@rogieking/figui3 2.13.2 → 2.15.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.
package/README.md CHANGED
@@ -911,6 +911,36 @@ const onChange = (e) => {
911
911
 
912
912
  ---
913
913
 
914
+ ## Breaking Changes / Migration
915
+
916
+ ### v2.15.0: Experimental Features
917
+
918
+ The `experimental` attribute now controls experimental CSS features instead of `variant="neue"`.
919
+
920
+ **Before (deprecated):**
921
+ ```html
922
+ <fig-dropdown variant="neue">
923
+ <option>Option 1</option>
924
+ </fig-dropdown>
925
+ ```
926
+
927
+ **After:**
928
+ ```html
929
+ <fig-dropdown experimental="modern">
930
+ <option>Option 1</option>
931
+ </fig-dropdown>
932
+ ```
933
+
934
+ The `experimental` attribute uses space-separated feature names for granular control:
935
+ - `experimental="modern"` - Enables the customizable select picker (`::picker(select)`, `appearance: base-select`)
936
+ - Future features can be added: `experimental="modern popover"`
937
+
938
+ Note: `variant="neue"` on `fig-slider` continues to work for visual styling.
939
+
940
+ See [CHANGELOG.md](CHANGELOG.md) for full details.
941
+
942
+ ---
943
+
914
944
  ## Theming
915
945
 
916
946
  FigUI3 automatically adapts to light and dark themes using CSS custom properties. The library uses Figma's color variable naming convention:
package/components.css CHANGED
@@ -478,7 +478,7 @@ input[type="text"][list] {
478
478
  }
479
479
 
480
480
  @supports (appearance: base-select) {
481
- fig-dropdown[variant="neue"] {
481
+ fig-dropdown[experimental~="modern"] {
482
482
  &[type="dropdown"] {
483
483
  select:before {
484
484
  content: attr(aria-label);
@@ -517,11 +517,14 @@ input[type="text"][list] {
517
517
 
518
518
  option {
519
519
  display: flex;
520
- gap: var(--spacer-1);
520
+ gap: var(--spacer-2);
521
521
  padding: 0 var(--spacer-4) 0 calc(var(--spacer-1) * 2 + var(--spacer-1));
522
522
  font-weight: var(--body-medium-fontWeight);
523
523
  color: var(--figma-color-text-menu);
524
524
  position: relative;
525
+ & * {
526
+ color: inherit;
527
+ }
525
528
  &[hidden] {
526
529
  display: none;
527
530
  }
@@ -598,6 +601,7 @@ input[type="text"][list] {
598
601
  /* https://codepen.io/editor/argyleink/pen/019c1f28-bbc2-7bac-ad4a-a7e41d3730f1 */
599
602
  ::picker(select) {
600
603
  appearance: base-select;
604
+ color-scheme: dark;
601
605
 
602
606
  /* Appearance/style */
603
607
  scrollbar-width: thin;
@@ -2412,7 +2416,7 @@ fig-slider {
2412
2416
  }
2413
2417
 
2414
2418
  & fig-input-number {
2415
- width: 5rem;
2419
+ flex-basis: 5rem;
2416
2420
  }
2417
2421
  }
2418
2422
 
package/fig.js CHANGED
@@ -1445,6 +1445,9 @@ class FigSlider extends HTMLElement {
1445
1445
  this.units = this.getAttribute("units") || "";
1446
1446
  this.transform = Number(this.getAttribute("transform") || 1);
1447
1447
  this.disabled = this.getAttribute("disabled") ? true : false;
1448
+ this.precision = this.hasAttribute("precision")
1449
+ ? Number(this.getAttribute("precision"))
1450
+ : null;
1448
1451
 
1449
1452
  const defaults = this.#typeDefaults[this.type];
1450
1453
  this.min = Number(this.getAttribute("min") || defaults.min);
@@ -1481,7 +1484,8 @@ class FigSlider extends HTMLElement {
1481
1484
  transform="${this.transform}"
1482
1485
  step="${this.step}"
1483
1486
  value="${this.value}"
1484
- ${this.units ? `units="${this.units}"` : ""}>
1487
+ ${this.units ? `units="${this.units}"` : ""}
1488
+ ${this.precision !== null ? `precision="${this.precision}"` : ""}>
1485
1489
  </fig-input-number>`;
1486
1490
  } else {
1487
1491
  html = slider;
@@ -1654,6 +1658,7 @@ class FigSlider extends HTMLElement {
1654
1658
  "transform",
1655
1659
  "text",
1656
1660
  "default",
1661
+ "precision",
1657
1662
  ];
1658
1663
  }
1659
1664
 
@@ -1690,6 +1695,16 @@ class FigSlider extends HTMLElement {
1690
1695
  this.figInputNumber.setAttribute("transform", this.transform);
1691
1696
  }
1692
1697
  break;
1698
+ case "precision":
1699
+ this.precision = newValue !== null ? Number(newValue) : null;
1700
+ if (this.figInputNumber) {
1701
+ if (this.precision !== null) {
1702
+ this.figInputNumber.setAttribute("precision", this.precision);
1703
+ } else {
1704
+ this.figInputNumber.removeAttribute("precision");
1705
+ }
1706
+ }
1707
+ break;
1693
1708
  case "default":
1694
1709
  this.default = newValue;
1695
1710
  this.#syncProperties();
@@ -2011,6 +2026,7 @@ class FigInputNumber extends HTMLElement {
2011
2026
  #boundKeyDown;
2012
2027
  #units;
2013
2028
  #unitPosition;
2029
+ #precision;
2014
2030
 
2015
2031
  constructor() {
2016
2032
  super();
@@ -2045,6 +2061,9 @@ class FigInputNumber extends HTMLElement {
2045
2061
  this.name = this.getAttribute("name") || null;
2046
2062
  this.#units = this.getAttribute("units") || "";
2047
2063
  this.#unitPosition = this.getAttribute("unit-position") || "suffix";
2064
+ this.#precision = this.hasAttribute("precision")
2065
+ ? Number(this.getAttribute("precision"))
2066
+ : 2;
2048
2067
 
2049
2068
  if (this.getAttribute("step")) {
2050
2069
  this.step = Number(this.getAttribute("step"));
@@ -2331,10 +2350,12 @@ class FigInputNumber extends HTMLElement {
2331
2350
  return sanitized;
2332
2351
  }
2333
2352
 
2334
- #formatNumber(num, precision = 2) {
2335
- // Check if the number has any decimal places after rounding
2336
- const rounded = Math.round(num * 100) / 100;
2337
- return Number.isInteger(rounded) ? rounded : rounded.toFixed(precision);
2353
+ #formatNumber(num) {
2354
+ const precision = this.#precision ?? 2;
2355
+ const factor = Math.pow(10, precision);
2356
+ const rounded = Math.round(num * factor) / factor;
2357
+ // Only show decimals if needed and up to precision
2358
+ return Number.isInteger(rounded) ? rounded : parseFloat(rounded.toFixed(precision));
2338
2359
  }
2339
2360
 
2340
2361
  static get observedAttributes() {
@@ -2350,6 +2371,7 @@ class FigInputNumber extends HTMLElement {
2350
2371
  "units",
2351
2372
  "unit-position",
2352
2373
  "steppers",
2374
+ "precision",
2353
2375
  ];
2354
2376
  }
2355
2377
 
@@ -2386,6 +2408,10 @@ class FigInputNumber extends HTMLElement {
2386
2408
  case "step":
2387
2409
  this[name] = Number(newValue);
2388
2410
  break;
2411
+ case "precision":
2412
+ this.#precision = newValue !== null ? Number(newValue) : 2;
2413
+ this.input.value = this.#formatWithUnit(this.value);
2414
+ break;
2389
2415
  case "name":
2390
2416
  this[name] = this.input[name] = newValue;
2391
2417
  this.input.setAttribute("name", newValue);
@@ -2512,6 +2538,8 @@ class FigInputColor extends HTMLElement {
2512
2538
  const useFigmaPicker = this.picker === "figma";
2513
2539
  const hidePicker = this.picker === "false";
2514
2540
  const showAlpha = this.getAttribute("alpha") === "true";
2541
+ const experimental = this.getAttribute("experimental");
2542
+ const expAttr = experimental ? `experimental="${experimental}"` : "";
2515
2543
 
2516
2544
  let html = ``;
2517
2545
  if (this.getAttribute("text")) {
@@ -2536,7 +2564,7 @@ class FigInputColor extends HTMLElement {
2536
2564
  let swatchElement = "";
2537
2565
  if (!hidePicker) {
2538
2566
  swatchElement = useFigmaPicker
2539
- ? `<fig-fill-picker mode="solid" ${
2567
+ ? `<fig-fill-picker mode="solid" ${expAttr} ${
2540
2568
  showAlpha ? "" : 'alpha="false"'
2541
2569
  } value='{"type":"solid","color":"${this.hexOpaque}","opacity":${
2542
2570
  this.alpha
@@ -2554,7 +2582,7 @@ class FigInputColor extends HTMLElement {
2554
2582
  html = ``;
2555
2583
  } else {
2556
2584
  html = useFigmaPicker
2557
- ? `<fig-fill-picker mode="solid" ${
2585
+ ? `<fig-fill-picker mode="solid" ${expAttr} ${
2558
2586
  showAlpha ? "" : 'alpha="false"'
2559
2587
  } value='{"type":"solid","color":"${this.hexOpaque}","opacity":${
2560
2588
  this.alpha
@@ -2746,7 +2774,7 @@ class FigInputColor extends HTMLElement {
2746
2774
  }
2747
2775
 
2748
2776
  static get observedAttributes() {
2749
- return ["value", "style", "mode", "picker"];
2777
+ return ["value", "style", "mode", "picker", "experimental"];
2750
2778
  }
2751
2779
 
2752
2780
  get mode() {
@@ -2928,7 +2956,7 @@ class FigInputFill extends HTMLElement {
2928
2956
  }
2929
2957
 
2930
2958
  static get observedAttributes() {
2931
- return ["value", "disabled", "mode"];
2959
+ return ["value", "disabled", "mode", "experimental"];
2932
2960
  }
2933
2961
 
2934
2962
  connectedCallback() {
@@ -3079,11 +3107,12 @@ class FigInputFill extends HTMLElement {
3079
3107
  }
3080
3108
 
3081
3109
  const modeAttr = this.getAttribute("mode");
3110
+ const experimentalAttr = this.getAttribute("experimental");
3082
3111
  this.innerHTML = `
3083
3112
  <div class="input-combo">
3084
3113
  <fig-fill-picker value='${fillPickerValue}' ${
3085
3114
  disabled ? "disabled" : ""
3086
- } ${modeAttr ? `mode="${modeAttr}"` : ""}></fig-fill-picker>
3115
+ } ${modeAttr ? `mode="${modeAttr}"` : ""} ${experimentalAttr ? `experimental="${experimentalAttr}"` : ""}></fig-fill-picker>
3087
3116
  ${controlsHtml}
3088
3117
  </div>`;
3089
3118
 
@@ -3525,6 +3554,17 @@ class FigInputFill extends HTMLElement {
3525
3554
  this.#render();
3526
3555
  }
3527
3556
  break;
3557
+ case "mode":
3558
+ case "experimental":
3559
+ // Pass through to internal fill picker
3560
+ if (this.#fillPicker) {
3561
+ if (newValue) {
3562
+ this.#fillPicker.setAttribute(name, newValue);
3563
+ } else {
3564
+ this.#fillPicker.removeAttribute(name);
3565
+ }
3566
+ }
3567
+ break;
3528
3568
  }
3529
3569
  }
3530
3570
  }
@@ -3870,6 +3910,8 @@ class FigComboInput extends HTMLElement {
3870
3910
  this.options = this.getOptionsFromAttribute();
3871
3911
  this.placeholder = this.getAttribute("placeholder") || "";
3872
3912
  this.value = this.getAttribute("value") || "";
3913
+ const experimental = this.getAttribute("experimental");
3914
+ const expAttr = experimental ? `experimental="${experimental}"` : "";
3873
3915
  this.innerHTML = `<div class="input-combo">
3874
3916
  <fig-input-text placeholder="${this.placeholder}">
3875
3917
  </fig-input-text>
@@ -3877,7 +3919,7 @@ class FigComboInput extends HTMLElement {
3877
3919
  <svg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'>
3878
3920
  <path d='M5.87868 7.12132L8 9.24264L10.1213 7.12132' stroke='currentColor' stroke-opacity="0.9" stroke-linecap='round'/>
3879
3921
  </svg>
3880
- <fig-dropdown type="dropdown">
3922
+ <fig-dropdown type="dropdown" ${expAttr}>
3881
3923
  ${this.options
3882
3924
  .map((option) => `<option>${option}</option>`)
3883
3925
  .join("")}
@@ -3906,7 +3948,7 @@ class FigComboInput extends HTMLElement {
3906
3948
  this.value = this.input.value;
3907
3949
  }
3908
3950
  static get observedAttributes() {
3909
- return ["options", "placeholder", "value", "disabled"];
3951
+ return ["options", "placeholder", "value", "disabled", "experimental"];
3910
3952
  }
3911
3953
  focus() {
3912
3954
  this.input.focus();
@@ -3953,6 +3995,15 @@ class FigComboInput extends HTMLElement {
3953
3995
  case "disabled":
3954
3996
  this.#applyDisabled(newValue !== null && newValue !== "false");
3955
3997
  break;
3998
+ case "experimental":
3999
+ if (this.dropdown) {
4000
+ if (newValue) {
4001
+ this.dropdown.setAttribute("experimental", newValue);
4002
+ } else {
4003
+ this.dropdown.removeAttribute("experimental");
4004
+ }
4005
+ }
4006
+ break;
3956
4007
  }
3957
4008
  }
3958
4009
  }
@@ -5297,7 +5348,7 @@ class FigFillPicker extends HTMLElement {
5297
5348
  }
5298
5349
 
5299
5350
  static get observedAttributes() {
5300
- return ["value", "disabled", "alpha", "mode"];
5351
+ return ["value", "disabled", "alpha", "mode", "experimental"];
5301
5352
  }
5302
5353
 
5303
5354
  connectedCallback() {
@@ -5581,6 +5632,9 @@ class FigFillPicker extends HTMLElement {
5581
5632
  }
5582
5633
 
5583
5634
  // Build header content - label if single mode, dropdown if multiple
5635
+ const experimental = this.getAttribute("experimental");
5636
+ const expAttr = experimental ? `experimental="${experimental}"` : "";
5637
+
5584
5638
  let headerContent;
5585
5639
  if (allowedModes.length === 1) {
5586
5640
  headerContent = `<span class="fig-fill-picker-type-label">${modeLabels[allowedModes[0]]}</span>`;
@@ -5588,7 +5642,7 @@ class FigFillPicker extends HTMLElement {
5588
5642
  const options = allowedModes
5589
5643
  .map((m) => `<option value="${m}">${modeLabels[m]}</option>`)
5590
5644
  .join("\n ");
5591
- headerContent = `<fig-dropdown class="fig-fill-picker-type" variant="neue" value="${this.#fillType}">
5645
+ headerContent = `<fig-dropdown class="fig-fill-picker-type" ${expAttr} value="${this.#fillType}">
5592
5646
  ${options}
5593
5647
  </fig-dropdown>`;
5594
5648
  }
@@ -5827,10 +5881,17 @@ class FigFillPicker extends HTMLElement {
5827
5881
  ctx.fillRect(0, 0, width, height);
5828
5882
  }
5829
5883
 
5830
- #updateHandlePosition() {
5884
+ #updateHandlePosition(retryCount = 0) {
5831
5885
  if (!this.#colorAreaHandle || !this.#colorArea) return;
5832
5886
 
5833
5887
  const rect = this.#colorArea.getBoundingClientRect();
5888
+
5889
+ // If the canvas isn't visible yet (0 dimensions), schedule a retry (max 5 attempts)
5890
+ if ((rect.width === 0 || rect.height === 0) && retryCount < 5) {
5891
+ requestAnimationFrame(() => this.#updateHandlePosition(retryCount + 1));
5892
+ return;
5893
+ }
5894
+
5834
5895
  const x = (this.#color.s / 100) * rect.width;
5835
5896
  const y = ((100 - this.#color.v) / 100) * rect.height;
5836
5897
 
@@ -5917,10 +5978,12 @@ class FigFillPicker extends HTMLElement {
5917
5978
  // ============ GRADIENT TAB ============
5918
5979
  #initGradientTab() {
5919
5980
  const container = this.#dialog.querySelector('[data-tab="gradient"]');
5981
+ const experimental = this.getAttribute("experimental");
5982
+ const expAttr = experimental ? `experimental="${experimental}"` : "";
5920
5983
 
5921
5984
  container.innerHTML = `
5922
5985
  <div class="fig-fill-picker-gradient-header">
5923
- <fig-dropdown class="fig-fill-picker-gradient-type" value="${
5986
+ <fig-dropdown class="fig-fill-picker-gradient-type" ${expAttr} value="${
5924
5987
  this.#gradient.type
5925
5988
  }">
5926
5989
  <option value="linear" selected>Linear</option>
package/index.html CHANGED
@@ -654,6 +654,12 @@
654
654
  <fig-combo-input options="Red, Green, Blue, Yellow, Purple"
655
655
  value="Blue"
656
656
  placeholder="Select a color"></fig-combo-input>
657
+
658
+ <h3>Experimental Modern</h3>
659
+ <p class="description">Uses the modern CSS picker styling for the dropdown.</p>
660
+ <fig-combo-input options="House, Apartment, Condo, Townhouse, Other"
661
+ experimental="modern"
662
+ placeholder="Type of residence"></fig-combo-input>
657
663
  </section>
658
664
  <hr>
659
665
 
@@ -840,7 +846,7 @@
840
846
  <p class="description">A select dropdown menu with options.</p>
841
847
 
842
848
  <h3>Default</h3>
843
- <fig-dropdown variant="neue">
849
+ <fig-dropdown>
844
850
  <optgroup label="Numbers">
845
851
  <option>One</option>
846
852
  <option>Two</option>
@@ -854,8 +860,7 @@
854
860
  </fig-dropdown>
855
861
 
856
862
  <h3>Full Width</h3>
857
- <fig-dropdown full
858
- variant="neue">
863
+ <fig-dropdown full>
859
864
  <option>Full Width Dropdown</option>
860
865
  <option>Option Two</option>
861
866
  <option>Option Three</option>
@@ -865,8 +870,7 @@
865
870
  <p style="font-size: 12px; color: var(--figma-color-text-secondary); margin-bottom: 8px;">
866
871
  Uses <code>field-sizing: content</code> to resize based on selected option.
867
872
  </p>
868
- <fig-dropdown autoresize
869
- variant="neue">
873
+ <fig-dropdown autoresize>
870
874
  <option>XS</option>
871
875
  <option>Small</option>
872
876
  <option>Medium</option>
@@ -875,8 +879,27 @@
875
879
  <option>XXL Super Extended Option</option>
876
880
  </fig-dropdown>
877
881
 
878
- <h3>Dropdown Neue Variant (with many options)</h3>
879
- <fig-dropdown variant="neue"
882
+ <h3>Experimental Modern</h3>
883
+ <p class="description">
884
+ Use <code>experimental="modern"</code> to enable the customizable select picker using
885
+ <code>::picker(select)</code> and <code>appearance: base-select</code>. This is a progressive
886
+ enhancement that falls back to native select on unsupported browsers.
887
+ </p>
888
+ <fig-dropdown experimental="modern">
889
+ <optgroup label="Numbers">
890
+ <option>One</option>
891
+ <option>Two</option>
892
+ <option>Three</option>
893
+ </optgroup>
894
+ <optgroup label="Fruits">
895
+ <option>Apple</option>
896
+ <option>Banana</option>
897
+ <option>Cherry</option>
898
+ </optgroup>
899
+ </fig-dropdown>
900
+
901
+ <h3>Experimental Modern - Dropdown Type (with many options)</h3>
902
+ <fig-dropdown experimental="modern"
880
903
  type="dropdown"
881
904
  label="Choose">
882
905
  <optgroup label="North America">
@@ -1007,9 +1030,9 @@
1007
1030
  </optgroup>
1008
1031
  </fig-dropdown>
1009
1032
 
1010
- <h3>Select Neue Variant (with many options)</h3>
1033
+ <h3>Experimental Modern - Select Type (with many options)</h3>
1011
1034
 
1012
- <fig-dropdown variant="neue">
1035
+ <fig-dropdown experimental="modern">
1013
1036
  <optgroup label="North America">
1014
1037
  <option value="us">United States</option>
1015
1038
  <option value="ca">Canada</option>
@@ -1137,6 +1160,41 @@
1137
1160
  <option value="zeplin">Zeplin</option>
1138
1161
  </optgroup>
1139
1162
  </fig-dropdown>
1163
+
1164
+ <h3>Experimental Modern - With Icons (Bleeding Edge)</h3>
1165
+ <p class="description">
1166
+ Using icons inside options requires <code>appearance: base-select</code> support.
1167
+ This is bleeding edge and may not work in all browsers.
1168
+ </p>
1169
+ <fig-dropdown experimental="modern">
1170
+ <option value="home">
1171
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1172
+ <path d="M2 6.5L8 2L14 6.5V13.5C14 14 13.5 14.5 13 14.5H3C2.5 14.5 2 14 2 13.5V6.5Z" stroke="currentColor" stroke-opacity="0.9" fill="none"/>
1173
+ </svg>
1174
+ <label>Home</label>
1175
+ </option>
1176
+ <option value="settings">
1177
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1178
+ <circle cx="8" cy="8" r="2" stroke="currentColor" stroke-opacity="0.9" fill="none"/>
1179
+ <path d="M8 1V3M8 13V15M1 8H3M13 8H15M2.5 2.5L4 4M12 12L13.5 13.5M2.5 13.5L4 12M12 4L13.5 2.5" stroke="currentColor" stroke-opacity="0.9"/>
1180
+ </svg>
1181
+ <label>Settings</label>
1182
+ </option>
1183
+ <option value="user">
1184
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1185
+ <circle cx="8" cy="5" r="3" stroke="currentColor" stroke-opacity="0.9" fill="none"/>
1186
+ <path d="M2 14C2 11 4.5 9 8 9C11.5 9 14 11 14 14" stroke="currentColor" stroke-opacity="0.9" fill="none"/>
1187
+ </svg>
1188
+ <label>User Profile</label>
1189
+ </option>
1190
+ <option value="search">
1191
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1192
+ <circle cx="6.5" cy="6.5" r="4" stroke="currentColor" stroke-opacity="0.9" fill="none"/>
1193
+ <path d="M10 10L14 14" stroke="currentColor" stroke-opacity="0.9"/>
1194
+ </svg>
1195
+ <label>Search</label>
1196
+ </option>
1197
+ </fig-dropdown>
1140
1198
  </section>
1141
1199
  <hr>
1142
1200
 
@@ -1840,6 +1898,31 @@
1840
1898
  steppers="true"></fig-input-number>
1841
1899
  </fig-field>
1842
1900
 
1901
+ <h3>With Precision</h3>
1902
+ <p class="description">Control decimal places with the <code>precision</code> attribute.</p>
1903
+ <fig-field direction="horizontal">
1904
+ <label>Default (2)</label>
1905
+ <fig-input-number value="3.14159"
1906
+ step="0.001"></fig-input-number>
1907
+ </fig-field>
1908
+ <fig-field direction="horizontal">
1909
+ <label>Precision 0</label>
1910
+ <fig-input-number value="3.14159"
1911
+ precision="0"></fig-input-number>
1912
+ </fig-field>
1913
+ <fig-field direction="horizontal">
1914
+ <label>Precision 1</label>
1915
+ <fig-input-number value="3.14159"
1916
+ precision="1"
1917
+ step="0.1"></fig-input-number>
1918
+ </fig-field>
1919
+ <fig-field direction="horizontal">
1920
+ <label>Precision 4</label>
1921
+ <fig-input-number value="3.14159"
1922
+ precision="4"
1923
+ step="0.0001"></fig-input-number>
1924
+ </fig-field>
1925
+
1843
1926
  <h3>States</h3>
1844
1927
  <fig-field direction="horizontal">
1845
1928
  <label>Disabled</label>
@@ -2645,6 +2728,64 @@
2645
2728
  text="true"
2646
2729
  units="%"></fig-slider>
2647
2730
 
2731
+ <h3>With Precision</h3>
2732
+ <p class="description">Control decimal places in the text input with the <code>precision</code> attribute.</p>
2733
+ <fig-field direction="horizontal">
2734
+ <label>Precision 0</label>
2735
+ <fig-slider min="0"
2736
+ max="100"
2737
+ value="33"
2738
+ text="true"
2739
+ precision="0"></fig-slider>
2740
+ </fig-field>
2741
+ <fig-field direction="horizontal">
2742
+ <label>Precision 1</label>
2743
+ <fig-slider min="0"
2744
+ max="10"
2745
+ value="3.5"
2746
+ step="0.1"
2747
+ text="true"
2748
+ precision="1"></fig-slider>
2749
+ </fig-field>
2750
+ <fig-field direction="horizontal">
2751
+ <label>Precision 3</label>
2752
+ <fig-slider min="0"
2753
+ max="1"
2754
+ value="0.333"
2755
+ step="0.001"
2756
+ text="true"
2757
+ precision="3"></fig-slider>
2758
+ </fig-field>
2759
+ <fig-field direction="horizontal">
2760
+ <label>Neue - Precision 0</label>
2761
+ <fig-slider min="0"
2762
+ max="100"
2763
+ value="33"
2764
+ text="true"
2765
+ precision="0"
2766
+ variant="neue"></fig-slider>
2767
+ </fig-field>
2768
+ <fig-field direction="horizontal">
2769
+ <label>Neue - Precision 1</label>
2770
+ <fig-slider min="0"
2771
+ max="10"
2772
+ value="3.5"
2773
+ step="0.1"
2774
+ text="true"
2775
+ precision="1"
2776
+ variant="neue"></fig-slider>
2777
+ </fig-field>
2778
+ <fig-field direction="horizontal">
2779
+ <label>Neue - Precision 3</label>
2780
+ <fig-slider min="0"
2781
+ max="1"
2782
+ value="0.333"
2783
+ step="0.001"
2784
+ text="true"
2785
+ precision="3"
2786
+ variant="neue"></fig-slider>
2787
+ </fig-field>
2788
+
2648
2789
  <h3>Variants</h3>
2649
2790
  <fig-field direction="horizontal">
2650
2791
  <label>Default</label>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.13.2",
3
+ "version": "2.15.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",