@tangible/ui 0.0.17 → 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 (57) hide show
  1. package/README.md +31 -1
  2. package/components/Popover/Popover.d.ts +21 -0
  3. package/components/Popover/Popover.js +148 -0
  4. package/components/Popover/PopoverContext.d.ts +3 -0
  5. package/components/Popover/PopoverContext.js +9 -0
  6. package/components/Popover/index.d.ts +2 -0
  7. package/components/Popover/index.js +1 -0
  8. package/components/Popover/types.d.ts +83 -0
  9. package/components/Popover/types.js +11 -0
  10. package/components/index.d.ts +2 -0
  11. package/components/index.js +1 -0
  12. package/package.json +7 -1
  13. package/styles/all.css +1 -1
  14. package/styles/all.expanded.css +35 -0
  15. package/styles/all.expanded.unlayered.css +35 -0
  16. package/styles/all.unlayered.css +1 -1
  17. package/styles/components/_bundle.scss +98 -69
  18. package/styles/components/accordion.scss +289 -0
  19. package/styles/components/avatar.scss +346 -0
  20. package/styles/components/button.scss +468 -0
  21. package/styles/components/card.scss +261 -0
  22. package/styles/components/checkbox.scss +184 -0
  23. package/styles/components/chip-group.scss +49 -0
  24. package/styles/components/chip.scss +472 -0
  25. package/styles/components/combobox.scss +378 -0
  26. package/styles/components/content-indicator.scss +114 -0
  27. package/styles/components/dropdown.scss +179 -0
  28. package/styles/components/field.scss +120 -0
  29. package/styles/components/icon-button.scss +311 -0
  30. package/styles/components/icon.scss +42 -0
  31. package/styles/components/modal.scss +312 -0
  32. package/styles/components/move-handle.scss +383 -0
  33. package/styles/components/multi-select.scss +449 -0
  34. package/styles/components/notice.scss +430 -0
  35. package/styles/components/overlap-stack.scss +81 -0
  36. package/styles/components/pager.scss +83 -0
  37. package/styles/components/popover.scss +70 -0
  38. package/styles/components/progress.scss +391 -0
  39. package/styles/components/radio.scss +259 -0
  40. package/styles/components/rating.scss +142 -0
  41. package/styles/components/segmented-control.scss +285 -0
  42. package/styles/components/select.scss +386 -0
  43. package/styles/components/sidebar.scss +240 -0
  44. package/styles/components/step-indicator.scss +118 -0
  45. package/styles/components/step-list.scss +130 -0
  46. package/styles/components/switch.scss +229 -0
  47. package/styles/components/table.scss +139 -0
  48. package/styles/components/tabs.scss +297 -0
  49. package/styles/components/text-input.scss +142 -0
  50. package/styles/components/textarea.scss +35 -0
  51. package/styles/components/toolbar.scss +62 -0
  52. package/styles/components/tooltip.scss +102 -0
  53. package/styles/core.css +1 -0
  54. package/styles/core.scss +12 -0
  55. package/styles/core.unlayered.css +1 -0
  56. package/styles/index.scss +29 -4
  57. package/tui-manifest.json +41 -2
@@ -0,0 +1,142 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-rating-active
5
+ --tui-rating-inactive
6
+ --tui-rating-scale
7
+ */
8
+
9
+ @mixin styles() {
10
+ // ==========================================================================
11
+ // Rating Component
12
+ // ==========================================================================
13
+ //
14
+ // Component API tokens (never defined here, only read via fallback):
15
+ // --tui-rating-active Color for active/filled stars
16
+ // --tui-rating-inactive Color for inactive/empty stars
17
+ // --tui-rating-scale Size multiplier (default 2)
18
+ //
19
+ // To override from consuming code:
20
+ // .my-context .tui-rating { --tui-rating-active: hotpink; }
21
+ //
22
+ // ==========================================================================
23
+
24
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}rating {
25
+ // Internal tokens — read component API with fallback to primitives
26
+ --_active: var(--#{sys.$prefix}rating-active, var(--#{sys.$prefix}theme-warning-base));
27
+ --_inactive: var(--#{sys.$prefix}rating-inactive, var(--#{sys.$prefix}color-fg-muted));
28
+ --_scale: var(--#{sys.$prefix}rating-scale, 2);
29
+
30
+ display: inline-flex;
31
+ align-items: center;
32
+
33
+ // -------------------------------------------------------------------------
34
+ // Sizes
35
+ // -------------------------------------------------------------------------
36
+ &.is-size-sm {
37
+ font-size: calc(var(--#{sys.$prefix}typography-size-sm) * var(--_scale));
38
+ }
39
+
40
+ &.is-size-md {
41
+ font-size: calc(var(--#{sys.$prefix}typography-size-md) * var(--_scale));
42
+ }
43
+
44
+ &.is-size-lg {
45
+ font-size: calc(var(--#{sys.$prefix}typography-size-lg) * var(--_scale));
46
+ }
47
+
48
+ &.is-size-xl {
49
+ font-size: calc(var(--#{sys.$prefix}typography-size-xl) * var(--_scale));
50
+ }
51
+
52
+ // -------------------------------------------------------------------------
53
+ // Themes
54
+ // -------------------------------------------------------------------------
55
+ &.is-theme-primary {
56
+ --_active: var(--#{sys.$prefix}rating-active, var(--#{sys.$prefix}theme-primary-base));
57
+ }
58
+
59
+ &.is-theme-secondary {
60
+ --_active: var(--#{sys.$prefix}rating-active, var(--#{sys.$prefix}theme-secondary-base));
61
+ }
62
+
63
+ &.is-theme-success {
64
+ --_active: var(--#{sys.$prefix}rating-active, var(--#{sys.$prefix}theme-success-base));
65
+ }
66
+
67
+ &.is-theme-warning {
68
+ --_active: var(--#{sys.$prefix}rating-active, var(--#{sys.$prefix}theme-warning-base));
69
+ }
70
+
71
+ &.is-theme-danger {
72
+ --_active: var(--#{sys.$prefix}rating-active, var(--#{sys.$prefix}theme-danger-base));
73
+ }
74
+
75
+ // -------------------------------------------------------------------------
76
+ // States
77
+ // -------------------------------------------------------------------------
78
+ &.is-disabled {
79
+ opacity: var(--#{sys.$prefix}opacity-disabled);
80
+ pointer-events: none;
81
+ }
82
+
83
+ // -------------------------------------------------------------------------
84
+ // Item & Star
85
+ // -------------------------------------------------------------------------
86
+ .#{sys.$prefix}rating__item {
87
+ line-height: 1;
88
+ max-height: 1em;
89
+ }
90
+
91
+ label.#{sys.$prefix}rating__star {
92
+ cursor: pointer;
93
+ }
94
+
95
+ // Show focus ring on label when sibling radio input has focus
96
+ .#{sys.$prefix}rating__item:has(input:focus-visible) label.#{sys.$prefix}rating__star {
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
+ border-radius: var(--#{sys.$prefix}radius-sm);
100
+ }
101
+
102
+ .#{sys.$prefix}rating__star {
103
+ display: inline-flex;
104
+ align-items: center;
105
+ justify-content: center;
106
+ font-size: inherit;
107
+ color: var(--_inactive) !important;
108
+
109
+ // Make icon size track font size cleanly
110
+ .#{sys.$prefix}icon {
111
+ flex: 0 0 auto;
112
+ font-size: inherit;
113
+ }
114
+
115
+ // Hover affordance only when interactive
116
+ @media (hover: hover) {
117
+ &:hover {
118
+ filter: brightness(0.95);
119
+ }
120
+ }
121
+
122
+ &.is-active {
123
+ color: var(--_active) !important;
124
+ }
125
+ }
126
+ }
127
+
128
+ // ---------------------------------------------------------------------------
129
+ // Forced colors (Windows High Contrast Mode)
130
+ // ---------------------------------------------------------------------------
131
+
132
+ @media (forced-colors: active) {
133
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}rating .#{sys.$prefix}rating__star {
134
+ forced-color-adjust: none;
135
+ color: GrayText !important;
136
+
137
+ &.is-active {
138
+ color: Highlight !important;
139
+ }
140
+ }
141
+ }
142
+ }
@@ -0,0 +1,285 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-segmented-gap
5
+ --tui-segmented-padding
6
+ --tui-segmented-radius
7
+ --tui-segmented-bg
8
+ --tui-segmented-border
9
+ --tui-segmented-item-padding
10
+ --tui-segmented-item-radius
11
+ --tui-segmented-item-fg
12
+ --tui-segmented-item-bg-active
13
+ --tui-segmented-item-fg-active
14
+ --tui-segmented-indicator
15
+ --tui-segmented-indicator-size
16
+ */
17
+
18
+ @mixin styles() {
19
+ // ==========================================================================
20
+ // SegmentedControl Component
21
+ // ==========================================================================
22
+ //
23
+ // Component API tokens (never defined here, only read via fallback):
24
+ // --tui-segmented-gap Gap between items
25
+ // --tui-segmented-padding Container padding
26
+ // --tui-segmented-radius Container border radius
27
+ // --tui-segmented-bg Container background
28
+ // --tui-segmented-border Container border color
29
+ // --tui-segmented-item-padding Item padding
30
+ // --tui-segmented-item-radius Item border radius
31
+ // --tui-segmented-item-fg Item foreground (inactive)
32
+ // --tui-segmented-item-bg-active Item background (active)
33
+ // --tui-segmented-item-fg-active Item foreground (active)
34
+ // --tui-segmented-indicator Underline indicator color
35
+ // --tui-segmented-indicator-size Underline indicator thickness
36
+ //
37
+ // To override from consuming code:
38
+ // .my-context .tui-segmented { --tui-segmented-item-bg-active: hotpink; }
39
+ //
40
+ // ==========================================================================
41
+
42
+ // ---------------------------------------------------------------------------
43
+ // Root Container
44
+ // ---------------------------------------------------------------------------
45
+
46
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented {
47
+ // Internal tokens with fallback chains
48
+ --_gap: var(--#{sys.$prefix}segmented-gap, var(--#{sys.$prefix}spacing-xs));
49
+ --_padding: var(--#{sys.$prefix}segmented-padding, var(--#{sys.$prefix}spacing-xs));
50
+ --_radius: var(--#{sys.$prefix}segmented-radius, var(--#{sys.$prefix}radius-lg));
51
+ --_bg: var(--#{sys.$prefix}segmented-bg, var(--#{sys.$prefix}color-bg-muted));
52
+ --_border: var(--#{sys.$prefix}segmented-border, transparent);
53
+
54
+ display: inline-flex;
55
+ flex-wrap: nowrap;
56
+ gap: var(--_gap);
57
+ padding: var(--_padding);
58
+ background: var(--_bg);
59
+ border: var(--#{sys.$prefix}border-width) solid var(--_border);
60
+ border-radius: var(--_radius);
61
+
62
+ &.is-wrap {
63
+ flex-wrap: wrap;
64
+ }
65
+
66
+ &.is-vertical {
67
+ flex-direction: column;
68
+ }
69
+
70
+ &[aria-disabled="true"] {
71
+ opacity: var(--#{sys.$prefix}opacity-disabled);
72
+ }
73
+ }
74
+
75
+ // ---------------------------------------------------------------------------
76
+ // Variant: Pill — Item Overrides
77
+ // ---------------------------------------------------------------------------
78
+ // Pill items sit on color-bg-muted; need color-fg for contrast (fg-muted fails 4.5:1)
79
+
80
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-variant-pill .#{sys.$prefix}segmented__item {
81
+ --_item-fg: var(--#{sys.$prefix}segmented-item-fg, var(--#{sys.$prefix}color-fg));
82
+ }
83
+
84
+ // ---------------------------------------------------------------------------
85
+ // Variant: Outline
86
+ // ---------------------------------------------------------------------------
87
+
88
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented.is-variant-outline {
89
+ --_bg: transparent;
90
+ --_border: var(--#{sys.$prefix}segmented-border, var(--#{sys.$prefix}color-border));
91
+ }
92
+
93
+ // ---------------------------------------------------------------------------
94
+ // Variant: Underline
95
+ // ---------------------------------------------------------------------------
96
+
97
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented.is-variant-underline {
98
+ --_bg: transparent;
99
+ --_padding: 0;
100
+ --_gap: var(--#{sys.$prefix}segmented-gap, var(--#{sys.$prefix}spacing-md));
101
+ border-radius: 0;
102
+ border-block-end: var(--#{sys.$prefix}border-width) solid var(--#{sys.$prefix}color-border);
103
+ }
104
+
105
+ // ---------------------------------------------------------------------------
106
+ // Item Button
107
+ // ---------------------------------------------------------------------------
108
+ // Note: No :where() — buttons need specificity to beat theme styles
109
+
110
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented__item {
111
+ // Internal tokens
112
+ --_item-padding: var(--#{sys.$prefix}segmented-item-padding, var(--#{sys.$prefix}spacing-sm) var(--#{sys.$prefix}spacing-md));
113
+ --_item-radius: var(--#{sys.$prefix}segmented-item-radius, var(--#{sys.$prefix}radius-md));
114
+ --_item-bg: transparent;
115
+ --_item-fg: var(--#{sys.$prefix}segmented-item-fg, var(--#{sys.$prefix}color-fg-muted));
116
+ --_item-bg-active: var(--#{sys.$prefix}segmented-item-bg-active, var(--#{sys.$prefix}theme-primary-base));
117
+ --_item-fg-active: var(--#{sys.$prefix}segmented-item-fg-active, var(--#{sys.$prefix}color-fg-on-accent));
118
+ --_item-bg-hover: color-mix(in srgb, var(--#{sys.$prefix}color-fg) 8%, transparent);
119
+
120
+ display: inline-flex;
121
+ align-items: center;
122
+ justify-content: center;
123
+ min-height: var(--#{sys.$prefix}control-height-md);
124
+ gap: var(--#{sys.$prefix}spacing-xs);
125
+ padding: var(--_item-padding);
126
+ border: none;
127
+ border-radius: var(--_item-radius);
128
+ background: var(--_item-bg);
129
+ color: var(--_item-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
+ white-space: nowrap;
135
+ cursor: pointer;
136
+ transition-property: background-color, color;
137
+ transition-duration: var(--#{sys.$prefix}motion-duration);
138
+ transition-timing-function: var(--#{sys.$prefix}motion-timing);
139
+
140
+ &:hover:not([aria-disabled="true"]):not([aria-checked="true"]) {
141
+ background: var(--_item-bg-hover);
142
+ color: var(--#{sys.$prefix}color-fg);
143
+ }
144
+
145
+ &:focus-visible {
146
+ outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
147
+ outline-offset: var(--#{sys.$prefix}focus-ring-offset);
148
+ z-index: 1;
149
+ }
150
+
151
+ &[aria-checked="true"] {
152
+ background: var(--_item-bg-active);
153
+ color: var(--_item-fg-active);
154
+ }
155
+
156
+ &[aria-disabled="true"] {
157
+ cursor: not-allowed;
158
+ }
159
+ }
160
+
161
+ // ---------------------------------------------------------------------------
162
+ // Variant: Outline — Item Overrides
163
+ // ---------------------------------------------------------------------------
164
+
165
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-variant-outline .#{sys.$prefix}segmented__item {
166
+ --_item-radius: var(--#{sys.$prefix}segmented-item-radius, var(--#{sys.$prefix}radius-full));
167
+ --_item-border: var(--#{sys.$prefix}segmented-border, var(--#{sys.$prefix}color-border));
168
+ --_item-bg-active: var(--#{sys.$prefix}segmented-item-bg-active, var(--#{sys.$prefix}theme-primary-subtlest));
169
+ --_item-fg-active: var(--#{sys.$prefix}segmented-item-fg-active, var(--#{sys.$prefix}theme-primary-strong));
170
+
171
+ border: var(--#{sys.$prefix}border-width) solid var(--_item-border);
172
+
173
+ &[aria-checked="true"] {
174
+ border-color: var(--#{sys.$prefix}theme-primary-base);
175
+ background: var(--_item-bg-active);
176
+ color: var(--_item-fg-active);
177
+ }
178
+ }
179
+
180
+ // ---------------------------------------------------------------------------
181
+ // Variant: Underline — Item Overrides
182
+ // ---------------------------------------------------------------------------
183
+
184
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-variant-underline .#{sys.$prefix}segmented__item {
185
+ --_item-radius: 0;
186
+ --_item-fg: var(--#{sys.$prefix}segmented-item-fg, var(--#{sys.$prefix}color-fg));
187
+ --_indicator: var(--#{sys.$prefix}segmented-indicator, var(--#{sys.$prefix}theme-primary-base));
188
+ --_indicator-size: var(--#{sys.$prefix}segmented-indicator-size, 2px);
189
+
190
+ margin-block-end: calc(var(--#{sys.$prefix}border-width) * -1);
191
+ border-bottom: var(--_indicator-size) solid transparent;
192
+
193
+ &:hover:not([aria-disabled="true"]):not([aria-checked="true"]) {
194
+ color: var(--#{sys.$prefix}color-fg);
195
+ }
196
+
197
+ &[aria-checked="true"] {
198
+ background: transparent;
199
+ color: var(--#{sys.$prefix}color-fg);
200
+ border-bottom-color: var(--_indicator);
201
+ }
202
+
203
+ &:focus-visible {
204
+ outline-offset: calc(var(--#{sys.$prefix}focus-ring-offset) * -1);
205
+ }
206
+ }
207
+
208
+ // ---------------------------------------------------------------------------
209
+ // Size Variants
210
+ // ---------------------------------------------------------------------------
211
+
212
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-size-sm .#{sys.$prefix}segmented__item {
213
+ --_item-padding: var(--#{sys.$prefix}spacing-xs) var(--#{sys.$prefix}spacing-sm);
214
+ font-size: var(--#{sys.$prefix}typography-size-xs);
215
+ min-height: var(--#{sys.$prefix}control-height-sm);
216
+ }
217
+
218
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-size-lg .#{sys.$prefix}segmented__item {
219
+ --_item-padding: var(--#{sys.$prefix}spacing-sm) var(--#{sys.$prefix}spacing-lg);
220
+ font-size: var(--#{sys.$prefix}typography-size-md);
221
+ min-height: var(--#{sys.$prefix}control-height-lg);
222
+ }
223
+
224
+ // ---------------------------------------------------------------------------
225
+ // Item Icon & Label
226
+ // ---------------------------------------------------------------------------
227
+
228
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented__item-icon {
229
+ display: inline-flex;
230
+ align-items: center;
231
+ justify-content: center;
232
+ flex-shrink: 0;
233
+ line-height: 1;
234
+ // Ensure emoji/text content renders correctly (not just Icon components)
235
+ font-style: normal;
236
+ font-family: inherit;
237
+ // Size emojis consistently with icons
238
+ min-width: 1em;
239
+ min-height: 1em;
240
+ }
241
+
242
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}segmented__item-label {
243
+ min-width: 0;
244
+ }
245
+
246
+ // ---------------------------------------------------------------------------
247
+ // Forced Colors (High Contrast Mode)
248
+ // ---------------------------------------------------------------------------
249
+
250
+ @media (forced-colors: active) {
251
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented__item {
252
+ &[aria-checked="true"] {
253
+ forced-color-adjust: none;
254
+ background: Highlight;
255
+ color: HighlightText;
256
+ }
257
+
258
+ &:focus-visible {
259
+ outline: 2px solid CanvasText;
260
+ }
261
+ }
262
+
263
+ // Underline variant: indicator visible, not filled background
264
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-variant-underline .#{sys.$prefix}segmented__item {
265
+ &[aria-checked="true"] {
266
+ background: transparent;
267
+ color: CanvasText;
268
+ border-bottom-color: Highlight;
269
+ border-bottom-width: 3px;
270
+ }
271
+ }
272
+
273
+ // Outline variant: border highlight, not filled background
274
+ .#{sys.$prefix}interface .#{sys.$prefix}segmented.is-variant-outline .#{sys.$prefix}segmented__item {
275
+ border-color: CanvasText;
276
+
277
+ &[aria-checked="true"] {
278
+ background: transparent;
279
+ color: CanvasText;
280
+ border-color: Highlight;
281
+ border-width: 2px;
282
+ }
283
+ }
284
+ }
285
+ }