@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,346 @@
1
+ @use "../system" as sys;
2
+
3
+ /* @tui-tokens
4
+ --tui-avatar-size
5
+ --tui-avatar-radius
6
+ --tui-avatar-bg
7
+ --tui-avatar-fg
8
+ --tui-avatar-border
9
+ --tui-avatar-indicator-bg
10
+ --tui-avatar-indicator-fg
11
+ --tui-avatar-overflow-bg
12
+ --tui-avatar-overflow-fg
13
+ --tui-avatar-group-overlap
14
+ --tui-avatar-group-gap
15
+ --tui-avatar-group-border-width
16
+ --tui-avatar-group-border-color
17
+ */
18
+
19
+ @mixin styles() {
20
+ // ==========================================================================
21
+ // Avatar Component
22
+ // ==========================================================================
23
+ //
24
+ // Component API tokens (never defined here, only read via fallback):
25
+ // --tui-avatar-size Override avatar size
26
+ // --tui-avatar-radius Override border radius
27
+ // --tui-avatar-bg Override background (for initials/placeholder)
28
+ // --tui-avatar-fg Override text/icon color
29
+ // --tui-avatar-border Border width and color
30
+ // --tui-avatar-indicator-bg Indicator badge background (default: danger)
31
+ // --tui-avatar-indicator-fg Indicator badge foreground (default: white)
32
+ // --tui-avatar-overflow-bg Overflow "+N" background (default: surface)
33
+ // --tui-avatar-overflow-fg Overflow "+N" foreground (default: muted)
34
+ //
35
+ // Group tokens:
36
+ // --tui-avatar-group-overlap Overlap amount (default: -0.35em)
37
+ // --tui-avatar-group-gap Gap when not overlapping (default: spacing-xs)
38
+ // --tui-avatar-group-border-width Border ring width (default: 2px)
39
+ // --tui-avatar-group-border-color Border ring color (default: bg-surface)
40
+ //
41
+ // Avatar palette (not theme tokens, internal variety):
42
+ // coral, amber, lime, teal, cyan, blue, violet, pink, slate, emerald
43
+ //
44
+ // To override from consuming code:
45
+ // .my-context .tui-avatar { --tui-avatar-indicator-bg: #22c55e; }
46
+ //
47
+ // ==========================================================================
48
+
49
+ // ---------------------------------------------------------------------------
50
+ // Avatar Palette (variety colors for initials)
51
+ // ---------------------------------------------------------------------------
52
+ // These are pleasant, accessible background colors with good contrast for white text.
53
+ // They're not tied to semantic themes - just visual variety based on name hash.
54
+
55
+ // Palette colors chosen for WCAG AA contrast (4.5:1+) with white text,
56
+ // except amber/lime/cyan which use dark text for better contrast.
57
+ :where(.#{sys.$prefix}interface) {
58
+ --#{sys.$prefix}avatar-palette-coral: #c62828;
59
+ --#{sys.$prefix}avatar-palette-amber: #f59e0b;
60
+ --#{sys.$prefix}avatar-palette-lime: #65a30d;
61
+ --#{sys.$prefix}avatar-palette-teal: #0f766e;
62
+ --#{sys.$prefix}avatar-palette-cyan: #0891b2;
63
+ --#{sys.$prefix}avatar-palette-blue: #1d4ed8;
64
+ --#{sys.$prefix}avatar-palette-violet: #6d28d9;
65
+ --#{sys.$prefix}avatar-palette-pink: #be185d;
66
+ --#{sys.$prefix}avatar-palette-slate: #475569;
67
+ --#{sys.$prefix}avatar-palette-emerald: #047857;
68
+ }
69
+
70
+ // ---------------------------------------------------------------------------
71
+ // Avatar Base
72
+ // ---------------------------------------------------------------------------
73
+
74
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}avatar {
75
+ // Internal tokens
76
+ --_size: var(--#{sys.$prefix}avatar-size, 2.5rem);
77
+ --_radius: var(--#{sys.$prefix}avatar-radius, 50%);
78
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}color-bg-muted));
79
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg-inverted));
80
+ --_border: var(--#{sys.$prefix}avatar-border, none);
81
+
82
+ position: relative;
83
+ display: inline-flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ width: var(--_size);
87
+ height: var(--_size);
88
+ border-radius: var(--_radius);
89
+ border: var(--_border);
90
+ background-color: var(--_bg);
91
+ color: var(--_fg);
92
+ font-weight: var(--#{sys.$prefix}font-weight-medium, 500);
93
+ font-size: calc(var(--_size) * 0.4);
94
+ line-height: 1;
95
+ flex-shrink: 0;
96
+ user-select: none;
97
+ // Note: no overflow:hidden here — indicator needs to escape bounds
98
+
99
+ // -------------------------------------------------------------------------
100
+ // Sizes
101
+ // -------------------------------------------------------------------------
102
+ &.is-size-xs {
103
+ --_size: var(--#{sys.$prefix}avatar-size, 1.5rem);
104
+ }
105
+
106
+ &.is-size-sm {
107
+ --_size: var(--#{sys.$prefix}avatar-size, 2rem);
108
+ }
109
+
110
+ &.is-size-md {
111
+ --_size: var(--#{sys.$prefix}avatar-size, 2.5rem);
112
+ }
113
+
114
+ &.is-size-lg {
115
+ --_size: var(--#{sys.$prefix}avatar-size, 3rem);
116
+ }
117
+
118
+ &.is-size-xl {
119
+ --_size: var(--#{sys.$prefix}avatar-size, 4rem);
120
+ }
121
+
122
+ &.is-size-xxl {
123
+ --_size: var(--#{sys.$prefix}avatar-size, 5rem);
124
+ }
125
+
126
+ // -------------------------------------------------------------------------
127
+ // Shapes
128
+ // -------------------------------------------------------------------------
129
+ &.is-shape-circle {
130
+ --_radius: var(--#{sys.$prefix}avatar-radius, 50%);
131
+ }
132
+
133
+ &.is-shape-square {
134
+ --_radius: var(--#{sys.$prefix}avatar-radius, var(--#{sys.$prefix}radius-md));
135
+ }
136
+
137
+ // -------------------------------------------------------------------------
138
+ // Palette Colors (for initials backgrounds)
139
+ // -------------------------------------------------------------------------
140
+ &.is-color-coral {
141
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-coral));
142
+ }
143
+
144
+ &.is-color-amber {
145
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-amber));
146
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg)); // Dark text for light bg
147
+ }
148
+
149
+ &.is-color-lime {
150
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-lime));
151
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg)); // Dark text for light bg
152
+ }
153
+
154
+ &.is-color-teal {
155
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-teal));
156
+ }
157
+
158
+ &.is-color-cyan {
159
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-cyan));
160
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg)); // Dark text for light bg
161
+ }
162
+
163
+ &.is-color-blue {
164
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-blue));
165
+ }
166
+
167
+ &.is-color-violet {
168
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-violet));
169
+ }
170
+
171
+ &.is-color-pink {
172
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-pink));
173
+ }
174
+
175
+ &.is-color-slate {
176
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-slate));
177
+ }
178
+
179
+ &.is-color-emerald {
180
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}avatar-palette-emerald));
181
+ }
182
+
183
+ // -------------------------------------------------------------------------
184
+ // Content wrapper (clips to shape, allows indicator to escape)
185
+ // -------------------------------------------------------------------------
186
+ .#{sys.$prefix}avatar__content {
187
+ position: absolute;
188
+ inset: 0;
189
+ display: flex;
190
+ align-items: center;
191
+ justify-content: center;
192
+ border-radius: inherit;
193
+ overflow: hidden;
194
+ }
195
+
196
+ // -------------------------------------------------------------------------
197
+ // Image
198
+ // -------------------------------------------------------------------------
199
+ .#{sys.$prefix}avatar__image {
200
+ width: 100%;
201
+ height: 100%;
202
+ object-fit: cover;
203
+ }
204
+
205
+ // -------------------------------------------------------------------------
206
+ // Initials
207
+ // -------------------------------------------------------------------------
208
+ .#{sys.$prefix}avatar__initials {
209
+ display: flex;
210
+ align-items: center;
211
+ justify-content: center;
212
+ text-transform: uppercase;
213
+ letter-spacing: -0.025em;
214
+ }
215
+
216
+ // -------------------------------------------------------------------------
217
+ // Placeholder icon
218
+ // -------------------------------------------------------------------------
219
+ .#{sys.$prefix}avatar__placeholder {
220
+ font-size: calc(var(--_size) * 0.6);
221
+ opacity: 0.7;
222
+ }
223
+
224
+ // -------------------------------------------------------------------------
225
+ // Indicator (badge/status)
226
+ // -------------------------------------------------------------------------
227
+ .#{sys.$prefix}avatar__indicator {
228
+ --_indicator-size: calc(var(--_size) * 0.35);
229
+ --_indicator-bg: var(--#{sys.$prefix}avatar-indicator-bg, var(--#{sys.$prefix}theme-danger-base));
230
+ --_indicator-fg: var(--#{sys.$prefix}avatar-indicator-fg, var(--#{sys.$prefix}color-fg-on-accent));
231
+
232
+ position: absolute;
233
+ display: flex;
234
+ align-items: center;
235
+ justify-content: center;
236
+ min-width: var(--_indicator-size);
237
+ min-height: var(--_indicator-size);
238
+ padding: 0.15em;
239
+ font-size: calc(var(--_size) * 0.3);
240
+ line-height: 1;
241
+ background-color: var(--_indicator-bg);
242
+ color: var(--_indicator-fg);
243
+ border-radius: 50%;
244
+ border: 2px solid var(--#{sys.$prefix}color-bg);
245
+
246
+ // Position variants
247
+ &.is-position-top-left {
248
+ top: 0;
249
+ left: 0;
250
+ transform: translate(-25%, -25%);
251
+ }
252
+
253
+ &.is-position-top-right {
254
+ top: 0;
255
+ right: 0;
256
+ transform: translate(25%, -25%);
257
+ }
258
+
259
+ &.is-position-bottom-left {
260
+ bottom: 0;
261
+ left: 0;
262
+ transform: translate(-25%, 25%);
263
+ }
264
+
265
+ &.is-position-bottom-right {
266
+ bottom: 0;
267
+ right: 0;
268
+ transform: translate(25%, 25%);
269
+ }
270
+ }
271
+
272
+ // -------------------------------------------------------------------------
273
+ // Overflow indicator ("+N")
274
+ // -------------------------------------------------------------------------
275
+ &.#{sys.$prefix}avatar--overflow {
276
+ --_bg: var(--#{sys.$prefix}avatar-overflow-bg, var(--#{sys.$prefix}color-bg-surface));
277
+ --_fg: var(--#{sys.$prefix}avatar-overflow-fg, var(--#{sys.$prefix}color-fg-muted));
278
+ }
279
+ }
280
+
281
+ // ---------------------------------------------------------------------------
282
+ // Avatar Group
283
+ // ---------------------------------------------------------------------------
284
+
285
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}avatar-group {
286
+ --_gap: var(--#{sys.$prefix}avatar-group-gap, var(--#{sys.$prefix}spacing-xs));
287
+
288
+ display: inline-flex;
289
+ align-items: center;
290
+ gap: var(--_gap);
291
+
292
+ // Overlap mode: map AvatarGroup tokens to OverlapStack tokens
293
+ &.is-overlap {
294
+ // Map avatar-group tokens to overlap-stack tokens
295
+ --#{sys.$prefix}overlap-stack-overlap: var(--#{sys.$prefix}avatar-group-overlap, -0.35em);
296
+
297
+ gap: 0;
298
+
299
+ // Ring border applied directly to avatars (respects their own shape/radius)
300
+ .#{sys.$prefix}avatar {
301
+ box-shadow: 0 0 0 var(--#{sys.$prefix}avatar-group-border-width, 2px) var(--#{sys.$prefix}avatar-group-border-color, var(--#{sys.$prefix}color-bg-surface));
302
+ }
303
+ }
304
+ }
305
+
306
+ // ---------------------------------------------------------------------------
307
+ // Dark mode: amber/lime/cyan need dark foreground on bright backgrounds
308
+ // ---------------------------------------------------------------------------
309
+ // In dark mode, --tui-color-fg flips to light text, which fails contrast on
310
+ // these bright palette backgrounds. Use --tui-color-fg-inverted (stays dark).
311
+
312
+ .#{sys.$prefix}interface[data-theme="dark"],
313
+ .#{sys.$prefix}interface[data-theme="dark"] :where(.#{sys.$prefix}interface) {
314
+ .#{sys.$prefix}avatar {
315
+ &.is-color-amber,
316
+ &.is-color-lime,
317
+ &.is-color-cyan {
318
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg-inverted));
319
+ }
320
+ }
321
+ }
322
+
323
+ @media (prefers-color-scheme: dark) {
324
+ .#{sys.$prefix}interface[data-theme="auto"],
325
+ .#{sys.$prefix}interface[data-theme="auto"] :where(.#{sys.$prefix}interface) {
326
+ .#{sys.$prefix}avatar {
327
+ &.is-color-amber,
328
+ &.is-color-lime,
329
+ &.is-color-cyan {
330
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg-inverted));
331
+ }
332
+ }
333
+ }
334
+ }
335
+
336
+ // ---------------------------------------------------------------------------
337
+ // Forced colors (Windows High Contrast Mode)
338
+ // ---------------------------------------------------------------------------
339
+ @media (forced-colors: active) {
340
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}avatar {
341
+ background-color: Canvas;
342
+ color: CanvasText;
343
+ border: 1px solid CanvasText;
344
+ }
345
+ }
346
+ }