@rogieking/figui3 6.9.2 → 6.9.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.
package/README.md CHANGED
@@ -25,7 +25,7 @@ FigUI3 components are built to preserve native semantics where possible and add
25
25
  - Selection components use standard keyboard patterns: tabs use roving focus and `aria-controls`, segmented controls expose a radio-group pattern with focus following arrow selection, choosers expose listbox/options, and menus support trigger state, item focus, Escape close, and disabled items.
26
26
  - Dialog, popup, tooltip, and toast surfaces expose names, close affordances, live-region behavior, Escape dismissal, and focus return behavior appropriate to their role.
27
27
  - Media components render their visual surface inside `fig-preview`; image/video semantics stay on the native media element, upload controls remain keyboard reachable, slotted image overlays stay in light DOM for framework ownership, and generated video controls render below the preview instead of as an overlay.
28
- - Display and pointer components expose useful semantics when interactive or informative: handles, chits, color tips, layers, spinners, shimmers, and skeletons sync names, busy states, disabled states, keyboard movement, inert states, or hidden states as appropriate.
28
+ - Display and pointer components expose useful semantics when interactive or informative: handles, swatches, color tips, layers, spinners, shimmers, and skeletons sync names, busy states, disabled states, keyboard movement, inert states, or hidden states as appropriate.
29
29
  - Focus styling uses shared `--figma-focus-outline`, `--figma-focus-outline-offset`, and `--figma-focus-outline-radius` tokens so visible focus treatment stays consistent across components.
30
30
  - Component contracts include Playwright keyboard/focus coverage plus an axe smoke suite for representative form, media, overlay, selection, and loading fixtures.
31
31
 
@@ -92,7 +92,7 @@ Minimal example:
92
92
  | [Text Input](#text-input) | `<fig-input-text>` | Styled text/textarea input |
93
93
  | [Number Input](#number-input) | `<fig-input-number>` | Numeric input with units |
94
94
  | [Input Angle](#input-angle) | `<fig-input-angle>` | Angle/rotation dial and text input |
95
- | [Chit](#chit) | `<fig-chit>` | Color/gradient/image swatch |
95
+ | [Swatch](#swatch) | `<fig-swatch>` | Color/gradient/image swatch |
96
96
  | [Color Tip](#color-tip) | `<fig-color-tip>` | Compact color tip with picker |
97
97
  | [Color Input](#color-input) | `<fig-input-color>` | Color picker with hex/alpha |
98
98
  | [Input Palette](#input-palette) | `<fig-input-palette>` | Editable multi-color palette |
@@ -305,6 +305,10 @@ Wraps a `<fig-field>` and `<fig-slider>` into a single labeled control. All slid
305
305
 
306
306
  **Events:** `input`, `change` — forwarded from the inner slider.
307
307
 
308
+ Double-click or right-click and choose "Reset to default" to reset to the `default` value, falling back to the slider minimum.
309
+
310
+ **Methods:** `resetToDefault()` triggers the same reset behavior.
311
+
308
312
  ```html
309
313
  <fig-field-slider label="Opacity" min="0" max="100" value="75" units="%"></fig-field-slider>
310
314
  ```
@@ -388,9 +392,9 @@ Angle/rotation input with circular dial, optional text input, multi-unit support
388
392
 
389
393
  ### Color & Fill
390
394
 
391
- #### Chit
395
+ #### Swatch
392
396
 
393
- `<fig-chit>` — [demo](https://rog.ie/figui3/#chit)
397
+ `<fig-swatch>` — [demo](https://rog.ie/figui3/#swatch)
394
398
 
395
399
  A color/gradient/image swatch element with checkerboard background for alpha.
396
400
 
@@ -403,8 +407,8 @@ A color/gradient/image swatch element with checkerboard background for alpha.
403
407
  | `alpha` | number | — | Opacity (0-1) |
404
408
 
405
409
  ```html
406
- <fig-chit background="#FF5733"></fig-chit>
407
- <fig-chit background="linear-gradient(90deg, #FF0000, #0000FF)" size="large"></fig-chit>
410
+ <fig-swatch background="#FF5733"></fig-swatch>
411
+ <fig-swatch background="linear-gradient(90deg, #FF0000, #0000FF)" size="large"></fig-swatch>
408
412
  ```
409
413
 
410
414
  ---
@@ -584,7 +588,7 @@ Optional full fill picker dialog supporting solid, gradient, image, video, and w
584
588
 
585
589
  ```html
586
590
  <fig-fill-picker value='{"type":"solid","color":"#FF5733"}'>
587
- <fig-chit></fig-chit>
591
+ <fig-swatch></fig-swatch>
588
592
  </fig-fill-picker>
589
593
  ```
590
594
 
@@ -1034,9 +1038,12 @@ Triggered menu with native keyboard patterns. The trigger gets `aria-haspopup="m
1034
1038
  | `position` | string | `"bottom left"` | Popup placement |
1035
1039
  | `offset` | string | — | Popup offset |
1036
1040
  | `closedby` | string | — | Popup close behavior |
1041
+ | `trigger` | string | — | Use `"contextmenu"` to open on right-click |
1037
1042
 
1038
1043
  **Keyboard:** Arrow keys move between enabled items, Home/End jump to edges, Enter/Space selects, Escape closes and returns focus to the trigger.
1039
1044
 
1045
+ **Methods:** `showAt(x, y)` opens the menu at viewport coordinates, useful for custom context menu behavior.
1046
+
1040
1047
  ```html
1041
1048
  <fig-menu position="bottom left">
1042
1049
  <fig-button fig-menu-trigger>Actions</fig-button>
package/components.css CHANGED
@@ -293,7 +293,7 @@
293
293
  rgba(255, 255, 255, 0.2) 0% 50%
294
294
  )
295
295
  0 0 / 0.5rem 0.5rem;
296
- --checkerboard-chit: repeating-conic-gradient(
296
+ --checkerboard-swatch: repeating-conic-gradient(
297
297
  rgba(0, 0, 0, 0.2) 0% 25%,
298
298
  rgba(255, 255, 255, 0.2) 0% 50%
299
299
  )
@@ -1466,15 +1466,15 @@ input[type="color"] {
1466
1466
  }
1467
1467
  }
1468
1468
 
1469
- fig-chit {
1469
+ fig-swatch {
1470
1470
  --size: 1.5rem;
1471
1471
  --padding: 5px;
1472
1472
  --width: var(--size);
1473
1473
  --height: var(--size);
1474
1474
  --border-radius: var(--radius-medium);
1475
- --chit-background: linear-gradient(#d9d9d9, #d9d9d9);
1476
- --chit-bg-size: cover;
1477
- --chit-bg-position: center;
1475
+ --swatch-background: linear-gradient(#d9d9d9, #d9d9d9);
1476
+ --swatch-bg-size: cover;
1477
+ --swatch-bg-position: center;
1478
1478
  --selected: 0;
1479
1479
  --alpha: 1;
1480
1480
 
@@ -1494,7 +1494,7 @@ fig-chit {
1494
1494
  grid-area: 1/1;
1495
1495
  }
1496
1496
  & > div {
1497
- background: var(--checkerboard-chit);
1497
+ background: var(--checkerboard-swatch);
1498
1498
  border-radius: var(--border-radius);
1499
1499
  }
1500
1500
 
@@ -1546,9 +1546,9 @@ fig-chit {
1546
1546
  }
1547
1547
  &::before {
1548
1548
  content: "";
1549
- background: var(--chit-background);
1550
- background-size: var(--chit-bg-size);
1551
- background-position: var(--chit-bg-position);
1549
+ background: var(--swatch-background);
1550
+ background-size: var(--swatch-bg-size);
1551
+ background-position: var(--swatch-bg-position);
1552
1552
  background-repeat: no-repeat;
1553
1553
  border-radius: calc(var(--border-radius) - (var(--padding) / 2));
1554
1554
  mask-image: linear-gradient(
@@ -2020,7 +2020,7 @@ fig-3d-rotate {
2020
2020
  width: var(--figma-3d-rotate-handle-size);
2021
2021
  height: var(--figma-3d-rotate-handle-size);
2022
2022
  border-radius: 50%;
2023
- background: var(--figma-color-border-strong);
2023
+ background: var(--figma-color-icon-brand);
2024
2024
  top: 50%;
2025
2025
  left: 50%;
2026
2026
  transform: translate(-50%, -50%);
@@ -2340,7 +2340,7 @@ fig-combo-input fig-button[type="select"] {
2340
2340
  color: var(--figma-color-text);
2341
2341
  }
2342
2342
 
2343
- & > *:not(fig-chit){
2343
+ & > *:not(fig-swatch){
2344
2344
  &:first-child:not(:last-child),
2345
2345
  &:first-child:not(:last-child) > * {
2346
2346
  border-top-right-radius: 0;
@@ -3094,11 +3094,6 @@ dialog,
3094
3094
  display: flex;
3095
3095
  flex-direction: column;
3096
3096
  }
3097
- >fig-header{
3098
- fig-button[icon][variant="ghost"]:not(fig-input-text fig-button) {
3099
- margin: 0;
3100
- }
3101
- }
3102
3097
  }
3103
3098
  dialog[is="fig-dialog"] {
3104
3099
  --z-index: 999999;
@@ -3376,6 +3371,7 @@ fig-header {
3376
3371
  --fig-header-height: var(--spacer-6);
3377
3372
  height: var(--fig-header-height);
3378
3373
  flex-shrink: 0;
3374
+ width: 100%;
3379
3375
  margin: 0;
3380
3376
  padding: var(--spacer-1) var(--spacer-3);
3381
3377
  display: flex;
@@ -3405,6 +3401,7 @@ fig-header {
3405
3401
 
3406
3402
  fig-group {
3407
3403
  display: block;
3404
+ width: 100%;
3408
3405
  margin-bottom: var(--spacer-2-5);
3409
3406
 
3410
3407
  p{
@@ -3475,10 +3472,12 @@ fig-group {
3475
3472
  fig-footer {
3476
3473
  display: flex;
3477
3474
  flex-shrink: 0;
3475
+ width: 100%;
3476
+ flex-wrap: wrap;
3478
3477
  align-items: flex-start;
3479
3478
  justify-content: flex-end;
3480
3479
  gap: var(--spacer-2);
3481
- padding: var(--spacer-2-5) var(--spacer-3);
3480
+ padding: var(--spacer-2-5);
3482
3481
  box-shadow: inset 0 1px 0 0 var(--figma-color-border);
3483
3482
 
3484
3483
  & h3 {
@@ -3508,7 +3507,7 @@ fig-footer {
3508
3507
  text-align: center;
3509
3508
  }
3510
3509
 
3511
- &:has(> :is(fig-button, fig-tooltip) ~ :is(fig-button, fig-tooltip)) {
3510
+ /*&:has(> :is(fig-button, fig-tooltip) ~ :is(fig-button, fig-tooltip)) {
3512
3511
  flex-direction: column;
3513
3512
  align-items: stretch;
3514
3513
 
@@ -3526,7 +3525,7 @@ fig-footer {
3526
3525
  & > .fig-footer-action fig-button {
3527
3526
  width: 100%;
3528
3527
  }
3529
- }
3528
+ }*/
3530
3529
 
3531
3530
  &[borderless] {
3532
3531
  box-shadow: none;
@@ -3545,6 +3544,7 @@ main,
3545
3544
  fig-content {
3546
3545
  padding: var(--spacer-2-5) 0;
3547
3546
  display: block;
3547
+ width: 100%;
3548
3548
  gap: 0;
3549
3549
  &:has(>fig-group[name]:first-child){
3550
3550
  padding-top: 0;
@@ -3747,14 +3747,14 @@ fig-input-fill {
3747
3747
  outline-offset: -1px !important;
3748
3748
  }
3749
3749
 
3750
- & > .input-combo > fig-chit:not(:only-child),
3751
- & > .input-combo > fig-chit:not(:only-child) input,
3750
+ & > .input-combo > fig-swatch:not(:only-child),
3751
+ & > .input-combo > fig-swatch:not(:only-child) input,
3752
3752
  & > .input-combo > fig-fill-picker:not(:only-child),
3753
- & > .input-combo > fig-fill-picker:not(:only-child) > fig-chit > input,
3753
+ & > .input-combo > fig-fill-picker:not(:only-child) > fig-swatch > input,
3754
3754
  & > .input-combo > label,
3755
3755
  & fig-fill-picker:not(:only-child),
3756
3756
  fig-input-text,
3757
- fig-chit {
3757
+ fig-swatch {
3758
3758
  &,
3759
3759
  &:focus,
3760
3760
  &:hover {
@@ -3765,8 +3765,8 @@ fig-input-fill {
3765
3765
  --selected: 0;
3766
3766
  }
3767
3767
  }
3768
- fig-chit ~ fig-input-text > input,
3769
- fig-chit ~ label,
3768
+ fig-swatch ~ fig-input-text > input,
3769
+ fig-swatch ~ label,
3770
3770
  fig-fill-picker ~ fig-input-text > input {
3771
3771
  padding-left: 0 !important;
3772
3772
  }
@@ -3813,6 +3813,11 @@ fig-input-fill {
3813
3813
  }
3814
3814
  }
3815
3815
 
3816
+ fig-input-color,
3817
+ fig-input-fill {
3818
+ width: 8.9375rem;
3819
+ }
3820
+
3816
3821
  fig-input-fill {
3817
3822
  & > .input-combo > fig-fill-picker {
3818
3823
  display: contents;
@@ -3853,7 +3858,7 @@ fig-input-gradient {
3853
3858
  --fig-input-gradient-height: 1.5rem;
3854
3859
  --fig-input-gradient-padding: var(--spacer-1);
3855
3860
  --fig-input-gradient-handle-size: 14px;
3856
- --fig-input-gradient-chit-border-radius: var(--radius-large);
3861
+ --fig-input-gradient-swatch-border-radius: var(--radius-large);
3857
3862
  position: relative;
3858
3863
  height: var(--fig-input-gradient-height);
3859
3864
  width: 100%;
@@ -3890,13 +3895,13 @@ fig-input-gradient {
3890
3895
  .fig-input-gradient-track {
3891
3896
  inset: 0 calc(var(--fig-input-gradient-padding) + 2px);
3892
3897
  }
3893
- --fig-input-gradient-chit-border-radius: var(--radius-medium);
3898
+ --fig-input-gradient-swatch-border-radius: var(--radius-medium);
3894
3899
  }
3895
3900
 
3896
3901
  &[edit="false"],
3897
3902
  &[edit="picker"] {
3898
3903
  pointer-events: none;
3899
- --fig-input-gradient-chit-border-radius: var(--radius-medium);
3904
+ --fig-input-gradient-swatch-border-radius: var(--radius-medium);
3900
3905
 
3901
3906
  }
3902
3907
 
@@ -3905,15 +3910,15 @@ fig-input-gradient {
3905
3910
  display: contents;
3906
3911
  }
3907
3912
  }
3908
- & > fig-chit,
3909
- & > fig-fill-picker > fig-chit {
3913
+ & > fig-swatch,
3914
+ & > fig-fill-picker > fig-swatch {
3910
3915
  --width: 100%;
3911
3916
  width: var(--width);
3912
- --border-radius: var(--fig-input-gradient-chit-border-radius);
3917
+ --border-radius: var(--fig-input-gradient-swatch-border-radius);
3913
3918
  }
3914
3919
  &[size="large"] {
3915
3920
  --fig-input-gradient-height: 2rem;
3916
- --fig-input-gradient-chit-border-radius: var(--radius-medium);
3921
+ --fig-input-gradient-swatch-border-radius: var(--radius-medium);
3917
3922
  height: var(--fig-input-gradient-height) !important;
3918
3923
 
3919
3924
  .fig-input-gradient-track {
@@ -3994,7 +3999,7 @@ fig-input-palette {
3994
3999
  &:focus-within {
3995
4000
  outline: 0 !important;
3996
4001
  }
3997
- fig-chit {
4002
+ fig-swatch {
3998
4003
  --border-radius: 0px;
3999
4004
  --width: 100%;
4000
4005
  --padding: 0px;
@@ -4015,7 +4020,7 @@ fig-input-palette {
4015
4020
  }
4016
4021
  }
4017
4022
  &:first-child{
4018
- & fig-chit::after{
4023
+ & fig-swatch::after{
4019
4024
  box-shadow: none;
4020
4025
  }
4021
4026
  }
@@ -4068,7 +4073,7 @@ fig-input-palette {
4068
4073
  grid-column: button;
4069
4074
  }
4070
4075
 
4071
- fig-chit {
4076
+ fig-swatch {
4072
4077
  --border-radius: var(--radius-medium);
4073
4078
  width: auto !important;
4074
4079
  height: var(--size);
@@ -4751,6 +4756,20 @@ fig-icon {
4751
4756
  -webkit-mask-size: contain;
4752
4757
  -webkit-mask-repeat: no-repeat;
4753
4758
  -webkit-mask-position: center;
4759
+
4760
+ &:has(> svg) {
4761
+ background: transparent;
4762
+ mask-image: none;
4763
+ -webkit-mask-image: none;
4764
+ }
4765
+
4766
+ & > svg {
4767
+ display: block;
4768
+ width: 100%;
4769
+ height: 100%;
4770
+ color: inherit;
4771
+ flex-shrink: 0;
4772
+ }
4754
4773
  }
4755
4774
 
4756
4775
  @keyframes fig-spinner-spin {
@@ -5162,6 +5181,7 @@ fig-handle {
5162
5181
  }
5163
5182
 
5164
5183
  fig-color-tip {
5184
+ --size: 1.5rem;
5165
5185
  --tip-selection-width: 1px;
5166
5186
  --tip-selection-scale: 1;
5167
5187
  --beak-offset: 50%;
@@ -5174,10 +5194,10 @@ fig-color-tip {
5174
5194
  position: relative;
5175
5195
  color: var(--figma-color-text);
5176
5196
  color-scheme: light only;
5197
+ width: var(--size);
5198
+ height: var(--size);
5177
5199
  aspect-ratio: 1 / 1;
5178
5200
  flex-shrink: 0;
5179
- min-width: max-content;
5180
- min-height: max-content;
5181
5201
  background-color: var(--figma-color-bg);
5182
5202
  border-radius: var(--radius-medium, 0.3125rem);
5183
5203
  box-shadow: inset 0 0.5px 0 0 rgba(255, 255, 255, 0.1);
@@ -5190,7 +5210,7 @@ fig-color-tip {
5190
5210
  cursor: pointer;
5191
5211
  }
5192
5212
 
5193
- fig-chit {
5213
+ fig-swatch {
5194
5214
  input[type="color"] {
5195
5215
  background: transparent;
5196
5216
  }