@tangible/ui 0.0.18 → 0.0.19

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 (43) hide show
  1. package/README.md +31 -1
  2. package/package.json +3 -1
  3. package/styles/components/_bundle.scss +98 -71
  4. package/styles/components/accordion.scss +289 -0
  5. package/styles/components/avatar.scss +346 -0
  6. package/styles/components/button.scss +468 -0
  7. package/styles/components/card.scss +261 -0
  8. package/styles/components/checkbox.scss +184 -0
  9. package/styles/components/chip-group.scss +49 -0
  10. package/styles/components/chip.scss +472 -0
  11. package/styles/components/combobox.scss +378 -0
  12. package/styles/components/content-indicator.scss +114 -0
  13. package/styles/components/dropdown.scss +179 -0
  14. package/styles/components/field.scss +120 -0
  15. package/styles/components/icon-button.scss +311 -0
  16. package/styles/components/icon.scss +42 -0
  17. package/styles/components/modal.scss +312 -0
  18. package/styles/components/move-handle.scss +383 -0
  19. package/styles/components/multi-select.scss +449 -0
  20. package/styles/components/notice.scss +430 -0
  21. package/styles/components/overlap-stack.scss +81 -0
  22. package/styles/components/pager.scss +83 -0
  23. package/styles/components/popover.scss +70 -0
  24. package/styles/components/progress.scss +391 -0
  25. package/styles/components/radio.scss +259 -0
  26. package/styles/components/rating.scss +142 -0
  27. package/styles/components/segmented-control.scss +285 -0
  28. package/styles/components/select.scss +386 -0
  29. package/styles/components/sidebar.scss +240 -0
  30. package/styles/components/step-indicator.scss +118 -0
  31. package/styles/components/step-list.scss +130 -0
  32. package/styles/components/switch.scss +229 -0
  33. package/styles/components/table.scss +139 -0
  34. package/styles/components/tabs.scss +297 -0
  35. package/styles/components/text-input.scss +142 -0
  36. package/styles/components/textarea.scss +35 -0
  37. package/styles/components/toolbar.scss +62 -0
  38. package/styles/components/tooltip.scss +102 -0
  39. package/styles/core.css +1 -0
  40. package/styles/core.scss +12 -0
  41. package/styles/core.unlayered.css +1 -0
  42. package/styles/index.scss +29 -4
  43. package/tui-manifest.json +2 -2
@@ -0,0 +1,297 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-tabs-gap
5
+ --tui-tabs-list-bg
6
+ --tui-tabs-list-padding
7
+ --tui-tabs-list-radius
8
+ --tui-tabs-tab-padding
9
+ --tui-tabs-tab-radius
10
+ --tui-tabs-tab-bg
11
+ --tui-tabs-tab-fg
12
+ --tui-tabs-tab-bg-active
13
+ --tui-tabs-tab-fg-active
14
+ --tui-tabs-tab-bg-hover
15
+ --tui-tabs-tab-border
16
+ --tui-tabs-indicator
17
+ --tui-tabs-indicator-size
18
+ */
19
+
20
+ @mixin styles() {
21
+ // ==========================================================================
22
+ // Tabs Component
23
+ // ==========================================================================
24
+ //
25
+ // Component API tokens (never defined here, only read via fallback):
26
+ // --tui-tabs-gap Gap between tabs in list
27
+ // --tui-tabs-list-bg Tablist background
28
+ // --tui-tabs-list-padding Tablist padding
29
+ // --tui-tabs-list-radius Tablist border radius
30
+ // --tui-tabs-tab-padding Tab button padding
31
+ // --tui-tabs-tab-radius Tab button border radius
32
+ // --tui-tabs-tab-bg Tab background (inactive)
33
+ // --tui-tabs-tab-fg Tab foreground (inactive)
34
+ // --tui-tabs-tab-bg-active Tab background (active)
35
+ // --tui-tabs-tab-fg-active Tab foreground (active)
36
+ // --tui-tabs-tab-bg-hover Tab background (hover)
37
+ // --tui-tabs-tab-border Tab border color
38
+ // --tui-tabs-indicator Underline indicator color
39
+ // --tui-tabs-indicator-size Underline thickness
40
+ //
41
+ // To override from consuming code:
42
+ // .my-context .tui-tabs { --tui-tabs-tab-bg-active: hotpink; }
43
+ //
44
+ // ==========================================================================
45
+
46
+ // ---------------------------------------------------------------------------
47
+ // Root Container
48
+ // ---------------------------------------------------------------------------
49
+
50
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tabs {
51
+ display: flex;
52
+ flex-direction: column;
53
+ gap: var(--#{sys.$prefix}spacing-md);
54
+
55
+ &[data-orientation="vertical"] {
56
+ flex-direction: row;
57
+ align-items: flex-start;
58
+
59
+ // Tablist in vertical orientation
60
+ .#{sys.$prefix}tabs__list {
61
+ flex-direction: column;
62
+ align-items: stretch;
63
+ flex-wrap: nowrap;
64
+ }
65
+
66
+ // Left-align tab content in vertical orientation
67
+ .#{sys.$prefix}tabs__tab {
68
+ text-align: start;
69
+ justify-content: flex-start;
70
+ }
71
+ }
72
+ }
73
+
74
+ // ---------------------------------------------------------------------------
75
+ // Tablist
76
+ // ---------------------------------------------------------------------------
77
+
78
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tabs__list {
79
+ display: flex;
80
+ flex-wrap: wrap;
81
+ gap: var(--#{sys.$prefix}tabs-gap, var(--#{sys.$prefix}spacing-xs));
82
+ align-items: center;
83
+
84
+ // Pill variant: list has background
85
+ [data-variant="pill"] & {
86
+ background: var(--#{sys.$prefix}tabs-list-bg, var(--#{sys.$prefix}color-bg-muted));
87
+ padding: var(--#{sys.$prefix}tabs-list-padding, var(--#{sys.$prefix}spacing-xs));
88
+ border-radius: var(--#{sys.$prefix}tabs-list-radius, var(--#{sys.$prefix}radius-lg));
89
+ }
90
+
91
+ // Underline variant: bottom border on list
92
+ [data-variant="underline"] & {
93
+ gap: var(--#{sys.$prefix}tabs-gap, var(--#{sys.$prefix}spacing-md));
94
+ border-block-end: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-border);
95
+ }
96
+
97
+ // Outline variant: no list background
98
+ [data-variant="outline"] & {
99
+ gap: var(--#{sys.$prefix}tabs-gap, var(--#{sys.$prefix}spacing-xs));
100
+ }
101
+ }
102
+
103
+ // ---------------------------------------------------------------------------
104
+ // Tab Button
105
+ // ---------------------------------------------------------------------------
106
+ // Note: No :where() wrapper here — buttons need specificity to beat theme styles
107
+
108
+ .#{sys.$prefix}interface .#{sys.$prefix}tabs__tab {
109
+ // Internal tokens with fallback chains
110
+ --_bg: var(--#{sys.$prefix}tabs-tab-bg, transparent);
111
+ --_fg: var(--#{sys.$prefix}tabs-tab-fg, var(--#{sys.$prefix}color-fg-muted));
112
+ --_border: var(--#{sys.$prefix}tabs-tab-border, transparent);
113
+ --_bg-active: var(--#{sys.$prefix}tabs-tab-bg-active, var(--#{sys.$prefix}theme-primary-base, currentColor));
114
+ --_fg-active: var(--#{sys.$prefix}tabs-tab-fg-active, var(--#{sys.$prefix}color-fg-on-accent));
115
+ --_bg-hover: var(--#{sys.$prefix}tabs-tab-bg-hover, var(--#{sys.$prefix}color-bg-muted));
116
+ --_indicator: var(--#{sys.$prefix}tabs-indicator, var(--#{sys.$prefix}theme-primary-base, currentColor));
117
+ --_indicator-size: var(--#{sys.$prefix}tabs-indicator-size, 2px);
118
+ --_padding: var(--#{sys.$prefix}tabs-tab-padding, var(--#{sys.$prefix}spacing-sm) var(--#{sys.$prefix}spacing-md));
119
+ --_radius: var(--#{sys.$prefix}tabs-tab-radius, var(--#{sys.$prefix}radius-md));
120
+
121
+ display: inline-flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ gap: var(--#{sys.$prefix}spacing-xs);
125
+ padding: var(--_padding);
126
+ border: none;
127
+ border-radius: var(--_radius);
128
+ background: var(--_bg);
129
+ color: var(--_fg);
130
+ font: inherit;
131
+ font-size: var(--#{sys.$prefix}typography-size-sm);
132
+ font-weight: var(--#{sys.$prefix}font-weight-medium, 500);
133
+ line-height: var(--#{sys.$prefix}line-height-tight, 1.25);
134
+ text-decoration: none;
135
+ white-space: nowrap;
136
+ cursor: pointer;
137
+ transition-property: background-color, color, border-color;
138
+ transition-duration: var(--#{sys.$prefix}motion-duration);
139
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
140
+
141
+ &:hover:not(:disabled):not([data-state="active"]) {
142
+ background: var(--_bg-hover);
143
+ color: var(--#{sys.$prefix}color-fg);
144
+ }
145
+
146
+ &:focus-visible {
147
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
148
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
149
+ z-index: 1;
150
+ }
151
+
152
+ &:disabled {
153
+ opacity: var(--#{sys.$prefix}opacity-disabled);
154
+ cursor: not-allowed;
155
+ }
156
+ }
157
+
158
+ // ---------------------------------------------------------------------------
159
+ // Tab Label (child span)
160
+ // ---------------------------------------------------------------------------
161
+
162
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tabs__tab-label {
163
+ // Allow truncation if needed in tight spaces
164
+ min-width: 0;
165
+ }
166
+
167
+ // ---------------------------------------------------------------------------
168
+ // Variant: Pill
169
+ // ---------------------------------------------------------------------------
170
+
171
+ .#{sys.$prefix}interface [data-variant="pill"] .#{sys.$prefix}tabs__tab {
172
+ --_radius: var(--#{sys.$prefix}tabs-tab-radius, var(--#{sys.$prefix}radius-md));
173
+ --_bg-hover: var(--#{sys.$prefix}tabs-tab-bg-hover, color-mix(in srgb, var(--#{sys.$prefix}color-fg) 8%, transparent));
174
+
175
+ &[data-state="active"] {
176
+ background: var(--_bg-active);
177
+ color: var(--_fg-active);
178
+ }
179
+ }
180
+
181
+ // ---------------------------------------------------------------------------
182
+ // Variant: Underline
183
+ // ---------------------------------------------------------------------------
184
+
185
+ .#{sys.$prefix}interface [data-variant="underline"] .#{sys.$prefix}tabs__tab {
186
+ --_padding: var(--#{sys.$prefix}tabs-tab-padding, var(--#{sys.$prefix}spacing-sm) var(--#{sys.$prefix}spacing-xs));
187
+ --_radius: 0;
188
+ --_bg-hover: transparent;
189
+ --_fg-active: var(--#{sys.$prefix}tabs-tab-fg-active, var(--#{sys.$prefix}color-fg));
190
+
191
+ position: relative;
192
+ margin-block-end: calc(var(--#{sys.$prefix}border-width) * -1);
193
+ border-bottom: var(--_indicator-size) solid transparent;
194
+ border-radius: 0;
195
+
196
+ &:hover:not(:disabled):not([data-state="active"]) {
197
+ color: var(--#{sys.$prefix}color-fg);
198
+ }
199
+
200
+ &[data-state="active"] {
201
+ color: var(--_fg-active);
202
+ border-bottom-color: var(--_indicator);
203
+ }
204
+
205
+ // Focus ring adjustment for underline variant
206
+ &:focus-visible {
207
+ outline-offset: calc(var(--#{sys.$prefix}focus-ring-offset) * -1);
208
+ }
209
+ }
210
+
211
+ // ---------------------------------------------------------------------------
212
+ // Variant: Outline
213
+ // ---------------------------------------------------------------------------
214
+
215
+ .#{sys.$prefix}interface [data-variant="outline"] .#{sys.$prefix}tabs__tab {
216
+ --_radius: var(--#{sys.$prefix}tabs-tab-radius, var(--#{sys.$prefix}radius-full));
217
+ --_border: var(--#{sys.$prefix}tabs-tab-border, var(--#{sys.$prefix}color-border));
218
+ --_bg-hover: var(--#{sys.$prefix}tabs-tab-bg-hover, var(--#{sys.$prefix}color-bg-muted));
219
+ --_fg-active: var(--#{sys.$prefix}tabs-tab-fg-active, var(--#{sys.$prefix}theme-primary-strong, currentColor));
220
+
221
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
222
+
223
+ &[data-state="active"] {
224
+ --_border: var(--#{sys.$prefix}theme-primary-base, currentColor);
225
+ color: var(--_fg-active);
226
+ background: var(--#{sys.$prefix}theme-primary-subtlest, transparent);
227
+ }
228
+ }
229
+
230
+ // ---------------------------------------------------------------------------
231
+ // Panel
232
+ // ---------------------------------------------------------------------------
233
+
234
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tabs__panel {
235
+ // Hide inactive panels (using aria-hidden + inert in JS, CSS display: none for visual)
236
+ &[data-state="inactive"] {
237
+ display: none;
238
+ }
239
+
240
+ // Focus styles for when panel itself receives focus (tabIndex={0} on active)
241
+ &:focus-visible {
242
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
243
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
244
+ }
245
+
246
+ // Remove default margins on first/last children
247
+ > *:first-child {
248
+ margin-block-start: 0;
249
+ }
250
+
251
+ > *:last-child {
252
+ margin-block-end: 0;
253
+ }
254
+ }
255
+
256
+ // ---------------------------------------------------------------------------
257
+ // Forced Colors (High Contrast Mode)
258
+ // ---------------------------------------------------------------------------
259
+
260
+ @media (forced-colors: active) {
261
+ .#{sys.$prefix}interface .#{sys.$prefix}tabs__tab {
262
+ // Ensure active tab is distinguishable via system highlight
263
+ &[data-state="active"] {
264
+ forced-color-adjust: none;
265
+ background: Highlight;
266
+ color: HighlightText;
267
+ }
268
+
269
+ // Ensure focus is visible
270
+ &:focus-visible {
271
+ outline: 2px solid CanvasText;
272
+ }
273
+ }
274
+
275
+ // Underline variant: ensure indicator visible
276
+ .#{sys.$prefix}interface [data-variant="underline"] .#{sys.$prefix}tabs__tab {
277
+ &[data-state="active"] {
278
+ background: transparent;
279
+ color: CanvasText;
280
+ border-bottom-color: Highlight;
281
+ border-bottom-width: 3px;
282
+ }
283
+ }
284
+
285
+ // Outline variant: ensure border visible
286
+ .#{sys.$prefix}interface [data-variant="outline"] .#{sys.$prefix}tabs__tab {
287
+ border-color: CanvasText;
288
+
289
+ &[data-state="active"] {
290
+ background: transparent;
291
+ color: CanvasText;
292
+ border-color: Highlight;
293
+ border-width: 2px;
294
+ }
295
+ }
296
+ }
297
+ }
@@ -0,0 +1,142 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-input-group-gap
5
+ */
6
+
7
+ // =============================================================================
8
+ // TextInput Styles
9
+ // =============================================================================
10
+ //
11
+ // Component API tokens (never defined here, only read via fallback):
12
+ // --tui-input-group-gap Gap between prefix/input/suffix
13
+ //
14
+ // The input itself uses tokens from src/styles/components/input/index.scss.
15
+ //
16
+ // =============================================================================
17
+
18
+ @mixin styles() {
19
+ // ---------------------------------------------------------------------------
20
+ // Input Group (wrapper for prefix/suffix)
21
+ // ---------------------------------------------------------------------------
22
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group {
23
+ // Internal tokens
24
+ --_gap: var(--#{sys.$prefix}input-group-gap, var(--#{sys.$prefix}spacing-xs));
25
+ --_bg: var(--#{sys.$prefix}input-bg, var(--#{sys.$prefix}color-bg-surface));
26
+ --_border: var(--#{sys.$prefix}input-border, var(--#{sys.$prefix}color-border));
27
+ --_border-focus: var(--#{sys.$prefix}input-border-focus, var(--#{sys.$prefix}theme-primary-base));
28
+ --_radius: var(--#{sys.$prefix}input-radius, var(--#{sys.$prefix}radius-md));
29
+
30
+ @include sys.control-sizing(sys.$prefix);
31
+
32
+ display: inline-flex;
33
+ align-items: center;
34
+ gap: var(--_gap);
35
+ background-color: var(--_bg);
36
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
37
+ border-radius: var(--_radius);
38
+ padding-inline: var(--#{sys.$prefix}spacing-xs);
39
+ cursor: text;
40
+
41
+ // Input inside group has no border (group provides it)
42
+ .#{sys.$prefix}input,
43
+ input {
44
+ border: none;
45
+ border-radius: 0;
46
+ background: transparent;
47
+ padding-inline: 0;
48
+ padding-block: 0;
49
+ min-height: 0;
50
+ min-width: 0;
51
+ flex: 1 1 auto;
52
+
53
+ &:focus-visible {
54
+ outline: none;
55
+ }
56
+ }
57
+
58
+ // Focus state on the wrapper when input is focused.
59
+ // Uses :focus-within (not :focus-visible) because no :focus-within-visible
60
+ // pseudo-class exists. This shows the ring on mouse click too — accepted
61
+ // trade-off (over-application, not under-application, so WCAG 2.4.11 is met).
62
+ &:focus-within {
63
+ --_border: var(--_border-focus);
64
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
65
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
66
+ }
67
+
68
+ // Invalid state — bubble from child input to wrapper border
69
+ &:has(input:invalid),
70
+ &:has(input[aria-invalid="true"]) {
71
+ --_border: var(--#{sys.$prefix}input-border-invalid, var(--#{sys.$prefix}theme-danger-base));
72
+ }
73
+
74
+ &.is-disabled {
75
+ opacity: var(--#{sys.$prefix}opacity-disabled);
76
+ cursor: not-allowed;
77
+
78
+ // Block interaction on children but keep cursor on wrapper
79
+ > * {
80
+ pointer-events: none;
81
+ }
82
+ }
83
+ }
84
+
85
+ // ---------------------------------------------------------------------------
86
+ // Prefix/Suffix slots
87
+ // ---------------------------------------------------------------------------
88
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group__prefix,
89
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group__suffix {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ flex-shrink: 0;
93
+ color: var(--#{sys.$prefix}color-fg-secondary);
94
+ pointer-events: none;
95
+ user-select: none;
96
+
97
+ // Interactive children opt back in
98
+ button, a, [role="button"] {
99
+ pointer-events: auto;
100
+ }
101
+
102
+ // Icons inherit size from parent
103
+ .#{sys.$prefix}icon {
104
+ font-size: 1em;
105
+ }
106
+ }
107
+
108
+ // ---------------------------------------------------------------------------
109
+ // Text Addons — string content like "$", ".com", "https://"
110
+ // ---------------------------------------------------------------------------
111
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group__prefix.is-text,
112
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group__suffix.is-text {
113
+ background-color: var(--#{sys.$prefix}color-bg-surface);
114
+ padding-inline: var(--#{sys.$prefix}spacing-xs);
115
+ // Eat into the group's padding-block so the addon sits flush with the border
116
+ margin-block: calc(-1 * var(--_py));
117
+ align-self: stretch;
118
+ display: inline-flex;
119
+ align-items: center;
120
+ }
121
+
122
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group__prefix.is-text {
123
+ border-inline-end: var(--#{sys.$prefix}border-width) solid var(--_border);
124
+ border-start-start-radius: calc(var(--_radius) - var(--#{sys.$prefix}border-width));
125
+ border-end-start-radius: calc(var(--_radius) - var(--#{sys.$prefix}border-width));
126
+ }
127
+
128
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group__suffix.is-text {
129
+ border-inline-start: var(--#{sys.$prefix}border-width) solid var(--_border);
130
+ border-start-end-radius: calc(var(--_radius) - var(--#{sys.$prefix}border-width));
131
+ border-end-end-radius: calc(var(--_radius) - var(--#{sys.$prefix}border-width));
132
+ }
133
+
134
+ // Remove group inline padding on sides with text addons
135
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group:has(> .#{sys.$prefix}input-group__prefix.is-text) {
136
+ padding-inline-start: 0;
137
+ }
138
+
139
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}input-group:has(> .#{sys.$prefix}input-group__suffix.is-text) {
140
+ padding-inline-end: 0;
141
+ }
142
+ }
@@ -0,0 +1,35 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens: none — inherits from input (--tui-input-*) */
4
+
5
+ @mixin styles() {
6
+ // ==========================================================================
7
+ // Textarea Component
8
+ // ==========================================================================
9
+ //
10
+ // Component API tokens (never defined here, only read via fallback):
11
+ // All inherited from input styles (--tui-input-*).
12
+ //
13
+ // The base textarea styling (border, bg, color, focus, invalid) is handled
14
+ // by src/styles/components/input/index.scss which targets native <textarea>.
15
+ // This file adds sizing and auto-resize behaviour.
16
+ //
17
+ // ==========================================================================
18
+
19
+ // Structural constant — prose-friendly line height for multi-line content
20
+ $_line-height: 1.4;
21
+
22
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}textarea {
23
+ @include sys.control-sizing(sys.$prefix);
24
+
25
+ // Override min-height for multi-line — taller default than single-line inputs
26
+ min-height: calc(4em + 2 * var(--_py));
27
+ font-family: inherit;
28
+ line-height: $_line-height;
29
+
30
+ &.is-autoresize {
31
+ resize: none;
32
+ overflow: hidden;
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,62 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-toolbar-gap
5
+ --tui-toolbar-padding
6
+ */
7
+
8
+ @mixin styles() {
9
+ // ==========================================================================
10
+ // Toolbar Component
11
+ // ==========================================================================
12
+ //
13
+ // Component API tokens (never defined here, only read via fallback):
14
+ // --tui-toolbar-gap Gap between items (default: spacing-sm)
15
+ // --tui-toolbar-padding Container padding (default: 0)
16
+ //
17
+ // To override from consuming code:
18
+ // .my-context .tui-toolbar { --tui-toolbar-gap: 1rem; }
19
+ //
20
+ // ==========================================================================
21
+
22
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}toolbar {
23
+ // Internal tokens — read component API with fallback to primitives
24
+ --_gap: var(--#{sys.$prefix}toolbar-gap, var(--#{sys.$prefix}spacing-sm));
25
+ --_padding: var(--#{sys.$prefix}toolbar-padding, 0);
26
+
27
+ display: flex;
28
+ align-items: center;
29
+ gap: var(--_gap);
30
+ padding: var(--_padding);
31
+
32
+ // Vertical orientation
33
+ &[aria-orientation="vertical"] {
34
+ flex-direction: column;
35
+ align-items: stretch;
36
+ }
37
+
38
+ // Disabled items: prevent mouse interaction for keyboard/mouse parity
39
+ [data-tui-toolbar-item][aria-disabled="true"],
40
+ [data-tui-toolbar-item]:disabled {
41
+ pointer-events: none;
42
+ }
43
+
44
+ // Focus-visible fallback for custom toolbar items that lack their own focus ring
45
+ [data-tui-toolbar-item]:focus-visible {
46
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
47
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
48
+ }
49
+ }
50
+
51
+ .#{sys.$prefix}toolbar__group {
52
+ display: flex;
53
+ align-items: center;
54
+ gap: var(--_gap);
55
+
56
+ // Inherit gap from parent toolbar
57
+ .#{sys.$prefix}toolbar[aria-orientation="vertical"] & {
58
+ flex-direction: column;
59
+ align-items: stretch;
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,102 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-tooltip-bg
5
+ --tui-tooltip-fg
6
+ --tui-tooltip-radius
7
+ --tui-tooltip-z
8
+ */
9
+
10
+ @mixin styles() {
11
+ // ==========================================================================
12
+ // Tooltip Component
13
+ // ==========================================================================
14
+ //
15
+ // Component API tokens (never defined here, only read via fallback):
16
+ // --tui-tooltip-bg Background color (default: color-bg-inverted; light: color-bg-surface)
17
+ // --tui-tooltip-fg Text color (default: color-fg-inverted; light: color-fg)
18
+ // --tui-tooltip-radius Border radius (default: radius-sm)
19
+ // --tui-tooltip-z Z-index for portal (default: layer-top)
20
+ //
21
+ // To override from consuming code:
22
+ // .my-context .tui-tooltip { --tui-tooltip-bg: #1a1a1a; }
23
+ //
24
+ // ==========================================================================
25
+
26
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tooltip {
27
+ // Internal tokens — read component API with fallback to primitives
28
+ --_bg: var(--#{sys.$prefix}tooltip-bg, var(--#{sys.$prefix}color-bg-inverted));
29
+ --_fg: var(--#{sys.$prefix}tooltip-fg, var(--#{sys.$prefix}color-fg-inverted));
30
+ --_radius: var(--#{sys.$prefix}tooltip-radius, var(--#{sys.$prefix}radius-sm));
31
+ --_z: var(--#{sys.$prefix}tooltip-z, var(--#{sys.$prefix}layer-top));
32
+
33
+ // Layout
34
+ z-index: var(--_z);
35
+ width: max-content;
36
+ max-width: min(250px, calc(100vw - (2 * var(--#{sys.$prefix}spacing-xs, 8px))));
37
+ padding: 0.35em 0.65em;
38
+ // Re-enable pointer events (portal root has pointer-events: none)
39
+ pointer-events: auto;
40
+
41
+ // Visual
42
+ background-color: var(--_bg);
43
+ color: var(--_fg);
44
+ border-radius: var(--_radius);
45
+
46
+ // Typography
47
+ font-size: var(--#{sys.$prefix}typography-size-sm, 13px);
48
+ line-height: 1.4;
49
+
50
+ // Animation
51
+ animation: #{sys.$prefix}fadeFromTransparent var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
52
+ }
53
+
54
+ // ---------------------------------------------------------------------------
55
+ // Light theme variant
56
+ // ---------------------------------------------------------------------------
57
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tooltip.is-theme-light {
58
+ --_bg: var(--#{sys.$prefix}tooltip-bg, var(--#{sys.$prefix}color-bg-surface));
59
+ --_fg: var(--#{sys.$prefix}tooltip-fg, var(--#{sys.$prefix}color-fg));
60
+ border: 1px solid var(--#{sys.$prefix}color-border);
61
+ }
62
+
63
+ // ---------------------------------------------------------------------------
64
+ // Arrow caret (rendered by FloatingArrow)
65
+ // ---------------------------------------------------------------------------
66
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tooltip__arrow {
67
+ fill: var(--_bg);
68
+ }
69
+
70
+ // ---------------------------------------------------------------------------
71
+ // Trigger focus indicator when tooltip is open
72
+ // ---------------------------------------------------------------------------
73
+ // Helps sighted keyboard users see the tooltip is showing
74
+ :where(.#{sys.$prefix}interface) [data-tooltip-open]:focus-visible {
75
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
76
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
77
+ }
78
+
79
+ // ---------------------------------------------------------------------------
80
+ // Reduced motion
81
+ // ---------------------------------------------------------------------------
82
+ @media (prefers-reduced-motion: reduce) {
83
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tooltip {
84
+ animation: none;
85
+ }
86
+ }
87
+
88
+ // ---------------------------------------------------------------------------
89
+ // Forced colors (Windows High Contrast Mode)
90
+ // ---------------------------------------------------------------------------
91
+ @media (forced-colors: active) {
92
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tooltip {
93
+ background-color: Canvas;
94
+ color: CanvasText;
95
+ border: 1px solid CanvasText;
96
+ }
97
+
98
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}tooltip__arrow {
99
+ fill: Canvas;
100
+ }
101
+ }
102
+ }