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

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 +2 -4
  2. package/dist/components/BulkBar/index.d.ts +0 -5
  3. package/dist/components/Drawer/classes.js +1 -1
  4. package/dist/components/DropdownMenu/DropdownMenu.d.ts +2 -0
  5. package/dist/components/DropdownMenu/DropdownMenu.js +84 -71
  6. package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
  7. package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
  8. package/dist/components/Overlay/Overlay.js +1 -1
  9. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +14 -0
  10. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +209 -0
  11. package/dist/components/Rules/PointSelector/MatchStep.d.ts +15 -0
  12. package/dist/components/Rules/PointSelector/MatchStep.js +186 -0
  13. package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +16 -0
  14. package/dist/components/Rules/PointSelector/MenuFooterHints.js +177 -0
  15. package/dist/components/Rules/PointSelector/PointPreview.d.ts +10 -0
  16. package/dist/components/Rules/PointSelector/PointPreview.js +88 -0
  17. package/dist/components/Rules/PointSelector/PointSelector.d.ts +17 -0
  18. package/dist/components/Rules/PointSelector/PointSelector.js +937 -0
  19. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +12 -0
  20. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +173 -0
  21. package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +31 -0
  22. package/dist/components/Rules/PointSelector/PointSelectorError.js +275 -0
  23. package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +20 -0
  24. package/dist/components/Rules/PointSelector/PointSelectorInput.js +130 -0
  25. package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +31 -0
  26. package/dist/components/Rules/PointSelector/PointSelectorMenu.js +317 -0
  27. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +8 -0
  28. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +73 -0
  29. package/dist/components/Rules/PointSelector/SampleRequest.d.ts +14 -0
  30. package/dist/components/Rules/PointSelector/SampleRequest.js +116 -0
  31. package/dist/components/Rules/PointSelector/StepMenu.d.ts +40 -0
  32. package/dist/components/Rules/PointSelector/StepMenu.js +210 -0
  33. package/dist/components/Rules/PointSelector/VersionWarning.d.ts +26 -0
  34. package/dist/components/Rules/PointSelector/VersionWarning.js +231 -0
  35. package/dist/components/Rules/PointSelector/WhereBar.d.ts +48 -0
  36. package/dist/components/Rules/PointSelector/WhereBar.js +263 -0
  37. package/dist/components/Rules/PointSelector/classes.d.ts +28 -0
  38. package/dist/components/Rules/PointSelector/classes.js +22 -0
  39. package/dist/components/Rules/PointSelector/index.d.ts +20 -0
  40. package/dist/components/Rules/PointSelector/index.js +18 -0
  41. package/dist/components/Rules/PointSelector/liftLayer.d.ts +8 -0
  42. package/dist/components/Rules/PointSelector/liftLayer.js +4 -0
  43. package/dist/components/Rules/PointSelector/sampleValue.d.ts +6 -0
  44. package/dist/components/Rules/PointSelector/sampleValue.js +51 -0
  45. package/dist/components/Rules/PointSelector/sdkBridge.d.ts +508 -0
  46. package/dist/components/Rules/PointSelector/sdkBridge.js +339 -0
  47. package/dist/components/Rules/PointSelector/types.d.ts +304 -0
  48. package/dist/components/Rules/PointSelector/types.js +0 -0
  49. package/dist/components/Rules/PointSelector/usePointSelector.d.ts +161 -0
  50. package/dist/components/Rules/PointSelector/usePointSelector.js +1088 -0
  51. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +28 -0
  52. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +208 -0
  53. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +23 -0
  54. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +950 -0
  55. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +21 -0
  56. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +110 -0
  57. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +20 -0
  58. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +31 -0
  59. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +23 -0
  60. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +131 -0
  61. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +17 -0
  62. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +14 -0
  63. package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +6 -0
  64. package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +6 -0
  65. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +24 -0
  66. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +245 -0
  67. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +15 -0
  68. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +691 -0
  69. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +19 -0
  70. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +72 -0
  71. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +27 -0
  72. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +407 -0
  73. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +14 -0
  74. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +269 -0
  75. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +25 -0
  76. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +99 -0
  77. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +14 -0
  78. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +118 -0
  79. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +14 -0
  80. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +446 -0
  81. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +14 -0
  82. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +266 -0
  83. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +35 -0
  84. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +57 -0
  85. package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +15 -0
  86. package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +10 -0
  87. package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +67 -0
  88. package/dist/components/Rules/RuleBuilder/RuleBuilder.js +366 -0
  89. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +32 -0
  90. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +420 -0
  91. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +27 -0
  92. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +446 -0
  93. package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +7 -0
  94. package/dist/components/Rules/RuleBuilder/Summary/index.js +2 -0
  95. package/dist/components/Rules/RuleBuilder/classes.d.ts +19 -0
  96. package/dist/components/Rules/RuleBuilder/classes.js +18 -0
  97. package/dist/components/Rules/RuleBuilder/index.d.ts +55 -0
  98. package/dist/components/Rules/RuleBuilder/index.js +11 -0
  99. package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +31 -0
  100. package/dist/components/Rules/RuleBuilder/models/actionModel.js +276 -0
  101. package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +95 -0
  102. package/dist/components/Rules/RuleBuilder/models/conditionModel.js +418 -0
  103. package/dist/components/Rules/RuleBuilder/models/index.d.ts +3 -0
  104. package/dist/components/Rules/RuleBuilder/models/index.js +3 -0
  105. package/dist/components/Rules/RuleBuilder/models/validation.d.ts +176 -0
  106. package/dist/components/Rules/RuleBuilder/models/validation.js +242 -0
  107. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +27 -0
  108. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +92 -0
  109. package/dist/components/Rules/RuleBuilder/shared/index.d.ts +1 -0
  110. package/dist/components/Rules/RuleBuilder/shared/index.js +1 -0
  111. package/dist/components/Rules/RuleBuilder/types.d.ts +384 -0
  112. package/dist/components/Rules/RuleBuilder/types.js +0 -0
  113. package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +65 -0
  114. package/dist/components/Rules/RuleBuilder/utils/constants.js +356 -0
  115. package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +48 -0
  116. package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +42 -0
  117. package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +92 -0
  118. package/dist/components/Rules/RuleBuilder/utils/helpers.js +54 -0
  119. package/dist/components/Rules/RuleBuilder/utils/index.d.ts +2 -0
  120. package/dist/components/Rules/RuleBuilder/utils/index.js +2 -0
  121. package/dist/components/SearchInput/SearchInput.d.ts +5 -7
  122. package/dist/components/SearchInput/SearchInput.js +101 -119
  123. package/dist/components/Select/SelectSearchInput.d.ts +1 -1
  124. package/dist/components/Table/types.d.ts +1 -1
  125. package/dist/components/Tabs/Tabs.d.ts +0 -1
  126. package/dist/components/Tabs/Tabs.js +28 -30
  127. package/dist/components/Tabs/TabsList/index.d.ts +1 -1
  128. package/dist/components/Tabs/index.d.ts +2 -2
  129. package/dist/components/Tour/TourPositioner.d.ts +0 -3
  130. package/dist/components/Tour/TourPositioner.js +4 -4
  131. package/dist/index.d.ts +3 -2
  132. package/dist/index.js +2 -1
  133. package/dist/metadata/components.json +9077 -12300
  134. package/dist/theme/typography.css +0 -5
  135. package/dist/utils/formatDateTime.d.ts +0 -6
  136. package/dist/utils/formatDateTime.js +1 -13
  137. package/package.json +4 -6
  138. package/dist/components/NotificationCenter/NotificationCenter.d.ts +0 -20
  139. package/dist/components/NotificationCenter/NotificationCenter.js +0 -65
  140. package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +0 -18
  141. package/dist/components/NotificationCenter/NotificationCenterBody.js +0 -202
  142. package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +0 -5
  143. package/dist/components/NotificationCenter/NotificationCenterContent.js +0 -42
  144. package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +0 -20
  145. package/dist/components/NotificationCenter/NotificationCenterHeader.js +0 -202
  146. package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +0 -26
  147. package/dist/components/NotificationCenter/NotificationCenterItem.js +0 -211
  148. package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +0 -9
  149. package/dist/components/NotificationCenter/NotificationCenterItemTime.js +0 -148
  150. package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +0 -14
  151. package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +0 -115
  152. package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +0 -10
  153. package/dist/components/NotificationCenter/NotificationCenterTabs.js +0 -77
  154. package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +0 -13
  155. package/dist/components/NotificationCenter/NotificationCenterTrigger.js +0 -138
  156. package/dist/components/NotificationCenter/index.d.ts +0 -9
  157. package/dist/components/NotificationCenter/index.js +0 -9
  158. package/dist/guidelines/foundations/color.md +0 -157
  159. package/dist/guidelines/foundations/focus.md +0 -122
  160. package/dist/guidelines/foundations/layering.md +0 -131
  161. package/dist/guidelines/foundations/radius-elevation.md +0 -111
  162. package/dist/guidelines/foundations/spacing.md +0 -117
  163. package/dist/guidelines/foundations/typography.md +0 -114
  164. package/dist/guidelines/patterns/app-layout.md +0 -1567
  165. package/dist/guidelines/patterns/auth-page.md +0 -668
  166. package/dist/guidelines/patterns/confirmation-dialogs.md +0 -605
  167. package/dist/guidelines/patterns/create-edit-forms.md +0 -768
  168. package/dist/guidelines/patterns/detail-drawer.md +0 -868
  169. package/dist/guidelines/patterns/empty-states.md +0 -461
  170. package/dist/guidelines/patterns/entity-table.md +0 -533
  171. package/dist/guidelines/patterns/feedback-toasts.md +0 -493
  172. package/dist/guidelines/patterns/filtering.md +0 -630
  173. package/dist/guidelines/patterns/resource-list-page.md +0 -558
  174. package/dist/guidelines/patterns/settings-page.md +0 -752
  175. package/dist/guidelines/rules.md +0 -25
  176. package/dist/metadata/guidelines.json +0 -1705
@@ -1,533 +0,0 @@
1
- ---
2
- title: Entity table
3
- description: Use when you render a list of users, roles, providers, channels or policies as a Table, with status badges, tags, a row menu and bulk actions.
4
- components: [Table, TableActionBar, TableActionBarSelection, TableEmptyState, Badge, Tag, OverflowList, Avatar, AvatarContent, AvatarName, AvatarDescription, Code, FormatDateTime, DropdownMenu, DropdownMenuItem, Button, Tooltip, Switch, EmptyState]
5
- keywords: [table, data table, grid, list, rows, columns, entity list, users table, cell, status badge, tags, +N, overflow, row menu, row actions, kebab, ellipsis, three dots, bulk actions, bulk bar, selection, checkbox, sort, empty value, em dash, column description, reorder]
6
- order: 20
7
- ---
8
-
9
- # Entity table
10
-
11
- One `Table` with a fixed cell vocabulary, a trailing row menu and a bulk bar.
12
-
13
- ## When to use
14
-
15
- | Need | Use | Not |
16
- | --- | --- | --- |
17
- | A list of entities on a page | `Table` inside `PageContent` | A `div` grid, a `Card` per row |
18
- | A list in a drawer or dialog | The same `Table` inside `DrawerBody` or `DialogBody` (from `@wallarm-org/design-system/Dialog`) | A custom bordered list |
19
- | Actions on one row | A trailing `actions` column with a `DropdownMenu` | Buttons repeated in every row |
20
- | Actions on many rows | `onRowSelectionChange` plus `TableActionBar` | Your own floating bar |
21
- | Details of one entity | `Attribute` in a drawer | A two-column `Table` |
22
- | Kanban, preference matrix | Product code | This pattern |
23
-
24
- Use only these cells.
25
-
26
- | Data | Cell | Not |
27
- | --- | --- | --- |
28
- | Person | `Avatar size='md'` with `AvatarName` | `img` plus `span` |
29
- | Second line | `AvatarDescription` | Two `Text` lines |
30
- | Status | `Badge variant='dotted' type='secondary' color=…` | Colored text, a raw dot |
31
- | Locked row | `Badge` with `Lock` in a `Tooltip` | A bare lock icon |
32
- | Groups, roles | `OverflowList` of `Tag` | Joined text, custom "+N" |
33
- | ID, key, hash | `Code size='m'` | A monospace `span` |
34
- | Recent time | `FormatDateTime format='relative'` | `toLocaleString()` |
35
- | Exact time | `FormatDateTime format='datetime'` | Two cells |
36
- | Count, metric | The raw number | `meta.align` |
37
- | On/off setting | `Switch` with `SwitchControl` | `Checkbox` |
38
- | Missing value | `'—'` (em dash) | `0`, `N/A`, an empty cell |
39
-
40
- ## Rules
41
-
42
- **Layout and spacing**
43
-
44
- - The first column is pinned and never hideable: put the entity name there.
45
- - `Table` owns its frame, borders, padding and header. **Never** wrap it in a bordered `div` or restyle cells via `meta.cellClassName`.
46
- - `PageContent`, `DrawerBody` and `DialogBody` own the gutter. **Never** add `p-24` or any padding around `Table`.
47
- - Set widths with `size`: name `320`, email `240`, status `140`, timestamp `200`, actions `60` plus `minSize: 60` (the default minimum is 96px).
48
- - If columns must keep their `size`, pass `stretch={false}`.
49
- - Two-line cell: add a `Text size='xs' color='secondary'` line; there is no `rowHeight`.
50
-
51
- **Row menu**
52
-
53
- - If rows have actions, add the trailing display column shown below (an `id`, no `accessorKey`, `enableHiding: false`).
54
- - **Never** use `meta.renderMenuAction` for entity actions: its menu shows only on hover. There is no `actions` column type, `alwaysShowMenu` or `TableRow`.
55
- - Trigger: `Button variant='ghost' color='neutral' size='small'`, `Ellipsis` icon, `aria-label` naming the row.
56
- - Order items: open, edit, reorder, state changes, `DropdownMenuSeparator`, destructive.
57
- - Use `variant='destructive'` and name the entity: "Delete user", not "Delete". Confirm before deleting.
58
- - Inherited or read-only row: only view and "Open at {scope}".
59
-
60
- **Data and selection**
61
-
62
- - Always pass `getRowId={row => row.id}`; selection, `activeRowId` and reordering key on it.
63
- - For selection, pass `rowSelection` and `onRowSelectionChange`; without the handler there are no checkboxes.
64
- - Sorting: `sorting` and `onSortingChange`, plus `manualSorting` if the server sorts.
65
- - Bulk actions: `Button variant='ghost' color='neutral-alt'` in `TableActionBar`; destructive last with `color='destructive'`; options go in a `DropdownMenu`.
66
- - Custom selection text: `TableActionBarSelection` (from `@wallarm-org/design-system/Table`) with `BulkBarSummaryCount`, `BulkBarSummarySelectAll`, `BulkBarSummaryClear` as direct children.
67
- - Drag to reorder: `onRowReorder`; pin rows with `getRowCanDrag`.
68
-
69
- **Values**
70
-
71
- - Status `color`: Active, Enabled, Connected `green`; Invited, Pending, Needs attention `yellow`; Expired, Failed, Error `red`; Deactivated, Disabled, Draft `gray`. `Badge` has no `status` prop.
72
- - **Never** show `0` for missing data; show `'—'`. `FormatDateTime` renders `—` for `null` itself.
73
- - **Never** set `meta.align` on numbers; they align right on their own. If the first row can be `null` or `'—'`, set `meta: { sortType: 'number' }`.
74
- - Header explanation: `meta.description: { type: 'tooltip', content }`; `type: 'text'` keeps it visible.
75
- - Import `OverflowList` from `@wallarm-org/design-system/OverflowList`; pass it a stable `items` array (`row.original.groups`). There is no `maxItems`.
76
- - Tests: pass `data-testid` to `Table`; **never** select by `data-slot`.
77
-
78
- ## Examples
79
-
80
- The whole table: the cell vocabulary, an always-visible row menu, sorting and a bulk bar for selected rows.
81
-
82
- Adds an ID in `Code` and an exact time to the `Cells` vocabulary. Sort by any header; select
83
- rows to bring up the bulk bar.
84
-
85
- ```tsx story=Default
86
- import { useState } from 'react';
87
- import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
88
- import { Badge } from '@wallarm-org/design-system/Badge';
89
- import { Button } from '@wallarm-org/design-system/Button';
90
- import { Code } from '@wallarm-org/design-system/Code';
91
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
92
- import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
93
- import { Ellipsis, Trash2 } from '@wallarm-org/design-system/icons';
94
- import { OverflowList } from '@wallarm-org/design-system/OverflowList';
95
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
96
- import { type TableCellContext, type TableColumnDef, type TableRowSelectionState, type TableSortingState, Table, TableActionBar } from '@wallarm-org/design-system/Table';
97
- import { Tag } from '@wallarm-org/design-system/Tag';
98
-
99
- export const Default = () => {
100
- const [sorting, setSorting] = useState<TableSortingState>([]);
101
- const [selection, setSelection] = useState<TableRowSelectionState>({});
102
-
103
- const STATUS = {
104
- active: { label: 'Active', color: 'green' },
105
- invited: { label: 'Invited', color: 'yellow' },
106
- expired: { label: 'Expired', color: 'red' },
107
- deactivated: { label: 'Deactivated', color: 'gray' },
108
- } as const;
109
-
110
- const renderGroup = (group: string) => <Tag key={group}>{group}</Tag>;
111
-
112
- const renderUser = ({ row }: TableCellContext<User, unknown>) => (
113
- <Avatar size='md'>
114
- <AvatarFallback name={row.original.name} />
115
- <AvatarContent>
116
- <AvatarName>{row.original.name}</AvatarName>
117
- <AvatarDescription>{row.original.email}</AvatarDescription>
118
- </AvatarContent>
119
- </Avatar>
120
- );
121
-
122
- const renderId = ({ row }: TableCellContext<User, unknown>) => (
123
- <Code size='m'>{row.original.id}</Code>
124
- );
125
-
126
- const renderGroups = ({ row }: TableCellContext<User, unknown>) =>
127
- row.original.groups.length > 0 ? (
128
- <OverflowList className='gap-4' items={row.original.groups} itemRenderer={renderGroup} />
129
- ) : (
130
- '—'
131
- );
132
-
133
- const renderStatus = ({ row }: TableCellContext<User, unknown>) => (
134
- <Badge variant='dotted' type='secondary' color={STATUS[row.original.status].color}>
135
- {STATUS[row.original.status].label}
136
- </Badge>
137
- );
138
-
139
- const renderLastSignIn = ({ row }: TableCellContext<User, unknown>) => (
140
- <FormatDateTime value={row.original.lastSignIn} format='datetime' />
141
- );
142
-
143
- const renderRequests = ({ row }: TableCellContext<User, unknown>) => row.original.requests ?? '—';
144
-
145
- const renderActions = ({ row }: TableCellContext<User, unknown>) => {
146
- const user = row.original;
147
- const handleEdit = () => onEditUser(user);
148
- const handleResend = () => onResendInvite(user);
149
- const handleDeactivate = () => onDeactivateUser(user);
150
- const handleDelete = () => onDeleteUser(user);
151
-
152
- return (
153
- <DropdownMenu data-testid='users-row-menu'>
154
- <DropdownMenuTrigger asChild>
155
- <Button
156
- variant='ghost'
157
- color='neutral'
158
- size='small'
159
- aria-label={`Actions for ${user.name}`}
160
- >
161
- <Ellipsis />
162
- </Button>
163
- </DropdownMenuTrigger>
164
- <DropdownMenuContent>
165
- <DropdownMenuItem onSelect={handleEdit}>
166
- <DropdownMenuItemText>Edit</DropdownMenuItemText>
167
- </DropdownMenuItem>
168
- {user.status === 'invited' && (
169
- <DropdownMenuItem onSelect={handleResend}>
170
- <DropdownMenuItemText>Resend invite</DropdownMenuItemText>
171
- </DropdownMenuItem>
172
- )}
173
- <DropdownMenuItem onSelect={handleDeactivate}>
174
- <DropdownMenuItemText>Deactivate</DropdownMenuItemText>
175
- </DropdownMenuItem>
176
- <DropdownMenuSeparator />
177
- <DropdownMenuItem variant='destructive' onSelect={handleDelete}>
178
- <DropdownMenuItemText>Delete user</DropdownMenuItemText>
179
- </DropdownMenuItem>
180
- </DropdownMenuContent>
181
- </DropdownMenu>
182
- );
183
- };
184
-
185
- const columns: TableColumnDef<User>[] = [
186
- { accessorKey: 'name', header: 'Name', size: 320, cell: renderUser },
187
- { accessorKey: 'id', header: 'User ID', size: 160, cell: renderId },
188
- {
189
- accessorKey: 'groups',
190
- header: 'Groups',
191
- size: 240,
192
- enableSorting: false,
193
- cell: renderGroups,
194
- },
195
- { accessorKey: 'status', header: 'Status', size: 140, cell: renderStatus },
196
- { accessorKey: 'lastSignIn', header: 'Last sign-in', size: 200, cell: renderLastSignIn },
197
- {
198
- accessorKey: 'requests',
199
- header: 'API requests',
200
- size: 140,
201
- meta: { sortType: 'number', description: { type: 'tooltip', content: 'Last 24 hours' } },
202
- cell: renderRequests,
203
- },
204
- {
205
- id: 'actions',
206
- header: '',
207
- size: 60,
208
- minSize: 60,
209
- enableHiding: false,
210
- cell: renderActions,
211
- },
212
- ];
213
-
214
- const handleAssignGroup = () => onAssignGroup(Object.keys(selection));
215
- const handleBulkDelete = () => onBulkDelete(Object.keys(selection));
216
-
217
- return (
218
- <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
219
- <PageContent>
220
- <Table
221
- aria-label='Users'
222
- data={USERS}
223
- columns={columns}
224
- getRowId={getUserId}
225
- sorting={sorting}
226
- onSortingChange={setSorting}
227
- rowSelection={selection}
228
- onRowSelectionChange={setSelection}
229
- data-testid='users-table'
230
- >
231
- <TableActionBar>
232
- <Button variant='ghost' color='neutral-alt' onClick={handleAssignGroup}>
233
- Assign group
234
- </Button>
235
- <Button color='destructive' onClick={handleBulkDelete} data-testid='users-bulk-delete'>
236
- <Trash2 /> Delete
237
- </Button>
238
- </TableActionBar>
239
- </Table>
240
- </PageContent>
241
- </Page>
242
- );
243
- };
244
- ```
245
-
246
- A person with a second line, a status badge, groups as tags, and a number whose header explains it.
247
-
248
- Tags collapse into "+N" when the column runs out of room; a user with no groups or no requests
249
- shows `—`.
250
-
251
- ```tsx story=Cells
252
- import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
253
- import { Badge } from '@wallarm-org/design-system/Badge';
254
- import { OverflowList } from '@wallarm-org/design-system/OverflowList';
255
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
256
- import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
257
- import { Tag } from '@wallarm-org/design-system/Tag';
258
-
259
- export const Cells = () => {
260
- const STATUS = {
261
- active: { label: 'Active', color: 'green' },
262
- invited: { label: 'Invited', color: 'yellow' },
263
- expired: { label: 'Expired', color: 'red' },
264
- deactivated: { label: 'Deactivated', color: 'gray' },
265
- } as const;
266
-
267
- const renderGroup = (group: string) => <Tag key={group}>{group}</Tag>;
268
-
269
- const renderUser = ({ row }: TableCellContext<User, unknown>) => (
270
- <Avatar size='md'>
271
- <AvatarFallback name={row.original.name} />
272
- <AvatarContent>
273
- <AvatarName>{row.original.name}</AvatarName>
274
- <AvatarDescription>{row.original.email}</AvatarDescription>
275
- </AvatarContent>
276
- </Avatar>
277
- );
278
-
279
- const renderStatus = ({ row }: TableCellContext<User, unknown>) => (
280
- <Badge variant='dotted' type='secondary' color={STATUS[row.original.status].color}>
281
- {STATUS[row.original.status].label}
282
- </Badge>
283
- );
284
-
285
- const renderGroups = ({ row }: TableCellContext<User, unknown>) =>
286
- row.original.groups.length > 0 ? (
287
- <OverflowList className='gap-4' items={row.original.groups} itemRenderer={renderGroup} />
288
- ) : (
289
- '—'
290
- );
291
-
292
- const renderRequests = ({ row }: TableCellContext<User, unknown>) => row.original.requests ?? '—';
293
-
294
- const columns: TableColumnDef<User>[] = [
295
- { accessorKey: 'name', header: 'Name', size: 320, cell: renderUser },
296
- { accessorKey: 'status', header: 'Status', size: 140, cell: renderStatus },
297
- {
298
- accessorKey: 'groups',
299
- header: 'Groups',
300
- size: 240,
301
- enableSorting: false,
302
- cell: renderGroups,
303
- },
304
- {
305
- accessorKey: 'requests',
306
- header: 'API requests',
307
- size: 140,
308
- meta: { sortType: 'number', description: { type: 'tooltip', content: 'Last 24 hours' } },
309
- cell: renderRequests,
310
- },
311
- ];
312
-
313
- return (
314
- <Page name='settings-users' data-testid='users-page'>
315
- <PageContent>
316
- <Table
317
- aria-label='Users'
318
- data={USERS}
319
- columns={columns}
320
- getRowId={getUserId}
321
- data-testid='users-table'
322
- />
323
- </PageContent>
324
- </Page>
325
- );
326
- };
327
- ```
328
-
329
- The row menu: the trigger names the row, and the destructive item comes last and names the entity.
330
-
331
- The column has an `id` and no `accessorKey`, and can't be hidden, so the menu never disappears
332
- behind the column settings.
333
-
334
- ```tsx story=RowMenu
335
- import { Avatar, AvatarContent, AvatarDescription, AvatarFallback, AvatarName } from '@wallarm-org/design-system/Avatar';
336
- import { Button } from '@wallarm-org/design-system/Button';
337
- import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
338
- import { Ellipsis } from '@wallarm-org/design-system/icons';
339
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
340
- import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
341
-
342
- export const RowMenu = () => {
343
- const renderUser = ({ row }: TableCellContext<User, unknown>) => (
344
- <Avatar size='md'>
345
- <AvatarFallback name={row.original.name} />
346
- <AvatarContent>
347
- <AvatarName>{row.original.name}</AvatarName>
348
- <AvatarDescription>{row.original.email}</AvatarDescription>
349
- </AvatarContent>
350
- </Avatar>
351
- );
352
-
353
- const renderActions = ({ row }: TableCellContext<User, unknown>) => {
354
- const user = row.original;
355
- const handleEdit = () => onEditUser(user);
356
- const handleDeactivate = () => onDeactivateUser(user);
357
- const handleDelete = () => onDeleteUser(user);
358
-
359
- return (
360
- <DropdownMenu data-testid='users-row-menu'>
361
- <DropdownMenuTrigger asChild>
362
- <Button
363
- variant='ghost'
364
- color='neutral'
365
- size='small'
366
- aria-label={`Actions for ${user.name}`}
367
- >
368
- <Ellipsis />
369
- </Button>
370
- </DropdownMenuTrigger>
371
- <DropdownMenuContent>
372
- <DropdownMenuItem onSelect={handleEdit}>
373
- <DropdownMenuItemText>Edit</DropdownMenuItemText>
374
- </DropdownMenuItem>
375
- <DropdownMenuItem onSelect={handleDeactivate}>
376
- <DropdownMenuItemText>Deactivate</DropdownMenuItemText>
377
- </DropdownMenuItem>
378
- <DropdownMenuSeparator />
379
- <DropdownMenuItem variant='destructive' onSelect={handleDelete}>
380
- <DropdownMenuItemText>Delete user</DropdownMenuItemText>
381
- </DropdownMenuItem>
382
- </DropdownMenuContent>
383
- </DropdownMenu>
384
- );
385
- };
386
-
387
- const columns: TableColumnDef<User>[] = [
388
- { accessorKey: 'name', header: 'Name', size: 320, cell: renderUser },
389
- {
390
- id: 'actions',
391
- header: '',
392
- size: 60,
393
- minSize: 60,
394
- enableHiding: false,
395
- cell: renderActions,
396
- },
397
- ];
398
-
399
- return (
400
- <Page name='settings-users' data-testid='users-page'>
401
- <PageContent>
402
- <Table
403
- aria-label='Users'
404
- data={USERS}
405
- columns={columns}
406
- getRowId={getUserId}
407
- data-testid='users-table'
408
- />
409
- </PageContent>
410
- </Page>
411
- );
412
- };
413
- ```
414
-
415
- First load keeps the header and fills the body with placeholder rows.
416
-
417
- `isLoading` draws the skeleton rows, not a `Loader`; `skeletonCount` sets how many (12 by
418
- default).
419
-
420
- ```tsx story=Loading
421
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
422
- import { type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
423
-
424
- export const Loading = () => {
425
- const columns: TableColumnDef<User>[] = [
426
- { accessorKey: 'name', header: 'Name', size: 320 },
427
- { accessorKey: 'id', header: 'User ID', size: 160 },
428
- { accessorKey: 'groups', header: 'Groups', size: 240 },
429
- { accessorKey: 'status', header: 'Status', size: 140 },
430
- { accessorKey: 'lastSignIn', header: 'Last sign-in', size: 200 },
431
- ];
432
-
433
- return (
434
- <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
435
- <PageContent>
436
- <Table
437
- aria-label='Users'
438
- data={[]}
439
- columns={columns}
440
- getRowId={getUserId}
441
- isLoading
442
- skeletonCount={6}
443
- data-testid='users-table'
444
- />
445
- </PageContent>
446
- </Page>
447
- );
448
- };
449
- ```
450
-
451
- Nothing created yet: an empty state under the header.
452
-
453
- `EmptyState type='collection-empty'` inside `TableEmptyState`. It has no button when the page
454
- header already has Create.
455
-
456
- ```tsx story=Empty
457
- import { EmptyState, EmptyStateDescription, EmptyStateIllustration, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
458
- import { UserPlus } from '@wallarm-org/design-system/icons';
459
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
460
- import { type TableColumnDef, Table, TableEmptyState } from '@wallarm-org/design-system/Table';
461
-
462
- export const Empty = () => {
463
- const columns: TableColumnDef<User>[] = [
464
- { accessorKey: 'name', header: 'Name', size: 320 },
465
- { accessorKey: 'id', header: 'User ID', size: 160 },
466
- { accessorKey: 'groups', header: 'Groups', size: 240 },
467
- { accessorKey: 'status', header: 'Status', size: 140 },
468
- { accessorKey: 'lastSignIn', header: 'Last sign-in', size: 200 },
469
- ];
470
-
471
- return (
472
- <Page name='settings-users' fullSize fixedHeight data-testid='users-page'>
473
- <PageContent>
474
- <Table
475
- aria-label='Users'
476
- data={[]}
477
- columns={columns}
478
- getRowId={getUserId}
479
- data-testid='users-table'
480
- >
481
- <TableEmptyState>
482
- <EmptyState type='collection-empty' data-testid='users-empty-state'>
483
- <EmptyStateIllustration>
484
- <UserPlus />
485
- </EmptyStateIllustration>
486
- <EmptyStateMessage>
487
- <EmptyStateTitle>No users yet</EmptyStateTitle>
488
- <EmptyStateDescription>
489
- Invite people to sign in to your organization.
490
- </EmptyStateDescription>
491
- </EmptyStateMessage>
492
- </EmptyState>
493
- </TableEmptyState>
494
- </Table>
495
- </PageContent>
496
- </Page>
497
- );
498
- };
499
- ```
500
-
501
- ## States
502
-
503
- | State | Show | Example component |
504
- | --- | --- | --- |
505
- | First load | `isLoading` (12 skeleton rows; `skeletonCount`), not a `Loader` | `Table` |
506
- | Nothing created | `EmptyState type='collection-empty'`; no button if `PageActions` has Create; keep header and toolbar | `TableEmptyState` |
507
- | No matches | `type='collection-empty'`, "No results found", `Button variant='outline' color='neutral'` "Reset filters"; not `type='no-results'` | `TableEmptyState` |
508
- | Rows selected | The bar appears on its own | `TableActionBar` |
509
- | Row open in a drawer | `activeRowId={openId}`; not a row `className` | `Table` |
510
- | Switch saving | Keep the `Switch`, `Loader` in a reserved slot beside it | `Switch`, `Loader` |
511
- | Locked by scope | Disabled control, `Lock` with a `Tooltip` naming the scope; never hide the row | `Tooltip` |
512
-
513
- ## What your app owns
514
-
515
- | You own | The DS owns |
516
- | --- | --- |
517
- | `columns`, order, widths | Cell padding, borders, header, hover and selected backgrounds |
518
- | Status-to-`color` mapping and labels | `Badge` dot, size and colors |
519
- | Row menu items and handlers | Menu focus and keyboard |
520
- | Fetching, filtering, server sorting, pagination | Client sorting |
521
- | Which bulk actions exist | Bar placement, "Select all", "Clear" |
522
- | Delete confirmation | Nothing; compose `Dialog` |
523
- | Scope marker | Nothing; compose `Badge variant='dotted'` with `Lock` |
524
- | Metric cell (% over "x of y") | Nothing; compose `FormatNumber` and `Text size='xs'` |
525
- | Grouped or orderable tables | `getSubRows`, `renderGroupRow`, `onRowReorder` |
526
-
527
- ## Related
528
-
529
- - [Resource list page](./resource-list-page.md): the page shell.
530
- - [Detail drawer](./detail-drawer.md): opens from a row.
531
- - [Confirmation dialogs](./confirmation-dialogs.md): confirm deletes.
532
- - [Feedback toasts](./feedback-toasts.md): report results.
533
- - [Empty states](./empty-states.md), [Filtering](./filtering.md), [Spacing](../foundations/spacing.md).