@rogieking/figui3 3.21.2 → 3.23.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
@@ -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,17 +1287,90 @@ fig-chit {
1280
1287
  display: none;
1281
1288
  }
1282
1289
  }
1290
+ }
1283
1291
 
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);
1292
+ /* Fig Image */
1293
+ fig-truncate {
1294
+ display: inline-block;
1295
+ white-space: nowrap;
1296
+ overflow: hidden;
1297
+ text-overflow: ellipsis;
1298
+ min-width: 0;
1299
+ max-width: 100%;
1300
+ vertical-align: bottom;
1301
+
1302
+ &[position="left"] {
1303
+ display: block;
1304
+ direction: rtl;
1305
+ text-align: left;
1306
+ }
1307
+
1308
+ &[position="middle"] {
1309
+ display: inline-flex;
1310
+ text-overflow: clip;
1311
+ gap: 0;
1312
+
1313
+ & > .start,
1314
+ & > .end {
1315
+ flex: 0 1 auto;
1316
+ white-space: nowrap;
1317
+ overflow: hidden;
1318
+ text-overflow: ellipsis;
1319
+ min-width: 0;
1320
+ }
1321
+
1322
+ & > .end {
1323
+ direction: rtl; /* technique #2 on right half */
1324
+ text-align: left;
1325
+ text-overflow: ellipsis;
1326
+ }
1327
+ &[tail] {
1328
+ & > .end {
1329
+ direction: ltr;
1330
+ text-align: right;
1331
+ flex-shrink: 0;
1332
+ }
1333
+ }
1334
+ }
1335
+ }
1336
+
1337
+ fig-input-file {
1338
+ display: flex;
1339
+ align-items: center;
1340
+ gap: var(--spacer-2);
1341
+ min-width: 0;
1342
+
1343
+ &[full]:not([full="false"]) {
1344
+ flex: 1 1 auto;
1345
+ width: 100%;
1346
+
1347
+ & > fig-tooltip,
1348
+ & > fig-button {
1349
+ flex: 1;
1350
+ min-width: 0;
1351
+ }
1352
+
1353
+ & > fig-tooltip > fig-button {
1354
+ width: 100%;
1355
+ }
1356
+ }
1357
+
1358
+ .fig-input-file-filename {
1359
+ flex: 1;
1360
+ min-width: 0;
1361
+ }
1362
+
1363
+ .fig-input-file-clear {
1364
+ flex-shrink: 0;
1365
+ }
1366
+
1367
+ &[dragover] {
1368
+ outline: 2px dashed var(--figma-color-border-brand);
1369
+ outline-offset: -2px;
1370
+ border-radius: var(--radius-small);
1290
1371
  }
1291
1372
  }
1292
1373
 
1293
- /* Fig Image */
1294
1374
  fig-image {
1295
1375
  --image-size: 2rem;
1296
1376
  --fit: cover;
@@ -2477,37 +2557,6 @@ fig-slider {
2477
2557
  }
2478
2558
  }
2479
2559
 
2480
- &[variant="minimal"] {
2481
- --slider-height: 0.375rem;
2482
- --slider-thumb-size: 0.75rem;
2483
- --slider-tick-width: calc(var(--slider-height) / 2);
2484
- --slider-tick-height: calc(var(--slider-height) / 2);
2485
- --handle-transition: none;
2486
- --slider-transition: none;
2487
- --slider-handle-shadow:
2488
- inset 0 0 0 calc(6px + 0.5rem * var(--unchanged))
2489
- var(--slider-thumb-color),
2490
- 0 0 0 0.75px rgba(0, 0, 0, 0.075), inset 0 0 0 5px rgba(0, 0, 0, 0.1),
2491
- var(--figma-elevation-100);
2492
-
2493
- .fig-slider-input-container {
2494
- height: var(--slider-height);
2495
- position: relative;
2496
- display: block;
2497
- width: 100%;
2498
- }
2499
- fig-input-text {
2500
- height: calc(var(--slider-height) * 2);
2501
- background-color: transparent;
2502
- }
2503
-
2504
- &:hover,
2505
- &:focus-within {
2506
- fig-input-text {
2507
- height: auto;
2508
- }
2509
- }
2510
- }
2511
2560
  &[variant="neue"] {
2512
2561
  --slider-height: 0.375rem;
2513
2562
  --slider-thumb-size: 0.75rem;
@@ -2816,7 +2865,7 @@ fig-tooltip {
2816
2865
  max-width: 180px;
2817
2866
  width: max-content;
2818
2867
  box-shadow: inset 0 0.5px 0 0
2819
- light-dark(rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.06));
2868
+ light-dark(rgba(0, 0, 0, 0.06), rgba(255, 255, 255, 0.1));
2820
2869
  filter: drop-shadow(0px 1px 1.5px rgba(0, 0, 0, 0.1))
2821
2870
  drop-shadow(0px 2.5px 6px rgba(0, 0, 0, 0.13))
2822
2871
  drop-shadow(0px 0px 0.5px rgba(0, 0, 0, 0.15));
@@ -2949,10 +2998,13 @@ fig-header {
2949
2998
  align-items: center;
2950
2999
  box-shadow: inset 0 -1px 0 0 var(--figma-color-border);
2951
3000
  gap: 0.25rem;
3001
+ user-select: none;
2952
3002
 
2953
3003
  & h3 {
2954
3004
  font-weight: var(--body-medium-strong-fontWeight);
2955
3005
  flex-grow: 1;
3006
+ display: flex;
3007
+ align-items: center;
2956
3008
  }
2957
3009
 
2958
3010
  &[borderless] {
@@ -2960,6 +3012,65 @@ fig-header {
2960
3012
  }
2961
3013
  }
2962
3014
 
3015
+ fig-group {
3016
+ display: block;
3017
+ padding-bottom: var(--spacer-2-5);
3018
+
3019
+ /* Sibling groups */
3020
+ & + fig-group {
3021
+ box-shadow: inset 0 1px 0 0 var(--figma-color-border);
3022
+ &:not([name]) {
3023
+ padding-top: var(--spacer-2-5);
3024
+ }
3025
+ &:last-of-type {
3026
+ padding-bottom: 0;
3027
+ }
3028
+ }
3029
+
3030
+ & > fig-header {
3031
+ cursor: default;
3032
+ padding-left: var(--spacer-3);
3033
+ h3 {
3034
+ .fig-group-chevron {
3035
+ --icon: var(--icon-chevron);
3036
+ --size: 1rem;
3037
+ color: var(--figma-color-text-tertiary);
3038
+ transform: rotate(-90deg);
3039
+ transition: transform var(--transition-duration)
3040
+ var(--transition-timing-function);
3041
+ margin-left: calc(var(--spacer-3) * -1);
3042
+ }
3043
+ }
3044
+ }
3045
+
3046
+ &[collapsible] > fig-header h3 {
3047
+ user-select: none;
3048
+ }
3049
+
3050
+ &[collapsible]:not([open]):not([open="true"]),
3051
+ &[collapsible][open="false"] {
3052
+ padding-bottom: 0;
3053
+ fig-header {
3054
+ color: var(--figma-color-text-secondary);
3055
+ &:hover {
3056
+ color: var(--figma-color-text);
3057
+ .fig-group-chevron {
3058
+ color: inherit;
3059
+ }
3060
+ }
3061
+ }
3062
+ }
3063
+
3064
+ &[open]:not([open="false"]) > fig-header .fig-group-chevron {
3065
+ transform: rotate(0deg);
3066
+ }
3067
+
3068
+ &[collapsible]:not([open]):not([open="true"]) > :not(fig-header),
3069
+ &[collapsible][open="false"] > :not(fig-header) {
3070
+ display: none;
3071
+ }
3072
+ }
3073
+
2963
3074
  fig-footer {
2964
3075
  display: flex;
2965
3076
  align-items: center;
@@ -3243,12 +3354,18 @@ fig-input-palette {
3243
3354
  flex-direction: column;
3244
3355
  gap: var(--spacer-2);
3245
3356
  min-width: 0;
3357
+ border-radius: var(--radius-medium);
3358
+
3359
+ &:focus {
3360
+ outline: 1px solid var(--figma-color-border-selected) !important;
3361
+ outline-offset: -1px !important;
3362
+ }
3246
3363
 
3247
3364
  .palette-colors {
3248
3365
  display: flex;
3249
3366
  flex-wrap: nowrap;
3250
3367
  gap: 0;
3251
- border-radius: var(--radius-small);
3368
+ border-radius: var(--radius-medium);
3252
3369
  overflow: hidden;
3253
3370
  grid-area: inputs;
3254
3371
  min-width: 0;
@@ -3263,18 +3380,14 @@ fig-input-palette {
3263
3380
  grid-template-columns: 1fr 24px;
3264
3381
  grid-template-areas: "inputs button";
3265
3382
  border-radius: var(--radius-medium);
3266
- background-color: var(--figma-color-bg-secondary);
3267
3383
  width: 100%;
3268
- gap: var(--spacer-1);
3384
+ gap: var(--spacer-2);
3269
3385
  place-items: center;
3270
3386
 
3271
3387
  .palette-colors {
3272
3388
  display: flex;
3273
- --palette-colors-height: calc(1.5rem - var(--spacer-1));
3389
+ --palette-colors-height: 1.5rem;
3274
3390
  height: var(--palette-colors-height);
3275
- margin-left: var(--spacer-1);
3276
-
3277
- background-color: var(--figma-color-bg-secondary);
3278
3391
  fig-input-color {
3279
3392
  width: 100%;
3280
3393
  }
@@ -3298,7 +3411,7 @@ fig-input-palette {
3298
3411
  }
3299
3412
  }
3300
3413
  }
3301
- &[expanded]:not([expanded="false"]):not([edit="false"]) {
3414
+ &[open]:not([open="false"]):not([edit="false"]) {
3302
3415
  .palette-colors-expanded {
3303
3416
  display: flex;
3304
3417
  }
@@ -3309,11 +3422,6 @@ fig-input-palette {
3309
3422
  grid-template-areas: "inputs inputs";
3310
3423
  }
3311
3424
  }
3312
- &[color-strip="false"] {
3313
- .palette-colors-inline {
3314
- display: none !important;
3315
- }
3316
- }
3317
3425
  .palette-colors-expanded {
3318
3426
  display: none;
3319
3427
  flex-direction: column;
@@ -3335,10 +3443,6 @@ fig-input-palette {
3335
3443
  }
3336
3444
  }
3337
3445
 
3338
- fig-field[direction="horizontal"]:has(> fig-input-palette) {
3339
- padding-right: var(--spacer-2);
3340
- }
3341
-
3342
3446
  fig-slider {
3343
3447
  display: flex;
3344
3448
 
@@ -3384,30 +3488,46 @@ fig-field,
3384
3488
  & > label {
3385
3489
  flex: 0;
3386
3490
  padding: var(--spacer-1) 0;
3387
- display: flex;
3388
- justify-content: space-between;
3389
3491
  min-height: calc(1rem + var(--spacer-1) * 2);
3492
+ display: flex;
3390
3493
  align-items: center;
3391
3494
  width: 100%;
3495
+ user-select: none;
3496
+ }
3497
+
3498
+ & > .fig-field-chevron {
3499
+ --icon: var(--icon-chevron);
3500
+ --size: 1rem;
3501
+ color: var(--figma-color-text-tertiary);
3502
+ transform: rotate(-90deg);
3503
+ transition: transform var(--transition-duration)
3504
+ var(--transition-timing-function);
3505
+ flex-shrink: 0;
3506
+ margin: var(--spacer-1) 0;
3507
+ margin-left: calc(var(--spacer-3) * -1);
3508
+ margin-right: calc(var(--spacer-2) * -1);
3509
+ }
3510
+
3511
+ &:has(> [open]:not([open="false"])) > .fig-field-chevron {
3512
+ transform: rotate(0deg);
3392
3513
  }
3393
3514
 
3394
3515
  &[direction="horizontal"] > label {
3516
+ display: block;
3395
3517
  width: auto;
3396
3518
  min-width: var(--field-label-width);
3397
3519
  max-width: var(--field-label-width);
3398
3520
  overflow: hidden;
3399
3521
  text-overflow: ellipsis;
3400
3522
  white-space: nowrap;
3523
+ padding: 0;
3524
+ line-height: 1.5rem;
3401
3525
  }
3402
3526
 
3403
3527
  &[direction="horizontal"] {
3404
3528
  gap: var(--spacer-2);
3405
3529
  align-items: start;
3406
3530
  flex-direction: row;
3407
-
3408
- & > label {
3409
- min-width: 4rem;
3410
- }
3411
3531
  &[columns="thirds"] {
3412
3532
  display: grid;
3413
3533
  grid-template-columns: repeat(3, 1fr);