oneslash-design-system 2.16.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.
Files changed (151) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +26 -3
  3. package/dist/cases/accept-invite/signed-in.jsx +1 -1
  4. package/dist/cases/accept-invite/signed-out.jsx +1 -1
  5. package/dist/cases/accept-invite.md +2 -2
  6. package/dist/cases/agent-options/cards.d.ts +1 -0
  7. package/dist/cases/agent-options/cards.jsx +91 -0
  8. package/dist/cases/agent-options.md +168 -0
  9. package/dist/cases/agent-pending-reply/steps.d.ts +1 -0
  10. package/dist/cases/agent-pending-reply/steps.jsx +149 -0
  11. package/dist/cases/agent-pending-reply/streaming.d.ts +1 -0
  12. package/dist/cases/agent-pending-reply/streaming.jsx +146 -0
  13. package/dist/cases/agent-pending-reply.md +432 -0
  14. package/dist/cases/agent-plan-proposal/changes.d.ts +1 -0
  15. package/dist/cases/agent-plan-proposal/changes.jsx +224 -0
  16. package/dist/cases/agent-plan-proposal/steps.d.ts +1 -0
  17. package/dist/cases/agent-plan-proposal/steps.jsx +211 -0
  18. package/dist/cases/agent-plan-proposal.md +656 -0
  19. package/dist/cases/agent-question/choices.d.ts +1 -0
  20. package/dist/cases/agent-question/choices.jsx +132 -0
  21. package/dist/cases/agent-question/free-text.d.ts +1 -0
  22. package/dist/cases/agent-question/free-text.jsx +81 -0
  23. package/dist/cases/agent-question.md +338 -0
  24. package/dist/cases/agent-shows-sources.md +2 -2
  25. package/dist/cases/artifact-card/card.d.ts +1 -0
  26. package/dist/cases/artifact-card/card.jsx +45 -0
  27. package/dist/cases/artifact-card.md +103 -0
  28. package/dist/cases/composer-limit/notice-with-action.d.ts +1 -0
  29. package/dist/cases/composer-limit/notice-with-action.jsx +87 -0
  30. package/dist/cases/composer-limit/notice.d.ts +1 -0
  31. package/dist/cases/composer-limit/notice.jsx +84 -0
  32. package/dist/cases/composer-limit.md +286 -0
  33. package/dist/cases/conversation-starters/chips.d.ts +1 -0
  34. package/dist/cases/conversation-starters/chips.jsx +69 -0
  35. package/dist/cases/conversation-starters/none.d.ts +1 -0
  36. package/dist/cases/conversation-starters/none.jsx +45 -0
  37. package/dist/cases/conversation-starters.md +208 -0
  38. package/dist/cases/mention-list/in-composer.d.ts +1 -0
  39. package/dist/cases/mention-list/in-composer.jsx +169 -0
  40. package/dist/cases/mention-list.md +252 -0
  41. package/dist/cases/message-actions/hover-toolbar.d.ts +1 -0
  42. package/dist/cases/message-actions/hover-toolbar.jsx +229 -0
  43. package/dist/cases/message-actions/menu.d.ts +1 -0
  44. package/dist/cases/message-actions/menu.jsx +258 -0
  45. package/dist/cases/message-actions.md +651 -0
  46. package/dist/cases/message-attachments/in-composer.d.ts +1 -0
  47. package/dist/cases/message-attachments/in-composer.jsx +134 -0
  48. package/dist/cases/message-attachments/in-message.d.ts +1 -0
  49. package/dist/cases/message-attachments/in-message.jsx +46 -0
  50. package/dist/cases/message-attachments.md +310 -0
  51. package/dist/cases/message-composer/plain.d.ts +1 -0
  52. package/dist/cases/message-composer/plain.jsx +57 -0
  53. package/dist/cases/message-composer/with-tools.d.ts +1 -0
  54. package/dist/cases/message-composer/with-tools.jsx +182 -0
  55. package/dist/cases/message-composer.md +356 -0
  56. package/dist/cases/message-edit/in-place.d.ts +1 -0
  57. package/dist/cases/message-edit/in-place.jsx +99 -0
  58. package/dist/cases/message-edit.md +179 -0
  59. package/dist/cases/message-reactions/chips.d.ts +1 -0
  60. package/dist/cases/message-reactions/chips.jsx +118 -0
  61. package/dist/cases/message-reactions/quick-pick.d.ts +1 -0
  62. package/dist/cases/message-reactions/quick-pick.jsx +155 -0
  63. package/dist/cases/message-reactions.md +371 -0
  64. package/dist/cases/message-row/grouped.d.ts +1 -0
  65. package/dist/cases/message-row/grouped.jsx +56 -0
  66. package/dist/cases/message-row/person-and-agent.d.ts +1 -0
  67. package/dist/cases/message-row/person-and-agent.jsx +41 -0
  68. package/dist/cases/message-row.md +189 -0
  69. package/dist/cases/reply-feedback/thumbs.d.ts +1 -0
  70. package/dist/cases/reply-feedback/thumbs.jsx +191 -0
  71. package/dist/cases/reply-feedback/with-reason.d.ts +1 -0
  72. package/dist/cases/reply-feedback/with-reason.jsx +221 -0
  73. package/dist/cases/reply-feedback.md +552 -0
  74. package/dist/cases/reply-sources/cards.d.ts +1 -0
  75. package/dist/cases/reply-sources/cards.jsx +83 -0
  76. package/dist/cases/reply-sources/tag-only.d.ts +1 -0
  77. package/dist/cases/reply-sources/tag-only.jsx +45 -0
  78. package/dist/cases/reply-sources.md +247 -0
  79. package/dist/cases/slash-command-list/in-composer.d.ts +1 -0
  80. package/dist/cases/slash-command-list/in-composer.jsx +162 -0
  81. package/dist/cases/slash-command-list.md +247 -0
  82. package/dist/cases/success-feedback.md +1 -1
  83. package/dist/cases/typing-and-status/line.d.ts +1 -0
  84. package/dist/cases/typing-and-status/line.jsx +50 -0
  85. package/dist/cases/typing-and-status.md +96 -0
  86. package/dist/cases.json +1276 -14
  87. package/dist/components/button.d.ts +3 -2
  88. package/dist/components/button.jsx +9 -7
  89. package/dist/components/composer.d.ts +74 -0
  90. package/dist/components/composer.jsx +122 -0
  91. package/dist/components/fileChip.d.ts +33 -0
  92. package/dist/components/fileChip.jsx +61 -0
  93. package/dist/components/iconButton.d.ts +3 -3
  94. package/dist/components/iconButton.jsx +9 -7
  95. package/dist/components/layout.d.ts +7 -1
  96. package/dist/components/layout.jsx +5 -2
  97. package/dist/components/menu.d.ts +21 -0
  98. package/dist/components/menu.jsx +27 -3
  99. package/dist/components/menuItem.d.ts +9 -1
  100. package/dist/components/menuItem.jsx +5 -4
  101. package/dist/components/message.d.ts +28 -0
  102. package/dist/components/message.jsx +25 -0
  103. package/dist/components/paragraph.d.ts +3 -1
  104. package/dist/components/paragraph.jsx +2 -2
  105. package/dist/components/popover.d.ts +7 -1
  106. package/dist/components/popover.jsx +35 -9
  107. package/dist/components/radioGroup.d.ts +8 -1
  108. package/dist/components/radioGroup.jsx +19 -8
  109. package/dist/components/sourceCard.d.ts +23 -0
  110. package/dist/components/sourceCard.jsx +56 -0
  111. package/dist/components/stepList.d.ts +17 -0
  112. package/dist/components/stepList.jsx +79 -0
  113. package/dist/components/tag.d.ts +9 -1
  114. package/dist/components/tag.jsx +6 -4
  115. package/dist/components/textarea.jsx +3 -18
  116. package/dist/components/userImage.d.ts +9 -1
  117. package/dist/components/userImage.jsx +10 -3
  118. package/dist/internal/autoGrow.d.ts +11 -0
  119. package/dist/internal/autoGrow.js +28 -0
  120. package/dist/internal/composer.d.ts +16 -0
  121. package/dist/internal/composer.js +18 -0
  122. package/dist/internal/menu.d.ts +6 -0
  123. package/dist/internal/menu.js +31 -0
  124. package/dist/native-mapping.json +32 -1
  125. package/dist/stories/Button.stories.d.ts +1 -0
  126. package/dist/stories/Button.stories.jsx +17 -1
  127. package/dist/stories/Cases.generated.stories.d.ts +30 -0
  128. package/dist/stories/Cases.generated.stories.jsx +60 -0
  129. package/dist/stories/Composer.stories.d.ts +23 -0
  130. package/dist/stories/Composer.stories.jsx +121 -0
  131. package/dist/stories/FileChip.stories.d.ts +7 -0
  132. package/dist/stories/FileChip.stories.jsx +35 -0
  133. package/dist/stories/IconButton.stories.d.ts +1 -0
  134. package/dist/stories/IconButton.stories.jsx +18 -1
  135. package/dist/stories/Menu.stories.d.ts +4 -0
  136. package/dist/stories/Menu.stories.jsx +46 -1
  137. package/dist/stories/MenuItem.stories.d.ts +1 -0
  138. package/dist/stories/MenuItem.stories.jsx +8 -0
  139. package/dist/stories/Message.stories.d.ts +10 -0
  140. package/dist/stories/Message.stories.jsx +77 -0
  141. package/dist/stories/PageComponents.stories.d.ts +1 -0
  142. package/dist/stories/PageComponents.stories.jsx +21 -0
  143. package/dist/stories/RadioGroup.stories.d.ts +2 -0
  144. package/dist/stories/RadioGroup.stories.jsx +40 -1
  145. package/dist/stories/SourceCard.stories.d.ts +8 -0
  146. package/dist/stories/SourceCard.stories.jsx +33 -0
  147. package/dist/stories/StepList.stories.d.ts +8 -0
  148. package/dist/stories/StepList.stories.jsx +35 -0
  149. package/dist/stories/UserImage.stories.d.ts +2 -0
  150. package/dist/stories/UserImage.stories.jsx +19 -0
  151. package/package.json +4 -3
@@ -0,0 +1,103 @@
1
+ # Document card
2
+
3
+ The agent made a document for the person, such as a plan or a report.
4
+
5
+ **Not built yet:** Scindo's card shows the kind, the title and 'Open' on one line, with no icon and no length. Its reply is not short: it is cut to its first lines.
6
+
7
+ ## Do
8
+
9
+ - Keep the reply to one sentence on what the agent made. Then put the card in the reply's `footer`.
10
+ - Show the document as a `SourceCard`: an icon for its kind, its title, its kind and length in `meta` ('Document · 4 pages'), and `action="Open"`.
11
+ - Open the document from the card with `onClick`, in a pane beside the thread.
12
+ - Move focus into the pane when it opens.
13
+ - Give the pane a Close control, and move focus back to the card when the pane closes.
14
+ - Bring the open pane forward when the person presses the card again, instead of opening a second one.
15
+ - Mark the agent's row as the rule 'An agent says what it is' says.
16
+ - Give the list that holds the rows `role="log"`.
17
+
18
+ ## Don't
19
+
20
+ - Do not paste the document into the thread.
21
+ - Do not repeat or list what the document says in the reply.
22
+ - Do not show the document's card on a person's message.
23
+
24
+ ## Example: In the thread
25
+
26
+ Uses: `Center`, `Grid`, `Heading`, `Message`, `Paragraph`, `SourceCard`, `Stack`, `Tag`, `TimeStamp`, `UserImage`
27
+
28
+ ```tsx
29
+ 'use client';
30
+ import { Bot, FileText } from 'lucide-react';
31
+ import Message from 'oneslash-design-system/components/message';
32
+ import UserImage from 'oneslash-design-system/components/userImage';
33
+ import Tag from 'oneslash-design-system/components/tag';
34
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
35
+ import Heading from 'oneslash-design-system/components/heading';
36
+ import Paragraph from 'oneslash-design-system/components/paragraph';
37
+ import SourceCard from 'oneslash-design-system/components/sourceCard';
38
+ import { Center, Grid, Stack } from 'oneslash-design-system/components/layout';
39
+
40
+ const agentName = 'Acme Agent';
41
+
42
+ const request = { from: 'Dana Lee', at: new Date('2025-01-15T11:40:00Z'), text: 'Can you write up the launch plan as a document?' };
43
+ const repliedAt = new Date('2025-01-15T11:41:00Z');
44
+ // One sentence on what the agent made. The document itself stays out of the thread.
45
+ const reply = 'I wrote the launch plan for March 3 as a document.';
46
+
47
+ const doc = { title: 'Launch plan for March 3', meta: 'Document · 4 pages' };
48
+
49
+ // The agent's marks, as the rule 'An agent says what it is' says.
50
+ function agentMeta(at: Date) {
51
+ return (
52
+ <>
53
+ <Tag variant="contained" size="small" label="Agent" />
54
+ <TimeStamp createdAt={at} dateFormat="absolute" data="time" />
55
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
56
+ </>
57
+ );
58
+ }
59
+
60
+ // A real app opens the document in a pane beside the thread and moves focus into it.
61
+ // ODS has no side pane part yet, so this example shows the card only.
62
+ function openDocument() {}
63
+
64
+ export default function ArtifactCardCard() {
65
+ return (
66
+ <Center width="page">
67
+ <Stack gap="large">
68
+ <Heading level={1} size="h5">Launch plan</Heading>
69
+ {/* A real app gives the list that holds the rows role="log". */}
70
+ <Stack gap="small">
71
+ <Message
72
+ aria-label={request.from}
73
+ avatar={<UserImage userHandle={request.from} decorative />}
74
+ name={request.from}
75
+ meta={<TimeStamp createdAt={request.at} dateFormat="absolute" data="time" />}
76
+ >
77
+ <Paragraph measure="none">{request.text}</Paragraph>
78
+ </Message>
79
+ <Message
80
+ aria-label={`${agentName}, agent`}
81
+ avatar={<UserImage userHandle={agentName} icon={Bot} decorative />}
82
+ name={agentName}
83
+ meta={agentMeta(repliedAt)}
84
+ footer={
85
+ <Grid columns={2} gap="medium">
86
+ <SourceCard icon={FileText} title={doc.title} meta={doc.meta} action="Open" onClick={openDocument} />
87
+ </Grid>
88
+ }
89
+ >
90
+ <Paragraph measure="none">{reply}</Paragraph>
91
+ </Message>
92
+ </Stack>
93
+ </Stack>
94
+ </Center>
95
+ );
96
+ }
97
+ ```
98
+
99
+ ## Native
100
+
101
+ On Mac the card opens the document in the canvas beside the thread. On iPhone it opens the document in a read-only sheet.
102
+
103
+ Seen in: Scindo.
@@ -0,0 +1 @@
1
+ export default function ComposerLimitNoticeWithAction(): import("react").JSX.Element;
@@ -0,0 +1,87 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useRef, useState } from 'react';
12
+ import { Bot } from 'lucide-react';
13
+ import Message from '../../components/message';
14
+ import UserImage from '../../components/userImage';
15
+ import TimeStamp from '../../components/timeStamp';
16
+ import Heading from '../../components/heading';
17
+ import Paragraph from '../../components/paragraph';
18
+ import Composer from '../../components/composer';
19
+ import Alert from '../../components/alert';
20
+ import Button from '../../components/button';
21
+ import IconButton from '../../components/iconButton';
22
+ import Tooltip from '../../components/tooltip';
23
+ import { Center, Cluster, Stack } from '../../components/layout';
24
+ // A real app passes the router from its framework, such as Next's useRouter().
25
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
26
+ // A real app reads this from the session.
27
+ var me = 'Dana Lee';
28
+ var firstThread = [
29
+ { id: 'm1', from: 'Ben Carter', at: new Date('2025-01-15T11:40:00Z'), text: 'The pricing page is live.' },
30
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Who writes the launch email?' },
31
+ ];
32
+ var FIVE_MINUTES = 5 * 60 * 1000;
33
+ // A follow-on row: the same sender as the row above, less than 5 minutes later and on the same day.
34
+ function followsOn(rows, i) {
35
+ var prev = rows[i - 1];
36
+ return (!!prev &&
37
+ prev.from === rows[i].from &&
38
+ rows[i].at.getTime() - prev.at.getTime() < FIVE_MINUTES &&
39
+ rows[i].at.toDateString() === prev.at.toDateString());
40
+ }
41
+ export default function ComposerLimitNoticeWithAction() {
42
+ var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
43
+ var _b = useState(''), text = _b[0], setText = _b[1];
44
+ // Opens on the notice, as if the workspace just used its last AI agent response of the month.
45
+ var _c = useState(true), showNotice = _c[0], setShowNotice = _c[1];
46
+ var field = useRef(null);
47
+ // 'Not Now' goes away with the notice, so focus goes to the message box.
48
+ function notNow() {
49
+ var _a;
50
+ setShowNotice(false);
51
+ (_a = field.current) === null || _a === void 0 ? void 0 : _a.focus();
52
+ }
53
+ // The agent cannot be called, but messages to people still send.
54
+ function send() {
55
+ // A real app sends the message to the server here and shows it at once.
56
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date(), text: text.trim() }], false); });
57
+ setText('');
58
+ }
59
+ return (<Center width="page">
60
+ <Stack gap="large">
61
+ <Heading level={1} size="h5">Launch plan</Heading>
62
+ {/* A real app gives the list that holds the rows role="log". */}
63
+ <Stack gap="small">
64
+ {thread.map(function (m, i) { return (<Message key={m.id} aria-label={m.from} compact={followsOn(thread, i)} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
65
+ <Paragraph measure="none">{m.text}</Paragraph>
66
+ </Message>); })}
67
+ </Stack>
68
+ <Composer ref={field} id="composer-limit-action-message" aria-label="Message"
69
+ // After 'Not Now' the placeholder says when agent replies start again.
70
+ placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'} value={text} onChange={setText} onSubmit={send}
71
+ // A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
72
+ // This person can change the plan, so they get the button that lifts the limit. Alert has no action slot.
73
+ above={showNotice ? (<Stack gap="small">
74
+ <Alert type="warning" variant="inline" autoDismiss={false} message="You've used all 50 AI agent responses this month." secondMessage="They start again on December 1. The Pro plan gives Acme Design 1,000 AI agent responses a month."/>
75
+ <Cluster gap="small">
76
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow}/>
77
+ <Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return router.push('/settings/billing?plan=pro'); }}/>
78
+ </Cluster>
79
+ </Stack>) : undefined} tools={
80
+ // It stays pressable while the limit stands, as the case 'Upgrade prompt' says: pressing it shows the notice
81
+ // again. It does not turn on until the limit is lifted.
82
+ <Tooltip title="Mention the agent">
83
+ <IconButton color="iconOnly" state="enabled" size="small" icon={Bot} ariaLabel="Mention the agent" aria-pressed={false} onClick={function () { return setShowNotice(true); }}/>
84
+ </Tooltip>}/>
85
+ </Stack>
86
+ </Center>);
87
+ }
@@ -0,0 +1 @@
1
+ export default function ComposerLimitNotice(): import("react").JSX.Element;
@@ -0,0 +1,84 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useRef, useState } from 'react';
12
+ import { Bot } from 'lucide-react';
13
+ import Message from '../../components/message';
14
+ import UserImage from '../../components/userImage';
15
+ import TimeStamp from '../../components/timeStamp';
16
+ import Heading from '../../components/heading';
17
+ import Paragraph from '../../components/paragraph';
18
+ import Composer from '../../components/composer';
19
+ import Alert from '../../components/alert';
20
+ import Button from '../../components/button';
21
+ import IconButton from '../../components/iconButton';
22
+ import Tooltip from '../../components/tooltip';
23
+ import { Center, Cluster, Stack } from '../../components/layout';
24
+ // A real app reads this from the session.
25
+ var me = 'Dana Lee';
26
+ var firstThread = [
27
+ { id: 'm1', from: 'Ben Carter', at: new Date('2025-01-15T11:40:00Z'), text: 'The pricing page is live.' },
28
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Who writes the launch email?' },
29
+ ];
30
+ var FIVE_MINUTES = 5 * 60 * 1000;
31
+ // A follow-on row: the same sender as the row above, less than 5 minutes later and on the same day.
32
+ function followsOn(rows, i) {
33
+ var prev = rows[i - 1];
34
+ return (!!prev &&
35
+ prev.from === rows[i].from &&
36
+ rows[i].at.getTime() - prev.at.getTime() < FIVE_MINUTES &&
37
+ rows[i].at.toDateString() === prev.at.toDateString());
38
+ }
39
+ export default function ComposerLimitNotice() {
40
+ var _a = useState(firstThread), thread = _a[0], setThread = _a[1];
41
+ var _b = useState(''), text = _b[0], setText = _b[1];
42
+ // Opens on the notice, as if the workspace just used its last AI agent response of the month.
43
+ var _c = useState(true), showNotice = _c[0], setShowNotice = _c[1];
44
+ var field = useRef(null);
45
+ // 'Not Now' goes away with the notice, so focus goes to the message box.
46
+ function notNow() {
47
+ var _a;
48
+ setShowNotice(false);
49
+ (_a = field.current) === null || _a === void 0 ? void 0 : _a.focus();
50
+ }
51
+ // The agent cannot be called, but messages to people still send.
52
+ function send() {
53
+ // A real app sends the message to the server here and shows it at once.
54
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date(), text: text.trim() }], false); });
55
+ setText('');
56
+ }
57
+ return (<Center width="page">
58
+ <Stack gap="large">
59
+ <Heading level={1} size="h5">Launch plan</Heading>
60
+ {/* A real app gives the list that holds the rows role="log". */}
61
+ <Stack gap="small">
62
+ {thread.map(function (m, i) { return (<Message key={m.id} aria-label={m.from} compact={followsOn(thread, i)} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
63
+ <Paragraph measure="none">{m.text}</Paragraph>
64
+ </Message>); })}
65
+ </Stack>
66
+ <Composer ref={field} id="composer-limit-notice-message" aria-label="Message"
67
+ // After 'Not Now' the placeholder says when agent replies start again.
68
+ placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'} value={text} onChange={setText} onSubmit={send}
69
+ // A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
70
+ // This person cannot change the plan, so it says who can. Everyone can close a refusal. Alert has no action slot.
71
+ above={showNotice ? (<Stack gap="small">
72
+ <Alert type="warning" variant="inline" autoDismiss={false} message="You've used all 50 AI agent responses this month." secondMessage="They start again on December 1. Ask a workspace admin to upgrade Acme Design to Pro for more replies."/>
73
+ <Cluster gap="small">
74
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow}/>
75
+ </Cluster>
76
+ </Stack>) : undefined} tools={
77
+ // It stays pressable while the limit stands, as the case 'Upgrade prompt' says: pressing it shows the notice
78
+ // again. It does not turn on until the limit is lifted.
79
+ <Tooltip title="Mention the agent">
80
+ <IconButton color="iconOnly" state="enabled" size="small" icon={Bot} ariaLabel="Mention the agent" aria-pressed={false} onClick={function () { return setShowNotice(true); }}/>
81
+ </Tooltip>}/>
82
+ </Stack>
83
+ </Center>);
84
+ }
@@ -0,0 +1,286 @@
1
+ # Composer at a limit
2
+
3
+ The agent cannot be called from the composer because the workspace reached a limit, such as its agent replies for the month.
4
+
5
+ **Not built yet:** Scindo on the web shows the monthly limit in an overlay over the thread, and shows its Upgrade button to everyone. Its other limits show as an error Alert that the person closes.
6
+
7
+ ## Do
8
+
9
+ - Follow the rule 'An agent refuses clearly' word for word: "You've used all 50 AI agent responses this month."
10
+ - Put the notice in the Composer's `above` slot: `<Alert variant="inline" autoDismiss={false}>`, with no close button on the Alert itself.
11
+ - Say when it resets and who can change it: 'Ask a workspace admin to upgrade Acme Design to Pro for more replies.'
12
+ - Give everyone 'Not Now', a tertiary Button, so the refusal can be closed. Put the Buttons in a `Cluster` under the Alert.
13
+ - Give a person who can lift the limit the action after 'Not Now', as a primary Button, such as 'Upgrade to Pro'.
14
+ - Keep the agent toggle pressable while the limit stands, as the case 'Upgrade prompt' says. Pressing it shows the notice again, and it does not turn on.
15
+ - Say in the placeholder when agent replies start again, once the person chose 'Not Now'.
16
+ - Move focus to the message box after 'Not Now', since the Button that had it is gone.
17
+ - Keep the field and send working, so messages to people still go.
18
+ - Follow the case 'Upgrade prompt' for a limit reached anywhere outside the message box.
19
+
20
+ ## Don't
21
+
22
+ - Do not disable the whole Composer. Only the agent is refused.
23
+ - Do not hide or disable the agent toggle. The person presses it and learns why it does not work.
24
+ - Do not show the upgrade Button to someone who cannot upgrade.
25
+ - Do not show a general error, or a toast that goes away, for a limit.
26
+ - Do not cover the thread with a Modal when the agent is refused.
27
+
28
+ ## Option: Notice
29
+
30
+ Use when: The person cannot lift the limit.
31
+
32
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `IconButton`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `Tooltip`, `UserImage`
33
+
34
+ ```tsx
35
+ 'use client';
36
+ import { useRef, useState } from 'react';
37
+ import { Bot } from 'lucide-react';
38
+ import Message from 'oneslash-design-system/components/message';
39
+ import UserImage from 'oneslash-design-system/components/userImage';
40
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
41
+ import Heading from 'oneslash-design-system/components/heading';
42
+ import Paragraph from 'oneslash-design-system/components/paragraph';
43
+ import Composer from 'oneslash-design-system/components/composer';
44
+ import Alert from 'oneslash-design-system/components/alert';
45
+ import Button from 'oneslash-design-system/components/button';
46
+ import IconButton from 'oneslash-design-system/components/iconButton';
47
+ import Tooltip from 'oneslash-design-system/components/tooltip';
48
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
49
+
50
+ // A real app reads this from the session.
51
+ const me = 'Dana Lee';
52
+
53
+ type Row = { id: string; from: string; at: Date; text: string };
54
+
55
+ const firstThread: Row[] = [
56
+ { id: 'm1', from: 'Ben Carter', at: new Date('2025-01-15T11:40:00Z'), text: 'The pricing page is live.' },
57
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Who writes the launch email?' },
58
+ ];
59
+
60
+ const FIVE_MINUTES = 5 * 60 * 1000;
61
+
62
+ // A follow-on row: the same sender as the row above, less than 5 minutes later and on the same day.
63
+ function followsOn(rows: Row[], i: number) {
64
+ const prev = rows[i - 1];
65
+ return (
66
+ !!prev &&
67
+ prev.from === rows[i].from &&
68
+ rows[i].at.getTime() - prev.at.getTime() < FIVE_MINUTES &&
69
+ rows[i].at.toDateString() === prev.at.toDateString()
70
+ );
71
+ }
72
+
73
+ export default function ComposerLimitNotice() {
74
+ const [thread, setThread] = useState(firstThread);
75
+ const [text, setText] = useState('');
76
+ // Opens on the notice, as if the workspace just used its last AI agent response of the month.
77
+ const [showNotice, setShowNotice] = useState(true);
78
+ const field = useRef<HTMLTextAreaElement>(null);
79
+
80
+ // 'Not Now' goes away with the notice, so focus goes to the message box.
81
+ function notNow() {
82
+ setShowNotice(false);
83
+ field.current?.focus();
84
+ }
85
+
86
+ // The agent cannot be called, but messages to people still send.
87
+ function send() {
88
+ // A real app sends the message to the server here and shows it at once.
89
+ setThread((rows) => [...rows, { id: `m${rows.length + 1}`, from: me, at: new Date(), text: text.trim() }]);
90
+ setText('');
91
+ }
92
+
93
+ return (
94
+ <Center width="page">
95
+ <Stack gap="large">
96
+ <Heading level={1} size="h5">Launch plan</Heading>
97
+ {/* A real app gives the list that holds the rows role="log". */}
98
+ <Stack gap="small">
99
+ {thread.map((m, i) => (
100
+ <Message
101
+ key={m.id}
102
+ aria-label={m.from}
103
+ compact={followsOn(thread, i)}
104
+ avatar={<UserImage userHandle={m.from} decorative />}
105
+ name={m.from}
106
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
107
+ >
108
+ <Paragraph measure="none">{m.text}</Paragraph>
109
+ </Message>
110
+ ))}
111
+ </Stack>
112
+ <Composer
113
+ ref={field}
114
+ id="composer-limit-notice-message"
115
+ aria-label="Message"
116
+ // After 'Not Now' the placeholder says when agent replies start again.
117
+ placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'}
118
+ value={text}
119
+ onChange={setText}
120
+ onSubmit={send}
121
+ // A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
122
+ // This person cannot change the plan, so it says who can. Everyone can close a refusal. Alert has no action slot.
123
+ above={
124
+ showNotice ? (
125
+ <Stack gap="small">
126
+ <Alert
127
+ type="warning"
128
+ variant="inline"
129
+ autoDismiss={false}
130
+ message="You've used all 50 AI agent responses this month."
131
+ secondMessage="They start again on December 1. Ask a workspace admin to upgrade Acme Design to Pro for more replies."
132
+ />
133
+ <Cluster gap="small">
134
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow} />
135
+ </Cluster>
136
+ </Stack>
137
+ ) : undefined
138
+ }
139
+ tools={
140
+ // It stays pressable while the limit stands, as the case 'Upgrade prompt' says: pressing it shows the notice
141
+ // again. It does not turn on until the limit is lifted.
142
+ <Tooltip title="Mention the agent">
143
+ <IconButton color="iconOnly" state="enabled" size="small" icon={Bot} ariaLabel="Mention the agent" aria-pressed={false} onClick={() => setShowNotice(true)} />
144
+ </Tooltip>
145
+ }
146
+ />
147
+ </Stack>
148
+ </Center>
149
+ );
150
+ }
151
+ ```
152
+
153
+ ## Option: Notice with an action
154
+
155
+ Use when: The person can lift the limit.
156
+
157
+ Uses: `Alert`, `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `IconButton`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `Tooltip`, `UserImage`
158
+
159
+ ```tsx
160
+ 'use client';
161
+ import { useRef, useState } from 'react';
162
+ import { Bot } from 'lucide-react';
163
+ import Message from 'oneslash-design-system/components/message';
164
+ import UserImage from 'oneslash-design-system/components/userImage';
165
+ import TimeStamp from 'oneslash-design-system/components/timeStamp';
166
+ import Heading from 'oneslash-design-system/components/heading';
167
+ import Paragraph from 'oneslash-design-system/components/paragraph';
168
+ import Composer from 'oneslash-design-system/components/composer';
169
+ import Alert from 'oneslash-design-system/components/alert';
170
+ import Button from 'oneslash-design-system/components/button';
171
+ import IconButton from 'oneslash-design-system/components/iconButton';
172
+ import Tooltip from 'oneslash-design-system/components/tooltip';
173
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
174
+
175
+ // A real app passes the router from its framework, such as Next's useRouter().
176
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
177
+
178
+ // A real app reads this from the session.
179
+ const me = 'Dana Lee';
180
+
181
+ type Row = { id: string; from: string; at: Date; text: string };
182
+
183
+ const firstThread: Row[] = [
184
+ { id: 'm1', from: 'Ben Carter', at: new Date('2025-01-15T11:40:00Z'), text: 'The pricing page is live.' },
185
+ { id: 'm2', from: 'Omar Reyes', at: new Date('2025-01-15T11:42:00Z'), text: 'Who writes the launch email?' },
186
+ ];
187
+
188
+ const FIVE_MINUTES = 5 * 60 * 1000;
189
+
190
+ // A follow-on row: the same sender as the row above, less than 5 minutes later and on the same day.
191
+ function followsOn(rows: Row[], i: number) {
192
+ const prev = rows[i - 1];
193
+ return (
194
+ !!prev &&
195
+ prev.from === rows[i].from &&
196
+ rows[i].at.getTime() - prev.at.getTime() < FIVE_MINUTES &&
197
+ rows[i].at.toDateString() === prev.at.toDateString()
198
+ );
199
+ }
200
+
201
+ export default function ComposerLimitNoticeWithAction() {
202
+ const [thread, setThread] = useState(firstThread);
203
+ const [text, setText] = useState('');
204
+ // Opens on the notice, as if the workspace just used its last AI agent response of the month.
205
+ const [showNotice, setShowNotice] = useState(true);
206
+ const field = useRef<HTMLTextAreaElement>(null);
207
+
208
+ // 'Not Now' goes away with the notice, so focus goes to the message box.
209
+ function notNow() {
210
+ setShowNotice(false);
211
+ field.current?.focus();
212
+ }
213
+
214
+ // The agent cannot be called, but messages to people still send.
215
+ function send() {
216
+ // A real app sends the message to the server here and shows it at once.
217
+ setThread((rows) => [...rows, { id: `m${rows.length + 1}`, from: me, at: new Date(), text: text.trim() }]);
218
+ setText('');
219
+ }
220
+
221
+ return (
222
+ <Center width="page">
223
+ <Stack gap="large">
224
+ <Heading level={1} size="h5">Launch plan</Heading>
225
+ {/* A real app gives the list that holds the rows role="log". */}
226
+ <Stack gap="small">
227
+ {thread.map((m, i) => (
228
+ <Message
229
+ key={m.id}
230
+ aria-label={m.from}
231
+ compact={followsOn(thread, i)}
232
+ avatar={<UserImage userHandle={m.from} decorative />}
233
+ name={m.from}
234
+ meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
235
+ >
236
+ <Paragraph measure="none">{m.text}</Paragraph>
237
+ </Message>
238
+ ))}
239
+ </Stack>
240
+ <Composer
241
+ ref={field}
242
+ id="composer-limit-action-message"
243
+ aria-label="Message"
244
+ // After 'Not Now' the placeholder says when agent replies start again.
245
+ placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'}
246
+ value={text}
247
+ onChange={setText}
248
+ onSubmit={send}
249
+ // A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
250
+ // This person can change the plan, so they get the button that lifts the limit. Alert has no action slot.
251
+ above={
252
+ showNotice ? (
253
+ <Stack gap="small">
254
+ <Alert
255
+ type="warning"
256
+ variant="inline"
257
+ autoDismiss={false}
258
+ message="You've used all 50 AI agent responses this month."
259
+ secondMessage="They start again on December 1. The Pro plan gives Acme Design 1,000 AI agent responses a month."
260
+ />
261
+ <Cluster gap="small">
262
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow} />
263
+ <Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={() => router.push('/settings/billing?plan=pro')} />
264
+ </Cluster>
265
+ </Stack>
266
+ ) : undefined
267
+ }
268
+ tools={
269
+ // It stays pressable while the limit stands, as the case 'Upgrade prompt' says: pressing it shows the notice
270
+ // again. It does not turn on until the limit is lifted.
271
+ <Tooltip title="Mention the agent">
272
+ <IconButton color="iconOnly" state="enabled" size="small" icon={Bot} ariaLabel="Mention the agent" aria-pressed={false} onClick={() => setShowNotice(true)} />
273
+ </Tooltip>
274
+ }
275
+ />
276
+ </Stack>
277
+ </Center>
278
+ );
279
+ }
280
+ ```
281
+
282
+ ## Native
283
+
284
+ On Apple the notice is a row above the composer, with an Upgrade or Change Budget Cap button for admins and never a link to a web page.
285
+
286
+ Seen in: Scindo.
@@ -0,0 +1 @@
1
+ export default function ConversationStartersChips(): import("react").JSX.Element;
@@ -0,0 +1,69 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useEffect, useRef, useState } from 'react';
12
+ import Message from '../../components/message';
13
+ import UserImage from '../../components/userImage';
14
+ import TimeStamp from '../../components/timeStamp';
15
+ import Heading from '../../components/heading';
16
+ import Paragraph from '../../components/paragraph';
17
+ import Composer from '../../components/composer';
18
+ import EmptyBox from '../../components/emptyBox';
19
+ import Tag from '../../components/tag';
20
+ import { Center, Cluster, Stack } from '../../components/layout';
21
+ // A real app reads this from the session.
22
+ var me = 'Dana Lee';
23
+ var agentName = 'Acme Agent';
24
+ // Things to ask, in the person's words.
25
+ var starters = [
26
+ 'Summarize the launch plan',
27
+ 'Draft the launch email',
28
+ 'List what is still open',
29
+ 'Check the pricing page for mistakes',
30
+ ];
31
+ export default function ConversationStartersChips() {
32
+ var _a = useState([]), thread = _a[0], setThread = _a[1];
33
+ var _b = useState(''), text = _b[0], setText = _b[1];
34
+ // Set when a starter fills the field; the effect below focuses it with the caret at the end.
35
+ var _c = useState(0), filled = _c[0], setFilled = _c[1];
36
+ var field = useRef(null);
37
+ useEffect(function () {
38
+ if (!filled || !field.current)
39
+ return;
40
+ var end = field.current.value.length;
41
+ field.current.focus();
42
+ field.current.setSelectionRange(end, end);
43
+ }, [filled]);
44
+ // Fills the field and does not send: the person can change it first.
45
+ function fillWith(starter) {
46
+ setText(starter);
47
+ setFilled(function (n) { return n + 1; });
48
+ }
49
+ function send() {
50
+ // A real app sends the message to the agent here and shows it at once.
51
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date(), text: text.trim() }], false); });
52
+ setText('');
53
+ }
54
+ return (<Center width="page">
55
+ <Stack gap="large">
56
+ <Heading level={1} size="h5">{"Ask ".concat(agentName)}</Heading>
57
+ {thread.length === 0 ? (<EmptyBox size="large" icon="MessageCircle" text="No messages yet" secondText={"Ask ".concat(agentName, " about the launch, or start with one of these.")} action={<Cluster gap="small">
58
+ {starters.map(function (s) { return (<Tag key={s} variant="contained" size="small" label={s} toggle={false} onClick={function () { return fillWith(s); }}/>); })}
59
+ </Cluster>}/>) : (
60
+ // A real app gives the list that holds the rows role="log".
61
+ <Stack gap="small">
62
+ {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"/>}>
63
+ <Paragraph measure="none">{m.text}</Paragraph>
64
+ </Message>); })}
65
+ </Stack>)}
66
+ <Composer ref={field} id="conversation-starters-chips-message" aria-label="Message" placeholder={"Message ".concat(agentName)} value={text} onChange={setText} onSubmit={send}/>
67
+ </Stack>
68
+ </Center>);
69
+ }
@@ -0,0 +1 @@
1
+ export default function ConversationStartersNone(): import("react").JSX.Element;