oneslash-design-system 2.16.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 +56 -17
- package/dist/cases/accept-invite/signed-in.jsx +1 -1
- package/dist/cases/accept-invite/signed-out.jsx +1 -1
- package/dist/cases/accept-invite.md +3 -7
- 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/cards.d.ts +1 -0
- package/dist/cases/agent-options/cards.jsx +91 -0
- package/dist/cases/agent-options.md +164 -0
- package/dist/cases/agent-pending-reply/steps.d.ts +1 -0
- package/dist/cases/agent-pending-reply/steps.jsx +149 -0
- package/dist/cases/agent-pending-reply/streaming.d.ts +1 -0
- package/dist/cases/agent-pending-reply/streaming.jsx +146 -0
- package/dist/cases/agent-pending-reply.md +428 -0
- package/dist/cases/agent-plan-proposal/changes.d.ts +1 -0
- package/dist/cases/agent-plan-proposal/changes.jsx +224 -0
- package/dist/cases/agent-plan-proposal/steps.d.ts +1 -0
- package/dist/cases/agent-plan-proposal/steps.jsx +211 -0
- package/dist/cases/agent-plan-proposal.md +652 -0
- package/dist/cases/agent-question/choices.d.ts +1 -0
- package/dist/cases/agent-question/choices.jsx +132 -0
- package/dist/cases/agent-question/free-text.d.ts +1 -0
- package/dist/cases/agent-question/free-text.jsx +81 -0
- package/dist/cases/agent-question.md +334 -0
- 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 +2 -4
- 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/card.d.ts +1 -0
- package/dist/cases/artifact-card/card.jsx +45 -0
- package/dist/cases/artifact-card.md +99 -0
- 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/notice-with-action.d.ts +1 -0
- package/dist/cases/composer-limit/notice-with-action.jsx +87 -0
- package/dist/cases/composer-limit/notice.d.ts +1 -0
- package/dist/cases/composer-limit/notice.jsx +84 -0
- package/dist/cases/composer-limit.md +282 -0
- package/dist/cases/confirm-destructive-action.md +0 -4
- package/dist/cases/confirm-dialogs.md +0 -4
- package/dist/cases/conversation-starters/chips.d.ts +1 -0
- package/dist/cases/conversation-starters/chips.jsx +69 -0
- package/dist/cases/conversation-starters/none.d.ts +1 -0
- package/dist/cases/conversation-starters/none.jsx +45 -0
- package/dist/cases/conversation-starters.md +204 -0
- 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/in-composer.d.ts +1 -0
- package/dist/cases/mention-list/in-composer.jsx +169 -0
- package/dist/cases/mention-list.md +248 -0
- package/dist/cases/message-actions/hover-toolbar.d.ts +1 -0
- package/dist/cases/message-actions/hover-toolbar.jsx +229 -0
- package/dist/cases/message-actions/menu.d.ts +1 -0
- package/dist/cases/message-actions/menu.jsx +258 -0
- package/dist/cases/message-actions.md +647 -0
- package/dist/cases/message-attachments/in-composer.d.ts +1 -0
- package/dist/cases/message-attachments/in-composer.jsx +134 -0
- package/dist/cases/message-attachments/in-message.d.ts +1 -0
- package/dist/cases/message-attachments/in-message.jsx +46 -0
- package/dist/cases/message-attachments.md +306 -0
- package/dist/cases/message-composer/plain.d.ts +1 -0
- package/dist/cases/message-composer/plain.jsx +57 -0
- package/dist/cases/message-composer/with-tools.d.ts +1 -0
- package/dist/cases/message-composer/with-tools.jsx +182 -0
- package/dist/cases/message-composer.md +352 -0
- package/dist/cases/message-edit/in-place.d.ts +1 -0
- package/dist/cases/message-edit/in-place.jsx +99 -0
- package/dist/cases/message-edit.md +175 -0
- package/dist/cases/message-reactions/chips.d.ts +1 -0
- package/dist/cases/message-reactions/chips.jsx +118 -0
- package/dist/cases/message-reactions/quick-pick.d.ts +1 -0
- package/dist/cases/message-reactions/quick-pick.jsx +155 -0
- package/dist/cases/message-reactions.md +367 -0
- package/dist/cases/message-row/grouped.d.ts +1 -0
- package/dist/cases/message-row/grouped.jsx +56 -0
- package/dist/cases/message-row/person-and-agent.d.ts +1 -0
- package/dist/cases/message-row/person-and-agent.jsx +41 -0
- package/dist/cases/message-row.md +185 -0
- 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/thumbs.d.ts +1 -0
- package/dist/cases/reply-feedback/thumbs.jsx +191 -0
- package/dist/cases/reply-feedback/with-reason.d.ts +1 -0
- package/dist/cases/reply-feedback/with-reason.jsx +221 -0
- package/dist/cases/reply-feedback.md +548 -0
- package/dist/cases/reply-sources/cards.d.ts +1 -0
- package/dist/cases/reply-sources/cards.jsx +83 -0
- package/dist/cases/reply-sources/tag-only.d.ts +1 -0
- package/dist/cases/reply-sources/tag-only.jsx +45 -0
- package/dist/cases/reply-sources.md +243 -0
- 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/in-composer.d.ts +1 -0
- package/dist/cases/slash-command-list/in-composer.jsx +162 -0
- package/dist/cases/slash-command-list.md +243 -0
- package/dist/cases/success-feedback.md +1 -5
- 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/line.d.ts +1 -0
- package/dist/cases/typing-and-status/line.jsx +50 -0
- package/dist/cases/typing-and-status.md +92 -0
- package/dist/cases/unsaved-changes-guard.md +0 -4
- package/dist/cases/upgrade-prompt.md +0 -4
- package/dist/cases.json +2331 -294
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +2 -2
- package/dist/components/button.d.ts +3 -2
- package/dist/components/button.jsx +14 -9
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +2 -2
- package/dist/components/composer.d.ts +74 -0
- package/dist/components/composer.jsx +122 -0
- package/dist/components/copyField.d.ts +20 -0
- package/dist/components/copyField.jsx +99 -0
- package/dist/components/fileChip.d.ts +33 -0
- package/dist/components/fileChip.jsx +61 -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/iconButton.d.ts +3 -3
- package/dist/components/iconButton.jsx +9 -7
- package/dist/components/layout.d.ts +7 -1
- package/dist/components/layout.jsx +5 -2
- package/dist/components/menu.d.ts +21 -0
- package/dist/components/menu.jsx +27 -3
- package/dist/components/menuItem.d.ts +12 -2
- package/dist/components/menuItem.jsx +6 -5
- package/dist/components/message.d.ts +28 -0
- package/dist/components/message.jsx +25 -0
- package/dist/components/navigation.d.ts +9 -1
- package/dist/components/navigation.jsx +15 -3
- package/dist/components/paragraph.d.ts +3 -1
- package/dist/components/paragraph.jsx +2 -2
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.jsx +35 -9
- package/dist/components/radioGroup.d.ts +12 -1
- package/dist/components/radioGroup.jsx +20 -9
- 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/sourceCard.d.ts +23 -0
- package/dist/components/sourceCard.jsx +56 -0
- package/dist/components/stepList.d.ts +17 -0
- package/dist/components/stepList.jsx +79 -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/tag.d.ts +9 -1
- package/dist/components/tag.jsx +6 -4
- 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 +6 -21
- package/dist/components/useHotkey.d.ts +7 -0
- package/dist/components/useHotkey.js +24 -0
- package/dist/components/userImage.d.ts +9 -1
- package/dist/components/userImage.jsx +10 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/internal/autoGrow.d.ts +11 -0
- package/dist/internal/autoGrow.js +28 -0
- package/dist/internal/composer.d.ts +16 -0
- package/dist/internal/composer.js +18 -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/menu.d.ts +6 -0
- package/dist/internal/menu.js +31 -0
- package/dist/internal/switch.d.ts +5 -0
- package/dist/internal/switch.js +9 -0
- package/dist/native-mapping.json +62 -1
- package/dist/stories/Button.stories.d.ts +1 -0
- package/dist/stories/Button.stories.jsx +17 -1
- package/dist/stories/Cases.generated.stories.d.ts +53 -0
- package/dist/stories/Cases.generated.stories.jsx +106 -0
- package/dist/stories/Composer.stories.d.ts +23 -0
- package/dist/stories/Composer.stories.jsx +121 -0
- package/dist/stories/CopyField.stories.d.ts +11 -0
- package/dist/stories/CopyField.stories.jsx +65 -0
- package/dist/stories/FileChip.stories.d.ts +7 -0
- package/dist/stories/FileChip.stories.jsx +35 -0
- package/dist/stories/FormField.stories.d.ts +6 -0
- package/dist/stories/FormField.stories.jsx +44 -0
- package/dist/stories/IconButton.stories.d.ts +1 -0
- package/dist/stories/IconButton.stories.jsx +18 -1
- package/dist/stories/Menu.stories.d.ts +4 -0
- package/dist/stories/Menu.stories.jsx +46 -1
- package/dist/stories/MenuItem.stories.d.ts +1 -0
- package/dist/stories/MenuItem.stories.jsx +8 -0
- package/dist/stories/Message.stories.d.ts +10 -0
- package/dist/stories/Message.stories.jsx +77 -0
- package/dist/stories/Navigation.stories.d.ts +1 -0
- package/dist/stories/Navigation.stories.jsx +17 -1
- package/dist/stories/PageComponents.stories.d.ts +1 -0
- package/dist/stories/PageComponents.stories.jsx +21 -0
- package/dist/stories/RadioGroup.stories.d.ts +2 -0
- package/dist/stories/RadioGroup.stories.jsx +40 -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/SourceCard.stories.d.ts +8 -0
- package/dist/stories/SourceCard.stories.jsx +33 -0
- package/dist/stories/StepList.stories.d.ts +8 -0
- package/dist/stories/StepList.stories.jsx +35 -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/dist/stories/UserImage.stories.d.ts +2 -0
- package/dist/stories/UserImage.stories.jsx +19 -0
- package/package.json +8 -3
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Quick switcher
|
|
2
|
+
|
|
3
|
+
A person jumps to a channel, task or document by typing part of its name, from anywhere in the product.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Open it with Cmd+K, or Ctrl+K on Windows, and with a visible 'Go to' Button. A shortcut alone is not found.
|
|
8
|
+
- Add the shortcut with `useHotkey('k', …)`. It is removed when the page goes away, and it does nothing while the person types in a field.
|
|
9
|
+
- Open a small `Modal` with `initialFocus="body"`, so focus lands in the search field. Closing gives focus back to where it was.
|
|
10
|
+
- Build it as a combobox, as the case 'Mention list' says. The field gets `role="combobox"`, `aria-expanded`, `aria-controls` and `aria-activedescendant`.
|
|
11
|
+
- Make the list a `Menu role="listbox"` of `MenuItem role="option"` rows, with `isActive` and `aria-selected` on the highlighted one.
|
|
12
|
+
- Name the field with `aria-label="Go to"`, since it has no visible label.
|
|
13
|
+
- Show the most recent places, at most 6, before the person types.
|
|
14
|
+
- Show each place with its icon and name, and where it lives in `secondLabel`.
|
|
15
|
+
- Move the highlight with the arrow keys. Enter opens the highlighted place and closes the Modal. Escape closes it.
|
|
16
|
+
- Leave Enter and the arrow keys to an input method while it is still composing.
|
|
17
|
+
- Follow the case 'Empty search' when nothing matches: the words searched for and a 'Clear Search' Button, which puts focus back in the field.
|
|
18
|
+
|
|
19
|
+
## Don't
|
|
20
|
+
|
|
21
|
+
- Do not use the shortcut as the only way in.
|
|
22
|
+
- Do not take Cmd+K while the person types in a field. Some fields use it for their own commands.
|
|
23
|
+
- Do not move focus into the list. The person keeps typing in the field.
|
|
24
|
+
- Do not keep the last search. It opens empty.
|
|
25
|
+
- Do not show a toast after going to a place. The page changing says it.
|
|
26
|
+
|
|
27
|
+
## Example: Small Modal with a search field and a list
|
|
28
|
+
|
|
29
|
+
Uses: `Button`, `Center`, `Cluster`, `EmptyBox`, `Heading`, `Menu`, `MenuItem`, `Modal`, `Paragraph`, `Stack`, `TextField`, `useHotkey`
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
'use client';
|
|
33
|
+
import { useState, type KeyboardEvent } from 'react';
|
|
34
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
35
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
36
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
37
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
38
|
+
import Button from 'oneslash-design-system/components/button';
|
|
39
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
40
|
+
import Menu from 'oneslash-design-system/components/menu';
|
|
41
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
42
|
+
import useHotkey from 'oneslash-design-system/components/useHotkey';
|
|
43
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
44
|
+
|
|
45
|
+
// A real app reads these from the server. The most recent place comes first.
|
|
46
|
+
type Place = { id: string; title: string; kind: 'channel' | 'task' | 'doc'; workspace: string };
|
|
47
|
+
const places: Place[] = [
|
|
48
|
+
{ id: 'launch-plan', title: 'launch-plan', kind: 'channel', workspace: 'Acme Design' },
|
|
49
|
+
{ id: 'press-kit', title: 'Update the press kit', kind: 'task', workspace: 'Acme Design' },
|
|
50
|
+
{ id: 'pricing-notes', title: 'Pricing notes', kind: 'doc', workspace: 'Acme Marketing' },
|
|
51
|
+
{ id: 'launch-checklist', title: 'Launch checklist', kind: 'doc', workspace: 'Acme Design' },
|
|
52
|
+
{ id: 'design-review', title: 'design-review', kind: 'channel', workspace: 'Acme Design' },
|
|
53
|
+
{ id: 'hiring-plan', title: 'Hiring plan', kind: 'doc', workspace: 'Acme Engineering' },
|
|
54
|
+
];
|
|
55
|
+
const icons = { channel: 'Hash', task: 'SquareCheck', doc: 'FileText' } as const;
|
|
56
|
+
|
|
57
|
+
// At most this many rows show, so the list never needs to scroll; typing more letters narrows it.
|
|
58
|
+
const MAX_RESULTS = 6;
|
|
59
|
+
const listId = 'quick-switcher-results';
|
|
60
|
+
const optionId = (p: Place) => `quick-switcher-option-${p.id}`;
|
|
61
|
+
|
|
62
|
+
// Places with a word that starts with what was typed. With nothing typed it shows the most recent.
|
|
63
|
+
function matches(query: string) {
|
|
64
|
+
const q = query.trim().toLowerCase();
|
|
65
|
+
if (!q) return places.slice(0, MAX_RESULTS);
|
|
66
|
+
return places.filter((p) => p.title.toLowerCase().split(/[\s-]+/).some((w) => w.startsWith(q))).slice(0, MAX_RESULTS);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default function QuickSwitcherModal() {
|
|
70
|
+
// Opens with the switcher showing, as if the person just pressed Cmd+K.
|
|
71
|
+
const [open, setOpen] = useState(true);
|
|
72
|
+
const [query, setQuery] = useState('la');
|
|
73
|
+
const [active, setActive] = useState(0);
|
|
74
|
+
const [here, setHere] = useState<Place>(places[0]);
|
|
75
|
+
// Bumped by 'Clear Search'. It remounts the search field with `autoFocus`, so focus goes back to the field
|
|
76
|
+
// instead of being lost with the Button that the list replaces.
|
|
77
|
+
const [fieldKey, setFieldKey] = useState(0);
|
|
78
|
+
|
|
79
|
+
const results = matches(query);
|
|
80
|
+
const listOpen = results.length > 0;
|
|
81
|
+
|
|
82
|
+
function openSwitcher() {
|
|
83
|
+
setQuery('');
|
|
84
|
+
setActive(0);
|
|
85
|
+
setOpen(true);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// The shortcut works from anywhere on the page except a text field. Cmd+K inside the switcher's own field does nothing.
|
|
89
|
+
useHotkey('k', () => {
|
|
90
|
+
if (!open) openSwitcher();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
function change(value: string) {
|
|
94
|
+
setQuery(value);
|
|
95
|
+
setActive(0);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// A real app goes to the place here. Closing hands focus back to what had it before the switcher opened.
|
|
99
|
+
function go(place: Place) {
|
|
100
|
+
setHere(place);
|
|
101
|
+
setOpen(false);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function clearSearch() {
|
|
105
|
+
setQuery('');
|
|
106
|
+
setActive(0);
|
|
107
|
+
setFieldKey((k) => k + 1);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Focus stays in the field; the arrows move the highlight and Enter opens it. Escape is the Modal's.
|
|
111
|
+
function keyDown(e: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) {
|
|
112
|
+
// An input method (Korean, Japanese, Chinese) uses Enter and the arrows while it composes: leave them to it.
|
|
113
|
+
if (e.nativeEvent.isComposing || e.keyCode === 229) return;
|
|
114
|
+
if (!listOpen) return;
|
|
115
|
+
if (e.key === 'ArrowDown') {
|
|
116
|
+
e.preventDefault();
|
|
117
|
+
setActive((i) => Math.min(i + 1, results.length - 1));
|
|
118
|
+
} else if (e.key === 'ArrowUp') {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
setActive((i) => Math.max(i - 1, 0));
|
|
121
|
+
} else if (e.key === 'Enter') {
|
|
122
|
+
e.preventDefault();
|
|
123
|
+
go(results[active]);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Center width="page">
|
|
129
|
+
<Stack gap="large">
|
|
130
|
+
<Cluster justify="between">
|
|
131
|
+
<Heading level={1} size="h5">{here.title}</Heading>
|
|
132
|
+
{/* A shortcut alone is not found by most people, so a Button opens it too. */}
|
|
133
|
+
<Button
|
|
134
|
+
size="small"
|
|
135
|
+
type="secondary"
|
|
136
|
+
state="enabled"
|
|
137
|
+
label="Go to"
|
|
138
|
+
decoIcon="Search"
|
|
139
|
+
aria-haspopup="dialog"
|
|
140
|
+
aria-keyshortcuts="Meta+K Control+K"
|
|
141
|
+
onClickButton={openSwitcher}
|
|
142
|
+
/>
|
|
143
|
+
</Cluster>
|
|
144
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
145
|
+
{here.workspace}. Press Cmd+K, or Ctrl+K on Windows, to go to a channel, task or document.
|
|
146
|
+
</Paragraph>
|
|
147
|
+
</Stack>
|
|
148
|
+
<Modal isOpen={open} size="small" title="Go to" initialFocus="body" onClose={() => setOpen(false)}>
|
|
149
|
+
<Stack gap="medium">
|
|
150
|
+
<TextField
|
|
151
|
+
key={fieldKey}
|
|
152
|
+
id="quick-switcher-query"
|
|
153
|
+
type="search"
|
|
154
|
+
// The Modal focuses the field when it opens. `autoFocus` only after 'Clear Search', which remounts the field.
|
|
155
|
+
autoFocus={fieldKey > 0}
|
|
156
|
+
aria-label="Go to"
|
|
157
|
+
placeholder="Search channels, tasks and documents"
|
|
158
|
+
value={query}
|
|
159
|
+
onChange={(e) => change(e.target.value)}
|
|
160
|
+
onKeyDown={keyDown}
|
|
161
|
+
// Focus stays in the field; the field points at the list and at the highlighted row.
|
|
162
|
+
role="combobox"
|
|
163
|
+
aria-autocomplete="list"
|
|
164
|
+
aria-expanded={listOpen}
|
|
165
|
+
aria-controls={listOpen ? listId : undefined}
|
|
166
|
+
aria-activedescendant={listOpen ? optionId(results[active]) : undefined}
|
|
167
|
+
/>
|
|
168
|
+
{listOpen ? (
|
|
169
|
+
<Menu role="listbox" id={listId} aria-label="Places" width="100%">
|
|
170
|
+
{results.map((p, i) => (
|
|
171
|
+
<MenuItem
|
|
172
|
+
key={p.id}
|
|
173
|
+
id={optionId(p)}
|
|
174
|
+
role="option"
|
|
175
|
+
tabIndex={-1}
|
|
176
|
+
isActive={i === active}
|
|
177
|
+
aria-selected={i === active}
|
|
178
|
+
size="small"
|
|
179
|
+
iconName={icons[p.kind]}
|
|
180
|
+
label={p.title}
|
|
181
|
+
secondLabel={p.workspace}
|
|
182
|
+
onClick={() => go(p)}
|
|
183
|
+
/>
|
|
184
|
+
))}
|
|
185
|
+
</Menu>
|
|
186
|
+
) : (
|
|
187
|
+
// The case 'Empty search' says what to show: the words searched for, and a way to clear them.
|
|
188
|
+
<EmptyBox
|
|
189
|
+
size="small"
|
|
190
|
+
icon="Search"
|
|
191
|
+
text={`No places match "${query.trim()}"`}
|
|
192
|
+
secondText="Check the spelling, or search for fewer words."
|
|
193
|
+
action={<Button size="medium" type="secondary" state="enabled" label="Clear Search" onClickButton={clearSearch} />}
|
|
194
|
+
/>
|
|
195
|
+
)}
|
|
196
|
+
</Stack>
|
|
197
|
+
</Modal>
|
|
198
|
+
</Center>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Native
|
|
204
|
+
|
|
205
|
+
On Apple use a sheet with a `TextField` over a `List`, opened with `.keyboardShortcut("k")`, and `ContentUnavailableView.search(text:)` when nothing matches. A phone needs no switcher: use the search tab.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function RangeSwitchSegmented(): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Heading from '../../components/heading';
|
|
4
|
+
import Paragraph from '../../components/paragraph';
|
|
5
|
+
import SegmentedControl from '../../components/segmentedControl';
|
|
6
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
7
|
+
// A real app counts these on the server.
|
|
8
|
+
var ranges = [
|
|
9
|
+
{ value: 'week', label: 'Week', count: 18 },
|
|
10
|
+
{ value: 'month', label: 'Month', count: 64 },
|
|
11
|
+
{ value: 'quarter', label: 'Quarter', count: 171 },
|
|
12
|
+
];
|
|
13
|
+
export default function RangeSwitchSegmented() {
|
|
14
|
+
var _a;
|
|
15
|
+
var _b = useState('week'), range = _b[0], setRange = _b[1];
|
|
16
|
+
var current = (_a = ranges.find(function (r) { return r.value === range; })) !== null && _a !== void 0 ? _a : ranges[0];
|
|
17
|
+
return (<Center width="page">
|
|
18
|
+
<Stack gap="large">
|
|
19
|
+
<Cluster justify="between">
|
|
20
|
+
<Heading level={1} size="h5">Overview</Heading>
|
|
21
|
+
<SegmentedControl size="small" width="fit" aria-label="Range" options={ranges.map(function (_a) {
|
|
22
|
+
var value = _a.value, label = _a.label;
|
|
23
|
+
return ({ value: value, label: label });
|
|
24
|
+
})} value={range} onChange={setRange}/>
|
|
25
|
+
</Cluster>
|
|
26
|
+
{/* The chart or list below changes with the range. This page stays the same. */}
|
|
27
|
+
<Paragraph size="body2" measure="none">{current.count} comments this {current.label.toLowerCase()}.</Paragraph>
|
|
28
|
+
</Stack>
|
|
29
|
+
</Center>);
|
|
30
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Range switch
|
|
2
|
+
|
|
3
|
+
A person changes the time range of a chart or a list on the same page, such as Week, Month or Quarter.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Use `SegmentedControl` with `size="small"` and `aria-label="Range"`: 'Week', 'Month', 'Quarter'.
|
|
8
|
+
- Put it beside the heading of the chart or list it changes, with `width="fit"` so it is as wide as its options.
|
|
9
|
+
- Keep one option on at all times. Start on 'Week', the newest numbers, unless the page is about a longer period.
|
|
10
|
+
- Change the numbers in place and keep the page, the heading and the scroll position.
|
|
11
|
+
- Move between options with the arrow keys. They select as they move.
|
|
12
|
+
|
|
13
|
+
## Don't
|
|
14
|
+
|
|
15
|
+
- Do not use tabs. Tabs switch panels, and this changes one value on the same page.
|
|
16
|
+
- Do not use more than four options. Use a menu, as the case 'Filter menu' says.
|
|
17
|
+
- Do not let the person turn every option off.
|
|
18
|
+
- Do not hide a range of three choices behind a menu.
|
|
19
|
+
|
|
20
|
+
## Example: Segmented control
|
|
21
|
+
|
|
22
|
+
Uses: `Center`, `Cluster`, `Heading`, `Paragraph`, `SegmentedControl`, `Stack`
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
'use client';
|
|
26
|
+
import { useState } from 'react';
|
|
27
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
28
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
29
|
+
import SegmentedControl from 'oneslash-design-system/components/segmentedControl';
|
|
30
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
31
|
+
|
|
32
|
+
// A real app counts these on the server.
|
|
33
|
+
const ranges = [
|
|
34
|
+
{ value: 'week', label: 'Week', count: 18 },
|
|
35
|
+
{ value: 'month', label: 'Month', count: 64 },
|
|
36
|
+
{ value: 'quarter', label: 'Quarter', count: 171 },
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
export default function RangeSwitchSegmented() {
|
|
40
|
+
const [range, setRange] = useState('week');
|
|
41
|
+
const current = ranges.find((r) => r.value === range) ?? ranges[0];
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Center width="page">
|
|
45
|
+
<Stack gap="large">
|
|
46
|
+
<Cluster justify="between">
|
|
47
|
+
<Heading level={1} size="h5">Overview</Heading>
|
|
48
|
+
<SegmentedControl
|
|
49
|
+
size="small"
|
|
50
|
+
width="fit"
|
|
51
|
+
aria-label="Range"
|
|
52
|
+
options={ranges.map(({ value, label }) => ({ value, label }))}
|
|
53
|
+
value={range}
|
|
54
|
+
onChange={setRange}
|
|
55
|
+
/>
|
|
56
|
+
</Cluster>
|
|
57
|
+
{/* The chart or list below changes with the range. This page stays the same. */}
|
|
58
|
+
<Paragraph size="body2" measure="none">{current.count} comments this {current.label.toLowerCase()}.</Paragraph>
|
|
59
|
+
</Stack>
|
|
60
|
+
</Center>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Native
|
|
66
|
+
|
|
67
|
+
On Apple use a `Picker` with the `.segmented` style, and on Android a `SingleChoiceSegmentedButtonRow`.
|
package/dist/cases/rename.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person renames something, such as a project or a channel.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Commentify's two renames disagree on what leaving the field does: a project name cancels, a tag name saves. Scindo on the web labels its rename Modals' action 'Save', shows 'Saving...' while it runs, and writes a taken name as a red caption by hand.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Title the Modal 'Rename' and the thing, such as 'Rename Project', and give its action the same verb: 'Rename'.
|
|
@@ -201,5 +199,3 @@ export default function RenameInline() {
|
|
|
201
199
|
## Native
|
|
202
200
|
|
|
203
201
|
On Apple rename in place in a list with a `TextField` and `.onSubmit`. Use an `.alert` with a `TextField` when the name is not on screen.
|
|
204
|
-
|
|
205
|
-
Seen in: Commentify, Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ReplyFeedbackThumbs(): import("react").JSX.Element;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Bot } from 'lucide-react';
|
|
4
|
+
import Message from '../../components/message';
|
|
5
|
+
import UserImage from '../../components/userImage';
|
|
6
|
+
import Tag from '../../components/tag';
|
|
7
|
+
import TimeStamp from '../../components/timeStamp';
|
|
8
|
+
import Heading from '../../components/heading';
|
|
9
|
+
import Paragraph from '../../components/paragraph';
|
|
10
|
+
import Button from '../../components/button';
|
|
11
|
+
import IconButton from '../../components/iconButton';
|
|
12
|
+
import Tooltip from '../../components/tooltip';
|
|
13
|
+
import StepList from '../../components/stepList';
|
|
14
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
15
|
+
var agentName = 'Acme Agent';
|
|
16
|
+
var request = { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'What changed in the new plans?' };
|
|
17
|
+
var firstRepliedAt = new Date('2025-01-15T11:41:00Z');
|
|
18
|
+
// Each Regenerate writes the next version of the reply.
|
|
19
|
+
var replies = [
|
|
20
|
+
'Pro goes from $12 to $15 a month. There is a new Team plan at $25 per seat, and the Free plan stays the same.',
|
|
21
|
+
'Two things changed. Pro now costs $15 a month instead of $12, and the new Team plan costs $25 per seat.',
|
|
22
|
+
];
|
|
23
|
+
// Each step in plain words: what the agent is doing now, and what it did once the step is done.
|
|
24
|
+
var plan = [
|
|
25
|
+
{ doing: 'Reading the thread', done: 'Read the thread' },
|
|
26
|
+
{ doing: 'Writing a new reply', done: 'Wrote a new reply' },
|
|
27
|
+
];
|
|
28
|
+
function stepsUpTo(current) {
|
|
29
|
+
return plan.slice(0, current + 1).map(function (s, i) { return (i < current ? { label: s.done, status: 'done' } : { label: s.doing, status: 'running' }); });
|
|
30
|
+
}
|
|
31
|
+
function secondsLine(seconds) {
|
|
32
|
+
return "Working for ".concat(seconds, " ").concat(seconds === 1 ? 'second' : 'seconds');
|
|
33
|
+
}
|
|
34
|
+
// The agent's marks, as the rule 'An agent says what it is' says. While a new reply is written there is
|
|
35
|
+
// no time to show: the old reply's time would be wrong for it.
|
|
36
|
+
function agentMeta(at) {
|
|
37
|
+
return (<>
|
|
38
|
+
<Tag variant="contained" size="small" label="Agent"/>
|
|
39
|
+
{at && <TimeStamp createdAt={at} dateFormat="absolute" data="time"/>}
|
|
40
|
+
<Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
|
|
41
|
+
</>);
|
|
42
|
+
}
|
|
43
|
+
export default function ReplyFeedbackThumbs() {
|
|
44
|
+
var _a = useState(null), thumb = _a[0], setThumb = _a[1];
|
|
45
|
+
var _b = useState(false), thanks = _b[0], setThanks = _b[1];
|
|
46
|
+
var _c = useState(false), copied = _c[0], setCopied = _c[1];
|
|
47
|
+
var _d = useState(0), version = _d[0], setVersion = _d[1];
|
|
48
|
+
// Each version of the reply has its own time: a regenerated reply shows when it was written.
|
|
49
|
+
var _e = useState(firstRepliedAt), repliedAt = _e[0], setRepliedAt = _e[1];
|
|
50
|
+
var _f = useState('reply'), phase = _f[0], setPhase = _f[1];
|
|
51
|
+
var _g = useState(0), current = _g[0], setCurrent = _g[1];
|
|
52
|
+
var _h = useState(0), seconds = _h[0], setSeconds = _h[1];
|
|
53
|
+
var _j = useState(false), stopped = _j[0], setStopped = _j[1];
|
|
54
|
+
var thanksTimer = useRef();
|
|
55
|
+
var copyTimer = useRef();
|
|
56
|
+
var tick = useRef();
|
|
57
|
+
var step = useRef();
|
|
58
|
+
var cancel = useRef();
|
|
59
|
+
var regenerateButton = useRef(null);
|
|
60
|
+
var stopButton = useRef(null);
|
|
61
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
62
|
+
var focusNext = useRef();
|
|
63
|
+
// The clipboard answers later; by then the example may be gone.
|
|
64
|
+
var mounted = useRef(true);
|
|
65
|
+
// On unmount it stops every timer and the run.
|
|
66
|
+
useEffect(function () { return function () {
|
|
67
|
+
mounted.current = false;
|
|
68
|
+
clearTimeout(thanksTimer.current);
|
|
69
|
+
clearTimeout(copyTimer.current);
|
|
70
|
+
clearInterval(tick.current);
|
|
71
|
+
clearTimeout(step.current);
|
|
72
|
+
clearTimeout(cancel.current);
|
|
73
|
+
}; }, []);
|
|
74
|
+
useEffect(function () {
|
|
75
|
+
var move = focusNext.current;
|
|
76
|
+
focusNext.current = undefined;
|
|
77
|
+
move === null || move === void 0 ? void 0 : move();
|
|
78
|
+
});
|
|
79
|
+
var reply = replies[version];
|
|
80
|
+
// Pressing a thumb marks it, pressing it again clears it, and the other thumb moves the mark.
|
|
81
|
+
// A real app sends the mark to the server; the thanks is the only confirmation.
|
|
82
|
+
function mark(next) {
|
|
83
|
+
var value = thumb === next ? null : next;
|
|
84
|
+
setThumb(value);
|
|
85
|
+
clearTimeout(thanksTimer.current);
|
|
86
|
+
setThanks(value !== null);
|
|
87
|
+
if (value !== null)
|
|
88
|
+
thanksTimer.current = setTimeout(function () { return setThanks(false); }, 2000);
|
|
89
|
+
}
|
|
90
|
+
function copy() {
|
|
91
|
+
var _a;
|
|
92
|
+
(_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(reply).then(function () {
|
|
93
|
+
if (!mounted.current)
|
|
94
|
+
return;
|
|
95
|
+
setCopied(true);
|
|
96
|
+
clearTimeout(copyTimer.current);
|
|
97
|
+
copyTimer.current = setTimeout(function () { return setCopied(false); }, 2000);
|
|
98
|
+
}, function () { });
|
|
99
|
+
}
|
|
100
|
+
function endRun() {
|
|
101
|
+
clearInterval(tick.current);
|
|
102
|
+
clearTimeout(step.current);
|
|
103
|
+
setPhase('reply');
|
|
104
|
+
// 'Stop' is gone and the buttons are back, so focus returns to Regenerate.
|
|
105
|
+
focusNext.current = function () { var _a; return (_a = regenerateButton.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
106
|
+
}
|
|
107
|
+
// Stands in for the agent's run: one step every 1.5 seconds.
|
|
108
|
+
function advance(at) {
|
|
109
|
+
step.current = setTimeout(function () {
|
|
110
|
+
if (at === plan.length - 1) {
|
|
111
|
+
setVersion(function (v) { return (v + 1) % replies.length; });
|
|
112
|
+
setRepliedAt(new Date());
|
|
113
|
+
setThumb(null);
|
|
114
|
+
endRun();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
setCurrent(at + 1);
|
|
118
|
+
advance(at + 1);
|
|
119
|
+
}, 1500);
|
|
120
|
+
}
|
|
121
|
+
// The reply's row turns into the agent's progress row, as the case 'Agent at work' shows.
|
|
122
|
+
function regenerate() {
|
|
123
|
+
clearTimeout(thanksTimer.current);
|
|
124
|
+
setThanks(false);
|
|
125
|
+
setStopped(false);
|
|
126
|
+
setCurrent(0);
|
|
127
|
+
setSeconds(0);
|
|
128
|
+
setPhase('running');
|
|
129
|
+
tick.current = setInterval(function () { return setSeconds(function (s) { return s + 1; }); }, 1000);
|
|
130
|
+
advance(0);
|
|
131
|
+
// Regenerate had focus and is gone; 'Stop' takes its place.
|
|
132
|
+
focusNext.current = function () { var _a; return (_a = stopButton.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
133
|
+
}
|
|
134
|
+
// Stop asks the server to end the run. The reply stays as it was.
|
|
135
|
+
function stop() {
|
|
136
|
+
if (phase !== 'running')
|
|
137
|
+
return;
|
|
138
|
+
clearTimeout(step.current);
|
|
139
|
+
setPhase('stopping');
|
|
140
|
+
// Stands in for the request to the server.
|
|
141
|
+
cancel.current = setTimeout(function () {
|
|
142
|
+
setStopped(true);
|
|
143
|
+
endRun();
|
|
144
|
+
}, 1200);
|
|
145
|
+
}
|
|
146
|
+
var working = phase !== 'reply';
|
|
147
|
+
return (<Center width="page">
|
|
148
|
+
<Stack gap="large">
|
|
149
|
+
<Heading level={1} size="h5">Pricing</Heading>
|
|
150
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
151
|
+
<Stack gap="small">
|
|
152
|
+
<Message aria-label={request.from} avatar={<UserImage userHandle={request.from} decorative/>} name={request.from} meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time"/>}>
|
|
153
|
+
<Paragraph measure="none">{request.text}</Paragraph>
|
|
154
|
+
</Message>
|
|
155
|
+
<Message aria-label={"".concat(agentName, ", agent")} avatar={<UserImage userHandle={agentName} icon={Bot} decorative/>} name={agentName} meta={agentMeta(working ? undefined : repliedAt)} footer={working ? (
|
|
156
|
+
// The only Stop, on the row for the whole run. It shows loading while the run is stopping.
|
|
157
|
+
<Cluster>
|
|
158
|
+
<Button ref={stopButton} size="small" type="secondary" state="enabled" label="Stop" loading={phase === 'stopping'} onClickButton={stop}/>
|
|
159
|
+
</Cluster>) : (
|
|
160
|
+
// One reply is on screen, so 'reply' is enough in the names. With several, each name says which reply.
|
|
161
|
+
<Cluster gap="small">
|
|
162
|
+
<Tooltip title="Mark as helpful">
|
|
163
|
+
<IconButton color="iconOnly" state={thumb === 'up' ? 'selected' : 'enabled'} size="small" iconName="ThumbsUp" ariaLabel="Mark reply as helpful" aria-pressed={thumb === 'up'} onClick={function () { return mark('up'); }}/>
|
|
164
|
+
</Tooltip>
|
|
165
|
+
<Tooltip title="Mark as not helpful">
|
|
166
|
+
<IconButton color="iconOnly" state={thumb === 'down' ? 'selected' : 'enabled'} size="small" iconName="ThumbsDown" ariaLabel="Mark reply as not helpful" aria-pressed={thumb === 'down'} onClick={function () { return mark('down'); }}/>
|
|
167
|
+
</Tooltip>
|
|
168
|
+
<Tooltip title={copied ? 'Copied' : 'Copy'}>
|
|
169
|
+
<IconButton color="iconOnly" state="enabled" size="small" iconName={copied ? 'Check' : 'Copy'} ariaLabel={copied ? 'Copied' : 'Copy reply'} onClick={copy}/>
|
|
170
|
+
</Tooltip>
|
|
171
|
+
{/* Only on the latest reply. */}
|
|
172
|
+
<Tooltip title="Regenerate">
|
|
173
|
+
<IconButton ref={regenerateButton} color="iconOnly" state="enabled" size="small" iconName="RefreshCw" ariaLabel="Regenerate reply" onClick={regenerate}/>
|
|
174
|
+
</Tooltip>
|
|
175
|
+
{/* A real app wraps the thanks in a polite live region. */}
|
|
176
|
+
{thanks && <Paragraph size="caption" tone="secondary" measure="none">Thanks. This helps the agent improve.</Paragraph>}
|
|
177
|
+
</Cluster>)}>
|
|
178
|
+
{working ? (
|
|
179
|
+
// A real app wraps this part in a polite live region, since StepList has none.
|
|
180
|
+
<Stack gap="medium">
|
|
181
|
+
<Paragraph size="caption" tone="secondary" measure="none">{secondsLine(seconds)}</Paragraph>
|
|
182
|
+
<StepList aria-label="Acme Agent's steps" steps={stepsUpTo(current)}/>
|
|
183
|
+
</Stack>) : (<Stack gap="small">
|
|
184
|
+
<Paragraph measure="none">{reply}</Paragraph>
|
|
185
|
+
{stopped && <Paragraph size="caption" tone="secondary" measure="none">Stopped. Nothing was changed.</Paragraph>}
|
|
186
|
+
</Stack>)}
|
|
187
|
+
</Message>
|
|
188
|
+
</Stack>
|
|
189
|
+
</Stack>
|
|
190
|
+
</Center>);
|
|
191
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ReplyFeedbackWithReason(): import("react").JSX.Element;
|