@nxgt/material 3.99.0 → 3.100.0

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.
@@ -1184,6 +1184,29 @@ toasts.success({
1184
1184
  });
1185
1185
  ```
1186
1186
 
1187
+ **Toasts that belong to a page.** `useScopedToasts()` returns the same API as
1188
+ `toasts`, and dismisses every toast it showed when the component unmounts, so a
1189
+ toast with an « Undo » action never outlives the page that can undo. `dismiss(id)`
1190
+ forgets the id; `dismiss()` without an id takes down only this scope's toasts.
1191
+ The returned object is stable, safe in a dependency array.
1192
+
1193
+ ```tsx
1194
+ import { Button, useScopedToasts } from '@nxgt/material/components';
1195
+
1196
+ function Archive({ undo }: { undo: () => void }) {
1197
+ const toasts = useScopedToasts();
1198
+ return (
1199
+ <Button
1200
+ onClick={() =>
1201
+ toasts.success({ title: 'Archived', action: { label: 'Undo', onClick: undo } })
1202
+ }
1203
+ >
1204
+ Archive
1205
+ </Button>
1206
+ );
1207
+ }
1208
+ ```
1209
+
1187
1210
  **An action keeps the toast open.** `toast()` itself does it, so a preset and a
1188
1211
  direct call behave alike: any toast with an `action` is persistent by default
1189
1212
  (`options.duration: Infinity`, WCAG 2.2.1: a timed toast can vanish before a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/material",
3
- "version": "3.99.0",
3
+ "version": "3.100.0",
4
4
  "license": "MIT",
5
5
  "bugs": {
6
6
  "email": "stevegires@gmail.com"