oneslash-design-system 2.19.0 → 2.21.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 (264) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +62 -5
  3. package/dist/cases/about-page/profile.d.ts +1 -0
  4. package/dist/cases/about-page/profile.jsx +64 -0
  5. package/dist/cases/about-page.md +114 -0
  6. package/dist/cases/admin-inbox/list.d.ts +1 -0
  7. package/dist/cases/admin-inbox/list.jsx +104 -0
  8. package/dist/cases/admin-inbox/split.d.ts +1 -0
  9. package/dist/cases/admin-inbox/split.jsx +68 -0
  10. package/dist/cases/admin-inbox.md +254 -0
  11. package/dist/cases/api-keys.md +1 -1
  12. package/dist/cases/billing-page/billed-elsewhere.d.ts +1 -0
  13. package/dist/cases/billing-page/billed-elsewhere.jsx +28 -0
  14. package/dist/cases/billing-page/self-serve.d.ts +1 -0
  15. package/dist/cases/billing-page/self-serve.jsx +134 -0
  16. package/dist/cases/billing-page.md +247 -0
  17. package/dist/cases/blog-index/cards.d.ts +1 -0
  18. package/dist/cases/blog-index/cards.jsx +45 -0
  19. package/dist/cases/blog-index/list.d.ts +1 -0
  20. package/dist/cases/blog-index/list.jsx +46 -0
  21. package/dist/cases/blog-index.md +160 -0
  22. package/dist/cases/breakdown-list/bars.d.ts +1 -0
  23. package/dist/cases/breakdown-list/bars.jsx +47 -0
  24. package/dist/cases/breakdown-list/table.d.ts +1 -0
  25. package/dist/cases/breakdown-list/table.jsx +69 -0
  26. package/dist/cases/breakdown-list.md +158 -0
  27. package/dist/cases/changelog/by-month.d.ts +1 -0
  28. package/dist/cases/changelog/by-month.jsx +70 -0
  29. package/dist/cases/changelog/one-page.d.ts +1 -0
  30. package/dist/cases/changelog/one-page.jsx +70 -0
  31. package/dist/cases/changelog.md +200 -0
  32. package/dist/cases/code-sample/block.d.ts +1 -0
  33. package/dist/cases/code-sample/block.jsx +19 -0
  34. package/dist/cases/code-sample/command.d.ts +1 -0
  35. package/dist/cases/code-sample/command.jsx +17 -0
  36. package/dist/cases/code-sample.md +96 -0
  37. package/dist/cases/composer-limit/notice-with-action.jsx +3 -3
  38. package/dist/cases/composer-limit/notice.jsx +3 -3
  39. package/dist/cases/composer-limit.md +8 -8
  40. package/dist/cases/contact-page/form.d.ts +1 -0
  41. package/dist/cases/contact-page/form.jsx +83 -0
  42. package/dist/cases/contact-page/links.d.ts +1 -0
  43. package/dist/cases/contact-page/links.jsx +19 -0
  44. package/dist/cases/contact-page.md +142 -0
  45. package/dist/cases/dashboard/numbers-first.d.ts +1 -0
  46. package/dist/cases/dashboard/numbers-first.jsx +165 -0
  47. package/dist/cases/dashboard/work-first.d.ts +1 -0
  48. package/dist/cases/dashboard/work-first.jsx +165 -0
  49. package/dist/cases/dashboard.md +507 -0
  50. package/dist/cases/data-table-page/all-rows.d.ts +1 -0
  51. package/dist/cases/data-table-page/all-rows.jsx +226 -0
  52. package/dist/cases/data-table-page/paged.d.ts +1 -0
  53. package/dist/cases/data-table-page/paged.jsx +284 -0
  54. package/dist/cases/data-table-page.md +771 -0
  55. package/dist/cases/docs-component-page/reference.d.ts +1 -0
  56. package/dist/cases/docs-component-page/reference.jsx +93 -0
  57. package/dist/cases/docs-component-page.md +144 -0
  58. package/dist/cases/faq/accordion.d.ts +1 -0
  59. package/dist/cases/faq/accordion.jsx +25 -0
  60. package/dist/cases/faq/open-list.d.ts +1 -0
  61. package/dist/cases/faq/open-list.jsx +27 -0
  62. package/dist/cases/faq.md +110 -0
  63. package/dist/cases/feature-grid/cards.d.ts +1 -0
  64. package/dist/cases/feature-grid/cards.jsx +33 -0
  65. package/dist/cases/feature-grid/rows.d.ts +1 -0
  66. package/dist/cases/feature-grid/rows.jsx +30 -0
  67. package/dist/cases/feature-grid.md +132 -0
  68. package/dist/cases/image-viewer/gallery.d.ts +1 -0
  69. package/dist/cases/image-viewer/gallery.jsx +32 -0
  70. package/dist/cases/image-viewer/single.d.ts +1 -0
  71. package/dist/cases/image-viewer/single.jsx +25 -0
  72. package/dist/cases/image-viewer.md +123 -0
  73. package/dist/cases/invoice-list/table.d.ts +1 -0
  74. package/dist/cases/invoice-list/table.jsx +64 -0
  75. package/dist/cases/invoice-list/with-upcoming.d.ts +1 -0
  76. package/dist/cases/invoice-list/with-upcoming.jsx +75 -0
  77. package/dist/cases/invoice-list.md +237 -0
  78. package/dist/cases/landing-hero/centered.d.ts +1 -0
  79. package/dist/cases/landing-hero/centered.jsx +22 -0
  80. package/dist/cases/landing-hero/split.d.ts +1 -0
  81. package/dist/cases/landing-hero/split.jsx +30 -0
  82. package/dist/cases/landing-hero.md +114 -0
  83. package/dist/cases/legal-page/sections.d.ts +1 -0
  84. package/dist/cases/legal-page/sections.jsx +61 -0
  85. package/dist/cases/legal-page.md +96 -0
  86. package/dist/cases/load-failure/inline.jsx +2 -2
  87. package/dist/cases/load-failure.md +2 -2
  88. package/dist/cases/long-form-page/article.d.ts +1 -0
  89. package/dist/cases/long-form-page/article.jsx +58 -0
  90. package/dist/cases/long-form-page/with-contents.d.ts +1 -0
  91. package/dist/cases/long-form-page/with-contents.jsx +41 -0
  92. package/dist/cases/long-form-page.md +170 -0
  93. package/dist/cases/members-list/rows.jsx +2 -1
  94. package/dist/cases/members-list/table.jsx +8 -9
  95. package/dist/cases/members-list.md +12 -13
  96. package/dist/cases/message-actions/hover-toolbar.jsx +11 -8
  97. package/dist/cases/message-actions/menu.jsx +10 -7
  98. package/dist/cases/message-actions.md +19 -13
  99. package/dist/cases/message-attachments/in-composer.jsx +2 -2
  100. package/dist/cases/message-attachments/in-message.jsx +16 -11
  101. package/dist/cases/message-attachments.md +29 -17
  102. package/dist/cases/number-format.md +36 -0
  103. package/dist/cases/one-main-action.md +33 -0
  104. package/dist/cases/overflow-menu/in-a-header.jsx +9 -6
  105. package/dist/cases/overflow-menu/on-a-row.jsx +9 -6
  106. package/dist/cases/overflow-menu.md +16 -10
  107. package/dist/cases/page-end/cta-band.d.ts +1 -0
  108. package/dist/cases/page-end/cta-band.jsx +24 -0
  109. package/dist/cases/page-end/next-link.d.ts +1 -0
  110. package/dist/cases/page-end/next-link.jsx +18 -0
  111. package/dist/cases/page-end.md +88 -0
  112. package/dist/cases/paged-card/pager.d.ts +1 -0
  113. package/dist/cases/paged-card/pager.jsx +41 -0
  114. package/dist/cases/paged-card/see-all.d.ts +1 -0
  115. package/dist/cases/paged-card/see-all.jsx +34 -0
  116. package/dist/cases/paged-card.md +147 -0
  117. package/dist/cases/password-gate/inline.d.ts +1 -0
  118. package/dist/cases/password-gate/inline.jsx +94 -0
  119. package/dist/cases/password-gate/modal.d.ts +1 -0
  120. package/dist/cases/password-gate/modal.jsx +81 -0
  121. package/dist/cases/password-gate/page.d.ts +1 -0
  122. package/dist/cases/password-gate/page.jsx +82 -0
  123. package/dist/cases/password-gate.md +351 -0
  124. package/dist/cases/payment-method/none.d.ts +1 -0
  125. package/dist/cases/payment-method/none.jsx +17 -0
  126. package/dist/cases/payment-method/on-file.d.ts +1 -0
  127. package/dist/cases/payment-method/on-file.jsx +92 -0
  128. package/dist/cases/payment-method.md +182 -0
  129. package/dist/cases/plan-change-confirm/blocked.d.ts +1 -0
  130. package/dist/cases/plan-change-confirm/blocked.jsx +48 -0
  131. package/dist/cases/plan-change-confirm/downgrade.d.ts +1 -0
  132. package/dist/cases/plan-change-confirm/downgrade.jsx +52 -0
  133. package/dist/cases/plan-change-confirm/upgrade.d.ts +1 -0
  134. package/dist/cases/plan-change-confirm/upgrade.jsx +51 -0
  135. package/dist/cases/plan-change-confirm.md +261 -0
  136. package/dist/cases/plan-picker/cards.d.ts +1 -0
  137. package/dist/cases/plan-picker/cards.jsx +97 -0
  138. package/dist/cases/plan-picker/list.d.ts +1 -0
  139. package/dist/cases/plan-picker/list.jsx +103 -0
  140. package/dist/cases/plan-picker.md +297 -0
  141. package/dist/cases/pricing-section/cards.d.ts +1 -0
  142. package/dist/cases/pricing-section/cards.jsx +40 -0
  143. package/dist/cases/pricing-section.md +85 -0
  144. package/dist/cases/product-cards/grid.d.ts +1 -0
  145. package/dist/cases/product-cards/grid.jsx +20 -0
  146. package/dist/cases/product-cards.md +71 -0
  147. package/dist/cases/range-switch/segmented.jsx +11 -7
  148. package/dist/cases/range-switch.md +16 -11
  149. package/dist/cases/reply-feedback/thumbs.jsx +11 -8
  150. package/dist/cases/reply-feedback/with-reason.jsx +11 -8
  151. package/dist/cases/reply-feedback.md +20 -14
  152. package/dist/cases/section-index/cards.d.ts +1 -0
  153. package/dist/cases/section-index/cards.jsx +25 -0
  154. package/dist/cases/section-index/list.d.ts +1 -0
  155. package/dist/cases/section-index/list.jsx +56 -0
  156. package/dist/cases/section-index.md +140 -0
  157. package/dist/cases/settings-page/top-tabs.jsx +4 -3
  158. package/dist/cases/settings-page.md +5 -4
  159. package/dist/cases/site-header.md +1 -1
  160. package/dist/cases/site-search/dialog.d.ts +1 -0
  161. package/dist/cases/site-search/dialog.jsx +131 -0
  162. package/dist/cases/site-search.md +176 -0
  163. package/dist/cases/stat-row/featured.d.ts +1 -0
  164. package/dist/cases/stat-row/featured.jsx +17 -0
  165. package/dist/cases/stat-row/tiles.d.ts +1 -0
  166. package/dist/cases/stat-row/tiles.jsx +34 -0
  167. package/dist/cases/stat-row.md +104 -0
  168. package/dist/cases/status-label/dot.d.ts +1 -0
  169. package/dist/cases/status-label/dot.jsx +39 -0
  170. package/dist/cases/status-label/text.d.ts +1 -0
  171. package/dist/cases/status-label/text.jsx +44 -0
  172. package/dist/cases/status-label.md +143 -0
  173. package/dist/cases/tabbed-panels/tabs.d.ts +1 -0
  174. package/dist/cases/tabbed-panels/tabs.jsx +40 -0
  175. package/dist/cases/tabbed-panels.md +81 -0
  176. package/dist/cases/upgrade-prompt/inline.jsx +4 -2
  177. package/dist/cases/upgrade-prompt/modal.jsx +2 -1
  178. package/dist/cases/upgrade-prompt.md +10 -6
  179. package/dist/cases/usage-meters/by-person.d.ts +1 -0
  180. package/dist/cases/usage-meters/by-person.jsx +72 -0
  181. package/dist/cases/usage-meters/meters.d.ts +1 -0
  182. package/dist/cases/usage-meters/meters.jsx +49 -0
  183. package/dist/cases/usage-meters/with-cap.d.ts +1 -0
  184. package/dist/cases/usage-meters/with-cap.jsx +73 -0
  185. package/dist/cases/usage-meters.md +303 -0
  186. package/dist/cases.json +2178 -97
  187. package/dist/components/accordion.d.ts +31 -0
  188. package/dist/components/accordion.jsx +103 -0
  189. package/dist/components/button.d.ts +1 -1
  190. package/dist/components/button.jsx +11 -5
  191. package/dist/components/codeBlock.d.ts +26 -0
  192. package/dist/components/codeBlock.jsx +101 -0
  193. package/dist/components/formatNumber.d.ts +25 -0
  194. package/dist/components/formatNumber.js +125 -0
  195. package/dist/components/iconButton.jsx +12 -7
  196. package/dist/components/lightbox.d.ts +31 -0
  197. package/dist/components/lightbox.jsx +161 -0
  198. package/dist/components/linkCard.d.ts +10 -1
  199. package/dist/components/linkCard.jsx +32 -6
  200. package/dist/components/modal.d.ts +10 -2
  201. package/dist/components/modal.jsx +17 -12
  202. package/dist/components/pageHeader.jsx +1 -1
  203. package/dist/components/pagination.d.ts +28 -0
  204. package/dist/components/pagination.jsx +89 -0
  205. package/dist/components/progress.d.ts +33 -0
  206. package/dist/components/progress.jsx +50 -0
  207. package/dist/components/searchDialog.d.ts +44 -0
  208. package/dist/components/searchDialog.jsx +152 -0
  209. package/dist/components/skeleton.d.ts +21 -0
  210. package/dist/components/skeleton.jsx +41 -0
  211. package/dist/components/statTile.d.ts +32 -0
  212. package/dist/components/statTile.jsx +61 -0
  213. package/dist/components/tab.d.ts +5 -1
  214. package/dist/components/tab.jsx +2 -2
  215. package/dist/components/tabPanel.d.ts +16 -0
  216. package/dist/components/tabPanel.jsx +12 -0
  217. package/dist/components/tableContainer.d.ts +5 -1
  218. package/dist/components/tableContainer.jsx +9 -1
  219. package/dist/components/tableHeaderCell.d.ts +3 -1
  220. package/dist/components/tableHeaderCell.jsx +2 -2
  221. package/dist/components/tabsContainer.d.ts +5 -1
  222. package/dist/components/tabsContainer.jsx +2 -2
  223. package/dist/components/titleBar.d.ts +3 -1
  224. package/dist/components/titleBar.jsx +4 -3
  225. package/dist/index.d.ts +10 -0
  226. package/dist/index.js +10 -0
  227. package/dist/internal/accordion.d.ts +4 -0
  228. package/dist/internal/accordion.js +53 -0
  229. package/dist/internal/combobox.d.ts +20 -0
  230. package/dist/internal/combobox.js +28 -0
  231. package/dist/internal/highlight.d.ts +5 -0
  232. package/dist/internal/highlight.js +18 -0
  233. package/dist/native-mapping.json +57 -3
  234. package/dist/stories/Accordion.stories.d.ts +11 -0
  235. package/dist/stories/Accordion.stories.jsx +93 -0
  236. package/dist/stories/Button.stories.d.ts +1 -0
  237. package/dist/stories/Button.stories.jsx +19 -1
  238. package/dist/stories/Cases.generated.stories.d.ts +60 -0
  239. package/dist/stories/Cases.generated.stories.jsx +120 -0
  240. package/dist/stories/CodeBlock.stories.d.ts +12 -0
  241. package/dist/stories/CodeBlock.stories.jsx +65 -0
  242. package/dist/stories/Lightbox.stories.d.ts +8 -0
  243. package/dist/stories/Lightbox.stories.jsx +40 -0
  244. package/dist/stories/LinkCard.stories.d.ts +6 -0
  245. package/dist/stories/LinkCard.stories.jsx +17 -0
  246. package/dist/stories/PageHeader.stories.d.ts +2 -0
  247. package/dist/stories/PageHeader.stories.jsx +13 -0
  248. package/dist/stories/Pagination.stories.d.ts +9 -0
  249. package/dist/stories/Pagination.stories.jsx +75 -0
  250. package/dist/stories/Progress.stories.d.ts +9 -0
  251. package/dist/stories/Progress.stories.jsx +43 -0
  252. package/dist/stories/SearchDialog.stories.d.ts +17 -0
  253. package/dist/stories/SearchDialog.stories.jsx +111 -0
  254. package/dist/stories/Skeleton.stories.d.ts +7 -0
  255. package/dist/stories/Skeleton.stories.jsx +27 -0
  256. package/dist/stories/StatTile.stories.d.ts +10 -0
  257. package/dist/stories/StatTile.stories.jsx +55 -0
  258. package/dist/stories/TabPanel.stories.d.ts +7 -0
  259. package/dist/stories/TabPanel.stories.jsx +31 -0
  260. package/dist/stories/Table.stories.d.ts +1 -0
  261. package/dist/stories/Table.stories.jsx +49 -1
  262. package/dist/stories/TitleBar.stories.d.ts +1 -0
  263. package/dist/stories/TitleBar.stories.jsx +7 -0
  264. package/package.json +5 -1
@@ -66,12 +66,12 @@ export default function ComposerLimitNoticeWithAction() {
66
66
  </Message>); })}
67
67
  </Stack>
68
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}
69
+ // After 'Not Now' the placeholder says when AI agent responses start again.
70
+ placeholder={showNotice ? 'Message the team' : 'Message the team. AI agent responses start again on Dec 1.'} value={text} onChange={setText} onSubmit={send}
71
71
  // A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
72
72
  // This person can change the plan, so they get the button that lifts the limit. Alert has no action slot.
73
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."/>
74
+ <Alert type="warning" variant="inline" autoDismiss={false} message="You've used all 50 AI agent responses this month." secondMessage="They start again on Dec 1. The Pro plan gives Acme Design 1,000 AI agent responses a month."/>
75
75
  <Cluster gap="small">
76
76
  <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow}/>
77
77
  <Button size="small" type="primary" state="enabled" label="Upgrade to Pro" onClickButton={function () { return router.push('/settings/billing?plan=pro'); }}/>
@@ -64,12 +64,12 @@ export default function ComposerLimitNotice() {
64
64
  </Message>); })}
65
65
  </Stack>
66
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}
67
+ // After 'Not Now' the placeholder says when AI agent responses start again.
68
+ placeholder={showNotice ? 'Message the team' : 'Message the team. AI agent responses start again on Dec 1.'} value={text} onChange={setText} onSubmit={send}
69
69
  // A standing condition: no close button on the Alert, and no auto-dismiss. 'Not Now' closes it.
70
70
  // This person cannot change the plan, so it says who can. Everyone can close a refusal. Alert has no action slot.
71
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."/>
72
+ <Alert type="warning" variant="inline" autoDismiss={false} message="You've used all 50 AI agent responses this month." secondMessage="They start again on Dec 1. Ask a workspace admin to upgrade Acme Design to Pro for more replies."/>
73
73
  <Cluster gap="small">
74
74
  <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow}/>
75
75
  </Cluster>
@@ -1,6 +1,6 @@
1
1
  # Composer at a limit
2
2
 
3
- The agent cannot be called from the composer because the workspace reached a limit, such as its agent replies for the month.
3
+ The agent cannot be called from the composer because the workspace reached a limit, such as its AI agent responses for the month.
4
4
 
5
5
  ## Do
6
6
 
@@ -10,7 +10,7 @@ The agent cannot be called from the composer because the workspace reached a lim
10
10
  - Give everyone 'Not Now', a tertiary Button, so the refusal can be closed. Put the Buttons in a `Cluster` under the Alert.
11
11
  - Give a person who can lift the limit the action after 'Not Now', as a primary Button, such as 'Upgrade to Pro'.
12
12
  - 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.
13
- - Say in the placeholder when agent replies start again, once the person chose 'Not Now'.
13
+ - Say in the placeholder when AI agent responses start again, once the person chose 'Not Now'.
14
14
  - Move focus to the message box after 'Not Now', since the Button that had it is gone.
15
15
  - Keep the field and send working, so messages to people still go.
16
16
  - Follow the case 'Upgrade prompt' for a limit reached anywhere outside the message box.
@@ -111,8 +111,8 @@ export default function ComposerLimitNotice() {
111
111
  ref={field}
112
112
  id="composer-limit-notice-message"
113
113
  aria-label="Message"
114
- // After 'Not Now' the placeholder says when agent replies start again.
115
- placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'}
114
+ // After 'Not Now' the placeholder says when AI agent responses start again.
115
+ placeholder={showNotice ? 'Message the team' : 'Message the team. AI agent responses start again on Dec 1.'}
116
116
  value={text}
117
117
  onChange={setText}
118
118
  onSubmit={send}
@@ -126,7 +126,7 @@ export default function ComposerLimitNotice() {
126
126
  variant="inline"
127
127
  autoDismiss={false}
128
128
  message="You've used all 50 AI agent responses this month."
129
- secondMessage="They start again on December 1. Ask a workspace admin to upgrade Acme Design to Pro for more replies."
129
+ secondMessage="They start again on Dec 1. Ask a workspace admin to upgrade Acme Design to Pro for more replies."
130
130
  />
131
131
  <Cluster gap="small">
132
132
  <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow} />
@@ -239,8 +239,8 @@ export default function ComposerLimitNoticeWithAction() {
239
239
  ref={field}
240
240
  id="composer-limit-action-message"
241
241
  aria-label="Message"
242
- // After 'Not Now' the placeholder says when agent replies start again.
243
- placeholder={showNotice ? 'Message the team' : 'Message the team. Agent replies start again on December 1.'}
242
+ // After 'Not Now' the placeholder says when AI agent responses start again.
243
+ placeholder={showNotice ? 'Message the team' : 'Message the team. AI agent responses start again on Dec 1.'}
244
244
  value={text}
245
245
  onChange={setText}
246
246
  onSubmit={send}
@@ -254,7 +254,7 @@ export default function ComposerLimitNoticeWithAction() {
254
254
  variant="inline"
255
255
  autoDismiss={false}
256
256
  message="You've used all 50 AI agent responses this month."
257
- secondMessage="They start again on December 1. The Pro plan gives Acme Design 1,000 AI agent responses a month."
257
+ secondMessage="They start again on Dec 1. The Pro plan gives Acme Design 1,000 AI agent responses a month."
258
258
  />
259
259
  <Cluster gap="small">
260
260
  <Button size="small" type="tertiary" state="enabled" label="Not Now" onClickButton={notNow} />
@@ -0,0 +1 @@
1
+ export default function ContactPageForm(): import("react").JSX.Element;
@@ -0,0 +1,83 @@
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
+ import { useEffect, useRef, useState } from 'react';
14
+ import PageShell from '../../components/pageShell';
15
+ import PageHeader from '../../components/pageHeader';
16
+ import Form from '../../components/form';
17
+ import TextField from '../../components/textField';
18
+ import Textarea from '../../components/textarea';
19
+ import Alert from '../../components/alert';
20
+ import Button from '../../components/button';
21
+ import { Stack } from '../../components/layout';
22
+ // A small check: some text, an @, then some text.
23
+ function looksLikeEmail(value) {
24
+ return /^[^@\s]+@[^@\s]+$/.test(value);
25
+ }
26
+ export default function ContactPageForm() {
27
+ var _a = useState(''), name = _a[0], setName = _a[1];
28
+ var _b = useState(''), email = _b[0], setEmail = _b[1];
29
+ var _c = useState(''), message = _c[0], setMessage = _c[1];
30
+ var _d = useState({ name: '', email: '', message: '' }), errors = _d[0], setErrors = _d[1];
31
+ var _e = useState(false), sent = _e[0], setSent = _e[1];
32
+ var _f = useState(false), sending = _f[0], setSending = _f[1];
33
+ var timer = useRef();
34
+ // Stops the request if the example goes away before it ends.
35
+ useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
36
+ // Any edit clears the confirmation and the problem with that field.
37
+ function edit(field, set, value) {
38
+ set(value);
39
+ setSent(false);
40
+ setErrors(function (current) {
41
+ var _a;
42
+ return (__assign(__assign({}, current), (_a = {}, _a[field] = '', _a)));
43
+ });
44
+ }
45
+ function handleSubmit() {
46
+ if (sending)
47
+ return;
48
+ setSent(false);
49
+ var next = {
50
+ name: name.trim() ? '' : 'Enter your name.',
51
+ email: !email.trim() ? 'Enter your email.' : looksLikeEmail(email.trim()) ? '' : 'Enter an email address, like name@example.com.',
52
+ message: message.trim() ? '' : 'Write a message.',
53
+ };
54
+ setErrors(next);
55
+ if (next.name || next.email || next.message)
56
+ return;
57
+ setSending(true);
58
+ // A real page also has a hidden spam-trap input named `website`, in its own code. ODS has no hidden field, so the example leaves it out.
59
+ // Stands in for the request to the server.
60
+ timer.current = setTimeout(function () {
61
+ setSending(false);
62
+ setSent(true);
63
+ setName('');
64
+ setEmail('');
65
+ setMessage('');
66
+ }, 1200);
67
+ }
68
+ return (<PageShell>
69
+ <Stack gap="xxlarge">
70
+ <PageHeader level={1} title="Contact" lede="I read every message and reply within two days."/>
71
+ <Form aria-label="Contact" onSubmit={handleSubmit}>
72
+ {/* The confirmation stays until the next edit, so it has no close button and does not close on its own. */}
73
+ {sent && <Alert type="success" variant="inline" message="Message sent. I reply within two days." autoDismiss={false}/>}
74
+ <TextField id="contact-page-name" label="Name" autoComplete="name" value={name} disabled={sending} error={Boolean(errors.name)} errorText={errors.name} onChange={function (e) { return edit('name', setName, e.target.value); }}/>
75
+ <TextField id="contact-page-email" label="Email" type="email" autoComplete="email" value={email} disabled={sending} error={Boolean(errors.email)} errorText={errors.email} onChange={function (e) { return edit('email', setEmail, e.target.value); }}/>
76
+ <Textarea id="contact-page-message" label="Message" maxRows={8} value={message} disabled={sending} error={Boolean(errors.message)} errorText={errors.message} onChange={function (e) { return edit('message', setMessage, e.target.value); }}/>
77
+ <Stack align="start">
78
+ <Button size="large" type="primary" state="enabled" label="Send" htmlType="submit" loading={sending}/>
79
+ </Stack>
80
+ </Form>
81
+ </Stack>
82
+ </PageShell>);
83
+ }
@@ -0,0 +1 @@
1
+ export default function ContactPageLinks(): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import PageShell from '../../components/pageShell';
3
+ import PageHeader from '../../components/pageHeader';
4
+ import Link from '../../components/link';
5
+ import CopyField from '../../components/copyField';
6
+ import { Stack } from '../../components/layout';
7
+ export default function ContactPageLinks() {
8
+ return (<PageShell>
9
+ <Stack gap="xxlarge">
10
+ <PageHeader level={1} title="Contact" lede="Write to me at this address. I reply within two days."/>
11
+ <Stack gap="large">
12
+ {/* A mailto link opens the visitor's own mail app. */}
13
+ <Link href="mailto:hello@acme.example">hello@acme.example</Link>
14
+ {/* For a visitor with no mail app: copy the address. */}
15
+ <CopyField id="contact-page-address" label="Email address" value="hello@acme.example"/>
16
+ </Stack>
17
+ </Stack>
18
+ </PageShell>);
19
+ }
@@ -0,0 +1,142 @@
1
+ # Contact page
2
+
3
+ A visitor wants to reach the person behind a site.
4
+
5
+ ## Do
6
+
7
+ - Use a `Form` for `form`, with Name, Email and Message, and follow the rules 'A form error shows next to the problem' and 'Success shows where the person is looking'.
8
+ - Show a problem with one field under that field. Say what to do: 'Enter an email address, like name@example.com.'
9
+ - Keep the label 'Send' while sending, and make the Button `loading`. Disable the fields.
10
+ - Show success in an inline success `Alert` with `autoDismiss={false}`: 'Message sent. I reply within two days.' Clear it on the next edit, and clear the fields.
11
+ - Say how long a reply takes, in the lede or in the confirmation.
12
+ - Add a spam-trap input named `website` in your own code, hidden from sight and from screen readers, with `tabIndex={-1}` and `autoComplete="off"`. The server drops a message that fills it. ODS has no hidden field, so the example leaves it out. Never show it as a visible `TextField`.
13
+ - Show a failed send above the fields in `<Alert type="error" variant="inline" showCloseButton>`: 'Could not send your message. Try again.' Keep what the visitor typed.
14
+ - Give the address in `links` as a `Link` with `mailto:` and as a `CopyField`, so a visitor with no mail app can copy it.
15
+ - Use one address only: 'hello@acme.example'.
16
+
17
+ ## Don't
18
+
19
+ - Do not change the Send label to Sending while it runs.
20
+ - Do not clear what the visitor typed after a failed send.
21
+ - Do not open the mail app from a Button with `window.open`. Use a link with `mailto:`.
22
+ - Do not close the confirmation on a timer. It stays until the next edit.
23
+ - Do not show both options on one page. Pick one.
24
+
25
+ ## Option: A message form
26
+
27
+ Use when: A visitor writes a message here, and the person reads and answers it.
28
+
29
+ Uses: `Alert`, `Button`, `Form`, `PageHeader`, `PageShell`, `Stack`, `TextField`, `Textarea`
30
+
31
+ ```tsx
32
+ 'use client';
33
+ import { useEffect, useRef, useState } from 'react';
34
+ import PageShell from 'oneslash-design-system/components/pageShell';
35
+ import PageHeader from 'oneslash-design-system/components/pageHeader';
36
+ import Form from 'oneslash-design-system/components/form';
37
+ import TextField from 'oneslash-design-system/components/textField';
38
+ import Textarea from 'oneslash-design-system/components/textarea';
39
+ import Alert from 'oneslash-design-system/components/alert';
40
+ import Button from 'oneslash-design-system/components/button';
41
+ import { Stack } from 'oneslash-design-system/components/layout';
42
+
43
+ // A small check: some text, an @, then some text.
44
+ function looksLikeEmail(value: string) {
45
+ return /^[^@\s]+@[^@\s]+$/.test(value);
46
+ }
47
+
48
+ export default function ContactPageForm() {
49
+ const [name, setName] = useState('');
50
+ const [email, setEmail] = useState('');
51
+ const [message, setMessage] = useState('');
52
+ const [errors, setErrors] = useState({ name: '', email: '', message: '' });
53
+ const [sent, setSent] = useState(false);
54
+ const [sending, setSending] = useState(false);
55
+ const timer = useRef<ReturnType<typeof setTimeout>>();
56
+
57
+ // Stops the request if the example goes away before it ends.
58
+ useEffect(() => () => clearTimeout(timer.current), []);
59
+
60
+ // Any edit clears the confirmation and the problem with that field.
61
+ function edit(field: 'name' | 'email' | 'message', set: (value: string) => void, value: string) {
62
+ set(value);
63
+ setSent(false);
64
+ setErrors((current) => ({ ...current, [field]: '' }));
65
+ }
66
+
67
+ function handleSubmit() {
68
+ if (sending) return;
69
+ setSent(false);
70
+ const next = {
71
+ name: name.trim() ? '' : 'Enter your name.',
72
+ email: !email.trim() ? 'Enter your email.' : looksLikeEmail(email.trim()) ? '' : 'Enter an email address, like name@example.com.',
73
+ message: message.trim() ? '' : 'Write a message.',
74
+ };
75
+ setErrors(next);
76
+ if (next.name || next.email || next.message) return;
77
+ setSending(true);
78
+ // A real page also has a hidden spam-trap input named `website`, in its own code. ODS has no hidden field, so the example leaves it out.
79
+ // Stands in for the request to the server.
80
+ timer.current = setTimeout(() => {
81
+ setSending(false);
82
+ setSent(true);
83
+ setName('');
84
+ setEmail('');
85
+ setMessage('');
86
+ }, 1200);
87
+ }
88
+
89
+ return (
90
+ <PageShell>
91
+ <Stack gap="xxlarge">
92
+ <PageHeader level={1} title="Contact" lede="I read every message and reply within two days." />
93
+ <Form aria-label="Contact" onSubmit={handleSubmit}>
94
+ {/* The confirmation stays until the next edit, so it has no close button and does not close on its own. */}
95
+ {sent && <Alert type="success" variant="inline" message="Message sent. I reply within two days." autoDismiss={false} />}
96
+ <TextField id="contact-page-name" label="Name" autoComplete="name" value={name} disabled={sending} error={Boolean(errors.name)} errorText={errors.name} onChange={(e) => edit('name', setName, e.target.value)} />
97
+ <TextField id="contact-page-email" label="Email" type="email" autoComplete="email" value={email} disabled={sending} error={Boolean(errors.email)} errorText={errors.email} onChange={(e) => edit('email', setEmail, e.target.value)} />
98
+ <Textarea id="contact-page-message" label="Message" maxRows={8} value={message} disabled={sending} error={Boolean(errors.message)} errorText={errors.message} onChange={(e) => edit('message', setMessage, e.target.value)} />
99
+ <Stack align="start">
100
+ <Button size="large" type="primary" state="enabled" label="Send" htmlType="submit" loading={sending} />
101
+ </Stack>
102
+ </Form>
103
+ </Stack>
104
+ </PageShell>
105
+ );
106
+ }
107
+ ```
108
+
109
+ ## Option: An address only
110
+
111
+ Use when: There is no inbox to read. The page gives an address and nothing else.
112
+
113
+ Uses: `CopyField`, `Link`, `PageHeader`, `PageShell`, `Stack`
114
+
115
+ ```tsx
116
+ 'use client';
117
+ import PageShell from 'oneslash-design-system/components/pageShell';
118
+ import PageHeader from 'oneslash-design-system/components/pageHeader';
119
+ import Link from 'oneslash-design-system/components/link';
120
+ import CopyField from 'oneslash-design-system/components/copyField';
121
+ import { Stack } from 'oneslash-design-system/components/layout';
122
+
123
+ export default function ContactPageLinks() {
124
+ return (
125
+ <PageShell>
126
+ <Stack gap="xxlarge">
127
+ <PageHeader level={1} title="Contact" lede="Write to me at this address. I reply within two days." />
128
+ <Stack gap="large">
129
+ {/* A mailto link opens the visitor's own mail app. */}
130
+ <Link href="mailto:hello@acme.example">hello@acme.example</Link>
131
+ {/* For a visitor with no mail app: copy the address. */}
132
+ <CopyField id="contact-page-address" label="Email address" value="hello@acme.example" />
133
+ </Stack>
134
+ </Stack>
135
+ </PageShell>
136
+ );
137
+ }
138
+ ```
139
+
140
+ ## Native
141
+
142
+ On Apple a message form is a grouped `Form` with a Send button in the toolbar. For an address only, use a `Link` with a `mailto:` address.
@@ -0,0 +1 @@
1
+ export default function DashboardNumbersFirst(): import("react").JSX.Element;
@@ -0,0 +1,165 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import AppShell from '../../components/appShell';
4
+ import TitleBar from '../../components/titleBar';
5
+ import SegmentedControl from '../../components/segmentedControl';
6
+ import SettingsSection from '../../components/settingsSection';
7
+ import Navigation from '../../components/navigation';
8
+ import MenuItem from '../../components/menuItem';
9
+ import StatTile from '../../components/statTile';
10
+ import Progress from '../../components/progress';
11
+ import Skeleton from '../../components/skeleton';
12
+ import Alert from '../../components/alert';
13
+ import Button from '../../components/button';
14
+ import Paragraph from '../../components/paragraph';
15
+ import EmptyBox from '../../components/emptyBox';
16
+ import List from '../../components/list';
17
+ import { formatCount } from '../../components/formatNumber';
18
+ import { Cluster, Grid, Stack } from '../../components/layout';
19
+ var ranges = [
20
+ { value: 'week', label: 'Week' },
21
+ { value: 'month', label: 'Month' },
22
+ { value: 'quarter', label: 'Quarter' },
23
+ ];
24
+ // A real app counts these on the server. One range drives every number on the page.
25
+ var data = {
26
+ week: {
27
+ stats: { comments: [1240, 1106], done: [312, 280], people: [18, 18], reply: [8640000, 9200000] },
28
+ projects: [['Website', 540], ['Mobile App', 380], ['Docs', 320]],
29
+ waiting: [
30
+ ['Ben Carter asked for the new screens', '/comments/1'],
31
+ ['Omar Reyes mentioned you in Launch plan', '/comments/2'],
32
+ ['Review the pricing copy', '/comments/3'],
33
+ ],
34
+ questions: [],
35
+ },
36
+ month: {
37
+ stats: { comments: [4820, 5210], done: [1190, 1004], people: [31, 27], reply: [7800000, 8100000] },
38
+ projects: [['Website', 2010], ['Mobile App', 1500], ['Docs', 910], ['Help Center', 400]],
39
+ waiting: [
40
+ ['Ben Carter asked for the new screens', '/comments/1'],
41
+ ['Omar Reyes mentioned you in Launch plan', '/comments/2'],
42
+ ['Review the pricing copy', '/comments/3'],
43
+ ['Confirm the release date', '/comments/4'],
44
+ ['Approve the new onboarding text', '/comments/5'],
45
+ ],
46
+ questions: [['Is the new pricing public before Friday?', '/questions/1'], ['Who approves the final copy?', '/questions/2']],
47
+ },
48
+ quarter: {
49
+ stats: { comments: [15880, 12410], done: [3950, 3210], people: [44, 36], reply: [7200000, 7900000] },
50
+ projects: [['Website', 6100], ['Mobile App', 4800], ['Docs', 3100], ['Help Center', 1880]],
51
+ waiting: [
52
+ ['Ben Carter asked for the new screens', '/comments/1'],
53
+ ['Omar Reyes mentioned you in Launch plan', '/comments/2'],
54
+ ['Review the pricing copy', '/comments/3'],
55
+ ['Confirm the release date', '/comments/4'],
56
+ ],
57
+ questions: [['Is the new pricing public before Friday?', '/questions/1'], ['Who approves the final copy?', '/questions/2'], ['Which logo should the launch page use?', '/questions/3']],
58
+ },
59
+ };
60
+ var noun = { week: 'this week', month: 'this month', quarter: 'this quarter' };
61
+ export default function DashboardNumbersFirst() {
62
+ var _a = useState('week'), range = _a[0], setRange = _a[1];
63
+ // The numbers load again when the range changes.
64
+ var _b = useState(false), loading = _b[0], setLoading = _b[1];
65
+ // The projects section fails first, so the rest of the page shows that one section can fail alone.
66
+ var _c = useState(true), projectsFailed = _c[0], setProjectsFailed = _c[1];
67
+ var _d = useState(false), retrying = _d[0], setRetrying = _d[1];
68
+ var _e = useState(false), navOpen = _e[0], setNavOpen = _e[1];
69
+ var timer = useRef();
70
+ var retryTimer = useRef();
71
+ // Stops the requests if the example goes away before they end.
72
+ useEffect(function () { return function () {
73
+ clearTimeout(timer.current);
74
+ clearTimeout(retryTimer.current);
75
+ }; }, []);
76
+ function changeRange(next) {
77
+ clearTimeout(timer.current);
78
+ setRange(next);
79
+ setLoading(true);
80
+ // Stands in for the request to the server.
81
+ timer.current = setTimeout(function () { return setLoading(false); }, 600);
82
+ }
83
+ function tryAgain() {
84
+ if (retrying)
85
+ return;
86
+ setRetrying(true);
87
+ retryTimer.current = setTimeout(function () {
88
+ setRetrying(false);
89
+ setProjectsFailed(false);
90
+ }, 1200);
91
+ }
92
+ var d = data[range];
93
+ var period = range;
94
+ var projectTotal = d.projects.reduce(function (sum, p) { return sum + p[1]; }, 0);
95
+ var waitingCount = d.waiting.length;
96
+ var sidebar = (<Navigation aria-label="Main">
97
+ <Paragraph size="body1" measure="none">Acme</Paragraph>
98
+ {[
99
+ ['Dashboard', 'LayoutDashboard', '/dashboard'],
100
+ ['Comments', 'MessageSquare', '/comments'],
101
+ ['Projects', 'FolderKanban', '/projects'],
102
+ ].map(function (_a) {
103
+ var label = _a[0], icon = _a[1], href = _a[2];
104
+ return (<MenuItem key={href} size="small" label={label} iconName={icon} href={href} isSelected={href === '/dashboard'} aria-current={href === '/dashboard' ? 'page' : undefined} onClick={function (event) {
105
+ // A real app lets the link go to its page. The example stays here.
106
+ event.preventDefault();
107
+ }}/>);
108
+ })}
109
+ </Navigation>);
110
+ var statRow = (<SettingsSection key="stats" title={"Numbers ".concat(noun[range])} id="dashboard-stats">
111
+ <Grid compact columns={4}>
112
+ <StatTile label="New comments" value={d.stats.comments[0]} previous={d.stats.comments[1]} period={period} loading={loading}/>
113
+ <StatTile label="Marked done" value={d.stats.done[0]} previous={d.stats.done[1]} period={period} loading={loading}/>
114
+ <StatTile label="People engaged" value={d.stats.people[0]} previous={d.stats.people[1]} period={period} loading={loading}/>
115
+ <StatTile label="Average reply time" value={d.stats.reply[0]} format="duration" previous={d.stats.reply[1]} period={period} loading={loading}/>
116
+ </Grid>
117
+ </SettingsSection>);
118
+ var projects = (<SettingsSection key="projects" title="Projects" description={"".concat(formatCount(projectTotal), " comments ").concat(noun[range], ", by project")} id="dashboard-projects">
119
+ {projectsFailed ? (<>
120
+ {/* Only this section failed. The rest of the page still shows. */}
121
+ <Alert type="error" variant="inline" message="Could not load projects." autoDismiss={false}/>
122
+ <Cluster>
123
+ <Button size="small" type="primary" state="enabled" label="Try Again" loading={retrying} onClickButton={tryAgain}/>
124
+ </Cluster>
125
+ </>) : loading ? (<Skeleton variant="text" lines={3} label="Loading projects"/>) : (<List size="body2" items={d.projects.map(function (_a) {
126
+ var name = _a[0], count = _a[1];
127
+ return (<Progress key={name} kind="share" label={name} value={count} max={projectTotal} unit="comments"/>);
128
+ })}/>)}
129
+ </SettingsSection>);
130
+ var waiting = (<SettingsSection key="waiting" title={loading ? 'Waiting on you' : "".concat(formatCount(waitingCount), " ").concat(waitingCount === 1 ? 'comment' : 'comments', " waiting on you")} description={"Asked of you ".concat(noun[range])} id="dashboard-waiting">
131
+ {loading ? (<Skeleton variant="text" lines={3} label="Loading what waits on you"/>) : (<Stack gap="small">
132
+ {d.waiting.map(function (_a) {
133
+ var text = _a[0], href = _a[1];
134
+ return (<MenuItem key={href} size="medium" label={text} href={href} onClick={function (event) {
135
+ // A real app lets the link go to its page. The example stays here.
136
+ event.preventDefault();
137
+ }}/>);
138
+ })}
139
+ </Stack>)}
140
+ </SettingsSection>);
141
+ var questions = (<SettingsSection key="questions" title="Questions from your agents" id="dashboard-questions">
142
+ {loading ? (<Skeleton variant="text" lines={2} label="Loading questions"/>) : d.questions.length === 0 ? (
143
+ // A section with nothing keeps its place and says what will fill it.
144
+ <EmptyBox size="small" text={"No questions from your agents ".concat(noun[range])} secondText="Questions your agents ask you appear here."/>) : (<Stack gap="small">
145
+ {d.questions.map(function (_a) {
146
+ var text = _a[0], href = _a[1];
147
+ return (<MenuItem key={href} size="medium" label={text} href={href} onClick={function (event) {
148
+ // A real app lets the link go to its page. The example stays here.
149
+ event.preventDefault();
150
+ }}/>);
151
+ })}
152
+ </Stack>)}
153
+ </SettingsSection>);
154
+ return (<AppShell title="Dashboard" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
155
+ <Stack gap="xlarge">
156
+ {/* One range drives every number below, and each heading says which one. */}
157
+ {/* Below md the range switch takes its own line under the title. */}
158
+ <TitleBar title="Dashboard" actionsBelow actions={<SegmentedControl size="small" width="fit" aria-label="Range" options={ranges} value={range} onChange={changeRange}/>}/>
159
+ {statRow}
160
+ {projects}
161
+ {waiting}
162
+ {questions}
163
+ </Stack>
164
+ </AppShell>);
165
+ }
@@ -0,0 +1 @@
1
+ export default function DashboardWorkFirst(): import("react").JSX.Element;