oneslash-design-system 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/DESIGN.md +30 -14
- package/dist/cases/accept-invite.md +1 -5
- package/dist/cases/account-menu/menu.d.ts +1 -0
- package/dist/cases/account-menu/menu.jsx +99 -0
- package/dist/cases/account-menu.md +164 -0
- package/dist/cases/agent-asks-before-risky-action.md +0 -4
- package/dist/cases/agent-cancels-when-unanswered.md +0 -4
- package/dist/cases/agent-options.md +0 -4
- package/dist/cases/agent-pending-reply.md +0 -4
- package/dist/cases/agent-plan-proposal.md +0 -4
- package/dist/cases/agent-question.md +0 -4
- package/dist/cases/agent-refuses-clearly.md +0 -4
- package/dist/cases/agent-says-what-it-is.md +0 -2
- package/dist/cases/agent-settings/form.d.ts +1 -0
- package/dist/cases/agent-settings/form.jsx +164 -0
- package/dist/cases/agent-settings.md +259 -0
- package/dist/cases/agent-shows-progress.md +0 -2
- package/dist/cases/agent-shows-sources.md +0 -2
- package/dist/cases/api-keys/list.d.ts +1 -0
- package/dist/cases/api-keys/list.jsx +162 -0
- package/dist/cases/api-keys.md +229 -0
- package/dist/cases/artifact-card.md +0 -4
- package/dist/cases/auth-gate-loading.md +0 -4
- package/dist/cases/check-your-email.md +0 -4
- package/dist/cases/collapsible-search/popover.d.ts +1 -0
- package/dist/cases/collapsible-search/popover.jsx +74 -0
- package/dist/cases/collapsible-search.md +143 -0
- package/dist/cases/composer-limit.md +0 -4
- package/dist/cases/confirm-destructive-action.md +0 -4
- package/dist/cases/confirm-dialogs.md +0 -4
- package/dist/cases/conversation-starters.md +0 -4
- package/dist/cases/create-modal.md +0 -4
- package/dist/cases/danger-zone/collapsed.d.ts +1 -0
- package/dist/cases/danger-zone/collapsed.jsx +75 -0
- package/dist/cases/danger-zone/shown.d.ts +1 -0
- package/dist/cases/danger-zone/shown.jsx +95 -0
- package/dist/cases/danger-zone.md +263 -0
- package/dist/cases/device-login.md +0 -4
- package/dist/cases/email-confirmed.md +0 -4
- package/dist/cases/empty-list.md +0 -4
- package/dist/cases/empty-lists.md +0 -4
- package/dist/cases/empty-not-set-up.md +0 -4
- package/dist/cases/empty-search.md +0 -4
- package/dist/cases/error-page.md +0 -4
- package/dist/cases/feedback-form.md +0 -4
- package/dist/cases/filter-menu/presets.d.ts +1 -0
- package/dist/cases/filter-menu/presets.jsx +53 -0
- package/dist/cases/filter-menu/with-clear.d.ts +1 -0
- package/dist/cases/filter-menu/with-clear.jsx +56 -0
- package/dist/cases/filter-menu.md +204 -0
- package/dist/cases/forgot-password.md +0 -4
- package/dist/cases/form-errors.md +0 -4
- package/dist/cases/import-checklist.md +0 -4
- package/dist/cases/inline-form-feedback.md +0 -4
- package/dist/cases/integrations-list/nested.d.ts +1 -0
- package/dist/cases/integrations-list/nested.jsx +164 -0
- package/dist/cases/integrations-list/rows.d.ts +1 -0
- package/dist/cases/integrations-list/rows.jsx +134 -0
- package/dist/cases/integrations-list.md +379 -0
- package/dist/cases/invite-member.md +0 -4
- package/dist/cases/load-failure.md +0 -4
- package/dist/cases/log-out-confirm.md +0 -4
- package/dist/cases/login-page.md +0 -4
- package/dist/cases/members-list/rows.d.ts +1 -0
- package/dist/cases/members-list/rows.jsx +318 -0
- package/dist/cases/members-list/table.d.ts +1 -0
- package/dist/cases/members-list/table.jsx +351 -0
- package/dist/cases/members-list.md +799 -0
- package/dist/cases/mention-list.md +0 -4
- package/dist/cases/message-actions.md +0 -4
- package/dist/cases/message-attachments.md +0 -4
- package/dist/cases/message-composer.md +0 -4
- package/dist/cases/message-edit.md +0 -4
- package/dist/cases/message-reactions.md +0 -4
- package/dist/cases/message-row.md +0 -4
- package/dist/cases/not-found-page.md +0 -4
- package/dist/cases/notification-menu/menu.d.ts +1 -0
- package/dist/cases/notification-menu/menu.jsx +74 -0
- package/dist/cases/notification-menu.md +135 -0
- package/dist/cases/oauth-consent.md +0 -4
- package/dist/cases/on-off-settings/list.d.ts +1 -0
- package/dist/cases/on-off-settings/list.jsx +97 -0
- package/dist/cases/on-off-settings.md +116 -0
- package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
- package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
- package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
- package/dist/cases/overflow-menu.md +410 -0
- package/dist/cases/profile-form/form.d.ts +1 -0
- package/dist/cases/profile-form/form.jsx +153 -0
- package/dist/cases/profile-form.md +236 -0
- package/dist/cases/quick-switcher/modal.d.ts +1 -0
- package/dist/cases/quick-switcher/modal.jsx +114 -0
- package/dist/cases/quick-switcher.md +205 -0
- package/dist/cases/range-switch/segmented.d.ts +1 -0
- package/dist/cases/range-switch/segmented.jsx +30 -0
- package/dist/cases/range-switch.md +67 -0
- package/dist/cases/rename.md +0 -4
- package/dist/cases/reply-feedback.md +0 -4
- package/dist/cases/reply-sources.md +0 -4
- package/dist/cases/route-loading.md +0 -2
- package/dist/cases/scope-picker/menu.d.ts +1 -0
- package/dist/cases/scope-picker/menu.jsx +47 -0
- package/dist/cases/scope-picker.md +97 -0
- package/dist/cases/set-new-password.md +0 -4
- package/dist/cases/settings-page/side-nav.d.ts +1 -0
- package/dist/cases/settings-page/side-nav.jsx +171 -0
- package/dist/cases/settings-page/top-tabs.d.ts +1 -0
- package/dist/cases/settings-page/top-tabs.jsx +129 -0
- package/dist/cases/settings-page.md +378 -0
- package/dist/cases/settings-save.md +35 -0
- package/dist/cases/sign-up-page.md +1 -5
- package/dist/cases/slash-command-list.md +0 -4
- package/dist/cases/success-feedback.md +0 -4
- package/dist/cases/tag-filter/tags.d.ts +1 -0
- package/dist/cases/tag-filter/tags.jsx +226 -0
- package/dist/cases/tag-filter.md +298 -0
- package/dist/cases/type-to-confirm.md +0 -4
- package/dist/cases/typing-and-status.md +0 -4
- package/dist/cases/unsaved-changes-guard.md +0 -4
- package/dist/cases/upgrade-prompt.md +0 -4
- package/dist/cases.json +1038 -263
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +2 -2
- package/dist/components/button.jsx +5 -2
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +2 -2
- package/dist/components/copyField.d.ts +20 -0
- package/dist/components/copyField.jsx +99 -0
- package/dist/components/formField.d.ts +34 -0
- package/dist/components/formField.jsx +28 -0
- package/dist/components/heading.d.ts +3 -1
- package/dist/components/heading.jsx +2 -2
- package/dist/components/menu.jsx +2 -2
- package/dist/components/menuItem.d.ts +4 -2
- package/dist/components/menuItem.jsx +3 -3
- package/dist/components/navigation.d.ts +9 -1
- package/dist/components/navigation.jsx +15 -3
- package/dist/components/radioGroup.d.ts +5 -1
- package/dist/components/radioGroup.jsx +2 -2
- package/dist/components/segmentedControl.d.ts +22 -0
- package/dist/components/segmentedControl.jsx +54 -0
- package/dist/components/select.d.ts +5 -1
- package/dist/components/select.jsx +2 -2
- package/dist/components/settingsSection.d.ts +31 -0
- package/dist/components/settingsSection.jsx +58 -0
- package/dist/components/slidingIndicator.d.ts +50 -0
- package/dist/components/slidingIndicator.jsx +102 -0
- package/dist/components/switch.d.ts +25 -0
- package/dist/components/switch.jsx +55 -0
- package/dist/components/tab.jsx +5 -11
- package/dist/components/tabsContainer.jsx +5 -67
- package/dist/components/textField.d.ts +12 -2
- package/dist/components/textField.jsx +11 -4
- package/dist/components/textarea.d.ts +5 -1
- package/dist/components/textarea.jsx +3 -3
- package/dist/components/useHotkey.d.ts +7 -0
- package/dist/components/useHotkey.js +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/internal/copyField.d.ts +5 -0
- package/dist/internal/copyField.js +61 -0
- package/dist/internal/hotkey.d.ts +16 -0
- package/dist/internal/hotkey.js +20 -0
- package/dist/internal/switch.d.ts +5 -0
- package/dist/internal/switch.js +9 -0
- package/dist/native-mapping.json +30 -0
- package/dist/stories/Cases.generated.stories.d.ts +23 -0
- package/dist/stories/Cases.generated.stories.jsx +46 -0
- package/dist/stories/CopyField.stories.d.ts +11 -0
- package/dist/stories/CopyField.stories.jsx +65 -0
- package/dist/stories/FormField.stories.d.ts +6 -0
- package/dist/stories/FormField.stories.jsx +44 -0
- package/dist/stories/Navigation.stories.d.ts +1 -0
- package/dist/stories/Navigation.stories.jsx +17 -1
- package/dist/stories/SegmentedControl.stories.d.ts +8 -0
- package/dist/stories/SegmentedControl.stories.jsx +33 -0
- package/dist/stories/SettingsSection.stories.d.ts +11 -0
- package/dist/stories/SettingsSection.stories.jsx +64 -0
- package/dist/stories/Switch.stories.d.ts +14 -0
- package/dist/stories/Switch.stories.jsx +87 -0
- package/dist/stories/TextField.stories.d.ts +1 -0
- package/dist/stories/TextField.stories.jsx +13 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -70,13 +70,13 @@ import SectionIntro from 'oneslash-design-system/components/sectionIntro';
|
|
|
70
70
|
|
|
71
71
|
## Design cases
|
|
72
72
|
|
|
73
|
-
A case is one design situation with oneSlash's answer to it. A rule case has one answer, such as "an agent asks before a risky action". A design case has one to four options, each with a line on when to use it and a working example built only from this package. 2.
|
|
73
|
+
A case is one design situation with oneSlash's answer to it. A rule case has one answer, such as "an agent asks before a risky action". A design case has one to four options, each with a line on when to use it and a working example built only from this package. 2.18.0 has 74: eleven rules and 63 design cases for auth pages, confirms and modals, states, chat and agent interfaces, settings and menus.
|
|
74
74
|
|
|
75
75
|
- `oneslash-design-system/cases.json` lists every case with its rule text, options, Do and Don't lines, and the source of each example.
|
|
76
76
|
- `oneslash-design-system/cases/<id>.md` is one case as text, and `oneslash-design-system/cases/<id>/<option>.jsx` is the example itself.
|
|
77
77
|
- The Cases section of [DESIGN.md](./dist/DESIGN.md) is the same list for an agent to read.
|
|
78
78
|
|
|
79
|
-
The source is `cases/<id>/case.js` plus one `.tsx` file per option. `npm run build` checks each example uses only ODS parts and writes the files above.
|
|
79
|
+
The source is `cases/<id>/case.js` plus one `.tsx` file per option. `npm run build` checks each example uses only ODS parts and writes the files above. Which products follow a case (`notBuiltYet`, `seenIn`) stays in the repo and is not published; a published field or example that names a product fails the build.
|
|
80
80
|
|
|
81
81
|
## Releasing
|
|
82
82
|
|
package/dist/DESIGN.md
CHANGED
|
@@ -296,10 +296,12 @@ For each web component, the table gives the native control to use. System contro
|
|
|
296
296
|
| brandIcon | the provider's own button where one exists (`SignInWithAppleButton`), else an asset in the app | an asset in the app | |
|
|
297
297
|
| checkBox | `Toggle` (switch on iOS, `.toggleStyle(.checkbox)` on macOS) | `Checkbox` | |
|
|
298
298
|
| composer | `TextField(_:text:axis: .vertical)` with `.lineLimit(1...6)` over a toolbar `HStack` of the tool `Button`s and a send `Button` | `OutlinedTextField` with `maxLines = 6` over a `Row` of the tool `IconButton`s and a send `IconButton` | On iPhone and Android, Return adds a line and the send button sends. While an agent works, send becomes Stop. |
|
|
299
|
+
| copyField | A `LabeledContent` row with the value in a `Text` (`.textSelection(.enabled)`) and a `Button` that sets `UIPasteboard` / `NSPasteboard` | An `OutlinedTextField` with `readOnly = true` and a `trailingIcon` `TextButton` that calls `LocalClipboard` | Show "Copied" for 2 seconds only after the write succeeds. Announce it for VoiceOver / TalkBack. A secret shown once gets the line under it. |
|
|
299
300
|
| emptyBox | `ContentUnavailableView` | `OdsEmptyState` | The system has this control on Apple, so ODS adds no part there. Material has none, so ODS does. |
|
|
300
301
|
| factsRow | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: `LabeledContent` rows in a `Form` / `ListItem` rows. |
|
|
301
302
|
| figure | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: an `Image` with a caption `Text` in the caption text style. |
|
|
302
303
|
| fileChip | A capsule `Label` (`.labelStyle(.titleAndIcon)`) with the file icon, the name and size, and a `Button` with `xmark.circle.fill` to remove it | An `InputChip` with a `trailingIcon` that removes it | An uploading chip gets a `ProgressView`; a failed one an alert symbol, not color alone. Say the state in the VoiceOver / TalkBack label. |
|
|
304
|
+
| formField | A `Section` in a `Form`: the control carries its own label, `footer:` holds the help or error text | The field's `label`, `supportingText` and `isError` on an `OutlinedTextField`; a `Column` with a supporting `Text` for other controls | On Apple the system ties the label to the control; do not add one. Say the error in the VoiceOver / TalkBack text, not color alone. |
|
|
303
305
|
| form | `Form` | A `Column` of fields; submit from the keyboard action | On Apple the system lays the fields out; do not add spacing. |
|
|
304
306
|
| heading | `Text` with the type role's text style and `.accessibilityAddTraits(.isHeader)` | `Text` with the type role's `MaterialTheme.typography` style and `Modifier.semantics { heading() }` | |
|
|
305
307
|
| icon | `Image(systemName:)` (SF Symbols) | Material Symbols | |
|
|
@@ -323,10 +325,13 @@ For each web component, the table gives the native control to use. System contro
|
|
|
323
325
|
| popover | `.popover` | `DropdownMenu` | Larger anchored content on Android: `ModalBottomSheet`. |
|
|
324
326
|
| radioGroup | `Picker` (`.inline` on iOS, `.radioGroup` on macOS) | `RadioButton`s in a `Column` with `Modifier.selectableGroup()` | `variant="card"`: each option is a bordered card with the radio in it, a `Picker` with custom rows on iOS / selectable `Card`s with a `RadioButton` in a `selectableGroup` on Android. |
|
|
325
327
|
| sectionIntro | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `Section` header in a `List` or `Form` / a heading `Text`. |
|
|
328
|
+
| segmentedControl | `Picker` with `.pickerStyle(.segmented)` | `SingleChoiceSegmentedButtonRow` with `SegmentedButton` | It sets a value on the same screen. To switch panels use `TabView` / `PrimaryTabRow`. Give the picker an accessibility label. |
|
|
326
329
|
| select | `Picker` or `Menu` | `ExposedDropdownMenuBox` | |
|
|
330
|
+
| settingsSection | A `Section` with a header `Text` and footer `Text` in a grouped `Form` | A `Column` with a title `Text`, a supporting `Text` and the controls under a `HorizontalDivider` | A danger zone gets its own `Section` with the error color on the header. Settings Columns is a screen layout: one column on a phone. For Settings Layout, on a phone the nav is its own screen, pushed with `NavigationStack` / `NavHost`. |
|
|
327
331
|
| sourceCard | `Link` or `Button` with a `Label` (icon, title) and the meta as a secondary line | A `Card` with `onClick`, or a `ListItem` with a leading `Icon` | With no destination it is a plain `Label`, not a button. |
|
|
328
332
|
| stepList | A `List` of `Label`s with an SF Symbol per status (`circle`, `checkmark.circle.fill`, `xmark.circle.fill`, `minus.circle`); `ProgressView` for the running one | A `Column` of `ListItem`s with an `Icon` per status; `CircularProgressIndicator` for the running one | Give each row a status text for VoiceOver / TalkBack, not color alone. |
|
|
329
333
|
| surface | Not applicable: web page pattern | Not applicable: web page pattern | In an app screen: a `Form` section or `GroupBox` / `Card`. |
|
|
334
|
+
| switch | `Toggle` in a `Form` row (`.toggleStyle(.switch)`); the description is the row's secondary line | `Switch` in a `ListItem` with `trailingContent` | While a change saves, disable the control or show a `ProgressView` / `CircularProgressIndicator` beside it and put the value back if it fails. |
|
|
330
335
|
| tab | `TabView` or segmented `Picker` | `PrimaryTabRow` | One `Tab` inside `TabView` or one segment / one `Tab`. `TabRow` is deprecated in Material 3. |
|
|
331
336
|
| tableCell | A `TableColumn` content view | `Text` in a `Row` with `Modifier.weight` | Material 3 has no table. |
|
|
332
337
|
| tableContainer | `Table` | `LazyColumn` of `Row`s | Material 3 has no table. A compact-width iPhone `Table` shows only its first column. |
|
|
@@ -389,8 +394,6 @@ The agent is about to do something that changes shared work or is hard to undo.
|
|
|
389
394
|
|
|
390
395
|
Answer: An action is risky when it changes shared work or is hard to undo. In a product that works with code, that includes opening or merging a pull request, deleting files, closing an issue and rolling back a release. Carrying out a plan of several changes is risky too. Before a risky action the agent stops and posts a card with the exact action: every step it will take, or the changes themselves, which the person can open. The agent does nothing until the person presses the approve button.
|
|
391
396
|
|
|
392
|
-
**Not built yet:** In Scindo the agent asks before carrying out a plan, opening a pull request and merging one. It does not yet ask before deleting files, closing an issue or rolling back a release.
|
|
393
|
-
|
|
394
397
|
File: cases/agent-asks-before-risky-action.md
|
|
395
398
|
|
|
396
399
|
### An agent cancels and reports when nobody answers
|
|
@@ -399,8 +402,6 @@ The agent has asked a question or proposed an action, and nobody answers.
|
|
|
399
402
|
|
|
400
403
|
Answer: The agent never takes silence as a yes: while a question or proposal waits, it does nothing that depends on the answer. Each product sets the waiting time and shows it on the waiting card. When the time is up, the agent cancels the request, marks the card Cancelled, and posts one line saying what it did not do. The agent may write a plan that lists the unanswered questions as open questions. It may not carry out anything that depends on an answer.
|
|
401
404
|
|
|
402
|
-
**Not built yet:** No product cancels a waiting request on its own yet. In Scindo a request waits until a person answers, cancels or skips it, and the waiting time is not decided.
|
|
403
|
-
|
|
404
405
|
File: cases/agent-cancels-when-unanswered.md
|
|
405
406
|
|
|
406
407
|
### An agent refuses clearly
|
|
@@ -409,8 +410,6 @@ The product will not let the agent answer a request, for example because the wor
|
|
|
409
410
|
|
|
410
411
|
Answer: The refusal says in one plain sentence which limit was reached, and either who can change it or when to try again. A person who can lift the limit gets the one button that does it, such as Upgrade or Change Budget Cap. When an admin can lift the limit, everyone else is told to ask a workspace admin. A limit that passes with time says when to try again instead.
|
|
411
412
|
|
|
412
|
-
**Not built yet:** Scindo on the web does not follow this yet: it shows the Upgrade button to everyone. Scindo's Apple app shows it only to admins.
|
|
413
|
-
|
|
414
413
|
File: cases/agent-refuses-clearly.md
|
|
415
414
|
|
|
416
415
|
### An agent says what it is
|
|
@@ -443,8 +442,6 @@ An action a person takes themselves needs their yes before it happens. An action
|
|
|
443
442
|
|
|
444
443
|
Answer: A confirm is a Modal with `size="small"`. Its title names the action in Title Case, such as 'Delete Project'. The body says in one or two sentences what will happen and what is kept. Two Buttons sit in the Modal's `actions`. 'Cancel' comes first, a `<Button type="tertiary" size="small">`. Then comes the action, a `<Button type="primary" size="small">` labelled in Title Case with the same verb as the title. When the action destroys or removes something, the action Button also has `color="danger"`. One case differs: 'Unsaved changes'. Its guard may have three Buttons, 'Cancel', "Don't Save" and 'Save', in that order. When it has two, its safe Button reads 'Keep Editing'. Escape and a click outside the Modal mean Cancel. While the request runs, the action Button is `loading` and keeps its label, and 'Cancel' is `state="disabled"`. The Modal stays open. It still calls `onClose` on Escape or a click outside, and the page ignores that call until the request ends. If the request fails, the Modal stays open and shows an inline error Alert at the top of its body, as the rule 'A form error shows next to the problem' says. When the action works, the Modal closes. If the thing is still on screen, the change shows where it is. If the thing is gone, a toast names it, as the rule 'Success shows where the person is looking' says.
|
|
445
444
|
|
|
446
|
-
**Not built yet:** No Commentify confirm Modal uses `color="danger"`, and two of them label Cancel 'No'. Scindo on the web makes Cancel a secondary Button in some confirms and a tertiary one in others. It leaves its Delete Task and Remove Member confirms uncolored. Scindo on the web revokes an API key, and Commentify revokes an agent client, with no confirm.
|
|
447
|
-
|
|
448
445
|
File: cases/confirm-dialogs.md
|
|
449
446
|
|
|
450
447
|
### An empty list says what will fill it
|
|
@@ -453,8 +450,6 @@ A list, table or pane has nothing to show.
|
|
|
453
450
|
|
|
454
451
|
Answer: Use `EmptyBox`, never a bare line of text. Its `size` is `large` when the list fills the whole region and `small` inside a section. The `text` says what is empty, in the person's words and in sentence case: 'No saved comments'. The `secondText` says what will appear here or what to do. When the person can fix it, pass the Button as `action`. The action Button is primary when it fills the list or tries again, and secondary when it is 'Clear Search'. An empty search shows the words searched for and a 'Clear Search' Button. A failed load is not an empty list: say that loading failed and offer a 'Try Again' Button. `EmptyBox` may hold that message, with 'Try Again' as its `action`, but never the empty text.
|
|
455
452
|
|
|
456
|
-
**Not built yet:** Scindo on the web uses `EmptyBox` in three places and bare text elsewhere, such as 'No API keys yet.' Commentify uses `EmptyBox` in most lists and bare text in a few. Commentify admin and jinhwankim.com show bare text. No product passes an `action` yet.
|
|
457
|
-
|
|
458
453
|
File: cases/empty-lists.md
|
|
459
454
|
|
|
460
455
|
### A form error shows next to the problem
|
|
@@ -463,34 +458,43 @@ A form was submitted and something is wrong.
|
|
|
463
458
|
|
|
464
459
|
Answer: A problem with one field shows under that field, through the field's `error` and `errorText`. A problem with the whole request shows above the fields in `<Alert type="error" variant="inline" showCloseButton>`, so it stays until the person closes it or submits again. Its `onClose` clears the message; if it does not, the Alert comes back. While the request runs, the submit Button is `loading` and keeps its label. The form keeps what the person typed. The next submit clears the old messages. Messages are in sentence case. It is never a colored caption written by hand, and never the browser's `alert()`.
|
|
465
460
|
|
|
466
|
-
**Not built yet:** Commentify writes red captions by hand on its consent screen and in its Figma import dialog. Scindo on the web does the same in its dialogs, such as renaming a workspace or a task. Commentify uses the browser's `alert()` in three files, and Scindo on the web in one.
|
|
467
|
-
|
|
468
461
|
File: cases/form-errors.md
|
|
469
462
|
|
|
463
|
+
### A setting saves in place, or with one Save Button
|
|
464
|
+
|
|
465
|
+
A person changes a setting.
|
|
466
|
+
|
|
467
|
+
Answer: A control that stands alone saves as soon as it changes: a `Switch`, a choice in a `RadioGroup` or a `Select`, or a picture the person chooses. It shows nothing on success, because the control already shows the new value. While the request runs it is busy: a `Switch` takes `busy`, and a `RadioGroup` or `Select` is disabled. If the save fails, the control goes back to its old value and says why next to itself: in a Switch's `error`, in the error line of its `FormField`, or in an inline error `Alert` under a control with no visible label, such as a role in a row. A group of fields that belong together, such as a name, a profile, instructions or a budget, has one Save Button for the whole group. The Button is `loading` while it saves, keeps its label, then reads 'Saved' for 2 seconds. It is disabled while nothing has changed. A group that fails to save follows the rule 'A form error shows next to the problem'. Leaving with unsaved changes follows the case 'Unsaved changes'. Never mix both in one group: a Switch beside a Save Button leaves the person unsure which one is saved. Never show a toast for a setting saved in place. The one exception is a setting chosen from a menu: the menu closes, so a failed save shows in a toast and the control goes back to its old value. A person who cannot change a setting sees it read-only, with one line that says who can change it.
|
|
468
|
+
|
|
469
|
+
File: cases/settings-save.md
|
|
470
|
+
|
|
470
471
|
### Success shows where the person is looking
|
|
471
472
|
|
|
472
473
|
Something the person did has worked.
|
|
473
474
|
|
|
474
475
|
Answer: The feedback depends on where the result shows. A Button that is `loading` keeps its label, and the spinner shows that it is working. Only success changes a label, and there are three success labels: 'Saved', 'Copied' and 'Sent', each for 2 seconds. When a form saves in place, its Button is `loading`, then reads 'Saved' for 2 seconds, then its own label again. There is no toast. Sometimes the result is somewhere else or gone. Something was deleted, sent, moved or duplicated somewhere else, or a long job has finished. Then call `toast({ type: 'success', message: '…' })` with one short sentence in the past tense, in sentence case. It closes after 5 seconds. When something is copied to the clipboard, a Button reads 'Copied' for 2 seconds, and an IconButton swaps its icon to `Check` for 2 seconds. When Copy is a menu item, the menu closes, so a toast says 'Message copied.' instead. When a Button sends an email again, it reads 'Sent' for 2 seconds. The message names the thing and does not say 'successfully'.
|
|
475
476
|
|
|
476
|
-
**Not built yet:** Scindo on the web has no toast. It shows success in five ways: a 'Saved' Button label, a green caption, an inline Alert, a thank-you that replaces a dialog and a 'Copied' label. The timed ones clear after 1.5, 2, 3 or 4 seconds. Commentify shows toasts through `Alert`, one at a time, and many of them say 'successfully'.
|
|
477
|
-
|
|
478
477
|
File: cases/success-feedback.md
|
|
479
478
|
|
|
480
479
|
| Case | When | File |
|
|
481
480
|
| --- | --- | --- |
|
|
482
481
|
| Invite link page | A person opens an invite link to join a workspace. | cases/accept-invite.md |
|
|
482
|
+
| Account menu | A person opens a menu for their own account to change settings, get help or log out. | cases/account-menu.md |
|
|
483
483
|
| Agent options | The agent sees two to four ways forward and needs the person to pick one. These are ways forward for the agent's own work. For a fact or a decision only the person has, see the case 'Agent question'. | cases/agent-options.md |
|
|
484
484
|
| Agent at work | The agent is working on a request in the thread, and its reply is not ready yet. | cases/agent-pending-reply.md |
|
|
485
485
|
| Plan proposal | The agent is about to change shared work and needs the person to approve it first. | cases/agent-plan-proposal.md |
|
|
486
486
|
| Agent question | The agent needs an answer from the person before it can go on. It needs a fact or a decision only the person has. For ways forward in its own work, see the case 'Agent options'. | cases/agent-question.md |
|
|
487
|
+
| Agent settings | An admin sets which model the agent uses, how it picks one, what it should know about the team and how much it may spend. | cases/agent-settings.md |
|
|
488
|
+
| API keys | A person makes keys that let a script or a service use the product as them, and revokes keys they no longer use. | cases/api-keys.md |
|
|
487
489
|
| Document card | The agent made a document for the person, such as a plan or a report. | cases/artifact-card.md |
|
|
488
490
|
| Login check loading | The app is checking whether the person is logged in, or running a step such as checking an invite, before it knows what to show. | cases/auth-gate-loading.md |
|
|
489
491
|
| Check your email | A person signed up, and the product sent a link to confirm their email. | cases/check-your-email.md |
|
|
492
|
+
| Collapsible search | A person filters a list by a word, and the list should keep its room when they are not typing. | cases/collapsible-search.md |
|
|
490
493
|
| Composer at a limit | The agent cannot be called from the composer because the workspace reached a limit, such as its agent replies for the month. | cases/composer-limit.md |
|
|
491
494
|
| Delete confirm | A person asks to delete or remove something, and it cannot be undone. | cases/confirm-destructive-action.md |
|
|
492
495
|
| Conversation starters | A thread has no messages yet, and the person may not know what to write first. | cases/conversation-starters.md |
|
|
493
496
|
| Create modal | A person creates something new, such as a project or a task, and it needs a name before it exists. | cases/create-modal.md |
|
|
497
|
+
| Danger zone | A settings page offers actions that are hard or impossible to undo, such as deleting an account or a workspace, or leaving one. | cases/danger-zone.md |
|
|
494
498
|
| Device login | A CLI, an editor or another app opened the browser so the person can log in, and the login must reach that app. | cases/device-login.md |
|
|
495
499
|
| Email confirmed | A person opened the link that confirms their email. | cases/email-confirmed.md |
|
|
496
500
|
| Empty list | A list has loaded, and there is nothing in it yet. | cases/empty-list.md |
|
|
@@ -498,13 +502,16 @@ File: cases/success-feedback.md
|
|
|
498
502
|
| Empty search | A search or a filter finds nothing. | cases/empty-search.md |
|
|
499
503
|
| Error page | Something broke while showing a page, and the app cannot show it. | cases/error-page.md |
|
|
500
504
|
| Feedback form | A person sends feedback about the product from inside it. | cases/feedback-form.md |
|
|
505
|
+
| Filter menu | A person narrows a list by one choice, such as a date range, or turns the filter off. | cases/filter-menu.md |
|
|
501
506
|
| Forgot password | A person cannot remember their password and asks for a link to set a new one. | cases/forgot-password.md |
|
|
502
507
|
| Import checklist | A person picks which items to bring in from another place, such as pages from a wiki. | cases/import-checklist.md |
|
|
503
508
|
| Form feedback | A person submits a small form, such as a settings field, and the request ends. The three options are the three outcomes of one save: it worked in place, it failed, or the result is elsewhere. | cases/inline-form-feedback.md |
|
|
509
|
+
| Integrations | A person connects the product to other tools, sees which ones are connected and disconnects them. | cases/integrations-list.md |
|
|
504
510
|
| Member invite | A person invites someone to join a workspace. | cases/invite-member.md |
|
|
505
511
|
| Load failure | A list or a section could not load. | cases/load-failure.md |
|
|
506
512
|
| Log-out confirm | A person chooses Log Out. | cases/log-out-confirm.md |
|
|
507
513
|
| Login page | A person who already has an account opens the product and is not logged in. | cases/login-page.md |
|
|
514
|
+
| Members | An admin sees who is in the workspace, changes their roles, removes people and invites more. | cases/members-list.md |
|
|
508
515
|
| Mention list | A person types @ in the message box to name someone, or the agent. | cases/mention-list.md |
|
|
509
516
|
| Message actions | A person acts on one message: reacts to it, copies it, edits or deletes it. | cases/message-actions.md |
|
|
510
517
|
| Attachments | A person adds files to a message, and people open the files in a message that was sent. | cases/message-attachments.md |
|
|
@@ -513,14 +520,23 @@ File: cases/success-feedback.md
|
|
|
513
520
|
| Reactions | People answer a message with an emoji instead of a reply. | cases/message-reactions.md |
|
|
514
521
|
| Message row | A thread shows messages from people, and sometimes from an agent. | cases/message-row.md |
|
|
515
522
|
| Page not found | A person opens a link to a page that does not exist. | cases/not-found-page.md |
|
|
523
|
+
| Notification setting | A person chooses how much a channel or a thread notifies them. | cases/notification-menu.md |
|
|
516
524
|
| OAuth consent | Another app, such as a CLI or an MCP client, asks to act for a person who is logged in, and the person must allow it. | cases/oauth-consent.md |
|
|
525
|
+
| On and off settings | A person turns things on and off, such as which notifications they get. | cases/on-off-settings.md |
|
|
526
|
+
| More menu | A person opens a menu of less common actions, behind one button, for a thing or for the page. | cases/overflow-menu.md |
|
|
527
|
+
| Profile | A person changes how they appear and how they sign in: their picture, their name and their password. | cases/profile-form.md |
|
|
528
|
+
| Quick switcher | A person jumps to a channel, task or document by typing part of its name, from anywhere in the product. | cases/quick-switcher.md |
|
|
529
|
+
| Range switch | A person changes the time range of a chart or a list on the same page, such as Week, Month or Quarter. | cases/range-switch.md |
|
|
517
530
|
| Rename | A person renames something, such as a project or a channel. | cases/rename.md |
|
|
518
531
|
| Reply feedback | The agent has replied, and the person can say whether the reply helped. | cases/reply-feedback.md |
|
|
519
532
|
| Reply sources | The agent answered from things it read, and the person may want to check them. | cases/reply-sources.md |
|
|
520
533
|
| Page loading | A page or a pane is loading, and there is nothing to show yet. | cases/route-loading.md |
|
|
534
|
+
| Scope picker | A person chooses where a search or a question looks, such as one workspace or all of them. | cases/scope-picker.md |
|
|
521
535
|
| Set new password | A person opened the link to reset their password and now chooses a new one. | cases/set-new-password.md |
|
|
536
|
+
| Settings page | A person opens the settings of the product and looks for one area, such as Profile or Billing. | cases/settings-page.md |
|
|
522
537
|
| Sign-up page | A person who has no account yet opens the product and wants one. | cases/sign-up-page.md |
|
|
523
538
|
| Command list | A person types / at the start of the message box to run a command. | cases/slash-command-list.md |
|
|
539
|
+
| Tag filter | A person filters a list by a tag, and adds, renames and deletes the tags themselves. | cases/tag-filter.md |
|
|
524
540
|
| Type to confirm | A person asks to delete something large that cannot be brought back, such as a workspace or an account. | cases/type-to-confirm.md |
|
|
525
541
|
| Typing line | Other people in the thread are writing a message that has not arrived yet. | cases/typing-and-status.md |
|
|
526
542
|
| Unsaved changes | A person closes or leaves something they changed and did not save. | cases/unsaved-changes-guard.md |
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person opens an invite link to join a workspace.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web labels its Buttons 'Log in' and 'Create account' in sentence case, and shows 'Please wait' under its spinner. Its wrong-account Button reads 'Sign out and switch accounts'.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Name the workspace in a `Heading` with `level={1}`: "You're invited to Acme Design".
|
|
@@ -156,6 +154,4 @@ export default function AcceptInviteSignedIn() {
|
|
|
156
154
|
|
|
157
155
|
## Native
|
|
158
156
|
|
|
159
|
-
On Apple,
|
|
160
|
-
|
|
161
|
-
Seen in: Scindo.
|
|
157
|
+
On Apple, joining works from a sheet with the invite link or code in a field. 'Cancel' and 'Join' sit in the toolbar. While it checks the invite, a small `ProgressView` sits beside a line naming the step.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AccountMenuExample(): import("react").JSX.Element;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import Modal from '../../components/modal';
|
|
4
|
+
import Heading from '../../components/heading';
|
|
5
|
+
import Paragraph from '../../components/paragraph';
|
|
6
|
+
import Button from '../../components/button';
|
|
7
|
+
import UserImage from '../../components/userImage';
|
|
8
|
+
import Popover from '../../components/popover';
|
|
9
|
+
import Menu from '../../components/menu';
|
|
10
|
+
import MenuItem from '../../components/menuItem';
|
|
11
|
+
import Line from '../../components/line';
|
|
12
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
13
|
+
// A real app reads this from the session.
|
|
14
|
+
var me = 'Dana Lee';
|
|
15
|
+
export default function AccountMenuExample() {
|
|
16
|
+
var _a = useState('Home'), view = _a[0], setView = _a[1];
|
|
17
|
+
var _b = useState(null), anchor = _b[0], setAnchor = _b[1];
|
|
18
|
+
var _c = useState(false), open = _c[0], setOpen = _c[1];
|
|
19
|
+
var _d = useState(false), confirming = _d[0], setConfirming = _d[1];
|
|
20
|
+
var _e = useState(false), loggingOut = _e[0], setLoggingOut = _e[1];
|
|
21
|
+
var _f = useState(false), loggedOut = _f[0], setLoggedOut = _f[1];
|
|
22
|
+
var timer = useRef();
|
|
23
|
+
var trigger = useRef(null);
|
|
24
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
25
|
+
var focusNext = useRef();
|
|
26
|
+
// Stops the request if the example goes away before it ends.
|
|
27
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
28
|
+
useEffect(function () {
|
|
29
|
+
var move = focusNext.current;
|
|
30
|
+
focusNext.current = undefined;
|
|
31
|
+
move === null || move === void 0 ? void 0 : move();
|
|
32
|
+
});
|
|
33
|
+
function toggle(anchorEl) {
|
|
34
|
+
setAnchor(anchorEl);
|
|
35
|
+
setOpen(function (o) { return !o; });
|
|
36
|
+
}
|
|
37
|
+
// The menu closes on any choice. Its Popover gives focus back to the trigger.
|
|
38
|
+
function go(next) {
|
|
39
|
+
setOpen(false);
|
|
40
|
+
setView(next);
|
|
41
|
+
}
|
|
42
|
+
// The confirm is the one in the case 'Log-out confirm'. Its Modal opens while the menu fades, so the Modal cannot
|
|
43
|
+
// take focus back from the menu item: 'Cancel' sends it to the trigger.
|
|
44
|
+
function askToLogOut() {
|
|
45
|
+
setOpen(false);
|
|
46
|
+
setConfirming(true);
|
|
47
|
+
}
|
|
48
|
+
function cancel() {
|
|
49
|
+
if (loggingOut)
|
|
50
|
+
return;
|
|
51
|
+
setConfirming(false);
|
|
52
|
+
focusNext.current = function () { var _a; return (_a = trigger.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
53
|
+
}
|
|
54
|
+
function logOut() {
|
|
55
|
+
if (loggingOut)
|
|
56
|
+
return;
|
|
57
|
+
setLoggingOut(true);
|
|
58
|
+
// Stands in for the request to the server.
|
|
59
|
+
timer.current = setTimeout(function () {
|
|
60
|
+
setLoggingOut(false);
|
|
61
|
+
setConfirming(false);
|
|
62
|
+
setLoggedOut(true);
|
|
63
|
+
}, 1200);
|
|
64
|
+
}
|
|
65
|
+
// A real app goes to its login page here. The example shows a short logged-out page instead.
|
|
66
|
+
if (loggedOut) {
|
|
67
|
+
return (<Center fill>
|
|
68
|
+
<Heading level={1} size="h5">You are logged out</Heading>
|
|
69
|
+
<Cluster>
|
|
70
|
+
<Button size="medium" type="primary" state="enabled" label="Log In" onClickButton={function () { setLoggedOut(false); setView('Home'); }}/>
|
|
71
|
+
</Cluster>
|
|
72
|
+
</Center>);
|
|
73
|
+
}
|
|
74
|
+
return (<Center width="page">
|
|
75
|
+
<Stack gap="large">
|
|
76
|
+
<Cluster justify="between">
|
|
77
|
+
<Heading level={1} size="h5">Acme</Heading>
|
|
78
|
+
{/* The avatar and the name are the trigger. The avatar sits beside the same name, so it is not read aloud. */}
|
|
79
|
+
<Button ref={trigger} size="small" type="tertiary" state={open ? 'selected' : 'enabled'} label={me} decoIcon={<UserImage userHandle={me} size={20} decorative/>} aria-label={"".concat(me, ", account menu")} aria-haspopup="menu" aria-expanded={open} onClickButton={function (e) { return toggle(e.currentTarget); }}/>
|
|
80
|
+
</Cluster>
|
|
81
|
+
<Paragraph tone="secondary" size="body2" measure="none">{view === 'Home' ? 'Logged in as dana@example.com.' : "You opened ".concat(view, ".")}</Paragraph>
|
|
82
|
+
</Stack>
|
|
83
|
+
<Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
|
|
84
|
+
<Menu navigable aria-label="Account" width={200}>
|
|
85
|
+
<MenuItem size="small" iconName="Settings" label="Settings" onClick={function () { return go('Settings'); }}/>
|
|
86
|
+
<MenuItem size="small" iconName="CircleHelp" label="Help" onClick={function () { return go('Help'); }}/>
|
|
87
|
+
<Line />
|
|
88
|
+
{/* Log Out is last. It destroys nothing, so it is a plain item, not a danger one. */}
|
|
89
|
+
<MenuItem size="small" iconName="LogOut" label="Log Out" onClick={askToLogOut}/>
|
|
90
|
+
</Menu>
|
|
91
|
+
</Popover>
|
|
92
|
+
<Modal isOpen={confirming} size="small" title="Log Out" onClose={cancel} actions={<>
|
|
93
|
+
<Button size="small" type="tertiary" state={loggingOut ? 'disabled' : 'enabled'} label="Cancel" onClickButton={cancel}/>
|
|
94
|
+
<Button size="small" type="primary" state="enabled" label="Log Out" loading={loggingOut} onClickButton={logOut}/>
|
|
95
|
+
</>}>
|
|
96
|
+
<Paragraph measure="none">You will need to log in again to use Acme on this device.</Paragraph>
|
|
97
|
+
</Modal>
|
|
98
|
+
</Center>);
|
|
99
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Account menu
|
|
2
|
+
|
|
3
|
+
A person opens a menu for their own account to change settings, get help or log out.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Use a small tertiary `Button` whose label is the person's name, with their `UserImage` as `decoIcon`: `decoIcon={<UserImage userHandle={name} size={20} decorative />}`.
|
|
8
|
+
- Make the avatar `decorative`. It sits beside the same name, so a screen reader reads the name once.
|
|
9
|
+
- Give the Button an `aria-label` that starts with the visible name: 'Dana Lee, account menu'.
|
|
10
|
+
- Set `aria-haspopup="menu"` and `aria-expanded` on the Button, and `state="selected"` while the menu is open.
|
|
11
|
+
- Open `<Popover returnFocus>` around `<Menu navigable aria-label="Account">` with 'Settings' and 'Help', then a `Line`, then 'Log Out' last.
|
|
12
|
+
- Use `onClick` items. A navigable menu's arrow keys skip an item with `href`.
|
|
13
|
+
- Leave 'Log Out' a plain item. It destroys nothing.
|
|
14
|
+
- Confirm 'Log Out' as the case 'Log-out confirm' says, in a small Modal. 'Cancel' puts focus back on the Button.
|
|
15
|
+
|
|
16
|
+
## Don't
|
|
17
|
+
|
|
18
|
+
- Do not show only the avatar as the trigger when the name fits. The name says whose account it is.
|
|
19
|
+
- Do not give the avatar its own name beside the same name.
|
|
20
|
+
- Do not use 'Sign Out'. The words are 'Log In' and 'Log Out'.
|
|
21
|
+
- Do not give 'Log Out' `color="danger"`.
|
|
22
|
+
- Do not open the menu when the page loads.
|
|
23
|
+
|
|
24
|
+
## Example: Avatar and name with a menu
|
|
25
|
+
|
|
26
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Line`, `Menu`, `MenuItem`, `Modal`, `Paragraph`, `Popover`, `Stack`, `UserImage`
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
'use client';
|
|
30
|
+
import { useEffect, useRef, useState } from 'react';
|
|
31
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
32
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
33
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
34
|
+
import Button from 'oneslash-design-system/components/button';
|
|
35
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
36
|
+
import Popover from 'oneslash-design-system/components/popover';
|
|
37
|
+
import Menu from 'oneslash-design-system/components/menu';
|
|
38
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
39
|
+
import Line from 'oneslash-design-system/components/line';
|
|
40
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
41
|
+
|
|
42
|
+
// A real app reads this from the session.
|
|
43
|
+
const me = 'Dana Lee';
|
|
44
|
+
|
|
45
|
+
export default function AccountMenuExample() {
|
|
46
|
+
const [view, setView] = useState('Home');
|
|
47
|
+
const [anchor, setAnchor] = useState<HTMLElement | null>(null);
|
|
48
|
+
const [open, setOpen] = useState(false);
|
|
49
|
+
const [confirming, setConfirming] = useState(false);
|
|
50
|
+
const [loggingOut, setLoggingOut] = useState(false);
|
|
51
|
+
const [loggedOut, setLoggedOut] = useState(false);
|
|
52
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
53
|
+
const trigger = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
|
|
54
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
55
|
+
const focusNext = useRef<() => void>();
|
|
56
|
+
|
|
57
|
+
// Stops the request if the example goes away before it ends.
|
|
58
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
59
|
+
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const move = focusNext.current;
|
|
62
|
+
focusNext.current = undefined;
|
|
63
|
+
move?.();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
function toggle(anchorEl: HTMLElement) {
|
|
67
|
+
setAnchor(anchorEl);
|
|
68
|
+
setOpen((o) => !o);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// The menu closes on any choice. Its Popover gives focus back to the trigger.
|
|
72
|
+
function go(next: string) {
|
|
73
|
+
setOpen(false);
|
|
74
|
+
setView(next);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// The confirm is the one in the case 'Log-out confirm'. Its Modal opens while the menu fades, so the Modal cannot
|
|
78
|
+
// take focus back from the menu item: 'Cancel' sends it to the trigger.
|
|
79
|
+
function askToLogOut() {
|
|
80
|
+
setOpen(false);
|
|
81
|
+
setConfirming(true);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function cancel() {
|
|
85
|
+
if (loggingOut) return;
|
|
86
|
+
setConfirming(false);
|
|
87
|
+
focusNext.current = () => trigger.current?.focus();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function logOut() {
|
|
91
|
+
if (loggingOut) return;
|
|
92
|
+
setLoggingOut(true);
|
|
93
|
+
// Stands in for the request to the server.
|
|
94
|
+
timer.current = setTimeout(() => {
|
|
95
|
+
setLoggingOut(false);
|
|
96
|
+
setConfirming(false);
|
|
97
|
+
setLoggedOut(true);
|
|
98
|
+
}, 1200);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// A real app goes to its login page here. The example shows a short logged-out page instead.
|
|
102
|
+
if (loggedOut) {
|
|
103
|
+
return (
|
|
104
|
+
<Center fill>
|
|
105
|
+
<Heading level={1} size="h5">You are logged out</Heading>
|
|
106
|
+
<Cluster>
|
|
107
|
+
<Button size="medium" type="primary" state="enabled" label="Log In" onClickButton={() => { setLoggedOut(false); setView('Home'); }} />
|
|
108
|
+
</Cluster>
|
|
109
|
+
</Center>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Center width="page">
|
|
115
|
+
<Stack gap="large">
|
|
116
|
+
<Cluster justify="between">
|
|
117
|
+
<Heading level={1} size="h5">Acme</Heading>
|
|
118
|
+
{/* The avatar and the name are the trigger. The avatar sits beside the same name, so it is not read aloud. */}
|
|
119
|
+
<Button
|
|
120
|
+
ref={trigger}
|
|
121
|
+
size="small"
|
|
122
|
+
type="tertiary"
|
|
123
|
+
state={open ? 'selected' : 'enabled'}
|
|
124
|
+
label={me}
|
|
125
|
+
decoIcon={<UserImage userHandle={me} size={20} decorative />}
|
|
126
|
+
aria-label={`${me}, account menu`}
|
|
127
|
+
aria-haspopup="menu"
|
|
128
|
+
aria-expanded={open}
|
|
129
|
+
onClickButton={(e: { currentTarget: HTMLElement }) => toggle(e.currentTarget)}
|
|
130
|
+
/>
|
|
131
|
+
</Cluster>
|
|
132
|
+
<Paragraph tone="secondary" size="body2" measure="none">{view === 'Home' ? 'Logged in as dana@example.com.' : `You opened ${view}.`}</Paragraph>
|
|
133
|
+
</Stack>
|
|
134
|
+
<Popover open={open} anchorEl={anchor} onClose={() => setOpen(false)} returnFocus>
|
|
135
|
+
<Menu navigable aria-label="Account" width={200}>
|
|
136
|
+
<MenuItem size="small" iconName="Settings" label="Settings" onClick={() => go('Settings')} />
|
|
137
|
+
<MenuItem size="small" iconName="CircleHelp" label="Help" onClick={() => go('Help')} />
|
|
138
|
+
<Line />
|
|
139
|
+
{/* Log Out is last. It destroys nothing, so it is a plain item, not a danger one. */}
|
|
140
|
+
<MenuItem size="small" iconName="LogOut" label="Log Out" onClick={askToLogOut} />
|
|
141
|
+
</Menu>
|
|
142
|
+
</Popover>
|
|
143
|
+
<Modal
|
|
144
|
+
isOpen={confirming}
|
|
145
|
+
size="small"
|
|
146
|
+
title="Log Out"
|
|
147
|
+
onClose={cancel}
|
|
148
|
+
actions={
|
|
149
|
+
<>
|
|
150
|
+
<Button size="small" type="tertiary" state={loggingOut ? 'disabled' : 'enabled'} label="Cancel" onClickButton={cancel} />
|
|
151
|
+
<Button size="small" type="primary" state="enabled" label="Log Out" loading={loggingOut} onClickButton={logOut} />
|
|
152
|
+
</>
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<Paragraph measure="none">You will need to log in again to use Acme on this device.</Paragraph>
|
|
156
|
+
</Modal>
|
|
157
|
+
</Center>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Native
|
|
163
|
+
|
|
164
|
+
On Apple use a toolbar `Menu` with a `Label` of the person's name, or the sidebar's account row. Put 'Log Out' last, and leave out the `.destructive` role. On Android use an avatar `IconButton` with a `DropdownMenu`.
|
|
@@ -6,8 +6,6 @@ The agent is about to do something that changes shared work or is hard to undo.
|
|
|
6
6
|
|
|
7
7
|
An action is risky when it changes shared work or is hard to undo. In a product that works with code, that includes opening or merging a pull request, deleting files, closing an issue and rolling back a release. Carrying out a plan of several changes is risky too. Before a risky action the agent stops and posts a card with the exact action: every step it will take, or the changes themselves, which the person can open. The agent does nothing until the person presses the approve button.
|
|
8
8
|
|
|
9
|
-
**Not built yet:** In Scindo the agent asks before carrying out a plan, opening a pull request and merging one. It does not yet ask before deleting files, closing an issue or rolling back a release.
|
|
10
|
-
|
|
11
9
|
## Why
|
|
12
10
|
|
|
13
11
|
A person can only approve what they can see, and an agent's mistake in shared work costs other people.
|
|
@@ -25,5 +23,3 @@ A person can only approve what they can see, and an agent's mistake in shared wo
|
|
|
25
23
|
- Do not replace the steps or the changes with a one-line summary.
|
|
26
24
|
- Do not let the agent write the label of an approve or merge button.
|
|
27
25
|
- Do not let a second click on a decided card approve or cancel it again.
|
|
28
|
-
|
|
29
|
-
Seen in: Scindo.
|
|
@@ -6,8 +6,6 @@ The agent has asked a question or proposed an action, and nobody answers.
|
|
|
6
6
|
|
|
7
7
|
The agent never takes silence as a yes: while a question or proposal waits, it does nothing that depends on the answer. Each product sets the waiting time and shows it on the waiting card. When the time is up, the agent cancels the request, marks the card Cancelled, and posts one line saying what it did not do. The agent may write a plan that lists the unanswered questions as open questions. It may not carry out anything that depends on an answer.
|
|
8
8
|
|
|
9
|
-
**Not built yet:** No product cancels a waiting request on its own yet. In Scindo a request waits until a person answers, cancels or skips it, and the waiting time is not decided.
|
|
10
|
-
|
|
11
9
|
## Why
|
|
12
10
|
|
|
13
11
|
An agent that acts on silence does work nobody approved, and one that waits forever leaves work stuck without saying so.
|
|
@@ -23,5 +21,3 @@ An agent that acts on silence does work nobody approved, and one that waits fore
|
|
|
23
21
|
|
|
24
22
|
- Do not treat no answer as approval.
|
|
25
23
|
- Do not cancel a request without saying so in the thread.
|
|
26
|
-
|
|
27
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The agent sees two to four ways forward and needs the person to pick one. These are ways forward for the agent's own work. For a fact or a decision only the person has, see the case 'Agent question'.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo's options card labels its button 'Confirm Selection', which reads 'Confirming...' while it loads, and marks a decided card 'Selected'. With no recommended option it preselects the first one. Scindo's Apple app shows no options card.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Put the card in the agent's `Message`, in a `Surface` with the question as its heading.
|
|
@@ -164,5 +162,3 @@ export default function AgentOptionsCards() {
|
|
|
164
162
|
);
|
|
165
163
|
}
|
|
166
164
|
```
|
|
167
|
-
|
|
168
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The agent is working on a request in the thread, and its reply is not ready yet.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web shows no 'Agent' tag on the progress row, its Stop is an icon button with a cross, and its current step is a blinking dot. Scindo's Apple app shows no progress row: while the agent works, Send turns into Stop.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Follow the rule 'An agent shows its progress': one row in the thread, where the reply will appear.
|
|
@@ -428,5 +426,3 @@ export default function AgentPendingReplyStreaming() {
|
|
|
428
426
|
);
|
|
429
427
|
}
|
|
430
428
|
```
|
|
431
|
-
|
|
432
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The agent is about to change shared work and needs the person to approve it first.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo's plan button reads 'Proceed' and comes first, and its buttons change label while loading, such as 'Proceeding...' and 'Cancelling...'. Its plan card has no View Changes button and shows no waiting time. Scindo's Apple app shows no plan card.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Follow the rule 'An agent asks before a risky action': the agent does nothing until the person presses 'Approve'.
|
|
@@ -652,5 +650,3 @@ export default function AgentPlanProposalChanges() {
|
|
|
652
650
|
);
|
|
653
651
|
}
|
|
654
652
|
```
|
|
655
|
-
|
|
656
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The agent needs an answer from the person before it can go on. It needs a fact or a decision only the person has. For ways forward in its own work, see the case 'Agent options'.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** A waiting question in Scindo never times out: it stays open until someone answers or skips it. Its answer button reads 'Submit', and its buttons read 'Submitting...' and 'Skipping...' while they load. With no recommended answer it preselects the first one. Scindo's Apple app shows no question card.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Put the card in the agent's `Message`, in a `Surface` with the question as its heading.
|
|
@@ -334,5 +332,3 @@ export default function AgentQuestionFreeText() {
|
|
|
334
332
|
);
|
|
335
333
|
}
|
|
336
334
|
```
|
|
337
|
-
|
|
338
|
-
Seen in: Scindo.
|
|
@@ -6,8 +6,6 @@ The product will not let the agent answer a request, for example because the wor
|
|
|
6
6
|
|
|
7
7
|
The refusal says in one plain sentence which limit was reached, and either who can change it or when to try again. A person who can lift the limit gets the one button that does it, such as Upgrade or Change Budget Cap. When an admin can lift the limit, everyone else is told to ask a workspace admin. A limit that passes with time says when to try again instead.
|
|
8
8
|
|
|
9
|
-
**Not built yet:** Scindo on the web does not follow this yet: it shows the Upgrade button to everyone. Scindo's Apple app shows it only to admins.
|
|
10
|
-
|
|
11
9
|
## Why
|
|
12
10
|
|
|
13
11
|
A person who is refused needs to know why and what to do next, or they will just send the request again.
|
|
@@ -27,5 +25,3 @@ A person who is refused needs to know why and what to do next, or they will just
|
|
|
27
25
|
## Native
|
|
28
26
|
|
|
29
27
|
On Apple the refusal is a row above the composer, with an Upgrade or Change Budget Cap button for admins and never a link to a web page.
|
|
30
|
-
|
|
31
|
-
Seen in: Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AgentSettingsForm(): import("react").JSX.Element;
|