oneslash-design-system 2.16.0 → 2.18.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 +2 -2
- package/dist/DESIGN.md +56 -17
- package/dist/cases/accept-invite/signed-in.jsx +1 -1
- package/dist/cases/accept-invite/signed-out.jsx +1 -1
- package/dist/cases/accept-invite.md +3 -7
- package/dist/cases/account-menu/menu.d.ts +1 -0
- package/dist/cases/account-menu/menu.jsx +99 -0
- package/dist/cases/account-menu.md +164 -0
- package/dist/cases/agent-asks-before-risky-action.md +0 -4
- package/dist/cases/agent-cancels-when-unanswered.md +0 -4
- package/dist/cases/agent-options/cards.d.ts +1 -0
- package/dist/cases/agent-options/cards.jsx +91 -0
- package/dist/cases/agent-options.md +164 -0
- package/dist/cases/agent-pending-reply/steps.d.ts +1 -0
- package/dist/cases/agent-pending-reply/steps.jsx +149 -0
- package/dist/cases/agent-pending-reply/streaming.d.ts +1 -0
- package/dist/cases/agent-pending-reply/streaming.jsx +146 -0
- package/dist/cases/agent-pending-reply.md +428 -0
- package/dist/cases/agent-plan-proposal/changes.d.ts +1 -0
- package/dist/cases/agent-plan-proposal/changes.jsx +224 -0
- package/dist/cases/agent-plan-proposal/steps.d.ts +1 -0
- package/dist/cases/agent-plan-proposal/steps.jsx +211 -0
- package/dist/cases/agent-plan-proposal.md +652 -0
- package/dist/cases/agent-question/choices.d.ts +1 -0
- package/dist/cases/agent-question/choices.jsx +132 -0
- package/dist/cases/agent-question/free-text.d.ts +1 -0
- package/dist/cases/agent-question/free-text.jsx +81 -0
- package/dist/cases/agent-question.md +334 -0
- package/dist/cases/agent-refuses-clearly.md +0 -4
- package/dist/cases/agent-says-what-it-is.md +0 -2
- package/dist/cases/agent-settings/form.d.ts +1 -0
- package/dist/cases/agent-settings/form.jsx +164 -0
- package/dist/cases/agent-settings.md +259 -0
- package/dist/cases/agent-shows-progress.md +0 -2
- package/dist/cases/agent-shows-sources.md +2 -4
- package/dist/cases/api-keys/list.d.ts +1 -0
- package/dist/cases/api-keys/list.jsx +162 -0
- package/dist/cases/api-keys.md +229 -0
- package/dist/cases/artifact-card/card.d.ts +1 -0
- package/dist/cases/artifact-card/card.jsx +45 -0
- package/dist/cases/artifact-card.md +99 -0
- package/dist/cases/auth-gate-loading.md +0 -4
- package/dist/cases/check-your-email.md +0 -4
- package/dist/cases/collapsible-search/popover.d.ts +1 -0
- package/dist/cases/collapsible-search/popover.jsx +74 -0
- package/dist/cases/collapsible-search.md +143 -0
- package/dist/cases/composer-limit/notice-with-action.d.ts +1 -0
- package/dist/cases/composer-limit/notice-with-action.jsx +87 -0
- package/dist/cases/composer-limit/notice.d.ts +1 -0
- package/dist/cases/composer-limit/notice.jsx +84 -0
- package/dist/cases/composer-limit.md +282 -0
- package/dist/cases/confirm-destructive-action.md +0 -4
- package/dist/cases/confirm-dialogs.md +0 -4
- package/dist/cases/conversation-starters/chips.d.ts +1 -0
- package/dist/cases/conversation-starters/chips.jsx +69 -0
- package/dist/cases/conversation-starters/none.d.ts +1 -0
- package/dist/cases/conversation-starters/none.jsx +45 -0
- package/dist/cases/conversation-starters.md +204 -0
- package/dist/cases/create-modal.md +0 -4
- package/dist/cases/danger-zone/collapsed.d.ts +1 -0
- package/dist/cases/danger-zone/collapsed.jsx +75 -0
- package/dist/cases/danger-zone/shown.d.ts +1 -0
- package/dist/cases/danger-zone/shown.jsx +95 -0
- package/dist/cases/danger-zone.md +263 -0
- package/dist/cases/device-login.md +0 -4
- package/dist/cases/email-confirmed.md +0 -4
- package/dist/cases/empty-list.md +0 -4
- package/dist/cases/empty-lists.md +0 -4
- package/dist/cases/empty-not-set-up.md +0 -4
- package/dist/cases/empty-search.md +0 -4
- package/dist/cases/error-page.md +0 -4
- package/dist/cases/feedback-form.md +0 -4
- package/dist/cases/filter-menu/presets.d.ts +1 -0
- package/dist/cases/filter-menu/presets.jsx +53 -0
- package/dist/cases/filter-menu/with-clear.d.ts +1 -0
- package/dist/cases/filter-menu/with-clear.jsx +56 -0
- package/dist/cases/filter-menu.md +204 -0
- package/dist/cases/forgot-password.md +0 -4
- package/dist/cases/form-errors.md +0 -4
- package/dist/cases/import-checklist.md +0 -4
- package/dist/cases/inline-form-feedback.md +0 -4
- package/dist/cases/integrations-list/nested.d.ts +1 -0
- package/dist/cases/integrations-list/nested.jsx +164 -0
- package/dist/cases/integrations-list/rows.d.ts +1 -0
- package/dist/cases/integrations-list/rows.jsx +134 -0
- package/dist/cases/integrations-list.md +379 -0
- package/dist/cases/invite-member.md +0 -4
- package/dist/cases/load-failure.md +0 -4
- package/dist/cases/log-out-confirm.md +0 -4
- package/dist/cases/login-page.md +0 -4
- package/dist/cases/members-list/rows.d.ts +1 -0
- package/dist/cases/members-list/rows.jsx +318 -0
- package/dist/cases/members-list/table.d.ts +1 -0
- package/dist/cases/members-list/table.jsx +351 -0
- package/dist/cases/members-list.md +799 -0
- package/dist/cases/mention-list/in-composer.d.ts +1 -0
- package/dist/cases/mention-list/in-composer.jsx +169 -0
- package/dist/cases/mention-list.md +248 -0
- package/dist/cases/message-actions/hover-toolbar.d.ts +1 -0
- package/dist/cases/message-actions/hover-toolbar.jsx +229 -0
- package/dist/cases/message-actions/menu.d.ts +1 -0
- package/dist/cases/message-actions/menu.jsx +258 -0
- package/dist/cases/message-actions.md +647 -0
- package/dist/cases/message-attachments/in-composer.d.ts +1 -0
- package/dist/cases/message-attachments/in-composer.jsx +134 -0
- package/dist/cases/message-attachments/in-message.d.ts +1 -0
- package/dist/cases/message-attachments/in-message.jsx +46 -0
- package/dist/cases/message-attachments.md +306 -0
- package/dist/cases/message-composer/plain.d.ts +1 -0
- package/dist/cases/message-composer/plain.jsx +57 -0
- package/dist/cases/message-composer/with-tools.d.ts +1 -0
- package/dist/cases/message-composer/with-tools.jsx +182 -0
- package/dist/cases/message-composer.md +352 -0
- package/dist/cases/message-edit/in-place.d.ts +1 -0
- package/dist/cases/message-edit/in-place.jsx +99 -0
- package/dist/cases/message-edit.md +175 -0
- package/dist/cases/message-reactions/chips.d.ts +1 -0
- package/dist/cases/message-reactions/chips.jsx +118 -0
- package/dist/cases/message-reactions/quick-pick.d.ts +1 -0
- package/dist/cases/message-reactions/quick-pick.jsx +155 -0
- package/dist/cases/message-reactions.md +367 -0
- package/dist/cases/message-row/grouped.d.ts +1 -0
- package/dist/cases/message-row/grouped.jsx +56 -0
- package/dist/cases/message-row/person-and-agent.d.ts +1 -0
- package/dist/cases/message-row/person-and-agent.jsx +41 -0
- package/dist/cases/message-row.md +185 -0
- package/dist/cases/not-found-page.md +0 -4
- package/dist/cases/notification-menu/menu.d.ts +1 -0
- package/dist/cases/notification-menu/menu.jsx +74 -0
- package/dist/cases/notification-menu.md +135 -0
- package/dist/cases/oauth-consent.md +0 -4
- package/dist/cases/on-off-settings/list.d.ts +1 -0
- package/dist/cases/on-off-settings/list.jsx +97 -0
- package/dist/cases/on-off-settings.md +116 -0
- package/dist/cases/overflow-menu/in-a-header.d.ts +1 -0
- package/dist/cases/overflow-menu/in-a-header.jsx +128 -0
- package/dist/cases/overflow-menu/on-a-row.d.ts +1 -0
- package/dist/cases/overflow-menu/on-a-row.jsx +183 -0
- package/dist/cases/overflow-menu.md +410 -0
- package/dist/cases/profile-form/form.d.ts +1 -0
- package/dist/cases/profile-form/form.jsx +153 -0
- package/dist/cases/profile-form.md +236 -0
- package/dist/cases/quick-switcher/modal.d.ts +1 -0
- package/dist/cases/quick-switcher/modal.jsx +114 -0
- package/dist/cases/quick-switcher.md +205 -0
- package/dist/cases/range-switch/segmented.d.ts +1 -0
- package/dist/cases/range-switch/segmented.jsx +30 -0
- package/dist/cases/range-switch.md +67 -0
- package/dist/cases/rename.md +0 -4
- package/dist/cases/reply-feedback/thumbs.d.ts +1 -0
- package/dist/cases/reply-feedback/thumbs.jsx +191 -0
- package/dist/cases/reply-feedback/with-reason.d.ts +1 -0
- package/dist/cases/reply-feedback/with-reason.jsx +221 -0
- package/dist/cases/reply-feedback.md +548 -0
- package/dist/cases/reply-sources/cards.d.ts +1 -0
- package/dist/cases/reply-sources/cards.jsx +83 -0
- package/dist/cases/reply-sources/tag-only.d.ts +1 -0
- package/dist/cases/reply-sources/tag-only.jsx +45 -0
- package/dist/cases/reply-sources.md +243 -0
- package/dist/cases/route-loading.md +0 -2
- package/dist/cases/scope-picker/menu.d.ts +1 -0
- package/dist/cases/scope-picker/menu.jsx +47 -0
- package/dist/cases/scope-picker.md +97 -0
- package/dist/cases/set-new-password.md +0 -4
- package/dist/cases/settings-page/side-nav.d.ts +1 -0
- package/dist/cases/settings-page/side-nav.jsx +171 -0
- package/dist/cases/settings-page/top-tabs.d.ts +1 -0
- package/dist/cases/settings-page/top-tabs.jsx +129 -0
- package/dist/cases/settings-page.md +378 -0
- package/dist/cases/settings-save.md +35 -0
- package/dist/cases/sign-up-page.md +1 -5
- package/dist/cases/slash-command-list/in-composer.d.ts +1 -0
- package/dist/cases/slash-command-list/in-composer.jsx +162 -0
- package/dist/cases/slash-command-list.md +243 -0
- package/dist/cases/success-feedback.md +1 -5
- package/dist/cases/tag-filter/tags.d.ts +1 -0
- package/dist/cases/tag-filter/tags.jsx +226 -0
- package/dist/cases/tag-filter.md +298 -0
- package/dist/cases/type-to-confirm.md +0 -4
- package/dist/cases/typing-and-status/line.d.ts +1 -0
- package/dist/cases/typing-and-status/line.jsx +50 -0
- package/dist/cases/typing-and-status.md +92 -0
- package/dist/cases/unsaved-changes-guard.md +0 -4
- package/dist/cases/upgrade-prompt.md +0 -4
- package/dist/cases.json +2331 -294
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +2 -2
- package/dist/components/button.d.ts +3 -2
- package/dist/components/button.jsx +14 -9
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +2 -2
- package/dist/components/composer.d.ts +74 -0
- package/dist/components/composer.jsx +122 -0
- package/dist/components/copyField.d.ts +20 -0
- package/dist/components/copyField.jsx +99 -0
- package/dist/components/fileChip.d.ts +33 -0
- package/dist/components/fileChip.jsx +61 -0
- package/dist/components/formField.d.ts +34 -0
- package/dist/components/formField.jsx +28 -0
- package/dist/components/heading.d.ts +3 -1
- package/dist/components/heading.jsx +2 -2
- package/dist/components/iconButton.d.ts +3 -3
- package/dist/components/iconButton.jsx +9 -7
- package/dist/components/layout.d.ts +7 -1
- package/dist/components/layout.jsx +5 -2
- package/dist/components/menu.d.ts +21 -0
- package/dist/components/menu.jsx +27 -3
- package/dist/components/menuItem.d.ts +12 -2
- package/dist/components/menuItem.jsx +6 -5
- package/dist/components/message.d.ts +28 -0
- package/dist/components/message.jsx +25 -0
- package/dist/components/navigation.d.ts +9 -1
- package/dist/components/navigation.jsx +15 -3
- package/dist/components/paragraph.d.ts +3 -1
- package/dist/components/paragraph.jsx +2 -2
- package/dist/components/popover.d.ts +7 -1
- package/dist/components/popover.jsx +35 -9
- package/dist/components/radioGroup.d.ts +12 -1
- package/dist/components/radioGroup.jsx +20 -9
- package/dist/components/segmentedControl.d.ts +22 -0
- package/dist/components/segmentedControl.jsx +54 -0
- package/dist/components/select.d.ts +5 -1
- package/dist/components/select.jsx +2 -2
- package/dist/components/settingsSection.d.ts +31 -0
- package/dist/components/settingsSection.jsx +58 -0
- package/dist/components/slidingIndicator.d.ts +50 -0
- package/dist/components/slidingIndicator.jsx +102 -0
- package/dist/components/sourceCard.d.ts +23 -0
- package/dist/components/sourceCard.jsx +56 -0
- package/dist/components/stepList.d.ts +17 -0
- package/dist/components/stepList.jsx +79 -0
- package/dist/components/switch.d.ts +25 -0
- package/dist/components/switch.jsx +55 -0
- package/dist/components/tab.jsx +5 -11
- package/dist/components/tabsContainer.jsx +5 -67
- package/dist/components/tag.d.ts +9 -1
- package/dist/components/tag.jsx +6 -4
- package/dist/components/textField.d.ts +12 -2
- package/dist/components/textField.jsx +11 -4
- package/dist/components/textarea.d.ts +5 -1
- package/dist/components/textarea.jsx +6 -21
- package/dist/components/useHotkey.d.ts +7 -0
- package/dist/components/useHotkey.js +24 -0
- package/dist/components/userImage.d.ts +9 -1
- package/dist/components/userImage.jsx +10 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/internal/autoGrow.d.ts +11 -0
- package/dist/internal/autoGrow.js +28 -0
- package/dist/internal/composer.d.ts +16 -0
- package/dist/internal/composer.js +18 -0
- package/dist/internal/copyField.d.ts +5 -0
- package/dist/internal/copyField.js +61 -0
- package/dist/internal/hotkey.d.ts +16 -0
- package/dist/internal/hotkey.js +20 -0
- package/dist/internal/menu.d.ts +6 -0
- package/dist/internal/menu.js +31 -0
- package/dist/internal/switch.d.ts +5 -0
- package/dist/internal/switch.js +9 -0
- package/dist/native-mapping.json +62 -1
- package/dist/stories/Button.stories.d.ts +1 -0
- package/dist/stories/Button.stories.jsx +17 -1
- package/dist/stories/Cases.generated.stories.d.ts +53 -0
- package/dist/stories/Cases.generated.stories.jsx +106 -0
- package/dist/stories/Composer.stories.d.ts +23 -0
- package/dist/stories/Composer.stories.jsx +121 -0
- package/dist/stories/CopyField.stories.d.ts +11 -0
- package/dist/stories/CopyField.stories.jsx +65 -0
- package/dist/stories/FileChip.stories.d.ts +7 -0
- package/dist/stories/FileChip.stories.jsx +35 -0
- package/dist/stories/FormField.stories.d.ts +6 -0
- package/dist/stories/FormField.stories.jsx +44 -0
- package/dist/stories/IconButton.stories.d.ts +1 -0
- package/dist/stories/IconButton.stories.jsx +18 -1
- package/dist/stories/Menu.stories.d.ts +4 -0
- package/dist/stories/Menu.stories.jsx +46 -1
- package/dist/stories/MenuItem.stories.d.ts +1 -0
- package/dist/stories/MenuItem.stories.jsx +8 -0
- package/dist/stories/Message.stories.d.ts +10 -0
- package/dist/stories/Message.stories.jsx +77 -0
- package/dist/stories/Navigation.stories.d.ts +1 -0
- package/dist/stories/Navigation.stories.jsx +17 -1
- package/dist/stories/PageComponents.stories.d.ts +1 -0
- package/dist/stories/PageComponents.stories.jsx +21 -0
- package/dist/stories/RadioGroup.stories.d.ts +2 -0
- package/dist/stories/RadioGroup.stories.jsx +40 -1
- package/dist/stories/SegmentedControl.stories.d.ts +8 -0
- package/dist/stories/SegmentedControl.stories.jsx +33 -0
- package/dist/stories/SettingsSection.stories.d.ts +11 -0
- package/dist/stories/SettingsSection.stories.jsx +64 -0
- package/dist/stories/SourceCard.stories.d.ts +8 -0
- package/dist/stories/SourceCard.stories.jsx +33 -0
- package/dist/stories/StepList.stories.d.ts +8 -0
- package/dist/stories/StepList.stories.jsx +35 -0
- package/dist/stories/Switch.stories.d.ts +14 -0
- package/dist/stories/Switch.stories.jsx +87 -0
- package/dist/stories/TextField.stories.d.ts +1 -0
- package/dist/stories/TextField.stories.jsx +13 -0
- package/dist/stories/UserImage.stories.d.ts +2 -0
- package/dist/stories/UserImage.stories.jsx +19 -0
- package/package.json +8 -3
|
@@ -0,0 +1,164 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
+
if (ar || !(i in from)) {
|
|
16
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
+
ar[i] = from[i];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
+
};
|
|
22
|
+
import { Fragment, useEffect, useRef, useState } from 'react';
|
|
23
|
+
import { Slack } from 'lucide-react';
|
|
24
|
+
import Modal from '../../components/modal';
|
|
25
|
+
import Heading from '../../components/heading';
|
|
26
|
+
import Paragraph from '../../components/paragraph';
|
|
27
|
+
import TableContainer from '../../components/tableContainer';
|
|
28
|
+
import TableRow from '../../components/tableRow';
|
|
29
|
+
import TableCell from '../../components/tableCell';
|
|
30
|
+
import BrandIcon from '../../components/brandIcon';
|
|
31
|
+
import Icon from '../../components/icon';
|
|
32
|
+
import Tag from '../../components/tag';
|
|
33
|
+
import Button from '../../components/button';
|
|
34
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
35
|
+
var firstProviders = [
|
|
36
|
+
{
|
|
37
|
+
id: 'github',
|
|
38
|
+
name: 'GitHub',
|
|
39
|
+
does: 'Link pull requests to tasks and close tasks when they merge.',
|
|
40
|
+
stops: 'Pull requests from it stop linking to tasks.',
|
|
41
|
+
brand: 'github',
|
|
42
|
+
accounts: [
|
|
43
|
+
{ id: 'acme', name: 'acme', detail: 'Connected Oct 3 · 14 repositories' },
|
|
44
|
+
{ id: 'acme-labs', name: 'acme-labs', detail: 'Access ran out. Reconnect to keep it working.', attention: true },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'slack',
|
|
49
|
+
name: 'Slack',
|
|
50
|
+
does: 'Post the weekly digest and link previews in your channels.',
|
|
51
|
+
stops: 'The digest and link previews stop in its channels.',
|
|
52
|
+
accounts: [],
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
export default function IntegrationsListNested() {
|
|
56
|
+
var _a = useState(firstProviders), providers = _a[0], setProviders = _a[1];
|
|
57
|
+
// Which Button is working: it shows `loading`, and every other Button waits.
|
|
58
|
+
var _b = useState(null), working = _b[0], setWorking = _b[1];
|
|
59
|
+
var _c = useState(null), confirming = _c[0], setConfirming = _c[1];
|
|
60
|
+
var timers = useRef([]);
|
|
61
|
+
// Stops every request if the example goes away before they end.
|
|
62
|
+
useEffect(function () { return function () { return timers.current.forEach(clearTimeout); }; }, []);
|
|
63
|
+
// Stands in for the sign-in a provider asks for, and the request that follows.
|
|
64
|
+
function later(callback, ms) {
|
|
65
|
+
timers.current.push(setTimeout(callback, ms));
|
|
66
|
+
}
|
|
67
|
+
function update(providerId, change) {
|
|
68
|
+
setProviders(function (list) { return list.map(function (p) { return (p.id === providerId ? __assign(__assign({}, p), { accounts: change(p.accounts) }) : p); }); });
|
|
69
|
+
}
|
|
70
|
+
// 'Connect' and 'Add Account' both start a sign-in, and the account that comes back joins its provider.
|
|
71
|
+
function handleAdd(p) {
|
|
72
|
+
if (working)
|
|
73
|
+
return;
|
|
74
|
+
setWorking("add-".concat(p.id));
|
|
75
|
+
later(function () {
|
|
76
|
+
setWorking(null);
|
|
77
|
+
var next = p.id === 'github'
|
|
78
|
+
? { id: 'acme-design', name: 'acme-design', detail: 'Connected today · 3 repositories' }
|
|
79
|
+
: { id: 'acme-slack', name: 'Acme', detail: 'Connected today · 6 channels' };
|
|
80
|
+
update(p.id, function (accounts) { return __spreadArray(__spreadArray([], accounts, true), [next], false); });
|
|
81
|
+
}, 1200);
|
|
82
|
+
}
|
|
83
|
+
function handleReconnect(p, a) {
|
|
84
|
+
if (working)
|
|
85
|
+
return;
|
|
86
|
+
setWorking("reconnect-".concat(a.id));
|
|
87
|
+
later(function () {
|
|
88
|
+
setWorking(null);
|
|
89
|
+
update(p.id, function (accounts) { return accounts.map(function (x) { return (x.id === a.id ? __assign(__assign({}, x), { detail: 'Connected today · 5 repositories', attention: false }) : x); }); });
|
|
90
|
+
}, 1200);
|
|
91
|
+
}
|
|
92
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
93
|
+
function handleClose() {
|
|
94
|
+
if (working)
|
|
95
|
+
return;
|
|
96
|
+
setConfirming(null);
|
|
97
|
+
}
|
|
98
|
+
function handleDisconnect(p, a) {
|
|
99
|
+
if (working)
|
|
100
|
+
return;
|
|
101
|
+
setWorking("remove-".concat(a.id));
|
|
102
|
+
later(function () {
|
|
103
|
+
setWorking(null);
|
|
104
|
+
setConfirming(null);
|
|
105
|
+
update(p.id, function (accounts) { return accounts.filter(function (x) { return x.id !== a.id; }); });
|
|
106
|
+
}, 1200);
|
|
107
|
+
}
|
|
108
|
+
return (<Center width="page">
|
|
109
|
+
<Stack gap="large">
|
|
110
|
+
<Stack gap="small">
|
|
111
|
+
<Heading level={1} size="h5">Integrations</Heading>
|
|
112
|
+
<Paragraph tone="secondary" size="body2" measure="none">A tool can hold several accounts. Each one connects and disconnects on its own.</Paragraph>
|
|
113
|
+
</Stack>
|
|
114
|
+
<TableContainer>
|
|
115
|
+
{providers.map(function (p) { return (<Fragment key={p.id}>
|
|
116
|
+
<TableRow>
|
|
117
|
+
<TableCell width="56px">
|
|
118
|
+
{p.brand ? <BrandIcon name={p.brand} size={24}/> : <Icon icon={Slack} size="medium" color="secondary"/>}
|
|
119
|
+
</TableCell>
|
|
120
|
+
<TableCell>
|
|
121
|
+
<Stack gap="small">
|
|
122
|
+
<Heading level={2} size="subtitle1">{p.name}</Heading>
|
|
123
|
+
<Paragraph tone="secondary" size="body2" measure="none">{p.does}</Paragraph>
|
|
124
|
+
</Stack>
|
|
125
|
+
</TableCell>
|
|
126
|
+
{/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
|
|
127
|
+
<TableCell width="240px">
|
|
128
|
+
<Cluster justify="end">
|
|
129
|
+
<Button size="small" type="secondary" state={working && working !== "add-".concat(p.id) ? 'disabled' : 'enabled'} label={p.accounts.length === 0 ? 'Connect' : 'Add Account'} aria-label={p.accounts.length === 0 ? "Connect ".concat(p.name) : "Add Account to ".concat(p.name)} loading={working === "add-".concat(p.id)} onClickButton={function () { return handleAdd(p); }}/>
|
|
130
|
+
</Cluster>
|
|
131
|
+
</TableCell>
|
|
132
|
+
</TableRow>
|
|
133
|
+
{/* The accounts sit under their provider, indented by an empty first cell. */}
|
|
134
|
+
{p.accounts.map(function (a) { return (<TableRow key={a.id}>
|
|
135
|
+
<TableCell width="56px">{''}</TableCell>
|
|
136
|
+
<TableCell>
|
|
137
|
+
<Stack gap="small">
|
|
138
|
+
<Cluster gap="small">
|
|
139
|
+
<Heading level={3} size="subtitle1">{a.name}</Heading>
|
|
140
|
+
{a.attention && <Tag variant="contained" size="small" color="warning" label="Needs attention"/>}
|
|
141
|
+
</Cluster>
|
|
142
|
+
<Paragraph tone="secondary" size="body2" measure="none">{a.detail}</Paragraph>
|
|
143
|
+
</Stack>
|
|
144
|
+
</TableCell>
|
|
145
|
+
<TableCell width="240px">
|
|
146
|
+
<Cluster gap="small" justify="end">
|
|
147
|
+
{a.attention && (<Button size="small" type="primary" state={working && working !== "reconnect-".concat(a.id) ? 'disabled' : 'enabled'} label="Reconnect" aria-label={"Reconnect ".concat(a.name)} loading={working === "reconnect-".concat(a.id)} onClickButton={function () { return handleReconnect(p, a); }}/>)}
|
|
148
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Disconnect" aria-label={"Disconnect ".concat(a.name)} onClickButton={function () { return setConfirming({ provider: p, account: a }); }}/>
|
|
149
|
+
</Cluster>
|
|
150
|
+
</TableCell>
|
|
151
|
+
</TableRow>); })}
|
|
152
|
+
</Fragment>); })}
|
|
153
|
+
</TableContainer>
|
|
154
|
+
</Stack>
|
|
155
|
+
<Modal isOpen={confirming !== null} size="small" title={confirming ? "Disconnect ".concat(confirming.account.name) : 'Disconnect'} onClose={handleClose} actions={<>
|
|
156
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
|
|
157
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Disconnect" loading={Boolean(working)} onClickButton={function () { return confirming && handleDisconnect(confirming.provider, confirming.account); }}/>
|
|
158
|
+
</>}>
|
|
159
|
+
{confirming && (<Paragraph measure="none">
|
|
160
|
+
{confirming.provider.stops} You can connect {confirming.account.name} again any time.
|
|
161
|
+
</Paragraph>)}
|
|
162
|
+
</Modal>
|
|
163
|
+
</Center>);
|
|
164
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function IntegrationsListRows(): import("react").JSX.Element;
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { Figma, Slack } from 'lucide-react';
|
|
15
|
+
import Modal from '../../components/modal';
|
|
16
|
+
import Heading from '../../components/heading';
|
|
17
|
+
import Paragraph from '../../components/paragraph';
|
|
18
|
+
import TableContainer from '../../components/tableContainer';
|
|
19
|
+
import TableRow from '../../components/tableRow';
|
|
20
|
+
import TableCell from '../../components/tableCell';
|
|
21
|
+
import BrandIcon from '../../components/brandIcon';
|
|
22
|
+
import Icon from '../../components/icon';
|
|
23
|
+
import Tag from '../../components/tag';
|
|
24
|
+
import Button from '../../components/button';
|
|
25
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
26
|
+
var providers = [
|
|
27
|
+
{ id: 'slack', name: 'Slack', does: 'Post the weekly digest and link previews in your channels.', stops: 'The weekly digest and link previews stop.', account: 'Acme workspace' },
|
|
28
|
+
{ id: 'github', name: 'GitHub', does: 'Link pull requests to tasks and close tasks when they merge.', stops: 'Pull requests stop linking to tasks.', account: 'acme', brand: 'github' },
|
|
29
|
+
{ id: 'google', name: 'Google Calendar', does: 'Show your calendar events beside your tasks.', stops: 'Calendar events stop showing beside tasks.', account: 'dana@acme.example', brand: 'google' },
|
|
30
|
+
{ id: 'figma', name: 'Figma', does: 'Show a preview when someone pastes a Figma link.', stops: 'Figma links stop showing a preview.', account: 'Acme team' },
|
|
31
|
+
];
|
|
32
|
+
function renderLogo(p) {
|
|
33
|
+
if (p.brand)
|
|
34
|
+
return <BrandIcon name={p.brand} size={24}/>;
|
|
35
|
+
return <Icon icon={p.id === 'slack' ? Slack : Figma} size="medium" color="secondary"/>;
|
|
36
|
+
}
|
|
37
|
+
export default function IntegrationsListRows() {
|
|
38
|
+
// Opens with GitHub needing attention, as if its access ran out.
|
|
39
|
+
var _a = useState({ github: true, google: true }), connected = _a[0], setConnected = _a[1];
|
|
40
|
+
var _b = useState({ github: true }), needsAttention = _b[0], setNeedsAttention = _b[1];
|
|
41
|
+
var _c = useState(null), working = _c[0], setWorking = _c[1];
|
|
42
|
+
var _d = useState(null), confirming = _d[0], setConfirming = _d[1];
|
|
43
|
+
var timers = useRef([]);
|
|
44
|
+
// Stops every request if the example goes away before they end.
|
|
45
|
+
useEffect(function () { return function () { return timers.current.forEach(clearTimeout); }; }, []);
|
|
46
|
+
// Stands in for the sign-in a provider asks for, and the request that follows.
|
|
47
|
+
function later(callback, ms) {
|
|
48
|
+
timers.current.push(setTimeout(callback, ms));
|
|
49
|
+
}
|
|
50
|
+
function handleConnect(p) {
|
|
51
|
+
if (working)
|
|
52
|
+
return;
|
|
53
|
+
setWorking(p.id);
|
|
54
|
+
later(function () {
|
|
55
|
+
setWorking(null);
|
|
56
|
+
setConnected(function (current) {
|
|
57
|
+
var _a;
|
|
58
|
+
return (__assign(__assign({}, current), (_a = {}, _a[p.id] = true, _a)));
|
|
59
|
+
});
|
|
60
|
+
setNeedsAttention(function (current) {
|
|
61
|
+
var _a;
|
|
62
|
+
return (__assign(__assign({}, current), (_a = {}, _a[p.id] = false, _a)));
|
|
63
|
+
});
|
|
64
|
+
}, 1200);
|
|
65
|
+
}
|
|
66
|
+
// Escape, a click outside and Cancel all close it, except while the request runs.
|
|
67
|
+
function handleClose() {
|
|
68
|
+
if (working)
|
|
69
|
+
return;
|
|
70
|
+
setConfirming(null);
|
|
71
|
+
}
|
|
72
|
+
function handleDisconnect(p) {
|
|
73
|
+
if (working)
|
|
74
|
+
return;
|
|
75
|
+
setWorking(p.id);
|
|
76
|
+
later(function () {
|
|
77
|
+
setWorking(null);
|
|
78
|
+
setConfirming(null);
|
|
79
|
+
setConnected(function (current) {
|
|
80
|
+
var _a;
|
|
81
|
+
return (__assign(__assign({}, current), (_a = {}, _a[p.id] = false, _a)));
|
|
82
|
+
});
|
|
83
|
+
setNeedsAttention(function (current) {
|
|
84
|
+
var _a;
|
|
85
|
+
return (__assign(__assign({}, current), (_a = {}, _a[p.id] = false, _a)));
|
|
86
|
+
});
|
|
87
|
+
}, 1200);
|
|
88
|
+
}
|
|
89
|
+
return (<Center width="page">
|
|
90
|
+
<Stack gap="large">
|
|
91
|
+
<Stack gap="small">
|
|
92
|
+
<Heading level={1} size="h5">Integrations</Heading>
|
|
93
|
+
<Paragraph tone="secondary" size="body2" measure="none">Connect the tools your team already uses.</Paragraph>
|
|
94
|
+
</Stack>
|
|
95
|
+
<TableContainer>
|
|
96
|
+
{providers.map(function (p) {
|
|
97
|
+
var isConnected = Boolean(connected[p.id]);
|
|
98
|
+
var attention = isConnected && Boolean(needsAttention[p.id]);
|
|
99
|
+
var busy = working === p.id;
|
|
100
|
+
return (<TableRow key={p.id}>
|
|
101
|
+
<TableCell width="56px">{renderLogo(p)}</TableCell>
|
|
102
|
+
<TableCell>
|
|
103
|
+
<Stack gap="small">
|
|
104
|
+
<Cluster gap="small">
|
|
105
|
+
<Heading level={2} size="subtitle1">{p.name}</Heading>
|
|
106
|
+
{attention && <Tag variant="contained" size="small" color="warning" label="Needs attention"/>}
|
|
107
|
+
</Cluster>
|
|
108
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
109
|
+
{attention ? 'Access ran out. Reconnect to keep it working.' : p.does}
|
|
110
|
+
</Paragraph>
|
|
111
|
+
</Stack>
|
|
112
|
+
</TableCell>
|
|
113
|
+
{/* A fixed last column keeps every row's Buttons in one place, so they do not jump when they change. */}
|
|
114
|
+
<TableCell width="340px">
|
|
115
|
+
{isConnected ? (<Cluster gap="small" justify="end">
|
|
116
|
+
<Paragraph size="body2" measure="none">{p.account}</Paragraph>
|
|
117
|
+
{attention && <Button size="small" type="primary" state={working && !busy ? 'disabled' : 'enabled'} label="Reconnect" aria-label={"Reconnect ".concat(p.name)} loading={busy} onClickButton={function () { return handleConnect(p); }}/>}
|
|
118
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Disconnect" aria-label={"Disconnect ".concat(p.name)} onClickButton={function () { return setConfirming(p); }}/>
|
|
119
|
+
</Cluster>) : (<Cluster gap="small" justify="end">
|
|
120
|
+
<Button size="small" type="secondary" state={working && !busy ? 'disabled' : 'enabled'} label="Connect" aria-label={"Connect ".concat(p.name)} loading={busy} onClickButton={function () { return handleConnect(p); }}/>
|
|
121
|
+
</Cluster>)}
|
|
122
|
+
</TableCell>
|
|
123
|
+
</TableRow>);
|
|
124
|
+
})}
|
|
125
|
+
</TableContainer>
|
|
126
|
+
</Stack>
|
|
127
|
+
<Modal isOpen={confirming !== null} size="small" title={confirming ? "Disconnect ".concat(confirming.name) : 'Disconnect'} onClose={handleClose} actions={<>
|
|
128
|
+
<Button size="small" type="tertiary" state={working ? 'disabled' : 'enabled'} label="Cancel" onClickButton={handleClose}/>
|
|
129
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Disconnect" loading={Boolean(working)} onClickButton={function () { return confirming && handleDisconnect(confirming); }}/>
|
|
130
|
+
</>}>
|
|
131
|
+
{confirming && (<Paragraph measure="none">{confirming.stops} You can connect {confirming.name} again any time.</Paragraph>)}
|
|
132
|
+
</Modal>
|
|
133
|
+
</Center>);
|
|
134
|
+
}
|