oneslash-design-system 2.14.2 → 2.16.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 (232) hide show
  1. package/README.md +15 -0
  2. package/dist/DESIGN.md +138 -1
  3. package/dist/cases/accept-invite/signed-in.d.ts +1 -0
  4. package/dist/cases/accept-invite/signed-in.jsx +57 -0
  5. package/dist/cases/accept-invite/signed-out.d.ts +1 -0
  6. package/dist/cases/accept-invite/signed-out.jsx +33 -0
  7. package/dist/cases/accept-invite.md +161 -0
  8. package/dist/cases/agent-asks-before-risky-action.md +29 -0
  9. package/dist/cases/agent-cancels-when-unanswered.md +27 -0
  10. package/dist/cases/agent-refuses-clearly.md +31 -0
  11. package/dist/cases/agent-says-what-it-is.md +29 -0
  12. package/dist/cases/agent-shows-progress.md +30 -0
  13. package/dist/cases/agent-shows-sources.md +26 -0
  14. package/dist/cases/auth-gate-loading/spinner-with-line.d.ts +1 -0
  15. package/dist/cases/auth-gate-loading/spinner-with-line.jsx +10 -0
  16. package/dist/cases/auth-gate-loading/spinner.d.ts +1 -0
  17. package/dist/cases/auth-gate-loading/spinner.jsx +10 -0
  18. package/dist/cases/auth-gate-loading.md +70 -0
  19. package/dist/cases/check-your-email/alert-on-login.d.ts +1 -0
  20. package/dist/cases/check-your-email/alert-on-login.jsx +78 -0
  21. package/dist/cases/check-your-email/page.d.ts +1 -0
  22. package/dist/cases/check-your-email/page.jsx +49 -0
  23. package/dist/cases/check-your-email.md +184 -0
  24. package/dist/cases/confirm-destructive-action/inline.d.ts +1 -0
  25. package/dist/cases/confirm-destructive-action/inline.jsx +69 -0
  26. package/dist/cases/confirm-destructive-action/modal.d.ts +1 -0
  27. package/dist/cases/confirm-destructive-action/modal.jsx +66 -0
  28. package/dist/cases/confirm-destructive-action.md +211 -0
  29. package/dist/cases/confirm-dialogs.md +36 -0
  30. package/dist/cases/create-modal/quick.d.ts +1 -0
  31. package/dist/cases/create-modal/quick.jsx +80 -0
  32. package/dist/cases/create-modal/with-settings.d.ts +1 -0
  33. package/dist/cases/create-modal/with-settings.jsx +99 -0
  34. package/dist/cases/create-modal.md +244 -0
  35. package/dist/cases/device-login/popup.d.ts +1 -0
  36. package/dist/cases/device-login/popup.jsx +14 -0
  37. package/dist/cases/device-login/provider-first.d.ts +1 -0
  38. package/dist/cases/device-login/provider-first.jsx +98 -0
  39. package/dist/cases/device-login.md +171 -0
  40. package/dist/cases/email-confirmed/alert-on-login.d.ts +1 -0
  41. package/dist/cases/email-confirmed/alert-on-login.jsx +78 -0
  42. package/dist/cases/email-confirmed/page.d.ts +1 -0
  43. package/dist/cases/email-confirmed/page.jsx +21 -0
  44. package/dist/cases/email-confirmed.md +151 -0
  45. package/dist/cases/empty-list/region.d.ts +1 -0
  46. package/dist/cases/empty-list/region.jsx +13 -0
  47. package/dist/cases/empty-list/section.d.ts +1 -0
  48. package/dist/cases/empty-list/section.jsx +17 -0
  49. package/dist/cases/empty-list.md +77 -0
  50. package/dist/cases/empty-lists.md +35 -0
  51. package/dist/cases/empty-not-set-up/action.d.ts +1 -0
  52. package/dist/cases/empty-not-set-up/action.jsx +16 -0
  53. package/dist/cases/empty-not-set-up/pointer.d.ts +1 -0
  54. package/dist/cases/empty-not-set-up/pointer.jsx +13 -0
  55. package/dist/cases/empty-not-set-up.md +88 -0
  56. package/dist/cases/empty-search/clear-search.d.ts +1 -0
  57. package/dist/cases/empty-search/clear-search.jsx +29 -0
  58. package/dist/cases/empty-search.md +77 -0
  59. package/dist/cases/error-page/full-page.d.ts +1 -0
  60. package/dist/cases/error-page/full-page.jsx +19 -0
  61. package/dist/cases/error-page/in-shell.d.ts +1 -0
  62. package/dist/cases/error-page/in-shell.jsx +39 -0
  63. package/dist/cases/error-page.md +107 -0
  64. package/dist/cases/feedback-form/modal.d.ts +1 -0
  65. package/dist/cases/feedback-form/modal.jsx +89 -0
  66. package/dist/cases/feedback-form.md +139 -0
  67. package/dist/cases/forgot-password/in-place.d.ts +1 -0
  68. package/dist/cases/forgot-password/in-place.jsx +155 -0
  69. package/dist/cases/forgot-password/own-page.d.ts +1 -0
  70. package/dist/cases/forgot-password/own-page.jsx +99 -0
  71. package/dist/cases/forgot-password.md +328 -0
  72. package/dist/cases/form-errors.md +32 -0
  73. package/dist/cases/import-checklist/modal.d.ts +1 -0
  74. package/dist/cases/import-checklist/modal.jsx +125 -0
  75. package/dist/cases/import-checklist.md +188 -0
  76. package/dist/cases/inline-form-feedback/button-label.d.ts +1 -0
  77. package/dist/cases/inline-form-feedback/button-label.jsx +54 -0
  78. package/dist/cases/inline-form-feedback/inline-alert.d.ts +1 -0
  79. package/dist/cases/inline-form-feedback/inline-alert.jsx +49 -0
  80. package/dist/cases/inline-form-feedback/toast.d.ts +1 -0
  81. package/dist/cases/inline-form-feedback/toast.jsx +66 -0
  82. package/dist/cases/inline-form-feedback.md +237 -0
  83. package/dist/cases/invite-member/by-email.d.ts +1 -0
  84. package/dist/cases/invite-member/by-email.jsx +98 -0
  85. package/dist/cases/invite-member/by-link.d.ts +1 -0
  86. package/dist/cases/invite-member/by-link.jsx +122 -0
  87. package/dist/cases/invite-member.md +321 -0
  88. package/dist/cases/load-failure/inline.d.ts +1 -0
  89. package/dist/cases/load-failure/inline.jsx +52 -0
  90. package/dist/cases/load-failure/region.d.ts +1 -0
  91. package/dist/cases/load-failure/region.jsx +34 -0
  92. package/dist/cases/load-failure.md +155 -0
  93. package/dist/cases/log-out-confirm/modal.d.ts +1 -0
  94. package/dist/cases/log-out-confirm/modal.jsx +57 -0
  95. package/dist/cases/log-out-confirm.md +106 -0
  96. package/dist/cases/login-page/centered.d.ts +1 -0
  97. package/dist/cases/login-page/centered.jsx +72 -0
  98. package/dist/cases/login-page/email-only.d.ts +1 -0
  99. package/dist/cases/login-page/email-only.jsx +59 -0
  100. package/dist/cases/login-page/provider-first.d.ts +1 -0
  101. package/dist/cases/login-page/provider-first.jsx +66 -0
  102. package/dist/cases/login-page/split.d.ts +1 -0
  103. package/dist/cases/login-page/split.jsx +79 -0
  104. package/dist/cases/login-page.md +373 -0
  105. package/dist/cases/not-found-page/full-page.d.ts +1 -0
  106. package/dist/cases/not-found-page/full-page.jsx +16 -0
  107. package/dist/cases/not-found-page/in-shell.d.ts +1 -0
  108. package/dist/cases/not-found-page/in-shell.jsx +36 -0
  109. package/dist/cases/not-found-page.md +98 -0
  110. package/dist/cases/oauth-consent/simple.d.ts +1 -0
  111. package/dist/cases/oauth-consent/simple.jsx +73 -0
  112. package/dist/cases/oauth-consent/with-scope.d.ts +1 -0
  113. package/dist/cases/oauth-consent/with-scope.jsx +89 -0
  114. package/dist/cases/oauth-consent.md +233 -0
  115. package/dist/cases/rename/inline.d.ts +1 -0
  116. package/dist/cases/rename/inline.jsx +58 -0
  117. package/dist/cases/rename/modal.d.ts +1 -0
  118. package/dist/cases/rename/modal.jsx +70 -0
  119. package/dist/cases/rename.md +205 -0
  120. package/dist/cases/route-loading/full-screen.d.ts +1 -0
  121. package/dist/cases/route-loading/full-screen.jsx +8 -0
  122. package/dist/cases/route-loading/region.d.ts +1 -0
  123. package/dist/cases/route-loading/region.jsx +26 -0
  124. package/dist/cases/route-loading.md +84 -0
  125. package/dist/cases/set-new-password/form.d.ts +1 -0
  126. package/dist/cases/set-new-password/form.jsx +130 -0
  127. package/dist/cases/set-new-password/invalid-link.d.ts +1 -0
  128. package/dist/cases/set-new-password/invalid-link.jsx +50 -0
  129. package/dist/cases/set-new-password.md +247 -0
  130. package/dist/cases/sign-up-page/centered.d.ts +1 -0
  131. package/dist/cases/sign-up-page/centered.jsx +124 -0
  132. package/dist/cases/sign-up-page/provider-first.d.ts +1 -0
  133. package/dist/cases/sign-up-page/provider-first.jsx +124 -0
  134. package/dist/cases/sign-up-page/split.d.ts +1 -0
  135. package/dist/cases/sign-up-page/split.jsx +134 -0
  136. package/dist/cases/sign-up-page.md +478 -0
  137. package/dist/cases/success-feedback.md +35 -0
  138. package/dist/cases/type-to-confirm/inline.d.ts +1 -0
  139. package/dist/cases/type-to-confirm/inline.jsx +69 -0
  140. package/dist/cases/type-to-confirm/modal.d.ts +1 -0
  141. package/dist/cases/type-to-confirm/modal.jsx +73 -0
  142. package/dist/cases/type-to-confirm.md +222 -0
  143. package/dist/cases/unsaved-changes-guard/discard.d.ts +1 -0
  144. package/dist/cases/unsaved-changes-guard/discard.jsx +81 -0
  145. package/dist/cases/unsaved-changes-guard/save-or-discard.d.ts +1 -0
  146. package/dist/cases/unsaved-changes-guard/save-or-discard.jsx +85 -0
  147. package/dist/cases/unsaved-changes-guard.md +239 -0
  148. package/dist/cases/upgrade-prompt/inline.d.ts +1 -0
  149. package/dist/cases/upgrade-prompt/inline.jsx +52 -0
  150. package/dist/cases/upgrade-prompt/modal.d.ts +1 -0
  151. package/dist/cases/upgrade-prompt/modal.jsx +43 -0
  152. package/dist/cases/upgrade-prompt.md +174 -0
  153. package/dist/cases.json +2073 -0
  154. package/dist/components/alert.d.ts +3 -1
  155. package/dist/components/alert.jsx +6 -4
  156. package/dist/components/brandIcon.d.ts +12 -0
  157. package/dist/components/brandIcon.jsx +24 -0
  158. package/dist/components/emptyBox.d.ts +6 -1
  159. package/dist/components/emptyBox.jsx +4 -2
  160. package/dist/components/form.d.ts +11 -0
  161. package/dist/components/form.jsx +22 -0
  162. package/dist/components/heading.d.ts +2 -2
  163. package/dist/components/image.d.ts +14 -0
  164. package/dist/components/image.jsx +6 -0
  165. package/dist/components/layout.d.ts +18 -1
  166. package/dist/components/layout.jsx +16 -0
  167. package/dist/components/line.d.ts +3 -1
  168. package/dist/components/line.jsx +8 -1
  169. package/dist/components/loadingScreen.d.ts +5 -1
  170. package/dist/components/loadingScreen.jsx +4 -2
  171. package/dist/components/modal.d.ts +2 -1
  172. package/dist/components/modal.jsx +20 -8
  173. package/dist/components/radioGroup.d.ts +2 -1
  174. package/dist/components/radioGroup.jsx +2 -2
  175. package/dist/components/select.d.ts +2 -1
  176. package/dist/components/select.jsx +4 -2
  177. package/dist/components/tab.jsx +3 -2
  178. package/dist/components/tabsContainer.d.ts +4 -1
  179. package/dist/components/tabsContainer.jsx +11 -5
  180. package/dist/components/textField.d.ts +5 -1
  181. package/dist/components/textField.jsx +7 -3
  182. package/dist/components/toaster.d.ts +12 -0
  183. package/dist/components/toaster.jsx +103 -0
  184. package/dist/components/tooltip.jsx +3 -1
  185. package/dist/designTokens.d.ts +1 -0
  186. package/dist/designTokens.js +1 -0
  187. package/dist/internal/alert.d.ts +4 -0
  188. package/dist/internal/alert.js +6 -0
  189. package/dist/internal/modal.d.ts +2 -0
  190. package/dist/internal/modal.js +21 -0
  191. package/dist/internal/toaster.d.ts +19 -0
  192. package/dist/internal/toaster.js +50 -0
  193. package/dist/native-mapping.json +23 -1
  194. package/dist/stories/Alert.stories.d.ts +1 -0
  195. package/dist/stories/Alert.stories.jsx +16 -0
  196. package/dist/stories/BrandIcon.stories.d.ts +9 -0
  197. package/dist/stories/BrandIcon.stories.jsx +19 -0
  198. package/dist/stories/Cases.generated.stories.d.ts +60 -0
  199. package/dist/stories/Cases.generated.stories.jsx +116 -0
  200. package/dist/stories/EmptyBox.stories.d.ts +2 -0
  201. package/dist/stories/EmptyBox.stories.jsx +16 -0
  202. package/dist/stories/Form.stories.d.ts +6 -0
  203. package/dist/stories/Form.stories.jsx +26 -0
  204. package/dist/stories/Heading.stories.d.ts +6 -0
  205. package/dist/stories/Heading.stories.jsx +10 -0
  206. package/dist/stories/Image.stories.d.ts +7 -0
  207. package/dist/stories/Image.stories.jsx +18 -0
  208. package/dist/stories/Line.stories.d.ts +1 -0
  209. package/dist/stories/Line.stories.jsx +12 -0
  210. package/dist/stories/LoadingScreen.stories.d.ts +1 -0
  211. package/dist/stories/LoadingScreen.stories.jsx +8 -0
  212. package/dist/stories/Modal.stories.d.ts +2 -0
  213. package/dist/stories/Modal.stories.jsx +36 -0
  214. package/dist/stories/PageComponents.stories.d.ts +2 -0
  215. package/dist/stories/PageComponents.stories.jsx +15 -1
  216. package/dist/stories/RadioGroup.stories.d.ts +1 -0
  217. package/dist/stories/RadioGroup.stories.jsx +14 -0
  218. package/dist/stories/Select.stories.d.ts +1 -0
  219. package/dist/stories/Select.stories.jsx +14 -0
  220. package/dist/stories/TabsContainer.stories.d.ts +1 -0
  221. package/dist/stories/TabsContainer.stories.jsx +12 -0
  222. package/dist/stories/TextField.stories.d.ts +2 -0
  223. package/dist/stories/TextField.stories.jsx +22 -0
  224. package/dist/stories/Toaster.stories.d.ts +6 -0
  225. package/dist/stories/Toaster.stories.jsx +29 -0
  226. package/dist/tailwind-preset-auto.js +2 -1
  227. package/dist/tailwind-preset.js +2 -1
  228. package/dist/theme-auto.css +1 -0
  229. package/dist/theme.css +1 -0
  230. package/dist/tokens.css +1 -0
  231. package/dist/tokens.json +7 -0
  232. package/package.json +4 -2
@@ -0,0 +1,52 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import Surface from '../../components/surface';
4
+ import Heading from '../../components/heading';
5
+ import Paragraph from '../../components/paragraph';
6
+ import TextField from '../../components/textField';
7
+ import Button from '../../components/button';
8
+ import { Center, Cluster, Stack } from '../../components/layout';
9
+ // A real app passes the router from its framework, such as Next's useRouter().
10
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
11
+ // A real app reads this from the person's role. Only an admin can change the plan.
12
+ var canChangePlan = true;
13
+ var thread = [
14
+ { id: 'm1', from: 'Dana Lee', text: 'Can you list what is still open for the launch?' },
15
+ { id: 'm2', from: 'Acme agent', text: 'Three tasks are open: the press kit, the pricing page and the launch email.' },
16
+ { id: 'm3', from: 'Dana Lee', text: 'Draft the launch email, please.' },
17
+ ];
18
+ export default function UpgradePromptInline() {
19
+ // Opens on the notice, as if the workspace just used its last AI agent response of the month.
20
+ var _a = useState(true), showNotice = _a[0], setShowNotice = _a[1];
21
+ return (<Center width="page">
22
+ <Stack gap="large">
23
+ <Heading level={1} size="h5">Launch plan</Heading>
24
+ <Stack gap="medium">
25
+ {thread.map(function (m) { return (<Stack key={m.id} gap="small">
26
+ <Paragraph tone="secondary" size="body2" measure="none">{m.from}</Paragraph>
27
+ <Paragraph measure="none">{m.text}</Paragraph>
28
+ </Stack>); })}
29
+ </Stack>
30
+ {showNotice ? (
31
+ // The notice takes the place of the message box, where the person was about to type.
32
+ <Surface padding="medium">
33
+ <Stack gap="medium">
34
+ <Stack gap="small">
35
+ <Paragraph measure="none">You&apos;ve used all 50 AI agent responses this month. They start again on December 1.</Paragraph>
36
+ <Paragraph tone="secondary" size="body2" measure="none">
37
+ {canChangePlan
38
+ ? 'The Pro plan gives Acme Design 1,000 AI agent responses a month.'
39
+ : 'Ask a workspace admin to upgrade Acme Design to Pro for more replies.'}
40
+ </Paragraph>
41
+ </Stack>
42
+ <Cluster gap="small">
43
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setShowNotice(false); }}/>
44
+ {canChangePlan && (<Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return router.push('/settings/billing?plan=pro'); }}/>)}
45
+ </Cluster>
46
+ </Stack>
47
+ </Surface>) : (
48
+ // After 'Not Now' the message box comes back, closed until the replies start again.
49
+ <TextField id="upgrade-prompt-message" label="Message the agent" value="" placeholder="Agent replies start again on December 1." disabled onChange={function () { }}/>)}
50
+ </Stack>
51
+ </Center>);
52
+ }
@@ -0,0 +1 @@
1
+ export default function UpgradePromptModal(): import("react").JSX.Element;
@@ -0,0 +1,43 @@
1
+ 'use client';
2
+ import { useState } from 'react';
3
+ import Modal from '../../components/modal';
4
+ import Heading from '../../components/heading';
5
+ import Paragraph from '../../components/paragraph';
6
+ import Button from '../../components/button';
7
+ import { Center, Cluster, Stack } from '../../components/layout';
8
+ // A real app passes the router from its framework, such as Next's useRouter().
9
+ var router = { push: function (url) { return console.info("Go to ".concat(url)); } };
10
+ // A real app reads this from the person's role. Only an admin can change the plan.
11
+ var canChangePlan = true;
12
+ export default function UpgradePromptModal() {
13
+ // Opens on the Modal, as if the person just chose Export PDF.
14
+ var _a = useState(true), open = _a[0], setOpen = _a[1];
15
+ function handleUpgrade() {
16
+ setOpen(false);
17
+ router.push('/settings/billing?plan=pro');
18
+ }
19
+ return (<Center width="page">
20
+ <Stack gap="medium">
21
+ <Heading level={1} size="h5">Q3 plan</Heading>
22
+ <Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
23
+ {/* The locked control stays on the page, so the person can find out what unlocks it. */}
24
+ <Cluster gap="small">
25
+ <Button size="small" type="secondary" state="enabled" label="Share"/>
26
+ <Button size="small" type="secondary" state="enabled" label="Export PDF" decoIcon="Lock" onClickButton={function () { return setOpen(true); }}/>
27
+ </Cluster>
28
+ </Stack>
29
+ <Modal isOpen={open} size="small"
30
+ // The title names the action only for a person who can take it.
31
+ title={canChangePlan ? 'Upgrade to Pro' : 'Pro Feature'} onClose={function () { return setOpen(false); }} actions={canChangePlan ? (<>
32
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setOpen(false); }}/>
33
+ <Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={handleUpgrade}/>
34
+ </>) : (<Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={function () { return setOpen(false); }}/>)}>
35
+ <Paragraph measure="none">Exporting to PDF is part of the Pro plan. Acme Design is on the Free plan.</Paragraph>
36
+ <Paragraph tone="secondary" size="body2" measure="none">
37
+ {canChangePlan
38
+ ? 'Pro also adds version history and unlimited guests, for $8 per member each month.'
39
+ : 'Ask a workspace admin to upgrade Acme Design to Pro.'}
40
+ </Paragraph>
41
+ </Modal>
42
+ </Center>);
43
+ }
@@ -0,0 +1,174 @@
1
+ # Upgrade prompt
2
+
3
+ A person reaches something their plan does not include, or a limit of their plan.
4
+
5
+ **Not built yet:** Scindo's upgrade prompt on the web is an overlay built by hand that does not close on Escape, is titled 'Upgrade Required' and shows Upgrade to everyone. Commentify's upgrade Modal labels its Buttons 'Maybe Later' and 'Upgrade'.
6
+
7
+ ## Do
8
+
9
+ - Say what is locked and which plan unlocks it: 'Exporting to PDF is part of the Pro plan.'
10
+ - Say which limit was reached, with the number, and when it resets: "You've used all 50 AI agent responses this month. They start again on December 1."
11
+ - Offer 'Not Now' as a tertiary Button, then 'Upgrade to Pro' as a primary Button.
12
+ - Show 'Upgrade to Pro' only to a person who can change the plan. Tell everyone else to ask a workspace admin, and give them only 'Not Now'.
13
+ - Title the Modal 'Upgrade to Pro' only for a person who can upgrade. For everyone else, title it 'Pro Feature'.
14
+ - Follow the rule 'A confirm says exactly what will happen' for the Modal: `size="small"`, and Escape or a click outside means 'Not Now'.
15
+ - Put the notice where the control was, with the same two Buttons, when a limit is reached inside a flow.
16
+ - Follow the rule 'An agent refuses clearly' too when the agent is the one refused.
17
+
18
+ ## Don't
19
+
20
+ - Do not title the Modal 'Upgrade Required' or 'This is available on Pro plan only'. Name the action: 'Upgrade to Pro'.
21
+ - Do not label the way out 'Maybe Later' or 'Close'.
22
+ - Do not show an Upgrade Button to someone who cannot upgrade.
23
+ - Do not hide the locked control. Let the person press it and learn what unlocks it.
24
+ - Do not build the overlay by hand. Use `Modal`, which closes on Escape.
25
+
26
+ ## Option: Explain in a Modal
27
+
28
+ Use when: The person pressed something their plan does not include.
29
+
30
+ Uses: `Button`, `Center`, `Cluster`, `Heading`, `Modal`, `Paragraph`, `Stack`
31
+
32
+ ```tsx
33
+ 'use client';
34
+ import { useState } from 'react';
35
+ import Modal from 'oneslash-design-system/components/modal';
36
+ import Heading from 'oneslash-design-system/components/heading';
37
+ import Paragraph from 'oneslash-design-system/components/paragraph';
38
+ import Button from 'oneslash-design-system/components/button';
39
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
40
+
41
+ // A real app passes the router from its framework, such as Next's useRouter().
42
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
43
+
44
+ // A real app reads this from the person's role. Only an admin can change the plan.
45
+ const canChangePlan = true;
46
+
47
+ export default function UpgradePromptModal() {
48
+ // Opens on the Modal, as if the person just chose Export PDF.
49
+ const [open, setOpen] = useState(true);
50
+
51
+ function handleUpgrade() {
52
+ setOpen(false);
53
+ router.push('/settings/billing?plan=pro');
54
+ }
55
+
56
+ return (
57
+ <Center width="page">
58
+ <Stack gap="medium">
59
+ <Heading level={1} size="h5">Q3 plan</Heading>
60
+ <Paragraph tone="secondary" size="body2" measure="none">12 tasks. Updated 2 days ago by Dana Lee.</Paragraph>
61
+ {/* The locked control stays on the page, so the person can find out what unlocks it. */}
62
+ <Cluster gap="small">
63
+ <Button size="small" type="secondary" state="enabled" label="Share" />
64
+ <Button size="small" type="secondary" state="enabled" label="Export PDF" decoIcon="Lock" onClickButton={() => setOpen(true)} />
65
+ </Cluster>
66
+ </Stack>
67
+ <Modal
68
+ isOpen={open}
69
+ size="small"
70
+ // The title names the action only for a person who can take it.
71
+ title={canChangePlan ? 'Upgrade to Pro' : 'Pro Feature'}
72
+ onClose={() => setOpen(false)}
73
+ actions={
74
+ canChangePlan ? (
75
+ <>
76
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={() => setOpen(false)} />
77
+ <Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={handleUpgrade} />
78
+ </>
79
+ ) : (
80
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={() => setOpen(false)} />
81
+ )
82
+ }
83
+ >
84
+ <Paragraph measure="none">Exporting to PDF is part of the Pro plan. Acme Design is on the Free plan.</Paragraph>
85
+ <Paragraph tone="secondary" size="body2" measure="none">
86
+ {canChangePlan
87
+ ? 'Pro also adds version history and unlimited guests, for $8 per member each month.'
88
+ : 'Ask a workspace admin to upgrade Acme Design to Pro.'}
89
+ </Paragraph>
90
+ </Modal>
91
+ </Center>
92
+ );
93
+ }
94
+ ```
95
+
96
+ ## Option: Replace the control
97
+
98
+ Use when: A limit was reached inside a flow. The notice takes the place of the control that hit it.
99
+
100
+ Uses: `Button`, `Center`, `Cluster`, `Heading`, `Paragraph`, `Stack`, `Surface`, `TextField`
101
+
102
+ ```tsx
103
+ 'use client';
104
+ import { useState } from 'react';
105
+ import Surface from 'oneslash-design-system/components/surface';
106
+ import Heading from 'oneslash-design-system/components/heading';
107
+ import Paragraph from 'oneslash-design-system/components/paragraph';
108
+ import TextField from 'oneslash-design-system/components/textField';
109
+ import Button from 'oneslash-design-system/components/button';
110
+ import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
111
+
112
+ // A real app passes the router from its framework, such as Next's useRouter().
113
+ const router = { push: (url: string) => console.info(`Go to ${url}`) };
114
+
115
+ // A real app reads this from the person's role. Only an admin can change the plan.
116
+ const canChangePlan = true;
117
+
118
+ const thread = [
119
+ { id: 'm1', from: 'Dana Lee', text: 'Can you list what is still open for the launch?' },
120
+ { id: 'm2', from: 'Acme agent', text: 'Three tasks are open: the press kit, the pricing page and the launch email.' },
121
+ { id: 'm3', from: 'Dana Lee', text: 'Draft the launch email, please.' },
122
+ ];
123
+
124
+ export default function UpgradePromptInline() {
125
+ // Opens on the notice, as if the workspace just used its last AI agent response of the month.
126
+ const [showNotice, setShowNotice] = useState(true);
127
+
128
+ return (
129
+ <Center width="page">
130
+ <Stack gap="large">
131
+ <Heading level={1} size="h5">Launch plan</Heading>
132
+ <Stack gap="medium">
133
+ {thread.map((m) => (
134
+ <Stack key={m.id} gap="small">
135
+ <Paragraph tone="secondary" size="body2" measure="none">{m.from}</Paragraph>
136
+ <Paragraph measure="none">{m.text}</Paragraph>
137
+ </Stack>
138
+ ))}
139
+ </Stack>
140
+ {showNotice ? (
141
+ // The notice takes the place of the message box, where the person was about to type.
142
+ <Surface padding="medium">
143
+ <Stack gap="medium">
144
+ <Stack gap="small">
145
+ <Paragraph measure="none">You&apos;ve used all 50 AI agent responses this month. They start again on December 1.</Paragraph>
146
+ <Paragraph tone="secondary" size="body2" measure="none">
147
+ {canChangePlan
148
+ ? 'The Pro plan gives Acme Design 1,000 AI agent responses a month.'
149
+ : 'Ask a workspace admin to upgrade Acme Design to Pro for more replies.'}
150
+ </Paragraph>
151
+ </Stack>
152
+ <Cluster gap="small">
153
+ <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={() => setShowNotice(false)} />
154
+ {canChangePlan && (
155
+ <Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={() => router.push('/settings/billing?plan=pro')} />
156
+ )}
157
+ </Cluster>
158
+ </Stack>
159
+ </Surface>
160
+ ) : (
161
+ // After 'Not Now' the message box comes back, closed until the replies start again.
162
+ <TextField id="upgrade-prompt-message" label="Message the agent" value="" placeholder="Agent replies start again on December 1." disabled onChange={() => {}} />
163
+ )}
164
+ </Stack>
165
+ </Center>
166
+ );
167
+ }
168
+ ```
169
+
170
+ ## Native
171
+
172
+ On Apple show the notice in place, with an Upgrade Button only for admins. It opens the plan sheet in the app, never a link to a web page.
173
+
174
+ Seen in: Commentify, Scindo.