@tangible/ui 0.2.18 → 0.2.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.
@@ -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,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.18",
3
- "generated": "2026-08-30T20:29:02.985Z",
2
+ "version": "0.2.19",
3
+ "generated": "2026-09-01T18:02:16.418Z",
4
4
  "components": {
5
5
  "Accordion": {
6
6
  "props": {
@@ -1294,7 +1294,7 @@
1294
1294
  "--tui-dropdown-item-bg-active"
1295
1295
  ],
1296
1296
  "story": {
1297
- "title": "Primitives/Dropdown",
1297
+ "title": "Overlays/Dropdown",
1298
1298
  "tags": [
1299
1299
  "autodocs",
1300
1300
  "stable"
@@ -1655,7 +1655,7 @@
1655
1655
  "--tui-modal-shadow"
1656
1656
  ],
1657
1657
  "story": {
1658
- "title": "Components/Modal",
1658
+ "title": "Overlays/Modal",
1659
1659
  "tags": [
1660
1660
  "autodocs",
1661
1661
  "stable"
@@ -2096,7 +2096,9 @@
2096
2096
  "--tui-notice-para-gap",
2097
2097
  "--tui-notice-icon",
2098
2098
  "--tui-notice-title-size",
2099
- "--tui-notice-foot-basis"
2099
+ "--tui-notice-foot-basis",
2100
+ "--tui-notice-dismiss-bg-interact",
2101
+ "--tui-notice-dismiss-bg-pressed"
2100
2102
  ],
2101
2103
  "story": {
2102
2104
  "title": "Components/Notice",
@@ -2345,7 +2347,7 @@
2345
2347
  "--tui-popover-padding"
2346
2348
  ],
2347
2349
  "story": {
2348
- "title": "Primitives/Popover",
2350
+ "title": "Overlays/Popover",
2349
2351
  "tags": [
2350
2352
  "autodocs"
2351
2353
  ]
@@ -3714,6 +3716,112 @@
3714
3716
  "use": null,
3715
3717
  "notFor": null
3716
3718
  },
3719
+ "Toast": {
3720
+ "props": {
3721
+ "className": {
3722
+ "type": "string",
3723
+ "required": false
3724
+ },
3725
+ "id": {
3726
+ "type": "string",
3727
+ "required": false
3728
+ },
3729
+ "style": {
3730
+ "type": "CSSProperties",
3731
+ "required": false
3732
+ },
3733
+ "role": {
3734
+ "type": "AriaRole",
3735
+ "required": false
3736
+ },
3737
+ "rel": {
3738
+ "type": "string",
3739
+ "required": false
3740
+ },
3741
+ "onChange": {
3742
+ "type": "FormEventHandler<HTMLDivElement>",
3743
+ "required": false
3744
+ },
3745
+ "onClick": {
3746
+ "type": "MouseEventHandler<HTMLDivElement>",
3747
+ "required": false
3748
+ },
3749
+ "theme": {
3750
+ "type": "\"info\" | \"success\" | \"warning\" | \"danger\" | \"neutral\"",
3751
+ "required": false,
3752
+ "defaultValue": "neutral",
3753
+ "description": "Visual intent. Default 'neutral' — the plain dark surface."
3754
+ },
3755
+ "size": {
3756
+ "type": "\"sm\" | \"md\" | \"lg\"",
3757
+ "required": false,
3758
+ "defaultValue": "sm",
3759
+ "description": "Density preset (Notice's size scale). Default 'sm' — toasts are dense;\n'md'/'lg' restore Notice's roomier panel spacing."
3760
+ },
3761
+ "icon": {
3762
+ "type": "ReactNode",
3763
+ "required": false,
3764
+ "description": "Icon content, rendered leading the text. Colored by theme via Notice."
3765
+ },
3766
+ "title": {
3767
+ "type": "ReactNode",
3768
+ "required": false,
3769
+ "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."
3770
+ },
3771
+ "announce": {
3772
+ "type": "\"polite\" | \"assertive\"",
3773
+ "required": false,
3774
+ "description": "Screen-reader announcement politeness.\nDefaults to 'assertive' (role=\"alert\") for danger, 'polite'\n(role=\"status\") otherwise."
3775
+ },
3776
+ "dismissible": {
3777
+ "type": "boolean",
3778
+ "required": false,
3779
+ "defaultValue": "true",
3780
+ "description": "Renders a dismiss (×) button. Default true."
3781
+ },
3782
+ "onDismiss": {
3783
+ "type": "() => void",
3784
+ "required": false,
3785
+ "description": "Called after the exit animation completes (× button path)."
3786
+ },
3787
+ "dismissLabel": {
3788
+ "type": "string",
3789
+ "required": false,
3790
+ "description": "Accessible label for the dismiss button. Default 'Dismiss'."
3791
+ },
3792
+ "actions": {
3793
+ "type": "ReactNode",
3794
+ "required": false,
3795
+ "description": "Action content (e.g. a Button), rendered in the foot."
3796
+ },
3797
+ "children": {
3798
+ "type": "ReactNode",
3799
+ "required": false,
3800
+ "description": "Body/description content."
3801
+ }
3802
+ },
3803
+ "cssTokens": [
3804
+ "--tui-toast-width",
3805
+ "--tui-toast-fg",
3806
+ "--tui-toast-gap",
3807
+ "--tui-toast-inset",
3808
+ "--tui-toast-shadow",
3809
+ "--tui-toast-z"
3810
+ ],
3811
+ "story": {
3812
+ "title": "Overlays/Toast",
3813
+ "tags": [
3814
+ "autodocs"
3815
+ ]
3816
+ },
3817
+ "subcomponents": null,
3818
+ "description": null,
3819
+ "gotchas": null,
3820
+ "examples": null,
3821
+ "related": null,
3822
+ "use": null,
3823
+ "notFor": null
3824
+ },
3717
3825
  "Toolbar": {
3718
3826
  "props": {
3719
3827
  "orientation": {
@@ -3781,7 +3889,7 @@
3781
3889
  "--tui-tooltip-z"
3782
3890
  ],
3783
3891
  "story": {
3784
- "title": "Primitives/Tooltip",
3892
+ "title": "Overlays/Tooltip",
3785
3893
  "tags": [
3786
3894
  "autodocs",
3787
3895
  "stable"