oneslash-design-system 2.28.1 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/DESIGN.md +31 -1
- package/dist/cases/about-page.md +2 -0
- package/dist/cases/accept-invite.md +2 -0
- package/dist/cases/account-menu.md +2 -0
- package/dist/cases/activity-timeline.md +2 -0
- package/dist/cases/admin-inbox.md +2 -0
- package/dist/cases/agent-asks-before-risky-action.md +3 -1
- package/dist/cases/agent-cancels-when-unanswered.md +2 -0
- package/dist/cases/agent-changes-review/all-at-once.d.ts +1 -0
- package/dist/cases/agent-changes-review/all-at-once.jsx +238 -0
- package/dist/cases/agent-changes-review/per-change.d.ts +1 -0
- package/dist/cases/agent-changes-review/per-change.jsx +203 -0
- package/dist/cases/agent-changes-review.md +585 -0
- package/dist/cases/agent-handoff/to-agent.d.ts +1 -0
- package/dist/cases/agent-handoff/to-agent.jsx +53 -0
- package/dist/cases/agent-handoff/to-person.d.ts +1 -0
- package/dist/cases/agent-handoff/to-person.jsx +84 -0
- package/dist/cases/agent-handoff.md +231 -0
- package/dist/cases/agent-memory/list.d.ts +1 -0
- package/dist/cases/agent-memory/list.jsx +256 -0
- package/dist/cases/agent-memory.md +354 -0
- package/dist/cases/agent-options.md +2 -0
- package/dist/cases/agent-pending-reply/steps.jsx +70 -21
- package/dist/cases/agent-pending-reply.md +74 -27
- package/dist/cases/agent-permissions/levels.d.ts +3 -0
- package/dist/cases/agent-permissions/levels.jsx +49 -0
- package/dist/cases/agent-permissions/per-tool.d.ts +3 -0
- package/dist/cases/agent-permissions/per-tool.jsx +178 -0
- package/dist/cases/agent-permissions.md +314 -0
- package/dist/cases/agent-plan-proposal/changes.jsx +18 -11
- package/dist/cases/agent-plan-proposal/steps.jsx +11 -4
- package/dist/cases/agent-plan-proposal.md +36 -21
- package/dist/cases/agent-question.md +2 -0
- package/dist/cases/agent-refuses-clearly.md +2 -0
- package/dist/cases/agent-run-failure/limit-reached.d.ts +1 -0
- package/dist/cases/agent-run-failure/limit-reached.jsx +172 -0
- package/dist/cases/agent-run-failure/step-failed.d.ts +3 -0
- package/dist/cases/agent-run-failure/step-failed.jsx +187 -0
- package/dist/cases/agent-run-failure.md +500 -0
- package/dist/cases/agent-says-what-it-is.md +2 -0
- package/dist/cases/agent-says-where-it-stopped.md +27 -0
- package/dist/cases/agent-settings.md +2 -0
- package/dist/cases/agent-shows-progress.md +2 -0
- package/dist/cases/agent-shows-sources.md +2 -0
- package/dist/cases/api-keys.md +2 -0
- package/dist/cases/app-shell.md +2 -0
- package/dist/cases/artifact-card.md +2 -0
- package/dist/cases/ask-page.md +2 -0
- package/dist/cases/auth-gate-loading.md +2 -0
- package/dist/cases/billing-page.md +2 -0
- package/dist/cases/blog-index.md +2 -0
- package/dist/cases/breadcrumb.md +2 -0
- package/dist/cases/breakdown-list.md +2 -0
- package/dist/cases/bulk-actions/list.d.ts +1 -0
- package/dist/cases/bulk-actions/list.jsx +209 -0
- package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
- package/dist/cases/bulk-actions/paged-table.jsx +246 -0
- package/dist/cases/bulk-actions.md +559 -0
- package/dist/cases/changelog.md +2 -0
- package/dist/cases/chart.md +2 -0
- package/dist/cases/check-your-email.md +2 -0
- package/dist/cases/code-sample.md +2 -0
- package/dist/cases/collapsible-search.md +2 -0
- package/dist/cases/comment-thread.md +2 -0
- package/dist/cases/comparison-page/table.d.ts +1 -0
- package/dist/cases/comparison-page/table.jsx +97 -0
- package/dist/cases/comparison-page.md +156 -0
- package/dist/cases/composer-limit.md +2 -0
- package/dist/cases/confirm-destructive-action.md +2 -0
- package/dist/cases/confirm-dialogs.md +2 -0
- package/dist/cases/connection-status/card.d.ts +1 -0
- package/dist/cases/connection-status/card.jsx +97 -0
- package/dist/cases/connection-status/row.d.ts +1 -0
- package/dist/cases/connection-status/row.jsx +120 -0
- package/dist/cases/connection-status.md +330 -0
- package/dist/cases/contact-page.md +2 -0
- package/dist/cases/conversation-starters.md +2 -0
- package/dist/cases/cookie-choice.md +2 -0
- package/dist/cases/create-modal.md +2 -0
- package/dist/cases/danger-zone.md +2 -0
- package/dist/cases/dashboard.md +2 -0
- package/dist/cases/data-table-page.md +2 -0
- package/dist/cases/date-field.md +2 -0
- package/dist/cases/device-login.md +2 -0
- package/dist/cases/docs-component-page.md +2 -0
- package/dist/cases/email-confirmed.md +2 -0
- package/dist/cases/empty-list.md +2 -0
- package/dist/cases/empty-lists.md +2 -0
- package/dist/cases/empty-not-set-up.md +2 -0
- package/dist/cases/empty-search.md +2 -0
- package/dist/cases/error-page.md +2 -0
- package/dist/cases/faq.md +2 -0
- package/dist/cases/feature-grid.md +2 -0
- package/dist/cases/feedback-form.md +2 -0
- package/dist/cases/file-upload.md +2 -0
- package/dist/cases/filter-menu.md +2 -0
- package/dist/cases/forgot-password.md +2 -0
- package/dist/cases/form-errors.md +2 -0
- package/dist/cases/image-viewer.md +2 -0
- package/dist/cases/import-checklist.md +2 -0
- package/dist/cases/inline-form-feedback.md +2 -0
- package/dist/cases/integrations-list/nested.jsx +1 -1
- package/dist/cases/integrations-list/rows.jsx +1 -1
- package/dist/cases/integrations-list.md +6 -4
- package/dist/cases/invite-member.md +2 -0
- package/dist/cases/invoice-list.md +2 -0
- package/dist/cases/landing-hero.md +2 -0
- package/dist/cases/leaderboard.md +2 -0
- package/dist/cases/legal-page.md +2 -0
- package/dist/cases/load-failure.md +2 -0
- package/dist/cases/log-out-confirm.md +2 -0
- package/dist/cases/login-page.md +2 -0
- package/dist/cases/long-form-page.md +2 -0
- package/dist/cases/master-detail.md +2 -0
- package/dist/cases/members-list.md +2 -0
- package/dist/cases/mention-list.md +2 -0
- package/dist/cases/message-actions.md +2 -0
- package/dist/cases/message-attachments.md +2 -0
- package/dist/cases/message-composer/with-tools.jsx +17 -7
- package/dist/cases/message-composer.md +28 -11
- package/dist/cases/message-edit.md +2 -0
- package/dist/cases/message-reactions.md +2 -0
- package/dist/cases/message-row.md +2 -0
- package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
- package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
- package/dist/cases/message-send-failure/retrying.d.ts +1 -0
- package/dist/cases/message-send-failure/retrying.jsx +116 -0
- package/dist/cases/message-send-failure.md +308 -0
- package/dist/cases/mobile-menu.md +2 -0
- package/dist/cases/newsletter-signup.md +2 -0
- package/dist/cases/no-access/page.d.ts +1 -0
- package/dist/cases/no-access/page.jsx +37 -0
- package/dist/cases/no-access/read-only.d.ts +1 -0
- package/dist/cases/no-access/read-only.jsx +33 -0
- package/dist/cases/no-access.md +147 -0
- package/dist/cases/not-found-page.md +2 -0
- package/dist/cases/notification-menu.md +2 -0
- package/dist/cases/number-format.md +2 -0
- package/dist/cases/oauth-consent.md +2 -0
- package/dist/cases/on-off-settings.md +2 -0
- package/dist/cases/on-this-page.md +2 -0
- package/dist/cases/onboarding.md +2 -0
- package/dist/cases/one-main-action.md +2 -0
- package/dist/cases/overflow-menu.md +2 -0
- package/dist/cases/page-end.md +2 -0
- package/dist/cases/page-header.md +2 -0
- package/dist/cases/paged-card.md +2 -0
- package/dist/cases/password-gate.md +2 -0
- package/dist/cases/payment-method.md +2 -0
- package/dist/cases/people-row.md +2 -0
- package/dist/cases/phone-navigation.md +2 -0
- package/dist/cases/plan-change-confirm.md +2 -0
- package/dist/cases/plan-comparison.md +3 -1
- package/dist/cases/plan-picker.md +4 -1
- package/dist/cases/plan-sign-off.md +2 -0
- package/dist/cases/pricing-section.md +5 -1
- package/dist/cases/product-cards.md +2 -0
- package/dist/cases/product-demo/scripted.d.ts +3 -0
- package/dist/cases/product-demo/scripted.jsx +95 -0
- package/dist/cases/product-demo/still.d.ts +1 -0
- package/dist/cases/product-demo/still.jsx +20 -0
- package/dist/cases/product-demo.md +221 -0
- package/dist/cases/profile-form.md +2 -0
- package/dist/cases/quick-switcher.md +2 -0
- package/dist/cases/range-switch.md +2 -0
- package/dist/cases/rename.md +2 -0
- package/dist/cases/reply-feedback.md +2 -0
- package/dist/cases/reply-sources.md +2 -0
- package/dist/cases/route-loading.md +2 -0
- package/dist/cases/scope-picker.md +2 -0
- package/dist/cases/section-index.md +2 -0
- package/dist/cases/session-expired/in-place.d.ts +1 -0
- package/dist/cases/session-expired/in-place.jsx +63 -0
- package/dist/cases/session-expired/redirect.d.ts +1 -0
- package/dist/cases/session-expired/redirect.jsx +62 -0
- package/dist/cases/session-expired.md +204 -0
- package/dist/cases/set-new-password.md +2 -0
- package/dist/cases/settings-page.md +2 -0
- package/dist/cases/settings-save.md +2 -0
- package/dist/cases/side-pane.md +2 -0
- package/dist/cases/sidebar-nav.md +2 -0
- package/dist/cases/sign-up-page.md +3 -0
- package/dist/cases/signup-from-site/plain.d.ts +1 -0
- package/dist/cases/signup-from-site/plain.jsx +125 -0
- package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
- package/dist/cases/signup-from-site/with-plan.jsx +151 -0
- package/dist/cases/signup-from-site.md +351 -0
- package/dist/cases/site-footer.md +2 -0
- package/dist/cases/site-header/links.d.ts +3 -1
- package/dist/cases/site-header/links.jsx +6 -2
- package/dist/cases/site-header.md +11 -3
- package/dist/cases/site-matches-app.md +32 -0
- package/dist/cases/site-search.md +2 -0
- package/dist/cases/slash-command-list.md +2 -0
- package/dist/cases/stat-row.md +2 -0
- package/dist/cases/status-label.md +3 -1
- package/dist/cases/success-feedback.md +2 -0
- package/dist/cases/tabbed-panels.md +2 -0
- package/dist/cases/tag-filter.md +2 -0
- package/dist/cases/task-header.md +2 -0
- package/dist/cases/theme-switcher.md +2 -0
- package/dist/cases/type-to-confirm.md +2 -0
- package/dist/cases/typing-and-status.md +2 -0
- package/dist/cases/unsaved-changes-guard.md +2 -0
- package/dist/cases/upgrade-prompt.md +2 -0
- package/dist/cases/usage-meters.md +2 -0
- package/dist/cases.json +1489 -39
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +23 -9
- package/dist/components/diff.d.ts +29 -0
- package/dist/components/diff.jsx +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/diff.d.ts +17 -0
- package/dist/internal/diff.js +44 -0
- package/dist/native-mapping.json +9 -2
- package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
- package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
- package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
- package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
- package/dist/stories/Cases.generated.stories.d.ts +24 -0
- package/dist/stories/Cases.generated.stories.jsx +48 -0
- package/dist/stories/Checkbox.stories.d.ts +2 -0
- package/dist/stories/Checkbox.stories.jsx +18 -0
- package/dist/stories/Diff.stories.d.ts +9 -0
- package/dist/stories/Diff.stories.jsx +40 -0
- package/dist/stories/ProductDemo.probe.stories.d.ts +6 -0
- package/dist/stories/ProductDemo.probe.stories.jsx +12 -0
- package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
- package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
- package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
- package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# Status of a connected source
|
|
2
|
+
|
|
3
|
+
A person connected other tools to the product, and wants to know if each one still works, is busy, or needs them.
|
|
4
|
+
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Build on the case 'Integrations': the same rows, logos and names, with the status under the name.
|
|
10
|
+
- Show the status as the case 'Status in a row' says: a `Tag` with `variant="dot"` and a word. Use 'Connected', 'Syncing', 'Needs reconnect' or 'Not responding'.
|
|
11
|
+
- Keep the grey dot for 'Connected' and 'Syncing'. Color the dot only when a person must act: `warning` for 'Needs reconnect', `error` for 'Not responding'.
|
|
12
|
+
- Put a `TimeStamp` beside the status that says when the source last synced: 'Synced 2 minutes ago'.
|
|
13
|
+
- Say in the line what is wrong and what fixes it: 'Access ran out on Nov 14, 2026. Reconnect to keep files in sync.'
|
|
14
|
+
- Give a source that needs reconnecting a primary 'Reconnect' on its row, named for it: 'Reconnect Figma'. It is `loading` while it runs and keeps its label.
|
|
15
|
+
- Give a source that is not responding a secondary 'Try Again', named for it: 'Try again to reach Notion'.
|
|
16
|
+
- Show a first import as 'Syncing' with a `Progress` that counts: '12 of 40 files'.
|
|
17
|
+
- Show a rate limit as 'Syncing', with a line that says when it goes on: 'GitHub asked Acme to slow down. Syncing again at 2:45 PM.'
|
|
18
|
+
- List only the sources that need a person on a dashboard card, with the same words. Say how many there are in the title.
|
|
19
|
+
- Say so in one line when every source works: 'All 5 sources are working.'
|
|
20
|
+
- Move focus to the row's 'Disconnect' after 'Reconnect' or 'Try Again' works. On the card, the fixed source leaves the list, so focus goes to the next source's Button, or to the card's title when none is left.
|
|
21
|
+
- Say in a toast when a source on the dashboard card works again, since it leaves the list there. Name the source in the toast. On a row, the new status is enough.
|
|
22
|
+
|
|
23
|
+
## Don't
|
|
24
|
+
|
|
25
|
+
- Do not blink or pulse the dot. Motion does not say what is wrong.
|
|
26
|
+
- Do not show a dot with no word, even on a small card.
|
|
27
|
+
- Do not show a rate limit as an error. Nothing is broken and the person cannot fix it.
|
|
28
|
+
- Do not hide the time of the last sync. It tells the person how old the data is.
|
|
29
|
+
- Do not list every source on a dashboard card. Show only the ones that need a person.
|
|
30
|
+
|
|
31
|
+
## Option: Status on each account
|
|
32
|
+
|
|
33
|
+
Use when: On the integrations page, where each connected account has its own row.
|
|
34
|
+
|
|
35
|
+
Uses: `BrandIcon`, `Button`, `Center`, `Cluster`, `Heading`, `Icon`, `Paragraph`, `Progress`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`, `TimeStamp`
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
'use client';
|
|
39
|
+
import { useEffect, useRef, useState } from 'react';
|
|
40
|
+
import { Figma, FileText, Slack } from 'lucide-react';
|
|
41
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
42
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
43
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
44
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
45
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
46
|
+
import BrandIcon from 'oneslash-design-system/components/brandIcon';
|
|
47
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
48
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
49
|
+
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
50
|
+
import Progress from 'oneslash-design-system/components/progress';
|
|
51
|
+
import Button from 'oneslash-design-system/components/button';
|
|
52
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
53
|
+
|
|
54
|
+
type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
|
|
55
|
+
type Status = 'Connected' | 'Syncing' | 'Needs reconnect' | 'Not responding';
|
|
56
|
+
|
|
57
|
+
type Source = {
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
status: Status;
|
|
61
|
+
/** Minutes since the last sync. Unset before the first import ends. */
|
|
62
|
+
syncedMinutesAgo?: number;
|
|
63
|
+
/** What is wrong or what is going on, and what fixes it. */
|
|
64
|
+
line?: string;
|
|
65
|
+
/** A first import: how many files have arrived, of how many. */
|
|
66
|
+
imported?: { done: number; total: number };
|
|
67
|
+
brand?: 'google' | 'github';
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// A real app reads these from the server.
|
|
71
|
+
const firstSources: Source[] = [
|
|
72
|
+
{ id: 'slack', name: 'Slack', status: 'Connected', syncedMinutesAgo: 2 },
|
|
73
|
+
{ id: 'github', name: 'GitHub', status: 'Syncing', syncedMinutesAgo: 12, line: 'GitHub asked Acme to slow down. Syncing again at 2:45 PM.', brand: 'github' },
|
|
74
|
+
{ id: 'drive', name: 'Google Drive', status: 'Syncing', line: 'First import. Files show up as they arrive.', imported: { done: 12, total: 40 }, brand: 'google' },
|
|
75
|
+
{ id: 'figma', name: 'Figma', status: 'Needs reconnect', syncedMinutesAgo: 2 * 24 * 60, line: 'Access ran out on Nov 14, 2026. Reconnect to keep files in sync.' },
|
|
76
|
+
{ id: 'notion', name: 'Notion', status: 'Not responding', syncedMinutesAgo: 35, line: 'Notion has not answered since 2:10 PM. Acme tries again every 10 minutes.' },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
// The case 'Status in a row': a grey dot for a usual state, a color only when a person must act.
|
|
80
|
+
const dotColor: Record<Status, 'default' | 'warning' | 'error'> = {
|
|
81
|
+
Connected: 'default',
|
|
82
|
+
Syncing: 'default',
|
|
83
|
+
'Needs reconnect': 'warning',
|
|
84
|
+
'Not responding': 'error',
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function renderLogo(s: Source) {
|
|
88
|
+
if (s.brand) return <BrandIcon name={s.brand} size={24} />;
|
|
89
|
+
return <Icon icon={s.id === 'slack' ? Slack : s.id === 'figma' ? Figma : FileText} size="medium" color="secondary" />;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default function ConnectionStatusRow() {
|
|
93
|
+
const [sources, setSources] = useState(firstSources);
|
|
94
|
+
const [working, setWorking] = useState<string | null>(null);
|
|
95
|
+
// The minutes above count back from when the page opened.
|
|
96
|
+
const [openedAt] = useState(() => Date.now());
|
|
97
|
+
const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
|
|
98
|
+
// Each row's Disconnect by source id, so focus can move there when Reconnect or Try Again goes away.
|
|
99
|
+
const disconnectButtons = useRef<Record<string, Focusable>>({});
|
|
100
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
101
|
+
const focusNext = useRef<() => void>();
|
|
102
|
+
|
|
103
|
+
// On unmount it stops every request.
|
|
104
|
+
useEffect(() => () => {
|
|
105
|
+
timers.current.forEach(clearTimeout);
|
|
106
|
+
}, []);
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const move = focusNext.current;
|
|
110
|
+
focusNext.current = undefined;
|
|
111
|
+
move?.();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// 'Reconnect' stands in for the provider's sign-in; 'Try Again' asks the source at once. Both work here.
|
|
115
|
+
function fix(s: Source) {
|
|
116
|
+
if (working) return;
|
|
117
|
+
setWorking(s.id);
|
|
118
|
+
timers.current.push(setTimeout(() => {
|
|
119
|
+
setWorking(null);
|
|
120
|
+
setSources((list) => list.map((x) => (x.id === s.id ? { ...x, status: 'Connected', syncedMinutesAgo: 0, line: undefined } : x)));
|
|
121
|
+
// The row's new status says it works again, so no toast. The Button that had focus is gone,
|
|
122
|
+
// so focus goes to the row's Disconnect.
|
|
123
|
+
focusNext.current = () => disconnectButtons.current[s.id]?.focus();
|
|
124
|
+
}, 1200));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<Center width="page">
|
|
129
|
+
<Stack gap="large">
|
|
130
|
+
<Stack gap="small">
|
|
131
|
+
<Heading level={1} size="h5">Integrations</Heading>
|
|
132
|
+
<Paragraph tone="secondary" size="body2" measure="none">Connect the tools your team already uses.</Paragraph>
|
|
133
|
+
</Stack>
|
|
134
|
+
{/* A named table scrolls inside its own region on a phone, never the page. */}
|
|
135
|
+
<TableContainer aria-label="Connected sources" minWidth="640px">
|
|
136
|
+
{sources.map((s) => {
|
|
137
|
+
const busy = working === s.id;
|
|
138
|
+
const minutes = s.syncedMinutesAgo;
|
|
139
|
+
return (
|
|
140
|
+
<TableRow key={s.id}>
|
|
141
|
+
<TableCell width="56px">{renderLogo(s)}</TableCell>
|
|
142
|
+
<TableCell>
|
|
143
|
+
<Stack gap="small">
|
|
144
|
+
<Heading level={2} size="subtitle1">{s.name}</Heading>
|
|
145
|
+
<Cluster gap="small">
|
|
146
|
+
<Tag variant="dot" size="small" color={dotColor[s.status]} label={s.status} />
|
|
147
|
+
{minutes !== undefined && (
|
|
148
|
+
<Cluster gap="small">
|
|
149
|
+
<Paragraph size="caption" tone="secondary" measure="none">Synced</Paragraph>
|
|
150
|
+
<TimeStamp createdAt={openedAt - minutes * 60 * 1000} dateFormat="relative" data={minutes < 24 * 60 ? 'time' : 'date'} />
|
|
151
|
+
</Cluster>
|
|
152
|
+
)}
|
|
153
|
+
</Cluster>
|
|
154
|
+
{s.line && <Paragraph tone="secondary" size="body2" measure="none">{s.line}</Paragraph>}
|
|
155
|
+
{s.imported && (
|
|
156
|
+
<Progress label="Importing files" kind="share" size="small" value={s.imported.done} max={s.imported.total} valueText={`${s.imported.done} of ${s.imported.total} files`} />
|
|
157
|
+
)}
|
|
158
|
+
</Stack>
|
|
159
|
+
</TableCell>
|
|
160
|
+
{/* A fixed last column keeps every row's Buttons in one place. */}
|
|
161
|
+
<TableCell width="220px">
|
|
162
|
+
<Cluster gap="small" justify="end">
|
|
163
|
+
{s.status === 'Needs reconnect' && (
|
|
164
|
+
<Button size="small" type="primary" state={working && !busy ? 'disabled' : 'enabled'} label="Reconnect" aria-label={`Reconnect ${s.name}`} loading={busy} onClickButton={() => fix(s)} />
|
|
165
|
+
)}
|
|
166
|
+
{s.status === 'Not responding' && (
|
|
167
|
+
<Button size="small" type="secondary" state={working && !busy ? 'disabled' : 'enabled'} label="Try Again" aria-label={`Try again to reach ${s.name}`} loading={busy} onClickButton={() => fix(s)} />
|
|
168
|
+
)}
|
|
169
|
+
{/* The case 'Integrations' confirms Disconnect in a small Modal. */}
|
|
170
|
+
<Button
|
|
171
|
+
ref={(el: Focusable) => { disconnectButtons.current[s.id] = el; }}
|
|
172
|
+
size="small"
|
|
173
|
+
type="tertiary"
|
|
174
|
+
state={working ? 'disabled' : 'enabled'}
|
|
175
|
+
label="Disconnect"
|
|
176
|
+
aria-label={`Disconnect ${s.name}`}
|
|
177
|
+
onClickButton={() => console.info(`Ask to disconnect ${s.name}`)}
|
|
178
|
+
/>
|
|
179
|
+
</Cluster>
|
|
180
|
+
</TableCell>
|
|
181
|
+
</TableRow>
|
|
182
|
+
);
|
|
183
|
+
})}
|
|
184
|
+
</TableContainer>
|
|
185
|
+
</Stack>
|
|
186
|
+
</Center>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Option: Sources that need a person
|
|
192
|
+
|
|
193
|
+
Use when: On a dashboard, when a broken source explains why some data is missing.
|
|
194
|
+
|
|
195
|
+
Uses: `Button`, `Center`, `Cluster`, `Heading`, `Icon`, `Line`, `Link`, `Paragraph`, `Stack`, `Tag`, `TimeStamp`, `Toaster`, `dismissToast`, `toast`
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
'use client';
|
|
199
|
+
import { useEffect, useRef, useState } from 'react';
|
|
200
|
+
import { Figma, FileText } from 'lucide-react';
|
|
201
|
+
import Toaster, { toast, dismissToast } from 'oneslash-design-system/components/toaster';
|
|
202
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
203
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
204
|
+
import Link from 'oneslash-design-system/components/link';
|
|
205
|
+
import Line from 'oneslash-design-system/components/line';
|
|
206
|
+
import Icon from 'oneslash-design-system/components/icon';
|
|
207
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
208
|
+
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
209
|
+
import Button from 'oneslash-design-system/components/button';
|
|
210
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
211
|
+
|
|
212
|
+
type Focusable = HTMLButtonElement | HTMLAnchorElement | null;
|
|
213
|
+
|
|
214
|
+
type Source = {
|
|
215
|
+
id: string;
|
|
216
|
+
name: string;
|
|
217
|
+
status: 'Needs reconnect' | 'Not responding';
|
|
218
|
+
syncedMinutesAgo: number;
|
|
219
|
+
line: string;
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// A real app reads these from the server: only the sources that need a person. The other 3 work.
|
|
223
|
+
const total = 5;
|
|
224
|
+
const firstSources: Source[] = [
|
|
225
|
+
{ id: 'figma', name: 'Figma', status: 'Needs reconnect', syncedMinutesAgo: 2 * 24 * 60, line: 'Access ran out. Design comments since Nov 14, 2026 are missing.' },
|
|
226
|
+
{ id: 'notion', name: 'Notion', status: 'Not responding', syncedMinutesAgo: 35, line: 'Notion has not answered since 2:10 PM. Docs may be out of date.' },
|
|
227
|
+
];
|
|
228
|
+
|
|
229
|
+
export default function ConnectionStatusCard() {
|
|
230
|
+
const [sources, setSources] = useState(firstSources);
|
|
231
|
+
const [working, setWorking] = useState<string | null>(null);
|
|
232
|
+
// The minutes above count back from when the page opened.
|
|
233
|
+
const [openedAt] = useState(() => Date.now());
|
|
234
|
+
const timers = useRef<ReturnType<typeof setTimeout>[]>([]);
|
|
235
|
+
const toastIds = useRef<string[]>([]);
|
|
236
|
+
const title = useRef<HTMLHeadingElement>(null);
|
|
237
|
+
// Each source's Button by id, so focus can move to the next one when a fixed source leaves the card.
|
|
238
|
+
const buttons = useRef<Record<string, Focusable>>({});
|
|
239
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
240
|
+
const focusNext = useRef<() => void>();
|
|
241
|
+
|
|
242
|
+
// On unmount it stops every request and closes every toast it opened.
|
|
243
|
+
useEffect(() => () => {
|
|
244
|
+
timers.current.forEach(clearTimeout);
|
|
245
|
+
toastIds.current.forEach((id) => dismissToast(id));
|
|
246
|
+
toastIds.current = [];
|
|
247
|
+
}, []);
|
|
248
|
+
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
const move = focusNext.current;
|
|
251
|
+
focusNext.current = undefined;
|
|
252
|
+
move?.();
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// 'Reconnect' stands in for the provider's sign-in; 'Try Again' asks the source at once. Both work here.
|
|
256
|
+
function fix(s: Source) {
|
|
257
|
+
if (working) return;
|
|
258
|
+
setWorking(s.id);
|
|
259
|
+
timers.current.push(setTimeout(() => {
|
|
260
|
+
setWorking(null);
|
|
261
|
+
const at = sources.findIndex((x) => x.id === s.id);
|
|
262
|
+
const rest = sources.filter((x) => x.id !== s.id);
|
|
263
|
+
setSources(rest);
|
|
264
|
+
toastIds.current.push(toast({ type: 'success', message: `${s.name} is connected and syncing again.` }));
|
|
265
|
+
// The fixed source leaves the card: focus goes to the next source, the one before on the last row, or the title.
|
|
266
|
+
const neighbor = rest[at] ?? rest[at - 1];
|
|
267
|
+
focusNext.current = () => (neighbor ? buttons.current[neighbor.id] : title.current)?.focus();
|
|
268
|
+
}, 1200));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
<Center width="page">
|
|
273
|
+
{/* A real app mounts one Toaster near its root. */}
|
|
274
|
+
<Toaster />
|
|
275
|
+
<Stack gap="medium">
|
|
276
|
+
<Line />
|
|
277
|
+
<Heading ref={title} tabIndex={-1} level={2} size="h6">
|
|
278
|
+
{sources.length === 0 ? 'Sources' : `${sources.length} ${sources.length === 1 ? 'source needs' : 'sources need'} you`}
|
|
279
|
+
</Heading>
|
|
280
|
+
{sources.length === 0 ? (
|
|
281
|
+
<Paragraph tone="secondary" size="body2" measure="none">{`All ${total} sources are working.`}</Paragraph>
|
|
282
|
+
) : (
|
|
283
|
+
<Stack gap="large">
|
|
284
|
+
{sources.map((s) => {
|
|
285
|
+
const busy = working === s.id;
|
|
286
|
+
const reconnect = s.status === 'Needs reconnect';
|
|
287
|
+
return (
|
|
288
|
+
<Cluster key={s.id} justify="between" align="start">
|
|
289
|
+
<Stack gap="small">
|
|
290
|
+
<Cluster gap="small">
|
|
291
|
+
<Icon icon={s.id === 'figma' ? Figma : FileText} size="small" color="secondary" />
|
|
292
|
+
<Heading level={3} size="subtitle2">{s.name}</Heading>
|
|
293
|
+
</Cluster>
|
|
294
|
+
<Cluster gap="small">
|
|
295
|
+
<Tag variant="dot" size="small" color={reconnect ? 'warning' : 'error'} label={s.status} />
|
|
296
|
+
<Cluster gap="small">
|
|
297
|
+
<Paragraph size="caption" tone="secondary" measure="none">Synced</Paragraph>
|
|
298
|
+
<TimeStamp createdAt={openedAt - s.syncedMinutesAgo * 60 * 1000} dateFormat="relative" data={s.syncedMinutesAgo < 24 * 60 ? 'time' : 'date'} />
|
|
299
|
+
</Cluster>
|
|
300
|
+
</Cluster>
|
|
301
|
+
<Paragraph tone="secondary" size="body2" measure="none">{s.line}</Paragraph>
|
|
302
|
+
</Stack>
|
|
303
|
+
<Button
|
|
304
|
+
ref={(el: Focusable) => { buttons.current[s.id] = el; }}
|
|
305
|
+
size="small"
|
|
306
|
+
type={reconnect ? 'primary' : 'secondary'}
|
|
307
|
+
state={working && !busy ? 'disabled' : 'enabled'}
|
|
308
|
+
label={reconnect ? 'Reconnect' : 'Try Again'}
|
|
309
|
+
aria-label={reconnect ? `Reconnect ${s.name}` : `Try again to reach ${s.name}`}
|
|
310
|
+
loading={busy}
|
|
311
|
+
onClickButton={() => fix(s)}
|
|
312
|
+
/>
|
|
313
|
+
</Cluster>
|
|
314
|
+
);
|
|
315
|
+
})}
|
|
316
|
+
</Stack>
|
|
317
|
+
)}
|
|
318
|
+
{/* A real app links to its integrations page. Link has no click handler to keep the example here, so it uses '#'. */}
|
|
319
|
+
<Cluster>
|
|
320
|
+
<Link href="#" size="body2">See All Sources</Link>
|
|
321
|
+
</Cluster>
|
|
322
|
+
</Stack>
|
|
323
|
+
</Center>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Native
|
|
329
|
+
|
|
330
|
+
On Apple show the status as a `Label` with a small circle and the word under the account's name, with 'Reconnect' as a Button in the row. On Android use a leading dot and the word in a `Text`, and a `LinearProgressIndicator` with the count for a first import.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A thread has no messages yet, and the person may not know what to write first.
|
|
4
4
|
|
|
5
|
+
For: an app, an agent
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Show the empty thread as the rule 'An empty list says what will fill it' says. Use `EmptyBox` with `size="large"`, the `text` 'No messages yet', and a `secondText` that says what to do.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A settings page offers actions that are hard or impossible to undo, such as deleting an account or a workspace, or leaving one.
|
|
4
4
|
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Put the actions in a `SettingsSection tone="danger"` titled 'Danger zone', or titled with the action, such as 'Delete workspace'. It is the last section on the page.
|
package/dist/cases/dashboard.md
CHANGED
package/dist/cases/date-field.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A person opens the page of one part of a design system or a code library to see what it looks like, how to write it and what it takes.
|
|
4
4
|
|
|
5
|
+
For: a marketing site
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Use `PageHeader` with `level={1}`: the part's name is the one level 1 heading, with a `lede` of one sentence that says what it is for.
|
package/dist/cases/empty-list.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A list, table or pane has nothing to show.
|
|
4
4
|
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
5
7
|
## Answer
|
|
6
8
|
|
|
7
9
|
Use `EmptyBox`, never a bare line of text. Its `size` is `large` when the list fills the whole region and `small` inside a section. The `text` says what is empty, in the person's words and in sentence case: 'No saved comments'. The `secondText` says what will appear here or what to do. When the person can fix it, pass the Button as `action`. The action Button is primary when it fills the list or tries again, and secondary when it is 'Clear Search'. An empty search shows the words searched for and a 'Clear Search' Button. A failed load is not an empty list: say that loading failed and offer a 'Try Again' Button. `EmptyBox` may hold that message, with 'Try Again' as its `action`, but never the empty text.
|
package/dist/cases/error-page.md
CHANGED
package/dist/cases/faq.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A marketing page answers the questions a visitor asks before signing up.
|
|
4
4
|
|
|
5
|
+
For: a marketing site
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Put the section's name in `SectionIntro`, so the section has a level 2 heading. Write each question as the visitor would ask it, in sentence case, ending in a question mark.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A marketing page lists what the product does, so a visitor can see if it fits.
|
|
4
4
|
|
|
5
|
+
For: a marketing site
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Follow the rule 'A marketing page asks for one main action, in the same words everywhere'. A feature section does not add its own action. The page's one Button stays in the header, the hero and the end.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A person adds a file from their device, such as a new profile picture or the receipts for a report.
|
|
4
4
|
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Use `DropZone`. A person can drop a file on it or choose one with its Button, so it works with a keyboard, a screen reader and touch.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A form was submitted and something is wrong.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Answer
|
|
6
8
|
|
|
7
9
|
A problem with one field shows under that field, through the field's `error` and `errorText`. A problem with the whole request shows above the fields in `<Alert type="error" variant="inline" showCloseButton>`, so it stays until the person closes it or submits again. Its `onClose` clears the message; if it does not, the Alert comes back. While the request runs, the submit Button is `loading` and keeps its label. The form keeps what the person typed. The next submit clears the old messages. Messages are in sentence case. It is never a colored caption written by hand, and never the browser's `alert()`.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A page shows images small, and a person wants to see one larger without leaving the page.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Show each image as a `LightboxThumbnail` and keep the open state and the index of the shown image in your page. For `gallery`, put the thumbnails in a `Grid compact`, two across on a phone.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A person submits a small form, such as a settings field, and the request ends. The three options are the three outcomes of one save: it worked in place, it failed, or the result is elsewhere.
|
|
4
4
|
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Show `loading` on the submit Button while the request runs, and keep its label.
|
|
@@ -137,7 +137,7 @@ export default function IntegrationsListNested() {
|
|
|
137
137
|
<Stack gap="small">
|
|
138
138
|
<Cluster gap="small">
|
|
139
139
|
<Heading level={3} size="subtitle1">{a.name}</Heading>
|
|
140
|
-
{a.attention && <Tag variant="
|
|
140
|
+
{a.attention && <Tag variant="dot" size="small" color="warning" label="Needs reconnect"/>}
|
|
141
141
|
</Cluster>
|
|
142
142
|
<Paragraph tone="secondary" size="body2" measure="none">{a.detail}</Paragraph>
|
|
143
143
|
</Stack>
|
|
@@ -103,7 +103,7 @@ export default function IntegrationsListRows() {
|
|
|
103
103
|
<Stack gap="small">
|
|
104
104
|
<Cluster gap="small">
|
|
105
105
|
<Heading level={2} size="subtitle1">{p.name}</Heading>
|
|
106
|
-
{attention && <Tag variant="
|
|
106
|
+
{attention && <Tag variant="dot" size="small" color="warning" label="Needs reconnect"/>}
|
|
107
107
|
</Cluster>
|
|
108
108
|
<Paragraph tone="secondary" size="body2" measure="none">
|
|
109
109
|
{attention ? 'Access ran out. Reconnect to keep it working.' : p.does}
|