@tangible/ui 0.2.1 → 0.2.2

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.
@@ -2,12 +2,15 @@
2
2
 
3
3
  /* @tui-tokens
4
4
  --tui-card-bg
5
+ --tui-card-bg-interact
5
6
  --tui-card-border
6
7
  --tui-card-border-width
7
8
  --tui-card-border-interact
9
+ --tui-card-border-active
8
10
  --tui-card-radius
9
11
  --tui-card-shadow
10
12
  --tui-card-shadow-interact
13
+ --tui-card-gap
11
14
  --tui-card-padding
12
15
  --tui-card-foot-basis
13
16
  */
@@ -19,13 +22,15 @@
19
22
  //
20
23
  // Component API tokens (never defined here, only read via fallback):
21
24
  // --tui-card-bg Background color
25
+ // --tui-card-bg-interact Hover/focus fill (default: no change; ghost: bg-muted)
22
26
  // --tui-card-border Border color
23
27
  // --tui-card-border-width Border width (falls back to --tui-border-width)
24
28
  // --tui-card-border-interact Hover/focus border color
25
29
  // --tui-card-radius Border radius
26
30
  // --tui-card-shadow Box shadow (elevated style)
27
31
  // --tui-card-shadow-interact Hover box shadow (elevated style)
28
- // --tui-card-padding Padding (inline and block)
32
+ // --tui-card-padding Edge padding on card items (inline and block)
33
+ // --tui-card-gap Gap between card items (block for stacked, inline for side-by-side)
29
34
  // --tui-card-foot-basis Flex basis for foot in inline layout
30
35
  //
31
36
  // To override from consuming code:
@@ -42,7 +47,11 @@
42
47
  --_radius: var(--#{sys.$prefix}card-radius, var(--#{sys.$prefix}radius-md));
43
48
  --_shadow: var(--#{sys.$prefix}card-shadow, var(--#{sys.$prefix}shadow-sm));
44
49
  --_shadow-interact: var(--#{sys.$prefix}card-shadow-interact, var(--#{sys.$prefix}shadow-md));
50
+ // Hover fill — defaults to the resting bg (no change). Ghost overrides it to
51
+ // a real fill; any variant can opt in via --tui-card-bg-interact.
52
+ --_bg-interact: var(--#{sys.$prefix}card-bg-interact, var(--_bg));
45
53
  --_padding: var(--#{sys.$prefix}card-padding, var(--#{sys.$prefix}spacing-lg));
54
+ --_gap: var(--#{sys.$prefix}card-gap, var(--#{sys.$prefix}spacing-lg));
46
55
  // 500px fallback gives the foot slot enough room for action buttons in inline
47
56
  // layout without crowding the body. Override via --tui-card-foot-basis.
48
57
  --_foot-basis: var(--#{sys.$prefix}card-foot-basis, 500px);
@@ -70,6 +79,7 @@
70
79
 
71
80
  .#{sys.$prefix}card__media.is-flush {
72
81
  margin-inline: calc(var(--_padding) * -1);
82
+ max-width: 100%; // fallback if the calc below is invalid (unitless padding)
73
83
  max-width: calc(100% + 2 * var(--_padding));
74
84
  border-radius: 0;
75
85
  }
@@ -77,22 +87,38 @@
77
87
  // -------------------------------------------------------------------------
78
88
  // Slots
79
89
  // -------------------------------------------------------------------------
90
+ // Per-slot padding (matches Modal/Notice): slots sit flush so a border/bg on
91
+ // a slot reads as a clean section separator; between-slot spacing comes from
92
+ // head's bottom + foot's top padding.
80
93
  &__head {
81
- padding-block: var(--_padding);
94
+ padding-block: var(--_gap);
82
95
  padding-inline: var(--_padding);
83
96
  width: 100%;
84
97
 
98
+ &:first-child {
99
+ padding-block-start: var(--_padding);
100
+ }
101
+
102
+ &:last-child {
103
+ padding-block-end: var(--_padding);
104
+ }
105
+
106
+ &:not(:first-child) {
107
+ padding-block-start: unset;
108
+ }
109
+
85
110
  .#{sys.$prefix}card__media.is-flush:first-child {
86
111
  margin-block-start: calc(var(--_padding) * -1);
87
- // 1px inset is intentional for sub-pixel precision — ensures flush media
88
- // corners sit cleanly inside the card border. Not referencing --tui-border-width
89
- // because the visual correction is independent of border thickness.
90
- border-start-end-radius: calc(var(--_radius) - 1px);
91
- border-start-start-radius: calc(var(--_radius) - 1px);
112
+ // Concentric radius: the flush media's inner corner = outer radius minus
113
+ // the border thickness, so it tucks cleanly inside the card border at any
114
+ // border width (the old `- 1px` only held at the default 1px border).
115
+ border-start-end-radius: calc(var(--_radius) - var(--_border-width));
116
+ border-start-start-radius: calc(var(--_radius) - var(--_border-width));
92
117
  }
93
118
  }
94
119
 
95
120
  &__body {
121
+ padding-block: var(--_gap);
96
122
  padding-inline: var(--_padding);
97
123
  width: 100%;
98
124
 
@@ -115,17 +141,36 @@
115
141
  &:last-child {
116
142
  padding-block-end: var(--_padding);
117
143
  }
144
+
145
+ &:not(:first-child) {
146
+ padding-block-start: unset;
147
+ }
118
148
  }
119
149
 
120
150
  &__foot {
121
- padding-block: var(--_padding);
151
+ padding-block: var(--_gap);
122
152
  padding-inline: var(--_padding);
123
153
  width: 100%;
154
+
155
+ &:first-child {
156
+ padding-block-start: var(--_padding);
157
+ }
158
+
159
+ &:last-child {
160
+ padding-block-end: var(--_padding);
161
+ }
162
+
163
+ &:not(:first-child) {
164
+ padding-block-start: unset;
165
+ }
124
166
 
125
167
  .#{sys.$prefix}card__media.is-flush:last-child {
168
+ // Cancel the foot's last-child edge padding (--_padding), matching the
169
+ // head's flush media — not --_gap, so a bottom image bleeds to the edge
170
+ // even when gap and padding are tuned apart.
126
171
  margin-block-end: calc(var(--_padding) * -1);
127
- border-end-end-radius: calc(var(--_radius) - 1px);
128
- border-end-start-radius: calc(var(--_radius) - 1px);
172
+ border-end-end-radius: calc(var(--_radius) - var(--_border-width));
173
+ border-end-start-radius: calc(var(--_radius) - var(--_border-width));
129
174
  }
130
175
  }
131
176
 
@@ -163,9 +208,10 @@
163
208
 
164
209
  .#{sys.$prefix}card__media.is-flush:first-child {
165
210
  margin-inline-end: var(--_padding);
211
+ max-width: 100%; // fallback if the calc below is invalid
166
212
  max-width: calc(100% + var(--_padding));
167
213
  border-start-end-radius: 0;
168
- border-end-start-radius: calc(var(--_radius) - 1px);
214
+ border-end-start-radius: calc(var(--_radius) - var(--_border-width));
169
215
  }
170
216
  }
171
217
 
@@ -184,9 +230,10 @@
184
230
 
185
231
  .#{sys.$prefix}card__media.is-flush:last-child {
186
232
  margin-inline-start: var(--_padding);
233
+ max-width: 100%; // fallback if the calc below is invalid
187
234
  max-width: calc(100% + var(--_padding));
188
235
  border-end-start-radius: 0;
189
- border-start-end-radius: calc(var(--_radius) - 1px);
236
+ border-start-end-radius: calc(var(--_radius) - var(--_border-width));
190
237
  }
191
238
  }
192
239
 
@@ -214,11 +261,13 @@
214
261
 
215
262
  &:hover {
216
263
  --_border: var(--_border-interact);
264
+ background-color: var(--_bg-interact);
217
265
  }
218
266
 
219
267
  &:focus-visible,
220
268
  &:has(:focus-visible) {
221
269
  --_border: var(--_border-interact);
270
+ background-color: var(--_bg-interact);
222
271
  }
223
272
 
224
273
  &:active,
@@ -247,8 +296,12 @@
247
296
  }
248
297
 
249
298
  // -------------------------------------------------------------------------
250
- // Elevated style
299
+ // Surface variants
251
300
  // -------------------------------------------------------------------------
301
+ // Base (unclassed) = solid: fill + border. `is-style-solid` is a no-op so
302
+ // React always emitting it, and CSS-only `.tui-card`, both read as solid.
303
+
304
+ // Elevated: solid + shadow (keeps the border). Hover grows the shadow.
252
305
  &.is-style-elevated {
253
306
  box-shadow: var(--_shadow);
254
307
  transition-property: border-color, color, background-color, box-shadow;
@@ -257,5 +310,33 @@
257
310
  box-shadow: var(--_shadow-interact);
258
311
  }
259
312
  }
313
+
314
+ // Outline: border only, no fill.
315
+ &.is-style-outline {
316
+ --_bg: transparent;
317
+ }
318
+
319
+ // Ghost: no resting chrome, reveals a fill on interaction. Border colour goes
320
+ // transparent (box metrics preserved so it aligns with solid/outline in grids).
321
+ &.is-style-ghost {
322
+ --_bg: transparent;
323
+ --_border: transparent;
324
+ --_bg-interact: var(--#{sys.$prefix}card-bg-interact, var(--#{sys.$prefix}color-bg-muted));
325
+ }
326
+
327
+ // Seamless: bare structure — no fill, no border, no padding. border-width is
328
+ // zeroed so the shared `.has-interaction` hover can't paint a border either;
329
+ // it stays bare on hover (focus ring is the only affordance). Reach for
330
+ // `ghost` when you want a hover-reveal on a chrome-less card.
331
+ &.is-style-seamless {
332
+ --_bg: transparent;
333
+ --_border: transparent;
334
+ // 0px, NOT 0 — these feed calcs (`calc(100% + var(--_padding))`,
335
+ // `calc(var(--_radius) - var(--_border-width))`). A unitless zero makes
336
+ // those calcs invalid, which drops the media's max-width and blows the
337
+ // image out to its intrinsic size.
338
+ --_border-width: 0px;
339
+ --_padding: 0px;
340
+ }
260
341
  }
261
342
  }
package/tui-manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "0.2.1",
3
- "generated": "2026-07-31T16:10:25.058Z",
2
+ "version": "0.2.2",
3
+ "generated": "2026-07-31T19:35:57.774Z",
4
4
  "components": {
5
5
  "Accordion": {
6
6
  "props": {
@@ -374,13 +374,27 @@
374
374
  },
375
375
  "Card": {
376
376
  "props": {
377
- "inline": {
378
- "type": "boolean",
379
- "required": false
377
+ "variant": {
378
+ "type": "\"elevated\" | \"solid\" | \"outline\" | \"ghost\" | \"seamless\"",
379
+ "required": false,
380
+ "defaultValue": "'solid'",
381
+ "description": "Surface treatment."
382
+ },
383
+ "mode": {
384
+ "type": "\"inline\" | \"stacked\"",
385
+ "required": false,
386
+ "defaultValue": "'stacked'",
387
+ "description": "Content arrangement."
380
388
  },
381
389
  "elevated": {
382
390
  "type": "boolean",
383
- "required": false
391
+ "required": false,
392
+ "description": "@deprecated Use `variant=\"elevated\"`."
393
+ },
394
+ "inline": {
395
+ "type": "boolean",
396
+ "required": false,
397
+ "description": "@deprecated Use `mode=\"inline\"`."
384
398
  },
385
399
  "interactive": {
386
400
  "type": "boolean",
@@ -407,11 +421,11 @@
407
421
  "required": false,
408
422
  "description": "@deprecated Use Card.Link for interactive cards. onClick without Card.Link has no keyboard/screen-reader semantics."
409
423
  },
410
- "title": {
424
+ "id": {
411
425
  "type": "string",
412
426
  "required": false
413
427
  },
414
- "id": {
428
+ "title": {
415
429
  "type": "string",
416
430
  "required": false
417
431
  },
@@ -430,12 +444,15 @@
430
444
  },
431
445
  "cssTokens": [
432
446
  "--tui-card-bg",
447
+ "--tui-card-bg-interact",
433
448
  "--tui-card-border",
434
449
  "--tui-card-border-width",
435
450
  "--tui-card-border-interact",
451
+ "--tui-card-border-active",
436
452
  "--tui-card-radius",
437
453
  "--tui-card-shadow",
438
454
  "--tui-card-shadow-interact",
455
+ "--tui-card-gap",
439
456
  "--tui-card-padding",
440
457
  "--tui-card-foot-basis"
441
458
  ],