@tangible/ui 0.2.18 → 0.2.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.
- package/components/Accordion/Accordion.d.ts +1 -1
- package/components/Accordion/Accordion.js +40 -12
- package/components/Accordion/AccordionContext.d.ts +2 -1
- package/components/Accordion/AccordionContext.js +25 -2
- package/components/Accordion/index.d.ts +2 -1
- package/components/Accordion/index.js +1 -0
- package/components/Accordion/types.d.ts +42 -3
- package/components/Modal/Modal.d.ts +36 -2
- package/components/Modal/Modal.js +40 -11
- package/components/Modal/index.d.ts +1 -1
- package/components/MoveHandle/MoveHandle.js +25 -11
- package/components/MoveHandle/types.d.ts +9 -3
- package/components/Notice/Notice.js +7 -0
- package/components/Toast/Toast.d.ts +134 -0
- package/components/Toast/Toast.js +234 -0
- package/components/Toast/ToastContext.d.ts +11 -0
- package/components/Toast/ToastContext.js +9 -0
- package/components/Toast/index.d.ts +4 -0
- package/components/Toast/index.js +2 -0
- package/components/index.d.ts +5 -3
- package/components/index.js +2 -1
- package/figma-tokens.json +1 -1
- package/package.json +5 -1
- package/skills/building-with-tui/SKILL.md +16 -2
- package/styles/all.css +1 -1
- package/styles/all.expanded.css +114 -9
- package/styles/all.expanded.unlayered.css +114 -9
- package/styles/all.unlayered.css +1 -1
- package/styles/components/_bundle.scss +5 -0
- package/styles/components/modal.scss +31 -1
- package/styles/components/move-handle.scss +20 -4
- package/styles/components/notice.scss +13 -0
- package/styles/components/toast.scss +183 -0
- package/tui-manifest.json +157 -12
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
@use "./tabs" as tabs;
|
|
43
43
|
@use "./textarea" as textarea;
|
|
44
44
|
@use "./text-input" as textinput;
|
|
45
|
+
@use "./toast" as toast;
|
|
45
46
|
@use "./toolbar" as toolbar;
|
|
46
47
|
@use "./tooltip" as tooltip;
|
|
47
48
|
|
|
@@ -121,6 +122,10 @@ $-input-dependents: (input, field, text-input, textarea, pager, search-input, se
|
|
|
121
122
|
@if -wants($only, tabs) { @include tabs.styles(); }
|
|
122
123
|
@if -wants($only, textarea) { @include textarea.styles(); }
|
|
123
124
|
@if -wants($only, text-input) { @include textinput.styles(); }
|
|
125
|
+
// Toast composes Notice at runtime — a subset build requesting toast must
|
|
126
|
+
// also request notice (and icon-button for the dismiss ×), same latent gap
|
|
127
|
+
// as the gradient-picker note above.
|
|
128
|
+
@if -wants($only, toast) { @include toast.styles(); }
|
|
124
129
|
@if -wants($only, toolbar) { @include toolbar.styles(); }
|
|
125
130
|
@if -wants($only, tooltip) { @include tooltip.styles(); }
|
|
126
131
|
}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
--tui-modal-radius
|
|
15
15
|
--tui-modal-padding
|
|
16
16
|
--tui-modal-shadow
|
|
17
|
+
--tui-modal-foot-gap
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
20
|
@mixin styles() {
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
// --tui-modal-radius Dialog border radius
|
|
36
37
|
// --tui-modal-padding Dialog padding (slots)
|
|
37
38
|
// --tui-modal-shadow Dialog box shadow
|
|
39
|
+
// --tui-modal-foot-gap Gap between actions in Modal.Foot
|
|
38
40
|
//
|
|
39
41
|
// To override from consuming code:
|
|
40
42
|
// .my-context .tui-modal { --tui-modal-max: 600px; }
|
|
@@ -233,11 +235,39 @@
|
|
|
233
235
|
padding-inline-end: calc(var(--_padding) + var(--#{sys.$prefix}spacing-xl));
|
|
234
236
|
}
|
|
235
237
|
|
|
236
|
-
// Foot slot
|
|
238
|
+
// Foot slot — the actions row. Flex so Buttons share one line, gathered at
|
|
239
|
+
// the inline end by default (reading order = visual order, primary last);
|
|
240
|
+
// Modal.Foot's `justify` re-points the distribution via data-justify. Wraps
|
|
241
|
+
// rather than overflows when a narrow dialog can't fit every action.
|
|
242
|
+
//
|
|
243
|
+
// Deliberately a data attribute, not an `is-align-*` class: the bare
|
|
244
|
+
// `.is-align-*` / `.is-justify-*` utilities are unscoped and sit in the
|
|
245
|
+
// utilities layer, so a modifier class of that name would have its
|
|
246
|
+
// `align-items` hijacked by the utility and win over anything set here.
|
|
237
247
|
.#{sys.$prefix}modal__foot {
|
|
248
|
+
--_foot-gap: var(--#{sys.$prefix}modal-foot-gap, var(--#{sys.$prefix}spacing-sm));
|
|
249
|
+
--_foot-justify: flex-end;
|
|
250
|
+
|
|
238
251
|
padding-block: var(--_padding);
|
|
239
252
|
padding-inline: var(--_padding);
|
|
240
253
|
width: 100%;
|
|
254
|
+
display: flex;
|
|
255
|
+
flex-wrap: wrap;
|
|
256
|
+
align-items: center;
|
|
257
|
+
justify-content: var(--_foot-justify);
|
|
258
|
+
gap: var(--_foot-gap);
|
|
259
|
+
|
|
260
|
+
// `end` is the base rule above — deliberately no attribute selector for it.
|
|
261
|
+
&[data-justify="start"] {
|
|
262
|
+
--_foot-justify: flex-start;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Not `space-between`: with three actions that floats the middle one
|
|
266
|
+
// into no-man's-land. The intent is "first action apart, the rest
|
|
267
|
+
// grouped at the end", which is an auto margin after the first item.
|
|
268
|
+
&[data-justify="between"] > :first-child {
|
|
269
|
+
margin-inline-end: auto;
|
|
270
|
+
}
|
|
241
271
|
}
|
|
242
272
|
|
|
243
273
|
// Size presets — scale min-body proportionally to width so short-content
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
//
|
|
17
17
|
// Compact reorder control for sortable lists. Vertical stack of chevron-up,
|
|
18
18
|
// center (drag handle / index / lock), and chevron-down. The 'arrows' mode
|
|
19
|
-
// drops the
|
|
19
|
+
// drops the drag handle for explicit-move-only items; its center is the
|
|
20
|
+
// index badge when one is given, otherwise there is no center at all.
|
|
20
21
|
//
|
|
21
22
|
// Component API tokens (never defined here, only read via fallback):
|
|
22
23
|
// --tui-move-handle-size Override container size
|
|
@@ -221,16 +222,19 @@
|
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
// -------------------------------------------------------------------------
|
|
224
|
-
// Index ↔ handle hover swap
|
|
225
|
+
// Index ↔ handle hover swap (full mode only)
|
|
225
226
|
// -------------------------------------------------------------------------
|
|
226
227
|
// Uses opacity + position instead of display:none so the handle button
|
|
227
228
|
// remains focusable. Tab triggers :focus-within reliably because the
|
|
228
229
|
// button is always in the layout flow (just visually hidden).
|
|
230
|
+
//
|
|
231
|
+
// Scoped away from arrows mode: it has no handle to swap to, so the hover
|
|
232
|
+
// rule would just blank the index.
|
|
229
233
|
&__center {
|
|
230
234
|
position: relative;
|
|
231
235
|
}
|
|
232
236
|
|
|
233
|
-
&.has-index {
|
|
237
|
+
&.has-index:not(.is-arrows) {
|
|
234
238
|
.#{sys.$prefix}move-handle__index {
|
|
235
239
|
opacity: 1;
|
|
236
240
|
}
|
|
@@ -257,7 +261,7 @@
|
|
|
257
261
|
|
|
258
262
|
// Touch devices: always show handle, hide index
|
|
259
263
|
@media (hover: none) {
|
|
260
|
-
&.has-index {
|
|
264
|
+
&.has-index:not(.is-arrows) {
|
|
261
265
|
.#{sys.$prefix}move-handle__index {
|
|
262
266
|
display: none;
|
|
263
267
|
}
|
|
@@ -291,6 +295,18 @@
|
|
|
291
295
|
// Arrows variant — panel with chevrons only, no center (unless locked)
|
|
292
296
|
// -------------------------------------------------------------------------
|
|
293
297
|
&.is-arrows {
|
|
298
|
+
// The group is the focus-recovery target when both chevrons disable
|
|
299
|
+
// (tabIndex -1, reached programmatically only) — keep that visible.
|
|
300
|
+
&:focus-visible {
|
|
301
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
302
|
+
outline-offset: var(--#{sys.$prefix}focus-ring-offset);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// With an index the stack is chevron | badge | chevron at full mode's
|
|
307
|
+
// exact heights (16 + center + 16 = 56px at md), so the two modes line up
|
|
308
|
+
// in one list. Without one, the chevrons take the whole panel.
|
|
309
|
+
&.is-arrows:not(.has-index) {
|
|
294
310
|
// No center to reserve space for — the stack is just the two chevrons.
|
|
295
311
|
min-height: calc(2 * #{$_chevron-size});
|
|
296
312
|
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
--tui-notice-icon
|
|
15
15
|
--tui-notice-title-size
|
|
16
16
|
--tui-notice-foot-basis
|
|
17
|
+
--tui-notice-dismiss-bg-interact
|
|
18
|
+
--tui-notice-dismiss-bg-pressed
|
|
17
19
|
*/
|
|
18
20
|
|
|
19
21
|
@mixin styles() {
|
|
@@ -35,6 +37,8 @@
|
|
|
35
37
|
// --tui-notice-icon Icon color (defaults to the theme base per variant)
|
|
36
38
|
// --tui-notice-title-size Title font size (defaults per size preset)
|
|
37
39
|
// --tui-notice-foot-basis Flex basis for foot in inline layout
|
|
40
|
+
// --tui-notice-dismiss-bg-interact Dismiss (×) hover/focus fill (default: 12% fg mix)
|
|
41
|
+
// --tui-notice-dismiss-bg-pressed Dismiss (×) pressed fill (default: 20% fg mix)
|
|
38
42
|
//
|
|
39
43
|
// To override from consuming code:
|
|
40
44
|
// .my-context .tui-notice { --tui-notice-bg: hotpink; }
|
|
@@ -476,6 +480,15 @@
|
|
|
476
480
|
position: absolute;
|
|
477
481
|
inset-block-start: var(--#{sys.$prefix}notice-padding, var(--#{sys.$prefix}spacing-md));
|
|
478
482
|
inset-inline-end: var(--#{sys.$prefix}notice-padding, var(--#{sys.$prefix}spacing-md));
|
|
483
|
+
// Hover/pressed fills: IconButton's ghost fallbacks are SOLID neutral
|
|
484
|
+
// fills (theme-secondary-subtle), which read as grey blobs on the tinted
|
|
485
|
+
// theme surfaces. A translucent fg-mix (the Tabs/SegmentedControl hover
|
|
486
|
+
// treatment) sits on any tint, and resolves per theme scope — Toast's
|
|
487
|
+
// dark surface gets a light hover from this same rule for free.
|
|
488
|
+
// Defined as token VALUES, not properties, so IconButton's own (0,2,0)
|
|
489
|
+
// rules read them via their fallback chain — no specificity contest.
|
|
490
|
+
--#{sys.$prefix}icon-button-bg-interact: var(--#{sys.$prefix}notice-dismiss-bg-interact, color-mix(in srgb, var(--#{sys.$prefix}color-fg) 12%, transparent));
|
|
491
|
+
--#{sys.$prefix}icon-button-bg-pressed: var(--#{sys.$prefix}notice-dismiss-bg-pressed, color-mix(in srgb, var(--#{sys.$prefix}color-fg) 20%, transparent));
|
|
479
492
|
}
|
|
480
493
|
|
|
481
494
|
// In inline mode, dismiss button flows at end instead of absolute positioning
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
@use "../system" as sys;
|
|
2
|
+
|
|
3
|
+
/* @tui-tokens
|
|
4
|
+
--tui-toast-width
|
|
5
|
+
--tui-toast-fg
|
|
6
|
+
--tui-toast-gap
|
|
7
|
+
--tui-toast-inset
|
|
8
|
+
--tui-toast-shadow
|
|
9
|
+
--tui-toast-z
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@mixin styles() {
|
|
13
|
+
// ==========================================================================
|
|
14
|
+
// Toast Component
|
|
15
|
+
// ==========================================================================
|
|
16
|
+
//
|
|
17
|
+
// A toast is an inline-layout Notice worn in a fixed stack (the DOM carries
|
|
18
|
+
// both .tui-toast and .tui-notice), so panel styling comes from Notice and
|
|
19
|
+
// its API tokens still apply — re-point them per context:
|
|
20
|
+
// .tui-toast { --tui-notice-bg: …; --tui-notice-padding: …; }
|
|
21
|
+
//
|
|
22
|
+
// The toast root is ALSO a nested .tui-interface[data-theme="dark"] — the
|
|
23
|
+
// dark surface is a theme scope, not a token remap, so everything inside
|
|
24
|
+
// (action Buttons, the dismiss IconButton, consumer children) resolves
|
|
25
|
+
// dark tokens on its own. Two consequences for this file:
|
|
26
|
+
// - fg must be pinned to the scope's own token (Notice's --_fg default
|
|
27
|
+
// is `inherit`, which would pull the LIGHT page color across the
|
|
28
|
+
// theme boundary);
|
|
29
|
+
// - most coloring needs no rules here at all.
|
|
30
|
+
//
|
|
31
|
+
// Toast's own API tokens (never defined here, only read via fallback):
|
|
32
|
+
// --tui-toast-width Toast width (default 26rem — the default must keep
|
|
33
|
+
// Notice's inline container query (content ≥ 400px)
|
|
34
|
+
// true, or the layout falls back to stacked). Read
|
|
35
|
+
// by the REGION, which owns all sizing (toasts fill
|
|
36
|
+
// it) — override it on .tui-toast-region or
|
|
37
|
+
// .tui-interface, never on .tui-toast, where the
|
|
38
|
+
// region has already sized itself and the override
|
|
39
|
+
// does nothing.
|
|
40
|
+
// --tui-toast-fg Text color (default: the dark scope's color-fg)
|
|
41
|
+
// --tui-toast-gap Gap between stacked toasts
|
|
42
|
+
// --tui-toast-inset Region padding from the viewport edges
|
|
43
|
+
// --tui-toast-shadow Box shadow (default shadow-lg)
|
|
44
|
+
// --tui-toast-z Region z-index (default layer-top)
|
|
45
|
+
//
|
|
46
|
+
// ==========================================================================
|
|
47
|
+
|
|
48
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}toast-region {
|
|
49
|
+
--_gap: var(--#{sys.$prefix}toast-gap, var(--#{sys.$prefix}spacing-sm));
|
|
50
|
+
--_inset: var(--#{sys.$prefix}toast-inset, var(--#{sys.$prefix}spacing-lg));
|
|
51
|
+
// Direction toasts enter from — inherited into the enter keyframes on
|
|
52
|
+
// each toast (both live in this file; rename one, rename the other).
|
|
53
|
+
// Top placements flip it below.
|
|
54
|
+
--_enter-from: 0.5rem;
|
|
55
|
+
|
|
56
|
+
position: fixed;
|
|
57
|
+
z-index: var(--#{sys.$prefix}toast-z, var(--#{sys.$prefix}layer-top, 9999));
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: var(--_gap);
|
|
61
|
+
padding: var(--_inset);
|
|
62
|
+
// Single owner of toast sizing — toasts fill the region's content box.
|
|
63
|
+
width: min(calc(var(--#{sys.$prefix}toast-width, 26rem) + var(--_inset) * 2), 100%);
|
|
64
|
+
// The region itself is click-through; each toast restores pointer-events.
|
|
65
|
+
pointer-events: none;
|
|
66
|
+
|
|
67
|
+
// The region receives programmatic focus when a dismissed toast held it,
|
|
68
|
+
// so it needs a visible ring — drawn inward, since the region sits at
|
|
69
|
+
// the viewport edge.
|
|
70
|
+
&:focus-visible {
|
|
71
|
+
outline: var(--#{sys.$prefix}focus-ring-width) solid var(--#{sys.$prefix}focus-ring-color);
|
|
72
|
+
outline-offset: calc(-1 * var(--#{sys.$prefix}focus-ring-width));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Center placements: over-constrained inset + auto margins center the
|
|
76
|
+
// fixed box. No transform centering — it breaks in RTL.
|
|
77
|
+
&.is-placement-top,
|
|
78
|
+
&.is-placement-bottom {
|
|
79
|
+
inset-inline: 0;
|
|
80
|
+
margin-inline: auto;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Top placements stack newest-first visually (DOM order stays
|
|
84
|
+
// oldest-first for reading order); toasts slide down into place.
|
|
85
|
+
&.is-placement-top-start,
|
|
86
|
+
&.is-placement-top,
|
|
87
|
+
&.is-placement-top-end {
|
|
88
|
+
--_enter-from: -0.5rem;
|
|
89
|
+
inset-block-start: 0;
|
|
90
|
+
flex-direction: column-reverse;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&.is-placement-bottom-start,
|
|
94
|
+
&.is-placement-bottom,
|
|
95
|
+
&.is-placement-bottom-end {
|
|
96
|
+
inset-block-end: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&.is-placement-top-start,
|
|
100
|
+
&.is-placement-bottom-start {
|
|
101
|
+
inset-inline-start: 0;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.is-placement-top-end,
|
|
105
|
+
&.is-placement-bottom-end {
|
|
106
|
+
inset-inline-end: 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Full specificity: the toast restyles the Notice it is composed from, and
|
|
111
|
+
// Notice's own state rules sit at (0,2,0) — a :where() host rule would lose
|
|
112
|
+
// (see the "wrapper restyling an embedded TUI component" gotcha).
|
|
113
|
+
// Width comes from Notice's own `width: 100%` (filling the region).
|
|
114
|
+
.#{sys.$prefix}interface .#{sys.$prefix}toast {
|
|
115
|
+
// Pin fg to the dark scope: Notice's --_fg default is `inherit`, which
|
|
116
|
+
// crosses the theme boundary and lands the page's LIGHT foreground on
|
|
117
|
+
// the dark surface. --tui-color-fg here resolves to the scope's dark
|
|
118
|
+
// value because the toast root carries data-theme="dark".
|
|
119
|
+
--#{sys.$prefix}notice-fg: var(--#{sys.$prefix}toast-fg, var(--#{sys.$prefix}color-fg));
|
|
120
|
+
// Actions are a compact cluster, not Notice's 500px form-actions basis.
|
|
121
|
+
--#{sys.$prefix}notice-foot-basis: max-content;
|
|
122
|
+
|
|
123
|
+
box-shadow: var(--#{sys.$prefix}toast-shadow, var(--#{sys.$prefix}shadow-lg));
|
|
124
|
+
pointer-events: auto;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.#{sys.$prefix}interface .#{sys.$prefix}toast .#{sys.$prefix}toast__title {
|
|
128
|
+
font-weight: var(--#{sys.$prefix}typography-weight-semibold, 600);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.#{sys.$prefix}interface .#{sys.$prefix}toast .#{sys.$prefix}toast__description {
|
|
132
|
+
font-size: var(--#{sys.$prefix}typography-size-sm);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Dismiss (×) hover/pressed fills live on Notice (`--tui-notice-dismiss-
|
|
136
|
+
// bg-interact`/`-pressed`, translucent fg-mixes) — the toast's dark scope
|
|
137
|
+
// resolves them dark-correct with no toast-side rule.
|
|
138
|
+
|
|
139
|
+
// The actions cluster holds its width; the body text wraps instead.
|
|
140
|
+
// Notice's inline rule sets `flex: 0 1 var(--_foot-basis)` at (0,2,0) —
|
|
141
|
+
// without this, a squeezed foot wraps a Button's label mid-word.
|
|
142
|
+
.#{sys.$prefix}interface .#{sys.$prefix}toast .#{sys.$prefix}notice__foot {
|
|
143
|
+
flex-shrink: 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// The dark scope's tokens don't exist under forced colors, and a floating
|
|
147
|
+
// surface needs an edge to read as one (mirrors Tooltip's WHCM rule).
|
|
148
|
+
@media (forced-colors: active) {
|
|
149
|
+
.#{sys.$prefix}interface .#{sys.$prefix}toast {
|
|
150
|
+
background-color: Canvas;
|
|
151
|
+
color: CanvasText;
|
|
152
|
+
border: 1px solid CanvasText;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Enter animation sits at (0,1,0) ON PURPOSE: Notice's exit rules
|
|
157
|
+
// (.tui-notice.is-exiting-fade, (0,2,0)) must win the `animation` property
|
|
158
|
+
// when the toast leaves, regardless of bundle order.
|
|
159
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}toast {
|
|
160
|
+
animation: #{sys.$prefix}toastEnter var(--#{sys.$prefix}motion-duration) var(--#{sys.$prefix}motion-timing);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@media (prefers-reduced-motion: reduce) {
|
|
164
|
+
:where(.#{sys.$prefix}interface) .#{sys.$prefix}toast {
|
|
165
|
+
animation: none;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// `--_enter-from` resolves against the animated toast by inheritance from
|
|
170
|
+
// its region (declared at the top of this file); the fallback covers a
|
|
171
|
+
// static toast rendered outside any region.
|
|
172
|
+
@keyframes #{sys.$prefix}toastEnter {
|
|
173
|
+
from {
|
|
174
|
+
opacity: 0;
|
|
175
|
+
translate: 0 var(--_enter-from, 0.5rem);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
to {
|
|
179
|
+
opacity: 1;
|
|
180
|
+
translate: 0 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
package/tui-manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.2.
|
|
3
|
-
"generated": "2026-
|
|
2
|
+
"version": "0.2.20",
|
|
3
|
+
"generated": "2026-09-03T19:23:49.505Z",
|
|
4
4
|
"components": {
|
|
5
5
|
"Accordion": {
|
|
6
6
|
"props": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"value": {
|
|
17
17
|
"type": "string | string[]",
|
|
18
18
|
"required": false,
|
|
19
|
-
"description": "Controlled: currently open item value\nControlled: currently open item values"
|
|
19
|
+
"description": "Controlled: currently open item value. `null` means \"controlled, nothing\nopen\". Controlled vs uncontrolled is decided once, at mount, from whether\n`value` is `undefined` — so pass `null` (not `undefined`) for \"all closed\",\nand if `undefined` does leak back in later (`onValueChange` reports it on\ncollapse), it reads as \"nothing open\" rather than switching modes.\nControlled: currently open item values"
|
|
20
20
|
},
|
|
21
21
|
"onValueChange": {
|
|
22
22
|
"type": "((value: string) => void) | ((value: string[]) => void)",
|
|
23
23
|
"required": false,
|
|
24
|
-
"description": "Callback when open item changes
|
|
24
|
+
"description": "Callback when open item changes. Receives `undefined` when all items are\nclosed (collapsible mode) — store it as `value ?? null` if your state is\n`string | null`.\nCallback when open items change"
|
|
25
25
|
},
|
|
26
26
|
"collapsible": {
|
|
27
27
|
"type": "boolean",
|
|
@@ -73,6 +73,18 @@
|
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"note": "Keyboard: Arrow keys navigate triggers, Enter/Space toggle"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"note": "Controlled single: value accepts string | null — null is 'nothing open'; undefined would flip to uncontrolled. onValueChange still reports undefined when all closed (store as v ?? null)"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"note": "Trigger asChild stamps the full-width row paint (tui-accordion__trigger) by default; add `unstyled` when the child is already a styled control (IconButton). data-tui-accordion-trigger + data-state always land"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"note": "asChild with a native <button> child: Enter/Space activation is left to the browser (no synthetic toggle), so it fires once"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"note": "useAccordionItem() (exported) gives a secondary control inside Accordion.Item the panelId/isOpen/toggle for its own aria-expanded/aria-controls"
|
|
76
88
|
}
|
|
77
89
|
],
|
|
78
90
|
"examples": [
|
|
@@ -87,6 +99,10 @@
|
|
|
87
99
|
{
|
|
88
100
|
"name": "With heading",
|
|
89
101
|
"code": "<Accordion.Item value=\"faq\" headingLevel={3}>\n <Accordion.Trigger>Frequently Asked</Accordion.Trigger>\n <Accordion.Panel>Answer here</Accordion.Panel>\n</Accordion.Item>"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "Icon-button trigger + secondary control",
|
|
105
|
+
"code": "function EditLink() {\n const { isOpen, panelId, toggle } = useAccordionItem();\n return <button type=\"button\" aria-expanded={isOpen} aria-controls={panelId} onClick={toggle}>{isOpen ? 'Close' : 'Edit'}</button>;\n}\n\n<Accordion type=\"single\" collapsible value={open} onValueChange={(v) => setOpen(v ?? null)}>\n <Accordion.Item value=\"row-1\">\n <div className=\"row\">\n <span>Hero banner</span>\n <EditLink />\n <Accordion.Trigger asChild unstyled>\n <IconButton icon=\"system/chevron-down\" label=\"Toggle Hero banner\" variant=\"ghost\" size=\"sm\" />\n </Accordion.Trigger>\n </div>\n <Accordion.Panel>…</Accordion.Panel>\n </Accordion.Item>\n</Accordion>"
|
|
90
106
|
}
|
|
91
107
|
],
|
|
92
108
|
"related": [
|
|
@@ -1294,7 +1310,7 @@
|
|
|
1294
1310
|
"--tui-dropdown-item-bg-active"
|
|
1295
1311
|
],
|
|
1296
1312
|
"story": {
|
|
1297
|
-
"title": "
|
|
1313
|
+
"title": "Overlays/Dropdown",
|
|
1298
1314
|
"tags": [
|
|
1299
1315
|
"autodocs",
|
|
1300
1316
|
"stable"
|
|
@@ -1633,6 +1649,16 @@
|
|
|
1633
1649
|
"type": "\"sm\" | \"md\" | \"lg\" | \"xl\"",
|
|
1634
1650
|
"required": false
|
|
1635
1651
|
},
|
|
1652
|
+
"role": {
|
|
1653
|
+
"type": "\"dialog\" | \"alertdialog\"",
|
|
1654
|
+
"required": false,
|
|
1655
|
+
"description": "ARIA role of the dialog element. Default `'dialog'`.\n\n`'alertdialog'` is for a dialog that interrupts the user's workflow to demand a response —\na destructive-action confirm is the textbook case. Focus trap, `aria-modal`, Escape and\nfocus restore behave identically for both roles; what changes is the contract around them:\nthe APG alert dialog pattern expects BOTH `aria-labelledby` (the heading) and\n`aria-describedby` (the message) — a dev warning fires if either is missing — and the\nbackdrop stops dismissing on click unless `closeOnBackdropClick` says otherwise, since a\nstray click outside is not a response. Escape still closes: it is the keyboard \"cancel\".\n\nInitial focus lands on the first focusable element in DOM order (unless\n`initialFocusSelector` says otherwise), and the APG wants that to be the safest action —\nso put Cancel before the destructive action in `Modal.Foot`. If the visual order must\ndiffer (`Modal.Foot justify=\"between\"` with a destructive action first), point\n`initialFocusSelector` at the safe one.\nhttps://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/"
|
|
1656
|
+
},
|
|
1657
|
+
"closeOnBackdropClick": {
|
|
1658
|
+
"type": "boolean",
|
|
1659
|
+
"required": false,
|
|
1660
|
+
"description": "Close when clicking the backdrop. Default `true` for `role=\"dialog\"`, `false` for\n`role=\"alertdialog\"` (see `role`). Passing it explicitly always wins."
|
|
1661
|
+
},
|
|
1636
1662
|
"preventScrollOnRestore": {
|
|
1637
1663
|
"type": "boolean",
|
|
1638
1664
|
"required": false,
|
|
@@ -1652,10 +1678,11 @@
|
|
|
1652
1678
|
"--tui-modal-border",
|
|
1653
1679
|
"--tui-modal-radius",
|
|
1654
1680
|
"--tui-modal-padding",
|
|
1655
|
-
"--tui-modal-shadow"
|
|
1681
|
+
"--tui-modal-shadow",
|
|
1682
|
+
"--tui-modal-foot-gap"
|
|
1656
1683
|
],
|
|
1657
1684
|
"story": {
|
|
1658
|
-
"title": "
|
|
1685
|
+
"title": "Overlays/Modal",
|
|
1659
1686
|
"tags": [
|
|
1660
1687
|
"autodocs",
|
|
1661
1688
|
"stable"
|
|
@@ -1672,6 +1699,12 @@
|
|
|
1672
1699
|
{
|
|
1673
1700
|
"note": "Always provide aria-labelledby pointing to a heading id for accessibility"
|
|
1674
1701
|
},
|
|
1702
|
+
{
|
|
1703
|
+
"note": "role=\"alertdialog\" for confirms that interrupt to demand a response (destructive actions): needs BOTH aria-labelledby and aria-describedby (dev warning otherwise), and the backdrop stops dismissing on click by default — Escape still cancels"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
"note": "Modal.Foot is a flex actions row, end-aligned by default; justify=\"start\" | \"end\" | \"between\" re-points it (between = first action apart, rest grouped at the end). No need for tui-flex / justify utilities on it"
|
|
1707
|
+
},
|
|
1675
1708
|
{
|
|
1676
1709
|
"note": "Body uses two-layer wrapper for scroll + :has() composition"
|
|
1677
1710
|
},
|
|
@@ -1693,6 +1726,10 @@
|
|
|
1693
1726
|
{
|
|
1694
1727
|
"name": "With close button",
|
|
1695
1728
|
"code": "<Modal open={open} onClose={close} showCloseButton aria-labelledby=\"title\">\n <Modal.Head><h2 id=\"title\">Confirm</h2></Modal.Head>\n <Modal.Body>Are you sure?</Modal.Body>\n</Modal>"
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
"name": "Alert dialog (destructive confirm)",
|
|
1732
|
+
"code": "<Modal open={open} onClose={close} role=\"alertdialog\" size=\"sm\" aria-labelledby=\"confirm-title\" aria-describedby=\"confirm-desc\">\n <Modal.Head><h2 id=\"confirm-title\">Delete course?</h2></Modal.Head>\n <Modal.Body><p id=\"confirm-desc\">This removes the course and its lessons. It cannot be undone.</p></Modal.Body>\n <Modal.Foot>\n <Button variant=\"outline\" label=\"Cancel\" onClick={close} />\n <Button theme=\"danger\" label=\"Delete\" onClick={confirm} />\n </Modal.Foot>\n</Modal>"
|
|
1696
1733
|
}
|
|
1697
1734
|
],
|
|
1698
1735
|
"related": [
|
|
@@ -1706,7 +1743,7 @@
|
|
|
1706
1743
|
"mode": {
|
|
1707
1744
|
"type": "\"full\" | \"handle\" | \"arrows\"",
|
|
1708
1745
|
"required": false,
|
|
1709
|
-
"description": "Structural mode. 'full' (default) shows background panel with arrows/index.\n'handle' shows only the bare drag icon button. 'arrows' shows the panel\nwith
|
|
1746
|
+
"description": "Structural mode. 'full' (default) shows background panel with arrows/index.\n'handle' shows only the bare drag icon button. 'arrows' shows the panel\nwith the up/down chevron buttons and no drag handle — for items reordered\nexclusively by explicit moves (top-level containers, lists without a drag\nlibrary). Pass `index` to show the position between the chevrons."
|
|
1710
1747
|
},
|
|
1711
1748
|
"size": {
|
|
1712
1749
|
"type": "\"sm\" | \"md\"",
|
|
@@ -1716,7 +1753,7 @@
|
|
|
1716
1753
|
"index": {
|
|
1717
1754
|
"type": "number",
|
|
1718
1755
|
"required": false,
|
|
1719
|
-
"description": "Position index.
|
|
1756
|
+
"description": "Position index. In 'full' mode, shows the number at rest and swaps to the\ndrag handle on hover/focus-within. In 'arrows' mode, shows the number\nbetween the chevrons with no swap — there is no handle to swap to.\nIgnored in 'handle' mode."
|
|
1720
1757
|
},
|
|
1721
1758
|
"locked": {
|
|
1722
1759
|
"type": "boolean",
|
|
@@ -2096,7 +2133,9 @@
|
|
|
2096
2133
|
"--tui-notice-para-gap",
|
|
2097
2134
|
"--tui-notice-icon",
|
|
2098
2135
|
"--tui-notice-title-size",
|
|
2099
|
-
"--tui-notice-foot-basis"
|
|
2136
|
+
"--tui-notice-foot-basis",
|
|
2137
|
+
"--tui-notice-dismiss-bg-interact",
|
|
2138
|
+
"--tui-notice-dismiss-bg-pressed"
|
|
2100
2139
|
],
|
|
2101
2140
|
"story": {
|
|
2102
2141
|
"title": "Components/Notice",
|
|
@@ -2345,7 +2384,7 @@
|
|
|
2345
2384
|
"--tui-popover-padding"
|
|
2346
2385
|
],
|
|
2347
2386
|
"story": {
|
|
2348
|
-
"title": "
|
|
2387
|
+
"title": "Overlays/Popover",
|
|
2349
2388
|
"tags": [
|
|
2350
2389
|
"autodocs"
|
|
2351
2390
|
]
|
|
@@ -3714,6 +3753,112 @@
|
|
|
3714
3753
|
"use": null,
|
|
3715
3754
|
"notFor": null
|
|
3716
3755
|
},
|
|
3756
|
+
"Toast": {
|
|
3757
|
+
"props": {
|
|
3758
|
+
"className": {
|
|
3759
|
+
"type": "string",
|
|
3760
|
+
"required": false
|
|
3761
|
+
},
|
|
3762
|
+
"id": {
|
|
3763
|
+
"type": "string",
|
|
3764
|
+
"required": false
|
|
3765
|
+
},
|
|
3766
|
+
"style": {
|
|
3767
|
+
"type": "CSSProperties",
|
|
3768
|
+
"required": false
|
|
3769
|
+
},
|
|
3770
|
+
"role": {
|
|
3771
|
+
"type": "AriaRole",
|
|
3772
|
+
"required": false
|
|
3773
|
+
},
|
|
3774
|
+
"rel": {
|
|
3775
|
+
"type": "string",
|
|
3776
|
+
"required": false
|
|
3777
|
+
},
|
|
3778
|
+
"onChange": {
|
|
3779
|
+
"type": "FormEventHandler<HTMLDivElement>",
|
|
3780
|
+
"required": false
|
|
3781
|
+
},
|
|
3782
|
+
"onClick": {
|
|
3783
|
+
"type": "MouseEventHandler<HTMLDivElement>",
|
|
3784
|
+
"required": false
|
|
3785
|
+
},
|
|
3786
|
+
"theme": {
|
|
3787
|
+
"type": "\"info\" | \"success\" | \"warning\" | \"danger\" | \"neutral\"",
|
|
3788
|
+
"required": false,
|
|
3789
|
+
"defaultValue": "neutral",
|
|
3790
|
+
"description": "Visual intent. Default 'neutral' — the plain dark surface."
|
|
3791
|
+
},
|
|
3792
|
+
"size": {
|
|
3793
|
+
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
3794
|
+
"required": false,
|
|
3795
|
+
"defaultValue": "sm",
|
|
3796
|
+
"description": "Density preset (Notice's size scale). Default 'sm' — toasts are dense;\n'md'/'lg' restore Notice's roomier panel spacing."
|
|
3797
|
+
},
|
|
3798
|
+
"icon": {
|
|
3799
|
+
"type": "ReactNode",
|
|
3800
|
+
"required": false,
|
|
3801
|
+
"description": "Icon content, rendered leading the text. Colored by theme via Notice."
|
|
3802
|
+
},
|
|
3803
|
+
"title": {
|
|
3804
|
+
"type": "ReactNode",
|
|
3805
|
+
"required": false,
|
|
3806
|
+
"description": "Title text — a styled `<div>`, never a heading: a toast lives in a\nportal outside the document outline, so a heading would be an orphan\nfor screen-reader heading navigation."
|
|
3807
|
+
},
|
|
3808
|
+
"announce": {
|
|
3809
|
+
"type": "\"polite\" | \"assertive\"",
|
|
3810
|
+
"required": false,
|
|
3811
|
+
"description": "Screen-reader announcement politeness.\nDefaults to 'assertive' (role=\"alert\") for danger, 'polite'\n(role=\"status\") otherwise."
|
|
3812
|
+
},
|
|
3813
|
+
"dismissible": {
|
|
3814
|
+
"type": "boolean",
|
|
3815
|
+
"required": false,
|
|
3816
|
+
"defaultValue": "true",
|
|
3817
|
+
"description": "Renders a dismiss (×) button. Default true."
|
|
3818
|
+
},
|
|
3819
|
+
"onDismiss": {
|
|
3820
|
+
"type": "() => void",
|
|
3821
|
+
"required": false,
|
|
3822
|
+
"description": "Called after the exit animation completes (× button path)."
|
|
3823
|
+
},
|
|
3824
|
+
"dismissLabel": {
|
|
3825
|
+
"type": "string",
|
|
3826
|
+
"required": false,
|
|
3827
|
+
"description": "Accessible label for the dismiss button. Default 'Dismiss'."
|
|
3828
|
+
},
|
|
3829
|
+
"actions": {
|
|
3830
|
+
"type": "ReactNode",
|
|
3831
|
+
"required": false,
|
|
3832
|
+
"description": "Action content (e.g. a Button), rendered in the foot."
|
|
3833
|
+
},
|
|
3834
|
+
"children": {
|
|
3835
|
+
"type": "ReactNode",
|
|
3836
|
+
"required": false,
|
|
3837
|
+
"description": "Body/description content."
|
|
3838
|
+
}
|
|
3839
|
+
},
|
|
3840
|
+
"cssTokens": [
|
|
3841
|
+
"--tui-toast-width",
|
|
3842
|
+
"--tui-toast-fg",
|
|
3843
|
+
"--tui-toast-gap",
|
|
3844
|
+
"--tui-toast-inset",
|
|
3845
|
+
"--tui-toast-shadow",
|
|
3846
|
+
"--tui-toast-z"
|
|
3847
|
+
],
|
|
3848
|
+
"story": {
|
|
3849
|
+
"title": "Overlays/Toast",
|
|
3850
|
+
"tags": [
|
|
3851
|
+
"autodocs"
|
|
3852
|
+
]
|
|
3853
|
+
},
|
|
3854
|
+
"subcomponents": null,
|
|
3855
|
+
"description": null,
|
|
3856
|
+
"gotchas": null,
|
|
3857
|
+
"examples": null,
|
|
3858
|
+
"related": null,
|
|
3859
|
+
"use": null,
|
|
3860
|
+
"notFor": null
|
|
3861
|
+
},
|
|
3717
3862
|
"Toolbar": {
|
|
3718
3863
|
"props": {
|
|
3719
3864
|
"orientation": {
|
|
@@ -3781,7 +3926,7 @@
|
|
|
3781
3926
|
"--tui-tooltip-z"
|
|
3782
3927
|
],
|
|
3783
3928
|
"story": {
|
|
3784
|
-
"title": "
|
|
3929
|
+
"title": "Overlays/Tooltip",
|
|
3785
3930
|
"tags": [
|
|
3786
3931
|
"autodocs",
|
|
3787
3932
|
"stable"
|