@rogieking/figui3 2.10.2 → 2.10.4

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 (3) hide show
  1. package/components.css +76 -84
  2. package/fig.js +11 -2
  3. package/package.json +1 -1
package/components.css CHANGED
@@ -193,10 +193,9 @@
193
193
  :root {
194
194
  /* Typography & Sizing */
195
195
  --font-size: 16px;
196
- --font-family:
197
- "Inter", AppleSystemUIFont, BlinkMacSystemFont, avenir next, avenir,
198
- segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial,
199
- sans-serif;
196
+ --font-family: "Inter", AppleSystemUIFont, BlinkMacSystemFont, avenir next,
197
+ avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto,
198
+ arial, sans-serif;
200
199
  --body-medium-fontSize: 0.6875rem;
201
200
  --body-large-fontSize: 0.8125rem;
202
201
  --body-letter-spacing: 0.055px;
@@ -305,19 +304,15 @@
305
304
  --icon-swap: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M8.35355 6.35355C8.54882 6.15829 8.54882 5.84171 8.35355 5.64645C8.15829 5.45118 7.84171 5.45118 7.64645 5.64645L5.14645 8.14645C4.95118 8.34171 4.95118 8.65829 5.14645 8.85355L7.64645 11.3536C7.84171 11.5488 8.15829 11.5488 8.35355 11.3536C8.54882 11.1583 8.54882 10.8417 8.35355 10.6464L6.70711 9H18.5C18.7761 9 19 8.77614 19 8.5C19 8.22386 18.7761 8 18.5 8H6.70711L8.35355 6.35355ZM15.6464 13.3536C15.4512 13.1583 15.4512 12.8417 15.6464 12.6464C15.8417 12.4512 16.1583 12.4512 16.3536 12.6464L18.8536 15.1464C19.0488 15.3417 19.0488 15.6583 18.8536 15.8536L16.3536 18.3536C16.1583 18.5488 15.8417 18.5488 15.6464 18.3536C15.4512 18.1583 15.4512 17.8417 15.6464 17.6464L17.2929 16H5.5C5.22386 16 5 15.7761 5 15.5C5 15.2239 5.22386 15 5.5 15H17.2929L15.6464 13.3536Z' fill='currentColor'/%3E%3C/svg%3E");
306
305
 
307
306
  /* Elevations - light theme defaults */
308
- --elevation-500-modal-window:
309
- 0px 0px 0.5px rgba(0, 0, 0, 0.08), 0px 10px 24px rgba(0, 0, 0, 0.18),
310
- 0px 2px 5px rgba(0, 0, 0, 0.15);
311
- --figma-elevation-100:
312
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 0px rgba(0, 0, 0, 0.15);
313
- --figma-elevation-200:
314
- 0px 1px 3px 0px rgba(0, 0, 0, 0.102), 0px 3px 8px 0px rgba(0, 0, 0, 0.102),
315
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.18);
316
- --figma-elevation-400-menu-panel:
317
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.12),
307
+ --elevation-500-modal-window: 0px 0px 0.5px rgba(0, 0, 0, 0.08),
308
+ 0px 10px 24px rgba(0, 0, 0, 0.18), 0px 2px 5px rgba(0, 0, 0, 0.15);
309
+ --figma-elevation-100: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.3),
310
+ 0px 1px 3px 0px rgba(0, 0, 0, 0.15);
311
+ --figma-elevation-200: 0px 1px 3px 0px rgba(0, 0, 0, 0.102),
312
+ 0px 3px 8px 0px rgba(0, 0, 0, 0.102), 0px 0px 0.5px 0px rgba(0, 0, 0, 0.18);
313
+ --figma-elevation-400-menu-panel: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.12),
318
314
  0px 10px 16px 0px rgba(0, 0, 0, 0.12), 0px 2px 5px 0px rgba(0, 0, 0, 0.15);
319
- --figma-elevation-500-modal-window:
320
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.08),
315
+ --figma-elevation-500-modal-window: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.08),
321
316
  0px 10px 24px 0px rgba(0, 0, 0, 0.18), 0px 2px 5px 0px rgba(0, 0, 0, 0.15);
322
317
  --handle-shadow: 0px 0 0 0.5px rgba(0, 0, 0, 0.1), var(--figma-elevation-200);
323
318
  }
@@ -326,48 +321,44 @@
326
321
  /* These cannot use light-dark() as they are complex values */
327
322
  @media (prefers-color-scheme: dark) {
328
323
  :root {
329
- --handle-shadow:
330
- 0px 0 0 0.75px 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
324
+ --handle-shadow: 0px 0 0 0.75px 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
331
325
  0px 0px 0.5px 0px rgba(255, 255, 255, 0.1);
332
- --figma-elevation-100:
333
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.5),
326
+ --figma-elevation-100: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.5),
334
327
  0px 0.75px 0px 0px rgba(255, 255, 255, 0.1) inset,
335
328
  0px 1px 3px 0px rgba(0, 0, 0, 0.4);
336
- --figma-elevation-200:
337
- 0px 3px 8px rgba(0, 0, 0, 0.35), 0px 1px 3px rgba(0, 0, 0, 0.5),
329
+ --figma-elevation-200: 0px 3px 8px rgba(0, 0, 0, 0.35),
330
+ 0px 1px 3px rgba(0, 0, 0, 0.5),
338
331
  inset 0px 0.5px 0px rgba(255, 255, 255, 0.08),
339
332
  inset 0px 0px 0.5px rgba(255, 255, 255, 0.3);
340
- --figma-elevation-400-menu-panel:
341
- 0px 0.5px 0px 0px rgba(255, 255, 255, 0.08) inset,
333
+ --figma-elevation-400-menu-panel: 0px 0.5px 0px 0px
334
+ rgba(255, 255, 255, 0.08) inset,
342
335
  0px 10px 16px 0px rgba(0, 0, 0, 0.35),
343
336
  inset 0px 0.75px 0px rgba(255, 255, 255, 0.075),
344
337
  0px 2px 5px 0px rgba(0, 0, 0, 0.35);
345
- --figma-elevation-500-modal-window:
346
- 0px 10px 24px rgba(0, 0, 0, 0.45), 0px 3px 5px rgba(0, 0, 0, 0.35),
338
+ --figma-elevation-500-modal-window: 0px 10px 24px rgba(0, 0, 0, 0.45),
339
+ 0px 3px 5px rgba(0, 0, 0, 0.35),
347
340
  inset 0px 0.75px 0px rgba(255, 255, 255, 0.1);
348
341
  }
349
342
  }
350
343
 
351
344
  /* Class-based dark theme override (for manual theme switching) */
352
345
  :root.figma-dark {
353
- --handle-shadow:
354
- 0px 0 0 0.75px 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
346
+ --handle-shadow: 0px 0 0 0.75px 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
355
347
  0px 0px 0.5px 0px rgba(255, 255, 255, 0.1);
356
- --figma-elevation-100:
357
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.5),
348
+ --figma-elevation-100: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.5),
358
349
  0px 0.75px 0px 0px rgba(255, 255, 255, 0.1) inset,
359
350
  0px 1px 3px 0px rgba(0, 0, 0, 0.4);
360
- --figma-elevation-200:
361
- 0px 3px 8px rgba(0, 0, 0, 0.35), 0px 1px 3px rgba(0, 0, 0, 0.5),
351
+ --figma-elevation-200: 0px 3px 8px rgba(0, 0, 0, 0.35),
352
+ 0px 1px 3px rgba(0, 0, 0, 0.5),
362
353
  inset 0px 0.5px 0px rgba(255, 255, 255, 0.08),
363
354
  inset 0px 0px 0.5px rgba(255, 255, 255, 0.3);
364
- --figma-elevation-400-menu-panel:
365
- 0px 0.5px 0px 0px rgba(255, 255, 255, 0.08) inset,
355
+ --figma-elevation-400-menu-panel: 0px 0.5px 0px 0px rgba(255, 255, 255, 0.08)
356
+ inset,
366
357
  0px 10px 16px 0px rgba(0, 0, 0, 0.35),
367
358
  inset 0px 0.75px 0px rgba(255, 255, 255, 0.075),
368
359
  0px 2px 5px 0px rgba(0, 0, 0, 0.35);
369
- --figma-elevation-500-modal-window:
370
- 0px 10px 24px rgba(0, 0, 0, 0.45), 0px 3px 5px rgba(0, 0, 0, 0.35),
360
+ --figma-elevation-500-modal-window: 0px 10px 24px rgba(0, 0, 0, 0.45),
361
+ 0px 3px 5px rgba(0, 0, 0, 0.35),
371
362
  inset 0px 0.75px 0px rgba(255, 255, 255, 0.1);
372
363
  }
373
364
 
@@ -490,8 +481,22 @@ input[type="text"][list] {
490
481
  }
491
482
  }
492
483
  select {
493
- appearance: base-select;
494
484
  --option-height: 1.5rem;
485
+ --max-width: 20rem;
486
+ @media (hover) and (pointer: fine) {
487
+ &,
488
+ &::picker(select) {
489
+ appearance: base-select;
490
+ }
491
+ }
492
+
493
+ max-inline-size: var(--max-width);
494
+ padding-block: 0;
495
+ will-change: scale;
496
+
497
+ @supports (-webkit-touch-callout: none) {
498
+ font-size: 16px;
499
+ }
495
500
 
496
501
  option::checkmark {
497
502
  content: var(--icon-checkmark);
@@ -580,9 +585,11 @@ input[type="text"][list] {
580
585
  display: none;
581
586
  }
582
587
 
588
+ /* https://codepen.io/editor/argyleink/pen/019c1f28-bbc2-7bac-ad4a-a7e41d3730f1 */
583
589
  ::picker(select) {
584
590
  appearance: base-select;
585
591
 
592
+ /* Appearance/style */
586
593
  scrollbar-width: thin;
587
594
  outline: 0;
588
595
  scrollbar-color: var(--figma-color-text-menu-tertiary)
@@ -598,7 +605,8 @@ input[type="text"][list] {
598
605
 
599
606
  input[type="text"][list],
600
607
  select {
601
- padding-right: 1.5rem;
608
+ padding-right: var(--spacer-4);
609
+ padding-left: var(--spacer-2);
602
610
  }
603
611
 
604
612
  /* Dropdown */
@@ -1111,8 +1119,7 @@ fig-chit {
1111
1119
  }
1112
1120
 
1113
1121
  &[selected]:not([selected="false"])::before {
1114
- box-shadow:
1115
- inset 0 0 0 1px var(--figma-color-border-selected),
1122
+ box-shadow: inset 0 0 0 1px var(--figma-color-border-selected),
1116
1123
  inset 0 0 0 3px var(--figma-color-bg);
1117
1124
  }
1118
1125
 
@@ -1468,10 +1475,8 @@ input[type="radio"] {
1468
1475
  border-radius: 100%;
1469
1476
  background-color: var(--figma-color-icon-onbrand);
1470
1477
  transform: scale(0);
1471
- box-shadow:
1472
- 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
1473
- 0px 1px 3px 0px rgba(0, 0, 0, 0.1),
1474
- 0px 3px 8px 0px rgba(0, 0, 0, 0.1),
1478
+ box-shadow: 0px 0 0 0.75px rgba(0, 0, 0, 0.1),
1479
+ 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 3px 8px 0px rgba(0, 0, 0, 0.1),
1475
1480
  0px 0px 0.5px 0px rgba(0, 0, 0, 0.18);
1476
1481
  }
1477
1482
  }
@@ -1568,12 +1573,12 @@ fig-slider {
1568
1573
  --slider-percent: calc(var(--slider-complete) * 100%);
1569
1574
  --start-percent: calc(var(--default, 0) * 100%);
1570
1575
  --slider-tick-size: calc(var(--slider-height) / 4);
1571
- --slider-handle-shadow:
1572
- inset 0 0 0 calc(4px + 0.5rem * var(--unchanged)) var(--handle-color),
1576
+ --slider-handle-shadow: inset 0 0 0 calc(4px + 0.5rem * var(--unchanged))
1577
+ var(--handle-color),
1573
1578
  0px 0 0 0.5px rgba(0, 0, 0, 0.1), var(--figma-elevation-200);
1574
- --slider-handle-shadow-focus:
1575
- inset 0 0 0 4px var(--handle-color), inset 0 0 0 5px rgba(0, 0, 0, 0.1),
1576
- var(--handle-shadow), 0 0 0 1px var(--figma-color-border-selected);
1579
+ --slider-handle-shadow-focus: inset 0 0 0 4px var(--handle-color),
1580
+ inset 0 0 0 5px rgba(0, 0, 0, 0.1), var(--handle-shadow),
1581
+ 0 0 0 1px var(--figma-color-border-selected);
1577
1582
  --slider-transition: all 0.1s ease-in-out;
1578
1583
  --handle-transition: var(--slider-transition);
1579
1584
 
@@ -1637,10 +1642,11 @@ fig-slider {
1637
1642
  );
1638
1643
  --width: calc(var(--slider-percent) - var(--start-percent));
1639
1644
  --abs-width: max(
1640
- var(--width) + var(--slider-height) / 2 +
1641
- (1 - var(--slider-complete)) * var(--slider-height),
1642
- -1 * var(--width) + var(--slider-height) / 2 +
1643
- (var(--slider-complete)) * var(--slider-height)
1645
+ var(--width) + var(--slider-height) / 2 + (1 - var(--slider-complete)) *
1646
+ var(--slider-height),
1647
+ -1 * var(--width) + var(--slider-height) / 2 + (
1648
+ var(--slider-complete)
1649
+ ) * var(--slider-height)
1644
1650
  );
1645
1651
  width: var(--abs-width);
1646
1652
  --delta: calc(var(--slider-complete) - var(--default));
@@ -1730,8 +1736,7 @@ fig-slider {
1730
1736
  }
1731
1737
 
1732
1738
  &.opacity::-webkit-slider-runnable-track {
1733
- background:
1734
- linear-gradient(to right, transparent, var(--color)),
1739
+ background: linear-gradient(to right, transparent, var(--color)),
1735
1740
  var(--checkerboard);
1736
1741
  }
1737
1742
  }
@@ -1805,8 +1810,7 @@ fig-slider {
1805
1810
  }
1806
1811
 
1807
1812
  &.opacity::-moz-range-track {
1808
- background:
1809
- linear-gradient(to right, transparent, var(--color)),
1813
+ background: linear-gradient(to right, transparent, var(--color)),
1810
1814
  var(--checkerboard);
1811
1815
  }
1812
1816
  }
@@ -1855,8 +1859,8 @@ fig-slider {
1855
1859
  --slider-tick-size: calc(var(--slider-height) / 2);
1856
1860
  --handle-transition: none;
1857
1861
  --slider-transition: none;
1858
- --slider-handle-shadow:
1859
- inset 0 0 0 calc(6px + 0.5rem * var(--unchanged)) var(--handle-color),
1862
+ --slider-handle-shadow: inset 0 0 0 calc(6px + 0.5rem * var(--unchanged))
1863
+ var(--handle-color),
1860
1864
  0 0 0 0.75px rgba(0, 0, 0, 0.075), inset 0 0 0 5px rgba(0, 0, 0, 0.1),
1861
1865
  var(--figma-elevation-200);
1862
1866
 
@@ -1884,8 +1888,8 @@ fig-slider {
1884
1888
  --slider-tick-size: calc(var(--slider-height) / 2);
1885
1889
  --handle-transition: none;
1886
1890
  --slider-transition: none;
1887
- --slider-handle-shadow:
1888
- inset 0 0 0 calc(6px + 0.5rem * var(--unchanged)) var(--handle-color),
1891
+ --slider-handle-shadow: inset 0 0 0 calc(6px + 0.5rem * var(--unchanged))
1892
+ var(--handle-color),
1889
1893
  0 0 0 0.75px rgba(0, 0, 0, 0.075), inset 0 0 0 5px rgba(0, 0, 0, 0.1),
1890
1894
  var(--figma-elevation-200);
1891
1895
 
@@ -1989,10 +1993,8 @@ dialog,
1989
1993
  text-overflow: ellipsis;
1990
1994
 
1991
1995
  border-radius: var(--radius-medium, 0.3125rem);
1992
- box-shadow:
1993
- 0px 0px 0.5px 0px rgba(0, 0, 0, 0.15),
1994
- 0px 5px 12px 0px rgba(0, 0, 0, 0.13),
1995
- 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
1996
+ box-shadow: 0px 0px 0.5px 0px rgba(0, 0, 0, 0.15),
1997
+ 0px 5px 12px 0px rgba(0, 0, 0, 0.13), 0px 1px 3px 0px rgba(0, 0, 0, 0.1);
1996
1998
 
1997
1999
  @supports (-webkit-line-clamp: 2) {
1998
2000
  white-space: initial;
@@ -2568,8 +2570,7 @@ fig-input-joystick {
2568
2570
  }
2569
2571
  }
2570
2572
  .fig-input-joystick-plane.dragging .fig-input-joystick-guides {
2571
- background:
2572
- linear-gradient(
2573
+ background: linear-gradient(
2573
2574
  45deg,
2574
2575
  transparent calc(50% - 0.5px),
2575
2576
  var(--figma-color-border) calc(50% - 0.5px),
@@ -2881,17 +2882,13 @@ fig-fill-picker {
2881
2882
  height: 1rem;
2882
2883
  border-radius: 50%;
2883
2884
  background: var(--picker-color);
2884
- box-shadow:
2885
- inset 0 0 0 0.125rem var(--handle-color),
2886
- 0px 0 0 0.5px rgba(0, 0, 0, 0.1),
2887
- var(--figma-elevation-200);
2885
+ box-shadow: inset 0 0 0 0.125rem var(--handle-color),
2886
+ 0px 0 0 0.5px rgba(0, 0, 0, 0.1), var(--figma-elevation-200);
2888
2887
  transform: translate(-50%, -50%);
2889
2888
  z-index: 1;
2890
2889
  &:hover {
2891
- box-shadow:
2892
- inset 0 0 0 0.25rem var(--handle-color),
2893
- 0px 0 0 0.5px rgba(0, 0, 0, 0.1),
2894
- var(--figma-elevation-200);
2890
+ box-shadow: inset 0 0 0 0.25rem var(--handle-color),
2891
+ 0px 0 0 0.5px rgba(0, 0, 0, 0.1), var(--figma-elevation-200);
2895
2892
  transform: translate(-50%, -50%);
2896
2893
  }
2897
2894
  }
@@ -3047,21 +3044,16 @@ fig-fill-picker {
3047
3044
  .fig-fill-picker-checkerboard {
3048
3045
  position: absolute;
3049
3046
  inset: 0;
3050
- background-image:
3051
- linear-gradient(45deg, var(--figma-color-bg-tertiary) 25%, transparent 25%),
3052
- linear-gradient(
3053
- -45deg,
3047
+ background-image: linear-gradient(
3048
+ 45deg,
3054
3049
  var(--figma-color-bg-tertiary) 25%,
3055
3050
  transparent 25%
3056
3051
  ),
3052
+ linear-gradient(-45deg, var(--figma-color-bg-tertiary) 25%, transparent 25%),
3057
3053
  linear-gradient(45deg, transparent 75%, var(--figma-color-bg-tertiary) 75%),
3058
3054
  linear-gradient(-45deg, transparent 75%, var(--figma-color-bg-tertiary) 75%);
3059
3055
  background-size: 16px 16px;
3060
- background-position:
3061
- 0 0,
3062
- 0 8px,
3063
- 8px -8px,
3064
- -8px 0px;
3056
+ background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
3065
3057
  }
3066
3058
 
3067
3059
  .fig-fill-picker-image-preview {
package/fig.js CHANGED
@@ -1984,9 +1984,17 @@ class FigInputNumber extends HTMLElement {
1984
1984
  }
1985
1985
  this.transform = Number(this.getAttribute("transform") || 1);
1986
1986
 
1987
+ const hasSteppers =
1988
+ this.hasAttribute("steppers") &&
1989
+ this.getAttribute("steppers") !== "false";
1990
+
1991
+ // Use type="number" when steppers are enabled (for native spin buttons)
1992
+ const inputType = hasSteppers ? "number" : "text";
1993
+ const inputMode = hasSteppers ? "" : 'inputmode="decimal"';
1994
+
1987
1995
  let html = `<input
1988
- type="text"
1989
- inputmode="decimal"
1996
+ type="${inputType}"
1997
+ ${inputMode}
1990
1998
  ${this.name ? `name="${this.name}"` : ""}
1991
1999
  placeholder="${this.placeholder}"
1992
2000
  value="${this.#formatWithUnit(this.value)}" />`;
@@ -2268,6 +2276,7 @@ class FigInputNumber extends HTMLElement {
2268
2276
  "name",
2269
2277
  "units",
2270
2278
  "unit-position",
2279
+ "steppers",
2271
2280
  ];
2272
2281
  }
2273
2282
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rogieking/figui3",
3
- "version": "2.10.2",
3
+ "version": "2.10.4",
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",