@rogieking/figui3 3.21.1 → 3.22.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.
@@ -111,8 +111,7 @@ bootstrap();
111
111
  - Use `transform` when internal value scale differs from UI display (example: internal `0..1`, display `0..100%`).
112
112
  - Variants:
113
113
  - Default variant for most property panels.
114
- - `variant="minimal"` for visually quieter contexts.
115
- - `variant="neue"` only where explicitly requested for that panel's style.
114
+ - `variant="neue"` for a compact, visually quieter style.
116
115
  - Always set explicit `min`, `max`, and `step` (and `units` where applicable) to keep behavior predictable.
117
116
 
118
117
  ### Control Selection Heuristics
@@ -176,7 +175,7 @@ Use a horizontal fig-field, with a fig-slider, min=0 max=100 text=true units=%.
176
175
  </fig-field>
177
176
  <fig-field direction="horizontal">
178
177
  <label>Hue</label>
179
- <fig-slider type="hue" value="180" text="true" variant="minimal" full></fig-slider>
178
+ <fig-slider type="hue" value="180" text="true" variant="neue" full></fig-slider>
180
179
  </fig-field>
181
180
  <fig-field direction="horizontal">
182
181
  <label>Offset</label>
package/README.md CHANGED
@@ -451,7 +451,7 @@ An editable palette of solid colors, each rendered as a `<fig-input-color>` swat
451
451
 
452
452
  ```html
453
453
  <fig-input-palette value='["#FF0000","#00FF00","#0000FF"]'></fig-input-palette>
454
- <fig-input-palette value='[{"color":"#FF0000","alpha":0.5},{"color":"#00FF00","alpha":1}]' expanded="true"></fig-input-palette>
454
+ <fig-input-palette value='[{"color":"#FF0000","alpha":0.5},{"color":"#00FF00","alpha":1}]' open></fig-input-palette>
455
455
  ```
456
456
 
457
457
  ---
package/components.css CHANGED
@@ -368,7 +368,7 @@
368
368
  inset 0px 0.75px 0px 0px light-dark(transparent, rgba(255, 255, 255, 0.1));
369
369
 
370
370
  --handle-shadow:
371
- 0px 0px 0px 0.5px rgba(0, 0, 0, 0.1),
371
+ 0px 0px 0px 1px rgba(0, 0, 0, 0.2),
372
372
  0px 0px 0.5px 0px light-dark(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.1)),
373
373
  0px 1px 3px 0px light-dark(rgba(0, 0, 0, 0.15), transparent);
374
374
  }
@@ -1178,7 +1178,7 @@ fig-chit {
1178
1178
  --width: var(--size);
1179
1179
  --height: var(--size);
1180
1180
  --border-radius: var(--radius-medium);
1181
- --chit-background: #d9d9d9;
1181
+ --chit-background: linear-gradient(#d9d9d9, #d9d9d9);
1182
1182
  --chit-bg-size: cover;
1183
1183
  --chit-bg-position: center;
1184
1184
  --selected: 0;
@@ -1194,9 +1194,14 @@ fig-chit {
1194
1194
 
1195
1195
  &::before,
1196
1196
  &::after,
1197
+ div,
1197
1198
  input {
1198
1199
  grid-area: 1/1;
1199
1200
  }
1201
+ & > div {
1202
+ background: var(--checkerboard-small);
1203
+ border-radius: var(--border-radius);
1204
+ }
1200
1205
 
1201
1206
  /* Selection ring */
1202
1207
  &[selected]:not([selected="false"]) {
@@ -1210,6 +1215,9 @@ fig-chit {
1210
1215
  &[selected]:not([selected="false"]) {
1211
1216
  --padding: 3px;
1212
1217
  }
1218
+ & > div {
1219
+ background: var(--checkerboard);
1220
+ }
1213
1221
  }
1214
1222
 
1215
1223
  &[size="medium"] {
@@ -1227,7 +1235,8 @@ fig-chit {
1227
1235
  }
1228
1236
 
1229
1237
  &::before,
1230
- &::after {
1238
+ &::after,
1239
+ & > div {
1231
1240
  content: "";
1232
1241
  width: calc(var(--width) - var(--padding) * 2);
1233
1242
  height: calc(var(--height) - var(--padding) * 2);
@@ -1242,12 +1251,10 @@ fig-chit {
1242
1251
  }
1243
1252
  &::before {
1244
1253
  content: "";
1245
- background: var(--chit-background), var(--checkerboard-small);
1246
- background-size:
1247
- var(--chit-bg-size),
1248
- 0.5rem 0.5rem;
1254
+ background: var(--chit-background);
1255
+ background-size: var(--chit-bg-size);
1249
1256
  background-position: var(--chit-bg-position);
1250
- background-repeat: no-repeat, repeat;
1257
+ background-repeat: no-repeat;
1251
1258
  border-radius: calc(var(--border-radius) - (var(--padding) / 2));
1252
1259
  mask-image: linear-gradient(
1253
1260
  to right,
@@ -1280,14 +1287,6 @@ fig-chit {
1280
1287
  display: none;
1281
1288
  }
1282
1289
  }
1283
-
1284
- /* Checkerboard for empty/missing images */
1285
- &[data-type="image"]:not([background])::after,
1286
- &[data-type="image"][background=""]::after,
1287
- &[data-type="image"][background="url()"]::after,
1288
- &[checkerboard]:not([checkerboard="false"])::after {
1289
- background: var(--checkerboard);
1290
- }
1291
1290
  }
1292
1291
 
1293
1292
  /* Fig Image */
@@ -1873,13 +1872,17 @@ fig-origin-grid {
1873
1872
 
1874
1873
  /* Switch */
1875
1874
  input[type="checkbox"].switch {
1875
+ --knob-width: 0.75rem;
1876
+ --knob-height: 0.5rem;
1877
+ --width: 2rem;
1878
+ --height: 1rem;
1876
1879
  contain: strict;
1877
1880
  display: inline-flex;
1878
1881
  margin: 0;
1879
1882
  vertical-align: middle;
1880
1883
  padding: 0;
1881
- width: 2rem;
1882
- height: 1rem;
1884
+ width: var(--width);
1885
+ height: var(--height);
1883
1886
  left: 0;
1884
1887
  top: 0;
1885
1888
  background: transparent;
@@ -1895,22 +1898,26 @@ input[type="checkbox"].switch {
1895
1898
  transition: var(--input-transition);
1896
1899
  box-sizing: border-box;
1897
1900
  box-shadow: inset 0 0 0 1px var(--figma-color-bordertranslucent);
1898
- }
1899
-
1900
- input[type="checkbox"].switch:after {
1901
- content: "";
1902
- background-color: var(--handle-color);
1903
- width: calc(1rem - 2px);
1904
- height: calc(1rem - 2px);
1905
- border-radius: 0.5rem;
1906
- margin: 1px;
1907
- transform: translate(calc(-0.5rem));
1908
- transition: var(--input-transition);
1909
- box-shadow: var(--handle-shadow);
1901
+ &:after {
1902
+ content: "";
1903
+ background-color: var(--handle-color);
1904
+ width: var(--knob-width);
1905
+ height: var(--knob-height);
1906
+ border-radius: 0.5rem;
1907
+ margin: 0.25rem;
1908
+ transform: translate(
1909
+ calc(
1910
+ (var(--width) - var(--knob-width)) * -0.5 +
1911
+ (var(--height) - var(--knob-height)) * 0.5
1912
+ )
1913
+ );
1914
+ transition: var(--input-transition);
1915
+ box-shadow: var(--handle-shadow);
1916
+ }
1910
1917
  }
1911
1918
 
1912
1919
  input[type="checkbox"].switch[indeterminate="true"]:after {
1913
- width: 0.5rem;
1920
+ width: 0.625rem;
1914
1921
  height: 0.125rem;
1915
1922
  transform: none;
1916
1923
  }
@@ -1921,14 +1928,29 @@ input[type="checkbox"].switch:checked {
1921
1928
  }
1922
1929
 
1923
1930
  input[type="checkbox"].switch:checked:after {
1924
- transform: translate(0.5rem);
1931
+ transform: translate(
1932
+ calc(
1933
+ (var(--width) - var(--knob-width)) * 0.5 +
1934
+ (var(--height) - var(--knob-height)) * -0.5
1935
+ )
1936
+ );
1925
1937
  }
1926
1938
 
1927
1939
  input[type="checkbox"].switch:disabled {
1928
- background-color: var(--figma-color-bg-secondary);
1940
+ background-color: transparent;
1929
1941
  cursor: not-allowed;
1930
1942
  &:after {
1931
- background-color: var(--figma-color-bg);
1943
+ background-color: var(--figma-color-icon-disabled);
1944
+ box-shadow: none;
1945
+ }
1946
+
1947
+ &:checked,
1948
+ &[indeterminate="true"] {
1949
+ background-color: var(--figma-color-bg-disabled);
1950
+ box-shadow: none;
1951
+ &:after {
1952
+ background-color: var(--figma-color-bg);
1953
+ }
1932
1954
  }
1933
1955
  }
1934
1956
 
@@ -2454,37 +2476,6 @@ fig-slider {
2454
2476
  }
2455
2477
  }
2456
2478
 
2457
- &[variant="minimal"] {
2458
- --slider-height: 0.375rem;
2459
- --slider-thumb-size: 0.75rem;
2460
- --slider-tick-width: calc(var(--slider-height) / 2);
2461
- --slider-tick-height: calc(var(--slider-height) / 2);
2462
- --handle-transition: none;
2463
- --slider-transition: none;
2464
- --slider-handle-shadow:
2465
- inset 0 0 0 calc(6px + 0.5rem * var(--unchanged))
2466
- var(--slider-thumb-color),
2467
- 0 0 0 0.75px rgba(0, 0, 0, 0.075), inset 0 0 0 5px rgba(0, 0, 0, 0.1),
2468
- var(--figma-elevation-100);
2469
-
2470
- .fig-slider-input-container {
2471
- height: var(--slider-height);
2472
- position: relative;
2473
- display: block;
2474
- width: 100%;
2475
- }
2476
- fig-input-text {
2477
- height: calc(var(--slider-height) * 2);
2478
- background-color: transparent;
2479
- }
2480
-
2481
- &:hover,
2482
- &:focus-within {
2483
- fig-input-text {
2484
- height: auto;
2485
- }
2486
- }
2487
- }
2488
2479
  &[variant="neue"] {
2489
2480
  --slider-height: 0.375rem;
2490
2481
  --slider-thumb-size: 0.75rem;
@@ -2793,10 +2784,11 @@ fig-tooltip {
2793
2784
  max-width: 180px;
2794
2785
  width: max-content;
2795
2786
  box-shadow: inset 0 0.5px 0 0
2796
- light-dark(rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.06));
2787
+ light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.1));
2797
2788
  filter: drop-shadow(0px 1px 1.5px rgba(0, 0, 0, 0.1))
2798
2789
  drop-shadow(0px 2.5px 6px rgba(0, 0, 0, 0.13))
2799
2790
  drop-shadow(0px 0px 0.5px rgba(0, 0, 0, 0.15));
2791
+ pointer-events: none;
2800
2792
 
2801
2793
  & > span {
2802
2794
  text-wrap: balance;
@@ -2925,10 +2917,13 @@ fig-header {
2925
2917
  align-items: center;
2926
2918
  box-shadow: inset 0 -1px 0 0 var(--figma-color-border);
2927
2919
  gap: 0.25rem;
2920
+ user-select: none;
2928
2921
 
2929
2922
  & h3 {
2930
2923
  font-weight: var(--body-medium-strong-fontWeight);
2931
2924
  flex-grow: 1;
2925
+ display: flex;
2926
+ align-items: center;
2932
2927
  }
2933
2928
 
2934
2929
  &[borderless] {
@@ -2936,6 +2931,65 @@ fig-header {
2936
2931
  }
2937
2932
  }
2938
2933
 
2934
+ fig-group {
2935
+ display: block;
2936
+ padding-bottom: var(--spacer-2-5);
2937
+
2938
+ /* Sibling groups */
2939
+ & + fig-group {
2940
+ box-shadow: inset 0 1px 0 0 var(--figma-color-border);
2941
+ &:not([name]) {
2942
+ padding-top: var(--spacer-2-5);
2943
+ }
2944
+ &:last-of-type {
2945
+ padding-bottom: 0;
2946
+ }
2947
+ }
2948
+
2949
+ & > fig-header {
2950
+ cursor: default;
2951
+ padding-left: var(--spacer-3);
2952
+ h3 {
2953
+ .fig-group-chevron {
2954
+ --icon: var(--icon-chevron);
2955
+ --size: 1rem;
2956
+ color: var(--figma-color-text-tertiary);
2957
+ transform: rotate(-90deg);
2958
+ transition: transform var(--transition-duration)
2959
+ var(--transition-timing-function);
2960
+ margin-left: calc(var(--spacer-3) * -1);
2961
+ }
2962
+ }
2963
+ }
2964
+
2965
+ &[collapsible] > fig-header h3 {
2966
+ user-select: none;
2967
+ }
2968
+
2969
+ &[collapsible]:not([open]):not([open="true"]),
2970
+ &[collapsible][open="false"] {
2971
+ padding-bottom: 0;
2972
+ fig-header {
2973
+ color: var(--figma-color-text-secondary);
2974
+ &:hover {
2975
+ color: var(--figma-color-text);
2976
+ .fig-group-chevron {
2977
+ color: inherit;
2978
+ }
2979
+ }
2980
+ }
2981
+ }
2982
+
2983
+ &[open]:not([open="false"]) > fig-header .fig-group-chevron {
2984
+ transform: rotate(0deg);
2985
+ }
2986
+
2987
+ &[collapsible]:not([open]):not([open="true"]) > :not(fig-header),
2988
+ &[collapsible][open="false"] > :not(fig-header) {
2989
+ display: none;
2990
+ }
2991
+ }
2992
+
2939
2993
  fig-footer {
2940
2994
  display: flex;
2941
2995
  align-items: center;
@@ -3219,12 +3273,18 @@ fig-input-palette {
3219
3273
  flex-direction: column;
3220
3274
  gap: var(--spacer-2);
3221
3275
  min-width: 0;
3276
+ border-radius: var(--radius-medium);
3277
+
3278
+ &:focus {
3279
+ outline: 1px solid var(--figma-color-border-selected) !important;
3280
+ outline-offset: -1px !important;
3281
+ }
3222
3282
 
3223
3283
  .palette-colors {
3224
3284
  display: flex;
3225
3285
  flex-wrap: nowrap;
3226
3286
  gap: 0;
3227
- border-radius: var(--radius-small);
3287
+ border-radius: var(--radius-medium);
3228
3288
  overflow: hidden;
3229
3289
  grid-area: inputs;
3230
3290
  min-width: 0;
@@ -3239,18 +3299,14 @@ fig-input-palette {
3239
3299
  grid-template-columns: 1fr 24px;
3240
3300
  grid-template-areas: "inputs button";
3241
3301
  border-radius: var(--radius-medium);
3242
- background-color: var(--figma-color-bg-secondary);
3243
3302
  width: 100%;
3244
- gap: var(--spacer-1);
3303
+ gap: var(--spacer-2);
3245
3304
  place-items: center;
3246
3305
 
3247
3306
  .palette-colors {
3248
3307
  display: flex;
3249
- --palette-colors-height: calc(1.5rem - var(--spacer-1));
3308
+ --palette-colors-height: 1.5rem;
3250
3309
  height: var(--palette-colors-height);
3251
- margin-left: var(--spacer-1);
3252
-
3253
- background-color: var(--figma-color-bg-secondary);
3254
3310
  fig-input-color {
3255
3311
  width: 100%;
3256
3312
  }
@@ -3274,7 +3330,7 @@ fig-input-palette {
3274
3330
  }
3275
3331
  }
3276
3332
  }
3277
- &[expanded]:not([expanded="false"]):not([edit="false"]) {
3333
+ &[open]:not([open="false"]):not([edit="false"]) {
3278
3334
  .palette-colors-expanded {
3279
3335
  display: flex;
3280
3336
  }
@@ -3285,11 +3341,6 @@ fig-input-palette {
3285
3341
  grid-template-areas: "inputs inputs";
3286
3342
  }
3287
3343
  }
3288
- &[color-strip="false"] {
3289
- .palette-colors-inline {
3290
- display: none !important;
3291
- }
3292
- }
3293
3344
  .palette-colors-expanded {
3294
3345
  display: none;
3295
3346
  flex-direction: column;
@@ -3311,10 +3362,6 @@ fig-input-palette {
3311
3362
  }
3312
3363
  }
3313
3364
 
3314
- fig-field[direction="horizontal"]:has(> fig-input-palette) {
3315
- padding-right: var(--spacer-2);
3316
- }
3317
-
3318
3365
  fig-slider {
3319
3366
  display: flex;
3320
3367
 
@@ -3360,30 +3407,46 @@ fig-field,
3360
3407
  & > label {
3361
3408
  flex: 0;
3362
3409
  padding: var(--spacer-1) 0;
3363
- display: flex;
3364
- justify-content: space-between;
3365
3410
  min-height: calc(1rem + var(--spacer-1) * 2);
3411
+ display: flex;
3366
3412
  align-items: center;
3367
3413
  width: 100%;
3414
+ user-select: none;
3415
+ }
3416
+
3417
+ & > .fig-field-chevron {
3418
+ --icon: var(--icon-chevron);
3419
+ --size: 1rem;
3420
+ color: var(--figma-color-text-tertiary);
3421
+ transform: rotate(-90deg);
3422
+ transition: transform var(--transition-duration)
3423
+ var(--transition-timing-function);
3424
+ flex-shrink: 0;
3425
+ margin: var(--spacer-1) 0;
3426
+ margin-left: calc(var(--spacer-3) * -1);
3427
+ margin-right: calc(var(--spacer-2) * -1);
3428
+ }
3429
+
3430
+ &:has(> [open]:not([open="false"])) > .fig-field-chevron {
3431
+ transform: rotate(0deg);
3368
3432
  }
3369
3433
 
3370
3434
  &[direction="horizontal"] > label {
3435
+ display: block;
3371
3436
  width: auto;
3372
3437
  min-width: var(--field-label-width);
3373
3438
  max-width: var(--field-label-width);
3374
3439
  overflow: hidden;
3375
3440
  text-overflow: ellipsis;
3376
3441
  white-space: nowrap;
3442
+ padding: 0;
3443
+ line-height: 1.5rem;
3377
3444
  }
3378
3445
 
3379
3446
  &[direction="horizontal"] {
3380
3447
  gap: var(--spacer-2);
3381
3448
  align-items: start;
3382
3449
  flex-direction: row;
3383
-
3384
- & > label {
3385
- min-width: 4rem;
3386
- }
3387
3450
  &[columns="thirds"] {
3388
3451
  display: grid;
3389
3452
  grid-template-columns: repeat(3, 1fr);
@@ -4911,6 +4974,7 @@ fig-handle {
4911
4974
  place-self: center;
4912
4975
  grid-area: 1 / 1;
4913
4976
  z-index: 2;
4977
+ display: none;
4914
4978
  }
4915
4979
 
4916
4980
  &[size="small"] {
@@ -4933,6 +4997,11 @@ fig-handle {
4933
4997
  pointer-events: none;
4934
4998
  cursor: default;
4935
4999
  }
5000
+ &[type="color"] {
5001
+ &::after {
5002
+ display: block;
5003
+ }
5004
+ }
4936
5005
 
4937
5006
  &[type="color"],
4938
5007
  &[control] {