@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,298 @@
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
+ // Initials colors come from the system's generative palette
42
+ // (--tui-generative-*, The Jellybean Bag) — see styles/system/_tokens.scss.
43
+ //
44
+ // To override from consuming code:
45
+ // .my-context .tui-avatar { --tui-avatar-indicator-bg: #22c55e; }
46
+ //
47
+ // ==========================================================================
48
+
49
+ // ---------------------------------------------------------------------------
50
+ // Avatar Base
51
+ // ---------------------------------------------------------------------------
52
+
53
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}avatar {
54
+ // Internal tokens
55
+ --_size: var(--#{sys.$prefix}avatar-size, 2.5rem);
56
+ --_radius: var(--#{sys.$prefix}avatar-radius, 50%);
57
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}color-bg-muted));
58
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg-inverted));
59
+ --_border: var(--#{sys.$prefix}avatar-border, none);
60
+
61
+ position: relative;
62
+ display: inline-flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ width: var(--_size);
66
+ height: var(--_size);
67
+ border-radius: var(--_radius);
68
+ border: var(--_border);
69
+ background-color: var(--_bg);
70
+ color: var(--_fg);
71
+ font-weight: var(--#{sys.$prefix}typography-weight-medium, 500);
72
+ font-size: calc(var(--_size) * 0.4);
73
+ line-height: 1;
74
+ flex-shrink: 0;
75
+ user-select: none;
76
+ // Note: no overflow:hidden here — indicator needs to escape bounds
77
+
78
+ // -------------------------------------------------------------------------
79
+ // Sizes
80
+ // -------------------------------------------------------------------------
81
+ &.is-size-xs {
82
+ --_size: var(--#{sys.$prefix}avatar-size, 1.5rem);
83
+ }
84
+
85
+ &.is-size-sm {
86
+ --_size: var(--#{sys.$prefix}avatar-size, 2rem);
87
+ }
88
+
89
+ &.is-size-md {
90
+ --_size: var(--#{sys.$prefix}avatar-size, 2.5rem);
91
+ }
92
+
93
+ &.is-size-lg {
94
+ --_size: var(--#{sys.$prefix}avatar-size, 3rem);
95
+ }
96
+
97
+ &.is-size-xl {
98
+ --_size: var(--#{sys.$prefix}avatar-size, 4rem);
99
+ }
100
+
101
+ &.is-size-xxl {
102
+ --_size: var(--#{sys.$prefix}avatar-size, 5rem);
103
+ }
104
+
105
+ // -------------------------------------------------------------------------
106
+ // Shapes
107
+ // -------------------------------------------------------------------------
108
+ &.is-shape-circle {
109
+ --_radius: var(--#{sys.$prefix}avatar-radius, 50%);
110
+ }
111
+
112
+ &.is-shape-square {
113
+ --_radius: var(--#{sys.$prefix}avatar-radius, var(--#{sys.$prefix}radius-md));
114
+ }
115
+
116
+ // -------------------------------------------------------------------------
117
+ // Identity Colors (for initials backgrounds)
118
+ // -------------------------------------------------------------------------
119
+ // The generative palette (The Jellybean Bag) — each bean carries its own
120
+ // mode-independent fg pairing, so no per-color special cases here.
121
+ @each $bean, $def in sys.$generative {
122
+ &.is-color-#{$bean} {
123
+ --_bg: var(--#{sys.$prefix}avatar-bg, var(--#{sys.$prefix}generative-#{$bean}));
124
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}generative-#{$bean}-fg));
125
+ }
126
+ }
127
+
128
+ // Neutral fallback for name-less avatars — deliberately NOT a bag member
129
+ // (grey means "no identity", not a flavour). Fixed values, like a bean.
130
+ &.is-color-slate {
131
+ --_bg: var(--#{sys.$prefix}avatar-bg, #475569);
132
+ --_fg: var(--#{sys.$prefix}avatar-fg, #fff);
133
+ }
134
+
135
+ // -------------------------------------------------------------------------
136
+ // Content wrapper (clips to shape, allows indicator to escape)
137
+ // -------------------------------------------------------------------------
138
+ .#{sys.$prefix}avatar__content {
139
+ position: absolute;
140
+ inset: 0;
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ border-radius: inherit;
145
+ overflow: hidden;
146
+ }
147
+
148
+ // -------------------------------------------------------------------------
149
+ // Image
150
+ // -------------------------------------------------------------------------
151
+ .#{sys.$prefix}avatar__image {
152
+ width: 100%;
153
+ height: 100%;
154
+ object-fit: cover;
155
+ }
156
+
157
+ // -------------------------------------------------------------------------
158
+ // Initials
159
+ // -------------------------------------------------------------------------
160
+ .#{sys.$prefix}avatar__initials {
161
+ display: flex;
162
+ align-items: center;
163
+ justify-content: center;
164
+ text-transform: uppercase;
165
+ letter-spacing: -0.025em;
166
+ }
167
+
168
+ // -------------------------------------------------------------------------
169
+ // Placeholder icon
170
+ // -------------------------------------------------------------------------
171
+ .#{sys.$prefix}avatar__placeholder {
172
+ font-size: calc(var(--_size) * 0.6);
173
+ opacity: 0.7;
174
+ }
175
+
176
+ // -------------------------------------------------------------------------
177
+ // Indicator (badge/status)
178
+ // -------------------------------------------------------------------------
179
+ .#{sys.$prefix}avatar__indicator {
180
+ --_indicator-size: calc(var(--_size) * 0.35);
181
+ --_indicator-bg: var(--#{sys.$prefix}avatar-indicator-bg, var(--#{sys.$prefix}theme-danger-base));
182
+ --_indicator-fg: var(--#{sys.$prefix}avatar-indicator-fg, var(--#{sys.$prefix}color-fg-on-accent));
183
+
184
+ position: absolute;
185
+ display: flex;
186
+ align-items: center;
187
+ justify-content: center;
188
+ min-width: var(--_indicator-size);
189
+ min-height: var(--_indicator-size);
190
+ padding: 0.15em;
191
+ font-size: calc(var(--_size) * 0.3);
192
+ line-height: 1;
193
+ background-color: var(--_indicator-bg);
194
+ color: var(--_indicator-fg);
195
+ border-radius: 50%;
196
+ border: 2px solid var(--#{sys.$prefix}color-bg);
197
+
198
+ // Position variants
199
+ &.is-position-top-left {
200
+ top: 0;
201
+ left: 0;
202
+ transform: translate(-25%, -25%);
203
+ }
204
+
205
+ &.is-position-top-right {
206
+ top: 0;
207
+ right: 0;
208
+ transform: translate(25%, -25%);
209
+ }
210
+
211
+ &.is-position-bottom-left {
212
+ bottom: 0;
213
+ left: 0;
214
+ transform: translate(-25%, 25%);
215
+ }
216
+
217
+ &.is-position-bottom-right {
218
+ bottom: 0;
219
+ right: 0;
220
+ transform: translate(25%, 25%);
221
+ }
222
+ }
223
+
224
+ // -------------------------------------------------------------------------
225
+ // Overflow indicator ("+N")
226
+ // -------------------------------------------------------------------------
227
+ &.#{sys.$prefix}avatar--overflow {
228
+ --_bg: var(--#{sys.$prefix}avatar-overflow-bg, var(--#{sys.$prefix}color-bg-surface));
229
+ --_fg: var(--#{sys.$prefix}avatar-overflow-fg, var(--#{sys.$prefix}color-fg-muted));
230
+ }
231
+ }
232
+
233
+ // ---------------------------------------------------------------------------
234
+ // Avatar Group
235
+ // ---------------------------------------------------------------------------
236
+
237
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}avatar-group {
238
+ --_gap: var(--#{sys.$prefix}avatar-group-gap, var(--#{sys.$prefix}spacing-xs));
239
+
240
+ display: inline-flex;
241
+ align-items: center;
242
+ gap: var(--_gap);
243
+
244
+ // Overlap mode: map AvatarGroup tokens to OverlapStack tokens
245
+ &.is-overlap {
246
+ // Map avatar-group tokens to overlap-stack tokens
247
+ --#{sys.$prefix}overlap-stack-overlap: var(--#{sys.$prefix}avatar-group-overlap, -0.35em);
248
+
249
+ gap: 0;
250
+
251
+ // Ring border applied directly to avatars (respects their own shape/radius)
252
+ .#{sys.$prefix}avatar {
253
+ 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));
254
+ }
255
+ }
256
+ }
257
+
258
+ // ---------------------------------------------------------------------------
259
+ // Dark mode: amber/lime/cyan need dark foreground on bright backgrounds
260
+ // ---------------------------------------------------------------------------
261
+ // In dark mode, --tui-color-fg flips to light text, which fails contrast on
262
+ // these bright palette backgrounds. Use --tui-color-fg-inverted (stays dark).
263
+
264
+ .#{sys.$prefix}interface[data-theme="dark"],
265
+ .#{sys.$prefix}interface[data-theme="dark"] :where(.#{sys.$prefix}interface) {
266
+ .#{sys.$prefix}avatar {
267
+ &.is-color-amber,
268
+ &.is-color-lime,
269
+ &.is-color-cyan {
270
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg-inverted));
271
+ }
272
+ }
273
+ }
274
+
275
+ @media (prefers-color-scheme: dark) {
276
+ .#{sys.$prefix}interface[data-theme="auto"],
277
+ .#{sys.$prefix}interface[data-theme="auto"] :where(.#{sys.$prefix}interface) {
278
+ .#{sys.$prefix}avatar {
279
+ &.is-color-amber,
280
+ &.is-color-lime,
281
+ &.is-color-cyan {
282
+ --_fg: var(--#{sys.$prefix}avatar-fg, var(--#{sys.$prefix}color-fg-inverted));
283
+ }
284
+ }
285
+ }
286
+ }
287
+
288
+ // ---------------------------------------------------------------------------
289
+ // Forced colors (Windows High Contrast Mode)
290
+ // ---------------------------------------------------------------------------
291
+ @media (forced-colors: active) {
292
+ :where(.#{sys.$prefix}interface) .#{sys.$prefix}avatar {
293
+ background-color: Canvas;
294
+ color: CanvasText;
295
+ border: 1px solid CanvasText;
296
+ }
297
+ }
298
+ }