@tangible/ui 0.2.11 → 0.2.13

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 (66) hide show
  1. package/README.md +35 -22
  2. package/components/Accordion/Accordion.js +2 -2
  3. package/components/Combobox/Combobox.js +37 -5
  4. package/components/Combobox/types.d.ts +6 -0
  5. package/components/DatePicker/DatePicker.d.ts +3 -0
  6. package/components/DatePicker/DatePicker.js +8 -2
  7. package/components/DatePicker/DateRangePicker.d.ts +3 -0
  8. package/components/DatePicker/DateRangePicker.js +8 -2
  9. package/components/DatePicker/types.d.ts +36 -0
  10. package/components/Dropdown/Dropdown.js +2 -1
  11. package/components/MultiCombobox/MultiCombobox.js +1 -1
  12. package/components/MultiSelect/MultiSelect.d.ts +1 -1
  13. package/components/MultiSelect/MultiSelect.js +29 -5
  14. package/components/MultiSelect/types.d.ts +13 -0
  15. package/components/Pager/Pager.d.ts +65 -1
  16. package/components/Pager/Pager.js +83 -10
  17. package/components/Pager/index.d.ts +1 -1
  18. package/components/Pager/types.d.ts +39 -0
  19. package/components/Pager/types.js +6 -0
  20. package/components/Popover/Popover.js +2 -1
  21. package/components/SearchSelect/SearchSelect.d.ts +1 -1
  22. package/components/SearchSelect/SearchSelect.js +3 -5
  23. package/components/SearchSelect/types.d.ts +0 -2
  24. package/components/Select/Select.d.ts +1 -1
  25. package/components/Select/Select.js +29 -5
  26. package/components/Select/types.d.ts +13 -0
  27. package/components/Table/DataTable.d.ts +6 -0
  28. package/components/Textarea/Textarea.js +7 -0
  29. package/components/Tooltip/Tooltip.js +2 -1
  30. package/components/index.d.ts +2 -2
  31. package/components/index.js +1 -1
  32. package/figma-tokens.json +4018 -0
  33. package/icons/icons.svg +12 -2
  34. package/icons/lms/index.d.ts +14 -1
  35. package/icons/lms/index.js +85 -18
  36. package/icons/manifest.json +204 -97
  37. package/icons/membersync/index.js +9 -9
  38. package/icons/player/index.js +4 -4
  39. package/icons/reaction/index.d.ts +1 -1
  40. package/icons/reaction/index.js +5 -5
  41. package/icons/registry.d.ts +53 -27
  42. package/icons/registry.js +26 -13
  43. package/icons/system/index.d.ts +21 -11
  44. package/icons/system/index.js +78 -32
  45. package/package.json +5 -1
  46. package/skills/building-with-tui/SKILL.md +328 -0
  47. package/styles/all.css +1 -1
  48. package/styles/all.expanded.css +145 -256
  49. package/styles/all.expanded.unlayered.css +145 -256
  50. package/styles/all.unlayered.css +1 -1
  51. package/styles/components/color-picker.scss +16 -3
  52. package/styles/components/combobox.scss +33 -58
  53. package/styles/components/date-picker.scss +17 -9
  54. package/styles/components/dropdown.scss +11 -6
  55. package/styles/components/gradient-picker.scss +4 -4
  56. package/styles/components/multi-combobox.scss +17 -37
  57. package/styles/components/multi-select.scss +14 -50
  58. package/styles/components/pager.scss +155 -17
  59. package/styles/components/radio.scss +37 -0
  60. package/styles/components/search-select.scss +14 -36
  61. package/styles/components/select.scss +22 -51
  62. package/styles/components/text-input.scss +79 -21
  63. package/styles/system/_constants.scss +7 -1
  64. package/tui-manifest.json +143 -6
  65. package/utils/compose-refs.d.ts +29 -3
  66. package/utils/compose-refs.js +51 -12
@@ -2,6 +2,10 @@
2
2
 
3
3
  /* @tui-tokens
4
4
  --tui-pager-gap
5
+ --tui-pager-nav-gap
6
+ --tui-pager-item-border
7
+ --tui-pager-item-radius
8
+ --tui-pager-jump-width
5
9
  */
6
10
 
7
11
  @mixin styles() {
@@ -12,11 +16,23 @@
12
16
  // Generic pagination control. Used standalone or wrapped by TablePagination.
13
17
  //
14
18
  // Component API tokens (never defined here, only read via fallback):
15
- // --tui-pager-gap Gap between nav and info sections
19
+ // --tui-pager-gap Gap between nav and info sections
20
+ // --tui-pager-nav-gap Gap between nav segments (0 in the flush variant)
21
+ // --tui-pager-item-border Segment border, bridged onto --tui-button-border
22
+ // --tui-pager-item-radius Segment radius in detached, and in flush once
23
+ // the container is too narrow to stay connected
24
+ // --tui-pager-jump-width Width of the go-to-page field
16
25
  //
17
26
  // ==========================================================================
18
27
 
19
28
  .#{sys.$prefix}pager {
29
+ // Container for the narrow-width block at the bottom of this file. Also
30
+ // has a useful side effect in Storybook, whose preview.css pins every story
31
+ // wrapper to `min-width: max-content`: under inline-size containment
32
+ // `max-content` resolves as though the element had no content, so the pin
33
+ // stops fighting the layout and the Pager can actually be QA'd narrow.
34
+ container-type: inline-size;
35
+ container-name: tuiPager;
20
36
  display: flex;
21
37
  flex-wrap: wrap;
22
38
  align-items: center;
@@ -24,11 +40,26 @@
24
40
  gap: var(--#{sys.$prefix}pager-gap, var(--#{sys.$prefix}spacing-md));
25
41
  padding-block: var(--#{sys.$prefix}spacing-md);
26
42
 
27
- // Connected button group for nav items
28
43
  &__nav {
29
44
  display: flex;
45
+ // Unconditional, not gated on the container query below: the nav's width
46
+ // depends on `mode`, `maxNumbers`, `showFirstLast` and `size`, so no
47
+ // threshold can promise it fits. `mode="full"` at 30 pages is wider than
48
+ // any sane breakpoint. Wrapping costs nothing while it fits, and the
49
+ // alternative is the nav overflowing its container and taking the page's
50
+ // horizontal scroll with it (WCAG 2.1 SC 1.4.10 Reflow).
51
+ flex-wrap: wrap;
30
52
  align-items: center;
31
- gap: 0;
53
+ // The nav pushes everything else to the far end, rather than each
54
+ // trailing region claiming the space itself. With two auto margins the
55
+ // free space would split between them and strand the info region in the
56
+ // middle, so this has to live here — and it keeps working whichever of
57
+ // info / jump actually render.
58
+ margin-inline-end: auto;
59
+ // Base carries the gap and `.is-variant-flush` zeroes it, mirroring
60
+ // Accordion (whose base gap is likewise cancelled by its flush variant).
61
+ // Pager defaults to flush, so a stock Pager still renders at gap 0.
62
+ gap: var(--#{sys.$prefix}pager-nav-gap, var(--#{sys.$prefix}spacing-sm));
32
63
  .#{sys.$prefix}pager__item,
33
64
  .#{sys.$prefix}pager__ellipsis {
34
65
  // Token Bridging: pager items are Button consumers — the connected
@@ -36,24 +67,20 @@
36
67
  // fighting its internals with !important. Theme via
37
68
  // --tui-pager-item-border.
38
69
  --#{sys.$prefix}button-border: var(--#{sys.$prefix}pager-item-border, var(--#{sys.$prefix}color-border));
39
- border-color: var(--#{sys.$prefix}button-border);
70
+ // Setting the token is the whole mechanism — do NOT also declare
71
+ // border-color here. Button's own `border-color: var(--_border)
72
+ // !important` (it defeats WordPress) beats any plain declaration, so
73
+ // such a line is inert for the items; and were the !important ever
74
+ // dropped, it would start overriding the ghost variant's
75
+ // `--_border: transparent` and put a visible border back on the
76
+ // detached prev/next. The ellipsis sets its own border shorthand below.
40
77
  // Compact page-number width. Font-size and height come from the shared
41
78
  // control ladder — Button's own control-sizing for the items, and the
42
79
  // control-sizing mixin for the ellipsis below — so the whole nav scales
43
80
  // with `size` and honours a context's --tui-control-height-* override.
81
+ // Kept in BOTH variants: it is what makes numbers read as numbers
82
+ // rather than as buttons with words in them.
44
83
  padding-inline: 0.85em;
45
-
46
- // Connected button group: remove inner radii
47
- &:not(:first-child) {
48
- border-start-start-radius: 0;
49
- border-end-start-radius: 0;
50
- border-inline-start-width: 0;
51
- }
52
-
53
- &:not(:last-child) {
54
- border-start-end-radius: 0;
55
- border-end-end-radius: 0;
56
- }
57
84
  }
58
85
 
59
86
  // Ellipsis: non-interactive, styled to match outline buttons. It's a plain
@@ -81,7 +108,20 @@
81
108
  display: flex;
82
109
  align-items: center;
83
110
  gap: var(--#{sys.$prefix}spacing-sm);
84
- margin-inline-start: auto;
111
+ }
112
+
113
+ // Go-to-page field (showJump)
114
+ &__jump {
115
+ display: flex;
116
+ align-items: center;
117
+ gap: var(--#{sys.$prefix}spacing-xs);
118
+ }
119
+
120
+ &__jump-input {
121
+ // An <input> left to its intrinsic width takes ~180px and shoves the
122
+ // rest of the row around. A page number needs a few digits and the
123
+ // spinners; anything wider is just a large empty box.
124
+ inline-size: var(--#{sys.$prefix}pager-jump-width, 4rem);
85
125
  }
86
126
 
87
127
  // Page size selector label
@@ -91,4 +131,102 @@
91
131
  gap: var(--#{sys.$prefix}spacing-xs);
92
132
  }
93
133
  }
134
+
135
+ // ---------------------------------------------------------------------------
136
+ // Variant: flush (connected group — shared borders, squared inner corners)
137
+ // ---------------------------------------------------------------------------
138
+ //
139
+ // The default, and what Pager has always rendered. Everything variant-specific
140
+ // lives here rather than in the base block, so `detached` is the absence of
141
+ // these rules rather than a pile of resets undoing them.
142
+ //
143
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}pager.is-variant-flush {
144
+ .#{sys.$prefix}pager__nav {
145
+ gap: 0;
146
+ }
147
+
148
+ .#{sys.$prefix}pager__item,
149
+ .#{sys.$prefix}pager__ellipsis {
150
+ // NOTE: keyed on actual position, not on "is prev / is next". Prev and
151
+ // next happen to be the end segments today, but showFirstLast will put
152
+ // buttons outside them — at which point a rule written as "prev squares
153
+ // its trailing corners" would be wrong and this one stays correct.
154
+ &:not(:first-child) {
155
+ border-start-start-radius: 0;
156
+ border-end-start-radius: 0;
157
+ border-inline-start-width: 0;
158
+ }
159
+
160
+ &:not(:last-child) {
161
+ border-start-end-radius: 0;
162
+ border-end-end-radius: 0;
163
+ }
164
+ }
165
+ }
166
+
167
+ // ---------------------------------------------------------------------------
168
+ // Variant: detached (separate buttons, spaced, full radius)
169
+ // ---------------------------------------------------------------------------
170
+ //
171
+ // Segments keep all four borders and their full radius. Prev/next carry no
172
+ // border or fill at all — the component renders them as ghost Buttons /
173
+ // IconButtons, so nothing here needs to strip anything.
174
+ //
175
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}pager.is-variant-detached {
176
+ .#{sys.$prefix}pager__item,
177
+ .#{sys.$prefix}pager__ellipsis {
178
+ // Covers the ellipsis too, which otherwise keeps its own radius-sm from
179
+ // the base block — (0,3,0) here against that rule's (0,2,0), so no
180
+ // separate override is needed.
181
+ border-radius: var(--#{sys.$prefix}pager-item-radius, var(--#{sys.$prefix}radius-md));
182
+ }
183
+ }
184
+
185
+ // ---------------------------------------------------------------------------
186
+ // Narrow containers: flush stops pretending to be a connected group
187
+ // ---------------------------------------------------------------------------
188
+ //
189
+ // A connected group cannot wrap and still look like one. The collapse rules
190
+ // key off `:first-child`/`:last-child`, and CSS cannot identify the first item
191
+ // of a *wrapped row* — so a second row opens with a borderless, square-cornered
192
+ // box that reads as broken (measured, not assumed: see the wrap screenshots in
193
+ // the PR). Below the threshold the flush variant therefore adopts the detached
194
+ // presentation, which wraps correctly by construction.
195
+ //
196
+ // 32rem is a design line, not a derived number — it is roughly where a
197
+ // horizontal row of controls stops being the right shape — so it deliberately
198
+ // degrades a *narrow* pager (a plain smart nav is ~380px) slightly before it
199
+ // would strictly have to. Pills are a legitimate look at that width, and the
200
+ // rules sit at the same specificity as the flush block so a consumer can
201
+ // override the call.
202
+ //
203
+ // These match the flush block's selectors exactly and win on source order.
204
+ //
205
+ @container tuiPager (width < 32rem) {
206
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}pager.is-variant-flush {
207
+ .#{sys.$prefix}pager__nav {
208
+ gap: var(--#{sys.$prefix}pager-nav-gap, var(--#{sys.$prefix}spacing-sm));
209
+ }
210
+
211
+ // The `:not()` pseudo-classes are mirrored from the flush block rather
212
+ // than simplified away: `:not(:first-child)` puts those rules at (0,4,0),
213
+ // so a tidier (0,3,0) selector here would silently lose. Same specificity,
214
+ // later in the file, no !important.
215
+ .#{sys.$prefix}pager__item,
216
+ .#{sys.$prefix}pager__ellipsis {
217
+ $_r: var(--#{sys.$prefix}pager-item-radius, var(--#{sys.$prefix}radius-md));
218
+
219
+ &:not(:first-child) {
220
+ border-start-start-radius: #{$_r};
221
+ border-end-start-radius: #{$_r};
222
+ border-inline-start-width: var(--#{sys.$prefix}border-width);
223
+ }
224
+
225
+ &:not(:last-child) {
226
+ border-start-end-radius: #{$_r};
227
+ border-end-end-radius: #{$_r};
228
+ }
229
+ }
230
+ }
231
+ }
94
232
  }
@@ -4,6 +4,7 @@
4
4
  --tui-radio-accent
5
5
  --tui-radio-size
6
6
  --tui-radio-border
7
+ --tui-radio-border-invalid
7
8
  --tui-radio-bg
8
9
  --tui-radio-gap
9
10
  --tui-radio-font-size
@@ -21,6 +22,7 @@
21
22
  // --tui-radio-accent Accent color for selected state
22
23
  // --tui-radio-size Indicator size (falls back to 1.15em)
23
24
  // --tui-radio-border Indicator border color (unchecked)
25
+ // --tui-radio-border-invalid Indicator border color when the group is invalid
24
26
  // --tui-radio-bg Indicator background color
25
27
  // --tui-radio-gap Gap between indicator and label
26
28
  // --tui-radio-font-size Font size for label + description base
@@ -161,6 +163,29 @@
161
163
  }
162
164
  }
163
165
 
166
+ // ---------------------------------------------------------------------------
167
+ // Invalid — every indicator in the group tints, selected one included
168
+ // ---------------------------------------------------------------------------
169
+ //
170
+ // aria-invalid lives on the GROUP (role="radiogroup" carries it, per
171
+ // RadioGroup.tsx), not on each radio, so this is a descendant rule rather
172
+ // than the `&[aria-invalid="true"]` self-selector Checkbox and Switch use.
173
+ // Spelled out top-level instead of nested with a trailing `&` — see the Sass
174
+ // parent-splice gotcha in CLAUDE.md, which would put the attribute selector
175
+ // ABOVE .tui-interface and silently match nothing.
176
+ //
177
+ // Specificity is deliberate at (0,6,0): it has to out-weigh the hover rule
178
+ // (0,5,0) and the checked rule (0,4,0), both of which set border-color on the
179
+ // indicator directly. Winning on source order alone would be fragile, so the
180
+ // full ancestor chain is named rather than relying on file order.
181
+ //
182
+ // Only the border tints. The dot keeps --_accent so the selection stays
183
+ // readable — same call Switch makes for its track, and the reason "tint all
184
+ // borders" doesn't cost you the answer to "which one did I pick?".
185
+ .#{sys.$prefix}interface .#{sys.$prefix}radio-group[aria-invalid="true"] .#{sys.$prefix}radio .#{sys.$prefix}radio__control .#{sys.$prefix}radio__indicator {
186
+ border-color: var(--#{sys.$prefix}radio-border-invalid, var(--#{sys.$prefix}theme-danger-base));
187
+ }
188
+
164
189
  // ---------------------------------------------------------------------------
165
190
  // Radio label
166
191
  // ---------------------------------------------------------------------------
@@ -255,5 +280,17 @@
255
280
  background-color: Highlight;
256
281
  }
257
282
  }
283
+
284
+ // The invalid tint is (0,6,0) and would otherwise outrank both rules above,
285
+ // painting a theme color into a forced-colors palette. Restore the system
286
+ // colors at matching weight. Invalid is conveyed by aria-invalid and the
287
+ // Field error text here, not by hue.
288
+ .#{sys.$prefix}interface .#{sys.$prefix}radio-group[aria-invalid="true"] .#{sys.$prefix}radio .#{sys.$prefix}radio__control .#{sys.$prefix}radio__indicator {
289
+ border-color: CanvasText;
290
+ }
291
+
292
+ .#{sys.$prefix}interface .#{sys.$prefix}radio-group[aria-invalid="true"] .#{sys.$prefix}radio:has(.#{sys.$prefix}radio__control[aria-checked="true"]) .#{sys.$prefix}radio__control .#{sys.$prefix}radio__indicator {
293
+ border-color: Highlight;
294
+ }
258
295
  }
259
296
  }
@@ -44,44 +44,22 @@
44
44
  // Trigger — a select-shaped button
45
45
  // ---------------------------------------------------------------------------
46
46
  .#{sys.$prefix}interface .#{sys.$prefix}search-select__trigger {
47
- --_bg: var(--#{sys.$prefix}search-select-trigger-bg, var(--#{sys.$prefix}select-trigger-bg, var(--#{sys.$prefix}color-bg-surface)));
48
- --_fg: var(--#{sys.$prefix}search-select-trigger-fg, var(--#{sys.$prefix}select-trigger-fg, var(--#{sys.$prefix}color-fg)));
49
- --_border: var(--#{sys.$prefix}search-select-trigger-border, var(--#{sys.$prefix}select-trigger-border, var(--#{sys.$prefix}color-border)));
50
- --_border-focus: var(--#{sys.$prefix}search-select-trigger-border-focus, var(--#{sys.$prefix}select-trigger-border-focus, var(--#{sys.$prefix}theme-primary-base)));
51
- --_radius: var(--#{sys.$prefix}search-select-trigger-radius, var(--#{sys.$prefix}select-trigger-radius, var(--#{sys.$prefix}radius-md)));
52
-
53
- // Reset
54
- appearance: none;
55
- margin: 0;
56
-
57
- // Unified control sizing (height + font ladder)
58
- @include sys.control-sizing(sys.$prefix);
59
-
60
- display: inline-flex;
61
- align-items: center;
47
+ // Chrome comes from .tui-input-group. The select-family chain stays in
48
+ // front of the shared input default, so a context that themes Select
49
+ // triggers still carries SearchSelect with it.
50
+ --_bg: var(--#{sys.$prefix}search-select-trigger-bg, var(--#{sys.$prefix}select-trigger-bg, var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface))));
51
+ --_fg: var(--#{sys.$prefix}search-select-trigger-fg, var(--#{sys.$prefix}select-trigger-fg, var(--#{sys.$prefix}input-fg, var(--#{sys.$prefix}color-fg))));
52
+ --_border: var(--#{sys.$prefix}search-select-trigger-border, var(--#{sys.$prefix}select-trigger-border, var(--#{sys.$prefix}input-border, var(--#{sys.$prefix}color-border))));
53
+ --_border-focus: var(--#{sys.$prefix}search-select-trigger-border-focus, var(--#{sys.$prefix}select-trigger-border-focus, var(--#{sys.$prefix}input-border-focus, var(--#{sys.$prefix}theme-primary-base))));
54
+ --_radius: var(--#{sys.$prefix}search-select-trigger-radius, var(--#{sys.$prefix}select-trigger-radius, var(--#{sys.$prefix}input-radius, var(--#{sys.$prefix}radius-md))));
55
+
56
+ // Deltas from the primitive
62
57
  justify-content: space-between;
63
- gap: var(--#{sys.$prefix}spacing-xs);
64
58
  width: 100%;
65
59
  padding-inline: var(--#{sys.$prefix}spacing-sm);
66
- text-align: start;
67
-
68
- background-color: var(--_bg);
69
- color: var(--_fg);
70
- border: var(--#{sys.$prefix}border-width) solid var(--_border);
71
- border-radius: var(--_radius);
72
60
  cursor: pointer;
61
+ text-align: start;
73
62
  transition: border-color var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
74
-
75
- &:focus-visible {
76
- border-color: var(--_border-focus);
77
- outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
78
- outline-offset: var(--#{sys.$prefix}focus-ring-offset);
79
- }
80
-
81
- &:disabled {
82
- opacity: var(--#{sys.$prefix}opacity-disabled);
83
- cursor: not-allowed;
84
- }
85
63
  }
86
64
 
87
65
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}search-select__value {
@@ -225,12 +203,12 @@
225
203
  }
226
204
 
227
205
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}search-select__label {
228
- padding: var(--#{sys.$prefix}spacing-xxs) var(--#{sys.$prefix}spacing-sm);
206
+ padding: var(--#{sys.$prefix}spacing-xs) var(--#{sys.$prefix}spacing-sm);
229
207
  color: var(--#{sys.$prefix}color-fg-muted);
230
208
  font-size: var(--#{sys.$prefix}typography-size-xs);
231
- font-weight: var(--#{sys.$prefix}typography-weight-medium, 600);
209
+ font-weight: var(--#{sys.$prefix}typography-weight-semibold, 600);
232
210
  text-transform: uppercase;
233
- letter-spacing: 0.05em;
211
+ letter-spacing: sys.$label-letter-spacing;
234
212
  }
235
213
 
236
214
  // High-contrast mode: keep highlighted/selected legible
@@ -20,7 +20,6 @@
20
20
  // Structural SCSS constants (compile away, not overridable)
21
21
  // $_min-width is the compile-time default for --tui-select-min-width.
22
22
  $_min-width: 160px;
23
- $_label-letter-spacing: 0.05em;
24
23
 
25
24
  @mixin styles() {
26
25
  // ==========================================================================
@@ -67,41 +66,31 @@ $_label-letter-spacing: 0.05em;
67
66
  // Trigger
68
67
  // ---------------------------------------------------------------------------
69
68
 
70
- :where(.#{sys.$prefix}interface) .#{sys.$prefix}select__trigger {
71
- // Internal tokens with real fallbacks
72
- --_bg: var(--#{sys.$prefix}select-trigger-bg, var(--#{sys.$prefix}color-bg-surface));
73
- --_fg: var(--#{sys.$prefix}select-trigger-fg, var(--#{sys.$prefix}color-fg));
74
- --_border: var(--#{sys.$prefix}select-trigger-border, var(--#{sys.$prefix}color-border));
75
- --_border-focus: var(--#{sys.$prefix}select-trigger-border-focus, var(--#{sys.$prefix}theme-primary-base));
76
- --_radius: var(--#{sys.$prefix}select-trigger-radius, var(--#{sys.$prefix}radius-md));
77
- --_min-width: var(--#{sys.$prefix}select-min-width, $_min-width);
78
-
79
- // Reset
80
- appearance: none;
81
- border: none;
82
- font: inherit;
83
- margin: 0;
84
-
85
- // Unified sizing
86
- @include sys.control-sizing(sys.$prefix);
87
-
88
- // Layout
89
- display: inline-flex;
90
- align-items: center;
69
+ // The trigger wears .tui-input-group: bg, fg, border, focus border, radius,
70
+ // control sizing, the focus ring, and the open/disabled states all come from
71
+ // that primitive. What stays here is what genuinely differs from a text field.
72
+ //
73
+ // Full specificity (not :where) is required, not stylistic: the primitive's
74
+ // base rule is included LAST in the bundle, so a (0,1,0) selector here would
75
+ // tie with it and lose the token re-pointing below on source order.
76
+ .#{sys.$prefix}interface .#{sys.$prefix}select__trigger {
77
+ // Chain, don't replace: an existing --tui-select-trigger-* override still
78
+ // wins, and the shared --tui-input-* default moves in underneath it.
79
+ --_bg: var(--#{sys.$prefix}select-trigger-bg, var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface)));
80
+ --_fg: var(--#{sys.$prefix}select-trigger-fg, var(--#{sys.$prefix}input-fg, var(--#{sys.$prefix}color-fg)));
81
+ --_border: var(--#{sys.$prefix}select-trigger-border, var(--#{sys.$prefix}input-border, var(--#{sys.$prefix}color-border)));
82
+ --_border-focus: var(--#{sys.$prefix}select-trigger-border-focus, var(--#{sys.$prefix}input-border-focus, var(--#{sys.$prefix}theme-primary-base)));
83
+ --_radius: var(--#{sys.$prefix}select-trigger-radius, var(--#{sys.$prefix}input-radius, var(--#{sys.$prefix}radius-md)));
84
+ --_min-width: var(--#{sys.$prefix}select-min-width, #{$_min-width});
85
+
86
+ // Deltas from the primitive: a value + chevron push apart, the box fills
87
+ // its container, roomier inline padding (12 vs the text field's 8 — see the
88
+ // padding-inline note in _control.scss), and it clicks rather than types.
91
89
  justify-content: space-between;
92
- gap: var(--#{sys.$prefix}spacing-xs);
93
90
  min-width: var(--_min-width);
94
91
  width: 100%;
95
92
  padding-inline: var(--#{sys.$prefix}spacing-sm);
96
-
97
- // Visual
98
- background-color: var(--_bg);
99
- color: var(--_fg);
100
- border: var(--#{sys.$prefix}border-width) solid var(--_border);
101
- border-radius: var(--_radius);
102
93
  cursor: pointer;
103
-
104
- // Typography
105
94
  line-height: 1.4;
106
95
  text-align: left;
107
96
 
@@ -109,24 +98,6 @@ $_label-letter-spacing: 0.05em;
109
98
  transition-duration: var(--#{sys.$prefix}motion-duration);
110
99
  transition-timing-function: var(--#{sys.$prefix}motion-timing);
111
100
  transition-property: border-color, background-color;
112
-
113
- // :focus, not :focus-visible — native selects show the ring on mouse
114
- // focus too (form-control heuristic), and this button impersonates one
115
- &:focus {
116
- --_border: var(--_border-focus);
117
- outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
118
- outline-offset: var(--#{sys.$prefix}focus-ring-offset);
119
- }
120
-
121
- &[data-state="open"] {
122
- --_border: var(--_border-focus);
123
- }
124
-
125
- &[data-disabled],
126
- &[disabled] {
127
- opacity: var(--#{sys.$prefix}opacity-disabled);
128
- cursor: not-allowed;
129
- }
130
101
  }
131
102
 
132
103
  :where(.#{sys.$prefix}interface) .#{sys.$prefix}select__value {
@@ -217,7 +188,7 @@ $_label-letter-spacing: 0.05em;
217
188
  --_border: var(--#{sys.$prefix}select-content-border, var(--#{sys.$prefix}color-border));
218
189
  --_shadow: var(--#{sys.$prefix}select-content-shadow, var(--#{sys.$prefix}shadow-dropdown));
219
190
  --_radius: var(--#{sys.$prefix}select-content-radius, var(--#{sys.$prefix}radius-md));
220
- --_min-width: var(--#{sys.$prefix}select-min-width, $_min-width);
191
+ --_min-width: var(--#{sys.$prefix}select-min-width, #{$_min-width});
221
192
 
222
193
  // Layout
223
194
  z-index: var(--#{sys.$prefix}layer-top);
@@ -349,7 +320,7 @@ $_label-letter-spacing: 0.05em;
349
320
  font-weight: var(--#{sys.$prefix}typography-weight-semibold, 600);
350
321
  color: var(--#{sys.$prefix}color-fg-muted);
351
322
  text-transform: uppercase;
352
- letter-spacing: $_label-letter-spacing;
323
+ letter-spacing: sys.$label-letter-spacing;
353
324
  }
354
325
 
355
326
  // ---------------------------------------------------------------------------
@@ -23,19 +23,31 @@
23
23
  // Internal tokens
24
24
  --_gap: var(--#{sys.$prefix}input-group-gap, var(--#{sys.$prefix}spacing-xs));
25
25
  --_bg: var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface));
26
+ --_fg: var(--#{sys.$prefix}input-fg, var(--#{sys.$prefix}color-fg));
26
27
  --_border: var(--#{sys.$prefix}input-border, var(--#{sys.$prefix}color-border));
27
28
  --_border-focus: var(--#{sys.$prefix}input-border-focus, var(--#{sys.$prefix}theme-primary-base));
28
29
  --_radius: var(--#{sys.$prefix}input-radius, var(--#{sys.$prefix}radius-md));
29
30
 
31
+ // Host-agnostic resets. The group is worn by a <div> wrapper (TextInput,
32
+ // SearchInput, DatePicker, Combobox, MultiCombobox) and by a <button>
33
+ // trigger (Select, MultiSelect, SearchSelect) — the button needs these, the
34
+ // div is unaffected by them. `font: inherit` must precede control-sizing or
35
+ // it would reset the font-size the mixin just set.
36
+ appearance: none;
37
+ margin: 0;
38
+ font: inherit;
39
+
30
40
  @include sys.control-sizing(sys.$prefix);
31
41
 
32
42
  display: inline-flex;
33
43
  align-items: center;
34
44
  gap: var(--_gap);
35
45
  background-color: var(--_bg);
46
+ color: var(--_fg);
36
47
  border: var(--#{sys.$prefix}border-width) solid var(--_border);
37
48
  border-radius: var(--_radius);
38
49
  padding-inline: var(--#{sys.$prefix}spacing-xs);
50
+ // Wrapper default. Button hosts override to `pointer`.
39
51
  cursor: text;
40
52
 
41
53
  // Input inside group has no border (group provides it). The group also
@@ -59,30 +71,76 @@
59
71
  }
60
72
  }
61
73
 
62
- // Focus state on the wrapper when input is focused.
63
- // Uses :focus-within (not :focus-visible) because no :focus-within-visible
64
- // pseudo-class exists. This shows the ring on mouse click too — accepted
65
- // trade-off (over-application, not under-application, so WCAG 2.4.11 is met).
66
- &:focus-within {
67
- --_border: var(--_border-focus);
68
- outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
69
- outline-offset: var(--#{sys.$prefix}focus-ring-offset);
70
- }
74
+ }
71
75
 
72
- // Invalid state — bubble from child input to wrapper border
73
- &:has(input:invalid),
74
- &:has(input[aria-invalid="true"]) {
75
- --_border: var(--#{sys.$prefix}input-border-invalid, var(--#{sys.$prefix}theme-danger-base));
76
- }
76
+ // ---------------------------------------------------------------------------
77
+ // Group states
78
+ // ---------------------------------------------------------------------------
79
+ //
80
+ // Full specificity (0,3,0+) on purpose, and NOT nested under the base rule.
81
+ // A host that wears this class re-points --_bg/--_border/--_radius in its own
82
+ // rule at (0,2,0) — `.tui-interface .tui-select__trigger` and friends. If a
83
+ // state rule only reached (0,2,0) it would tie with that base definition and
84
+ // resolve on bundle source order, silently dropping the focus border. Keeping
85
+ // states above every host's base rule makes the outcome order-independent.
86
+ // (Selectors are spelled out rather than written with a trailing `&` — see the
87
+ // Sass parent-splice gotcha in CLAUDE.md.)
88
+ // ---------------------------------------------------------------------------
77
89
 
78
- &.is-disabled {
79
- opacity: var(--#{sys.$prefix}opacity-disabled);
80
- cursor: not-allowed;
90
+ // Uses :focus-within (not :focus-visible) because no :focus-within-visible
91
+ // pseudo-class exists. This shows the ring on mouse click too — accepted
92
+ // trade-off (over-application, not under-application, so WCAG 2.4.11 is met).
93
+ // On a <button> host :focus-within is simply :focus, which is what the select
94
+ // family wants anyway: native selects ring on mouse focus too.
95
+ .#{sys.$prefix}interface .#{sys.$prefix}input-group:focus-within {
96
+ --_border: var(--_border-focus);
97
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
98
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
99
+ }
81
100
 
82
- // Block interaction on children but keep cursor on wrapper
83
- > * {
84
- pointer-events: none;
85
- }
101
+ // A control owning a panel keeps its border lit while the panel is open.
102
+ // Three spellings because the attribute sits wherever the ARIA does: on the
103
+ // trigger button (Select, MultiSelect), on the host itself, or on an inner
104
+ // combobox input (Combobox, MultiCombobox). Inert for plain inputs.
105
+ .#{sys.$prefix}interface .#{sys.$prefix}input-group:is(
106
+ [data-state="open"],
107
+ [aria-expanded="true"],
108
+ :has(input[aria-expanded="true"])
109
+ ) {
110
+ --_border: var(--_border-focus);
111
+ }
112
+
113
+ // Invalid — from a child input, or from the host itself when the host is the
114
+ // labelled control (a button trigger carrying aria-invalid).
115
+ //
116
+ // LAST of the border-colour states on purpose: an invalid control must stay
117
+ // red while the user is interacting with it, so this has to out-order both
118
+ // :focus-within and the panel-open rule above. For the select family those
119
+ // two states are near-permanent while the control is in use — losing the tie
120
+ // would blank the error the moment the listbox opened.
121
+ .#{sys.$prefix}interface .#{sys.$prefix}input-group:is(
122
+ :has(input:invalid),
123
+ :has(input[aria-invalid="true"]),
124
+ [aria-invalid="true"]
125
+ ) {
126
+ --_border: var(--#{sys.$prefix}input-border-invalid, var(--#{sys.$prefix}theme-danger-base));
127
+ }
128
+
129
+ // Disabled, in every spelling the family uses: a class (TextInput), the native
130
+ // attribute on a button host, data-disabled (asChild triggers), or a disabled
131
+ // inner input (token fields).
132
+ .#{sys.$prefix}interface .#{sys.$prefix}input-group:is(
133
+ .is-disabled,
134
+ :disabled,
135
+ [data-disabled],
136
+ :has(input:disabled)
137
+ ) {
138
+ opacity: var(--#{sys.$prefix}opacity-disabled);
139
+ cursor: not-allowed;
140
+
141
+ // Block interaction on children but keep cursor on wrapper
142
+ > * {
143
+ pointer-events: none;
86
144
  }
87
145
  }
88
146
 
@@ -9,4 +9,10 @@ $prefix: tui- !default;
9
9
  $container-name: tuiContainer !default;
10
10
  $radius: (xs: 2px, sm: 4px, md: 8px, lg: 12px, xl: 16px, full: 9999px) !default;
11
11
  $space : (1: .25rem, 2: .5rem, 3: .75rem, 4: 1rem) !default;
12
- $font : (base-size: 16px) !default;
12
+ $font : (base-size: 16px) !default;
13
+
14
+ // Tracking for the uppercase micro-label treatment shared by listbox/menu group
15
+ // labels (Select, MultiSelect, Combobox, MultiCombobox, SearchSelect, Dropdown)
16
+ // and DatePicker's field labels. Structural rather than a token: it's a property
17
+ // of that one typographic treatment, not a dial a context should retune.
18
+ $label-letter-spacing: 0.05em !default;