@wallarm-org/design-system 4.8.0-rc-feat-parser.1 → 4.8.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.
Files changed (176) hide show
  1. package/README.md +4 -2
  2. package/dist/components/BulkBar/index.d.ts +5 -0
  3. package/dist/components/Drawer/classes.js +1 -1
  4. package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
  5. package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
  6. package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
  7. package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
  8. package/dist/components/NotificationCenter/NotificationCenter.d.ts +20 -0
  9. package/dist/components/NotificationCenter/NotificationCenter.js +65 -0
  10. package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +18 -0
  11. package/dist/components/NotificationCenter/NotificationCenterBody.js +202 -0
  12. package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +5 -0
  13. package/dist/components/NotificationCenter/NotificationCenterContent.js +42 -0
  14. package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +20 -0
  15. package/dist/components/NotificationCenter/NotificationCenterHeader.js +202 -0
  16. package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +26 -0
  17. package/dist/components/NotificationCenter/NotificationCenterItem.js +211 -0
  18. package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +9 -0
  19. package/dist/components/NotificationCenter/NotificationCenterItemTime.js +148 -0
  20. package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +14 -0
  21. package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +115 -0
  22. package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +10 -0
  23. package/dist/components/NotificationCenter/NotificationCenterTabs.js +77 -0
  24. package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +13 -0
  25. package/dist/components/NotificationCenter/NotificationCenterTrigger.js +138 -0
  26. package/dist/components/NotificationCenter/index.d.ts +9 -0
  27. package/dist/components/NotificationCenter/index.js +9 -0
  28. package/dist/components/Overlay/Overlay.js +1 -1
  29. package/dist/components/SearchInput/SearchInput.d.ts +7 -5
  30. package/dist/components/SearchInput/SearchInput.js +119 -101
  31. package/dist/components/Select/SelectSearchInput.d.ts +1 -1
  32. package/dist/components/Table/types.d.ts +1 -1
  33. package/dist/components/Tabs/Tabs.d.ts +1 -0
  34. package/dist/components/Tabs/Tabs.js +30 -28
  35. package/dist/components/Tabs/TabsList/index.d.ts +1 -1
  36. package/dist/components/Tabs/index.d.ts +2 -2
  37. package/dist/components/Tour/TourPositioner.d.ts +3 -0
  38. package/dist/components/Tour/TourPositioner.js +4 -4
  39. package/dist/guidelines/foundations/color.md +157 -0
  40. package/dist/guidelines/foundations/focus.md +122 -0
  41. package/dist/guidelines/foundations/layering.md +131 -0
  42. package/dist/guidelines/foundations/radius-elevation.md +111 -0
  43. package/dist/guidelines/foundations/spacing.md +117 -0
  44. package/dist/guidelines/foundations/typography.md +114 -0
  45. package/dist/guidelines/patterns/app-layout.md +1567 -0
  46. package/dist/guidelines/patterns/auth-page.md +668 -0
  47. package/dist/guidelines/patterns/confirmation-dialogs.md +605 -0
  48. package/dist/guidelines/patterns/create-edit-forms.md +768 -0
  49. package/dist/guidelines/patterns/detail-drawer.md +868 -0
  50. package/dist/guidelines/patterns/empty-states.md +461 -0
  51. package/dist/guidelines/patterns/entity-table.md +533 -0
  52. package/dist/guidelines/patterns/feedback-toasts.md +493 -0
  53. package/dist/guidelines/patterns/filtering.md +630 -0
  54. package/dist/guidelines/patterns/resource-list-page.md +558 -0
  55. package/dist/guidelines/patterns/settings-page.md +752 -0
  56. package/dist/guidelines/rules.md +25 -0
  57. package/dist/index.d.ts +2 -3
  58. package/dist/index.js +1 -2
  59. package/dist/metadata/components.json +12431 -9208
  60. package/dist/metadata/guidelines.json +1705 -0
  61. package/dist/theme/typography.css +5 -0
  62. package/dist/utils/formatDateTime.d.ts +6 -0
  63. package/dist/utils/formatDateTime.js +13 -1
  64. package/package.json +6 -4
  65. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
  66. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
  67. package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
  68. package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
  69. package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
  70. package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
  71. package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
  72. package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
  73. package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
  74. package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
  75. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
  76. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
  77. package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
  78. package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
  79. package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
  80. package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
  81. package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
  82. package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
  83. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
  84. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
  85. package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
  86. package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
  87. package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
  88. package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
  89. package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
  90. package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
  91. package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
  92. package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
  93. package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
  94. package/dist/components/Rules/PointSelector/classes.js +0 -22
  95. package/dist/components/Rules/PointSelector/index.d.ts +0 -20
  96. package/dist/components/Rules/PointSelector/index.js +0 -18
  97. package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
  98. package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
  99. package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
  100. package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
  101. package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
  102. package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
  103. package/dist/components/Rules/PointSelector/types.d.ts +0 -304
  104. package/dist/components/Rules/PointSelector/types.js +0 -0
  105. package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
  106. package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
  107. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
  108. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
  109. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
  110. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
  111. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
  112. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
  113. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
  114. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
  115. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
  116. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
  117. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
  118. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
  119. package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
  120. package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
  121. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
  122. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
  123. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
  124. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
  125. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
  126. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
  127. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
  128. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
  129. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
  130. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
  131. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
  132. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
  133. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
  134. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
  135. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
  136. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
  137. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
  138. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
  139. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
  140. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
  141. package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
  142. package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
  143. package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
  144. package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
  145. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
  146. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
  147. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
  148. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
  149. package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
  150. package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
  151. package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
  152. package/dist/components/Rules/RuleBuilder/classes.js +0 -18
  153. package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
  154. package/dist/components/Rules/RuleBuilder/index.js +0 -11
  155. package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
  156. package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
  157. package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
  158. package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
  159. package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
  160. package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
  161. package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
  162. package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
  163. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
  164. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
  165. package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
  166. package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
  167. package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
  168. package/dist/components/Rules/RuleBuilder/types.js +0 -0
  169. package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
  170. package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
  171. package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
  172. package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
  173. package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
  174. package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
  175. package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
  176. package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
@@ -0,0 +1,493 @@
1
+ ---
2
+ title: Feedback toasts
3
+ description: Use when a mutation finishes (row menu, bulk bar, dialog confirm, autosave, test run) and the app must report the result with a transient toast.
4
+ components: [Toaster, ToastActions, Button, Alert, Banner, Dialog, FieldError]
5
+ keywords: [toast, toaster, useToast, notification, snackbar, feedback, success message, error message, loading toast, action result, confirmation message, flash message, saved, deleted]
6
+ order: 40
7
+ ---
8
+
9
+ # Feedback toasts
10
+
11
+ A toast reports the result of the user's last action, then leaves on its own.
12
+
13
+ ## When to use
14
+
15
+ | Need | Use | Not |
16
+ | --- | --- | --- |
17
+ | Confirm a finished mutation ("User deleted") | Toast, `type: 'default'` | `Alert` in the page |
18
+ | Show progress of a request that takes seconds | Toast, `type: 'loading'`, then `update` | A spinner in a blocking `Dialog` |
19
+ | Report an async result (test sent, sync done) | Toast, `type: 'success'` or `'error'` | `type: 'default'` |
20
+ | Offer one next step after create | Toast with `actions` | A second dialog |
21
+ | Ask the user to decide | `Dialog` | Toast with two action buttons |
22
+ | Show a result inside a form (connection test) | `Alert` in the form | Toast |
23
+ | Show standing account or system state | `Banner` | Toast with a long `duration` |
24
+ | Show a field validation error | `FieldError` under the field | Toast |
25
+
26
+ If the message is the only place the user learns something important, do not use a toast. It disappears.
27
+
28
+ ## Rules
29
+
30
+ ### Type and layout
31
+
32
+ - If the user's own mutation finished, use `type: 'default'` (no icon). A delete confirmed in a `Dialog` is a finished mutation.
33
+ - Otherwise use `'success'`, `'error'`, `'warning'` (finished with a caveat) or `'info'` (neutral notice).
34
+ - Exception: save toasts on a settings page use `type: 'success'`. See [Settings page](./settings-page.md).
35
+ - **Always** set `type`. Without it the toast renders as `'info'` with a blue icon.
36
+ - A `description` always switches to the `extended` layout (title over description, 10000 ms), even with `variant: 'simple'`. Without it the toast is one 48px row, 5000 ms.
37
+ - `icon` replaces the type icon and takes the type color unless it sets its own `text-*` class.
38
+
39
+ ### Placement and spacing
40
+
41
+ - `Toaster` owns position (bottom center), 24px padding, 12px gaps and layering above every drawer and dialog. **Never** wrap it in a positioned element.
42
+ - `Toast` owns its padding and width (256–560px). **Never** add spacing or width to toast content.
43
+ - Three toasts show at once; hover expands the stack and pauses every timer.
44
+ - Mount one `Toaster` at the app root. **Never** mount a second.
45
+
46
+ ### Loading and updates
47
+
48
+ - If you create a `loading` toast, **always** resolve it with `update` or `dismiss`. It has no timer and never leaves on its own.
49
+ - If an `update` adds a `description`, also pass `duration: 10000`. The timer is fixed at `create`.
50
+ - Pass `closable: false` only to a `loading` toast the user must not lose.
51
+ - If the user can repeat an action (copy, save), pass a stable `id` so the toast updates instead of stacking.
52
+
53
+ ### Copy
54
+
55
+ | Case | Pattern | Example |
56
+ | --- | --- | --- |
57
+ | Mutation done | `<Object> <past-tense verb>` | "User deleted", "Changes saved" |
58
+ | Toggle | `<Object> enabled` / `disabled` | "Policy enabled" |
59
+ | In flight | `<Verb>ing <object>…` | "Testing channel…" |
60
+ | Async success | `<Result> via <provider>` | "Test delivered via Slack" |
61
+ | Failure | `<Action> failed — <cause>` | "Test failed — Slack rejected the request: missing API key" |
62
+ | Create with next step | Title, one-sentence description, one action | "Channel created" + "Go to destination" |
63
+
64
+ - Use sentence case and name the object, not "Success" or "Done". **Never** end a title with a period or "!".
65
+ - If the error text is long, put the action in `title` and the cause in `description`.
66
+ - **Never** pre-truncate copy; it clamps with a tooltip.
67
+
68
+ ### Behavior
69
+
70
+ - Fire one toast per user action. A bulk action fires one toast for the batch ("3 users deleted").
71
+ - If a `Dialog` confirmed the action, close the dialog first, then fire the toast.
72
+ - Use `actions` only for a next step after create, one action (two max), each a `<Button variant='secondary' size='small' color='neutral-alt'>` inside `ToastActions`.
73
+ - **Never** make Undo, Confirm or Retry available only in a toast.
74
+
75
+ ### Imports
76
+
77
+ - Import `useToast` from `@wallarm-org/design-system/Toast`. It is not exported from the package root.
78
+ - Outside React, use `toaster.create(options)` and `toaster.update(id, options)`.
79
+
80
+ ## Examples
81
+
82
+ Confirm a finished mutation with a plain toast. A delete confirmed in a dialog closes the dialog first.
83
+
84
+ The whole page, with every toast from the one app-root `Toaster`: create, then send test, copy
85
+ link and delete from each row's menu. The parts below show each toast on its own.
86
+
87
+ ```tsx story=Default
88
+ import { useState } from 'react';
89
+ import { Button } from '@wallarm-org/design-system/Button';
90
+ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
91
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
92
+ import { Ellipsis } from '@wallarm-org/design-system/icons';
93
+ import { Page, PageActions, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
94
+ import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
95
+ import { ToastActions, useToast } from '@wallarm-org/design-system/Toast';
96
+
97
+ export const Default = () => {
98
+ const toast = useToast();
99
+ const [channels, setChannels] = useState(CHANNELS);
100
+ const [deleteTarget, setDeleteTarget] = useState<Channel | null>(null);
101
+ const [deleteOpen, setDeleteOpen] = useState(false);
102
+
103
+ const handleCreate = () => {
104
+ toast.create({
105
+ id: 'channel-created',
106
+ title: 'Channel created',
107
+ description: 'Route notifications through this channel in a destination.',
108
+ type: 'default',
109
+ actions: (
110
+ <ToastActions>
111
+ <Button variant='secondary' size='small' color='neutral-alt' onClick={onOpenDestination}>
112
+ Go to destination
113
+ </Button>
114
+ </ToastActions>
115
+ ),
116
+ });
117
+ };
118
+
119
+ const handleConfirmDelete = () => {
120
+ if (!deleteTarget) return;
121
+ onDeleteChannel(deleteTarget);
122
+ setChannels(channels.filter(channel => channel.id !== deleteTarget.id));
123
+ setDeleteOpen(false);
124
+ toast.create({ id: `delete-${deleteTarget.id}`, title: 'Channel deleted', type: 'default' });
125
+ };
126
+
127
+ const renderActions = ({ row }: TableCellContext<Channel, unknown>) => {
128
+ const channel = row.original;
129
+
130
+ const handleTest = async () => {
131
+ const id = toast.create({
132
+ id: `test-${channel.id}`,
133
+ title: 'Testing channel…',
134
+ type: 'loading',
135
+ });
136
+ try {
137
+ await sendTestNotification();
138
+ toast.update({ id, title: `Test delivered via ${channel.provider}`, type: 'success' });
139
+ } catch (error) {
140
+ toast.update({
141
+ id,
142
+ title: 'Test failed',
143
+ description: error instanceof Error ? error.message : undefined,
144
+ type: 'error',
145
+ duration: 10000,
146
+ });
147
+ }
148
+ };
149
+
150
+ const handleCopyLink = async () => {
151
+ try {
152
+ await navigator.clipboard.writeText(channel.link);
153
+ toast.create({ id: 'copy-link', title: 'Link copied', type: 'default' });
154
+ } catch {
155
+ toast.create({ id: 'copy-link', title: 'Copy failed', type: 'error' });
156
+ }
157
+ };
158
+
159
+ const handleDelete = () => {
160
+ setDeleteTarget(channel);
161
+ setDeleteOpen(true);
162
+ };
163
+
164
+ return (
165
+ <DropdownMenu data-testid='channel-actions'>
166
+ <DropdownMenuTrigger asChild>
167
+ <Button
168
+ variant='ghost'
169
+ color='neutral'
170
+ size='small'
171
+ aria-label={`Actions for ${channel.name}`}
172
+ >
173
+ <Ellipsis />
174
+ </Button>
175
+ </DropdownMenuTrigger>
176
+ <DropdownMenuContent>
177
+ <DropdownMenuItem onSelect={handleTest}>
178
+ <DropdownMenuItemText>Send test</DropdownMenuItemText>
179
+ </DropdownMenuItem>
180
+ <DropdownMenuItem onSelect={handleCopyLink}>
181
+ <DropdownMenuItemText>Copy link</DropdownMenuItemText>
182
+ </DropdownMenuItem>
183
+ <DropdownMenuSeparator />
184
+ <DropdownMenuItem variant='destructive' onSelect={handleDelete}>
185
+ <DropdownMenuItemText>Delete channel</DropdownMenuItemText>
186
+ </DropdownMenuItem>
187
+ </DropdownMenuContent>
188
+ </DropdownMenu>
189
+ );
190
+ };
191
+
192
+ const columns: TableColumnDef<Channel>[] = [
193
+ { accessorKey: 'name', header: 'Name', size: 240 },
194
+ { accessorKey: 'provider', header: 'Provider', size: 160 },
195
+ { accessorKey: 'events', header: 'Events', size: 320 },
196
+ {
197
+ id: 'actions',
198
+ header: '',
199
+ size: 60,
200
+ minSize: 60,
201
+ enableHiding: false,
202
+ cell: renderActions,
203
+ },
204
+ ];
205
+
206
+ return (
207
+ <Page name='integrations-channels' fullSize fixedHeight data-testid='channels-page'>
208
+ <PageHeader>
209
+ <PageHeaderGroup className='flex-1'>
210
+ <PageTitle>Notification channels</PageTitle>
211
+ <PageDescription>
212
+ Where Wallarm sends attack, incident and system notifications.
213
+ </PageDescription>
214
+ </PageHeaderGroup>
215
+ <PageActions>
216
+ <Button size='medium' onClick={handleCreate} data-testid='channels-create'>
217
+ Create channel
218
+ </Button>
219
+ </PageActions>
220
+ </PageHeader>
221
+
222
+ <PageContent>
223
+ <Table
224
+ aria-label='Notification channels'
225
+ data={channels}
226
+ columns={columns}
227
+ getRowId={getChannelId}
228
+ data-testid='channels-table'
229
+ />
230
+ </PageContent>
231
+
232
+ <Dialog
233
+ width={400}
234
+ open={deleteOpen}
235
+ onOpenChange={setDeleteOpen}
236
+ data-testid='channels-delete-dialog'
237
+ >
238
+ <DialogContent>
239
+ <DialogHeader>
240
+ <DialogTitle>Delete channel?</DialogTitle>
241
+ <DialogDescription>
242
+ Wallarm stops sending notifications to {deleteTarget?.name}. You can't undo this.
243
+ </DialogDescription>
244
+ </DialogHeader>
245
+ <DialogFooter>
246
+ <DialogClose asChild>
247
+ <Button variant='ghost' color='neutral'>
248
+ Cancel
249
+ </Button>
250
+ </DialogClose>
251
+ <Button color='destructive' onClick={handleConfirmDelete}>
252
+ Delete channel
253
+ </Button>
254
+ </DialogFooter>
255
+ </DialogContent>
256
+ </Dialog>
257
+ </Page>
258
+ );
259
+ };
260
+ ```
261
+
262
+ Offer one next step after create.
263
+
264
+ The description switches the toast to the extended layout, so it stays 10000 ms.
265
+
266
+ ```tsx story=NextStep
267
+ import { Button } from '@wallarm-org/design-system/Button';
268
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
269
+ import { ToastActions, useToast } from '@wallarm-org/design-system/Toast';
270
+
271
+ export const NextStep = () => {
272
+ const toast = useToast();
273
+
274
+ const handleCreate = () => {
275
+ toast.create({
276
+ id: 'channel-created',
277
+ title: 'Channel created',
278
+ description: 'Route notifications through this channel in a destination.',
279
+ type: 'default',
280
+ actions: (
281
+ <ToastActions>
282
+ <Button variant='secondary' size='small' color='neutral-alt' onClick={onOpenDestination}>
283
+ Go to destination
284
+ </Button>
285
+ </ToastActions>
286
+ ),
287
+ });
288
+ };
289
+
290
+ return (
291
+ <Page name='integrations-channels' data-testid='channels-page'>
292
+ <PageHeader>
293
+ <PageHeaderGroup className='flex-1'>
294
+ <PageTitle>Notification channels</PageTitle>
295
+ <PageDescription>
296
+ Where Wallarm sends attack, incident and system notifications.
297
+ </PageDescription>
298
+ </PageHeaderGroup>
299
+ <PageActions>
300
+ <Button size='medium' onClick={handleCreate} data-testid='channels-create'>
301
+ Create channel
302
+ </Button>
303
+ </PageActions>
304
+ </PageHeader>
305
+ </Page>
306
+ );
307
+ };
308
+ ```
309
+
310
+ Turn a loading toast into the result in place.
311
+
312
+ The loading toast has no timer; the 5000 ms timer starts when `update` resolves it.
313
+
314
+ ```tsx story=TestDelivered
315
+ import { Button } from '@wallarm-org/design-system/Button';
316
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
317
+ import { useToast } from '@wallarm-org/design-system/Toast';
318
+
319
+ export const TestDelivered = () => {
320
+ const toast = useToast();
321
+
322
+ const handleTest = async () => {
323
+ const id = toast.create({
324
+ id: 'test-ch-soc-alerts',
325
+ title: 'Testing channel…',
326
+ type: 'loading',
327
+ });
328
+ try {
329
+ await sendTestNotification();
330
+ toast.update({ id, title: 'Test delivered via Slack', type: 'success' });
331
+ } catch (error) {
332
+ toast.update({
333
+ id,
334
+ title: 'Test failed',
335
+ description: error instanceof Error ? error.message : undefined,
336
+ type: 'error',
337
+ duration: 10000,
338
+ });
339
+ }
340
+ };
341
+
342
+ return (
343
+ <Page name='integrations-channel' data-testid='channel-page'>
344
+ <PageHeader>
345
+ <PageHeaderGroup className='flex-1'>
346
+ <PageTitle>#soc-alerts</PageTitle>
347
+ <PageDescription>Slack channel. Receives attacks and vulnerabilities.</PageDescription>
348
+ </PageHeaderGroup>
349
+ <PageActions>
350
+ <Button
351
+ size='medium'
352
+ variant='outline'
353
+ color='neutral'
354
+ onClick={handleTest}
355
+ data-testid='channel-send-test'
356
+ >
357
+ Send test
358
+ </Button>
359
+ </PageActions>
360
+ </PageHeader>
361
+ </Page>
362
+ );
363
+ };
364
+ ```
365
+
366
+ If the failure adds a description, extend the timer in the same update.
367
+
368
+ The action goes in `title` and the provider's cause in `description`.
369
+
370
+ ```tsx story=TestFailed
371
+ import { Button } from '@wallarm-org/design-system/Button';
372
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
373
+ import { useToast } from '@wallarm-org/design-system/Toast';
374
+
375
+ export const TestFailed = () => {
376
+ const toast = useToast();
377
+
378
+ const handleTest = async () => {
379
+ const id = toast.create({ id: 'test-ch-siem', title: 'Testing channel…', type: 'loading' });
380
+ try {
381
+ await sendRejectedTestNotification();
382
+ toast.update({ id, title: 'Test delivered via Splunk', type: 'success' });
383
+ } catch (error) {
384
+ toast.update({
385
+ id,
386
+ title: 'Test failed',
387
+ description: error instanceof Error ? error.message : undefined,
388
+ type: 'error',
389
+ duration: 10000,
390
+ });
391
+ }
392
+ };
393
+
394
+ return (
395
+ <Page name='integrations-channel' data-testid='channel-page'>
396
+ <PageHeader>
397
+ <PageHeaderGroup className='flex-1'>
398
+ <PageTitle>SIEM ingest</PageTitle>
399
+ <PageDescription>
400
+ Splunk HTTP Event Collector. Receives attacks, incidents and system events.
401
+ </PageDescription>
402
+ </PageHeaderGroup>
403
+ <PageActions>
404
+ <Button
405
+ size='medium'
406
+ variant='outline'
407
+ color='neutral'
408
+ onClick={handleTest}
409
+ data-testid='channel-send-test'
410
+ >
411
+ Send test
412
+ </Button>
413
+ </PageActions>
414
+ </PageHeader>
415
+ </Page>
416
+ );
417
+ };
418
+ ```
419
+
420
+ Reuse an `id` so repeated clicks update one toast instead of stacking.
421
+
422
+ If the clipboard is blocked, the same id turns the toast into an error.
423
+
424
+ ```tsx story=CopyLink
425
+ import { Button } from '@wallarm-org/design-system/Button';
426
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
427
+ import { useToast } from '@wallarm-org/design-system/Toast';
428
+
429
+ export const CopyLink = () => {
430
+ const toast = useToast();
431
+
432
+ const handleCopyLink = async () => {
433
+ try {
434
+ await navigator.clipboard.writeText(ONCALL_LINK);
435
+ toast.create({ id: 'copy-link', title: 'Link copied', type: 'default' });
436
+ } catch {
437
+ toast.create({ id: 'copy-link', title: 'Copy failed', type: 'error' });
438
+ }
439
+ };
440
+
441
+ return (
442
+ <Page name='integrations-channel' data-testid='channel-page'>
443
+ <PageHeader>
444
+ <PageHeaderGroup className='flex-1'>
445
+ <PageTitle>Security on-call</PageTitle>
446
+ <PageDescription>PagerDuty service. Receives incidents.</PageDescription>
447
+ </PageHeaderGroup>
448
+ <PageActions>
449
+ <Button
450
+ size='medium'
451
+ variant='outline'
452
+ color='neutral'
453
+ onClick={handleCopyLink}
454
+ data-testid='channel-copy-link'
455
+ >
456
+ Copy link
457
+ </Button>
458
+ </PageActions>
459
+ </PageHeader>
460
+ </Page>
461
+ );
462
+ };
463
+ ```
464
+
465
+ ## States
466
+
467
+ | State | Show | Example component |
468
+ | --- | --- | --- |
469
+ | Done | Plain toast, leaves after 5000 ms | `toast.create({ title, type: 'default' })` |
470
+ | In flight | Spinner, no timer, no progress bar | `toast.create({ title, type: 'loading' })` |
471
+ | Resolved | Same toast changes in place, timer starts | `toast.update({ id, title, type: 'success' })` |
472
+ | Failed | Same toast turns into an error | `toast.update({ id, title, type: 'error' })` |
473
+ | Repeated action | Visible toast updates, no copy | `toast.create({ id: 'copy-link', … })` |
474
+ | Dismissed by code | One toast removed, or all | `toast.dismiss({ id })`, `toast.dismiss()` |
475
+
476
+ ## What your app owns
477
+
478
+ - Toast copy, firing after the request resolves, resolving every `loading` toast, and stable ids.
479
+
480
+ These do not exist:
481
+
482
+ - Placement or visible-count props. `Toaster` takes no props.
483
+ - An Undo helper or a promise helper on `useToast`.
484
+ - Rich text. `title` and `description` are strings.
485
+ - `className` or `testId` options. The toast root gets `data-testid` equal to its `id`, so pass `id` to locate it in tests.
486
+ - An exported duration constant. Use the literals 5000 and 10000.
487
+
488
+ ## Related
489
+
490
+ - [Confirmation dialogs](./confirmation-dialogs.md): the dialog before most toasts.
491
+ - [Settings page](./settings-page.md): autosave fires a "<Field> updated" toast.
492
+ - [Create and edit forms](./create-edit-forms.md): the create toast with a next-step action.
493
+ - [Layering](../foundations/layering.md): why toasts paint above drawers and dialogs.