oneslash-design-system 2.15.0 → 2.17.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 +6 -1
- package/dist/DESIGN.md +100 -73
- package/dist/cases/accept-invite/signed-in.d.ts +1 -0
- package/dist/cases/accept-invite/signed-in.jsx +57 -0
- package/dist/cases/accept-invite/signed-out.d.ts +1 -0
- package/dist/cases/accept-invite/signed-out.jsx +33 -0
- package/dist/cases/accept-invite.md +161 -0
- package/dist/cases/agent-asks-before-risky-action.md +1 -1
- package/dist/cases/agent-cancels-when-unanswered.md +1 -1
- 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 +168 -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 +432 -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 +656 -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 +338 -0
- package/dist/cases/agent-shows-sources.md +2 -2
- 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 +103 -0
- package/dist/cases/auth-gate-loading/spinner-with-line.d.ts +1 -0
- package/dist/cases/auth-gate-loading/spinner-with-line.jsx +10 -0
- package/dist/cases/auth-gate-loading/spinner.d.ts +1 -0
- package/dist/cases/auth-gate-loading/spinner.jsx +10 -0
- package/dist/cases/auth-gate-loading.md +70 -0
- package/dist/cases/check-your-email/alert-on-login.d.ts +1 -0
- package/dist/cases/check-your-email/alert-on-login.jsx +78 -0
- package/dist/cases/check-your-email/page.d.ts +1 -0
- package/dist/cases/check-your-email/page.jsx +49 -0
- package/dist/cases/check-your-email.md +184 -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 +286 -0
- package/dist/cases/confirm-destructive-action/inline.d.ts +1 -0
- package/dist/cases/confirm-destructive-action/inline.jsx +69 -0
- package/dist/cases/confirm-destructive-action/modal.d.ts +1 -0
- package/dist/cases/confirm-destructive-action/modal.jsx +66 -0
- package/dist/cases/confirm-destructive-action.md +211 -0
- package/dist/cases/confirm-dialogs.md +36 -0
- 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 +208 -0
- package/dist/cases/create-modal/quick.d.ts +1 -0
- package/dist/cases/create-modal/quick.jsx +80 -0
- package/dist/cases/create-modal/with-settings.d.ts +1 -0
- package/dist/cases/create-modal/with-settings.jsx +99 -0
- package/dist/cases/create-modal.md +244 -0
- package/dist/cases/device-login/popup.d.ts +1 -0
- package/dist/cases/device-login/popup.jsx +14 -0
- package/dist/cases/device-login/provider-first.d.ts +1 -0
- package/dist/cases/device-login/provider-first.jsx +98 -0
- package/dist/cases/device-login.md +171 -0
- package/dist/cases/email-confirmed/alert-on-login.d.ts +1 -0
- package/dist/cases/email-confirmed/alert-on-login.jsx +78 -0
- package/dist/cases/email-confirmed/page.d.ts +1 -0
- package/dist/cases/email-confirmed/page.jsx +21 -0
- package/dist/cases/email-confirmed.md +151 -0
- package/dist/cases/empty-list/region.d.ts +1 -0
- package/dist/cases/empty-list/region.jsx +13 -0
- package/dist/cases/empty-list/section.d.ts +1 -0
- package/dist/cases/empty-list/section.jsx +17 -0
- package/dist/cases/empty-list.md +77 -0
- package/dist/cases/empty-lists.md +35 -0
- package/dist/cases/empty-not-set-up/action.d.ts +1 -0
- package/dist/cases/empty-not-set-up/action.jsx +16 -0
- package/dist/cases/empty-not-set-up/pointer.d.ts +1 -0
- package/dist/cases/empty-not-set-up/pointer.jsx +13 -0
- package/dist/cases/empty-not-set-up.md +88 -0
- package/dist/cases/empty-search/clear-search.d.ts +1 -0
- package/dist/cases/empty-search/clear-search.jsx +29 -0
- package/dist/cases/empty-search.md +77 -0
- package/dist/cases/error-page/full-page.d.ts +1 -0
- package/dist/cases/error-page/full-page.jsx +19 -0
- package/dist/cases/error-page/in-shell.d.ts +1 -0
- package/dist/cases/error-page/in-shell.jsx +39 -0
- package/dist/cases/error-page.md +107 -0
- package/dist/cases/feedback-form/modal.d.ts +1 -0
- package/dist/cases/feedback-form/modal.jsx +89 -0
- package/dist/cases/feedback-form.md +139 -0
- package/dist/cases/forgot-password/in-place.d.ts +1 -0
- package/dist/cases/forgot-password/in-place.jsx +155 -0
- package/dist/cases/forgot-password/own-page.d.ts +1 -0
- package/dist/cases/forgot-password/own-page.jsx +99 -0
- package/dist/cases/forgot-password.md +328 -0
- package/dist/cases/form-errors.md +32 -0
- package/dist/cases/import-checklist/modal.d.ts +1 -0
- package/dist/cases/import-checklist/modal.jsx +125 -0
- package/dist/cases/import-checklist.md +188 -0
- package/dist/cases/inline-form-feedback/button-label.d.ts +1 -0
- package/dist/cases/inline-form-feedback/button-label.jsx +54 -0
- package/dist/cases/inline-form-feedback/inline-alert.d.ts +1 -0
- package/dist/cases/inline-form-feedback/inline-alert.jsx +49 -0
- package/dist/cases/inline-form-feedback/toast.d.ts +1 -0
- package/dist/cases/inline-form-feedback/toast.jsx +66 -0
- package/dist/cases/inline-form-feedback.md +237 -0
- package/dist/cases/invite-member/by-email.d.ts +1 -0
- package/dist/cases/invite-member/by-email.jsx +98 -0
- package/dist/cases/invite-member/by-link.d.ts +1 -0
- package/dist/cases/invite-member/by-link.jsx +122 -0
- package/dist/cases/invite-member.md +321 -0
- package/dist/cases/load-failure/inline.d.ts +1 -0
- package/dist/cases/load-failure/inline.jsx +52 -0
- package/dist/cases/load-failure/region.d.ts +1 -0
- package/dist/cases/load-failure/region.jsx +34 -0
- package/dist/cases/load-failure.md +155 -0
- package/dist/cases/log-out-confirm/modal.d.ts +1 -0
- package/dist/cases/log-out-confirm/modal.jsx +57 -0
- package/dist/cases/log-out-confirm.md +106 -0
- package/dist/cases/login-page/centered.jsx +10 -7
- package/dist/cases/login-page/email-only.jsx +11 -8
- package/dist/cases/login-page/provider-first.jsx +12 -9
- package/dist/cases/login-page/split.jsx +11 -8
- package/dist/cases/login-page.md +58 -41
- 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 +252 -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 +651 -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 +310 -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 +356 -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 +179 -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 +371 -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 +189 -0
- package/dist/cases/not-found-page/full-page.d.ts +1 -0
- package/dist/cases/not-found-page/full-page.jsx +16 -0
- package/dist/cases/not-found-page/in-shell.d.ts +1 -0
- package/dist/cases/not-found-page/in-shell.jsx +36 -0
- package/dist/cases/not-found-page.md +98 -0
- package/dist/cases/oauth-consent/simple.d.ts +1 -0
- package/dist/cases/oauth-consent/simple.jsx +73 -0
- package/dist/cases/oauth-consent/with-scope.d.ts +1 -0
- package/dist/cases/oauth-consent/with-scope.jsx +89 -0
- package/dist/cases/oauth-consent.md +233 -0
- package/dist/cases/rename/inline.d.ts +1 -0
- package/dist/cases/rename/inline.jsx +58 -0
- package/dist/cases/rename/modal.d.ts +1 -0
- package/dist/cases/rename/modal.jsx +70 -0
- package/dist/cases/rename.md +205 -0
- 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 +552 -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 +247 -0
- package/dist/cases/route-loading/full-screen.d.ts +1 -0
- package/dist/cases/route-loading/full-screen.jsx +8 -0
- package/dist/cases/route-loading/region.d.ts +1 -0
- package/dist/cases/route-loading/region.jsx +26 -0
- package/dist/cases/route-loading.md +84 -0
- package/dist/cases/set-new-password/form.d.ts +1 -0
- package/dist/cases/set-new-password/form.jsx +130 -0
- package/dist/cases/set-new-password/invalid-link.d.ts +1 -0
- package/dist/cases/set-new-password/invalid-link.jsx +50 -0
- package/dist/cases/set-new-password.md +247 -0
- package/dist/cases/sign-up-page/centered.d.ts +1 -0
- package/dist/cases/sign-up-page/centered.jsx +124 -0
- package/dist/cases/sign-up-page/provider-first.d.ts +1 -0
- package/dist/cases/sign-up-page/provider-first.jsx +124 -0
- package/dist/cases/sign-up-page/split.d.ts +1 -0
- package/dist/cases/sign-up-page/split.jsx +134 -0
- package/dist/cases/sign-up-page.md +478 -0
- 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 +247 -0
- package/dist/cases/success-feedback.md +35 -0
- package/dist/cases/type-to-confirm/inline.d.ts +1 -0
- package/dist/cases/type-to-confirm/inline.jsx +69 -0
- package/dist/cases/type-to-confirm/modal.d.ts +1 -0
- package/dist/cases/type-to-confirm/modal.jsx +73 -0
- package/dist/cases/type-to-confirm.md +222 -0
- 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 +96 -0
- package/dist/cases/unsaved-changes-guard/discard.d.ts +1 -0
- package/dist/cases/unsaved-changes-guard/discard.jsx +81 -0
- package/dist/cases/unsaved-changes-guard/save-or-discard.d.ts +1 -0
- package/dist/cases/unsaved-changes-guard/save-or-discard.jsx +85 -0
- package/dist/cases/unsaved-changes-guard.md +239 -0
- package/dist/cases/upgrade-prompt/inline.d.ts +1 -0
- package/dist/cases/upgrade-prompt/inline.jsx +52 -0
- package/dist/cases/upgrade-prompt/modal.d.ts +1 -0
- package/dist/cases/upgrade-prompt/modal.jsx +43 -0
- package/dist/cases/upgrade-prompt.md +174 -0
- package/dist/cases.json +3138 -59
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +6 -4
- package/dist/components/button.d.ts +3 -2
- package/dist/components/button.jsx +9 -7
- package/dist/components/composer.d.ts +74 -0
- package/dist/components/composer.jsx +122 -0
- package/dist/components/emptyBox.d.ts +6 -1
- package/dist/components/emptyBox.jsx +4 -2
- package/dist/components/fileChip.d.ts +33 -0
- package/dist/components/fileChip.jsx +61 -0
- package/dist/components/heading.d.ts +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/loadingScreen.d.ts +5 -1
- package/dist/components/loadingScreen.jsx +4 -2
- package/dist/components/menu.d.ts +21 -0
- package/dist/components/menu.jsx +27 -3
- package/dist/components/menuItem.d.ts +9 -1
- package/dist/components/menuItem.jsx +5 -4
- package/dist/components/message.d.ts +28 -0
- package/dist/components/message.jsx +25 -0
- package/dist/components/modal.d.ts +2 -1
- package/dist/components/modal.jsx +20 -8
- 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 +9 -1
- package/dist/components/radioGroup.jsx +20 -9
- package/dist/components/select.d.ts +2 -1
- package/dist/components/select.jsx +4 -2
- 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/tab.jsx +3 -2
- package/dist/components/tabsContainer.d.ts +4 -1
- package/dist/components/tabsContainer.jsx +7 -3
- package/dist/components/tag.d.ts +9 -1
- package/dist/components/tag.jsx +6 -4
- package/dist/components/textField.d.ts +5 -1
- package/dist/components/textField.jsx +7 -3
- package/dist/components/textarea.jsx +3 -18
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.jsx +103 -0
- package/dist/components/userImage.d.ts +9 -1
- package/dist/components/userImage.jsx +10 -3
- package/dist/internal/alert.d.ts +4 -0
- package/dist/internal/alert.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/menu.d.ts +6 -0
- package/dist/internal/menu.js +31 -0
- package/dist/internal/modal.d.ts +2 -0
- package/dist/internal/modal.js +21 -0
- package/dist/internal/toaster.d.ts +19 -0
- package/dist/internal/toaster.js +50 -0
- package/dist/native-mapping.json +38 -1
- package/dist/stories/Alert.stories.d.ts +1 -0
- package/dist/stories/Alert.stories.jsx +16 -0
- 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 +82 -0
- package/dist/stories/Cases.generated.stories.jsx +164 -0
- package/dist/stories/Composer.stories.d.ts +23 -0
- package/dist/stories/Composer.stories.jsx +121 -0
- package/dist/stories/EmptyBox.stories.d.ts +2 -0
- package/dist/stories/EmptyBox.stories.jsx +16 -0
- package/dist/stories/FileChip.stories.d.ts +7 -0
- package/dist/stories/FileChip.stories.jsx +35 -0
- package/dist/stories/Heading.stories.d.ts +6 -0
- package/dist/stories/Heading.stories.jsx +10 -0
- package/dist/stories/IconButton.stories.d.ts +1 -0
- package/dist/stories/IconButton.stories.jsx +18 -1
- package/dist/stories/LoadingScreen.stories.d.ts +1 -0
- package/dist/stories/LoadingScreen.stories.jsx +8 -0
- 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/Modal.stories.d.ts +2 -0
- package/dist/stories/Modal.stories.jsx +36 -0
- package/dist/stories/PageComponents.stories.d.ts +1 -0
- package/dist/stories/PageComponents.stories.jsx +21 -0
- package/dist/stories/RadioGroup.stories.d.ts +3 -0
- package/dist/stories/RadioGroup.stories.jsx +54 -1
- package/dist/stories/Select.stories.d.ts +1 -0
- package/dist/stories/Select.stories.jsx +14 -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/TabsContainer.stories.d.ts +1 -0
- package/dist/stories/TabsContainer.stories.jsx +12 -0
- package/dist/stories/TextField.stories.d.ts +2 -0
- package/dist/stories/TextField.stories.jsx +22 -0
- package/dist/stories/Toaster.stories.d.ts +6 -0
- package/dist/stories/Toaster.stories.jsx +29 -0
- package/dist/stories/UserImage.stories.d.ts +2 -0
- package/dist/stories/UserImage.stories.jsx +19 -0
- package/package.json +4 -3
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Message edit
|
|
2
|
+
|
|
3
|
+
A person changes the text of a message they sent.
|
|
4
|
+
|
|
5
|
+
**Not built yet:** Scindo on the web saves and cancels with two icon buttons, a check and a cross, under the field. Scindo's Apple app shows 'Saving...' on its Save button while it saves.
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Replace the row's body with a `Composer` that holds the text, and focus it with the caret after the text.
|
|
10
|
+
- Put 'Cancel' and 'Save' in the Composer's `actions`: `<Button type="tertiary" size="small">`, then `<Button type="primary" size="small">`.
|
|
11
|
+
- Save on Enter, and cancel on Escape. Take Escape in `onKeyDown` with `preventDefault()` and `stopPropagation()`.
|
|
12
|
+
- Pass `canSubmit` so an empty or unchanged text cannot be saved, and keep 'Save' `state="disabled"` until then.
|
|
13
|
+
- Show 'Save' as `loading` while the request runs, keep its label, and disable the field and 'Cancel'.
|
|
14
|
+
- Show the new text in the row once it is saved, with '(edited)' after the time.
|
|
15
|
+
- Show '(edited)' on a compact row, which has no time line, as a caption in the row's `footer`.
|
|
16
|
+
- Move focus to the row's Edit or More button after Save or Cancel, since the field that had it is gone.
|
|
17
|
+
- Keep the field, its text, 'Cancel' and 'Save' when the save fails. Show an inline error Alert above the field, as the rule 'A form error shows next to the problem' says.
|
|
18
|
+
- Offer Edit only on the person's own messages.
|
|
19
|
+
|
|
20
|
+
## Don't
|
|
21
|
+
|
|
22
|
+
- Do not open a Modal to edit a message. The text is on screen, so it becomes the field.
|
|
23
|
+
- Do not show a toast after an edit. The new text shows where the old one was.
|
|
24
|
+
- Do not change 'Save' to 'Saving…' while it runs.
|
|
25
|
+
- Do not let Escape in the field close a Modal or a panel around the thread.
|
|
26
|
+
|
|
27
|
+
## Example: Edit in place
|
|
28
|
+
|
|
29
|
+
Uses: `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `IconButton`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `Tooltip`, `UserImage`
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
'use client';
|
|
33
|
+
import { useEffect, useRef, useState } from 'react';
|
|
34
|
+
import Message from 'oneslash-design-system/components/message';
|
|
35
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
36
|
+
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
37
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
38
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
39
|
+
import Composer from 'oneslash-design-system/components/composer';
|
|
40
|
+
import Button from 'oneslash-design-system/components/button';
|
|
41
|
+
import IconButton from 'oneslash-design-system/components/iconButton';
|
|
42
|
+
import Tooltip from 'oneslash-design-system/components/tooltip';
|
|
43
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
44
|
+
|
|
45
|
+
// A real app reads this from the session.
|
|
46
|
+
const me = 'Dana Lee';
|
|
47
|
+
|
|
48
|
+
const question = { from: 'Ben Carter', at: new Date('2025-01-15T11:40:00Z'), text: 'When does the launch email go out?' };
|
|
49
|
+
const mine = { from: me, at: new Date('2025-01-15T11:42:00Z') };
|
|
50
|
+
|
|
51
|
+
export default function MessageEditInPlace() {
|
|
52
|
+
const [text, setText] = useState('Thursday at 9:00.');
|
|
53
|
+
const [edited, setEdited] = useState(false);
|
|
54
|
+
// Opens with the message in edit mode, as if the person just chose Edit.
|
|
55
|
+
const [editing, setEditing] = useState(true);
|
|
56
|
+
const [draft, setDraft] = useState('Thursday at 9:00.');
|
|
57
|
+
const [saving, setSaving] = useState(false);
|
|
58
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
59
|
+
const field = useRef<HTMLTextAreaElement>(null);
|
|
60
|
+
const editButton = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
|
|
61
|
+
|
|
62
|
+
// On unmount it stops the request.
|
|
63
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
64
|
+
|
|
65
|
+
// Set when the person presses Edit. The example opens in edit mode without it, so nothing takes focus on load.
|
|
66
|
+
const pressedEdit = useRef(false);
|
|
67
|
+
|
|
68
|
+
// When the person opens the field, focus it with the caret after the text. When it closes, the field
|
|
69
|
+
// that had focus is gone, so focus goes to the row's Edit button.
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!editing) {
|
|
72
|
+
editButton.current?.focus();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!pressedEdit.current || !field.current) return;
|
|
76
|
+
const end = field.current.value.length;
|
|
77
|
+
field.current.focus();
|
|
78
|
+
field.current.setSelectionRange(end, end);
|
|
79
|
+
}, [editing]);
|
|
80
|
+
|
|
81
|
+
// An empty or unchanged text has nothing to save.
|
|
82
|
+
const canSave = draft.trim() !== '' && draft.trim() !== text;
|
|
83
|
+
|
|
84
|
+
function startEditing() {
|
|
85
|
+
pressedEdit.current = true;
|
|
86
|
+
setDraft(text);
|
|
87
|
+
setEditing(true);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function cancel() {
|
|
91
|
+
if (saving) return;
|
|
92
|
+
setEditing(false);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function save() {
|
|
96
|
+
if (saving || !canSave) return;
|
|
97
|
+
setSaving(true);
|
|
98
|
+
// Stands in for the request to the server.
|
|
99
|
+
timer.current = setTimeout(() => {
|
|
100
|
+
setSaving(false);
|
|
101
|
+
setText(draft.trim());
|
|
102
|
+
setEdited(true);
|
|
103
|
+
setEditing(false);
|
|
104
|
+
}, 1200);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Center width="page">
|
|
109
|
+
<Stack gap="large">
|
|
110
|
+
<Heading level={1} size="h5">Launch plan</Heading>
|
|
111
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
112
|
+
<Stack gap="small">
|
|
113
|
+
<Message
|
|
114
|
+
aria-label={question.from}
|
|
115
|
+
avatar={<UserImage userHandle={question.from} decorative />}
|
|
116
|
+
name={question.from}
|
|
117
|
+
meta={<TimeStamp createdAt={question.at} dateFormat="absolute" data="time" />}
|
|
118
|
+
>
|
|
119
|
+
<Paragraph measure="none">{question.text}</Paragraph>
|
|
120
|
+
</Message>
|
|
121
|
+
<Message
|
|
122
|
+
aria-label={mine.from}
|
|
123
|
+
avatar={<UserImage userHandle={mine.from} decorative />}
|
|
124
|
+
name={mine.from}
|
|
125
|
+
meta={
|
|
126
|
+
<>
|
|
127
|
+
<TimeStamp createdAt={mine.at} dateFormat="absolute" data="time" />
|
|
128
|
+
{edited && <Paragraph size="caption" tone="secondary" measure="none">(edited)</Paragraph>}
|
|
129
|
+
</>
|
|
130
|
+
}
|
|
131
|
+
actions={
|
|
132
|
+
editing ? undefined : (
|
|
133
|
+
<Tooltip title="Edit">
|
|
134
|
+
<IconButton ref={editButton} color="iconOnly" state="enabled" size="small" iconName="Pencil" ariaLabel="Edit your message" onClick={startEditing} />
|
|
135
|
+
</Tooltip>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
{editing ? (
|
|
140
|
+
// The body becomes a Composer in place. Enter saves and Escape cancels.
|
|
141
|
+
<Composer
|
|
142
|
+
ref={field}
|
|
143
|
+
id="message-edit-text"
|
|
144
|
+
aria-label="Edit message"
|
|
145
|
+
value={draft}
|
|
146
|
+
onChange={setDraft}
|
|
147
|
+
onSubmit={save}
|
|
148
|
+
canSubmit={canSave}
|
|
149
|
+
disabled={saving}
|
|
150
|
+
onKeyDown={(e) => {
|
|
151
|
+
if (e.key === 'Escape') {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
e.stopPropagation();
|
|
154
|
+
cancel();
|
|
155
|
+
}
|
|
156
|
+
}}
|
|
157
|
+
actions={
|
|
158
|
+
<Cluster gap="small">
|
|
159
|
+
<Button size="small" type="tertiary" state={saving ? 'disabled' : 'enabled'} label="Cancel" onClickButton={cancel} />
|
|
160
|
+
<Button size="small" type="primary" state={canSave ? 'enabled' : 'disabled'} label="Save" loading={saving} onClickButton={save} />
|
|
161
|
+
</Cluster>
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
) : (
|
|
165
|
+
<Paragraph measure="none">{text}</Paragraph>
|
|
166
|
+
)}
|
|
167
|
+
</Message>
|
|
168
|
+
</Stack>
|
|
169
|
+
</Stack>
|
|
170
|
+
</Center>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Native
|
|
176
|
+
|
|
177
|
+
On Apple the text becomes a field in the row, with 'Cancel' and 'Save', and the row shows '(edited)' after.
|
|
178
|
+
|
|
179
|
+
Seen in: Scindo.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MessageReactionsChips(): import("react").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
import { useEffect, useRef, useState } from 'react';
|
|
23
|
+
import Message from '../../components/message';
|
|
24
|
+
import UserImage from '../../components/userImage';
|
|
25
|
+
import TimeStamp from '../../components/timeStamp';
|
|
26
|
+
import Heading from '../../components/heading';
|
|
27
|
+
import Paragraph from '../../components/paragraph';
|
|
28
|
+
import Tag from '../../components/tag';
|
|
29
|
+
import IconButton from '../../components/iconButton';
|
|
30
|
+
import Tooltip from '../../components/tooltip';
|
|
31
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
32
|
+
// A real app reads this from the session.
|
|
33
|
+
var me = 'Dana Lee';
|
|
34
|
+
// Each emoji's name in words, for its aria-label.
|
|
35
|
+
var emojiNames = { '👍': 'Thumbs up', '❤️': 'Heart', '🎉': 'Party popper' };
|
|
36
|
+
var firstThread = [
|
|
37
|
+
{
|
|
38
|
+
id: 'm1',
|
|
39
|
+
from: 'Ben Carter',
|
|
40
|
+
at: new Date('2025-01-15T11:40:00Z'),
|
|
41
|
+
text: 'The pricing page is live.',
|
|
42
|
+
reactions: [
|
|
43
|
+
{ emoji: '👍', by: ['Omar Reyes', me] },
|
|
44
|
+
{ emoji: '🎉', by: ['Omar Reyes'] },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Nice work. I will share it with the sales team.', reactions: [] },
|
|
48
|
+
];
|
|
49
|
+
var firstName = function (name) { return name.split(' ')[0]; };
|
|
50
|
+
// 'Omar and you': other people by first name, the person last.
|
|
51
|
+
function whoReacted(by) {
|
|
52
|
+
var names = __spreadArray(__spreadArray([], by.filter(function (n) { return n !== me; }).map(firstName), true), (by.includes(me) ? ['you'] : []), true);
|
|
53
|
+
if (names.length === 1)
|
|
54
|
+
return names[0] === 'you' ? 'You' : names[0];
|
|
55
|
+
return "".concat(names.slice(0, -1).join(', '), " and ").concat(names[names.length - 1]);
|
|
56
|
+
}
|
|
57
|
+
// 'Thumbs up, 3 reactions'. The chip's aria-pressed says whether the person reacted.
|
|
58
|
+
function chipName(r) {
|
|
59
|
+
var count = "".concat(r.by.length, " ").concat(r.by.length === 1 ? 'reaction' : 'reactions');
|
|
60
|
+
return "".concat(emojiNames[r.emoji], ", ").concat(count);
|
|
61
|
+
}
|
|
62
|
+
export default function MessageReactionsChips() {
|
|
63
|
+
var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
|
|
64
|
+
// Each row's 'Add reaction' button by row id. When the chip that had focus goes away, focus goes there.
|
|
65
|
+
var addButtons = useRef({});
|
|
66
|
+
var focusAdd = useRef(null);
|
|
67
|
+
useEffect(function () {
|
|
68
|
+
var _a;
|
|
69
|
+
if (!focusAdd.current)
|
|
70
|
+
return;
|
|
71
|
+
(_a = addButtons.current[focusAdd.current]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
72
|
+
focusAdd.current = null;
|
|
73
|
+
});
|
|
74
|
+
// The count changes at once. A real app sends the change to the server and puts it back if that fails.
|
|
75
|
+
function toggle(rowId, emoji) {
|
|
76
|
+
var row = thread.find(function (m) { return m.id === rowId; });
|
|
77
|
+
var chip = row === null || row === void 0 ? void 0 : row.reactions.find(function (r) { return r.emoji === emoji; });
|
|
78
|
+
// The person's reaction was the last one, so the chip goes away.
|
|
79
|
+
if (chip && chip.by.length === 1 && chip.by[0] === me)
|
|
80
|
+
focusAdd.current = rowId;
|
|
81
|
+
setThread(function (rows) {
|
|
82
|
+
return rows.map(function (m) {
|
|
83
|
+
if (m.id !== rowId)
|
|
84
|
+
return m;
|
|
85
|
+
var has = m.reactions.find(function (r) { return r.emoji === emoji; });
|
|
86
|
+
var reactions = has
|
|
87
|
+
? m.reactions.map(function (r) {
|
|
88
|
+
return r.emoji !== emoji ? r : __assign(__assign({}, r), { by: r.by.includes(me) ? r.by.filter(function (n) { return n !== me; }) : __spreadArray(__spreadArray([], r.by, true), [me], false) });
|
|
89
|
+
})
|
|
90
|
+
: __spreadArray(__spreadArray([], m.reactions, true), [{ emoji: emoji, by: [me] }], false);
|
|
91
|
+
// A chip with no reactions left goes away.
|
|
92
|
+
return __assign(__assign({}, m), { reactions: reactions.filter(function (r) { return r.by.length > 0; }) });
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return (<Center width="page">
|
|
97
|
+
<Stack gap="large">
|
|
98
|
+
<Heading level={1} size="h5">Launch plan</Heading>
|
|
99
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
100
|
+
<Stack gap="small">
|
|
101
|
+
{thread.map(function (m) { return (<Message key={m.id} aria-label={m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>} footer={<Cluster gap="small">
|
|
102
|
+
{m.reactions.map(function (r) { return (<Tooltip key={r.emoji} title={whoReacted(r.by)}>
|
|
103
|
+
<Tag variant="contained" size="small" state={r.by.includes(me) ? 'selected' : 'enabled'} label={"".concat(r.emoji, " ").concat(r.by.length)} aria-label={chipName(r)} onClick={function () { return toggle(m.id, r.emoji); }}/>
|
|
104
|
+
</Tooltip>); })}
|
|
105
|
+
{/* A real app opens the quick pick here, as the option 'Quick pick' shows; this one adds a heart. */}
|
|
106
|
+
<Tooltip title="Add reaction">
|
|
107
|
+
<IconButton color="iconOnly" state="enabled" size="small" ref={function (el) { addButtons.current[m.id] = el; }} iconName="SmilePlus" ariaLabel={"Add reaction to message from ".concat(m.from)} onClick={function () {
|
|
108
|
+
if (!m.reactions.some(function (r) { return r.emoji === '❤️' && r.by.includes(me); }))
|
|
109
|
+
toggle(m.id, '❤️');
|
|
110
|
+
}}/>
|
|
111
|
+
</Tooltip>
|
|
112
|
+
</Cluster>}>
|
|
113
|
+
<Paragraph measure="none">{m.text}</Paragraph>
|
|
114
|
+
</Message>); })}
|
|
115
|
+
</Stack>
|
|
116
|
+
</Stack>
|
|
117
|
+
</Center>);
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function MessageReactionsQuickPick(): import("react").JSX.Element;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
import { useEffect, useRef, useState } from 'react';
|
|
23
|
+
import Message from '../../components/message';
|
|
24
|
+
import UserImage from '../../components/userImage';
|
|
25
|
+
import TimeStamp from '../../components/timeStamp';
|
|
26
|
+
import Heading from '../../components/heading';
|
|
27
|
+
import Paragraph from '../../components/paragraph';
|
|
28
|
+
import Tag from '../../components/tag';
|
|
29
|
+
import IconButton from '../../components/iconButton';
|
|
30
|
+
import Tooltip from '../../components/tooltip';
|
|
31
|
+
import Popover from '../../components/popover';
|
|
32
|
+
import Menu from '../../components/menu';
|
|
33
|
+
import MenuItem from '../../components/menuItem';
|
|
34
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
35
|
+
// A real app reads this from the session.
|
|
36
|
+
var me = 'Dana Lee';
|
|
37
|
+
// The six emoji people use most, each named in words. ODS has no full emoji picker yet.
|
|
38
|
+
var quickEmoji = [
|
|
39
|
+
{ emoji: '👍', name: 'Thumbs up' },
|
|
40
|
+
{ emoji: '❤️', name: 'Heart' },
|
|
41
|
+
{ emoji: '😂', name: 'Tears of joy' },
|
|
42
|
+
{ emoji: '🎉', name: 'Party popper' },
|
|
43
|
+
{ emoji: '👀', name: 'Eyes' },
|
|
44
|
+
{ emoji: '🚀', name: 'Rocket' },
|
|
45
|
+
];
|
|
46
|
+
var emojiName = function (emoji) { var _a, _b; return (_b = (_a = quickEmoji.find(function (q) { return q.emoji === emoji; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : emoji; };
|
|
47
|
+
var firstThread = [
|
|
48
|
+
{
|
|
49
|
+
id: 'm1',
|
|
50
|
+
from: 'Ben Carter',
|
|
51
|
+
at: new Date('2025-01-15T11:40:00Z'),
|
|
52
|
+
text: 'The pricing page is live.',
|
|
53
|
+
reactions: [{ emoji: '👍', by: ['Omar Reyes', me] }],
|
|
54
|
+
},
|
|
55
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Nice work. I will share it with the sales team.', reactions: [] },
|
|
56
|
+
];
|
|
57
|
+
var firstName = function (name) { return name.split(' ')[0]; };
|
|
58
|
+
// 'Omar and you': other people by first name, the person last.
|
|
59
|
+
function whoReacted(by) {
|
|
60
|
+
var names = __spreadArray(__spreadArray([], by.filter(function (n) { return n !== me; }).map(firstName), true), (by.includes(me) ? ['you'] : []), true);
|
|
61
|
+
if (names.length === 1)
|
|
62
|
+
return names[0] === 'you' ? 'You' : names[0];
|
|
63
|
+
return "".concat(names.slice(0, -1).join(', '), " and ").concat(names[names.length - 1]);
|
|
64
|
+
}
|
|
65
|
+
// 'Thumbs up, 3 reactions'. The chip's aria-pressed says whether the person reacted.
|
|
66
|
+
function chipName(r) {
|
|
67
|
+
var count = "".concat(r.by.length, " ").concat(r.by.length === 1 ? 'reaction' : 'reactions');
|
|
68
|
+
return "".concat(emojiName(r.emoji), ", ").concat(count);
|
|
69
|
+
}
|
|
70
|
+
export default function MessageReactionsQuickPick() {
|
|
71
|
+
var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
|
|
72
|
+
// Each row's 'Add reaction' button by row id. When the chip that had focus goes away, focus goes there.
|
|
73
|
+
var addButtons = useRef({});
|
|
74
|
+
var focusAdd = useRef(null);
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
var _a;
|
|
77
|
+
if (!focusAdd.current)
|
|
78
|
+
return;
|
|
79
|
+
(_a = addButtons.current[focusAdd.current]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
80
|
+
focusAdd.current = null;
|
|
81
|
+
});
|
|
82
|
+
// The row whose quick pick is open, and the button it opens from. Both stay set while it fades out.
|
|
83
|
+
var _b = useState(null), pickRow = _b[0], setPickRow = _b[1];
|
|
84
|
+
var _c = useState(null), pickAnchor = _c[0], setPickAnchor = _c[1];
|
|
85
|
+
var _d = useState(false), pickOpen = _d[0], setPickOpen = _d[1];
|
|
86
|
+
// The count changes at once. A real app sends the change to the server and puts it back if that fails.
|
|
87
|
+
function toggle(rowId, emoji) {
|
|
88
|
+
var row = thread.find(function (m) { return m.id === rowId; });
|
|
89
|
+
var chip = row === null || row === void 0 ? void 0 : row.reactions.find(function (r) { return r.emoji === emoji; });
|
|
90
|
+
// The person's reaction was the last one, so the chip goes away.
|
|
91
|
+
if (chip && chip.by.length === 1 && chip.by[0] === me)
|
|
92
|
+
focusAdd.current = rowId;
|
|
93
|
+
setThread(function (rows) {
|
|
94
|
+
return rows.map(function (m) {
|
|
95
|
+
if (m.id !== rowId)
|
|
96
|
+
return m;
|
|
97
|
+
var has = m.reactions.find(function (r) { return r.emoji === emoji; });
|
|
98
|
+
var reactions = has
|
|
99
|
+
? m.reactions.map(function (r) {
|
|
100
|
+
return r.emoji !== emoji ? r : __assign(__assign({}, r), { by: r.by.includes(me) ? r.by.filter(function (n) { return n !== me; }) : __spreadArray(__spreadArray([], r.by, true), [me], false) });
|
|
101
|
+
})
|
|
102
|
+
: __spreadArray(__spreadArray([], m.reactions, true), [{ emoji: emoji, by: [me] }], false);
|
|
103
|
+
// A chip with no reactions left goes away.
|
|
104
|
+
return __assign(__assign({}, m), { reactions: reactions.filter(function (r) { return r.by.length > 0; }) });
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function openPick(m, anchor) {
|
|
109
|
+
if (pickOpen && (pickRow === null || pickRow === void 0 ? void 0 : pickRow.id) === m.id) {
|
|
110
|
+
setPickOpen(false);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
setPickRow(m);
|
|
114
|
+
setPickAnchor(anchor);
|
|
115
|
+
setPickOpen(true);
|
|
116
|
+
}
|
|
117
|
+
// Escape, a click outside and a pick close it. Popover's returnFocus gives focus back to 'Add reaction'.
|
|
118
|
+
function closePick() {
|
|
119
|
+
setPickOpen(false);
|
|
120
|
+
}
|
|
121
|
+
function pick(emoji) {
|
|
122
|
+
if (!pickRow)
|
|
123
|
+
return;
|
|
124
|
+
closePick();
|
|
125
|
+
toggle(pickRow.id, emoji);
|
|
126
|
+
}
|
|
127
|
+
// The open row, read from the thread so the quick pick shows its reactions as they are now.
|
|
128
|
+
var openRow = thread.find(function (m) { return m.id === (pickRow === null || pickRow === void 0 ? void 0 : pickRow.id); });
|
|
129
|
+
return (<Center width="page">
|
|
130
|
+
<Stack gap="large">
|
|
131
|
+
<Heading level={1} size="h5">Launch plan</Heading>
|
|
132
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
133
|
+
<Stack gap="small">
|
|
134
|
+
{thread.map(function (m) { return (<Message key={m.id} aria-label={m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>} footer={<Cluster gap="small">
|
|
135
|
+
{m.reactions.map(function (r) { return (<Tooltip key={r.emoji} title={whoReacted(r.by)}>
|
|
136
|
+
<Tag variant="contained" size="small" state={r.by.includes(me) ? 'selected' : 'enabled'} label={"".concat(r.emoji, " ").concat(r.by.length)} aria-label={chipName(r)} onClick={function () { return toggle(m.id, r.emoji); }}/>
|
|
137
|
+
</Tooltip>); })}
|
|
138
|
+
<Tooltip title="Add reaction">
|
|
139
|
+
<IconButton color="iconOnly" state={pickOpen && (pickRow === null || pickRow === void 0 ? void 0 : pickRow.id) === m.id ? 'selected' : 'enabled'} size="small" ref={function (el) { addButtons.current[m.id] = el; }} iconName="SmilePlus" ariaLabel={"Add reaction to message from ".concat(m.from)} aria-haspopup="menu" aria-expanded={pickOpen && (pickRow === null || pickRow === void 0 ? void 0 : pickRow.id) === m.id} onClick={function (e) { return openPick(m, e.currentTarget); }}/>
|
|
140
|
+
</Tooltip>
|
|
141
|
+
</Cluster>}>
|
|
142
|
+
<Paragraph measure="none">{m.text}</Paragraph>
|
|
143
|
+
</Message>); })}
|
|
144
|
+
</Stack>
|
|
145
|
+
</Stack>
|
|
146
|
+
{/* A navigable Menu focuses its first item and takes the arrow keys, Home, End and letters. */}
|
|
147
|
+
<Popover open={pickOpen} anchorEl={pickAnchor} onClose={closePick} returnFocus>
|
|
148
|
+
<Menu navigable aria-label="Add reaction" width={200}>
|
|
149
|
+
{quickEmoji.map(function (q) { return (<MenuItem key={q.emoji} size="small" icon={q.emoji} label={q.name}
|
|
150
|
+
// Picking an emoji the person already used removes it.
|
|
151
|
+
tag={(openRow === null || openRow === void 0 ? void 0 : openRow.reactions.some(function (r) { return r.emoji === q.emoji && r.by.includes(me); })) ? { label: 'Added', variant: 'textOnly' } : undefined} onClick={function () { return pick(q.emoji); }}/>); })}
|
|
152
|
+
</Menu>
|
|
153
|
+
</Popover>
|
|
154
|
+
</Center>);
|
|
155
|
+
}
|