oneslash-design-system 2.19.0 → 2.20.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 (122) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +28 -4
  3. package/dist/cases/billing-page/billed-elsewhere.d.ts +1 -0
  4. package/dist/cases/billing-page/billed-elsewhere.jsx +28 -0
  5. package/dist/cases/billing-page/self-serve.d.ts +1 -0
  6. package/dist/cases/billing-page/self-serve.jsx +134 -0
  7. package/dist/cases/billing-page.md +247 -0
  8. package/dist/cases/breakdown-list/bars.d.ts +1 -0
  9. package/dist/cases/breakdown-list/bars.jsx +47 -0
  10. package/dist/cases/breakdown-list/table.d.ts +1 -0
  11. package/dist/cases/breakdown-list/table.jsx +69 -0
  12. package/dist/cases/breakdown-list.md +158 -0
  13. package/dist/cases/composer-limit/notice-with-action.jsx +3 -3
  14. package/dist/cases/composer-limit/notice.jsx +3 -3
  15. package/dist/cases/composer-limit.md +8 -8
  16. package/dist/cases/dashboard/numbers-first.d.ts +1 -0
  17. package/dist/cases/dashboard/numbers-first.jsx +165 -0
  18. package/dist/cases/dashboard/work-first.d.ts +1 -0
  19. package/dist/cases/dashboard/work-first.jsx +165 -0
  20. package/dist/cases/dashboard.md +507 -0
  21. package/dist/cases/data-table-page/all-rows.d.ts +1 -0
  22. package/dist/cases/data-table-page/all-rows.jsx +226 -0
  23. package/dist/cases/data-table-page/paged.d.ts +1 -0
  24. package/dist/cases/data-table-page/paged.jsx +284 -0
  25. package/dist/cases/data-table-page.md +771 -0
  26. package/dist/cases/invoice-list/table.d.ts +1 -0
  27. package/dist/cases/invoice-list/table.jsx +64 -0
  28. package/dist/cases/invoice-list/with-upcoming.d.ts +1 -0
  29. package/dist/cases/invoice-list/with-upcoming.jsx +75 -0
  30. package/dist/cases/invoice-list.md +237 -0
  31. package/dist/cases/load-failure/inline.jsx +2 -2
  32. package/dist/cases/load-failure.md +2 -2
  33. package/dist/cases/members-list/rows.jsx +2 -1
  34. package/dist/cases/members-list/table.jsx +8 -9
  35. package/dist/cases/members-list.md +12 -13
  36. package/dist/cases/number-format.md +36 -0
  37. package/dist/cases/paged-card/pager.d.ts +1 -0
  38. package/dist/cases/paged-card/pager.jsx +41 -0
  39. package/dist/cases/paged-card/see-all.d.ts +1 -0
  40. package/dist/cases/paged-card/see-all.jsx +34 -0
  41. package/dist/cases/paged-card.md +147 -0
  42. package/dist/cases/payment-method/none.d.ts +1 -0
  43. package/dist/cases/payment-method/none.jsx +17 -0
  44. package/dist/cases/payment-method/on-file.d.ts +1 -0
  45. package/dist/cases/payment-method/on-file.jsx +92 -0
  46. package/dist/cases/payment-method.md +182 -0
  47. package/dist/cases/plan-change-confirm/blocked.d.ts +1 -0
  48. package/dist/cases/plan-change-confirm/blocked.jsx +48 -0
  49. package/dist/cases/plan-change-confirm/downgrade.d.ts +1 -0
  50. package/dist/cases/plan-change-confirm/downgrade.jsx +52 -0
  51. package/dist/cases/plan-change-confirm/upgrade.d.ts +1 -0
  52. package/dist/cases/plan-change-confirm/upgrade.jsx +51 -0
  53. package/dist/cases/plan-change-confirm.md +261 -0
  54. package/dist/cases/plan-picker/cards.d.ts +1 -0
  55. package/dist/cases/plan-picker/cards.jsx +97 -0
  56. package/dist/cases/plan-picker/list.d.ts +1 -0
  57. package/dist/cases/plan-picker/list.jsx +103 -0
  58. package/dist/cases/plan-picker.md +297 -0
  59. package/dist/cases/range-switch/segmented.jsx +11 -7
  60. package/dist/cases/range-switch.md +16 -11
  61. package/dist/cases/settings-page/top-tabs.jsx +4 -3
  62. package/dist/cases/settings-page.md +5 -4
  63. package/dist/cases/stat-row/featured.d.ts +1 -0
  64. package/dist/cases/stat-row/featured.jsx +17 -0
  65. package/dist/cases/stat-row/tiles.d.ts +1 -0
  66. package/dist/cases/stat-row/tiles.jsx +34 -0
  67. package/dist/cases/stat-row.md +104 -0
  68. package/dist/cases/status-label/dot.d.ts +1 -0
  69. package/dist/cases/status-label/dot.jsx +39 -0
  70. package/dist/cases/status-label/text.d.ts +1 -0
  71. package/dist/cases/status-label/text.jsx +44 -0
  72. package/dist/cases/status-label.md +143 -0
  73. package/dist/cases/upgrade-prompt/inline.jsx +4 -2
  74. package/dist/cases/upgrade-prompt/modal.jsx +2 -1
  75. package/dist/cases/upgrade-prompt.md +10 -6
  76. package/dist/cases/usage-meters/by-person.d.ts +1 -0
  77. package/dist/cases/usage-meters/by-person.jsx +72 -0
  78. package/dist/cases/usage-meters/meters.d.ts +1 -0
  79. package/dist/cases/usage-meters/meters.jsx +49 -0
  80. package/dist/cases/usage-meters/with-cap.d.ts +1 -0
  81. package/dist/cases/usage-meters/with-cap.jsx +73 -0
  82. package/dist/cases/usage-meters.md +303 -0
  83. package/dist/cases.json +956 -19
  84. package/dist/components/button.d.ts +1 -1
  85. package/dist/components/button.jsx +11 -5
  86. package/dist/components/formatNumber.d.ts +25 -0
  87. package/dist/components/formatNumber.js +125 -0
  88. package/dist/components/iconButton.jsx +12 -7
  89. package/dist/components/pagination.d.ts +28 -0
  90. package/dist/components/pagination.jsx +89 -0
  91. package/dist/components/progress.d.ts +33 -0
  92. package/dist/components/progress.jsx +50 -0
  93. package/dist/components/skeleton.d.ts +21 -0
  94. package/dist/components/skeleton.jsx +41 -0
  95. package/dist/components/statTile.d.ts +32 -0
  96. package/dist/components/statTile.jsx +61 -0
  97. package/dist/components/tableContainer.d.ts +5 -1
  98. package/dist/components/tableContainer.jsx +9 -1
  99. package/dist/components/tableHeaderCell.d.ts +3 -1
  100. package/dist/components/tableHeaderCell.jsx +2 -2
  101. package/dist/components/titleBar.d.ts +3 -1
  102. package/dist/components/titleBar.jsx +4 -3
  103. package/dist/index.d.ts +5 -0
  104. package/dist/index.js +5 -0
  105. package/dist/native-mapping.json +26 -2
  106. package/dist/stories/Button.stories.d.ts +1 -0
  107. package/dist/stories/Button.stories.jsx +19 -1
  108. package/dist/stories/Cases.generated.stories.d.ts +26 -0
  109. package/dist/stories/Cases.generated.stories.jsx +52 -0
  110. package/dist/stories/Pagination.stories.d.ts +9 -0
  111. package/dist/stories/Pagination.stories.jsx +75 -0
  112. package/dist/stories/Progress.stories.d.ts +9 -0
  113. package/dist/stories/Progress.stories.jsx +43 -0
  114. package/dist/stories/Skeleton.stories.d.ts +7 -0
  115. package/dist/stories/Skeleton.stories.jsx +27 -0
  116. package/dist/stories/StatTile.stories.d.ts +10 -0
  117. package/dist/stories/StatTile.stories.jsx +55 -0
  118. package/dist/stories/Table.stories.d.ts +1 -0
  119. package/dist/stories/Table.stories.jsx +49 -1
  120. package/dist/stories/TitleBar.stories.d.ts +1 -0
  121. package/dist/stories/TitleBar.stories.jsx +7 -0
  122. package/package.json +5 -1
@@ -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 Heading from '../../components/heading';
12
+ import Paragraph from '../../components/paragraph';
13
+ import TableContainer from '../../components/tableContainer';
14
+ import TableHeader from '../../components/tableHeader';
15
+ import TableHeaderCell from '../../components/tableHeaderCell';
16
+ import TableRow from '../../components/tableRow';
17
+ import TableCell from '../../components/tableCell';
18
+ import { formatCount, formatMoney, formatPercent } from '../../components/formatNumber';
19
+ import { Center, Stack } from '../../components/layout';
20
+ // A real app counts these on the server.
21
+ var models = [
22
+ { name: 'Atlas Large', responses: 5120, cost: 61.4 },
23
+ { name: 'Atlas Medium', responses: 3010, cost: 18.06 },
24
+ { name: 'Birch 4', responses: 1680, cost: 12.3 },
25
+ { name: 'Birch 4 Mini', responses: 960, cost: 1.92 },
26
+ { name: 'Cedar Pro', responses: 620, cost: 4.65 },
27
+ { name: 'Cedar Lite', responses: 410, cost: 0.41 },
28
+ { name: 'Delta 2', responses: 280, cost: 0.84 },
29
+ { name: 'Delta 1', responses: 170, cost: 0.17 },
30
+ { name: 'Elm', responses: 90, cost: 0.004 },
31
+ { name: 'Fern', responses: 60, cost: 0 },
32
+ ];
33
+ // Largest first: the table is sorted by its main number.
34
+ var rows = __spreadArray([], models, true).sort(function (a, b) { return b.responses - a.responses; });
35
+ var total = rows.reduce(function (sum, m) { return sum + m.responses; }, 0);
36
+ var totalCost = rows.reduce(function (sum, m) { return sum + m.cost; }, 0);
37
+ export default function BreakdownListTable() {
38
+ return (<Center width="page">
39
+ <Stack gap="large">
40
+ <Stack gap="small">
41
+ <Heading level={2} size="h6">Responses and cost by model</Heading>
42
+ <Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this month, largest first.</Paragraph>
43
+ </Stack>
44
+ {/* A named table sits in a region that scrolls sideways by itself, so the page never does. */}
45
+ <TableContainer aria-label="Responses and cost by model" minWidth="520px">
46
+ <TableHeader>
47
+ <TableRow>
48
+ <TableHeaderCell>Model</TableHeaderCell>
49
+ <TableHeaderCell align="right" width="120px" sort="descending">Responses</TableHeaderCell>
50
+ <TableHeaderCell align="right" width="90px">Share</TableHeaderCell>
51
+ <TableHeaderCell align="right" width="110px">Cost</TableHeaderCell>
52
+ </TableRow>
53
+ </TableHeader>
54
+ {rows.map(function (m) { return (<TableRow key={m.name}>
55
+ <TableCell>{m.name}</TableCell>
56
+ <TableCell align="right" width="120px">{formatCount(m.responses)}</TableCell>
57
+ <TableCell align="right" width="90px">{formatPercent(m.responses / total)}</TableCell>
58
+ <TableCell align="right" width="110px">{formatMoney(m.cost)}</TableCell>
59
+ </TableRow>); })}
60
+ <TableRow>
61
+ <TableCell>Total</TableCell>
62
+ <TableCell align="right" width="120px">{formatCount(total)}</TableCell>
63
+ <TableCell align="right" width="90px">{formatPercent(1)}</TableCell>
64
+ <TableCell align="right" width="110px">{formatMoney(totalCost)}</TableCell>
65
+ </TableRow>
66
+ </TableContainer>
67
+ </Stack>
68
+ </Center>);
69
+ }
@@ -0,0 +1,158 @@
1
+ # Breakdown of a total
2
+
3
+ A page shows how a total splits into parts, such as responses by model or comments by project.
4
+
5
+ ## Do
6
+
7
+ - Follow the rule 'A number shows its unit and never shows 0 for unknown'.
8
+ - Say the total and its range above the list: '1,240 responses this week.'
9
+ - Sort by the main number, largest first, in both options.
10
+ - Use one `Progress kind="share"` for each part in the bars, with `max` the total and `unit` the thing counted: '41%, 512 responses'. Put them in a `List`.
11
+ - Show the largest seven parts and fold the rest into 'Other', so the list is never longer than eight rows.
12
+ - Give the table's `TableContainer` an `aria-label` and a `minWidth`, mark the sorted column with `sort`, and right-align the numbers.
13
+ - Show the exact number in a table, a share column from `formatPercent` and a cost from `formatMoney`. A cost under a cent reads '< $0.01'.
14
+ - End the table with a Total row.
15
+
16
+ ## Don't
17
+
18
+ - Do not use a donut or a stacked bar. Color carries nothing here, so no legend is needed.
19
+ - Do not give each part its own color.
20
+ - Do not show a part with no name, or a share with no count.
21
+ - Do not list more than eight bars. Use the table.
22
+ - Do not show a share of 0 for a part that has data. A small share reads '< 1%'.
23
+
24
+ ## Option: Ranked bars
25
+
26
+ Use when: There are up to about eight parts of one total, and the person reads them in order.
27
+
28
+ Uses: `Center`, `Heading`, `List`, `Paragraph`, `Progress`, `Stack`, `formatCount`
29
+
30
+ ```tsx
31
+ 'use client';
32
+ import Heading from 'oneslash-design-system/components/heading';
33
+ import Paragraph from 'oneslash-design-system/components/paragraph';
34
+ import Progress from 'oneslash-design-system/components/progress';
35
+ import List from 'oneslash-design-system/components/list';
36
+ import { formatCount } from 'oneslash-design-system/components/formatNumber';
37
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
38
+
39
+ // A real app counts these on the server.
40
+ const models = [
41
+ { name: 'Atlas Large', count: 512 },
42
+ { name: 'Atlas Medium', count: 301 },
43
+ { name: 'Birch 4', count: 168 },
44
+ { name: 'Birch 4 Mini', count: 96 },
45
+ { name: 'Cedar Pro', count: 62 },
46
+ { name: 'Cedar Lite', count: 41 },
47
+ { name: 'Delta 2', count: 28 },
48
+ { name: 'Delta 1', count: 17 },
49
+ { name: 'Elm', count: 9 },
50
+ { name: 'Fern', count: 6 },
51
+ ];
52
+
53
+ // The largest seven are listed and the rest fold into 'Other', so the list is never longer than eight rows.
54
+ const sorted = [...models].sort((a, b) => b.count - a.count);
55
+ const total = sorted.reduce((sum, m) => sum + m.count, 0);
56
+ const rest = sorted.slice(7).reduce((sum, m) => sum + m.count, 0);
57
+ const parts = [...sorted.slice(0, 7), ...(rest > 0 ? [{ name: 'Other', count: rest }] : [])];
58
+
59
+ export default function BreakdownListBars() {
60
+ return (
61
+ <Center width="page">
62
+ <Stack gap="large">
63
+ <Stack gap="small">
64
+ <Heading level={2} size="h6">Responses by model</Heading>
65
+ <Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this week.</Paragraph>
66
+ </Stack>
67
+ <List
68
+ size="body2"
69
+ items={parts.map((p) => (
70
+ // `max` is the total, so each bar is the part's share. A share is not a limit, so it never turns to a warning.
71
+ <Progress key={p.name} kind="share" label={p.name} value={p.count} max={total} unit="responses" />
72
+ ))}
73
+ />
74
+ </Stack>
75
+ </Center>
76
+ );
77
+ }
78
+ ```
79
+
80
+ ## Option: Table with a share column
81
+
82
+ Use when: There are more parts, or the parts are compared on two numbers, such as responses and cost.
83
+
84
+ Uses: `Center`, `Heading`, `Paragraph`, `Stack`, `TableCell`, `TableContainer`, `TableHeader`, `TableHeaderCell`, `TableRow`, `formatCount`, `formatMoney`, `formatPercent`
85
+
86
+ ```tsx
87
+ 'use client';
88
+ import Heading from 'oneslash-design-system/components/heading';
89
+ import Paragraph from 'oneslash-design-system/components/paragraph';
90
+ import TableContainer from 'oneslash-design-system/components/tableContainer';
91
+ import TableHeader from 'oneslash-design-system/components/tableHeader';
92
+ import TableHeaderCell from 'oneslash-design-system/components/tableHeaderCell';
93
+ import TableRow from 'oneslash-design-system/components/tableRow';
94
+ import TableCell from 'oneslash-design-system/components/tableCell';
95
+ import { formatCount, formatMoney, formatPercent } from 'oneslash-design-system/components/formatNumber';
96
+ import { Center, Stack } from 'oneslash-design-system/components/layout';
97
+
98
+ // A real app counts these on the server.
99
+ const models = [
100
+ { name: 'Atlas Large', responses: 5120, cost: 61.4 },
101
+ { name: 'Atlas Medium', responses: 3010, cost: 18.06 },
102
+ { name: 'Birch 4', responses: 1680, cost: 12.3 },
103
+ { name: 'Birch 4 Mini', responses: 960, cost: 1.92 },
104
+ { name: 'Cedar Pro', responses: 620, cost: 4.65 },
105
+ { name: 'Cedar Lite', responses: 410, cost: 0.41 },
106
+ { name: 'Delta 2', responses: 280, cost: 0.84 },
107
+ { name: 'Delta 1', responses: 170, cost: 0.17 },
108
+ { name: 'Elm', responses: 90, cost: 0.004 },
109
+ { name: 'Fern', responses: 60, cost: 0 },
110
+ ];
111
+
112
+ // Largest first: the table is sorted by its main number.
113
+ const rows = [...models].sort((a, b) => b.responses - a.responses);
114
+ const total = rows.reduce((sum, m) => sum + m.responses, 0);
115
+ const totalCost = rows.reduce((sum, m) => sum + m.cost, 0);
116
+
117
+ export default function BreakdownListTable() {
118
+ return (
119
+ <Center width="page">
120
+ <Stack gap="large">
121
+ <Stack gap="small">
122
+ <Heading level={2} size="h6">Responses and cost by model</Heading>
123
+ <Paragraph tone="secondary" size="body2" measure="none">{formatCount(total)} responses this month, largest first.</Paragraph>
124
+ </Stack>
125
+ {/* A named table sits in a region that scrolls sideways by itself, so the page never does. */}
126
+ <TableContainer aria-label="Responses and cost by model" minWidth="520px">
127
+ <TableHeader>
128
+ <TableRow>
129
+ <TableHeaderCell>Model</TableHeaderCell>
130
+ <TableHeaderCell align="right" width="120px" sort="descending">Responses</TableHeaderCell>
131
+ <TableHeaderCell align="right" width="90px">Share</TableHeaderCell>
132
+ <TableHeaderCell align="right" width="110px">Cost</TableHeaderCell>
133
+ </TableRow>
134
+ </TableHeader>
135
+ {rows.map((m) => (
136
+ <TableRow key={m.name}>
137
+ <TableCell>{m.name}</TableCell>
138
+ <TableCell align="right" width="120px">{formatCount(m.responses)}</TableCell>
139
+ <TableCell align="right" width="90px">{formatPercent(m.responses / total)}</TableCell>
140
+ <TableCell align="right" width="110px">{formatMoney(m.cost)}</TableCell>
141
+ </TableRow>
142
+ ))}
143
+ <TableRow>
144
+ <TableCell>Total</TableCell>
145
+ <TableCell align="right" width="120px">{formatCount(total)}</TableCell>
146
+ <TableCell align="right" width="90px">{formatPercent(1)}</TableCell>
147
+ <TableCell align="right" width="110px">{formatMoney(totalCost)}</TableCell>
148
+ </TableRow>
149
+ </TableContainer>
150
+ </Stack>
151
+ </Center>
152
+ );
153
+ }
154
+ ```
155
+
156
+ ## Native
157
+
158
+ On Apple use a `List` of rows with a `Gauge` or a `ProgressView(value:total:)`, or a `Table` for the table. On Android use a `LazyColumn` of rows with a `LinearProgressIndicator`.
@@ -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 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;