@rogieking/figui3 3.2.0 → 3.4.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.
Files changed (4) hide show
  1. package/components.css +280 -35
  2. package/dist/fig.js +38 -38
  3. package/fig.js +628 -65
  4. package/package.json +1 -1
package/components.css CHANGED
@@ -257,6 +257,19 @@
257
257
  );
258
258
 
259
259
  /* Gradients */
260
+ --eased-fade-stops:
261
+ var(--figma-color-bg) 0%,
262
+ color-mix(in oklch, var(--figma-color-bg) 99.9%, transparent) 10%,
263
+ color-mix(in oklch, var(--figma-color-bg) 99.2%, transparent) 20%,
264
+ color-mix(in oklch, var(--figma-color-bg) 97.3%, transparent) 30%,
265
+ color-mix(in oklch, var(--figma-color-bg) 93.6%, transparent) 40%,
266
+ color-mix(in oklch, var(--figma-color-bg) 87.5%, transparent) 50%,
267
+ color-mix(in oklch, var(--figma-color-bg) 78.4%, transparent) 60%,
268
+ color-mix(in oklch, var(--figma-color-bg) 65.7%, transparent) 70%,
269
+ color-mix(in oklch, var(--figma-color-bg) 48.8%, transparent) 80%,
270
+ color-mix(in oklch, var(--figma-color-bg) 27.1%, transparent) 90%,
271
+ transparent 100%;
272
+
260
273
  --checkerboard: repeating-conic-gradient(
261
274
  rgba(0, 0, 0, 0.1) 0% 25%,
262
275
  rgba(255, 255, 255, 0.1) 0% 50%
@@ -367,6 +380,10 @@ textarea,
367
380
  input[type="text"],
368
381
  input[type="number"],
369
382
  input[type="password"],
383
+ input[type="url"],
384
+ input[type="email"],
385
+ input[type="search"],
386
+ input[type="tel"],
370
387
  .input {
371
388
  background-color: var(--figma-color-bg-secondary);
372
389
  border: 0;
@@ -395,28 +412,47 @@ input[type="password"],
395
412
  }
396
413
  }
397
414
 
398
- fig-input-text,
399
- fig-input-number {
400
- &:has([slot="append"]) input[type="number"] {
401
- &::-webkit-outer-spin-button,
402
- &::-webkit-inner-spin-button {
403
- display: none;
404
- color-scheme: inherit;
405
- margin: 0;
406
- opacity: 0;
415
+ fig-input-number .fig-steppers {
416
+ display: flex;
417
+ flex-direction: column;
418
+ flex-shrink: 0;
419
+ border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
420
+ overflow: hidden;
421
+
422
+ & button {
423
+ display: block;
424
+ appearance: none;
425
+ border: 0;
426
+ padding: 0;
427
+ margin: 0;
428
+ width: 1.5rem;
429
+ flex: 1;
430
+ background-color: var(--figma-color-text-secondary);
431
+ cursor: pointer;
432
+ mask-size: 1rem;
433
+ mask-repeat: no-repeat;
434
+ mask-position: center -3.5px;
435
+
436
+ &:hover {
437
+ background-color: var(--figma-color-text);
407
438
  }
408
- }
409
- &[steppers="true"] {
410
- input[type="number"]::-webkit-inner-spin-button {
411
- display: block;
412
- opacity: 1;
413
- height: 1.5rem;
414
- width: 1.5rem;
415
- margin-right: calc(var(--spacer-2) * -1);
416
- background-color: var(--figma-color-text-secondary);
417
- mask-image: var(--icon-steppers);
439
+ &:active {
440
+ background-color: var(--figma-color-text-tertiary);
418
441
  }
419
442
  }
443
+
444
+ fig-input-number[disabled]:not([disabled="false"]) & button {
445
+ pointer-events: none;
446
+ background-color: var(--figma-color-text-disabled);
447
+ }
448
+
449
+ & .fig-stepper-up {
450
+ mask-image: var(--icon-chevron);
451
+ rotate: 180deg;
452
+ }
453
+ & .fig-stepper-down {
454
+ mask-image: var(--icon-chevron);
455
+ }
420
456
  }
421
457
 
422
458
  /* Textarea */
@@ -1144,6 +1180,7 @@ fig-chit {
1144
1180
  width: var(--size);
1145
1181
  height: var(--size);
1146
1182
  border-radius: var(--radius-medium);
1183
+ cursor: default;
1147
1184
 
1148
1185
  &::before,
1149
1186
  &::after,
@@ -2681,6 +2718,7 @@ dialog[is="fig-toast"] {
2681
2718
  justify-content: center;
2682
2719
  min-width: 0;
2683
2720
  color: var(--figma-color-text);
2721
+ background-color: var(--figma-color-bg);
2684
2722
 
2685
2723
  &[open] {
2686
2724
  display: flex;
@@ -2703,32 +2741,34 @@ dialog[is="fig-toast"] {
2703
2741
 
2704
2742
  /* Theme: Dark (default) - hardcoded to ensure consistency regardless of global theme */
2705
2743
  &[theme="dark"] {
2706
- background-color: #2c2c2c;
2707
- color: rgba(255, 255, 255, 0.9);
2708
2744
  color-scheme: dark;
2709
2745
  }
2710
2746
 
2711
2747
  /* Theme: Light - hardcoded to ensure consistency regardless of global theme */
2712
2748
  &[theme="light"] {
2713
- background-color: #ffffff;
2714
- color: rgba(0, 0, 0, 0.9);
2715
- box-shadow: var(--figma-elevation-500-modal-window);
2716
2749
  color-scheme: light;
2717
2750
  }
2718
2751
 
2719
2752
  /* Theme: Danger - hardcoded to ensure consistency regardless of global theme */
2720
2753
  &[theme="danger"] {
2721
- background-color: #f24822;
2722
- color: #ffffff;
2754
+ background-color: var(--figma-color-bg-danger);
2723
2755
  color-scheme: dark;
2724
2756
  }
2725
2757
 
2726
2758
  /* Theme: Brand - hardcoded to ensure consistency regardless of global theme */
2727
2759
  &[theme="brand"] {
2728
- background-color: #0d99ff;
2729
- color: #ffffff;
2760
+ background-color: var(--figma-color-bg-brand);
2761
+ color-scheme: dark;
2762
+ }
2763
+
2764
+ &[theme="success"] {
2765
+ background-color: var(--figma-color-bg-success);
2730
2766
  color-scheme: dark;
2731
2767
  }
2768
+
2769
+ &[theme="auto"] {
2770
+ /* color-scheme is resolved at runtime by FigToast JS */
2771
+ }
2732
2772
  }
2733
2773
 
2734
2774
  /* Tooltip */
@@ -2958,9 +2998,13 @@ fig-input-number {
2958
2998
  flex: 1;
2959
2999
  color: var(--figma-color-text);
2960
3000
 
3001
+ &[full]:not([full="false"]) {
3002
+ display: flex;
3003
+ width: 100%;
3004
+ }
2961
3005
  &[multiline] {
2962
3006
  display: flex;
2963
- width: 100%; /* Multiline defaults to full width */
3007
+ width: 100%;
2964
3008
  }
2965
3009
  &[autoresize] input,
2966
3010
  &[autoresize] textarea {
@@ -3064,8 +3108,7 @@ fig-input-fill {
3064
3108
  }
3065
3109
  }
3066
3110
 
3067
- fig-field[direction="horizontal"] &,
3068
- fig-field[direction="row"] & {
3111
+ fig-field[direction="horizontal"] & {
3069
3112
  flex: 1;
3070
3113
  min-width: 0;
3071
3114
  }
@@ -3082,8 +3125,7 @@ fig-slider {
3082
3125
  flex-basis: 5rem;
3083
3126
  }
3084
3127
 
3085
- fig-field[direction="horizontal"] &,
3086
- fig-field[direction="row"] & {
3128
+ fig-field[direction="horizontal"] & {
3087
3129
  flex: 1;
3088
3130
  min-width: 0;
3089
3131
  }
@@ -3099,7 +3141,6 @@ fig-field,
3099
3141
  gap: 0;
3100
3142
  align-items: start;
3101
3143
 
3102
- &[direction="row"],
3103
3144
  &[direction="horizontal"] {
3104
3145
  flex-direction: row;
3105
3146
  align-items: center;
@@ -3121,10 +3162,13 @@ fig-field,
3121
3162
  width: 100%;
3122
3163
  }
3123
3164
 
3124
- &[direction="row"] > label,
3125
3165
  &[direction="horizontal"] > label {
3126
3166
  width: auto;
3127
3167
  min-width: var(--field-label-width);
3168
+ max-width: var(--field-label-width);
3169
+ overflow: hidden;
3170
+ text-overflow: ellipsis;
3171
+ white-space: nowrap;
3128
3172
  }
3129
3173
 
3130
3174
  &[direction="horizontal"] {
@@ -3968,6 +4012,207 @@ fig-fill-picker {
3968
4012
  }
3969
4013
  }
3970
4014
 
4015
+ /* Chooser */
4016
+ fig-chooser {
4017
+ --chooser-fade-size: var(--spacer-4);
4018
+
4019
+ display: flex;
4020
+ flex-direction: column;
4021
+ gap: 1px;
4022
+ overflow: hidden auto;
4023
+ scrollbar-width: none;
4024
+
4025
+ &[overflow="scrollbar"] {
4026
+ scrollbar-width: thin;
4027
+ scrollbar-color: var(--figma-color-border) transparent;
4028
+ }
4029
+
4030
+ &[layout="horizontal"] {
4031
+ flex-direction: row;
4032
+ flex-wrap: nowrap;
4033
+ overflow: auto hidden;
4034
+ scrollbar-width: none;
4035
+
4036
+ &[overflow="scrollbar"] {
4037
+ scrollbar-width: thin;
4038
+ scrollbar-color: var(--figma-color-border) transparent;
4039
+ }
4040
+
4041
+ > :not(.fig-chooser-nav-start):not(.fig-chooser-nav-end) {
4042
+ flex: 1 1 0%;
4043
+ }
4044
+ fig-image[full] {
4045
+ min-width: 3rem;
4046
+ }
4047
+ }
4048
+
4049
+ &[layout="grid"] {
4050
+ display: grid;
4051
+ grid-template-columns: 1fr 1fr;
4052
+
4053
+ > * {
4054
+ min-width: 0;
4055
+ width: 100%;
4056
+ }
4057
+
4058
+ > .fig-chooser-nav-start,
4059
+ > .fig-chooser-nav-end {
4060
+ grid-column: 1 / -1;
4061
+ }
4062
+ }
4063
+
4064
+ &[full]:not([full="false"]) {
4065
+ width: 100%;
4066
+ }
4067
+
4068
+ &[disabled]:not([disabled="false"]) {
4069
+ pointer-events: none;
4070
+ opacity: 0.4;
4071
+ }
4072
+
4073
+ .fig-chooser-nav-start,
4074
+ .fig-chooser-nav-end {
4075
+ all: unset;
4076
+ position: sticky;
4077
+ z-index: 3;
4078
+ flex-shrink: 0;
4079
+ display: flex;
4080
+ align-items: center;
4081
+ justify-content: center;
4082
+ cursor: pointer;
4083
+ opacity: 0;
4084
+ pointer-events: none;
4085
+ color: var(--figma-color-icon);
4086
+ transition: opacity 0.2s ease;
4087
+
4088
+ &:hover {
4089
+ background: var(--figma-color-bg) !important;
4090
+ }
4091
+
4092
+ &::after {
4093
+ content: "";
4094
+ display: block;
4095
+ width: 1rem;
4096
+ height: 1rem;
4097
+ mask-image: var(--icon-chevron);
4098
+ mask-size: contain;
4099
+ mask-repeat: no-repeat;
4100
+ mask-position: center;
4101
+ background: currentColor;
4102
+ }
4103
+ }
4104
+
4105
+ .fig-chooser-nav-start {
4106
+ top: 0;
4107
+ left: 0;
4108
+ right: 0;
4109
+ width: 100%;
4110
+ height: var(--chooser-fade-size);
4111
+ margin-bottom: calc(var(--chooser-fade-size) * -1);
4112
+ background: linear-gradient(to bottom, var(--eased-fade-stops));
4113
+
4114
+ &:hover {
4115
+ box-shadow: 0 1px 0 0 var(--figma-color-border) !important;
4116
+ }
4117
+
4118
+ &::after {
4119
+ rotate: 180deg;
4120
+ }
4121
+ }
4122
+
4123
+ .fig-chooser-nav-end {
4124
+ bottom: 0;
4125
+ left: 0;
4126
+ right: 0;
4127
+ width: 100%;
4128
+ height: var(--chooser-fade-size);
4129
+ margin-top: calc(var(--chooser-fade-size) * -1);
4130
+ background: linear-gradient(to top, var(--eased-fade-stops));
4131
+
4132
+ &:hover {
4133
+ box-shadow: 0 -1px 0 0 var(--figma-color-border) !important;
4134
+ }
4135
+ }
4136
+
4137
+ &[layout="horizontal"] {
4138
+ .fig-chooser-nav-start,
4139
+ .fig-chooser-nav-end {
4140
+ top: 0;
4141
+ bottom: 0;
4142
+ height: auto;
4143
+ width: var(--chooser-fade-size);
4144
+ align-self: stretch;
4145
+ margin: 0;
4146
+ }
4147
+
4148
+ .fig-chooser-nav-start {
4149
+ left: 0;
4150
+ right: auto;
4151
+ margin-right: calc(var(--chooser-fade-size) * -1);
4152
+ background: linear-gradient(to right, var(--eased-fade-stops));
4153
+
4154
+ &:hover {
4155
+ box-shadow: 1px 0 0 0 var(--figma-color-border) !important;
4156
+ }
4157
+
4158
+ &::after {
4159
+ rotate: 90deg;
4160
+ }
4161
+ }
4162
+
4163
+ .fig-chooser-nav-end {
4164
+ right: 0;
4165
+ left: auto;
4166
+ margin-left: calc(var(--chooser-fade-size) * -1);
4167
+ background: linear-gradient(to left, var(--eased-fade-stops));
4168
+
4169
+ &:hover {
4170
+ box-shadow: -1px 0 0 0 var(--figma-color-border) !important;
4171
+ }
4172
+
4173
+ &::after {
4174
+ rotate: -90deg;
4175
+ }
4176
+ }
4177
+ }
4178
+
4179
+ &.overflow-start > .fig-chooser-nav-start {
4180
+ opacity: 1;
4181
+ pointer-events: auto;
4182
+ }
4183
+
4184
+ &.overflow-end > .fig-chooser-nav-end {
4185
+ opacity: 1;
4186
+ pointer-events: auto;
4187
+ }
4188
+ }
4189
+
4190
+ fig-choice {
4191
+ display: flex;
4192
+ align-items: center;
4193
+ flex-direction: column;
4194
+ border-radius: var(--radius-large);
4195
+ padding: var(--spacer-2);
4196
+ gap: var(--spacer-2);
4197
+ outline: none;
4198
+ border: 1px solid transparent;
4199
+
4200
+ &:hover:not([selected]):not([disabled]):not([aria-disabled="true"]) {
4201
+ background-color: var(--figma-color-bg-secondary);
4202
+ }
4203
+
4204
+ &[selected] {
4205
+ background-color: var(--figma-color-bg-selected);
4206
+ }
4207
+
4208
+ &[disabled]:not([disabled="false"]),
4209
+ &[aria-disabled="true"] {
4210
+ pointer-events: none;
4211
+ opacity: 0.4;
4212
+ cursor: default;
4213
+ }
4214
+ }
4215
+
3971
4216
  @keyframes fig-shimmer {
3972
4217
  0% {
3973
4218
  background-position: 100% 100%;