@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,752 +0,0 @@
1
- ---
2
- title: Settings page
3
- description: Use when building a page of independent settings (profile, preferences, appearance) where each value saves on its own and a toast confirms it.
4
- components: [Page, PageHeader, PageHeaderGroup, PageContent, PageTitle, RemoteShellBreadcrumb, Heading, Text, Field, FieldLabel, FieldError, Input, Select, SelectInput, SegmentedControl, RadioGroup, Radio, Switch, Button, Avatar, FileUpload, Separator, Tooltip, Toast, Dialog, PasswordInput, PasswordComplexity, ThemeProvider, ImageCropper, Slider, NavRail]
5
- keywords: [settings, settings page, profile, preferences, account settings, user settings, appearance, theme picker, label value row, settings row, settings section, autosave, save on blur, danger zone, delete account, change password, change email, timezone, date format, time format, sidebar style, form page]
6
- order: 70
7
- ---
8
-
9
- # Settings page
10
-
11
- A 640px column of sections. Each row saves itself and a toast confirms it. No Save button.
12
-
13
- ## When to use
14
-
15
- | Need | Use | Not |
16
- | --- | --- | --- |
17
- | Independent values of one account or org | This pattern | One form with a Save button |
18
- | Values saved together (a provider config) | [Create and edit forms](./create-edit-forms.md) in a `Drawer` | Rows that autosave |
19
- | A list of entities | [Resource list page](./resource-list-page.md) | A row per entity |
20
- | An events × channels matrix | `Table` with `Switch` cells ([Entity table](./entity-table.md)) | A row per cell |
21
- | Email or password change | A `Dialog` opened from the row | Editing the value in place |
22
- | Deleting the account | Type-to-confirm `Dialog` ([Confirmation dialogs](./confirmation-dialogs.md)) | Deleting at once |
23
-
24
- Pick the row kind by the control:
25
-
26
- | Control | Row |
27
- | --- | --- |
28
- | `Input`, `Select`, `Switch` | Field row: `Field orientation='horizontal'` › `FieldLabel` + a `w-[320px] shrink-0` wrapper |
29
- | `SegmentedControl` | Action row with `aria-label` on the control |
30
- | `Button`, `Avatar` | Action row: `Text` + control |
31
- | `RadioGroup variant='card'` | No row; the section `Heading` labels it through `aria-labelledby` |
32
-
33
- ## Rules
34
-
35
- **Layout and spacing** (spacing counts in pixels, `gap-16` = 16px):
36
-
37
- - Use `Page fullSize fixedHeight` › `PageHeader` › `PageContent`. **Never** add `PageActions`, `PageToolbar` or `PageDescription`.
38
- - `PageHeader` › `PageHeaderGroup` › `PageTitle`. The trail is the Settings section's `RemoteShellBreadcrumb` ([Application layout](./app-layout.md)); **never** put `Breadcrumbs` in `PageHeader`.
39
- - `PageContent` owns the 24px gutter. **Never** add padding around it.
40
- - Put the sections in one `div className='flex max-w-[640px] flex-col gap-16'`. **Never** wrap it in a `Card` or padded box. **Never** give it `mx-auto`; it stays left-aligned.
41
- - Section: `flex flex-col gap-16` › `Heading as='h2' size='xl' weight='medium' color='primary'` + a `flex flex-col` row list.
42
- - Put `Separator spacing={16}` after every row, including a section's last row, except in the last section.
43
- - **Never** add `gap-*` to the row list. The separators carry the rhythm.
44
- - Wrap `Input` and `Select` in `w-[320px] shrink-0`. Leave compact controls unwrapped.
45
- - Give action rows `flex min-h-36 items-center justify-between gap-16`. Use the default `Button` size (36px).
46
- - Put card radios in `div className='grid grid-cols-3 gap-8'` inside the `RadioGroup`.
47
- - **Never** pass `className` to `Field`, `FieldLabel`, `Heading`, `Text`, `RadioGroup` or `Radio`. Size them through a wrapper `div`.
48
-
49
- **Controls:**
50
-
51
- - Save text on blur and choices on change. **Never** save per keystroke or an unchanged value.
52
- - Use `SelectInput` as the trigger. Over ~10 options, add `SelectHeader` › `SelectSearchInput` with `useSelectSearch`.
53
- - Use `SegmentedControl` for 2–4 short options. Its `onChange` gets `(value: string)`.
54
- - Use `RadioGroup variant='card'` only when options carry a picture or description (theme).
55
- - Use `Button variant='outline' color='neutral'` for a row action that opens a dialog ("Change password").
56
- - Make the avatar the upload trigger: `FileUploadTrigger asChild` › `Avatar as='button'` with `AvatarOverlay`.
57
- - If a value needs confirming (email, password), open a 560 `Dialog` that asks for the current password. **Never** edit it in the row.
58
- - If two values only make sense together, put them in one dialog. **Never** autosave half a pair.
59
- - Put the danger zone last: text (`max-w-[320px]`) left, `Button color='destructive'` right.
60
-
61
- **Copy:**
62
-
63
- - Page title = rail item ("Profile"); breadcrumbs "Settings › Profile". Section titles are one noun ("Preferences"). Labels are sentence case, no colon.
64
- - Write the toast as "<Label> updated" with `type: 'success'`, one per saved value. This overrides `'default'` from [Feedback toasts](./feedback-toasts.md).
65
-
66
- There is no `SettingsPage`, `SettingsSection` or `SettingsRow`, no `className` on `Field`, no `label` on `Separator`, no `loading` on `Switch` or `Input`, no `'system'` theme value, and no theme preview tile.
67
-
68
- ## Examples
69
-
70
- The page frame: a title in the header, sections straight in `PageContent`.
71
-
72
- Settings › Profile: About, Preferences, Appearance, Security and the danger zone in one
73
- left-aligned 640px column. Text saves on blur, choices on change, and every save shows a
74
- "<Label> updated" toast. Email and password open dialogs; two-factor is locked by the org.
75
-
76
- ```tsx story=Default
77
- import { type ChangeEvent, useState } from 'react';
78
- import { Avatar, AvatarFallback, AvatarImage, AvatarOverlay } from '@wallarm-org/design-system/Avatar';
79
- import { Button } from '@wallarm-org/design-system/Button';
80
- import { Field, FieldError, FieldLabel } from '@wallarm-org/design-system/Field';
81
- import { FileUpload, FileUploadTrigger, useFilePreviewUrl } from '@wallarm-org/design-system/FileUpload';
82
- import { Heading } from '@wallarm-org/design-system/Heading';
83
- import { Lock } from '@wallarm-org/design-system/icons';
84
- import { Input } from '@wallarm-org/design-system/Input';
85
- import { Page, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
86
- import { Radio, RadioDescription, RadioGroup, RadioIndicator, RadioLabel } from '@wallarm-org/design-system/Radio';
87
- import { SegmentedControl, SegmentedControlItem } from '@wallarm-org/design-system/SegmentedControl';
88
- import { createListCollection, Select, SelectContent, SelectInput, SelectOption, SelectOptionIndicator, SelectOptionText, SelectPositioner } from '@wallarm-org/design-system/Select';
89
- import { Separator } from '@wallarm-org/design-system/Separator';
90
- import { Switch, SwitchControl } from '@wallarm-org/design-system/Switch';
91
- import { Text } from '@wallarm-org/design-system/Text';
92
- import { useToast } from '@wallarm-org/design-system/Toast';
93
- import { Tooltip, TooltipContent, TooltipTrigger } from '@wallarm-org/design-system/Tooltip';
94
-
95
- export const Default = () => {
96
- const toast = useToast();
97
- const [profile, setProfile] = useState(PROFILE);
98
- const [name, setName] = useState(PROFILE.name);
99
- const [nameError, setNameError] = useState('');
100
- const [photos, setPhotos] = useState<File[]>([]);
101
- const photo = useFilePreviewUrl(photos[0]);
102
-
103
- const timezones = createListCollection({ items: TIMEZONES });
104
- const dateFormats = createListCollection({ items: DATE_FORMATS });
105
-
106
- const save = async (patch: Partial<Profile>, label: string) => {
107
- setProfile({ ...profile, ...patch });
108
- try {
109
- await onSaveProfile(patch);
110
- toast.create({ title: `${label} updated`, type: 'success' });
111
- } catch {
112
- toast.create({ title: `${label} update failed`, type: 'error' });
113
- }
114
- };
115
-
116
- const handlePhotoChange = (files: File[]) => {
117
- setPhotos(files);
118
- toast.create({ title: 'Photo updated', type: 'success' });
119
- };
120
-
121
- const handleNameChange = (event: ChangeEvent<HTMLInputElement>) => {
122
- setName(event.target.value);
123
- setNameError('');
124
- };
125
-
126
- const handleNameBlur = () => {
127
- const value = name.trim();
128
- if (!value) {
129
- setNameError('Enter your name');
130
- return;
131
- }
132
- if (value !== profile.name) save({ name: value }, 'Name');
133
- };
134
-
135
- const handleTimezoneChange = ({ value }: { value: string[] }) =>
136
- save({ timezone: value[0] }, 'Timezone');
137
- const handleDateFormatChange = ({ value }: { value: string[] }) =>
138
- save({ dateFormat: value[0] }, 'Date format');
139
- const handleTimeFormatChange = (value: string) => save({ timeFormat: value }, 'Time format');
140
- const handleWeeklyReportChange = ({ checked }: { checked: boolean }) =>
141
- save({ weeklyReport: checked }, 'Weekly report');
142
- const handleSidebarStyleChange = (value: string) =>
143
- save({ sidebarStyle: value }, 'Sidebar style');
144
- const handleThemeChange = ({ value }: { value: string | null }) => {
145
- if (value) save({ theme: value }, 'Theme');
146
- };
147
-
148
- return (
149
- <Page name='settings-profile' fullSize fixedHeight data-testid='profile-page'>
150
- <PageHeader>
151
- <PageHeaderGroup>
152
- <PageTitle>Profile</PageTitle>
153
- </PageHeaderGroup>
154
- </PageHeader>
155
-
156
- <PageContent>
157
- <div className='flex max-w-[640px] flex-col gap-16'>
158
- <section className='flex flex-col gap-16'>
159
- <Heading as='h2' size='xl' weight='medium' color='primary'>
160
- About
161
- </Heading>
162
- <div className='flex flex-col'>
163
- <div className='flex min-h-36 items-center justify-between gap-16'>
164
- <Text size='sm' weight='medium' color='primary'>
165
- Photo
166
- </Text>
167
- <FileUpload
168
- accept='image/png,image/jpeg,image/webp'
169
- maxFileSize={512 * 1024}
170
- value={photos}
171
- onValueChange={handlePhotoChange}
172
- className='w-auto'
173
- data-testid='profile-photo'
174
- >
175
- <FileUploadTrigger asChild>
176
- <Avatar as='button' aria-label='Change photo'>
177
- <AvatarImage src={photo} />
178
- <AvatarFallback name={profile.name} />
179
- <AvatarOverlay />
180
- </Avatar>
181
- </FileUploadTrigger>
182
- </FileUpload>
183
- </div>
184
- <Separator spacing={16} />
185
- <Field orientation='horizontal'>
186
- <FieldLabel>Name</FieldLabel>
187
- <div className='flex w-[320px] shrink-0 flex-col gap-4'>
188
- <Input
189
- value={name}
190
- error={!!nameError}
191
- onChange={handleNameChange}
192
- onBlur={handleNameBlur}
193
- data-testid='profile-name'
194
- />
195
- {nameError && <FieldError>{nameError}</FieldError>}
196
- </div>
197
- </Field>
198
- <Separator spacing={16} />
199
- <Field orientation='horizontal'>
200
- <FieldLabel>Email</FieldLabel>
201
- <div className='w-[320px] shrink-0'>
202
- <Input
203
- readOnly
204
- value={EMAIL}
205
- onClick={onEditEmail}
206
- onKeyDown={handleEmailKeyDown}
207
- data-testid='profile-email'
208
- />
209
- </div>
210
- </Field>
211
- <Separator spacing={16} />
212
- </div>
213
- </section>
214
-
215
- <section className='flex flex-col gap-16'>
216
- <Heading as='h2' size='xl' weight='medium' color='primary'>
217
- Preferences
218
- </Heading>
219
- <div className='flex flex-col'>
220
- <Field orientation='horizontal'>
221
- <FieldLabel>Timezone</FieldLabel>
222
- <div className='w-[320px] shrink-0'>
223
- <Select
224
- collection={timezones}
225
- value={[profile.timezone]}
226
- onValueChange={handleTimezoneChange}
227
- data-testid='profile-timezone'
228
- >
229
- <SelectInput className='w-full' />
230
- <SelectPositioner>
231
- <SelectContent>
232
- {timezones.items.map(item => (
233
- <SelectOption key={item.value} item={item}>
234
- <SelectOptionText>{item.label}</SelectOptionText>
235
- <SelectOptionIndicator />
236
- </SelectOption>
237
- ))}
238
- </SelectContent>
239
- </SelectPositioner>
240
- </Select>
241
- </div>
242
- </Field>
243
- <Separator spacing={16} />
244
- <Field orientation='horizontal'>
245
- <FieldLabel>Date format</FieldLabel>
246
- <div className='w-[320px] shrink-0'>
247
- <Select
248
- collection={dateFormats}
249
- value={[profile.dateFormat]}
250
- onValueChange={handleDateFormatChange}
251
- data-testid='profile-date-format'
252
- >
253
- <SelectInput className='w-full' />
254
- <SelectPositioner>
255
- <SelectContent>
256
- {dateFormats.items.map(item => (
257
- <SelectOption key={item.value} item={item}>
258
- <SelectOptionText>{item.label}</SelectOptionText>
259
- <SelectOptionIndicator />
260
- </SelectOption>
261
- ))}
262
- </SelectContent>
263
- </SelectPositioner>
264
- </Select>
265
- </div>
266
- </Field>
267
- <Separator spacing={16} />
268
- <div className='flex min-h-36 items-center justify-between gap-16'>
269
- <Text size='sm' weight='medium' color='primary'>
270
- Time format
271
- </Text>
272
- <SegmentedControl
273
- aria-label='Time format'
274
- value={profile.timeFormat}
275
- onChange={handleTimeFormatChange}
276
- data-testid='profile-time-format'
277
- >
278
- <SegmentedControlItem value='12h'>12-hour</SegmentedControlItem>
279
- <SegmentedControlItem value='24h'>24-hour</SegmentedControlItem>
280
- </SegmentedControl>
281
- </div>
282
- <Separator spacing={16} />
283
- <Field orientation='horizontal'>
284
- <FieldLabel>Weekly attack summary email</FieldLabel>
285
- <Switch
286
- checked={profile.weeklyReport}
287
- onCheckedChange={handleWeeklyReportChange}
288
- data-testid='profile-weekly-report'
289
- >
290
- <SwitchControl />
291
- </Switch>
292
- </Field>
293
- <Separator spacing={16} />
294
- </div>
295
- </section>
296
-
297
- <section className='flex flex-col gap-16'>
298
- <Heading id='appearance-heading' as='h2' size='xl' weight='medium' color='primary'>
299
- Appearance
300
- </Heading>
301
- <div className='flex flex-col'>
302
- <RadioGroup
303
- variant='card'
304
- name='theme'
305
- aria-labelledby='appearance-heading'
306
- value={profile.theme}
307
- onValueChange={handleThemeChange}
308
- >
309
- <div className='grid grid-cols-3 gap-8' data-testid='profile-theme'>
310
- <Radio value='light'>
311
- <RadioIndicator />
312
- <RadioLabel>Light</RadioLabel>
313
- <RadioDescription>Bright surfaces for daytime work</RadioDescription>
314
- </Radio>
315
- <Radio value='dark'>
316
- <RadioIndicator />
317
- <RadioLabel>Dark</RadioLabel>
318
- <RadioDescription>Dim surfaces for a SOC at night</RadioDescription>
319
- </Radio>
320
- <Radio value='system'>
321
- <RadioIndicator />
322
- <RadioLabel>System</RadioLabel>
323
- <RadioDescription>Follows your operating system</RadioDescription>
324
- </Radio>
325
- </div>
326
- </RadioGroup>
327
- <Separator spacing={16} />
328
- <div className='flex min-h-36 items-center justify-between gap-16'>
329
- <Text size='sm' weight='medium' color='primary'>
330
- Sidebar style
331
- </Text>
332
- <SegmentedControl
333
- aria-label='Sidebar style'
334
- value={profile.sidebarStyle}
335
- onChange={handleSidebarStyleChange}
336
- data-testid='profile-sidebar-style'
337
- >
338
- <SegmentedControlItem value='neutral'>Neutral</SegmentedControlItem>
339
- <SegmentedControlItem value='branded'>Branded</SegmentedControlItem>
340
- </SegmentedControl>
341
- </div>
342
- <Separator spacing={16} />
343
- </div>
344
- </section>
345
-
346
- <section className='flex flex-col gap-16'>
347
- <Heading as='h2' size='xl' weight='medium' color='primary'>
348
- Security
349
- </Heading>
350
- <div className='flex flex-col'>
351
- <div className='flex min-h-36 items-center justify-between gap-16'>
352
- <Text size='sm' weight='medium' color='primary'>
353
- Password
354
- </Text>
355
- <Button
356
- variant='outline'
357
- color='neutral'
358
- onClick={onChangePassword}
359
- data-testid='profile-change-password'
360
- >
361
- Change password
362
- </Button>
363
- </div>
364
- <Separator spacing={16} />
365
- <Field orientation='horizontal'>
366
- <FieldLabel>Two-factor authentication</FieldLabel>
367
- <div className='flex items-center gap-8'>
368
- <Tooltip>
369
- <TooltipTrigger asChild>
370
- <Lock aria-label='Locked' />
371
- </TooltipTrigger>
372
- <TooltipContent>Enabled by your organization</TooltipContent>
373
- </Tooltip>
374
- <Switch checked disabled data-testid='profile-two-factor'>
375
- <SwitchControl />
376
- </Switch>
377
- </div>
378
- </Field>
379
- <Separator spacing={16} />
380
- </div>
381
- </section>
382
-
383
- <section className='flex flex-col gap-16'>
384
- <Heading as='h2' size='xl' weight='medium' color='primary'>
385
- Danger zone
386
- </Heading>
387
- <div className='flex flex-col'>
388
- <div className='flex min-h-36 items-center justify-between gap-16'>
389
- <div className='max-w-[320px]'>
390
- <Text size='sm' color='secondary'>
391
- Deletes your account and signs you out. Your organization's data stays.
392
- </Text>
393
- </div>
394
- <Button
395
- color='destructive'
396
- onClick={onDeleteAccount}
397
- data-testid='profile-delete-account'
398
- >
399
- Delete account
400
- </Button>
401
- </div>
402
- </div>
403
- </section>
404
- </div>
405
- </PageContent>
406
- </Page>
407
- );
408
- };
409
- ```
410
-
411
- A field row saves on blur and shows an inline error; a failed save keeps the typed value.
412
-
413
- Starts invalid: the message sits under the input inside the 320px wrapper, and nothing saves
414
- until the name is valid. A failed save shows an error toast instead of "Name updated".
415
-
416
- ```tsx story=InvalidValue
417
- import { type ChangeEvent, useState } from 'react';
418
- import { Field, FieldError, FieldLabel } from '@wallarm-org/design-system/Field';
419
- import { Heading } from '@wallarm-org/design-system/Heading';
420
- import { Input } from '@wallarm-org/design-system/Input';
421
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
422
- import { useToast } from '@wallarm-org/design-system/Toast';
423
-
424
- export const InvalidValue = () => {
425
- const toast = useToast();
426
- const [savedName, setSavedName] = useState(PROFILE.name);
427
- const [name, setName] = useState('');
428
- const [nameError, setNameError] = useState('Enter your name');
429
-
430
- const handleNameChange = (event: ChangeEvent<HTMLInputElement>) => {
431
- setName(event.target.value);
432
- setNameError('');
433
- };
434
-
435
- // On failure the input keeps the typed value, and the next blur retries.
436
- const handleNameBlur = async () => {
437
- const value = name.trim();
438
- if (!value) {
439
- setNameError('Enter your name');
440
- return;
441
- }
442
- if (value === savedName) return;
443
- try {
444
- await onSaveProfile({ name: value });
445
- setSavedName(value);
446
- toast.create({ title: 'Name updated', type: 'success' });
447
- } catch {
448
- toast.create({ title: 'Name update failed', type: 'error' });
449
- }
450
- };
451
-
452
- return (
453
- <Page name='settings-profile' data-testid='profile-page'>
454
- <PageContent>
455
- <div className='flex max-w-[640px] flex-col gap-16'>
456
- <section className='flex flex-col gap-16'>
457
- <Heading as='h2' size='xl' weight='medium' color='primary'>
458
- About
459
- </Heading>
460
- <div className='flex flex-col'>
461
- <Field orientation='horizontal'>
462
- <FieldLabel>Name</FieldLabel>
463
- <div className='flex w-[320px] shrink-0 flex-col gap-4'>
464
- <Input
465
- value={name}
466
- error={!!nameError}
467
- onChange={handleNameChange}
468
- onBlur={handleNameBlur}
469
- data-testid='profile-name'
470
- />
471
- {nameError && <FieldError>{nameError}</FieldError>}
472
- </div>
473
- </Field>
474
- </div>
475
- </section>
476
- </div>
477
- </PageContent>
478
- </Page>
479
- );
480
- };
481
- ```
482
-
483
- An action row labels with `Text` and `aria-label`, not `FieldLabel`.
484
-
485
- The control saves on change; the row keeps its 36px height whatever the control is.
486
-
487
- ```tsx story=ActionRow
488
- import { useState } from 'react';
489
- import { Heading } from '@wallarm-org/design-system/Heading';
490
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
491
- import { SegmentedControl, SegmentedControlItem } from '@wallarm-org/design-system/SegmentedControl';
492
- import { Text } from '@wallarm-org/design-system/Text';
493
- import { useToast } from '@wallarm-org/design-system/Toast';
494
-
495
- export const ActionRow = () => {
496
- const toast = useToast();
497
- const [sidebarStyle, setSidebarStyle] = useState(PROFILE.sidebarStyle);
498
-
499
- const handleSidebarStyleChange = (value: string) => {
500
- setSidebarStyle(value);
501
- onSaveProfile({ sidebarStyle: value });
502
- toast.create({ title: 'Sidebar style updated', type: 'success' });
503
- };
504
-
505
- return (
506
- <Page name='settings-profile' data-testid='profile-page'>
507
- <PageContent>
508
- <div className='flex max-w-[640px] flex-col gap-16'>
509
- <section className='flex flex-col gap-16'>
510
- <Heading as='h2' size='xl' weight='medium' color='primary'>
511
- Appearance
512
- </Heading>
513
- <div className='flex flex-col'>
514
- <div className='flex min-h-36 items-center justify-between gap-16'>
515
- <Text size='sm' weight='medium' color='primary'>
516
- Sidebar style
517
- </Text>
518
- <SegmentedControl
519
- aria-label='Sidebar style'
520
- value={sidebarStyle}
521
- onChange={handleSidebarStyleChange}
522
- data-testid='profile-sidebar-style'
523
- >
524
- <SegmentedControlItem value='neutral'>Neutral</SegmentedControlItem>
525
- <SegmentedControlItem value='branded'>Branded</SegmentedControlItem>
526
- </SegmentedControl>
527
- </div>
528
- </div>
529
- </section>
530
- </div>
531
- </PageContent>
532
- </Page>
533
- );
534
- };
535
- ```
536
-
537
- An org-locked value puts the tooltip on `Lock`; a disabled `Switch` never opens one.
538
-
539
- The row stays visible with its current value, so users see what the org enforces.
540
-
541
- ```tsx story=LockedValue
542
- import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
543
- import { Heading } from '@wallarm-org/design-system/Heading';
544
- import { Lock } from '@wallarm-org/design-system/icons';
545
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
546
- import { Switch, SwitchControl } from '@wallarm-org/design-system/Switch';
547
- import { Tooltip, TooltipContent, TooltipTrigger } from '@wallarm-org/design-system/Tooltip';
548
-
549
- export const LockedValue = () => (
550
- <Page name='settings-profile' data-testid='profile-page'>
551
- <PageContent>
552
- <div className='flex max-w-[640px] flex-col gap-16'>
553
- <section className='flex flex-col gap-16'>
554
- <Heading as='h2' size='xl' weight='medium' color='primary'>
555
- Security
556
- </Heading>
557
- <div className='flex flex-col'>
558
- <Field orientation='horizontal'>
559
- <FieldLabel>Two-factor authentication</FieldLabel>
560
- <div className='flex items-center gap-8'>
561
- <Tooltip>
562
- <TooltipTrigger asChild>
563
- <Lock aria-label='Locked' />
564
- </TooltipTrigger>
565
- <TooltipContent>Enabled by your organization</TooltipContent>
566
- </Tooltip>
567
- <Switch checked disabled data-testid='profile-two-factor'>
568
- <SwitchControl />
569
- </Switch>
570
- </div>
571
- </Field>
572
- </div>
573
- </section>
574
- </div>
575
- </PageContent>
576
- </Page>
577
- );
578
- ```
579
-
580
- A read-only email opens its dialog on click or Enter.
581
-
582
- The dialog asks for the current password before it changes the email.
583
-
584
- ```tsx story=ReadOnlyValue
585
- import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
586
- import { Heading } from '@wallarm-org/design-system/Heading';
587
- import { Input } from '@wallarm-org/design-system/Input';
588
- import { Page, PageContent } from '@wallarm-org/design-system/Page';
589
-
590
- export const ReadOnlyValue = () => (
591
- <Page name='settings-profile' data-testid='profile-page'>
592
- <PageContent>
593
- <div className='flex max-w-[640px] flex-col gap-16'>
594
- <section className='flex flex-col gap-16'>
595
- <Heading as='h2' size='xl' weight='medium' color='primary'>
596
- About
597
- </Heading>
598
- <div className='flex flex-col'>
599
- <Field orientation='horizontal'>
600
- <FieldLabel>Email</FieldLabel>
601
- <div className='w-[320px] shrink-0'>
602
- <Input
603
- readOnly
604
- value={EMAIL}
605
- onClick={onEditEmail}
606
- onKeyDown={handleEmailKeyDown}
607
- data-testid='profile-email'
608
- />
609
- </div>
610
- </Field>
611
- </div>
612
- </section>
613
- </div>
614
- </PageContent>
615
- </Page>
616
- );
617
- ```
618
-
619
- ## States
620
-
621
- | State | Show | Example component |
622
- | --- | --- | --- |
623
- | Saved | Success toast "<Label> updated" | `useToast().create({ type: 'success' })` |
624
- | Save failed | Error toast; keep the typed value | `useToast().create({ type: 'error' })` |
625
- | Invalid value | Message inside the 320 wrapper; no save, no toast | `Input error` + `FieldError` |
626
- | Saving a select | Disabled until the request ends | `Select disabled` |
627
- | Saving a button action | Loading button; never disable the page | `Button loading` |
628
- | Saving a switch | Disabled until the request ends | `Switch disabled` |
629
- | Locked by the org | Disabled control + `Lock` tooltip; keep the row | `Tooltip` › `TooltipTrigger` |
630
- | Opens a dialog | Read-only value | `Input readOnly` |
631
-
632
- Pass `error` to `Input`; `Field invalid` alone does not mark it.
633
-
634
- While a value saves, only its own control changes.
635
-
636
- Saving: a select and a switch stay disabled until the request ends, and a button action shows
637
- its loading state. The rest of the page stays usable.
638
-
639
- ```tsx story=Saving
640
- import { Button } from '@wallarm-org/design-system/Button';
641
- import { Field, FieldLabel } from '@wallarm-org/design-system/Field';
642
- import { Heading } from '@wallarm-org/design-system/Heading';
643
- import { Page, PageContent, PageHeader, PageHeaderGroup, PageTitle } from '@wallarm-org/design-system/Page';
644
- import { createListCollection, Select, SelectContent, SelectInput, SelectOption, SelectOptionIndicator, SelectOptionText, SelectPositioner } from '@wallarm-org/design-system/Select';
645
- import { Separator } from '@wallarm-org/design-system/Separator';
646
- import { Switch, SwitchControl } from '@wallarm-org/design-system/Switch';
647
- import { Text } from '@wallarm-org/design-system/Text';
648
-
649
- export const Saving = () => {
650
- const timezones = createListCollection({ items: TIMEZONES });
651
-
652
- return (
653
- <Page name='settings-profile' fullSize fixedHeight data-testid='profile-page'>
654
- <PageHeader>
655
- <PageHeaderGroup>
656
- <PageTitle>Profile</PageTitle>
657
- </PageHeaderGroup>
658
- </PageHeader>
659
-
660
- <PageContent>
661
- <div className='flex max-w-[640px] flex-col gap-16'>
662
- <section className='flex flex-col gap-16'>
663
- <Heading as='h2' size='xl' weight='medium' color='primary'>
664
- Preferences
665
- </Heading>
666
- <div className='flex flex-col'>
667
- <Field orientation='horizontal'>
668
- <FieldLabel>Timezone</FieldLabel>
669
- <div className='w-[320px] shrink-0'>
670
- <Select
671
- collection={timezones}
672
- defaultValue={['Asia/Singapore']}
673
- disabled
674
- data-testid='profile-timezone'
675
- >
676
- <SelectInput className='w-full' />
677
- <SelectPositioner>
678
- <SelectContent>
679
- {timezones.items.map(item => (
680
- <SelectOption key={item.value} item={item}>
681
- <SelectOptionText>{item.label}</SelectOptionText>
682
- <SelectOptionIndicator />
683
- </SelectOption>
684
- ))}
685
- </SelectContent>
686
- </SelectPositioner>
687
- </Select>
688
- </div>
689
- </Field>
690
- <Separator spacing={16} />
691
- <Field orientation='horizontal'>
692
- <FieldLabel>Weekly attack summary email</FieldLabel>
693
- <Switch checked disabled data-testid='profile-weekly-report'>
694
- <SwitchControl />
695
- </Switch>
696
- </Field>
697
- <Separator spacing={16} />
698
- </div>
699
- </section>
700
-
701
- <section className='flex flex-col gap-16'>
702
- <Heading as='h2' size='xl' weight='medium' color='primary'>
703
- Security
704
- </Heading>
705
- <div className='flex flex-col'>
706
- <div className='flex min-h-36 items-center justify-between gap-16'>
707
- <Text size='sm' weight='medium' color='primary'>
708
- Active sessions
709
- </Text>
710
- <Button
711
- variant='outline'
712
- color='neutral'
713
- loading
714
- data-testid='profile-sign-out-sessions'
715
- >
716
- Sign out of all sessions
717
- </Button>
718
- </div>
719
- </div>
720
- </section>
721
- </div>
722
- </PageContent>
723
- </Page>
724
- );
725
- };
726
- ```
727
-
728
- ## What your app owns
729
-
730
- | Concern | Recipe |
731
- | --- | --- |
732
- | Saving, validation, toasts | Call your API, then `useToast().create(...)` |
733
- | Email and password dialogs | `Dialog` from `@wallarm-org/design-system/Dialog`; `PasswordInput` with `PasswordComplexity` and `passwordValidators` for the new password. See [Create and edit forms](./create-edit-forms.md) |
734
- | Avatar crop | `Dialog` with `ImageCropper` and `Slider`; `FileUpload` only holds the file |
735
- | "System" theme | `useTheme().setTheme` takes `'light'` or `'dark'`. Store `'system'` yourself and resolve it with `matchMedia('(prefers-color-scheme: dark)')` |
736
- | Theme previews | Pass your own image in `RadioDescription` |
737
- | Sidebar style | `useTheme().frameStyle` / `setFrameStyle('neutral' \| 'branded')` |
738
- | Sidebar mode | Store it yourself; pass `mode` (`'expanded'`, `'collapsed'`, `'compact'`) to `NavRail`. "Adaptive" is your logic |
739
- | Date and time formats | Option labels built from the current date |
740
- | Org locks | Which values are locked |
741
- | Delete account | Type-to-confirm `Dialog`, then sign the user out |
742
-
743
- ## Related
744
-
745
- - [Application layout](./app-layout.md)
746
- - [Spacing](../foundations/spacing.md)
747
- - [Typography](../foundations/typography.md)
748
- - [Resource list page](./resource-list-page.md)
749
- - [Create and edit forms](./create-edit-forms.md)
750
- - [Confirmation dialogs](./confirmation-dialogs.md)
751
- - [Feedback toasts](./feedback-toasts.md)
752
- - [Entity table](./entity-table.md)