@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.
- package/README.md +4 -2
- package/dist/components/BulkBar/index.d.ts +5 -0
- package/dist/components/Drawer/classes.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.d.ts +20 -0
- package/dist/components/NotificationCenter/NotificationCenter.js +65 -0
- package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +18 -0
- package/dist/components/NotificationCenter/NotificationCenterBody.js +202 -0
- package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +5 -0
- package/dist/components/NotificationCenter/NotificationCenterContent.js +42 -0
- package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +20 -0
- package/dist/components/NotificationCenter/NotificationCenterHeader.js +202 -0
- package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +26 -0
- package/dist/components/NotificationCenter/NotificationCenterItem.js +211 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +9 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTime.js +148 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +14 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +115 -0
- package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +10 -0
- package/dist/components/NotificationCenter/NotificationCenterTabs.js +77 -0
- package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +13 -0
- package/dist/components/NotificationCenter/NotificationCenterTrigger.js +138 -0
- package/dist/components/NotificationCenter/index.d.ts +9 -0
- package/dist/components/NotificationCenter/index.js +9 -0
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +7 -5
- package/dist/components/SearchInput/SearchInput.js +119 -101
- package/dist/components/Select/SelectSearchInput.d.ts +1 -1
- package/dist/components/Table/types.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Tabs/Tabs.js +30 -28
- package/dist/components/Tabs/TabsList/index.d.ts +1 -1
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Tour/TourPositioner.d.ts +3 -0
- package/dist/components/Tour/TourPositioner.js +4 -4
- package/dist/guidelines/foundations/color.md +157 -0
- package/dist/guidelines/foundations/focus.md +122 -0
- package/dist/guidelines/foundations/layering.md +131 -0
- package/dist/guidelines/foundations/radius-elevation.md +111 -0
- package/dist/guidelines/foundations/spacing.md +117 -0
- package/dist/guidelines/foundations/typography.md +114 -0
- package/dist/guidelines/patterns/app-layout.md +1567 -0
- package/dist/guidelines/patterns/auth-page.md +668 -0
- package/dist/guidelines/patterns/confirmation-dialogs.md +605 -0
- package/dist/guidelines/patterns/create-edit-forms.md +768 -0
- package/dist/guidelines/patterns/detail-drawer.md +868 -0
- package/dist/guidelines/patterns/empty-states.md +461 -0
- package/dist/guidelines/patterns/entity-table.md +533 -0
- package/dist/guidelines/patterns/feedback-toasts.md +493 -0
- package/dist/guidelines/patterns/filtering.md +630 -0
- package/dist/guidelines/patterns/resource-list-page.md +558 -0
- package/dist/guidelines/patterns/settings-page.md +752 -0
- package/dist/guidelines/rules.md +25 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/metadata/components.json +12431 -9208
- package/dist/metadata/guidelines.json +1705 -0
- package/dist/theme/typography.css +5 -0
- package/dist/utils/formatDateTime.d.ts +6 -0
- package/dist/utils/formatDateTime.js +13 -1
- package/package.json +6 -4
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
- package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
- package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
- package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
- package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
- package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
- package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
- package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
- package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
- package/dist/components/Rules/PointSelector/classes.js +0 -22
- package/dist/components/Rules/PointSelector/index.d.ts +0 -20
- package/dist/components/Rules/PointSelector/index.js +0 -18
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
- package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
- package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
- package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
- package/dist/components/Rules/PointSelector/types.d.ts +0 -304
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
- package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
- package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
- package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/classes.js +0 -18
- package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
- package/dist/components/Rules/RuleBuilder/index.js +0 -11
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
- package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
- package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
- package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
- package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
- package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
- package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
|
@@ -0,0 +1,868 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Detail drawer
|
|
3
|
+
description: Use when a row click opens a read-only view of one entity in a side panel, with key-value attributes, sections, tabs and a nested table.
|
|
4
|
+
components: [Drawer, DrawerContent, DrawerHeader, DrawerTitle, DrawerBody, DrawerResizeHandle, Attribute, AttributeLabel, AttributeValue, Heading, Separator, HStack, VStack, Tabs, TabsList, TabsTrigger, TabsContent, TabsLineActions, NumericBadge, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, Button, InlineCodeSnippet, Tag, FormatDateTime, Table, EmptyState, EmptyStateMessage, EmptyStateTitle, Alert, AlertContent, AlertTitle, AlertControls, Tooltip, Dialog]
|
|
5
|
+
keywords: [drawer, detail view, details panel, side panel, side sheet, preview, inspector, entity details, read-only view, attributes, key value, properties, label value, actions menu, header actions, tabs in drawer, nested table, drawer width, 700, resize, row click, master cell]
|
|
6
|
+
order: 50
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Detail drawer
|
|
10
|
+
|
|
11
|
+
A detail drawer is a `Drawer` with no footer. It shows one entity as `Attribute` rows, titled sections and an optional nested `Table`.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
| Need | Use | Not |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| Read-only details of one row | This pattern, opened from `Table` `onMasterCellClick` | A new page, a `Dialog` |
|
|
18
|
+
| Edit several fields | A separate edit drawer or dialog. See [Create and edit forms](./create-edit-forms.md) | Inputs inside the detail drawer |
|
|
19
|
+
| Edit one field in place | `InlineEdit` inside `AttributeValue` | A form in the drawer |
|
|
20
|
+
| Actions on the entity | One "Actions" `DropdownMenu` in `DrawerHeader` | Several header buttons, a footer |
|
|
21
|
+
| Related collections (roles, rules, members) | `Tabs` with `NumericBadge` counts, one `Table` per tab | Stacked tables with no tabs |
|
|
22
|
+
| A few titled groups of attributes | `Heading` sections split by `Separator` | `Accordion`, a `Card` per group |
|
|
23
|
+
| Confirm a destructive action | A `Dialog` inside `DrawerContent`. See [Confirmation dialogs](./confirmation-dialogs.md) | `window.confirm` |
|
|
24
|
+
| Keep the list usable while open | `modal={false} overlay={false} closeOnOutsideClick={false}` | Default props |
|
|
25
|
+
|
|
26
|
+
## Rules
|
|
27
|
+
|
|
28
|
+
**Drawer**
|
|
29
|
+
|
|
30
|
+
- Mount one controlled `Drawer` (`open`, `onOpenChange`) for the list. **Never** one per row.
|
|
31
|
+
- Open it from the list `Table` `onMasterCellClick`; mark the row with `activeRowId`. Row-menu clicks do not open it.
|
|
32
|
+
- Keep the last entity in state after close so content does not blank.
|
|
33
|
+
- Pass `width={640}`. Use 700 (the Figma frame) only if design confirms it. `width` is read once on mount.
|
|
34
|
+
- If resizable, put `DrawerResizeHandle` first in `DrawerContent` (400–1130px).
|
|
35
|
+
- **Never** add a `DrawerFooter` or your own close button.
|
|
36
|
+
- In tests, pass `data-testid` to `Drawer`. **Never** select by `data-slot`.
|
|
37
|
+
|
|
38
|
+
**Header actions**
|
|
39
|
+
|
|
40
|
+
- One `DropdownMenu` in `DrawerHeader`, trigger `Button variant='outline' color='neutral' size='small'` "Actions" + `ChevronDown`.
|
|
41
|
+
- Order: edit, state changes, "Go to …" links, `DropdownMenuSeparator`, destructive items.
|
|
42
|
+
- Destructive items use `variant='destructive'` and name the entity: "Delete provider".
|
|
43
|
+
- Keep the built-in 12px before the close X, though Figma shows 4px.
|
|
44
|
+
|
|
45
|
+
**Spacing**
|
|
46
|
+
|
|
47
|
+
- `DrawerBody` owns the 24px gutter. **Never** pad inside it or pass `className` to `DrawerHeader`/`DrawerBody`.
|
|
48
|
+
- Attribute rows: `VStack gap={6} className='pb-8'`. Sections: `Separator spacing={4}`.
|
|
49
|
+
- Section header: `HStack justify='between' align='center' className='py-8'`, `Heading as='h3' size='md' weight='medium'`, optional `Button size='small'`.
|
|
50
|
+
- Full-width tabs: `<div className='-mx-24'>` around `TabsList`, not its `className`. Table 16px from the edge: `<div className='-mx-8'>` around `Table`, never on it. No other negative margins.
|
|
51
|
+
|
|
52
|
+
**Attributes**
|
|
53
|
+
|
|
54
|
+
- Always pass `orientation='horizontal'`; the default is vertical.
|
|
55
|
+
- One `AttributeLabel` `width` per drawer: 140 matches Figma; up to 256 for long labels. **Never** wrap a label.
|
|
56
|
+
- Two columns: `grid grid-cols-2 gap-x-8 gap-y-6`, default label width.
|
|
57
|
+
- Section help: an `Info` icon in a `Tooltip` after the heading.
|
|
58
|
+
|
|
59
|
+
| Data | Value | Not |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| Plain text | The string as the `AttributeValue` child | A `Text` with your own size |
|
|
62
|
+
| ID, URL, claim, scope, path | `InlineCodeSnippet code={value} size='md'` | `Code`, a monospace `span` |
|
|
63
|
+
| Several codes | Several `InlineCodeSnippet` in `HStack gap={4}` | One joined string |
|
|
64
|
+
| Role, tag, label | `Tag` | `Badge`, plain text |
|
|
65
|
+
| Timestamp | `FormatDateTime format='datetime' layout='inline'` | `toLocaleString()` |
|
|
66
|
+
| Secret | "Set — never shown" | Dots, a masked input |
|
|
67
|
+
| Missing value | `Attribute isEmpty` | `N/A`, `0`, your own dash |
|
|
68
|
+
| Icon with text | `HStack gap={6} align='center'` | An `img` with your own margin |
|
|
69
|
+
|
|
70
|
+
`InlineCodeSnippet` copies on click; `copyable={false}` turns that off.
|
|
71
|
+
|
|
72
|
+
**Tabs and tables**
|
|
73
|
+
|
|
74
|
+
- Keep `Tabs` in `DrawerBody` to scroll with the attributes. Pinned tabs: `Tabs asChild` around `DrawerHeader`, `TabsList`, `DrawerBody` (`Drawer` `WithTabs` story); attributes then go in each `TabsContent`.
|
|
75
|
+
- Tab action: `Button size='small'` in `TabsLineActions`.
|
|
76
|
+
- Nested tables follow [Entity table](./entity-table.md). **Never** use `TableActionBar` in a drawer: it renders underneath.
|
|
77
|
+
|
|
78
|
+
**Does not exist:** `DRAWER_SIZES`, a `size` prop on `Drawer`, `DrawerActions`, `DrawerHeaderActions`, `AttributeGroup`, `AttributeList`, `DescriptionList`, a section component, `fullBleed` on `TabsList` or `Table`.
|
|
79
|
+
|
|
80
|
+
## Examples
|
|
81
|
+
|
|
82
|
+
The list opens one shared drawer from the master cell.
|
|
83
|
+
|
|
84
|
+
Click a provider name: one shared, non-modal drawer opens and the row stays marked. The header
|
|
85
|
+
has a single "Actions" menu; the body has horizontal attributes (a code value, a secret, a
|
|
86
|
+
timestamp), then full-width tabs with counts, each with an inset nested table. Google Workspace
|
|
87
|
+
has no rules, so its table keeps the headers and shows a short empty state.
|
|
88
|
+
|
|
89
|
+
```tsx story=Default
|
|
90
|
+
import { useState } from 'react';
|
|
91
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
92
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
93
|
+
import { InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
94
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerResizeHandle, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
95
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
96
|
+
import { EmptyState, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
97
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
98
|
+
import { ChevronDown, Plus } from '@wallarm-org/design-system/icons';
|
|
99
|
+
import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
|
|
100
|
+
import { Page, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
|
|
101
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
102
|
+
import { VStack } from '@wallarm-org/design-system/Stack';
|
|
103
|
+
import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
|
|
104
|
+
import { Tabs, TabsContent, TabsLineActions, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
105
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
106
|
+
|
|
107
|
+
export const Default = () => {
|
|
108
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
109
|
+
const [open, setOpen] = useState(false);
|
|
110
|
+
const [tab, setTab] = useState('rules');
|
|
111
|
+
|
|
112
|
+
const provider = PROVIDERS.find(item => item.id === selectedId) ?? null;
|
|
113
|
+
|
|
114
|
+
const renderClaim = ({ row }: TableCellContext<RoleRule, unknown>) => (
|
|
115
|
+
<InlineCodeSnippet code={`${row.original.claim} = ${row.original.value}`} size='md' />
|
|
116
|
+
);
|
|
117
|
+
const renderRole = ({ row }: TableCellContext<RoleRule, unknown>) => (
|
|
118
|
+
<Tag>{row.original.role}</Tag>
|
|
119
|
+
);
|
|
120
|
+
const renderVerifiedAt = ({ row }: TableCellContext<Domain, unknown>) => (
|
|
121
|
+
<FormatDateTime value={row.original.verifiedAt} format='date' />
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const columns: TableColumnDef<Provider>[] = [
|
|
125
|
+
{ accessorKey: 'name', header: 'Name', size: 260 },
|
|
126
|
+
{ accessorKey: 'protocol', header: 'Protocol', size: 180 },
|
|
127
|
+
{ accessorKey: 'issuer', header: 'Issuer', size: 360 },
|
|
128
|
+
];
|
|
129
|
+
const ruleColumns: TableColumnDef<RoleRule>[] = [
|
|
130
|
+
{ id: 'claim', header: 'Claim', size: 300, cell: renderClaim },
|
|
131
|
+
{ accessorKey: 'role', header: 'Role', size: 200, cell: renderRole },
|
|
132
|
+
];
|
|
133
|
+
const domainColumns: TableColumnDef<Domain>[] = [
|
|
134
|
+
{ accessorKey: 'name', header: 'Domain', size: 300 },
|
|
135
|
+
{ accessorKey: 'verifiedAt', header: 'Verified', size: 200, cell: renderVerifiedAt },
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
const handleMasterCellClick = (id: string) => {
|
|
139
|
+
setSelectedId(id);
|
|
140
|
+
setOpen(true);
|
|
141
|
+
};
|
|
142
|
+
const handleEdit = () => onEditProvider(provider);
|
|
143
|
+
const handleDisable = () => onDisableProvider(provider);
|
|
144
|
+
const handleGoToAuditLog = () => onGoToAuditLog(provider);
|
|
145
|
+
const handleDelete = () => onDeleteProvider(provider);
|
|
146
|
+
const handleCreateRule = () => onCreateRule(provider);
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<Page name='settings-sso' fullSize fixedHeight data-testid='providers-page'>
|
|
150
|
+
<PageHeader>
|
|
151
|
+
<PageHeaderGroup>
|
|
152
|
+
<PageTitle>SSO providers</PageTitle>
|
|
153
|
+
</PageHeaderGroup>
|
|
154
|
+
</PageHeader>
|
|
155
|
+
|
|
156
|
+
<PageContent>
|
|
157
|
+
<Table
|
|
158
|
+
aria-label='SSO providers'
|
|
159
|
+
data={PROVIDERS}
|
|
160
|
+
columns={columns}
|
|
161
|
+
getRowId={getProviderId}
|
|
162
|
+
activeRowId={open ? selectedId : null}
|
|
163
|
+
onMasterCellClick={handleMasterCellClick}
|
|
164
|
+
data-testid='providers-table'
|
|
165
|
+
/>
|
|
166
|
+
</PageContent>
|
|
167
|
+
|
|
168
|
+
<Drawer
|
|
169
|
+
open={open}
|
|
170
|
+
onOpenChange={setOpen}
|
|
171
|
+
modal={false}
|
|
172
|
+
overlay={false}
|
|
173
|
+
closeOnOutsideClick={false}
|
|
174
|
+
width={640}
|
|
175
|
+
data-testid='provider-drawer'
|
|
176
|
+
>
|
|
177
|
+
<DrawerContent>
|
|
178
|
+
<DrawerResizeHandle />
|
|
179
|
+
<DrawerHeader>
|
|
180
|
+
<DrawerTitle>{provider?.name}</DrawerTitle>
|
|
181
|
+
<DropdownMenu data-testid='provider-actions'>
|
|
182
|
+
<DropdownMenuTrigger asChild>
|
|
183
|
+
<Button variant='outline' color='neutral' size='small'>
|
|
184
|
+
Actions <ChevronDown />
|
|
185
|
+
</Button>
|
|
186
|
+
</DropdownMenuTrigger>
|
|
187
|
+
<DropdownMenuContent>
|
|
188
|
+
<DropdownMenuItem onSelect={handleEdit}>
|
|
189
|
+
<DropdownMenuItemText>Edit provider</DropdownMenuItemText>
|
|
190
|
+
</DropdownMenuItem>
|
|
191
|
+
<DropdownMenuItem onSelect={handleDisable}>
|
|
192
|
+
<DropdownMenuItemText>Disable provider</DropdownMenuItemText>
|
|
193
|
+
</DropdownMenuItem>
|
|
194
|
+
<DropdownMenuItem onSelect={handleGoToAuditLog}>
|
|
195
|
+
<DropdownMenuItemText>Go to audit log</DropdownMenuItemText>
|
|
196
|
+
</DropdownMenuItem>
|
|
197
|
+
<DropdownMenuSeparator />
|
|
198
|
+
<DropdownMenuItem variant='destructive' onSelect={handleDelete}>
|
|
199
|
+
<DropdownMenuItemText>Delete provider</DropdownMenuItemText>
|
|
200
|
+
</DropdownMenuItem>
|
|
201
|
+
</DropdownMenuContent>
|
|
202
|
+
</DropdownMenu>
|
|
203
|
+
</DrawerHeader>
|
|
204
|
+
|
|
205
|
+
<DrawerBody>
|
|
206
|
+
{provider && (
|
|
207
|
+
<>
|
|
208
|
+
<VStack gap={6} className='pb-8' data-testid='provider-attributes'>
|
|
209
|
+
<Attribute orientation='horizontal'>
|
|
210
|
+
<AttributeLabel width={140}>Protocol</AttributeLabel>
|
|
211
|
+
<AttributeValue>{provider.protocol}</AttributeValue>
|
|
212
|
+
</Attribute>
|
|
213
|
+
<Attribute orientation='horizontal'>
|
|
214
|
+
<AttributeLabel width={140}>Issuer URL</AttributeLabel>
|
|
215
|
+
<AttributeValue>
|
|
216
|
+
<InlineCodeSnippet code={provider.issuer} size='md' />
|
|
217
|
+
</AttributeValue>
|
|
218
|
+
</Attribute>
|
|
219
|
+
<Attribute orientation='horizontal'>
|
|
220
|
+
<AttributeLabel width={140}>Client ID</AttributeLabel>
|
|
221
|
+
<AttributeValue>
|
|
222
|
+
<InlineCodeSnippet code={provider.clientId} size='md' />
|
|
223
|
+
</AttributeValue>
|
|
224
|
+
</Attribute>
|
|
225
|
+
<Attribute orientation='horizontal'>
|
|
226
|
+
<AttributeLabel width={140}>Client secret</AttributeLabel>
|
|
227
|
+
<AttributeValue>Set — never shown</AttributeValue>
|
|
228
|
+
</Attribute>
|
|
229
|
+
<Attribute orientation='horizontal' isEmpty={!provider.defaultRole}>
|
|
230
|
+
<AttributeLabel width={140}>Default role</AttributeLabel>
|
|
231
|
+
<AttributeValue>
|
|
232
|
+
{provider.defaultRole && <Tag>{provider.defaultRole}</Tag>}
|
|
233
|
+
</AttributeValue>
|
|
234
|
+
</Attribute>
|
|
235
|
+
<Attribute orientation='horizontal'>
|
|
236
|
+
<AttributeLabel width={140}>Created at</AttributeLabel>
|
|
237
|
+
<AttributeValue>
|
|
238
|
+
<FormatDateTime
|
|
239
|
+
value={provider.createdAt}
|
|
240
|
+
format='datetime'
|
|
241
|
+
layout='inline'
|
|
242
|
+
/>
|
|
243
|
+
</AttributeValue>
|
|
244
|
+
</Attribute>
|
|
245
|
+
</VStack>
|
|
246
|
+
|
|
247
|
+
<Separator spacing={4} />
|
|
248
|
+
|
|
249
|
+
<Tabs value={tab} onChange={setTab} data-testid='provider-tabs'>
|
|
250
|
+
<div className='-mx-24'>
|
|
251
|
+
<TabsList>
|
|
252
|
+
<TabsTrigger value='rules'>
|
|
253
|
+
Role rules <NumericBadge>{provider.rules.length}</NumericBadge>
|
|
254
|
+
</TabsTrigger>
|
|
255
|
+
<TabsTrigger value='domains'>
|
|
256
|
+
Domains <NumericBadge>{provider.domains.length}</NumericBadge>
|
|
257
|
+
</TabsTrigger>
|
|
258
|
+
<TabsLineActions>
|
|
259
|
+
<Button size='small' onClick={handleCreateRule}>
|
|
260
|
+
<Plus /> Create rule
|
|
261
|
+
</Button>
|
|
262
|
+
</TabsLineActions>
|
|
263
|
+
</TabsList>
|
|
264
|
+
</div>
|
|
265
|
+
<TabsContent value='rules'>
|
|
266
|
+
<div className='-mx-8 pt-8'>
|
|
267
|
+
<Table
|
|
268
|
+
aria-label='Role rules'
|
|
269
|
+
data={provider.rules}
|
|
270
|
+
columns={ruleColumns}
|
|
271
|
+
getRowId={getItemId}
|
|
272
|
+
data-testid='provider-rules-table'
|
|
273
|
+
>
|
|
274
|
+
{provider.rules.length === 0 && (
|
|
275
|
+
<EmptyState type='collection-empty' data-testid='provider-rules-empty'>
|
|
276
|
+
<EmptyStateMessage>
|
|
277
|
+
<EmptyStateTitle>No role rules yet</EmptyStateTitle>
|
|
278
|
+
</EmptyStateMessage>
|
|
279
|
+
</EmptyState>
|
|
280
|
+
)}
|
|
281
|
+
</Table>
|
|
282
|
+
</div>
|
|
283
|
+
</TabsContent>
|
|
284
|
+
<TabsContent value='domains'>
|
|
285
|
+
<div className='-mx-8 pt-8'>
|
|
286
|
+
<Table
|
|
287
|
+
aria-label='Domains'
|
|
288
|
+
data={provider.domains}
|
|
289
|
+
columns={domainColumns}
|
|
290
|
+
getRowId={getItemId}
|
|
291
|
+
data-testid='provider-domains-table'
|
|
292
|
+
>
|
|
293
|
+
{provider.domains.length === 0 && (
|
|
294
|
+
<EmptyState type='collection-empty'>
|
|
295
|
+
<EmptyStateMessage>
|
|
296
|
+
<EmptyStateTitle>No domains yet</EmptyStateTitle>
|
|
297
|
+
</EmptyStateMessage>
|
|
298
|
+
</EmptyState>
|
|
299
|
+
)}
|
|
300
|
+
</Table>
|
|
301
|
+
</div>
|
|
302
|
+
</TabsContent>
|
|
303
|
+
</Tabs>
|
|
304
|
+
</>
|
|
305
|
+
)}
|
|
306
|
+
</DrawerBody>
|
|
307
|
+
</DrawerContent>
|
|
308
|
+
</Drawer>
|
|
309
|
+
</Page>
|
|
310
|
+
);
|
|
311
|
+
};
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
The drawer shell with a resize handle and the header actions menu.
|
|
315
|
+
|
|
316
|
+
Drag the left edge to resize between 400 and 1130px; `onResizeEnd` gets the final width to
|
|
317
|
+
persist. The close X comes built in, so there is no footer and no close button of your own.
|
|
318
|
+
|
|
319
|
+
```tsx story=Header
|
|
320
|
+
import { useState } from 'react';
|
|
321
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
322
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
323
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerResizeHandle, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
324
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
325
|
+
import { ChevronDown } from '@wallarm-org/design-system/icons';
|
|
326
|
+
import { VStack } from '@wallarm-org/design-system/Stack';
|
|
327
|
+
|
|
328
|
+
export const Header = () => {
|
|
329
|
+
const [open, setOpen] = useState(true);
|
|
330
|
+
|
|
331
|
+
const handleEdit = () => onEditProvider(OKTA);
|
|
332
|
+
const handleDisable = () => onDisableProvider(OKTA);
|
|
333
|
+
const handleGoToAuditLog = () => onGoToAuditLog(OKTA);
|
|
334
|
+
const handleDelete = () => onDeleteProvider(OKTA);
|
|
335
|
+
|
|
336
|
+
return (
|
|
337
|
+
<Drawer open={open} onOpenChange={setOpen} width={640} data-testid='provider-drawer'>
|
|
338
|
+
<DrawerContent>
|
|
339
|
+
<DrawerResizeHandle onResizeEnd={onSaveDrawerWidth} />
|
|
340
|
+
<DrawerHeader>
|
|
341
|
+
<DrawerTitle>{OKTA.name}</DrawerTitle>
|
|
342
|
+
<DropdownMenu data-testid='provider-actions'>
|
|
343
|
+
<DropdownMenuTrigger asChild>
|
|
344
|
+
<Button variant='outline' color='neutral' size='small'>
|
|
345
|
+
Actions <ChevronDown />
|
|
346
|
+
</Button>
|
|
347
|
+
</DropdownMenuTrigger>
|
|
348
|
+
<DropdownMenuContent>
|
|
349
|
+
<DropdownMenuItem onSelect={handleEdit}>
|
|
350
|
+
<DropdownMenuItemText>Edit provider</DropdownMenuItemText>
|
|
351
|
+
</DropdownMenuItem>
|
|
352
|
+
<DropdownMenuItem onSelect={handleDisable}>
|
|
353
|
+
<DropdownMenuItemText>Disable provider</DropdownMenuItemText>
|
|
354
|
+
</DropdownMenuItem>
|
|
355
|
+
<DropdownMenuItem onSelect={handleGoToAuditLog}>
|
|
356
|
+
<DropdownMenuItemText>Go to audit log</DropdownMenuItemText>
|
|
357
|
+
</DropdownMenuItem>
|
|
358
|
+
<DropdownMenuSeparator />
|
|
359
|
+
<DropdownMenuItem variant='destructive' onSelect={handleDelete}>
|
|
360
|
+
<DropdownMenuItemText>Delete provider</DropdownMenuItemText>
|
|
361
|
+
</DropdownMenuItem>
|
|
362
|
+
</DropdownMenuContent>
|
|
363
|
+
</DropdownMenu>
|
|
364
|
+
</DrawerHeader>
|
|
365
|
+
<DrawerBody>
|
|
366
|
+
<VStack gap={6} className='pb-8'>
|
|
367
|
+
<Attribute orientation='horizontal'>
|
|
368
|
+
<AttributeLabel width={140}>Protocol</AttributeLabel>
|
|
369
|
+
<AttributeValue>{OKTA.protocol}</AttributeValue>
|
|
370
|
+
</Attribute>
|
|
371
|
+
</VStack>
|
|
372
|
+
</DrawerBody>
|
|
373
|
+
</DrawerContent>
|
|
374
|
+
</Drawer>
|
|
375
|
+
);
|
|
376
|
+
};
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
Attribute rows with a code value, a secret, a missing value and a timestamp.
|
|
380
|
+
|
|
381
|
+
Every row is horizontal with the same 140px label. Entra ID has no default role, so that row
|
|
382
|
+
stays and shows the empty marker; the codes copy on click.
|
|
383
|
+
|
|
384
|
+
```tsx story=Attributes
|
|
385
|
+
import { useState } from 'react';
|
|
386
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
387
|
+
import { InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
388
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
389
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
390
|
+
import { VStack } from '@wallarm-org/design-system/Stack';
|
|
391
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
392
|
+
|
|
393
|
+
export const Attributes = () => {
|
|
394
|
+
const [open, setOpen] = useState(true);
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<Drawer open={open} onOpenChange={setOpen} width={640} data-testid='provider-drawer'>
|
|
398
|
+
<DrawerContent>
|
|
399
|
+
<DrawerHeader>
|
|
400
|
+
<DrawerTitle>{ENTRA.name}</DrawerTitle>
|
|
401
|
+
</DrawerHeader>
|
|
402
|
+
<DrawerBody>
|
|
403
|
+
<VStack gap={6} className='pb-8' data-testid='provider-attributes'>
|
|
404
|
+
<Attribute orientation='horizontal'>
|
|
405
|
+
<AttributeLabel width={140}>Client ID</AttributeLabel>
|
|
406
|
+
<AttributeValue>
|
|
407
|
+
<InlineCodeSnippet code={ENTRA.clientId} size='md' />
|
|
408
|
+
</AttributeValue>
|
|
409
|
+
</Attribute>
|
|
410
|
+
<Attribute orientation='horizontal'>
|
|
411
|
+
<AttributeLabel width={140}>Client secret</AttributeLabel>
|
|
412
|
+
<AttributeValue>Set — never shown</AttributeValue>
|
|
413
|
+
</Attribute>
|
|
414
|
+
<Attribute orientation='horizontal' isEmpty={!ENTRA.defaultRole}>
|
|
415
|
+
<AttributeLabel width={140}>Default role</AttributeLabel>
|
|
416
|
+
<AttributeValue>{ENTRA.defaultRole && <Tag>{ENTRA.defaultRole}</Tag>}</AttributeValue>
|
|
417
|
+
</Attribute>
|
|
418
|
+
<Attribute orientation='horizontal'>
|
|
419
|
+
<AttributeLabel width={140}>Created at</AttributeLabel>
|
|
420
|
+
<AttributeValue>
|
|
421
|
+
<FormatDateTime value={ENTRA.createdAt} format='datetime' layout='inline' />
|
|
422
|
+
</AttributeValue>
|
|
423
|
+
</Attribute>
|
|
424
|
+
</VStack>
|
|
425
|
+
</DrawerBody>
|
|
426
|
+
</DrawerContent>
|
|
427
|
+
</Drawer>
|
|
428
|
+
);
|
|
429
|
+
};
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
A section with a title and an action.
|
|
433
|
+
|
|
434
|
+
The first group needs no title. Each later group starts with a `Separator` and a header row; the
|
|
435
|
+
action applies to that section only.
|
|
436
|
+
|
|
437
|
+
```tsx story=Section
|
|
438
|
+
import { useState } from 'react';
|
|
439
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
440
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
441
|
+
import { InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
442
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
443
|
+
import { FormatDateTime } from '@wallarm-org/design-system/FormatDateTime';
|
|
444
|
+
import { Heading } from '@wallarm-org/design-system/Heading';
|
|
445
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
446
|
+
import { HStack, VStack } from '@wallarm-org/design-system/Stack';
|
|
447
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
448
|
+
|
|
449
|
+
export const Section = () => {
|
|
450
|
+
const [open, setOpen] = useState(true);
|
|
451
|
+
|
|
452
|
+
const handleEditDefaults = () => onEditProvider(OKTA);
|
|
453
|
+
|
|
454
|
+
return (
|
|
455
|
+
<Drawer open={open} onOpenChange={setOpen} width={640} data-testid='provider-drawer'>
|
|
456
|
+
<DrawerContent>
|
|
457
|
+
<DrawerHeader>
|
|
458
|
+
<DrawerTitle>{OKTA.name}</DrawerTitle>
|
|
459
|
+
</DrawerHeader>
|
|
460
|
+
<DrawerBody>
|
|
461
|
+
<VStack gap={6} className='pb-8'>
|
|
462
|
+
<Attribute orientation='horizontal'>
|
|
463
|
+
<AttributeLabel width={140}>Protocol</AttributeLabel>
|
|
464
|
+
<AttributeValue>{OKTA.protocol}</AttributeValue>
|
|
465
|
+
</Attribute>
|
|
466
|
+
<Attribute orientation='horizontal'>
|
|
467
|
+
<AttributeLabel width={140}>Issuer URL</AttributeLabel>
|
|
468
|
+
<AttributeValue>
|
|
469
|
+
<InlineCodeSnippet code={OKTA.issuer} size='md' />
|
|
470
|
+
</AttributeValue>
|
|
471
|
+
</Attribute>
|
|
472
|
+
</VStack>
|
|
473
|
+
|
|
474
|
+
<Separator spacing={4} />
|
|
475
|
+
|
|
476
|
+
<HStack
|
|
477
|
+
justify='between'
|
|
478
|
+
align='center'
|
|
479
|
+
className='py-8'
|
|
480
|
+
data-testid='provider-defaults-section'
|
|
481
|
+
>
|
|
482
|
+
<Heading as='h3' size='md' weight='medium'>
|
|
483
|
+
Defaults
|
|
484
|
+
</Heading>
|
|
485
|
+
<Button size='small' variant='outline' color='neutral' onClick={handleEditDefaults}>
|
|
486
|
+
Edit defaults
|
|
487
|
+
</Button>
|
|
488
|
+
</HStack>
|
|
489
|
+
<VStack gap={6} className='pb-8'>
|
|
490
|
+
<Attribute orientation='horizontal' isEmpty={!OKTA.defaultRole}>
|
|
491
|
+
<AttributeLabel width={140}>Default role</AttributeLabel>
|
|
492
|
+
<AttributeValue>{OKTA.defaultRole && <Tag>{OKTA.defaultRole}</Tag>}</AttributeValue>
|
|
493
|
+
</Attribute>
|
|
494
|
+
<Attribute orientation='horizontal'>
|
|
495
|
+
<AttributeLabel width={140}>Created at</AttributeLabel>
|
|
496
|
+
<AttributeValue>
|
|
497
|
+
<FormatDateTime value={OKTA.createdAt} format='datetime' layout='inline' />
|
|
498
|
+
</AttributeValue>
|
|
499
|
+
</Attribute>
|
|
500
|
+
</VStack>
|
|
501
|
+
</DrawerBody>
|
|
502
|
+
</DrawerContent>
|
|
503
|
+
</Drawer>
|
|
504
|
+
);
|
|
505
|
+
};
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Full-width tabs with a count and an inset nested table that stays visible when empty.
|
|
509
|
+
|
|
510
|
+
Google Workspace has no rules yet: the table keeps its headers and shows a one-line empty state
|
|
511
|
+
with no action, since "Create rule" already sits on the tab line.
|
|
512
|
+
|
|
513
|
+
```tsx story=NestedTable
|
|
514
|
+
import { useState } from 'react';
|
|
515
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
516
|
+
import { InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
517
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
518
|
+
import { EmptyState, EmptyStateMessage, EmptyStateTitle } from '@wallarm-org/design-system/EmptyState';
|
|
519
|
+
import { Plus } from '@wallarm-org/design-system/icons';
|
|
520
|
+
import { NumericBadge } from '@wallarm-org/design-system/NumericBadge';
|
|
521
|
+
import { type TableCellContext, type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
|
|
522
|
+
import { Tabs, TabsContent, TabsLineActions, TabsList, TabsTrigger } from '@wallarm-org/design-system/Tabs';
|
|
523
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
524
|
+
|
|
525
|
+
export const NestedTable = () => {
|
|
526
|
+
const [open, setOpen] = useState(true);
|
|
527
|
+
const [tab, setTab] = useState('rules');
|
|
528
|
+
|
|
529
|
+
const renderClaim = ({ row }: TableCellContext<RoleRule, unknown>) => (
|
|
530
|
+
<InlineCodeSnippet code={`${row.original.claim} = ${row.original.value}`} size='md' />
|
|
531
|
+
);
|
|
532
|
+
const renderRole = ({ row }: TableCellContext<RoleRule, unknown>) => (
|
|
533
|
+
<Tag>{row.original.role}</Tag>
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
const ruleColumns: TableColumnDef<RoleRule>[] = [
|
|
537
|
+
{ id: 'claim', header: 'Claim', size: 300, cell: renderClaim },
|
|
538
|
+
{ accessorKey: 'role', header: 'Role', size: 200, cell: renderRole },
|
|
539
|
+
];
|
|
540
|
+
|
|
541
|
+
const handleCreateRule = () => onCreateRule(GOOGLE);
|
|
542
|
+
|
|
543
|
+
return (
|
|
544
|
+
<Drawer open={open} onOpenChange={setOpen} width={640} data-testid='provider-drawer'>
|
|
545
|
+
<DrawerContent>
|
|
546
|
+
<DrawerHeader>
|
|
547
|
+
<DrawerTitle>{GOOGLE.name}</DrawerTitle>
|
|
548
|
+
</DrawerHeader>
|
|
549
|
+
<DrawerBody>
|
|
550
|
+
<Tabs value={tab} onChange={setTab} data-testid='provider-tabs'>
|
|
551
|
+
<div className='-mx-24'>
|
|
552
|
+
<TabsList>
|
|
553
|
+
<TabsTrigger value='rules'>
|
|
554
|
+
Role rules <NumericBadge>{GOOGLE.rules.length}</NumericBadge>
|
|
555
|
+
</TabsTrigger>
|
|
556
|
+
<TabsLineActions>
|
|
557
|
+
<Button size='small' onClick={handleCreateRule}>
|
|
558
|
+
<Plus /> Create rule
|
|
559
|
+
</Button>
|
|
560
|
+
</TabsLineActions>
|
|
561
|
+
</TabsList>
|
|
562
|
+
</div>
|
|
563
|
+
<TabsContent value='rules'>
|
|
564
|
+
<div className='-mx-8 pt-8'>
|
|
565
|
+
<Table
|
|
566
|
+
aria-label='Role rules'
|
|
567
|
+
data={GOOGLE.rules}
|
|
568
|
+
columns={ruleColumns}
|
|
569
|
+
getRowId={getItemId}
|
|
570
|
+
data-testid='provider-rules-table'
|
|
571
|
+
>
|
|
572
|
+
{GOOGLE.rules.length === 0 && (
|
|
573
|
+
<EmptyState type='collection-empty' data-testid='provider-rules-empty'>
|
|
574
|
+
<EmptyStateMessage>
|
|
575
|
+
<EmptyStateTitle>No role rules yet</EmptyStateTitle>
|
|
576
|
+
</EmptyStateMessage>
|
|
577
|
+
</EmptyState>
|
|
578
|
+
)}
|
|
579
|
+
</Table>
|
|
580
|
+
</div>
|
|
581
|
+
</TabsContent>
|
|
582
|
+
</Tabs>
|
|
583
|
+
</DrawerBody>
|
|
584
|
+
</DrawerContent>
|
|
585
|
+
</Drawer>
|
|
586
|
+
);
|
|
587
|
+
};
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
## States
|
|
591
|
+
|
|
592
|
+
| State | Show | Example component |
|
|
593
|
+
| --- | --- | --- |
|
|
594
|
+
| Entity loading | `loading` on every `Attribute` (skeleton label is 100 wide whatever `width`). Not a `Loader` over the body | `Attribute` |
|
|
595
|
+
| Nested table loading | `isLoading` with `skeletonCount={3}` | `Table` |
|
|
596
|
+
| Nested collection empty | Keep headers; `type='collection-empty'` as a direct `Table` child when `rows.length === 0 && !isLoading`. Title and description only, no `EmptyStateActions`. Not `TableEmptyState` (too tall) | `EmptyState` |
|
|
597
|
+
| Field has no value | `isEmpty`; never hide the row | `Attribute` |
|
|
598
|
+
| Viewing an old version | `color='info'` first in `DrawerBody`, "Back to current" and "Restore" in `AlertControls`; disable header actions | `Alert` |
|
|
599
|
+
| Row open in the drawer | `activeRowId={selectedId}`; not a row `className` | `Table` |
|
|
600
|
+
| Action running | `loading` on its button, then a toast; keep the drawer open | `Button` |
|
|
601
|
+
|
|
602
|
+
The entity is loading.
|
|
603
|
+
|
|
604
|
+
The entity is still loading: every `Attribute` shows its skeleton and the nested table shows
|
|
605
|
+
three skeleton rows. No `Loader` over the body, and the header keeps its title.
|
|
606
|
+
|
|
607
|
+
```tsx story=Loading
|
|
608
|
+
import { useState } from 'react';
|
|
609
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
610
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
611
|
+
import { Page, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
|
|
612
|
+
import { Separator } from '@wallarm-org/design-system/Separator';
|
|
613
|
+
import { VStack } from '@wallarm-org/design-system/Stack';
|
|
614
|
+
import { type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
|
|
615
|
+
|
|
616
|
+
export const Loading = () => {
|
|
617
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
618
|
+
const [open, setOpen] = useState(false);
|
|
619
|
+
|
|
620
|
+
const provider = PROVIDERS.find(item => item.id === selectedId) ?? null;
|
|
621
|
+
|
|
622
|
+
const columns: TableColumnDef<Provider>[] = [
|
|
623
|
+
{ accessorKey: 'name', header: 'Name', size: 260 },
|
|
624
|
+
{ accessorKey: 'protocol', header: 'Protocol', size: 180 },
|
|
625
|
+
{ accessorKey: 'issuer', header: 'Issuer', size: 360 },
|
|
626
|
+
];
|
|
627
|
+
const ruleColumns: TableColumnDef<RoleRule>[] = [
|
|
628
|
+
{ accessorKey: 'value', header: 'Claim', size: 300 },
|
|
629
|
+
{ accessorKey: 'role', header: 'Role', size: 200 },
|
|
630
|
+
];
|
|
631
|
+
|
|
632
|
+
const handleMasterCellClick = (id: string) => {
|
|
633
|
+
setSelectedId(id);
|
|
634
|
+
setOpen(true);
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
return (
|
|
638
|
+
<Page name='settings-sso' fullSize fixedHeight data-testid='providers-page'>
|
|
639
|
+
<PageHeader>
|
|
640
|
+
<PageHeaderGroup>
|
|
641
|
+
<PageTitle>SSO providers</PageTitle>
|
|
642
|
+
</PageHeaderGroup>
|
|
643
|
+
</PageHeader>
|
|
644
|
+
|
|
645
|
+
<PageContent>
|
|
646
|
+
<Table
|
|
647
|
+
aria-label='SSO providers'
|
|
648
|
+
data={PROVIDERS}
|
|
649
|
+
columns={columns}
|
|
650
|
+
getRowId={getProviderId}
|
|
651
|
+
activeRowId={open ? selectedId : null}
|
|
652
|
+
onMasterCellClick={handleMasterCellClick}
|
|
653
|
+
data-testid='providers-table'
|
|
654
|
+
/>
|
|
655
|
+
</PageContent>
|
|
656
|
+
|
|
657
|
+
<Drawer
|
|
658
|
+
open={open}
|
|
659
|
+
onOpenChange={setOpen}
|
|
660
|
+
modal={false}
|
|
661
|
+
overlay={false}
|
|
662
|
+
closeOnOutsideClick={false}
|
|
663
|
+
width={640}
|
|
664
|
+
data-testid='provider-drawer'
|
|
665
|
+
>
|
|
666
|
+
<DrawerContent>
|
|
667
|
+
<DrawerHeader>
|
|
668
|
+
<DrawerTitle>{provider?.name}</DrawerTitle>
|
|
669
|
+
</DrawerHeader>
|
|
670
|
+
<DrawerBody>
|
|
671
|
+
<VStack gap={6} className='pb-8' data-testid='provider-attributes'>
|
|
672
|
+
<Attribute orientation='horizontal' loading>
|
|
673
|
+
<AttributeLabel width={140}>Protocol</AttributeLabel>
|
|
674
|
+
<AttributeValue>{provider?.protocol}</AttributeValue>
|
|
675
|
+
</Attribute>
|
|
676
|
+
<Attribute orientation='horizontal' loading>
|
|
677
|
+
<AttributeLabel width={140}>Issuer URL</AttributeLabel>
|
|
678
|
+
<AttributeValue>{provider?.issuer}</AttributeValue>
|
|
679
|
+
</Attribute>
|
|
680
|
+
<Attribute orientation='horizontal' loading>
|
|
681
|
+
<AttributeLabel width={140}>Client ID</AttributeLabel>
|
|
682
|
+
<AttributeValue>{provider?.clientId}</AttributeValue>
|
|
683
|
+
</Attribute>
|
|
684
|
+
<Attribute orientation='horizontal' loading>
|
|
685
|
+
<AttributeLabel width={140}>Created at</AttributeLabel>
|
|
686
|
+
<AttributeValue>{provider?.createdAt}</AttributeValue>
|
|
687
|
+
</Attribute>
|
|
688
|
+
</VStack>
|
|
689
|
+
<Separator spacing={4} />
|
|
690
|
+
<div className='-mx-8 pt-8'>
|
|
691
|
+
<Table
|
|
692
|
+
aria-label='Role rules'
|
|
693
|
+
data={[]}
|
|
694
|
+
columns={ruleColumns}
|
|
695
|
+
getRowId={getItemId}
|
|
696
|
+
isLoading
|
|
697
|
+
skeletonCount={3}
|
|
698
|
+
data-testid='provider-rules-table'
|
|
699
|
+
/>
|
|
700
|
+
</div>
|
|
701
|
+
</DrawerBody>
|
|
702
|
+
</DrawerContent>
|
|
703
|
+
</Drawer>
|
|
704
|
+
</Page>
|
|
705
|
+
);
|
|
706
|
+
};
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
Viewing an old version.
|
|
710
|
+
|
|
711
|
+
Viewing an old version: an info `Alert` comes first in the body with "Back to current" and
|
|
712
|
+
"Restore", and the header "Actions" menu is disabled until the reader goes back.
|
|
713
|
+
|
|
714
|
+
```tsx story=OldVersion
|
|
715
|
+
import { useState } from 'react';
|
|
716
|
+
import { Alert, AlertContent, AlertControls, AlertDescription, AlertIcon, AlertTitle } from '@wallarm-org/design-system/Alert';
|
|
717
|
+
import { Attribute, AttributeLabel, AttributeValue } from '@wallarm-org/design-system/Attribute';
|
|
718
|
+
import { Button } from '@wallarm-org/design-system/Button';
|
|
719
|
+
import { InlineCodeSnippet } from '@wallarm-org/design-system/CodeSnippet';
|
|
720
|
+
import { Drawer, DrawerBody, DrawerContent, DrawerHeader, DrawerTitle } from '@wallarm-org/design-system/Drawer';
|
|
721
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemText, DropdownMenuSeparator, DropdownMenuTrigger } from '@wallarm-org/design-system/DropdownMenu';
|
|
722
|
+
import { ChevronDown } from '@wallarm-org/design-system/icons';
|
|
723
|
+
import { Page, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
|
|
724
|
+
import { VStack } from '@wallarm-org/design-system/Stack';
|
|
725
|
+
import { type TableColumnDef, Table } from '@wallarm-org/design-system/Table';
|
|
726
|
+
import { Tag } from '@wallarm-org/design-system/Tag';
|
|
727
|
+
|
|
728
|
+
export const OldVersion = () => {
|
|
729
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
730
|
+
const [open, setOpen] = useState(false);
|
|
731
|
+
const [isOldVersion, setIsOldVersion] = useState(true);
|
|
732
|
+
|
|
733
|
+
const provider = PROVIDERS.find(item => item.id === selectedId) ?? null;
|
|
734
|
+
// The old version had a default role that was removed later.
|
|
735
|
+
const defaultRole = isOldVersion ? 'Security analyst' : provider?.defaultRole;
|
|
736
|
+
|
|
737
|
+
const columns: TableColumnDef<Provider>[] = [
|
|
738
|
+
{ accessorKey: 'name', header: 'Name', size: 260 },
|
|
739
|
+
{ accessorKey: 'protocol', header: 'Protocol', size: 180 },
|
|
740
|
+
{ accessorKey: 'issuer', header: 'Issuer', size: 360 },
|
|
741
|
+
];
|
|
742
|
+
|
|
743
|
+
const handleMasterCellClick = (id: string) => {
|
|
744
|
+
setSelectedId(id);
|
|
745
|
+
setIsOldVersion(true);
|
|
746
|
+
setOpen(true);
|
|
747
|
+
};
|
|
748
|
+
const handleBackToCurrent = () => setIsOldVersion(false);
|
|
749
|
+
const handleRestore = () => onRestoreVersion(provider);
|
|
750
|
+
const handleEdit = () => onEditProvider(provider);
|
|
751
|
+
const handleDelete = () => onDeleteProvider(provider);
|
|
752
|
+
|
|
753
|
+
return (
|
|
754
|
+
<Page name='settings-sso' fullSize fixedHeight data-testid='providers-page'>
|
|
755
|
+
<PageHeader>
|
|
756
|
+
<PageHeaderGroup>
|
|
757
|
+
<PageTitle>SSO providers</PageTitle>
|
|
758
|
+
</PageHeaderGroup>
|
|
759
|
+
</PageHeader>
|
|
760
|
+
|
|
761
|
+
<PageContent>
|
|
762
|
+
<Table
|
|
763
|
+
aria-label='SSO providers'
|
|
764
|
+
data={PROVIDERS}
|
|
765
|
+
columns={columns}
|
|
766
|
+
getRowId={getProviderId}
|
|
767
|
+
activeRowId={open ? selectedId : null}
|
|
768
|
+
onMasterCellClick={handleMasterCellClick}
|
|
769
|
+
data-testid='providers-table'
|
|
770
|
+
/>
|
|
771
|
+
</PageContent>
|
|
772
|
+
|
|
773
|
+
<Drawer
|
|
774
|
+
open={open}
|
|
775
|
+
onOpenChange={setOpen}
|
|
776
|
+
modal={false}
|
|
777
|
+
overlay={false}
|
|
778
|
+
closeOnOutsideClick={false}
|
|
779
|
+
width={640}
|
|
780
|
+
data-testid='provider-drawer'
|
|
781
|
+
>
|
|
782
|
+
<DrawerContent>
|
|
783
|
+
<DrawerHeader>
|
|
784
|
+
<DrawerTitle>{provider?.name}</DrawerTitle>
|
|
785
|
+
<DropdownMenu data-testid='provider-actions'>
|
|
786
|
+
<DropdownMenuTrigger asChild>
|
|
787
|
+
<Button variant='outline' color='neutral' size='small' disabled={isOldVersion}>
|
|
788
|
+
Actions <ChevronDown />
|
|
789
|
+
</Button>
|
|
790
|
+
</DropdownMenuTrigger>
|
|
791
|
+
<DropdownMenuContent>
|
|
792
|
+
<DropdownMenuItem onSelect={handleEdit}>
|
|
793
|
+
<DropdownMenuItemText>Edit provider</DropdownMenuItemText>
|
|
794
|
+
</DropdownMenuItem>
|
|
795
|
+
<DropdownMenuSeparator />
|
|
796
|
+
<DropdownMenuItem variant='destructive' onSelect={handleDelete}>
|
|
797
|
+
<DropdownMenuItemText>Delete provider</DropdownMenuItemText>
|
|
798
|
+
</DropdownMenuItem>
|
|
799
|
+
</DropdownMenuContent>
|
|
800
|
+
</DropdownMenu>
|
|
801
|
+
</DrawerHeader>
|
|
802
|
+
|
|
803
|
+
<DrawerBody>
|
|
804
|
+
{isOldVersion && (
|
|
805
|
+
<Alert color='info' data-testid='provider-version-alert'>
|
|
806
|
+
<AlertIcon />
|
|
807
|
+
<AlertContent>
|
|
808
|
+
<AlertTitle>You are viewing the version from Oct 28, 2026</AlertTitle>
|
|
809
|
+
<AlertDescription>Changes made after it are not shown.</AlertDescription>
|
|
810
|
+
</AlertContent>
|
|
811
|
+
<AlertControls>
|
|
812
|
+
<Button
|
|
813
|
+
variant='secondary'
|
|
814
|
+
color='neutral'
|
|
815
|
+
size='small'
|
|
816
|
+
onClick={handleBackToCurrent}
|
|
817
|
+
>
|
|
818
|
+
Back to current
|
|
819
|
+
</Button>
|
|
820
|
+
<Button variant='secondary' color='neutral' size='small' onClick={handleRestore}>
|
|
821
|
+
Restore
|
|
822
|
+
</Button>
|
|
823
|
+
</AlertControls>
|
|
824
|
+
</Alert>
|
|
825
|
+
)}
|
|
826
|
+
{provider && (
|
|
827
|
+
<VStack gap={6} className='pt-12 pb-8' data-testid='provider-attributes'>
|
|
828
|
+
<Attribute orientation='horizontal'>
|
|
829
|
+
<AttributeLabel width={140}>Protocol</AttributeLabel>
|
|
830
|
+
<AttributeValue>{provider.protocol}</AttributeValue>
|
|
831
|
+
</Attribute>
|
|
832
|
+
<Attribute orientation='horizontal'>
|
|
833
|
+
<AttributeLabel width={140}>Client ID</AttributeLabel>
|
|
834
|
+
<AttributeValue>
|
|
835
|
+
<InlineCodeSnippet code={provider.clientId} size='md' />
|
|
836
|
+
</AttributeValue>
|
|
837
|
+
</Attribute>
|
|
838
|
+
<Attribute orientation='horizontal' isEmpty={!defaultRole}>
|
|
839
|
+
<AttributeLabel width={140}>Default role</AttributeLabel>
|
|
840
|
+
<AttributeValue>{defaultRole && <Tag>{defaultRole}</Tag>}</AttributeValue>
|
|
841
|
+
</Attribute>
|
|
842
|
+
</VStack>
|
|
843
|
+
)}
|
|
844
|
+
</DrawerBody>
|
|
845
|
+
</DrawerContent>
|
|
846
|
+
</Drawer>
|
|
847
|
+
</Page>
|
|
848
|
+
);
|
|
849
|
+
};
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
## What your app owns
|
|
853
|
+
|
|
854
|
+
| You own | The DS owns |
|
|
855
|
+
| --- | --- |
|
|
856
|
+
| `selectedId`, `open`, fetching | Animation, focus trap, close X |
|
|
857
|
+
| Width; persisting it via `onResizeEnd` | Resize drag and limits |
|
|
858
|
+
| Attributes, sections, tabs, label width | Row height, truncation, skeletons |
|
|
859
|
+
| Menu items and handlers | Menu positioning and keyboard |
|
|
860
|
+
| Section headers, grid, bleed offsets | Body gutter, header spacing |
|
|
861
|
+
| Confirmation, version restore | Nothing; compose `Dialog`, `Alert` |
|
|
862
|
+
|
|
863
|
+
## Related
|
|
864
|
+
|
|
865
|
+
- [Entity table](./entity-table.md), [Resource list page](./resource-list-page.md)
|
|
866
|
+
- [Create and edit forms](./create-edit-forms.md), [Confirmation dialogs](./confirmation-dialogs.md)
|
|
867
|
+
- [Action-result toasts](./feedback-toasts.md), [Empty states](./empty-states.md)
|
|
868
|
+
- [Spacing](../foundations/spacing.md), [Layering](../foundations/layering.md)
|