@wallarm-org/design-system 4.8.0-rc-feat-parser.1 → 4.8.0-rc-fix-claude-code.2

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,605 @@
1
+ ---
2
+ title: Confirmation dialogs
3
+ description: Use when an action deletes, disables or overwrites something, or when closing a form would lose unsaved changes, and the user must confirm first.
4
+ components: [Dialog, Drawer, Button, Input, Toast, Toaster]
5
+ keywords: [confirm, confirmation, are you sure, delete, remove, revoke, deactivate, disable, destructive, type to confirm, unsaved changes, leave without saving, discard, modal, alert dialog, ConfirmDialog]
6
+ order: 30
7
+ ---
8
+
9
+ # Confirmation dialogs
10
+
11
+ A confirmation dialog asks one question about one action, then runs that action or cancels it. Compose it from `Dialog` parts. There is no `ConfirmDialog`, `AlertDialog`, `useConfirm` or `UnsavedChangesDialog`.
12
+
13
+ ## When to use
14
+
15
+ | Need | Use | Not |
16
+ | --- | --- | --- |
17
+ | Delete, revoke, deactivate, disable | `Dialog width={400}`, confirm `color='destructive'` | A toast with Undo, or a `Switch` that silently removes access |
18
+ | Activate or enable | `Dialog width={400}`, default brand confirm | `color='destructive'` |
19
+ | Delete that also breaks linked objects | Type-to-confirm: no `width` (560) + `Input` | A longer description |
20
+ | Closing a drawer with unsaved edits | Unsaved-changes guard, no `width` (560) | `window.confirm` or `closeOnEscape={false}` |
21
+ | Continue despite a warning | `Dialog width={400}`, brand "Create anyway" | An `Alert` to dismiss first |
22
+ | Reversible action that loses no data | No dialog; run it and show a toast | A confirmation |
23
+ | Several fields before acting | [Create and edit forms](create-edit-forms.md) | A form inside `DialogBody` |
24
+ | Report the result | A toast | A second dialog that says "Done" |
25
+
26
+ ## Rules
27
+
28
+ ### Structure
29
+
30
+ - Import every `Dialog*` part from `@wallarm-org/design-system/Dialog`. `Dialog` is not exported from the package root.
31
+ - Use `width={400}` for delete, state change and proceed-anyway. Omit `width` (560) for type-to-confirm and unsaved changes. **Never** use `960` for a confirmation.
32
+ - Write the width as a number; `DIALOG_SIZES` and a `size` prop do not exist. If the description wraps, keep 400.
33
+ - Footer order, left to right: Cancel, then confirm. The confirm button is always rightmost.
34
+ - Confirm buttons use the default `variant='primary'`. Every other footer button is `variant='ghost' color='neutral'`.
35
+ - **Never** use `color='destructive'` for an action that grants access or creates something.
36
+ - Wrap Cancel in `DialogClose asChild`. **Never** wrap the confirm button in `DialogClose`: it closes the dialog before the request runs.
37
+ - **Never** add a close button to `DialogHeader`. It renders the close X itself.
38
+ - There is no `onConfirm`, `onCancel`, `confirmLabel`, `destructive` or `loading` prop on `Dialog`, no `DialogAction`/`DialogCancel`, and no initial-focus prop.
39
+
40
+ ### Spacing
41
+
42
+ - The parts own all padding (header `pt-20 pb-16 px-24`, body `px-24 py-8`, footer `px-24 py-16 gap-8`). Keep the body's 8px though Figma draws the input flush.
43
+ - **Never** add `p-*`, `gap-*` or `space-y-*` around dialog content, wrap footer buttons in a `div`/`HStack`, or pass `size` to them (default 36px).
44
+ - **Never** pass `className` to `DialogHeader`, `DialogBody` or `DialogFooter`. They take only `children` and `ref`.
45
+
46
+ ### Behavior
47
+
48
+ - While the request runs, pass `loading={pending}` to confirm (it also disables it; do not add `disabled={pending}`) and ignore close requests. Close only on success; on failure keep it open with an error toast.
49
+ - If the dialog closes, reset the type-to-confirm input to `''`. Match the entity name exactly, case-sensitive.
50
+ - If the dialog opens from a `Drawer`, render it inside `DrawerContent`. See [Layering](../foundations/layering.md).
51
+ - To guard unsaved changes, intercept `onOpenChange(false)` on the `Drawer`. One handler covers the close X, `Escape` and outside click.
52
+ - **Never** open a confirmation from a toast or from another confirmation.
53
+ - Use one controlled `open` state per dialog, set by the control that starts the action.
54
+
55
+ ### Copy
56
+
57
+ | Part | Write | Not |
58
+ | --- | --- | --- |
59
+ | Title | "Delete user?" / bulk "Delete 3 users?" | "Are you sure?", "Warning", "Delete", "Delete selected?" |
60
+ | Title, unsaved changes | "Unsaved changes" | "Discard changes?" |
61
+ | Description | "This permanently deletes {name} and all their access. You can't undo this." | "This action cannot be undone." with no object named |
62
+ | Description, bulk | "This permanently deletes 3 users and all their access. You can't undo this." | Naming only the first user |
63
+ | Description, reversible | "{name} loses access until you reactivate them. Their roles and data are kept." | Hiding what is kept |
64
+ | Confirm | "Delete user" / bulk "Delete 3 users" | "OK", "Yes", "Confirm", "Delete", "Delete all" |
65
+ | Cancel | "Cancel" | "No", "Close", "Back" |
66
+ | Footer, unsaved changes | "Keep editing", "Leave without saving" (both ghost neutral), "Save changes" (brand) | "Cancel" |
67
+ | Type-to-confirm placeholder | `Enter "{name}" to confirm` | "Type here" |
68
+ | Toast | "User deleted" / "3 users deleted" | "Success!", "User was deleted successfully." |
69
+
70
+ - Title is `<Verb> <object>?` in sentence case. Confirm repeats that verb and noun without `?`.
71
+ - Name the specific object in the description, and end with what can be undone or what is kept. If nothing can be undone, write "You can't undo this."
72
+ - If Figma's confirm label differs from the title ("Delete rule?" / "Delete permission"), use the title's noun.
73
+
74
+ ## Examples
75
+
76
+ A delete confirmation with pending, success and failure handling.
77
+
78
+ Opened from a row's actions menu, which sets the selected user and the dialog's own `open`
79
+ state. While the request runs, `Escape` and outside clicks are ignored; on success the row is
80
+ removed.
81
+
82
+ ```tsx story=Default
83
+ import { useState } from 'react';
84
+ import { Badge } from '@wallarm-org/design-system/Badge';
85
+ import { Button } from '@wallarm-org/design-system/Button';
86
+ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
87
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
88
+ import { Ellipsis } from '@wallarm-org/design-system/icons';
89
+ import { Page, PageContent, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
90
+ import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
91
+ import { useToast } from '@wallarm-org/design-system/Toast';
92
+
93
+ export const Default = () => {
94
+ const toast = useToast();
95
+ const [users, setUsers] = useState(USERS);
96
+ const [selected, setSelected] = useState<User | null>(null);
97
+ const [deleteOpen, setDeleteOpen] = useState(false);
98
+ const [pending, setPending] = useState(false);
99
+
100
+ const renderStatus = ({ row }: TableCellContext<User, unknown>) =>
101
+ row.original.status === 'active' ? (
102
+ <Badge variant='dotted' type='secondary' color='green'>
103
+ Active
104
+ </Badge>
105
+ ) : (
106
+ <Badge variant='dotted' type='secondary' color='gray'>
107
+ Deactivated
108
+ </Badge>
109
+ );
110
+
111
+ const renderActions = ({ row }: TableCellContext<User, unknown>) => {
112
+ const user = row.original;
113
+ const handleDeleteSelect = () => {
114
+ setSelected(user);
115
+ setDeleteOpen(true);
116
+ };
117
+
118
+ return (
119
+ <DropdownMenu>
120
+ <DropdownMenuTrigger asChild>
121
+ <Button
122
+ variant='ghost'
123
+ color='neutral'
124
+ size='small'
125
+ aria-label={`Actions for ${user.name}`}
126
+ data-testid='users-actions'
127
+ >
128
+ <Ellipsis />
129
+ </Button>
130
+ </DropdownMenuTrigger>
131
+ <DropdownMenuContent>
132
+ <DropdownMenuItem
133
+ variant='destructive'
134
+ onSelect={handleDeleteSelect}
135
+ data-testid='users-delete'
136
+ >
137
+ <DropdownMenuItemText>Delete user</DropdownMenuItemText>
138
+ </DropdownMenuItem>
139
+ </DropdownMenuContent>
140
+ </DropdownMenu>
141
+ );
142
+ };
143
+
144
+ const columns: TableColumnDef<User>[] = [
145
+ { accessorKey: 'name', header: 'Name', size: 220 },
146
+ { accessorKey: 'email', header: 'Email', size: 280 },
147
+ { accessorKey: 'role', header: 'Role', size: 180 },
148
+ { accessorKey: 'status', header: 'Status', size: 140, cell: renderStatus },
149
+ {
150
+ id: 'actions',
151
+ header: '',
152
+ size: 60,
153
+ minSize: 60,
154
+ enableHiding: false,
155
+ cell: renderActions,
156
+ },
157
+ ];
158
+
159
+ const handleDeleteOpenChange = (next: boolean) => {
160
+ if (!pending) setDeleteOpen(next);
161
+ };
162
+
163
+ const handleDelete = async () => {
164
+ if (!selected) return;
165
+ setPending(true);
166
+ try {
167
+ await deleteUser(selected.id);
168
+ setUsers(prev => prev.filter(user => user.id !== selected.id));
169
+ setDeleteOpen(false);
170
+ toast.create({ title: 'User deleted', type: 'default' });
171
+ } catch {
172
+ toast.create({ title: "Couldn't delete user", type: 'error' });
173
+ } finally {
174
+ setPending(false);
175
+ }
176
+ };
177
+
178
+ return (
179
+ <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
180
+ <PageHeader>
181
+ <PageHeaderGroup>
182
+ <PageTitle>Users</PageTitle>
183
+ <PageDescription>
184
+ People who can sign in to your organization, with access set by roles and groups.
185
+ </PageDescription>
186
+ </PageHeaderGroup>
187
+ </PageHeader>
188
+
189
+ <PageContent>
190
+ <Table
191
+ aria-label='Users'
192
+ data={users}
193
+ columns={columns}
194
+ getRowId={getUserId}
195
+ data-testid='users-table'
196
+ />
197
+ </PageContent>
198
+
199
+ <Dialog
200
+ width={400}
201
+ open={deleteOpen}
202
+ onOpenChange={handleDeleteOpenChange}
203
+ data-testid='delete-user-dialog'
204
+ >
205
+ <DialogContent>
206
+ <DialogHeader>
207
+ <DialogTitle>Delete user?</DialogTitle>
208
+ <DialogDescription>
209
+ This permanently deletes {selected?.name} and all their access. You can't undo this.
210
+ </DialogDescription>
211
+ </DialogHeader>
212
+ <DialogFooter>
213
+ <DialogClose asChild>
214
+ <Button variant='ghost' color='neutral' data-testid='delete-user-cancel'>
215
+ Cancel
216
+ </Button>
217
+ </DialogClose>
218
+ <Button
219
+ color='destructive'
220
+ loading={pending}
221
+ onClick={handleDelete}
222
+ data-testid='delete-user-confirm'
223
+ >
224
+ Delete user
225
+ </Button>
226
+ </DialogFooter>
227
+ </DialogContent>
228
+ </Dialog>
229
+ </Page>
230
+ );
231
+ };
232
+ ```
233
+
234
+ A state change that grants access uses the default brand confirm.
235
+
236
+ The description says what the user gets back. Once active, the same button deactivates: that
237
+ dialog uses a destructive confirm and says the roles and data are kept.
238
+
239
+ ```tsx story=Activate
240
+ import { useState } from 'react';
241
+ import { Button } from '@wallarm-org/design-system/Button';
242
+ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
243
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
244
+ import { useToast } from '@wallarm-org/design-system/Toast';
245
+
246
+ export const Activate = () => {
247
+ const toast = useToast();
248
+ const [status, setStatus] = useState(INACTIVE_USER.status);
249
+ const [open, setOpen] = useState(false);
250
+ const [pending, setPending] = useState(false);
251
+
252
+ const isActive = status === 'active';
253
+
254
+ const handleOpen = () => setOpen(true);
255
+
256
+ const handleOpenChange = (next: boolean) => {
257
+ if (!pending) setOpen(next);
258
+ };
259
+
260
+ const handleStatusChange = async () => {
261
+ const nextStatus: UserStatus = isActive ? 'deactivated' : 'active';
262
+ setPending(true);
263
+ try {
264
+ await setUserStatus(INACTIVE_USER.id, nextStatus);
265
+ setStatus(nextStatus);
266
+ setOpen(false);
267
+ toast.create({ title: isActive ? 'User deactivated' : 'User activated', type: 'default' });
268
+ } catch {
269
+ toast.create({ title: "Couldn't update user", type: 'error' });
270
+ } finally {
271
+ setPending(false);
272
+ }
273
+ };
274
+
275
+ return (
276
+ <Page name='settings-user' fullSize fixedHeight data-testid='user-page'>
277
+ <PageHeader>
278
+ <PageHeaderGroup className='flex-1'>
279
+ <PageTitle>{INACTIVE_USER.name}</PageTitle>
280
+ <PageDescription>
281
+ {INACTIVE_USER.email} · {INACTIVE_USER.role}
282
+ </PageDescription>
283
+ </PageHeaderGroup>
284
+ <PageActions>
285
+ <Button
286
+ size='medium'
287
+ variant='outline'
288
+ color='neutral'
289
+ onClick={handleOpen}
290
+ data-testid='user-change-status'
291
+ >
292
+ {isActive ? 'Deactivate user' : 'Activate user'}
293
+ </Button>
294
+ </PageActions>
295
+ </PageHeader>
296
+
297
+ <Dialog
298
+ width={400}
299
+ open={open}
300
+ onOpenChange={handleOpenChange}
301
+ data-testid='user-status-dialog'
302
+ >
303
+ <DialogContent>
304
+ <DialogHeader>
305
+ <DialogTitle>{isActive ? 'Deactivate user?' : 'Activate user?'}</DialogTitle>
306
+ <DialogDescription>
307
+ {isActive
308
+ ? `${INACTIVE_USER.name} loses access until you reactivate them. Their roles and data are kept.`
309
+ : `${INACTIVE_USER.name} can sign in again with the roles they had before.`}
310
+ </DialogDescription>
311
+ </DialogHeader>
312
+ <DialogFooter>
313
+ <DialogClose asChild>
314
+ <Button variant='ghost' color='neutral'>
315
+ Cancel
316
+ </Button>
317
+ </DialogClose>
318
+ <Button
319
+ color={isActive ? 'destructive' : 'brand'}
320
+ loading={pending}
321
+ onClick={handleStatusChange}
322
+ data-testid='user-status-confirm'
323
+ >
324
+ {isActive ? 'Deactivate user' : 'Activate user'}
325
+ </Button>
326
+ </DialogFooter>
327
+ </DialogContent>
328
+ </Dialog>
329
+ </Page>
330
+ );
331
+ };
332
+ ```
333
+
334
+ Type-to-confirm omits `width` and keeps confirm disabled until the name matches.
335
+
336
+ For a delete that also breaks linked objects. The match is exact and case-sensitive, and
337
+ closing the dialog resets the input to `''`.
338
+
339
+ ```tsx story=TypeToConfirm
340
+ import { type ChangeEvent, useState } from 'react';
341
+ import { Button } from '@wallarm-org/design-system/Button';
342
+ import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
343
+ import { Input } from '@wallarm-org/design-system/Input';
344
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
345
+ import { useToast } from '@wallarm-org/design-system/Toast';
346
+
347
+ export const TypeToConfirm = () => {
348
+ const toast = useToast();
349
+ const [open, setOpen] = useState(false);
350
+ const [value, setValue] = useState('');
351
+ const [pending, setPending] = useState(false);
352
+
353
+ const handleOpen = () => setOpen(true);
354
+
355
+ const handleOpenChange = (next: boolean) => {
356
+ if (pending) return;
357
+ setOpen(next);
358
+ if (!next) setValue('');
359
+ };
360
+
361
+ const handleValueChange = (event: ChangeEvent<HTMLInputElement>) => {
362
+ setValue(event.target.value);
363
+ };
364
+
365
+ const handleDelete = async () => {
366
+ setPending(true);
367
+ try {
368
+ await deleteProvider(PROVIDER_NAME);
369
+ setOpen(false);
370
+ setValue('');
371
+ toast.create({ title: 'Identity provider deleted', type: 'default' });
372
+ } catch {
373
+ toast.create({ title: "Couldn't delete identity provider", type: 'error' });
374
+ } finally {
375
+ setPending(false);
376
+ }
377
+ };
378
+
379
+ return (
380
+ <Page name='settings-sso-provider' fullSize fixedHeight data-testid='provider-page'>
381
+ <PageHeader>
382
+ <PageHeaderGroup className='flex-1'>
383
+ <PageTitle>{PROVIDER_NAME}</PageTitle>
384
+ <PageDescription>SAML identity provider for single sign-on.</PageDescription>
385
+ </PageHeaderGroup>
386
+ <PageActions>
387
+ <Button
388
+ size='medium'
389
+ variant='outline'
390
+ color='destructive'
391
+ onClick={handleOpen}
392
+ data-testid='provider-delete'
393
+ >
394
+ Delete identity provider
395
+ </Button>
396
+ </PageActions>
397
+ </PageHeader>
398
+
399
+ <Dialog open={open} onOpenChange={handleOpenChange} data-testid='delete-provider-dialog'>
400
+ <DialogContent>
401
+ <DialogHeader>
402
+ <DialogTitle>Delete identity provider?</DialogTitle>
403
+ <DialogDescription>
404
+ "{PROVIDER_NAME}" is unlinked and deleted, along with its rules. You can't undo this.
405
+ </DialogDescription>
406
+ </DialogHeader>
407
+ <DialogBody>
408
+ <Input
409
+ aria-label='Provider name'
410
+ placeholder={`Enter "${PROVIDER_NAME}" to confirm`}
411
+ value={value}
412
+ onChange={handleValueChange}
413
+ data-testid='delete-provider-input'
414
+ />
415
+ </DialogBody>
416
+ <DialogFooter>
417
+ <DialogClose asChild>
418
+ <Button variant='ghost' color='neutral'>
419
+ Cancel
420
+ </Button>
421
+ </DialogClose>
422
+ <Button
423
+ color='destructive'
424
+ disabled={value !== PROVIDER_NAME}
425
+ loading={pending}
426
+ onClick={handleDelete}
427
+ data-testid='delete-provider-confirm'
428
+ >
429
+ Delete identity provider
430
+ </Button>
431
+ </DialogFooter>
432
+ </DialogContent>
433
+ </Dialog>
434
+ </Page>
435
+ );
436
+ };
437
+ ```
438
+
439
+ An unsaved-changes guard intercepts the drawer's close and renders the dialog inside `DrawerContent`.
440
+
441
+ While the form is dirty, the close X, Cancel, `Escape` and an outside click all open the same
442
+ dialog. "Keep editing" returns to the form; "Leave without saving" drops the edits.
443
+
444
+ ```tsx story=UnsavedChanges
445
+ import { type ChangeEvent, useState } from 'react';
446
+ import { Button } from '@wallarm-org/design-system/Button';
447
+ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@wallarm-org/design-system/Dialog';
448
+ import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle } from '@wallarm-org/design-system/Drawer';
449
+ import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
450
+ import { Input } from '@wallarm-org/design-system/Input';
451
+ import { Page, PageActions, PageDescription, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
452
+ import { useToast } from '@wallarm-org/design-system/Toast';
453
+
454
+ export const UnsavedChanges = () => {
455
+ const toast = useToast();
456
+ const [open, setOpen] = useState(false);
457
+ const [guardOpen, setGuardOpen] = useState(false);
458
+ const [savedName, setSavedName] = useState(PROVIDER_NAME);
459
+ const [name, setName] = useState(PROVIDER_NAME);
460
+ const [saving, setSaving] = useState(false);
461
+
462
+ const isDirty = name !== savedName;
463
+
464
+ const handleOpen = () => setOpen(true);
465
+
466
+ const handleDrawerOpenChange = (next: boolean) => {
467
+ if (saving) return;
468
+ if (!next && isDirty) {
469
+ setGuardOpen(true);
470
+ return;
471
+ }
472
+ setOpen(next);
473
+ };
474
+
475
+ const handleGuardOpenChange = (next: boolean) => {
476
+ if (!saving) setGuardOpen(next);
477
+ };
478
+
479
+ const handleNameChange = (event: ChangeEvent<HTMLInputElement>) => {
480
+ setName(event.target.value);
481
+ };
482
+
483
+ const handleLeave = () => {
484
+ setName(savedName);
485
+ setGuardOpen(false);
486
+ setOpen(false);
487
+ };
488
+
489
+ const handleSave = async () => {
490
+ setSaving(true);
491
+ try {
492
+ await saveProvider({ name });
493
+ setSavedName(name);
494
+ setGuardOpen(false);
495
+ setOpen(false);
496
+ toast.create({ title: 'Identity provider updated', type: 'default' });
497
+ } catch {
498
+ toast.create({ title: "Couldn't update identity provider", type: 'error' });
499
+ } finally {
500
+ setSaving(false);
501
+ }
502
+ };
503
+
504
+ return (
505
+ <Page name='settings-sso-provider' fullSize fixedHeight data-testid='provider-page'>
506
+ <PageHeader>
507
+ <PageHeaderGroup className='flex-1'>
508
+ <PageTitle>{savedName}</PageTitle>
509
+ <PageDescription>SAML identity provider for single sign-on.</PageDescription>
510
+ </PageHeaderGroup>
511
+ <PageActions>
512
+ <Button size='medium' onClick={handleOpen} data-testid='provider-edit'>
513
+ Edit identity provider
514
+ </Button>
515
+ </PageActions>
516
+ </PageHeader>
517
+
518
+ <Drawer open={open} onOpenChange={handleDrawerOpenChange} data-testid='edit-provider-drawer'>
519
+ <DrawerContent>
520
+ <DrawerHeader>
521
+ <DrawerTitle>Edit identity provider</DrawerTitle>
522
+ </DrawerHeader>
523
+ <DrawerBody>
524
+ <Field>
525
+ <FieldLabel>Display name</FieldLabel>
526
+ <Input value={name} onChange={handleNameChange} data-testid='provider-name' />
527
+ </Field>
528
+ </DrawerBody>
529
+ <DrawerFooter>
530
+ <DrawerClose asChild>
531
+ <Button variant='ghost' color='neutral'>
532
+ Cancel
533
+ </Button>
534
+ </DrawerClose>
535
+ <Button disabled={!isDirty} loading={saving} onClick={handleSave}>
536
+ Save changes
537
+ </Button>
538
+ </DrawerFooter>
539
+
540
+ <Dialog
541
+ open={guardOpen}
542
+ onOpenChange={handleGuardOpenChange}
543
+ data-testid='unsaved-changes-dialog'
544
+ >
545
+ <DialogContent>
546
+ <DialogHeader>
547
+ <DialogTitle>Unsaved changes</DialogTitle>
548
+ <DialogDescription>
549
+ You have unsaved changes. Leaving will lose them unless you save.
550
+ </DialogDescription>
551
+ </DialogHeader>
552
+ <DialogFooter>
553
+ <DialogClose asChild>
554
+ <Button variant='ghost' color='neutral' data-testid='unsaved-changes-keep'>
555
+ Keep editing
556
+ </Button>
557
+ </DialogClose>
558
+ <Button
559
+ variant='ghost'
560
+ color='neutral'
561
+ onClick={handleLeave}
562
+ data-testid='unsaved-changes-leave'
563
+ >
564
+ Leave without saving
565
+ </Button>
566
+ <Button loading={saving} onClick={handleSave}>
567
+ Save changes
568
+ </Button>
569
+ </DialogFooter>
570
+ </DialogContent>
571
+ </Dialog>
572
+ </DrawerContent>
573
+ </Drawer>
574
+ </Page>
575
+ );
576
+ };
577
+ ```
578
+
579
+ ## States
580
+
581
+ | State | Show | Example component |
582
+ | --- | --- | --- |
583
+ | Idle | Question, consequence, Cancel and confirm enabled | `Dialog` |
584
+ | Type-to-confirm, empty or wrong | Confirm disabled | `Button disabled={value !== name}` |
585
+ | Type-to-confirm, matches | Confirm enabled | `Button` |
586
+ | Pending | Spinner on confirm, dialog stays open, close ignored | `Button loading={pending}` |
587
+ | Success | Dialog closes, then a toast | `toast.create({ type: 'default' })` |
588
+ | Failure | Dialog stays open, error toast, confirm enabled again | `toast.create({ type: 'error' })` |
589
+
590
+ ## What your app owns
591
+
592
+ - The request, `pending` state, error handling and blocking close while pending.
593
+ - Type-to-confirm matching and resetting the input on close.
594
+ - Dirty tracking (your form library's flag) and intercepting the drawer close.
595
+ - Route changes and tab close from a dirty form: use your router's blocker and `beforeunload`. The design system does not handle them.
596
+ - Result toasts: `useToast` from `@wallarm-org/design-system/Toast`, with one `Toaster` at the app root.
597
+ - All copy, including entity names.
598
+
599
+ ## Related
600
+
601
+ - [Action-result toasts](feedback-toasts.md): the toast after a confirmed action.
602
+ - [Entity detail drawer](detail-drawer.md): opens delete and state-change dialogs from its Actions menu.
603
+ - [Create and edit forms](create-edit-forms.md): forms that need the unsaved-changes guard.
604
+ - [Layering](../foundations/layering.md): nesting a `Dialog` inside a `Drawer`.
605
+ - [Spacing](../foundations/spacing.md) and [Typography](../foundations/typography.md): the dialog's built-in padding and text styles.