@tangible/ui 0.2.37 → 0.2.38
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.
- package/components/Tray/Tray.d.ts +79 -0
- package/components/Tray/Tray.js +229 -0
- package/components/Tray/index.d.ts +4 -0
- package/components/Tray/index.js +2 -0
- package/components/Tray/labels.d.ts +9 -0
- package/components/Tray/labels.js +6 -0
- package/components/index.d.ts +2 -0
- package/components/index.js +1 -0
- package/figma-tokens.json +1 -1
- package/icons/icons.svg +1 -1
- package/icons/sprite-version.js +1 -1
- package/icons/sprite.php +1 -1
- package/package.json +5 -1
- package/skills/building-with-tui/SKILL.md +18 -0
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +135 -16
- package/styles/all.expanded.unlayered.css +135 -16
- package/styles/all.unlayered.css +1 -1
- package/styles/components/_bundle.scss +4 -0
- package/styles/components/card.scss +19 -13
- package/styles/components/tray.scss +186 -0
- package/tui-manifest.json +81 -2
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
@use "./textarea" as textarea;
|
|
46
46
|
@use "./text-input" as textinput;
|
|
47
47
|
@use "./toast" as toast;
|
|
48
|
+
@use "./tray" as tray;
|
|
48
49
|
@use "./toolbar" as toolbar;
|
|
49
50
|
@use "./tooltip" as tooltip;
|
|
50
51
|
|
|
@@ -130,6 +131,9 @@ $-input-dependents: (input, field, text-input, textarea, pager, search-input, se
|
|
|
130
131
|
// also request notice (and icon-button for the dismiss ×), same latent gap
|
|
131
132
|
// as the gradient-picker note above.
|
|
132
133
|
@if -wants($only, toast) { @include toast.styles(); }
|
|
134
|
+
// Tray.SaveActions renders Buttons: a subset build requesting tray must
|
|
135
|
+
// also request button.
|
|
136
|
+
@if -wants($only, tray) { @include tray.styles(); }
|
|
133
137
|
@if -wants($only, toolbar) { @include toolbar.styles(); }
|
|
134
138
|
@if -wants($only, tooltip) { @include tooltip.styles(); }
|
|
135
139
|
}
|
|
@@ -200,7 +200,11 @@
|
|
|
200
200
|
//
|
|
201
201
|
// Scoped away from inline layout, which owns its own row flex in the
|
|
202
202
|
// container query below (the two selectors are mutually exclusive).
|
|
203
|
-
|
|
203
|
+
// Child combinators, here and in the inline block below: a card nested in
|
|
204
|
+
// another card's body must take its own layout, not its ancestor's. A
|
|
205
|
+
// descendant selector let a stacked parent turn a nested inline card into a
|
|
206
|
+
// column (and its foot's 500px flex-basis into its height).
|
|
207
|
+
&:not(.is-layout-inline) > .#{sys.$prefix}card__inner {
|
|
204
208
|
display: flex;
|
|
205
209
|
flex-direction: column;
|
|
206
210
|
height: 100%;
|
|
@@ -212,33 +216,35 @@
|
|
|
212
216
|
// :where() on the layout context keeps slot specificity equal to base
|
|
213
217
|
// selectors — consumers can override without fighting the cascade.
|
|
214
218
|
@container tuiCard (width >= 400px) {
|
|
215
|
-
:where(&.is-layout-inline) .#{sys.$prefix}card__inner {
|
|
219
|
+
:where(&.is-layout-inline) > .#{sys.$prefix}card__inner {
|
|
216
220
|
display: flex;
|
|
217
221
|
flex-direction: row;
|
|
218
222
|
align-items: center;
|
|
219
223
|
gap: var(--_padding);
|
|
220
224
|
|
|
221
|
-
.#{sys.$prefix}card__media.is-flush
|
|
225
|
+
> .#{sys.$prefix}card__media.is-flush,
|
|
226
|
+
> * > .#{sys.$prefix}card__media.is-flush {
|
|
222
227
|
object-fit: cover;
|
|
223
228
|
object-position: center;
|
|
224
229
|
margin-block: calc(var(--_padding) * -1);
|
|
225
230
|
height: calc(100% + 2 * var(--_padding));
|
|
226
231
|
}
|
|
227
232
|
|
|
228
|
-
*:has(.#{sys.$prefix}card__media.is-flush) {
|
|
233
|
+
> *:has(> .#{sys.$prefix}card__media.is-flush) {
|
|
229
234
|
align-self: stretch;
|
|
230
235
|
}
|
|
231
236
|
|
|
232
|
-
.#{sys.$prefix}card__head {
|
|
237
|
+
> .#{sys.$prefix}card__head {
|
|
233
238
|
padding-inline-start: var(--_padding);
|
|
234
239
|
padding-block: var(--_padding);
|
|
235
240
|
flex: 0 1 auto;
|
|
236
241
|
|
|
237
|
-
|
|
242
|
+
// A lone icon or avatar sizes to itself instead of stretching.
|
|
243
|
+
&:has(.#{sys.$prefix}icon:only-child, .#{sys.$prefix}avatar:only-child) {
|
|
238
244
|
flex: 0 0 max-content;
|
|
239
245
|
}
|
|
240
246
|
|
|
241
|
-
.#{sys.$prefix}card__media.is-flush:first-child {
|
|
247
|
+
> .#{sys.$prefix}card__media.is-flush:first-child {
|
|
242
248
|
margin-inline-end: var(--_padding);
|
|
243
249
|
max-width: 100%; // fallback if the calc below is invalid
|
|
244
250
|
max-width: calc(100% + var(--_padding));
|
|
@@ -247,12 +253,12 @@
|
|
|
247
253
|
}
|
|
248
254
|
}
|
|
249
255
|
|
|
250
|
-
.#{sys.$prefix}card__body {
|
|
256
|
+
> .#{sys.$prefix}card__body {
|
|
251
257
|
flex: 2 1 auto;
|
|
252
258
|
padding-block: var(--_padding);
|
|
253
259
|
}
|
|
254
260
|
|
|
255
|
-
.#{sys.$prefix}card__foot {
|
|
261
|
+
> .#{sys.$prefix}card__foot {
|
|
256
262
|
width: unset;
|
|
257
263
|
flex: 0 1 var(--_foot-basis);
|
|
258
264
|
padding-block: var(--_padding);
|
|
@@ -260,7 +266,7 @@
|
|
|
260
266
|
margin-inline-start: auto;
|
|
261
267
|
justify-content: flex-end;
|
|
262
268
|
|
|
263
|
-
.#{sys.$prefix}card__media.is-flush:last-child {
|
|
269
|
+
> .#{sys.$prefix}card__media.is-flush:last-child {
|
|
264
270
|
margin-inline-start: var(--_padding);
|
|
265
271
|
max-width: 100%; // fallback if the calc below is invalid
|
|
266
272
|
max-width: calc(100% + var(--_padding));
|
|
@@ -269,9 +275,9 @@
|
|
|
269
275
|
}
|
|
270
276
|
}
|
|
271
277
|
|
|
272
|
-
.#{sys.$prefix}card__head,
|
|
273
|
-
.#{sys.$prefix}card__body,
|
|
274
|
-
.#{sys.$prefix}card__foot {
|
|
278
|
+
> .#{sys.$prefix}card__head,
|
|
279
|
+
> .#{sys.$prefix}card__body,
|
|
280
|
+
> .#{sys.$prefix}card__foot {
|
|
275
281
|
&:not(:first-child) {
|
|
276
282
|
padding-inline-start: 0;
|
|
277
283
|
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-tray-gutter
|
|
5
|
+
--tui-tray-bg
|
|
6
|
+
--tui-tray-fg
|
|
7
|
+
--tui-tray-border
|
|
8
|
+
--tui-tray-radius
|
|
9
|
+
--tui-tray-shadow
|
|
10
|
+
--tui-tray-block-size
|
|
11
|
+
--tui-tray-offset
|
|
12
|
+
--tui-tray-max-width
|
|
13
|
+
--tui-tray-padding-inline-start
|
|
14
|
+
--tui-tray-padding-inline-end
|
|
15
|
+
--tui-tray-gap
|
|
16
|
+
--tui-tray-z
|
|
17
|
+
--tui-tray-message-fg
|
|
18
|
+
--tui-tray-message-weight
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
@mixin styles() {
|
|
22
|
+
// ==========================================================================
|
|
23
|
+
// Tray
|
|
24
|
+
// ==========================================================================
|
|
25
|
+
//
|
|
26
|
+
// A floating bar at the bottom of its scroll container (sticky) or the
|
|
27
|
+
// viewport (fixed). Figma: Tray, 507:3594: elevated surface, decorative
|
|
28
|
+
// border, shadow-lg, radius-md, 64px tall, padding 12 / 12 / 12 / 20, 12px
|
|
29
|
+
// gap, as wide as its content column.
|
|
30
|
+
//
|
|
31
|
+
// Component API tokens (never defined here, only read via fallback):
|
|
32
|
+
// --tui-tray-bg / -fg / -border / -radius / -shadow Surface
|
|
33
|
+
// --tui-tray-block-size Minimum height (default 4rem, Figma's 64px)
|
|
34
|
+
// --tui-tray-offset Gap from the bottom edge (default spacing-md)
|
|
35
|
+
// --tui-tray-gutter Fixed placement only: gap from the viewport's
|
|
36
|
+
// sides (default: the offset)
|
|
37
|
+
// --tui-tray-max-width Cap on its width (default none: fills the column)
|
|
38
|
+
// --tui-tray-padding-inline-start / -end
|
|
39
|
+
// Default 1.25rem / spacing-sm: Figma's 20 / 12
|
|
40
|
+
// --tui-tray-gap Between message and actions, and between actions
|
|
41
|
+
// --tui-tray-z Stacking (default layer-elevated)
|
|
42
|
+
// --tui-tray-message-fg / -weight The message text
|
|
43
|
+
//
|
|
44
|
+
// State hooks: [data-state="open" | "closing" | "closed"], and
|
|
45
|
+
// .is-placement-sticky / .is-placement-fixed.
|
|
46
|
+
//
|
|
47
|
+
// Reserve room so the tray is less likely to cover a focused field (WCAG
|
|
48
|
+
// 2.4.11: it helps, it doesn't guarantee; a field already half under the
|
|
49
|
+
// tray when focused may stay partly covered). On the
|
|
50
|
+
// scroll container, or on html when that's the document:
|
|
51
|
+
// html:has(.tui-tray[data-state="open"]) {
|
|
52
|
+
// scroll-padding-block-end: calc(var(--tui-tray-block-size, 4rem) + var(--tui-tray-offset, 1rem));
|
|
53
|
+
// }
|
|
54
|
+
// A fixed tray also needs the page to pad its own bottom by the same amount.
|
|
55
|
+
//
|
|
56
|
+
// ==========================================================================
|
|
57
|
+
|
|
58
|
+
.#{sys.$prefix}interface .#{sys.$prefix}tray {
|
|
59
|
+
--_offset: var(--#{sys.$prefix}tray-offset, var(--#{sys.$prefix}spacing-md));
|
|
60
|
+
|
|
61
|
+
position: sticky;
|
|
62
|
+
inset-block-end: var(--_offset);
|
|
63
|
+
z-index: var(--#{sys.$prefix}tray-z, var(--#{sys.$prefix}layer-elevated));
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: var(--#{sys.$prefix}tray-gap, var(--#{sys.$prefix}spacing-sm));
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
inline-size: 100%;
|
|
70
|
+
max-inline-size: var(--#{sys.$prefix}tray-max-width, none);
|
|
71
|
+
min-block-size: var(--#{sys.$prefix}tray-block-size, 4rem);
|
|
72
|
+
margin-inline: auto;
|
|
73
|
+
// Figma draws the border inside the padding (64px = 12 + 40 + 12), so the
|
|
74
|
+
// padding gives up the border's width.
|
|
75
|
+
--_bw: var(--#{sys.$prefix}border-width);
|
|
76
|
+
padding-block: calc(var(--#{sys.$prefix}spacing-sm) - var(--_bw));
|
|
77
|
+
padding-inline-start: calc(var(--#{sys.$prefix}tray-padding-inline-start, 1.25rem) - var(--_bw));
|
|
78
|
+
padding-inline-end: calc(var(--#{sys.$prefix}tray-padding-inline-end, var(--#{sys.$prefix}spacing-sm)) - var(--_bw));
|
|
79
|
+
border: var(--_bw) solid var(--#{sys.$prefix}tray-border, var(--#{sys.$prefix}color-border));
|
|
80
|
+
border-radius: var(--#{sys.$prefix}tray-radius, var(--#{sys.$prefix}radius-md));
|
|
81
|
+
background: var(--#{sys.$prefix}tray-bg, var(--#{sys.$prefix}color-bg-elevated));
|
|
82
|
+
// A painted surface owns its text colour (see the surface-fg gotcha).
|
|
83
|
+
color: var(--#{sys.$prefix}tray-fg, var(--#{sys.$prefix}color-fg));
|
|
84
|
+
box-shadow: var(--#{sys.$prefix}tray-shadow, var(--#{sys.$prefix}shadow-lg));
|
|
85
|
+
|
|
86
|
+
// Sticky: inset-block-end lifts the tray by the offset at the end of the
|
|
87
|
+
// scroll, over the last content. The margin reserves that space in flow.
|
|
88
|
+
&.is-placement-sticky {
|
|
89
|
+
margin-block-end: var(--_offset);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Only a tray that opens on the page animates in; one open at mount doesn't.
|
|
93
|
+
&[data-entering] {
|
|
94
|
+
animation: #{sys.$prefix}trayEnter var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.is-placement-fixed {
|
|
98
|
+
position: fixed;
|
|
99
|
+
inset-inline: var(--#{sys.$prefix}tray-gutter, var(--_offset));
|
|
100
|
+
inline-size: auto;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&[data-state="closing"] {
|
|
104
|
+
animation: #{sys.$prefix}trayExit var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing) forwards;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&[data-state="closed"] {
|
|
108
|
+
display: none;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media (prefers-reduced-motion: reduce) {
|
|
112
|
+
&[data-entering],
|
|
113
|
+
&[data-state="closing"] {
|
|
114
|
+
animation: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (forced-colors: active) {
|
|
119
|
+
border-color: CanvasText;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.#{sys.$prefix}interface .#{sys.$prefix}tray__message {
|
|
124
|
+
// 12rem: below this the actions wrap under the message rather than
|
|
125
|
+
// squeezing it (reflow, WCAG 1.4.10).
|
|
126
|
+
flex: 1 1 12rem;
|
|
127
|
+
min-inline-size: 0;
|
|
128
|
+
margin: 0;
|
|
129
|
+
color: var(--#{sys.$prefix}tray-message-fg, inherit);
|
|
130
|
+
font-size: var(--#{sys.$prefix}typography-size-sm);
|
|
131
|
+
font-weight: var(--#{sys.$prefix}tray-message-weight, var(--#{sys.$prefix}typography-weight-semibold));
|
|
132
|
+
line-height: 1.4;
|
|
133
|
+
overflow-wrap: anywhere;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.#{sys.$prefix}interface .#{sys.$prefix}tray__actions {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex: none;
|
|
139
|
+
flex-wrap: wrap;
|
|
140
|
+
align-items: center;
|
|
141
|
+
gap: var(--#{sys.$prefix}tray-gap, var(--#{sys.$prefix}spacing-sm));
|
|
142
|
+
margin-inline-start: auto;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Screen-reader-only text: the announcer and Save's reason. Written out
|
|
146
|
+
// rather than reusing .tui-visually-hidden, which is scoped under
|
|
147
|
+
// .tui-interface: the announcer is the tray's SIBLING, so if a consumer
|
|
148
|
+
// forgot the interface wrapper its text would paint on the page (the
|
|
149
|
+
// tui-visually-hidden gotcha). Unscoped on purpose, as a fallback.
|
|
150
|
+
.#{sys.$prefix}tray__announcer,
|
|
151
|
+
.#{sys.$prefix}tray__description {
|
|
152
|
+
position: absolute;
|
|
153
|
+
inline-size: 1px;
|
|
154
|
+
block-size: 1px;
|
|
155
|
+
padding: 0;
|
|
156
|
+
margin: -1px;
|
|
157
|
+
overflow: hidden;
|
|
158
|
+
clip: rect(0 0 0 0);
|
|
159
|
+
white-space: nowrap;
|
|
160
|
+
border: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@keyframes #{sys.$prefix}trayEnter {
|
|
164
|
+
from {
|
|
165
|
+
opacity: 0;
|
|
166
|
+
translate: 0 var(--#{sys.$prefix}spacing-xs);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
to {
|
|
170
|
+
opacity: 1;
|
|
171
|
+
translate: 0 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@keyframes #{sys.$prefix}trayExit {
|
|
176
|
+
from {
|
|
177
|
+
opacity: 1;
|
|
178
|
+
translate: 0 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
to {
|
|
182
|
+
opacity: 0;
|
|
183
|
+
translate: 0 var(--#{sys.$prefix}spacing-xs);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
package/tui-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
3
|
-
"generated": "2026-11-
|
|
2
|
+
"version": "0.2.38",
|
|
3
|
+
"generated": "2026-11-19T20:46:48.988Z",
|
|
4
4
|
"components": {
|
|
5
5
|
"Accordion": {
|
|
6
6
|
"props": {
|
|
@@ -4189,6 +4189,85 @@
|
|
|
4189
4189
|
"related": null,
|
|
4190
4190
|
"use": null,
|
|
4191
4191
|
"notFor": null
|
|
4192
|
+
},
|
|
4193
|
+
"Tray": {
|
|
4194
|
+
"props": {
|
|
4195
|
+
"open": {
|
|
4196
|
+
"type": "boolean",
|
|
4197
|
+
"required": true,
|
|
4198
|
+
"description": "Whether the tray is showing. Controlled only, like Modal: the state it\nreports (unsaved edits, a selection, an undo stack) is the app's, and the\ntray never asks to close itself, so there is no `onOpenChange`."
|
|
4199
|
+
},
|
|
4200
|
+
"placement": {
|
|
4201
|
+
"type": "\"sticky\" | \"fixed\"",
|
|
4202
|
+
"required": false,
|
|
4203
|
+
"defaultValue": "sticky",
|
|
4204
|
+
"description": "`sticky` pins it to the bottom of its scroll container (the default);\n`fixed` pins it to the viewport. A fixed tray breaks out of the viewport's\nframe under a transformed, filtered or contained ancestor, as any\n`position: fixed` does; the page reserves room at its own bottom for it."
|
|
4205
|
+
},
|
|
4206
|
+
"restoreFocusTo": {
|
|
4207
|
+
"type": "FocusTarget",
|
|
4208
|
+
"required": false,
|
|
4209
|
+
"description": "Where focus goes if the tray closes while focus is inside it. Read at close.\nDefaults to the element focus entered the tray from."
|
|
4210
|
+
},
|
|
4211
|
+
"className": {
|
|
4212
|
+
"type": "string",
|
|
4213
|
+
"required": false
|
|
4214
|
+
},
|
|
4215
|
+
"id": {
|
|
4216
|
+
"type": "string",
|
|
4217
|
+
"required": false
|
|
4218
|
+
},
|
|
4219
|
+
"style": {
|
|
4220
|
+
"type": "CSSProperties",
|
|
4221
|
+
"required": false
|
|
4222
|
+
},
|
|
4223
|
+
"title": {
|
|
4224
|
+
"type": "string",
|
|
4225
|
+
"required": false
|
|
4226
|
+
},
|
|
4227
|
+
"rel": {
|
|
4228
|
+
"type": "string",
|
|
4229
|
+
"required": false
|
|
4230
|
+
},
|
|
4231
|
+
"onChange": {
|
|
4232
|
+
"type": "FormEventHandler<HTMLDivElement>",
|
|
4233
|
+
"required": false
|
|
4234
|
+
},
|
|
4235
|
+
"onClick": {
|
|
4236
|
+
"type": "MouseEventHandler<HTMLDivElement>",
|
|
4237
|
+
"required": false
|
|
4238
|
+
}
|
|
4239
|
+
},
|
|
4240
|
+
"cssTokens": [
|
|
4241
|
+
"--tui-tray-gutter",
|
|
4242
|
+
"--tui-tray-bg",
|
|
4243
|
+
"--tui-tray-fg",
|
|
4244
|
+
"--tui-tray-border",
|
|
4245
|
+
"--tui-tray-radius",
|
|
4246
|
+
"--tui-tray-shadow",
|
|
4247
|
+
"--tui-tray-block-size",
|
|
4248
|
+
"--tui-tray-offset",
|
|
4249
|
+
"--tui-tray-max-width",
|
|
4250
|
+
"--tui-tray-padding-inline-start",
|
|
4251
|
+
"--tui-tray-padding-inline-end",
|
|
4252
|
+
"--tui-tray-gap",
|
|
4253
|
+
"--tui-tray-z",
|
|
4254
|
+
"--tui-tray-message-fg",
|
|
4255
|
+
"--tui-tray-message-weight"
|
|
4256
|
+
],
|
|
4257
|
+
"story": {
|
|
4258
|
+
"title": "Components/Tray",
|
|
4259
|
+
"tags": [
|
|
4260
|
+
"autodocs",
|
|
4261
|
+
"stable"
|
|
4262
|
+
]
|
|
4263
|
+
},
|
|
4264
|
+
"subcomponents": null,
|
|
4265
|
+
"description": null,
|
|
4266
|
+
"gotchas": null,
|
|
4267
|
+
"examples": null,
|
|
4268
|
+
"related": null,
|
|
4269
|
+
"use": null,
|
|
4270
|
+
"notFor": null
|
|
4192
4271
|
}
|
|
4193
4272
|
},
|
|
4194
4273
|
"utilities": {
|