@tangible/ui 0.1.0 → 0.2.1

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 (74) hide show
  1. package/components/Button/types.d.ts +5 -2
  2. package/components/Chip/Chip.d.ts +28 -0
  3. package/components/Chip/Chip.js +19 -3
  4. package/components/ColorPicker/ColorArea.d.ts +24 -0
  5. package/components/ColorPicker/ColorArea.js +62 -0
  6. package/components/ColorPicker/ColorField.d.ts +59 -0
  7. package/components/ColorPicker/ColorField.js +88 -0
  8. package/components/ColorPicker/ColorPicker.d.ts +36 -0
  9. package/components/ColorPicker/ColorPicker.js +215 -0
  10. package/components/ColorPicker/ColorSlider.d.ts +20 -0
  11. package/components/ColorPicker/ColorSlider.js +38 -0
  12. package/components/ColorPicker/index.d.ts +14 -0
  13. package/components/ColorPicker/index.js +7 -0
  14. package/components/ColorPicker/labels.d.ts +42 -0
  15. package/components/ColorPicker/labels.js +38 -0
  16. package/components/ColorPicker/tracks.d.ts +4 -0
  17. package/components/ColorPicker/tracks.js +4 -0
  18. package/components/ColorPicker/usePointerDrag.d.ts +13 -0
  19. package/components/ColorPicker/usePointerDrag.js +34 -0
  20. package/components/Combobox/Combobox.d.ts +1 -1
  21. package/components/Combobox/Combobox.js +2 -2
  22. package/components/Combobox/types.d.ts +13 -0
  23. package/components/IconButton/types.d.ts +2 -2
  24. package/components/MultiCombobox/MultiCombobox.d.ts +33 -0
  25. package/components/MultiCombobox/MultiCombobox.js +595 -0
  26. package/components/MultiCombobox/MultiComboboxContext.d.ts +8 -0
  27. package/components/MultiCombobox/MultiComboboxContext.js +36 -0
  28. package/components/MultiCombobox/index.d.ts +3 -0
  29. package/components/MultiCombobox/index.js +2 -0
  30. package/components/MultiCombobox/types.d.ts +244 -0
  31. package/components/MultiCombobox/types.js +7 -0
  32. package/components/MultiSelect/MultiSelect.js +22 -2
  33. package/components/Popover/index.d.ts +1 -1
  34. package/components/Select/Select.js +14 -0
  35. package/components/Slider/Slider.d.ts +2 -0
  36. package/components/Slider/Slider.js +29 -0
  37. package/components/Slider/index.d.ts +2 -0
  38. package/components/Slider/index.js +1 -0
  39. package/components/Slider/types.d.ts +39 -0
  40. package/components/Slider/types.js +1 -0
  41. package/components/index.d.ts +6 -0
  42. package/components/index.js +3 -0
  43. package/icons/icons.svg +1 -0
  44. package/icons/manifest.json +8 -0
  45. package/icons/registry.d.ts +2 -0
  46. package/icons/registry.js +1 -0
  47. package/icons/system/index.d.ts +2 -0
  48. package/icons/system/index.js +11 -0
  49. package/package.json +13 -1
  50. package/styles/all.css +1 -1
  51. package/styles/all.expanded.css +1063 -133
  52. package/styles/all.expanded.unlayered.css +1063 -133
  53. package/styles/all.unlayered.css +1 -1
  54. package/styles/components/_bundle.scss +6 -0
  55. package/styles/components/button.scss +45 -35
  56. package/styles/components/chip.scss +57 -0
  57. package/styles/components/color-picker.scss +378 -0
  58. package/styles/components/combobox.scss +16 -2
  59. package/styles/components/icon-button.scss +32 -26
  60. package/styles/components/input/index.scss +1 -2
  61. package/styles/components/multi-combobox.scss +457 -0
  62. package/styles/components/multi-select.scss +34 -18
  63. package/styles/components/pager.scss +4 -2
  64. package/styles/components/progress.scss +1 -1
  65. package/styles/components/segmented-control.scss +44 -18
  66. package/styles/components/select.scss +19 -3
  67. package/styles/components/slider.scss +184 -0
  68. package/styles/components/switch.scss +1 -1
  69. package/styles/core.css +1 -1
  70. package/styles/core.unlayered.css +1 -1
  71. package/styles/system/_tokens.scss +13 -0
  72. package/tui-manifest.json +307 -8
  73. package/utils/color/color.d.ts +61 -0
  74. package/utils/color/color.js +293 -0
@@ -8,6 +8,8 @@
8
8
  @use "./chip" as chip;
9
9
  @use "./chip-group" as chipgroup;
10
10
  @use "./combobox" as combobox;
11
+ @use "./color-picker" as colorpicker;
12
+ @use "./multi-combobox" as multicombobox;
11
13
  @use "./content-indicator" as contentindicator;
12
14
  @use "./date-picker" as datepicker;
13
15
  @use "./dropdown" as dropdown;
@@ -27,6 +29,7 @@
27
29
  @use "./rating" as rating;
28
30
  @use "./progress" as progress;
29
31
  @use "./segmented-control" as segmentedcontrol;
32
+ @use "./slider" as slider;
30
33
  @use "./switch" as switch;
31
34
  @use "./sidebar" as sidebar;
32
35
  @use "./step-indicator" as stepindicator;
@@ -72,6 +75,8 @@ $-input-dependents: (input, field, text-input, textarea, pager);
72
75
  @if -wants($only, chip) { @include chip.styles(); }
73
76
  @if -wants($only, chip-group) { @include chipgroup.styles(); }
74
77
  @if -wants($only, combobox) { @include combobox.styles(); }
78
+ @if -wants($only, color-picker) { @include colorpicker.styles(); }
79
+ @if -wants($only, multi-combobox) { @include multicombobox.styles(); }
75
80
  @if -wants($only, content-indicator) { @include contentindicator.styles(); }
76
81
  @if -wants($only, date-picker) { @include datepicker.styles(); }
77
82
  @if -wants($only, dropdown) { @include dropdown.styles(); }
@@ -91,6 +96,7 @@ $-input-dependents: (input, field, text-input, textarea, pager);
91
96
  @if -wants($only, rating) { @include rating.styles(); }
92
97
  @if -wants($only, progress) { @include progress.styles(); }
93
98
  @if -wants($only, segmented-control) { @include segmentedcontrol.styles(); }
99
+ @if -wants($only, slider) { @include slider.styles(); }
94
100
  @if -wants($only, switch) { @include switch.styles(); }
95
101
  @if -wants($only, sidebar) { @include sidebar.styles(); }
96
102
  @if -wants($only, step-indicator) { @include stepindicator.styles(); }
@@ -267,17 +267,21 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
267
267
  }
268
268
  }
269
269
 
270
- &.is-theme-danger {
271
- --_bg: var(--#{sys.$prefix}button-bg, var(--#{sys.$prefix}theme-danger-base));
272
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}color-fg-on-accent));
273
- --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-danger-base));
274
-
275
- &:hover,
276
- &:focus-visible,
277
- &:is(:active, [aria-pressed="true"]) {
278
- --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-danger-stronger));
279
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
280
- --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-danger-stronger));
270
+ // Status themes (danger/success/warning/info) share one recipe:
271
+ // base fill, on-accent text, stronger step on interaction.
272
+ @each $status in (danger, success, warning, info) {
273
+ &.is-theme-#{$status} {
274
+ --_bg: var(--#{sys.$prefix}button-bg, var(--#{sys.$prefix}theme-#{$status}-base));
275
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}color-fg-on-accent));
276
+ --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-#{$status}-base));
277
+
278
+ &:hover,
279
+ &:focus-visible,
280
+ &:is(:active, [aria-pressed="true"]) {
281
+ --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
282
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
283
+ --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
284
+ }
281
285
  }
282
286
  }
283
287
 
@@ -312,17 +316,19 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
312
316
  }
313
317
  }
314
318
 
315
- &.is-style-outline.is-theme-danger {
316
- --_bg: var(--#{sys.$prefix}button-bg, transparent);
317
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-danger-strong));
318
- --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-danger-base));
319
-
320
- &:hover,
321
- &:focus-visible,
322
- &:is(:active, [aria-pressed="true"]) {
323
- --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-danger-base));
324
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
325
- --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-danger-base));
319
+ @each $status in (danger, success, warning, info) {
320
+ &.is-style-outline.is-theme-#{$status} {
321
+ --_bg: var(--#{sys.$prefix}button-bg, transparent);
322
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-#{$status}-strong));
323
+ --_border: var(--#{sys.$prefix}button-border, var(--#{sys.$prefix}theme-#{$status}-base));
324
+
325
+ &:hover,
326
+ &:focus-visible,
327
+ &:is(:active, [aria-pressed="true"]) {
328
+ --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-base));
329
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}color-fg-on-accent));
330
+ --_border: var(--#{sys.$prefix}button-border-interact, var(--#{sys.$prefix}theme-#{$status}-base));
331
+ }
326
332
  }
327
333
  }
328
334
 
@@ -352,14 +358,16 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
352
358
  }
353
359
  }
354
360
 
355
- &.is-style-ghost.is-theme-danger {
356
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-danger-strong));
361
+ @each $status in (danger, success, warning, info) {
362
+ &.is-style-ghost.is-theme-#{$status} {
363
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-#{$status}-strong));
357
364
 
358
- &:hover,
359
- &:focus-visible,
360
- &:is(:active, [aria-pressed="true"]) {
361
- --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-danger-subtlest));
362
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-danger-stronger));
365
+ &:hover,
366
+ &:focus-visible,
367
+ &:is(:active, [aria-pressed="true"]) {
368
+ --_bg: var(--#{sys.$prefix}button-bg-interact, var(--#{sys.$prefix}theme-#{$status}-subtlest));
369
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-#{$status}-stronger));
370
+ }
363
371
  }
364
372
  }
365
373
 
@@ -391,13 +399,15 @@ $_typography-lineHeight: var(--#{sys.$prefix}button-line-height, 1.4);
391
399
  }
392
400
  }
393
401
 
394
- &.is-style-link.is-theme-danger {
395
- --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-danger-strong));
402
+ @each $status in (danger, success, warning, info) {
403
+ &.is-style-link.is-theme-#{$status} {
404
+ --_fg: var(--#{sys.$prefix}button-fg, var(--#{sys.$prefix}theme-#{$status}-strong));
396
405
 
397
- &:hover,
398
- &:focus-visible,
399
- &:is(:active, [aria-pressed="true"]) {
400
- --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-danger-strongest));
406
+ &:hover,
407
+ &:focus-visible,
408
+ &:is(:active, [aria-pressed="true"]) {
409
+ --_fg: var(--#{sys.$prefix}button-fg-interact, var(--#{sys.$prefix}theme-#{$status}-strongest));
410
+ }
401
411
  }
402
412
  }
403
413
  }
@@ -165,6 +165,63 @@
165
165
  }
166
166
  }
167
167
 
168
+ // -------------------------------------------------------------------------
169
+ // Remove button — trailing dismiss affordance (token/tag pattern)
170
+ // -------------------------------------------------------------------------
171
+ // Rendered when `onRemove` is set: a real <button> nested in a display-only
172
+ // chip (the only focusable target). Sized in em so it tracks the chip text
173
+ // and is pulled toward the chip's end edge. The × glyph is held at ~1em
174
+ // (below the chip's 1.25em icon scale) so the button never drives the chip
175
+ // taller than its text — the padding keeps the tap target comfortable.
176
+ .#{sys.$prefix}chip__remove {
177
+ display: inline-flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ flex: none;
181
+ // The chip's own `gap` already spaces children; pull back so the × sits
182
+ // close to the label instead of doubling that gap.
183
+ margin-inline-start: calc(0.125em - #{$_spacing-within});
184
+ margin-inline-end: -0.1875em;
185
+ padding: 0.1875em;
186
+ border: 0;
187
+ border-radius: var(--#{sys.$prefix}radius-full, 999px);
188
+ background: transparent;
189
+ color: inherit;
190
+ cursor: pointer;
191
+ opacity: 0.65;
192
+ line-height: 0;
193
+ transition-duration: var(--#{sys.$prefix}motion-duration);
194
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
195
+ transition-property: opacity, outline-color;
196
+
197
+ // Hold the glyph at text height so it doesn't inflate the chip.
198
+ .#{sys.$prefix}icon,
199
+ .#{sys.$prefix}icon[class*="is-size-"] {
200
+ font-size: 0.9375em;
201
+ }
202
+
203
+ @media (hover: hover) {
204
+ &:hover { opacity: 1; }
205
+ }
206
+
207
+ &:focus-visible {
208
+ opacity: 1;
209
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
210
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
211
+ }
212
+
213
+ &:disabled {
214
+ cursor: not-allowed;
215
+ opacity: var(--#{sys.$prefix}opacity-disabled);
216
+ }
217
+ }
218
+
219
+ // A chip carrying a remove button trims its trailing padding so the button
220
+ // sits flush without a gap swallowing the chip's end.
221
+ &.has-remove {
222
+ padding-inline-end: calc(#{$_spacing-inline} - 0.125em);
223
+ }
224
+
168
225
 
169
226
  // -------------------------------------------------------------------------
170
227
  // Interactive behavior
@@ -0,0 +1,378 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-color-area-radius
5
+ --tui-color-area-min-height
6
+ --tui-color-area-thumb-size
7
+ --tui-color-slider-radius
8
+ --tui-color-slider-height
9
+ --tui-color-slider-thumb-size
10
+ */
11
+
12
+ @mixin styles() {
13
+ // ==========================================================================
14
+ // ColorPicker primitives — ColorArea (2D) + ColorSlider (hue / alpha)
15
+ // ==========================================================================
16
+ //
17
+ // The thumb chrome (white ring + dark halo) and the alpha checkerboard use
18
+ // fixed neutral values on purpose: they must read on top of an ARBITRARY
19
+ // user colour, so they can't defer to theme tokens.
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Color area — 2D saturation × value
23
+ // ---------------------------------------------------------------------------
24
+ .#{sys.$prefix}interface .#{sys.$prefix}color-area {
25
+ position: relative;
26
+ width: 100%;
27
+ aspect-ratio: 3 / 2;
28
+ min-height: var(--#{sys.$prefix}color-area-min-height, 140px);
29
+ border-radius: var(--#{sys.$prefix}color-area-radius, var(--#{sys.$prefix}radius-md));
30
+ cursor: crosshair;
31
+ touch-action: none;
32
+ user-select: none;
33
+
34
+ &:focus-visible {
35
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
36
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
37
+ }
38
+
39
+ &.is-disabled {
40
+ opacity: var(--#{sys.$prefix}opacity-disabled);
41
+ pointer-events: none;
42
+ }
43
+ }
44
+
45
+ .#{sys.$prefix}interface .#{sys.$prefix}color-area__thumb {
46
+ position: absolute;
47
+ width: var(--#{sys.$prefix}color-area-thumb-size, 14px);
48
+ height: var(--#{sys.$prefix}color-area-thumb-size, 14px);
49
+ transform: translate(-50%, -50%);
50
+ border-radius: var(--#{sys.$prefix}radius-full, 999px);
51
+ background: var(--_swatch);
52
+ border: 2px solid #fff;
53
+ box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
54
+ pointer-events: none;
55
+ }
56
+
57
+ // ---------------------------------------------------------------------------
58
+ // Color slider — hue / alpha
59
+ // ---------------------------------------------------------------------------
60
+ .#{sys.$prefix}interface .#{sys.$prefix}color-slider {
61
+ position: relative;
62
+ height: var(--#{sys.$prefix}color-slider-height, 12px);
63
+ border-radius: var(--#{sys.$prefix}color-slider-radius, var(--#{sys.$prefix}radius-full, 999px));
64
+ cursor: pointer;
65
+ touch-action: none;
66
+ user-select: none;
67
+
68
+ &:focus-visible {
69
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
70
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
71
+ }
72
+
73
+ &.is-disabled {
74
+ opacity: var(--#{sys.$prefix}opacity-disabled);
75
+ pointer-events: none;
76
+ }
77
+
78
+ // Alpha checkerboard (fixed neutral — a transparency indicator)
79
+ &.has-checkerboard {
80
+ background-color: #fff;
81
+ background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
82
+ linear-gradient(-45deg, #ccc 25%, transparent 25%),
83
+ linear-gradient(45deg, transparent 75%, #ccc 75%),
84
+ linear-gradient(-45deg, transparent 75%, #ccc 75%);
85
+ background-size: 8px 8px;
86
+ background-position: 0 0, 0 4px, 4px -4px, -4px 0;
87
+ }
88
+ }
89
+
90
+ .#{sys.$prefix}interface .#{sys.$prefix}color-slider__track {
91
+ position: absolute;
92
+ inset: 0;
93
+ border-radius: inherit;
94
+ }
95
+
96
+ .#{sys.$prefix}interface .#{sys.$prefix}color-slider__thumb {
97
+ position: absolute;
98
+ top: 50%;
99
+ width: var(--#{sys.$prefix}color-slider-thumb-size, 16px);
100
+ height: var(--#{sys.$prefix}color-slider-thumb-size, 16px);
101
+ transform: translate(-50%, -50%);
102
+ border-radius: var(--#{sys.$prefix}radius-full, 999px);
103
+ background: transparent;
104
+ border: 2px solid #fff;
105
+ box-shadow: 0 0 0 1px rgb(0 0 0 / 0.35);
106
+ pointer-events: none;
107
+ }
108
+
109
+ // ---------------------------------------------------------------------------
110
+ // ColorPicker composition
111
+ // ---------------------------------------------------------------------------
112
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker {
113
+ display: flex;
114
+ flex-direction: column;
115
+ gap: var(--#{sys.$prefix}spacing-sm);
116
+ width: 100%;
117
+
118
+ &.is-disabled {
119
+ opacity: var(--#{sys.$prefix}opacity-disabled);
120
+ }
121
+ }
122
+
123
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__value {
124
+ display: flex;
125
+ align-items: center;
126
+ gap: var(--#{sys.$prefix}spacing-xxs);
127
+ }
128
+
129
+ // Copy button fills the row height so it lines up with the field group.
130
+ // Extra specificity to beat IconButton's own fixed height.
131
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__value .#{sys.$prefix}color-picker__copy {
132
+ flex: none;
133
+ align-self: stretch;
134
+ block-size: auto;
135
+ height: auto;
136
+ }
137
+
138
+ // Compact format Select trigger; the value field takes the rest of the width.
139
+ // Smaller type keeps the trigger narrow so wide formats (oklch) don't squish
140
+ // the channel inputs. Height stays put — the named control-height token wins.
141
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__format {
142
+ flex: none;
143
+ min-width: 0;
144
+ font-size: var(--#{sys.$prefix}typography-size-xs);
145
+ padding-inline: var(--#{sys.$prefix}spacing-xs);
146
+ }
147
+
148
+ // The value field group — one bordered box holding the hex/var input OR the
149
+ // per-channel inputs, with a compact format switcher at its trailing edge.
150
+ // Matches the control height of its neighbours (swatch, copy).
151
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__field-group {
152
+ flex: 1 1 auto;
153
+ min-width: 0;
154
+ display: flex;
155
+ align-items: center;
156
+ gap: var(--#{sys.$prefix}spacing-xxs);
157
+ min-height: var(--#{sys.$prefix}control-height-md, 2.5rem);
158
+ padding-inline: var(--#{sys.$prefix}spacing-xxs);
159
+ border: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-border);
160
+ border-radius: var(--#{sys.$prefix}radius-md);
161
+ background: var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface));
162
+ font-size: var(--#{sys.$prefix}typography-size-xs);
163
+
164
+ &:focus-within {
165
+ border-color: var(--#{sys.$prefix}focus-ring-color);
166
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
167
+ outline-offset: calc(-1 * var(--#{sys.$prefix}border-width));
168
+ }
169
+ }
170
+
171
+ // Hex / var text input — borderless; the group owns the border + focus ring.
172
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__field-input {
173
+ flex: 1 1 auto;
174
+ min-width: 0;
175
+ width: 100%;
176
+ border: 0;
177
+ padding: 0;
178
+ background: transparent;
179
+ color: inherit;
180
+ font: inherit;
181
+ text-align: start;
182
+
183
+ &:focus,
184
+ &:focus-visible {
185
+ outline: none;
186
+ }
187
+ }
188
+
189
+ // Per-channel inputs (rgb / hsl / hwb / oklch) — a borderless flex row that
190
+ // fills the field group; the group provides the border + focus ring.
191
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__channels {
192
+ flex: 1 1 auto;
193
+ min-width: 0;
194
+ display: flex;
195
+ align-items: center;
196
+ gap: var(--#{sys.$prefix}spacing-xxs);
197
+ }
198
+
199
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel {
200
+ flex: 1 1 0;
201
+ min-width: 0;
202
+ display: flex;
203
+ align-items: baseline;
204
+ gap: 0.125em;
205
+ }
206
+
207
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel-letter {
208
+ flex: none;
209
+ color: var(--#{sys.$prefix}color-fg-muted);
210
+ font-size: var(--#{sys.$prefix}typography-size-xs);
211
+ line-height: 1;
212
+ user-select: none;
213
+ }
214
+
215
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel-input {
216
+ flex: 1 1 auto;
217
+ min-width: 0;
218
+ width: 100%;
219
+ border: 0;
220
+ padding: 0;
221
+ background: transparent;
222
+ color: inherit;
223
+ font: inherit;
224
+ text-align: start;
225
+ border-radius: var(--#{sys.$prefix}radius-sm);
226
+
227
+ // The group carries the :focus-within ring; each field additionally shows a
228
+ // subtle tint so a sighted keyboard user can tell WHICH channel has focus.
229
+ &:focus-visible {
230
+ outline: none;
231
+ background: var(--#{sys.$prefix}color-bg-muted);
232
+ }
233
+ }
234
+
235
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__var {
236
+ margin: 0;
237
+ font-size: var(--#{sys.$prefix}typography-size-xs);
238
+ color: var(--#{sys.$prefix}color-fg-muted);
239
+
240
+ code {
241
+ font-family: var(--#{sys.$prefix}font-family-mono, monospace);
242
+ }
243
+
244
+ // Kept in the DOM (so the aria-live region announces on toggle) but
245
+ // collapsed when there's nothing to say. Not display:none — that would
246
+ // remove it from the accessibility tree and defeat the live region.
247
+ &.is-empty {
248
+ block-size: 0;
249
+ overflow: hidden;
250
+ }
251
+ }
252
+
253
+ // ---------------------------------------------------------------------------
254
+ // ColorField — pill trigger with a circular icon-swatch, opens the picker
255
+ // ---------------------------------------------------------------------------
256
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field {
257
+ display: inline-flex;
258
+ align-items: center;
259
+ gap: var(--#{sys.$prefix}spacing-sm);
260
+ min-block-size: var(--#{sys.$prefix}control-height-md, 2.5rem);
261
+ padding: var(--#{sys.$prefix}spacing-xxs);
262
+ padding-inline-end: var(--#{sys.$prefix}spacing-sm);
263
+ border: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-border);
264
+ border-radius: var(--#{sys.$prefix}radius-md);
265
+ background: var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface));
266
+ color: var(--#{sys.$prefix}color-fg);
267
+ font: inherit;
268
+ font-size: var(--#{sys.$prefix}typography-size-sm);
269
+ line-height: 1;
270
+ cursor: pointer;
271
+
272
+ &.is-size-sm {
273
+ min-block-size: var(--#{sys.$prefix}control-height-sm, 2.25rem);
274
+ }
275
+ &.is-size-lg {
276
+ min-block-size: var(--#{sys.$prefix}control-height-lg, 3rem);
277
+ font-size: var(--#{sys.$prefix}typography-size-md);
278
+ }
279
+
280
+ // Compact: just the circular icon-swatch, no label.
281
+ &.is-swatch-only {
282
+ padding-inline-end: var(--#{sys.$prefix}spacing-xxs);
283
+ }
284
+
285
+ &:hover {
286
+ border-color: var(--#{sys.$prefix}color-border-strong, var(--#{sys.$prefix}color-border));
287
+ }
288
+
289
+ // Match the shared form-control focus treatment: border turns primary plus
290
+ // an offset ring. data-popover-open keeps it lit while the picker is open.
291
+ &:focus-visible,
292
+ &[data-popover-open] {
293
+ border-color: var(--#{sys.$prefix}input-border-focus, var(--#{sys.$prefix}theme-primary-base));
294
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
295
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
296
+ }
297
+
298
+ &.is-disabled {
299
+ opacity: var(--#{sys.$prefix}opacity-disabled);
300
+ pointer-events: none;
301
+ }
302
+ }
303
+
304
+ // Icon-swatch — the colour (or a neutral fill for dynamic values) with a
305
+ // contrast-picked white/black icon centred on top. A rounded square that
306
+ // tracks the field's radius (rounds up with the token, matching the pill).
307
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field__swatch {
308
+ // A square sized to the field's inner height. Both dimensions are set
309
+ // explicitly (not aspect-ratio) — in a flex row, flex-basis:auto would size
310
+ // the width from the icon content and defeat aspect-ratio.
311
+ --_size: calc(var(--#{sys.$prefix}control-height-md, 2.5rem) - 2 * var(--#{sys.$prefix}spacing-xxs) - 2 * var(--#{sys.$prefix}border-width));
312
+ flex: none;
313
+ display: inline-flex;
314
+ align-items: center;
315
+ justify-content: center;
316
+ inline-size: var(--_size);
317
+ block-size: var(--_size);
318
+ border-radius: var(--#{sys.$prefix}radius-sm);
319
+ background-color: var(--#{sys.$prefix}color-bg);
320
+ background-image: linear-gradient(var(--_swatch), var(--_swatch)),
321
+ linear-gradient(45deg, #ccc 25%, transparent 25%),
322
+ linear-gradient(-45deg, #ccc 25%, transparent 25%),
323
+ linear-gradient(45deg, transparent 75%, #ccc 75%),
324
+ linear-gradient(-45deg, transparent 75%, #ccc 75%);
325
+ background-size: 100% 100%, 6px 6px, 6px 6px, 6px 6px, 6px 6px;
326
+ background-position: 0 0, 0 0, 0 3px, 3px -3px, -3px 0;
327
+ }
328
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-sm .#{sys.$prefix}color-field__swatch {
329
+ --_size: calc(var(--#{sys.$prefix}control-height-sm, 2.25rem) - 2 * var(--#{sys.$prefix}spacing-xxs) - 2 * var(--#{sys.$prefix}border-width));
330
+ }
331
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-lg .#{sys.$prefix}color-field__swatch {
332
+ --_size: calc(var(--#{sys.$prefix}control-height-lg, 3rem) - 2 * var(--#{sys.$prefix}spacing-xxs) - 2 * var(--#{sys.$prefix}border-width));
333
+ }
334
+
335
+ // The Icon renders <span class="tui-icon …"><svg width="1em"/></span>, so the
336
+ // glyph scales with FONT-SIZE, not inline/block-size (that only grows the span).
337
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field__swatch-icon {
338
+ font-size: 1.25rem; // ~20px glyph
339
+ color: var(--_swatch-icon, #fff);
340
+ }
341
+ // Per-size overrides need the size class as an ANCESTOR of the icon — a nested
342
+ // `.is-size-sm &` inverts the order and never matches.
343
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-sm .#{sys.$prefix}color-field__swatch-icon {
344
+ font-size: 1.125rem; // ~18px
345
+ }
346
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field.is-size-lg .#{sys.$prefix}color-field__swatch-icon {
347
+ font-size: 1.5rem; // ~24px
348
+ }
349
+
350
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field__label {
351
+ min-inline-size: 0;
352
+ overflow: hidden;
353
+ text-overflow: ellipsis;
354
+ white-space: nowrap;
355
+ }
356
+
357
+ .#{sys.$prefix}interface .#{sys.$prefix}color-field__popover {
358
+ inline-size: 20rem;
359
+ max-inline-size: calc(100vw - 2rem);
360
+ }
361
+
362
+ @media (forced-colors: active) {
363
+ .#{sys.$prefix}interface .#{sys.$prefix}color-area,
364
+ .#{sys.$prefix}interface .#{sys.$prefix}color-slider {
365
+ &:focus-visible {
366
+ outline-color: Highlight;
367
+ }
368
+ }
369
+
370
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__channels:focus-within {
371
+ outline-color: Highlight;
372
+ }
373
+
374
+ .#{sys.$prefix}interface .#{sys.$prefix}color-picker__channel-input:focus-visible {
375
+ outline: 1px solid Highlight;
376
+ }
377
+ }
378
+ }
@@ -14,6 +14,7 @@
14
14
  --tui-combobox-option-radius
15
15
  --tui-combobox-option-bg-hover
16
16
  --tui-combobox-option-bg-selected
17
+ --tui-combobox-option-gap
17
18
  */
18
19
 
19
20
  // Structural SCSS constants (compile away, not overridable)
@@ -151,7 +152,7 @@ $_label-letter-spacing: 0.05em;
151
152
 
152
153
  &:hover {
153
154
  color: var(--#{sys.$prefix}color-fg);
154
- background-color: var(--#{sys.$prefix}theme-secondary-subtlest);
155
+ background-color: var(--#{sys.$prefix}color-fill-subtle);
155
156
  }
156
157
 
157
158
  &:focus-visible {
@@ -244,7 +245,7 @@ $_label-letter-spacing: 0.05em;
244
245
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option {
245
246
  // Internal tokens with fallbacks to Select tokens
246
247
  --_option-radius: var(--#{sys.$prefix}combobox-option-radius, var(--#{sys.$prefix}select-option-radius, var(--#{sys.$prefix}radius-sm)));
247
- --_bg-hover: var(--#{sys.$prefix}combobox-option-bg-hover, var(--#{sys.$prefix}select-option-bg-hover, var(--#{sys.$prefix}theme-secondary-subtlest)));
248
+ --_bg-hover: var(--#{sys.$prefix}combobox-option-bg-hover, var(--#{sys.$prefix}select-option-bg-hover, var(--#{sys.$prefix}color-fill-subtle)));
248
249
  --_bg-selected: var(--#{sys.$prefix}combobox-option-bg-selected, var(--#{sys.$prefix}select-option-bg-selected, var(--#{sys.$prefix}theme-primary-subtlest)));
249
250
 
250
251
  // Layout
@@ -260,6 +261,15 @@ $_label-letter-spacing: 0.05em;
260
261
  font-size: var(--#{sys.$prefix}typography-size-sm);
261
262
  line-height: 1.4;
262
263
 
264
+ transition: background-color var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
265
+
266
+ // Rounded boxes shouldn't abut — a hairline of air between options.
267
+ // (Not `& + &`: sass expands both ampersands to the full compound
268
+ // selector, and the :where() prefix ends up mid-combinator — dead rule.)
269
+ & + .#{sys.$prefix}combobox__option {
270
+ margin-block-start: var(--#{sys.$prefix}combobox-option-gap, var(--#{sys.$prefix}select-option-gap, 2px));
271
+ }
272
+
263
273
  &:hover:not([data-disabled]),
264
274
  &[data-highlighted]:not([data-disabled]) {
265
275
  background-color: var(--_bg-hover);
@@ -336,6 +346,10 @@ $_label-letter-spacing: 0.05em;
336
346
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__content {
337
347
  animation-duration: 0ms;
338
348
  }
349
+
350
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option {
351
+ transition-duration: 0ms;
352
+ }
339
353
  }
340
354
 
341
355
  // ---------------------------------------------------------------------------