@tangible/ui 0.0.18 → 0.0.20

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 (80) hide show
  1. package/README.md +32 -1
  2. package/components/Avatar/Avatar.d.ts +3 -1
  3. package/components/Avatar/Avatar.js +6 -25
  4. package/components/Avatar/index.d.ts +2 -2
  5. package/components/Avatar/index.js +1 -1
  6. package/components/Avatar/types.d.ts +8 -8
  7. package/components/Avatar/types.js +0 -12
  8. package/components/Icon/Icon.d.ts +10 -1
  9. package/components/Icon/Icon.js +5 -1
  10. package/components/Modal/Modal.js +1 -1
  11. package/components/OverlapStack/OverlapStack.js +4 -2
  12. package/components/Pager/Pager.js +9 -3
  13. package/components/Pager/types.d.ts +9 -0
  14. package/components/Pager/types.js +2 -0
  15. package/components/Progress/Progress.js +3 -3
  16. package/components/Rating/Rating.js +4 -2
  17. package/components/Rating/types.d.ts +5 -1
  18. package/components/Rating/types.js +1 -0
  19. package/components/Select/Select.d.ts +1 -1
  20. package/components/Select/Select.js +5 -3
  21. package/components/Select/types.d.ts +5 -0
  22. package/components/StepIndicator/StepIndicator.js +6 -2
  23. package/components/StepIndicator/types.d.ts +3 -0
  24. package/components/StepIndicator/types.js +1 -0
  25. package/components/Table/BulkActionsBar.js +4 -1
  26. package/components/Table/DataTable.js +8 -5
  27. package/components/index.d.ts +3 -2
  28. package/components/index.js +2 -1
  29. package/package.json +3 -1
  30. package/styles/all.css +1 -1
  31. package/styles/all.expanded.css +220 -88
  32. package/styles/all.expanded.unlayered.css +220 -88
  33. package/styles/all.unlayered.css +1 -1
  34. package/styles/components/_bundle.scss +98 -71
  35. package/styles/components/accordion.scss +289 -0
  36. package/styles/components/avatar.scss +298 -0
  37. package/styles/components/button.scss +468 -0
  38. package/styles/components/card.scss +261 -0
  39. package/styles/components/checkbox.scss +184 -0
  40. package/styles/components/chip-group.scss +49 -0
  41. package/styles/components/chip.scss +472 -0
  42. package/styles/components/combobox.scss +378 -0
  43. package/styles/components/content-indicator.scss +114 -0
  44. package/styles/components/dropdown.scss +179 -0
  45. package/styles/components/field.scss +120 -0
  46. package/styles/components/icon-button.scss +311 -0
  47. package/styles/components/icon.scss +42 -0
  48. package/styles/components/input/index.scss +6 -1
  49. package/styles/components/modal.scss +312 -0
  50. package/styles/components/move-handle.scss +383 -0
  51. package/styles/components/multi-select.scss +449 -0
  52. package/styles/components/notice.scss +430 -0
  53. package/styles/components/overlap-stack.scss +82 -0
  54. package/styles/components/pager.scss +86 -0
  55. package/styles/components/popover.scss +70 -0
  56. package/styles/components/progress.scss +403 -0
  57. package/styles/components/radio.scss +259 -0
  58. package/styles/components/rating.scss +142 -0
  59. package/styles/components/segmented-control.scss +285 -0
  60. package/styles/components/select.scss +386 -0
  61. package/styles/components/sidebar.scss +240 -0
  62. package/styles/components/step-indicator.scss +118 -0
  63. package/styles/components/step-list.scss +130 -0
  64. package/styles/components/switch.scss +229 -0
  65. package/styles/components/table.scss +140 -0
  66. package/styles/components/tabs.scss +297 -0
  67. package/styles/components/text-input.scss +142 -0
  68. package/styles/components/textarea.scss +35 -0
  69. package/styles/components/toolbar.scss +62 -0
  70. package/styles/components/tooltip.scss +102 -0
  71. package/styles/core.css +1 -0
  72. package/styles/core.scss +12 -0
  73. package/styles/core.unlayered.css +1 -0
  74. package/styles/index.scss +34 -6
  75. package/styles/system/_constants.scss +2 -2
  76. package/styles/system/_motion.scss +20 -18
  77. package/styles/system/_tokens.scss +89 -10
  78. package/tui-manifest.json +10 -3
  79. package/utils/generative.d.ts +16 -0
  80. package/utils/generative.js +45 -0
@@ -0,0 +1,378 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-combobox-input-bg
5
+ --tui-combobox-input-fg
6
+ --tui-combobox-input-border
7
+ --tui-combobox-input-border-focus
8
+ --tui-combobox-input-radius
9
+ --tui-combobox-content-bg
10
+ --tui-combobox-content-border
11
+ --tui-combobox-content-shadow
12
+ --tui-combobox-content-radius
13
+ --tui-combobox-option-radius
14
+ --tui-combobox-option-bg-hover
15
+ --tui-combobox-option-bg-selected
16
+ */
17
+
18
+ // Structural SCSS constants (compile away, not overridable)
19
+ $_min-width: 160px;
20
+ $_label-letter-spacing: 0.05em;
21
+
22
+ @mixin styles() {
23
+ // ==========================================================================
24
+ // Combobox Component
25
+ // ==========================================================================
26
+ //
27
+ // Shares visual language with Select. Uses Select tokens as fallbacks.
28
+ //
29
+ // Component API tokens (only define if Combobox needs different values):
30
+ // --tui-combobox-input-bg
31
+ // --tui-combobox-input-fg
32
+ // --tui-combobox-input-border
33
+ // --tui-combobox-input-border-focus
34
+ // --tui-combobox-input-radius
35
+ // --tui-combobox-content-bg
36
+ // --tui-combobox-content-border
37
+ // --tui-combobox-content-shadow
38
+ // --tui-combobox-content-radius
39
+ // --tui-combobox-option-radius
40
+ // --tui-combobox-option-bg-hover
41
+ // --tui-combobox-option-bg-selected
42
+ //
43
+ // ==========================================================================
44
+
45
+ // ---------------------------------------------------------------------------
46
+ // Root
47
+ // ---------------------------------------------------------------------------
48
+
49
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox {
50
+ position: relative;
51
+ display: inline-block;
52
+ width: 100%;
53
+ }
54
+
55
+ // ---------------------------------------------------------------------------
56
+ // Input Wrapper
57
+ // ---------------------------------------------------------------------------
58
+
59
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__input-wrapper {
60
+ position: relative;
61
+ display: flex;
62
+ align-items: center;
63
+ }
64
+
65
+ // ---------------------------------------------------------------------------
66
+ // Input
67
+ // ---------------------------------------------------------------------------
68
+
69
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__input {
70
+ // Internal tokens with fallbacks to Select tokens
71
+ --_bg: var(--#{sys.$prefix}combobox-input-bg, var(--#{sys.$prefix}select-trigger-bg, var(--#{sys.$prefix}color-bg-surface)));
72
+ --_fg: var(--#{sys.$prefix}combobox-input-fg, var(--#{sys.$prefix}select-trigger-fg, var(--#{sys.$prefix}color-fg)));
73
+ --_border: var(--#{sys.$prefix}combobox-input-border, var(--#{sys.$prefix}select-trigger-border, var(--#{sys.$prefix}color-border)));
74
+ --_border-focus: var(--#{sys.$prefix}combobox-input-border-focus, var(--#{sys.$prefix}select-trigger-border-focus, var(--#{sys.$prefix}theme-primary-base)));
75
+ --_radius: var(--#{sys.$prefix}combobox-input-radius, var(--#{sys.$prefix}select-trigger-radius, var(--#{sys.$prefix}radius-md)));
76
+
77
+ // Reset
78
+ appearance: none;
79
+ font: inherit;
80
+ margin: 0;
81
+
82
+ // Unified sizing (after font reset so font-size wins)
83
+ @include sys.control-sizing(sys.$prefix);
84
+
85
+ // Layout
86
+ display: block;
87
+ width: 100%;
88
+ padding-inline: var(--#{sys.$prefix}spacing-sm);
89
+ padding-right: calc(var(--#{sys.$prefix}spacing-sm) + 1.5em + var(--#{sys.$prefix}spacing-xs) + 1.25em);
90
+
91
+ // Visual
92
+ background-color: var(--_bg);
93
+ color: var(--_fg);
94
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
95
+ border-radius: var(--_radius);
96
+
97
+ // Typography
98
+ line-height: 1.4;
99
+
100
+ // Transitions
101
+ transition-duration: var(--#{sys.$prefix}motion-duration);
102
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
103
+ transition-property: border-color, background-color;
104
+
105
+ &::placeholder {
106
+ color: var(--#{sys.$prefix}color-fg-muted);
107
+ }
108
+
109
+ &:focus {
110
+ --_border: var(--_border-focus);
111
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
112
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
113
+ }
114
+
115
+ &[aria-expanded="true"] {
116
+ --_border: var(--_border-focus);
117
+ }
118
+
119
+ &:disabled {
120
+ opacity: var(--#{sys.$prefix}opacity-disabled);
121
+ cursor: not-allowed;
122
+ }
123
+ }
124
+
125
+ // ---------------------------------------------------------------------------
126
+ // Clear Button
127
+ // ---------------------------------------------------------------------------
128
+
129
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__clear {
130
+ // Reset (real <button>, sibling of input)
131
+ appearance: none;
132
+ border: none;
133
+ background: none;
134
+ padding: 0;
135
+ font: inherit;
136
+ margin: 0;
137
+
138
+ position: absolute;
139
+ right: calc(var(--#{sys.$prefix}spacing-sm) + 1.25em + var(--#{sys.$prefix}spacing-xxs));
140
+ display: flex;
141
+ align-items: center;
142
+ justify-content: center;
143
+ width: 1.25em;
144
+ height: 1.25em;
145
+ border-radius: var(--#{sys.$prefix}radius-sm);
146
+ color: var(--#{sys.$prefix}color-fg-muted);
147
+ cursor: pointer;
148
+ transition: color var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing),
149
+ background-color var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
150
+
151
+ &:hover {
152
+ color: var(--#{sys.$prefix}color-fg);
153
+ background-color: var(--#{sys.$prefix}theme-secondary-subtlest);
154
+ }
155
+
156
+ &:focus-visible {
157
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
158
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
159
+ }
160
+
161
+ :disabled ~ & {
162
+ pointer-events: none;
163
+ }
164
+ }
165
+
166
+ // ---------------------------------------------------------------------------
167
+ // Chevron Icon
168
+ // ---------------------------------------------------------------------------
169
+
170
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__icon {
171
+ position: absolute;
172
+ right: var(--#{sys.$prefix}spacing-sm);
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ color: var(--#{sys.$prefix}color-fg-muted);
177
+ pointer-events: none;
178
+ transition: transform var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
179
+
180
+ [aria-expanded="true"] ~ & {
181
+ transform: rotate(180deg);
182
+ }
183
+ }
184
+
185
+ // ---------------------------------------------------------------------------
186
+ // Content (Listbox)
187
+ // ---------------------------------------------------------------------------
188
+
189
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__content {
190
+ // Internal tokens with fallbacks to Select tokens
191
+ --_bg: var(--#{sys.$prefix}combobox-content-bg, var(--#{sys.$prefix}select-content-bg, var(--#{sys.$prefix}color-bg-elevated)));
192
+ --_border: var(--#{sys.$prefix}combobox-content-border, var(--#{sys.$prefix}select-content-border, var(--#{sys.$prefix}color-border)));
193
+ --_shadow: var(--#{sys.$prefix}combobox-content-shadow, var(--#{sys.$prefix}select-content-shadow, var(--#{sys.$prefix}shadow-dropdown)));
194
+ --_radius: var(--#{sys.$prefix}combobox-content-radius, var(--#{sys.$prefix}select-content-radius, var(--#{sys.$prefix}radius-md)));
195
+
196
+ // Layout
197
+ z-index: var(--#{sys.$prefix}layer-top);
198
+ min-width: $_min-width;
199
+ padding: var(--#{sys.$prefix}spacing-xxs);
200
+ overflow-y: auto;
201
+ overscroll-behavior: contain;
202
+ pointer-events: auto;
203
+
204
+ // Custom scrollbar
205
+ scrollbar-width: thin;
206
+ scrollbar-color: var(--#{sys.$prefix}color-fg-muted) transparent;
207
+
208
+ &::-webkit-scrollbar {
209
+ width: 8px;
210
+ }
211
+
212
+ &::-webkit-scrollbar-track {
213
+ background: transparent;
214
+ }
215
+
216
+ &::-webkit-scrollbar-thumb {
217
+ background-color: var(--#{sys.$prefix}color-fg-muted);
218
+ border-radius: 4px;
219
+ border: 2px solid transparent;
220
+ background-clip: content-box;
221
+ opacity: 0.5;
222
+
223
+ &:hover {
224
+ opacity: 1;
225
+ }
226
+ }
227
+
228
+ // Visual
229
+ background-color: var(--_bg);
230
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
231
+ border-radius: var(--_radius);
232
+ box-shadow: var(--_shadow);
233
+
234
+ // Animation
235
+ animation: #{sys.$prefix}fadeFromTransparent var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
236
+ }
237
+
238
+ // ---------------------------------------------------------------------------
239
+ // Option
240
+ // ---------------------------------------------------------------------------
241
+
242
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option {
243
+ // Internal tokens with fallbacks to Select tokens
244
+ --_option-radius: var(--#{sys.$prefix}combobox-option-radius, var(--#{sys.$prefix}select-option-radius, var(--#{sys.$prefix}radius-sm)));
245
+ --_bg-hover: var(--#{sys.$prefix}combobox-option-bg-hover, var(--#{sys.$prefix}select-option-bg-hover, var(--#{sys.$prefix}theme-secondary-subtlest)));
246
+ --_bg-selected: var(--#{sys.$prefix}combobox-option-bg-selected, var(--#{sys.$prefix}select-option-bg-selected, var(--#{sys.$prefix}theme-primary-subtlest)));
247
+
248
+ // Layout
249
+ display: flex;
250
+ align-items: center;
251
+ justify-content: space-between;
252
+ gap: var(--#{sys.$prefix}spacing-xs);
253
+ padding: var(--#{sys.$prefix}spacing-xs) var(--#{sys.$prefix}spacing-sm);
254
+ border-radius: var(--_option-radius);
255
+ cursor: pointer;
256
+
257
+ // Typography
258
+ font-size: var(--#{sys.$prefix}typography-size-sm);
259
+ line-height: 1.4;
260
+
261
+ &:hover:not([data-disabled]),
262
+ &[data-highlighted]:not([data-disabled]) {
263
+ background-color: var(--_bg-hover);
264
+ }
265
+
266
+ &[aria-selected="true"] {
267
+ background-color: var(--_bg-selected);
268
+ }
269
+
270
+ &[aria-selected="true"]:hover:not([data-disabled]),
271
+ &[aria-selected="true"][data-highlighted]:not([data-disabled]) {
272
+ background-color: var(--#{sys.$prefix}theme-primary-subtle);
273
+ }
274
+
275
+ &[data-disabled] {
276
+ opacity: var(--#{sys.$prefix}opacity-disabled);
277
+ cursor: not-allowed;
278
+ }
279
+ }
280
+
281
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option-content {
282
+ flex: 1;
283
+ min-width: 0;
284
+ }
285
+
286
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option-check {
287
+ flex-shrink: 0;
288
+ color: var(--#{sys.$prefix}theme-primary-base);
289
+ }
290
+
291
+ // ---------------------------------------------------------------------------
292
+ // Group
293
+ // ---------------------------------------------------------------------------
294
+
295
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__group {
296
+ & + & {
297
+ margin-top: var(--#{sys.$prefix}spacing-xxs);
298
+ padding-top: var(--#{sys.$prefix}spacing-xxs);
299
+ border-top: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-divider);
300
+ }
301
+ }
302
+
303
+ // ---------------------------------------------------------------------------
304
+ // Label
305
+ // ---------------------------------------------------------------------------
306
+
307
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__label {
308
+ padding: var(--#{sys.$prefix}spacing-xs) var(--#{sys.$prefix}spacing-sm);
309
+ padding-bottom: var(--#{sys.$prefix}spacing-xxs);
310
+ font-size: var(--#{sys.$prefix}typography-size-xs);
311
+ font-weight: var(--#{sys.$prefix}typography-weight-semibold, 600);
312
+ color: var(--#{sys.$prefix}color-fg-muted);
313
+ text-transform: uppercase;
314
+ letter-spacing: $_label-letter-spacing;
315
+ }
316
+
317
+ // ---------------------------------------------------------------------------
318
+ // Reduced motion
319
+ // ---------------------------------------------------------------------------
320
+
321
+ @media (prefers-reduced-motion: reduce) {
322
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__input {
323
+ transition-duration: 0ms;
324
+ }
325
+
326
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__icon {
327
+ transition-duration: 0ms;
328
+ }
329
+
330
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__clear {
331
+ transition-duration: 0ms;
332
+ }
333
+
334
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__content {
335
+ animation-duration: 0ms;
336
+ }
337
+ }
338
+
339
+ // ---------------------------------------------------------------------------
340
+ // Forced colors (Windows High Contrast Mode)
341
+ // ---------------------------------------------------------------------------
342
+
343
+ @media (forced-colors: active) {
344
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__input {
345
+ background-color: Canvas;
346
+ color: CanvasText;
347
+ border-color: CanvasText;
348
+
349
+ &:focus {
350
+ outline-color: Highlight;
351
+ }
352
+ }
353
+
354
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__content {
355
+ background-color: Canvas;
356
+ color: CanvasText;
357
+ border-color: CanvasText;
358
+ }
359
+
360
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}combobox__option {
361
+ &:hover:not([data-disabled]),
362
+ &[data-highlighted]:not([data-disabled]),
363
+ &[aria-selected="true"] {
364
+ background-color: Highlight;
365
+ color: HighlightText;
366
+ forced-color-adjust: none;
367
+ }
368
+ }
369
+
370
+ .#{sys.$prefix}interface .#{sys.$prefix}combobox__clear {
371
+ color: CanvasText;
372
+
373
+ &:focus-visible {
374
+ outline-color: Highlight;
375
+ }
376
+ }
377
+ }
378
+ }
@@ -0,0 +1,114 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-content-indicator-bg
5
+ --tui-content-indicator-border
6
+ --tui-content-indicator-fg
7
+ */
8
+
9
+ @mixin styles() {
10
+ // ==========================================================================
11
+ // Content Indicator Component
12
+ // ==========================================================================
13
+ //
14
+ // Displays an icon inside a circular frame. For content type markers
15
+ // (quiz, video, reading) or status badges that don't involve progress.
16
+ //
17
+ // Visually matches StepIndicator but is semantically distinct:
18
+ // - StepIndicator: progressbar role, shows completion state
19
+ // - ContentIndicator: img/presentation role, shows content type
20
+ //
21
+ // Component API tokens (never defined here, only read via fallback):
22
+ // --tui-content-indicator-bg Circle background color
23
+ // --tui-content-indicator-border Circle border color
24
+ // --tui-content-indicator-fg Icon color
25
+ //
26
+ // ==========================================================================
27
+
28
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}content-indicator {
29
+ // Internal tokens
30
+ --_bg: var(--#{sys.$prefix}content-indicator-bg, transparent);
31
+ --_border: var(--#{sys.$prefix}content-indicator-border, var(--#{sys.$prefix}color-border));
32
+ --_fg: var(--#{sys.$prefix}content-indicator-fg, var(--#{sys.$prefix}color-fg));
33
+
34
+ display: inline-flex;
35
+
36
+ // -------------------------------------------------------------------------
37
+ // Sizes (match StepIndicator)
38
+ // -------------------------------------------------------------------------
39
+ &.is-size-xs {
40
+ font-size: 8px;
41
+ }
42
+
43
+ &.is-size-sm {
44
+ font-size: 12px;
45
+ }
46
+
47
+ &.is-size-md {
48
+ font-size: 16px;
49
+ }
50
+
51
+ &.is-size-lg {
52
+ font-size: 20px;
53
+ }
54
+
55
+ // -------------------------------------------------------------------------
56
+ // Circle element
57
+ // -------------------------------------------------------------------------
58
+ &__circle {
59
+ position: relative;
60
+ display: grid;
61
+ place-items: center;
62
+ inline-size: 2em;
63
+ block-size: 2em;
64
+ border-radius: 50%;
65
+ background: var(--_bg);
66
+ border: 0.15em solid var(--_border);
67
+
68
+ .#{sys.$prefix}icon {
69
+ font-size: 1.2em;
70
+ color: var(--_fg);
71
+ }
72
+ }
73
+
74
+ // -------------------------------------------------------------------------
75
+ // Variants
76
+ // -------------------------------------------------------------------------
77
+ &.is-variant-solid .#{sys.$prefix}content-indicator__circle {
78
+ border: none;
79
+ background: var(--_border); // Use border color as fill
80
+
81
+ .#{sys.$prefix}icon {
82
+ color: var(--#{sys.$prefix}color-fg-on-accent);
83
+ }
84
+ }
85
+
86
+ // -------------------------------------------------------------------------
87
+ // Themes
88
+ // -------------------------------------------------------------------------
89
+ &.is-theme-default {
90
+ --_border: var(--#{sys.$prefix}color-border);
91
+ --_fg: var(--#{sys.$prefix}color-fg-muted);
92
+ }
93
+
94
+ &.is-theme-info {
95
+ --_border: var(--#{sys.$prefix}theme-info-base);
96
+ --_fg: var(--#{sys.$prefix}theme-info-base);
97
+ }
98
+
99
+ &.is-theme-success {
100
+ --_border: var(--#{sys.$prefix}theme-success-base);
101
+ --_fg: var(--#{sys.$prefix}theme-success-base);
102
+ }
103
+
104
+ &.is-theme-warning {
105
+ --_border: var(--#{sys.$prefix}theme-warning-base);
106
+ --_fg: var(--#{sys.$prefix}theme-warning-base);
107
+ }
108
+
109
+ &.is-theme-danger {
110
+ --_border: var(--#{sys.$prefix}theme-danger-base);
111
+ --_fg: var(--#{sys.$prefix}theme-danger-base);
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,179 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-dropdown-bg
5
+ --tui-dropdown-fg
6
+ --tui-dropdown-radius
7
+ --tui-dropdown-shadow
8
+ --tui-dropdown-border
9
+ --tui-dropdown-z
10
+ --tui-dropdown-min-width
11
+ --tui-dropdown-item-bg-hover
12
+ --tui-dropdown-item-bg-active
13
+ */
14
+
15
+ @mixin styles() {
16
+ // ==========================================================================
17
+ // Dropdown Component
18
+ // ==========================================================================
19
+ //
20
+ // Component API tokens (never defined here, only read via fallback):
21
+ // --tui-dropdown-bg Background color
22
+ // --tui-dropdown-fg Text color
23
+ // --tui-dropdown-radius Border radius
24
+ // --tui-dropdown-shadow Box shadow
25
+ // --tui-dropdown-border Border color
26
+ // --tui-dropdown-z Z-index for portal
27
+ // --tui-dropdown-min-width Minimum width
28
+ // --tui-dropdown-item-bg-hover Item hover background
29
+ // --tui-dropdown-item-bg-active Item active/selected background
30
+ //
31
+ // ==========================================================================
32
+
33
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}dropdown {
34
+ // Internal tokens
35
+ --_bg: var(--#{sys.$prefix}dropdown-bg, var(--#{sys.$prefix}color-bg-elevated));
36
+ --_fg: var(--#{sys.$prefix}dropdown-fg, var(--#{sys.$prefix}color-fg));
37
+ --_radius: var(--#{sys.$prefix}dropdown-radius, var(--#{sys.$prefix}radius-sm));
38
+ --_shadow: var(--#{sys.$prefix}dropdown-shadow, var(--#{sys.$prefix}shadow-md));
39
+ --_z: var(--#{sys.$prefix}dropdown-z, var(--#{sys.$prefix}layer-top));
40
+ --_border: var(--#{sys.$prefix}dropdown-border, var(--#{sys.$prefix}color-border));
41
+ --_item-bg-hover: var(--#{sys.$prefix}dropdown-item-bg-hover, var(--#{sys.$prefix}color-bg-muted));
42
+ --_item-bg-active: var(--#{sys.$prefix}dropdown-item-bg-active, var(--#{sys.$prefix}color-bg-muted));
43
+
44
+ // Layout
45
+ z-index: var(--_z);
46
+ min-width: var(--#{sys.$prefix}dropdown-min-width, 160px);
47
+ padding: var(--#{sys.$prefix}spacing-xxs, 4px);
48
+ pointer-events: auto;
49
+
50
+ // Visual
51
+ background-color: var(--_bg);
52
+ color: var(--_fg);
53
+ border-radius: var(--_radius);
54
+ box-shadow: var(--_shadow);
55
+ border: 1px solid var(--_border);
56
+
57
+ // Typography
58
+ font-size: var(--#{sys.$prefix}typography-size-sm, 14px);
59
+ line-height: 1.4;
60
+
61
+ // Animation (matches Tooltip)
62
+ animation: #{sys.$prefix}fadeFromTransparent var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
63
+ }
64
+
65
+ // ---------------------------------------------------------------------------
66
+ // Dropdown Item (opt-in via .tui-dropdown__item class)
67
+ // ---------------------------------------------------------------------------
68
+ //
69
+ // Dropdown.Item renders a Button and applies `tui-dropdown__item` to it.
70
+ // For custom content (a bare Button or IconButton placed inside Dropdown.Content),
71
+ // add `className="tui-dropdown__item"` explicitly to opt into menu-item styling.
72
+ // Without that class, custom content renders with its component defaults.
73
+ // ---------------------------------------------------------------------------
74
+
75
+ // Full specificity (no :where) on .tui-interface — needed to override
76
+ // Button's `.tui-interface .tui-button` rule which is also 0,2,0.
77
+ .#{sys.$prefix}interface .#{sys.$prefix}dropdown__item {
78
+ // Override Button's sizing/layout
79
+ justify-content: flex-start;
80
+ width: 100%;
81
+ min-width: 0;
82
+ gap: var(--#{sys.$prefix}spacing-xs, 8px);
83
+ padding: var(--#{sys.$prefix}spacing-xs, 8px) var(--#{sys.$prefix}spacing-sm, 12px);
84
+ border-radius: var(--#{sys.$prefix}radius-xs, 4px);
85
+ text-align: left;
86
+ font-weight: normal;
87
+
88
+ // Override Button's colors for menu context
89
+ --#{sys.$prefix}button-bg: transparent;
90
+ --#{sys.$prefix}button-fg: inherit;
91
+ --#{sys.$prefix}button-border-color: transparent;
92
+
93
+ &:hover,
94
+ &[data-active] {
95
+ --#{sys.$prefix}button-bg: var(--_item-bg-hover);
96
+ --#{sys.$prefix}button-fg: inherit;
97
+ }
98
+
99
+ &:focus-visible {
100
+ --#{sys.$prefix}button-bg: var(--_item-bg-hover);
101
+ --#{sys.$prefix}button-fg: inherit;
102
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
103
+ outline-offset: calc(-1 * var(--#{sys.$prefix}focus-ring-width, 2px));
104
+ }
105
+
106
+ &:active {
107
+ --#{sys.$prefix}button-bg: var(--_item-bg-active);
108
+ }
109
+
110
+ &:disabled,
111
+ &[aria-disabled="true"] {
112
+ opacity: var(--#{sys.$prefix}opacity-disabled);
113
+ cursor: not-allowed;
114
+ pointer-events: none;
115
+ }
116
+ }
117
+
118
+ // IconButton tagged as a dropdown item: center the icon instead of left-aligning.
119
+ .#{sys.$prefix}interface .#{sys.$prefix}dropdown__item.#{sys.$prefix}icon-button {
120
+ justify-content: center;
121
+ }
122
+
123
+ // ---------------------------------------------------------------------------
124
+ // Separator
125
+ // ---------------------------------------------------------------------------
126
+
127
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}dropdown__separator {
128
+ border: none;
129
+ border-top: 1px solid var(--#{sys.$prefix}color-border);
130
+ margin: var(--#{sys.$prefix}spacing-xxs, 4px) 0;
131
+ }
132
+
133
+ // ---------------------------------------------------------------------------
134
+ // Header (section label)
135
+ // ---------------------------------------------------------------------------
136
+
137
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}dropdown__header {
138
+ padding: var(--#{sys.$prefix}spacing-xs, 8px) var(--#{sys.$prefix}spacing-sm, 12px);
139
+ padding-block-end: var(--#{sys.$prefix}spacing-xxs, 4px);
140
+ font-size: var(--#{sys.$prefix}typography-size-xs, 11px);
141
+ font-weight: var(--#{sys.$prefix}typography-weight-semibold, 600);
142
+ color: var(--#{sys.$prefix}color-fg-muted);
143
+ letter-spacing: 0.02em;
144
+ user-select: none;
145
+ }
146
+
147
+ // ---------------------------------------------------------------------------
148
+ // Reduced Motion
149
+ // ---------------------------------------------------------------------------
150
+
151
+ @media (prefers-reduced-motion: reduce) {
152
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}dropdown {
153
+ animation: none;
154
+ }
155
+ }
156
+
157
+ // ---------------------------------------------------------------------------
158
+ // Forced colors (Windows High Contrast Mode)
159
+ // ---------------------------------------------------------------------------
160
+
161
+ @media (forced-colors: active) {
162
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}dropdown {
163
+ background-color: Canvas;
164
+ color: CanvasText;
165
+ border: 1px solid CanvasText;
166
+ }
167
+
168
+ .#{sys.$prefix}interface .#{sys.$prefix}dropdown__item {
169
+ &:hover,
170
+ &:focus-visible,
171
+ &[data-active] {
172
+ background-color: Highlight;
173
+ color: HighlightText;
174
+ forced-color-adjust: none;
175
+ }
176
+ }
177
+ }
178
+
179
+ }