@nxgt/material 2.9.0 → 2.10.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.
- package/CHANGELOG.md +16 -0
- package/dist/{blockDiagram-BEXU5L5S-BOsyK4E_.js → blockDiagram-BEXU5L5S-B8_AJyBb.js} +1 -1
- package/dist/{chunk-3FUC2YCW-BCsKm3ZT.js → chunk-3FUC2YCW-AfTluaJD.js} +1 -1
- package/dist/{chunk-7M6MHVWA-C3qpW8zM.js → chunk-7M6MHVWA-B2FTOUoo.js} +1 -1
- package/dist/{chunk-GNY47TPC-CzPNLW5k.js → chunk-GNY47TPC-CscSFMWi.js} +4 -4
- package/dist/{chunk-NETBCI7D-tNinefdn.js → chunk-NETBCI7D-iu8QN4Le.js} +1 -1
- package/dist/{chunk-Z7XXMR3K-C9P-XjM2.js → chunk-Z7XXMR3K-BICnZMWs.js} +1 -1
- package/dist/{classDiagram-v2-NBCMYWYE-D00ZobEC.js → classDiagram-v2-NBCMYWYE-Cg2qBPTZ.js} +2 -2
- package/dist/{components-km60bAdr.js → components-BfXTx1uS.js} +21317 -21291
- package/dist/components.js +1 -1
- package/dist/{dagre-6A5THRUB-D_F3_LlW.js → dagre-6A5THRUB-B9m4hqWN.js} +3 -3
- package/dist/{diagram-22UHCM2B-CsxOExpW.js → diagram-22UHCM2B-ChYYeBFB.js} +2 -2
- package/dist/{diagram-3UASUU5V-Dl7AETV1.js → diagram-3UASUU5V-BoEmx9Kd.js} +1 -1
- package/dist/{elk-276RUBZZ-BK-NMLiI.js → elk-276RUBZZ-CxNgT7Wb.js} +3 -3
- package/dist/{erDiagram-OPXOYQCR-DC1GgS4l.js → erDiagram-OPXOYQCR-DiqLuL4t.js} +2 -2
- package/dist/{flowDiagram-KWPJA3E3-BUSlDNQP.js → flowDiagram-KWPJA3E3-CcUm8XN5.js} +3 -3
- package/dist/{ganttDiagram-FUAMR5RP-DOp1p_x0.js → ganttDiagram-FUAMR5RP-fN1MVB5K.js} +1 -1
- package/dist/{journeyDiagram-ZHPQQLJL-DuQ9Th0y.js → journeyDiagram-ZHPQQLJL-Cj7Vcat2.js} +1 -1
- package/dist/lib/components/ui/feedback/toast/index.d.ts +1 -0
- package/dist/lib/components/ui/feedback/toast/partials/toast-actions.d.ts +12 -2
- package/dist/lib/components/ui/feedback/toast/toast-data.d.ts +26 -0
- package/dist/lib/components/ui/feedback/toast/toast.d.ts +6 -3
- package/dist/lib/components/ui/feedback/toast/toasts.d.ts +18 -6
- package/dist/main.js +1 -1
- package/dist/{mermaid.core-Dfr4zfuP.js → mermaid.core-Be3u4qna.js} +21 -21
- package/dist/{mindmap-definition-NLK3R4M7-_qKWGSrk.js → mindmap-definition-NLK3R4M7-Dw8Z4Lyy.js} +2 -2
- package/dist/{pieDiagram-5QR66LMP-B6at48Bd.js → pieDiagram-5QR66LMP-Cv_V3nnp.js} +1 -1
- package/dist/{quadrantDiagram-O4NWA36T-Cr9bA0xJ.js → quadrantDiagram-O4NWA36T-Bavlu0dy.js} +1 -1
- package/dist/{requirementDiagram-PLB6GJNP-BBs-lByV.js → requirementDiagram-PLB6GJNP-6fInAtPO.js} +2 -2
- package/dist/{sankeyDiagram-IPEJSGJF-BzX37jGY.js → sankeyDiagram-IPEJSGJF-wzaUoPP7.js} +1 -1
- package/dist/{stateDiagram-v2-GCMORJYK-Chc9Z6Mr.js → stateDiagram-v2-GCMORJYK-BRIjnDU3.js} +2 -2
- package/dist/{swimlanes-2SLR337P-D0yLvfot.js → swimlanes-2SLR337P-BNephno6.js} +3 -3
- package/dist/{swimlanesDiagram-TC7HE7FX-BOd0Czfs.js → swimlanesDiagram-TC7HE7FX-CUARDUGc.js} +3 -3
- package/dist/{timeline-definition-EJHVYXUP-nDNR-Dt-.js → timeline-definition-EJHVYXUP-By2gWxfd.js} +1 -1
- package/dist/{usecaseDiagram-POWQR4AR-Bwen99ay.js → usecaseDiagram-POWQR4AR-CleiKWa8.js} +2 -2
- package/dist/{xychartDiagram-PMCCYNJV-b-Quuxoi.js → xychartDiagram-PMCCYNJV-gwrRH4uJ.js} +1 -1
- package/docs/components/feedback-and-status.md +35 -6
- package/docs/roadmap.md +5 -0
- package/docs/troubleshooting.md +47 -0
- package/package.json +2 -2
|
@@ -426,7 +426,7 @@ toasts.dismiss(id);
|
|
|
426
426
|
| --- | --- | --- | --- |
|
|
427
427
|
| `title` / `description` | `ReactNode` | preset title for `success`, `error`, `loading` | toast text |
|
|
428
428
|
| `icon` | `ReactNode` (`toast`) · icon name (`toasts.custom`) | preset icon | leading icon |
|
|
429
|
-
| `action` | `ToastAction`: `{ label, onClick? }` or `(dismiss) => ReactNode` | a translated “Close” for `success`, `info`, `error`;
|
|
429
|
+
| `action` | `ToastAction`: `{ label, onClick? }` or `(dismiss) => ReactNode` | a translated “Close” for `success`, `info`, `error`; every preset keeps the caller's own, in either call | trailing button: `onClick` (given the click event, optional when you call it yourself), then the toast closes; or what the function renders, given `dismiss`. Brings the X button and a persistent toast, see below |
|
|
430
430
|
| `dismissLabel` | `string` | the translated “Close” when an `action` is given | accessible name of the X icon button beside the action; `''` hides it |
|
|
431
431
|
| `role` | `'status' \| 'alert'` | none (`toasts.error`: `'alert'`) | live-region role. Toasts are already announced politely by the `Toaster`'s region; `alert` interrupts, and may be read twice by some screen readers |
|
|
432
432
|
| `options` | Sonner `ExternalToast` | `duration: 5000` for presets, `Infinity` for `loading` and for any toast with your own `action` (a preset's fallback "Close" still times out at 5000) unless a `duration` is passed | passed to Sonner (`id`, `duration`, `position`…) |
|
|
@@ -438,7 +438,7 @@ forwarded; mount the one from `@nxgt/material/components`, not Sonner's own,
|
|
|
438
438
|
or neither phone change below applies. `Toast` is the component each toast
|
|
439
439
|
renders, for use with `sonnerToast.custom`.
|
|
440
440
|
|
|
441
|
-
**Types:** `ToastAction`, `ToastProps`, `ToastMethodProps`, `ToasterProps
|
|
441
|
+
**Types:** `ToastAction`, `ToastProps`, `ToastMethodProps`, `ToastData`, `ToastArgs`, `ToasterProps`, and `PresetProps` (the props of `success`, `warning`, `info` and `error`: use it, not `Parameters<typeof toasts.success>[0]`, which is now a union with the `(message, data)` form).
|
|
442
442
|
|
|
443
443
|
**On a phone** (under 600px wide, where Sonner lays toasts out across the
|
|
444
444
|
screen), a `Toaster` with no `position` shows its toasts at the top
|
|
@@ -454,6 +454,27 @@ stay visible: `<Toaster mobileOffset={{ top: 72 }} />`.
|
|
|
454
454
|
<Toaster position="bottom-center" /> // bottom-center everywhere
|
|
455
455
|
```
|
|
456
456
|
|
|
457
|
+
**sonner's call works too.** Every preset (`custom`, `success`, `info`,
|
|
458
|
+
`warning`, `error`, `loading`) also takes sonner's own `(message, data)`: the
|
|
459
|
+
message is the title, `data.description` and `data.action` are shown, and the
|
|
460
|
+
rest of `data` (`id`, `duration`, `onDismiss`…) is passed to sonner as the
|
|
461
|
+
options. `data` is typed `ToastData`, sonner's `ExternalToast` without `icon`
|
|
462
|
+
(a preset draws its own) and `cancel` (the X button stands for it): passing
|
|
463
|
+
either is a type error rather than a silent no-op.
|
|
464
|
+
|
|
465
|
+
```ts
|
|
466
|
+
toasts.success('Staff member restored', {
|
|
467
|
+
description: 'They can sign in again.',
|
|
468
|
+
action: { label: 'Send an invitation', onClick: openInvite },
|
|
469
|
+
});
|
|
470
|
+
// the same as
|
|
471
|
+
toasts.success({
|
|
472
|
+
title: 'Staff member restored',
|
|
473
|
+
description: 'They can sign in again.',
|
|
474
|
+
action: { label: 'Send an invitation', onClick: openInvite },
|
|
475
|
+
});
|
|
476
|
+
```
|
|
477
|
+
|
|
457
478
|
**An action keeps the toast open.** `toast()` itself does it, so a preset and a
|
|
458
479
|
direct call behave alike: any toast with an `action` is persistent by default
|
|
459
480
|
(`options.duration: Infinity`, WCAG 2.2.1: a timed toast can vanish before a
|
|
@@ -471,10 +492,18 @@ elsewhere) is ignored, so a tapped toast still goes after its duration. On a
|
|
|
471
492
|
touch screen a tap no longer fans out a stack of two or more toasts either: pass
|
|
472
493
|
`expand` to keep the stack open. Sonner does not close a toast on Escape (it
|
|
473
494
|
only collapses the stack); this `Toast` does when focus is inside it, with or
|
|
474
|
-
without an action. The close button is reached with Tab.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
495
|
+
without an action. The close button is reached with Tab.
|
|
496
|
+
|
|
497
|
+
**Focus after an action.** A click on a toast's action first gives the focus
|
|
498
|
+
back to the control that had it before the focus entered the toast, then runs
|
|
499
|
+
your `onClick`, then closes the toast; a function action's `dismiss` does the
|
|
500
|
+
same before it closes. So an action that opens a `Dialog` (or moves the focus
|
|
501
|
+
anywhere else) keeps it there: the dialog holds the control it focused once
|
|
502
|
+
the toast has gone, and gives the focus back to that earlier control when it
|
|
503
|
+
closes (WCAG 2.4.3). An action that moves the focus nowhere leaves it on that
|
|
504
|
+
earlier control. A toast closed by its X or by Escape takes its focused
|
|
505
|
+
control with it, so the focus falls back to `document.body`; move it yourself
|
|
506
|
+
(after `toasts.dismiss()`) when the flow needs it elsewhere.
|
|
478
507
|
|
|
479
508
|
**Announced to screen readers:** `Toaster` renders a polite live region
|
|
480
509
|
(`<section aria-live="polite">`) that is in the page before the first toast,
|
package/docs/roadmap.md
CHANGED
|
@@ -88,6 +88,11 @@ Nothing in progress right now; see Next.
|
|
|
88
88
|
|
|
89
89
|
## Shipped
|
|
90
90
|
|
|
91
|
+
- **Toast actions that work everywhere** — `toasts.success(message, { action })`
|
|
92
|
+
and every other preset take sonner's own call shape and keep their action,
|
|
93
|
+
and a dialog a toast's action opens keeps the focus, then gives it back to
|
|
94
|
+
where it was before the toast. 2.10.0.
|
|
95
|
+
|
|
91
96
|
- **Tabs in two looks** — `underline`, the new default, whose bar slides to
|
|
92
97
|
the active tab, and a neutral `segmented` pill; a list that scrolls
|
|
93
98
|
sideways on a phone instead of widening the page, right-to-left, a visible
|
package/docs/troubleshooting.md
CHANGED
|
@@ -32,6 +32,8 @@ words in your error.
|
|
|
32
32
|
- [A toast covers the form's button on a phone](#a-toast-covers-the-forms-button-on-a-phone)
|
|
33
33
|
- [A toast never goes away after a tap](#a-toast-never-goes-away-after-a-tap)
|
|
34
34
|
- [A toast's action cannot be clicked while a dialog is open](#a-toasts-action-cannot-be-clicked-while-a-dialog-is-open)
|
|
35
|
+
- [`toasts.success(message, { action })` shows no action button](#toastssuccessmessage--action--shows-no-action-button)
|
|
36
|
+
- [The focus leaves a dialog that a toast's action opened](#the-focus-leaves-a-dialog-that-a-toasts-action-opened)
|
|
35
37
|
- [A `ConfirmationDialog` reopened with new content blocks clicks](#a-confirmationdialog-reopened-with-new-content-blocks-clicks)
|
|
36
38
|
- [The first Escape after closing a nested dialog does nothing](#the-first-escape-after-closing-a-nested-dialog-does-nothing)
|
|
37
39
|
|
|
@@ -642,6 +644,51 @@ counted a pointer down on a toast as outside the dialog.
|
|
|
642
644
|
inside the `Toaster` as inside, so the action runs and the dialog stays open.
|
|
643
645
|
Sonner's own `Toaster` keeps the old behaviour.
|
|
644
646
|
|
|
647
|
+
### `toasts.success(message, { action })` shows no action button
|
|
648
|
+
|
|
649
|
+
**When:** a preset is called the way sonner's own `toast.success` is, with a
|
|
650
|
+
message and a `data` object: `toasts.success('Staff member restored', {
|
|
651
|
+
action: { label: 'Send an invitation', onClick } })`. The toast shows the
|
|
652
|
+
preset's default title ("Success") and its "Close" button, not your message,
|
|
653
|
+
description or action.
|
|
654
|
+
**Why:** the presets took one props object only (`{ title, description,
|
|
655
|
+
action, options }`): a string first argument was read as that object, and
|
|
656
|
+
the second argument was ignored.
|
|
657
|
+
**Fix:** update `@nxgt/material`: every preset (`custom`, `success`, `info`,
|
|
658
|
+
`warning`, `error`, `loading`) now takes `(message, data)` too, the message as
|
|
659
|
+
the title and `data.description` and `data.action` shown, the rest of `data`
|
|
660
|
+
as sonner's options. The props object works as before:
|
|
661
|
+
|
|
662
|
+
```ts
|
|
663
|
+
toasts.success('Staff member restored', { action: { label: 'Send an invitation', onClick } });
|
|
664
|
+
toasts.success({ title: 'Staff member restored', action: { label: 'Send an invitation', onClick } });
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
`data` takes no `icon` (a preset draws its own) and no `cancel` (the X button
|
|
668
|
+
beside the action stands for it).
|
|
669
|
+
|
|
670
|
+
### The focus leaves a dialog that a toast's action opened
|
|
671
|
+
|
|
672
|
+
**When:** a toast's action opens a `Dialog` (or an `AlertDialog`, a `Sheet`,
|
|
673
|
+
a `Drawer`, or moves the focus anywhere else). Once the toast has gone, the
|
|
674
|
+
focus is no longer on the dialog's control (it is on the dialog itself, on
|
|
675
|
+
the page behind it, or on `document.body`), and closing the dialog leaves the
|
|
676
|
+
focus on `document.body` instead of where it was before the toast.
|
|
677
|
+
**Why:** sonner remembers the control focused before the focus entered the
|
|
678
|
+
`Toaster`, and focuses it again as soon as the focus leaves the `Toaster`.
|
|
679
|
+
The dialog taking the focus counted as leaving, so sonner pulled it back out
|
|
680
|
+
of the dialog (WCAG 2.4.3). The dialog, opened while the toast's button had
|
|
681
|
+
the focus, also gave the focus back to that button once closed: it had gone
|
|
682
|
+
with its toast, so the focus fell to `document.body`.
|
|
683
|
+
**Fix:** update `@nxgt/material` and give the toast an `action` (a `{ label,
|
|
684
|
+
onClick }`, or a function that calls the `dismiss` it is given): the action
|
|
685
|
+
gives the focus back to where it was before the toast first, then runs. The
|
|
686
|
+
dialog keeps its control, and gives the focus back to that earlier control
|
|
687
|
+
when it closes. A workaround that blurs the button and opens the dialog on
|
|
688
|
+
the next frame can go. A button you render in a function action and that
|
|
689
|
+
opens a dialog without calling `dismiss` is not covered: call `dismiss()`
|
|
690
|
+
before opening the dialog.
|
|
691
|
+
|
|
645
692
|
### A `ConfirmationDialog` reopened with new content blocks clicks
|
|
646
693
|
|
|
647
694
|
**When:** a `ConfirmationDialog` or a `ConfirmDialog` (or a `Dialog`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/material",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"email": "stevegires@gmail.com"
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"docs:previews": "vitest run --project previews"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@nxgt/material-core": "^0.
|
|
117
|
+
"@nxgt/material-core": "^0.7.0",
|
|
118
118
|
"@base-ui/react": "^1.6.0",
|
|
119
119
|
"@dnd-kit/core": "^6.3.1",
|
|
120
120
|
"@dnd-kit/sortable": "^10.0.0",
|