oneslash-design-system 2.17.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 +30 -14
- package/dist/cases/accept-invite.md +1 -5
- 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.md +0 -4
- package/dist/cases/agent-pending-reply.md +0 -4
- package/dist/cases/agent-plan-proposal.md +0 -4
- package/dist/cases/agent-question.md +0 -4
- 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 +0 -2
- 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.md +0 -4
- 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.md +0 -4
- package/dist/cases/confirm-destructive-action.md +0 -4
- package/dist/cases/confirm-dialogs.md +0 -4
- package/dist/cases/conversation-starters.md +0 -4
- 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.md +0 -4
- package/dist/cases/message-actions.md +0 -4
- package/dist/cases/message-attachments.md +0 -4
- package/dist/cases/message-composer.md +0 -4
- package/dist/cases/message-edit.md +0 -4
- package/dist/cases/message-reactions.md +0 -4
- package/dist/cases/message-row.md +0 -4
- 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.md +0 -4
- package/dist/cases/reply-sources.md +0 -4
- 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.md +0 -4
- package/dist/cases/success-feedback.md +0 -4
- 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.md +0 -4
- package/dist/cases/unsaved-changes-guard.md +0 -4
- package/dist/cases/upgrade-prompt.md +0 -4
- package/dist/cases.json +1038 -263
- package/dist/components/alert.d.ts +3 -1
- package/dist/components/alert.jsx +2 -2
- package/dist/components/button.jsx +5 -2
- package/dist/components/checkBox.d.ts +5 -1
- package/dist/components/checkBox.jsx +2 -2
- package/dist/components/copyField.d.ts +20 -0
- package/dist/components/copyField.jsx +99 -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/menu.jsx +2 -2
- package/dist/components/menuItem.d.ts +4 -2
- package/dist/components/menuItem.jsx +3 -3
- package/dist/components/navigation.d.ts +9 -1
- package/dist/components/navigation.jsx +15 -3
- package/dist/components/radioGroup.d.ts +5 -1
- package/dist/components/radioGroup.jsx +2 -2
- 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/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/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 +3 -3
- package/dist/components/useHotkey.d.ts +7 -0
- package/dist/components/useHotkey.js +24 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -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/switch.d.ts +5 -0
- package/dist/internal/switch.js +9 -0
- package/dist/native-mapping.json +30 -0
- package/dist/stories/Cases.generated.stories.d.ts +23 -0
- package/dist/stories/Cases.generated.stories.jsx +46 -0
- package/dist/stories/CopyField.stories.d.ts +11 -0
- package/dist/stories/CopyField.stories.jsx +65 -0
- package/dist/stories/FormField.stories.d.ts +6 -0
- package/dist/stories/FormField.stories.jsx +44 -0
- package/dist/stories/Navigation.stories.d.ts +1 -0
- package/dist/stories/Navigation.stories.jsx +17 -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/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/package.json +5 -1
|
@@ -0,0 +1,226 @@
|
|
|
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 { useEffect, useRef, useState } from 'react';
|
|
23
|
+
import Toaster, { toast, dismissToast } from '../../components/toaster';
|
|
24
|
+
import Modal from '../../components/modal';
|
|
25
|
+
import Heading from '../../components/heading';
|
|
26
|
+
import Paragraph from '../../components/paragraph';
|
|
27
|
+
import TextField from '../../components/textField';
|
|
28
|
+
import Tag from '../../components/tag';
|
|
29
|
+
import Button from '../../components/button';
|
|
30
|
+
import IconButton from '../../components/iconButton';
|
|
31
|
+
import Tooltip from '../../components/tooltip';
|
|
32
|
+
import Popover from '../../components/popover';
|
|
33
|
+
import Menu from '../../components/menu';
|
|
34
|
+
import MenuItem from '../../components/menuItem';
|
|
35
|
+
import EmptyBox from '../../components/emptyBox';
|
|
36
|
+
import TableContainer from '../../components/tableContainer';
|
|
37
|
+
import TableRow from '../../components/tableRow';
|
|
38
|
+
import TableCell from '../../components/tableCell';
|
|
39
|
+
import { Center, Cluster, Stack } from '../../components/layout';
|
|
40
|
+
var firstTags = [
|
|
41
|
+
{ id: 'design', name: 'Design' },
|
|
42
|
+
{ id: 'research', name: 'Research' },
|
|
43
|
+
{ id: 'ideas', name: 'Ideas' },
|
|
44
|
+
];
|
|
45
|
+
var firstItems = [
|
|
46
|
+
{ id: 'i1', title: 'Pricing page teardown', tagId: 'research' },
|
|
47
|
+
{ id: 'i2', title: 'Color tokens for dark mode', tagId: 'design' },
|
|
48
|
+
{ id: 'i3', title: 'Onboarding checklist patterns', tagId: 'design' },
|
|
49
|
+
{ id: 'i4', title: 'Interview notes, March', tagId: 'research' },
|
|
50
|
+
{ id: 'i5', title: 'A weekly digest email', tagId: 'ideas' },
|
|
51
|
+
{ id: 'i6', title: 'Keyboard shortcut cheat sheet', tagId: null },
|
|
52
|
+
];
|
|
53
|
+
export default function TagFilterTags() {
|
|
54
|
+
var _a = useState(firstTags), tags = _a[0], setTags = _a[1];
|
|
55
|
+
var _b = useState(firstItems), items = _b[0], setItems = _b[1];
|
|
56
|
+
// null is 'All'.
|
|
57
|
+
var _c = useState('design'), selected = _c[0], setSelected = _c[1];
|
|
58
|
+
var _d = useState(null), editing = _d[0], setEditing = _d[1];
|
|
59
|
+
var _e = useState(''), draft = _e[0], setDraft = _e[1];
|
|
60
|
+
var _f = useState(false), taken = _f[0], setTaken = _f[1];
|
|
61
|
+
var _g = useState(null), menuAnchor = _g[0], setMenuAnchor = _g[1];
|
|
62
|
+
var _h = useState(false), menuOpen = _h[0], setMenuOpen = _h[1];
|
|
63
|
+
var _j = useState(false), confirming = _j[0], setConfirming = _j[1];
|
|
64
|
+
var _k = useState(false), deleting = _k[0], setDeleting = _k[1];
|
|
65
|
+
// The tag the confirm is about, kept until the Modal is closed, so its text stays while it fades out.
|
|
66
|
+
var _l = useState({ name: '', count: 0 }), doomed = _l[0], setDoomed = _l[1];
|
|
67
|
+
var timer = useRef();
|
|
68
|
+
var toastIds = useRef([]);
|
|
69
|
+
var moreButton = useRef(null);
|
|
70
|
+
var addButton = useRef(null);
|
|
71
|
+
// Enter and Escape end the edit before the field goes away, so its blur must not save again.
|
|
72
|
+
var ended = useRef(false);
|
|
73
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
74
|
+
var focusNext = useRef();
|
|
75
|
+
var tag = tags.find(function (t) { return t.id === selected; });
|
|
76
|
+
var shown = selected === null ? items : items.filter(function (i) { return i.tagId === selected; });
|
|
77
|
+
var nameOf = function (tagId) { var _a, _b; return (_b = (_a = tags.find(function (t) { return t.id === tagId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'No tag'; };
|
|
78
|
+
// On unmount it stops the request and closes every toast it opened.
|
|
79
|
+
useEffect(function () { return function () {
|
|
80
|
+
clearTimeout(timer.current);
|
|
81
|
+
toastIds.current.forEach(function (id) { return dismissToast(id); });
|
|
82
|
+
toastIds.current = [];
|
|
83
|
+
}; }, []);
|
|
84
|
+
useEffect(function () {
|
|
85
|
+
var move = focusNext.current;
|
|
86
|
+
focusNext.current = undefined;
|
|
87
|
+
move === null || move === void 0 ? void 0 : move();
|
|
88
|
+
});
|
|
89
|
+
function startEditing(kind) {
|
|
90
|
+
ended.current = false;
|
|
91
|
+
setDraft(kind === 'rename' && tag ? tag.name : '');
|
|
92
|
+
setTaken(false);
|
|
93
|
+
setEditing(kind);
|
|
94
|
+
}
|
|
95
|
+
// Enter and a click away save. An empty or unchanged name cancels. A name that is taken stays in the field with
|
|
96
|
+
// the error, so what the person typed is not lost. `byKey` is true for Enter, where focus goes back to where it was.
|
|
97
|
+
function finish(byKey) {
|
|
98
|
+
if (ended.current || !editing)
|
|
99
|
+
return;
|
|
100
|
+
var name = draft.trim();
|
|
101
|
+
var unchanged = editing === 'rename' && name === (tag === null || tag === void 0 ? void 0 : tag.name);
|
|
102
|
+
if (!name || unchanged)
|
|
103
|
+
return cancel(byKey);
|
|
104
|
+
if (tags.some(function (t) { return !(editing === 'rename' && t.id === selected) && t.name.toLowerCase() === name.toLowerCase(); })) {
|
|
105
|
+
setTaken(true);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
ended.current = true;
|
|
109
|
+
// A real app sends the name to the server here and shows it at once.
|
|
110
|
+
if (editing === 'rename') {
|
|
111
|
+
setTags(function (list) { return list.map(function (t) { return (t.id === selected ? __assign(__assign({}, t), { name: name }) : t); }); });
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
var id_1 = "tag-".concat(name.toLowerCase().replace(/\s+/g, '-'));
|
|
115
|
+
setTags(function (list) { return __spreadArray(__spreadArray([], list, true), [{ id: id_1, name: name }], false); });
|
|
116
|
+
setSelected(id_1);
|
|
117
|
+
}
|
|
118
|
+
leave(byKey);
|
|
119
|
+
}
|
|
120
|
+
function cancel(byKey) {
|
|
121
|
+
if (ended.current)
|
|
122
|
+
return;
|
|
123
|
+
ended.current = true;
|
|
124
|
+
leave(byKey);
|
|
125
|
+
}
|
|
126
|
+
function leave(byKey) {
|
|
127
|
+
var kind = editing;
|
|
128
|
+
setEditing(null);
|
|
129
|
+
setTaken(false);
|
|
130
|
+
if (byKey)
|
|
131
|
+
focusNext.current = function () { var _a; return (_a = (kind === 'rename' ? moreButton.current : addButton.current)) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
132
|
+
}
|
|
133
|
+
function openMenu(anchorEl) {
|
|
134
|
+
setMenuAnchor(anchorEl);
|
|
135
|
+
setMenuOpen(function (o) { return !o; });
|
|
136
|
+
}
|
|
137
|
+
// The menu closes on any choice. Its Popover gives focus back to the More button.
|
|
138
|
+
function rename() {
|
|
139
|
+
setMenuOpen(false);
|
|
140
|
+
startEditing('rename');
|
|
141
|
+
}
|
|
142
|
+
function askToDelete() {
|
|
143
|
+
setMenuOpen(false);
|
|
144
|
+
if (tag)
|
|
145
|
+
setDoomed({ name: tag.name, count: items.filter(function (i) { return i.tagId === tag.id; }).length });
|
|
146
|
+
setConfirming(true);
|
|
147
|
+
}
|
|
148
|
+
// 'Cancel' ends the confirm; the More button is still there, so focus goes back to it.
|
|
149
|
+
function keepTag() {
|
|
150
|
+
if (deleting)
|
|
151
|
+
return;
|
|
152
|
+
setConfirming(false);
|
|
153
|
+
focusNext.current = function () { var _a; return (_a = moreButton.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
154
|
+
}
|
|
155
|
+
// The items keep their place in 'All' and lose the tag. The tag and its More button are gone, so focus goes to 'Add Tag'.
|
|
156
|
+
function confirmDelete() {
|
|
157
|
+
if (deleting || !tag)
|
|
158
|
+
return;
|
|
159
|
+
var gone = tag;
|
|
160
|
+
setDeleting(true);
|
|
161
|
+
// Stands in for the request to the server.
|
|
162
|
+
timer.current = setTimeout(function () {
|
|
163
|
+
setDeleting(false);
|
|
164
|
+
setConfirming(false);
|
|
165
|
+
setTags(function (list) { return list.filter(function (t) { return t.id !== gone.id; }); });
|
|
166
|
+
setItems(function (list) { return list.map(function (i) { return (i.tagId === gone.id ? __assign(__assign({}, i), { tagId: null }) : i); }); });
|
|
167
|
+
setSelected(null);
|
|
168
|
+
toastIds.current.push(toast({ type: 'success', message: "".concat(gone.name, " tag deleted.") }));
|
|
169
|
+
focusNext.current = function () { var _a; return (_a = addButton.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
170
|
+
}, 1200);
|
|
171
|
+
}
|
|
172
|
+
return (<Center width="page">
|
|
173
|
+
{/* A real app mounts one Toaster near its root. */}
|
|
174
|
+
<Toaster />
|
|
175
|
+
<Stack gap="large">
|
|
176
|
+
<Heading level={1} size="h5">Reading list</Heading>
|
|
177
|
+
{editing ? (
|
|
178
|
+
// The row of tags becomes the field, as the case 'Rename' says for a name that is on screen. Enter and a click away save, Escape cancels.
|
|
179
|
+
<TextField key={editing} id="tag-filter-name" size="small" autoFocus aria-label={editing === 'rename' ? "Rename tag ".concat(tag === null || tag === void 0 ? void 0 : tag.name) : 'New tag name'} placeholder={editing === 'add' ? 'Tag name' : undefined} value={draft} error={taken} errorText="A tag with this name already exists." onChange={function (e) {
|
|
180
|
+
setDraft(e.target.value);
|
|
181
|
+
setTaken(false);
|
|
182
|
+
}} onKeyDown={function (e) {
|
|
183
|
+
if (e.key === 'Enter') {
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
finish(true);
|
|
186
|
+
}
|
|
187
|
+
else if (e.key === 'Escape') {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
cancel(true);
|
|
190
|
+
}
|
|
191
|
+
}} onBlur={function () { return finish(false); }}/>) : (
|
|
192
|
+
// Tags that people add, rename and delete are not a fixed short set, so they are toggle Tags in a row that wraps.
|
|
193
|
+
<Cluster gap="small">
|
|
194
|
+
<Tag variant="contained" size="medium" label="All" state={selected === null ? 'selected' : 'enabled'} onClick={function () { return setSelected(null); }}/>
|
|
195
|
+
{tags.map(function (t) { return (<Tag key={t.id} variant="contained" size="medium" label={t.name} state={t.id === selected ? 'selected' : 'enabled'} onClick={function () { return setSelected(t.id); }}/>); })}
|
|
196
|
+
{/* One More button, for the tag that is selected, so the row has one extra stop and not one per tag. */}
|
|
197
|
+
{tag && (<Tooltip title="More">
|
|
198
|
+
<IconButton ref={moreButton} color="iconOnly" state={menuOpen ? 'selected' : 'enabled'} size="small" iconName="Ellipsis" ariaLabel={"More actions for tag ".concat(tag.name)} aria-haspopup="menu" aria-expanded={menuOpen} onClick={function (e) { return openMenu(e.currentTarget); }}/>
|
|
199
|
+
</Tooltip>)}
|
|
200
|
+
<Button ref={addButton} size="small" type="tertiary" state="enabled" label="Add Tag" decoIcon="Plus" onClickButton={function () { return startEditing('add'); }}/>
|
|
201
|
+
</Cluster>)}
|
|
202
|
+
{shown.length > 0 ? (<TableContainer>
|
|
203
|
+
{shown.map(function (i) { return (<TableRow key={i.id}>
|
|
204
|
+
<TableCell>{i.title}</TableCell>
|
|
205
|
+
<TableCell width="120px">{nameOf(i.tagId)}</TableCell>
|
|
206
|
+
</TableRow>); })}
|
|
207
|
+
</TableContainer>) : (<EmptyBox size="small" icon="Tag" text={"No items tagged '".concat(tag === null || tag === void 0 ? void 0 : tag.name, "'")} secondText="Items you tag appear here."/>)}
|
|
208
|
+
</Stack>
|
|
209
|
+
<Popover open={menuOpen} anchorEl={menuAnchor} onClose={function () { return setMenuOpen(false); }} returnFocus>
|
|
210
|
+
<Menu navigable aria-label="Tag actions" width={180}>
|
|
211
|
+
<MenuItem size="small" iconName="Pencil" label="Rename" onClick={rename}/>
|
|
212
|
+
{/* Delete is last, and danger. */}
|
|
213
|
+
<MenuItem size="small" color="danger" iconName="Trash2" label="Delete" onClick={askToDelete}/>
|
|
214
|
+
</Menu>
|
|
215
|
+
</Popover>
|
|
216
|
+
<Modal isOpen={confirming} size="small" title="Delete Tag" onClose={keepTag} actions={<>
|
|
217
|
+
<Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={keepTag}/>
|
|
218
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Delete" loading={deleting} onClickButton={confirmDelete}/>
|
|
219
|
+
</>}>
|
|
220
|
+
<Paragraph measure="none">{"This deletes the tag '".concat(doomed.name, "'.")}</Paragraph>
|
|
221
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
222
|
+
{doomed.count === 1 ? 'Its 1 item stays in All, with no tag.' : "Its ".concat(doomed.count, " items stay in All, with no tag.")}
|
|
223
|
+
</Paragraph>
|
|
224
|
+
</Modal>
|
|
225
|
+
</Center>);
|
|
226
|
+
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Tag filter
|
|
2
|
+
|
|
3
|
+
A person filters a list by a tag, and adds, renames and deletes the tags themselves.
|
|
4
|
+
|
|
5
|
+
## Do
|
|
6
|
+
|
|
7
|
+
- Use a row of `Tag` with `variant="contained"` and `size="medium"` in a `Cluster`. Put 'All' first, then each tag. The row wraps.
|
|
8
|
+
- Mark the chosen one with `state="selected"`. A clickable `Tag` is a toggle and reports `aria-pressed`.
|
|
9
|
+
- Choose Tags over a `SegmentedControl`. A `SegmentedControl` is for a fixed set of two to four, as in the case 'Range switch'. It cannot grow, wrap or hold a field.
|
|
10
|
+
- Show one More `IconButton` after the selected tag: `ariaLabel="More actions for tag Design"`. The row gets one extra stop, not one for each tag.
|
|
11
|
+
- Open a navigable menu from it: `<Popover returnFocus>` around `<Menu navigable aria-label="Tag actions">` with 'Rename', then a danger 'Delete'.
|
|
12
|
+
- Rename in place, as the case 'Rename' says. The row becomes a field with `aria-label="Rename tag Design"`. Enter and a click away save, and Escape cancels.
|
|
13
|
+
- Add a tag with an 'Add Tag' Button that turns the row into the same field, with `aria-label="New tag name"`. The new tag is chosen once it is added.
|
|
14
|
+
- Show a name that is taken under the field with `error` and `errorText`, and keep what the person typed.
|
|
15
|
+
- Confirm Delete in a small Modal, as the case 'Delete confirm' says: 'Cancel' first, then a danger 'Delete'.
|
|
16
|
+
- Say where the items go: 'Its 3 items stay in All, with no tag.' Name the tag in a toast when it is gone.
|
|
17
|
+
- Put focus on the More button after Rename or Cancel, and on 'Add Tag' after a delete, since the tag and its More button are gone.
|
|
18
|
+
|
|
19
|
+
## Don't
|
|
20
|
+
|
|
21
|
+
- Do not use a `SegmentedControl` for tags that people add and delete.
|
|
22
|
+
- Do not delete the items with their tag.
|
|
23
|
+
- Do not say 'Are you sure?' in the confirm. Say what is deleted and where the items go.
|
|
24
|
+
- Do not add a 'Delete' that has no confirm. A tag may be on many items.
|
|
25
|
+
- Do not leave the row on a tag that was just deleted. It goes back to All.
|
|
26
|
+
|
|
27
|
+
## Example: Row of toggle Tags
|
|
28
|
+
|
|
29
|
+
Uses: `Button`, `Center`, `Cluster`, `EmptyBox`, `Heading`, `IconButton`, `Menu`, `MenuItem`, `Modal`, `Paragraph`, `Popover`, `Stack`, `TableCell`, `TableContainer`, `TableRow`, `Tag`, `TextField`, `Toaster`, `Tooltip`, `dismissToast`, `toast`
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
'use client';
|
|
33
|
+
import { useEffect, useRef, useState } from 'react';
|
|
34
|
+
import Toaster, { toast, dismissToast } from 'oneslash-design-system/components/toaster';
|
|
35
|
+
import Modal from 'oneslash-design-system/components/modal';
|
|
36
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
37
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
38
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
39
|
+
import Tag from 'oneslash-design-system/components/tag';
|
|
40
|
+
import Button from 'oneslash-design-system/components/button';
|
|
41
|
+
import IconButton from 'oneslash-design-system/components/iconButton';
|
|
42
|
+
import Tooltip from 'oneslash-design-system/components/tooltip';
|
|
43
|
+
import Popover from 'oneslash-design-system/components/popover';
|
|
44
|
+
import Menu from 'oneslash-design-system/components/menu';
|
|
45
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
46
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
47
|
+
import TableContainer from 'oneslash-design-system/components/tableContainer';
|
|
48
|
+
import TableRow from 'oneslash-design-system/components/tableRow';
|
|
49
|
+
import TableCell from 'oneslash-design-system/components/tableCell';
|
|
50
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
51
|
+
|
|
52
|
+
// A real app reads these from the server. 'All' is not a tag: it shows every item.
|
|
53
|
+
type Item = { id: string; title: string; tagId: string | null };
|
|
54
|
+
const firstTags = [
|
|
55
|
+
{ id: 'design', name: 'Design' },
|
|
56
|
+
{ id: 'research', name: 'Research' },
|
|
57
|
+
{ id: 'ideas', name: 'Ideas' },
|
|
58
|
+
];
|
|
59
|
+
const firstItems: Item[] = [
|
|
60
|
+
{ id: 'i1', title: 'Pricing page teardown', tagId: 'research' },
|
|
61
|
+
{ id: 'i2', title: 'Color tokens for dark mode', tagId: 'design' },
|
|
62
|
+
{ id: 'i3', title: 'Onboarding checklist patterns', tagId: 'design' },
|
|
63
|
+
{ id: 'i4', title: 'Interview notes, March', tagId: 'research' },
|
|
64
|
+
{ id: 'i5', title: 'A weekly digest email', tagId: 'ideas' },
|
|
65
|
+
{ id: 'i6', title: 'Keyboard shortcut cheat sheet', tagId: null },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
// What the field is for: a new tag, or the selected tag's new name.
|
|
69
|
+
type Editing = 'add' | 'rename' | null;
|
|
70
|
+
|
|
71
|
+
export default function TagFilterTags() {
|
|
72
|
+
const [tags, setTags] = useState(firstTags);
|
|
73
|
+
const [items, setItems] = useState(firstItems);
|
|
74
|
+
// null is 'All'.
|
|
75
|
+
const [selected, setSelected] = useState<string | null>('design');
|
|
76
|
+
const [editing, setEditing] = useState<Editing>(null);
|
|
77
|
+
const [draft, setDraft] = useState('');
|
|
78
|
+
const [taken, setTaken] = useState(false);
|
|
79
|
+
const [menuAnchor, setMenuAnchor] = useState<HTMLElement | null>(null);
|
|
80
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
81
|
+
const [confirming, setConfirming] = useState(false);
|
|
82
|
+
const [deleting, setDeleting] = useState(false);
|
|
83
|
+
// The tag the confirm is about, kept until the Modal is closed, so its text stays while it fades out.
|
|
84
|
+
const [doomed, setDoomed] = useState<{ name: string; count: number }>({ name: '', count: 0 });
|
|
85
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
86
|
+
const toastIds = useRef<string[]>([]);
|
|
87
|
+
const moreButton = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
|
|
88
|
+
const addButton = useRef<HTMLButtonElement | HTMLAnchorElement>(null);
|
|
89
|
+
// Enter and Escape end the edit before the field goes away, so its blur must not save again.
|
|
90
|
+
const ended = useRef(false);
|
|
91
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
92
|
+
const focusNext = useRef<() => void>();
|
|
93
|
+
|
|
94
|
+
const tag = tags.find((t) => t.id === selected);
|
|
95
|
+
const shown = selected === null ? items : items.filter((i) => i.tagId === selected);
|
|
96
|
+
const nameOf = (tagId: string | null) => tags.find((t) => t.id === tagId)?.name ?? 'No tag';
|
|
97
|
+
|
|
98
|
+
// On unmount it stops the request and closes every toast it opened.
|
|
99
|
+
useEffect(() => () => {
|
|
100
|
+
clearTimeout(timer.current);
|
|
101
|
+
toastIds.current.forEach((id) => dismissToast(id));
|
|
102
|
+
toastIds.current = [];
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
const move = focusNext.current;
|
|
107
|
+
focusNext.current = undefined;
|
|
108
|
+
move?.();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
function startEditing(kind: 'add' | 'rename') {
|
|
112
|
+
ended.current = false;
|
|
113
|
+
setDraft(kind === 'rename' && tag ? tag.name : '');
|
|
114
|
+
setTaken(false);
|
|
115
|
+
setEditing(kind);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Enter and a click away save. An empty or unchanged name cancels. A name that is taken stays in the field with
|
|
119
|
+
// the error, so what the person typed is not lost. `byKey` is true for Enter, where focus goes back to where it was.
|
|
120
|
+
function finish(byKey: boolean) {
|
|
121
|
+
if (ended.current || !editing) return;
|
|
122
|
+
const name = draft.trim();
|
|
123
|
+
const unchanged = editing === 'rename' && name === tag?.name;
|
|
124
|
+
if (!name || unchanged) return cancel(byKey);
|
|
125
|
+
if (tags.some((t) => !(editing === 'rename' && t.id === selected) && t.name.toLowerCase() === name.toLowerCase())) {
|
|
126
|
+
setTaken(true);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
ended.current = true;
|
|
130
|
+
// A real app sends the name to the server here and shows it at once.
|
|
131
|
+
if (editing === 'rename') {
|
|
132
|
+
setTags((list) => list.map((t) => (t.id === selected ? { ...t, name } : t)));
|
|
133
|
+
} else {
|
|
134
|
+
const id = `tag-${name.toLowerCase().replace(/\s+/g, '-')}`;
|
|
135
|
+
setTags((list) => [...list, { id, name }]);
|
|
136
|
+
setSelected(id);
|
|
137
|
+
}
|
|
138
|
+
leave(byKey);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function cancel(byKey: boolean) {
|
|
142
|
+
if (ended.current) return;
|
|
143
|
+
ended.current = true;
|
|
144
|
+
leave(byKey);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function leave(byKey: boolean) {
|
|
148
|
+
const kind = editing;
|
|
149
|
+
setEditing(null);
|
|
150
|
+
setTaken(false);
|
|
151
|
+
if (byKey) focusNext.current = () => (kind === 'rename' ? moreButton.current : addButton.current)?.focus();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function openMenu(anchorEl: HTMLElement) {
|
|
155
|
+
setMenuAnchor(anchorEl);
|
|
156
|
+
setMenuOpen((o) => !o);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// The menu closes on any choice. Its Popover gives focus back to the More button.
|
|
160
|
+
function rename() {
|
|
161
|
+
setMenuOpen(false);
|
|
162
|
+
startEditing('rename');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function askToDelete() {
|
|
166
|
+
setMenuOpen(false);
|
|
167
|
+
if (tag) setDoomed({ name: tag.name, count: items.filter((i) => i.tagId === tag.id).length });
|
|
168
|
+
setConfirming(true);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 'Cancel' ends the confirm; the More button is still there, so focus goes back to it.
|
|
172
|
+
function keepTag() {
|
|
173
|
+
if (deleting) return;
|
|
174
|
+
setConfirming(false);
|
|
175
|
+
focusNext.current = () => moreButton.current?.focus();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// The items keep their place in 'All' and lose the tag. The tag and its More button are gone, so focus goes to 'Add Tag'.
|
|
179
|
+
function confirmDelete() {
|
|
180
|
+
if (deleting || !tag) return;
|
|
181
|
+
const gone = tag;
|
|
182
|
+
setDeleting(true);
|
|
183
|
+
// Stands in for the request to the server.
|
|
184
|
+
timer.current = setTimeout(() => {
|
|
185
|
+
setDeleting(false);
|
|
186
|
+
setConfirming(false);
|
|
187
|
+
setTags((list) => list.filter((t) => t.id !== gone.id));
|
|
188
|
+
setItems((list) => list.map((i) => (i.tagId === gone.id ? { ...i, tagId: null } : i)));
|
|
189
|
+
setSelected(null);
|
|
190
|
+
toastIds.current.push(toast({ type: 'success', message: `${gone.name} tag deleted.` }));
|
|
191
|
+
focusNext.current = () => addButton.current?.focus();
|
|
192
|
+
}, 1200);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<Center width="page">
|
|
197
|
+
{/* A real app mounts one Toaster near its root. */}
|
|
198
|
+
<Toaster />
|
|
199
|
+
<Stack gap="large">
|
|
200
|
+
<Heading level={1} size="h5">Reading list</Heading>
|
|
201
|
+
{editing ? (
|
|
202
|
+
// The row of tags becomes the field, as the case 'Rename' says for a name that is on screen. Enter and a click away save, Escape cancels.
|
|
203
|
+
<TextField
|
|
204
|
+
key={editing}
|
|
205
|
+
id="tag-filter-name"
|
|
206
|
+
size="small"
|
|
207
|
+
autoFocus
|
|
208
|
+
aria-label={editing === 'rename' ? `Rename tag ${tag?.name}` : 'New tag name'}
|
|
209
|
+
placeholder={editing === 'add' ? 'Tag name' : undefined}
|
|
210
|
+
value={draft}
|
|
211
|
+
error={taken}
|
|
212
|
+
errorText="A tag with this name already exists."
|
|
213
|
+
onChange={(e) => {
|
|
214
|
+
setDraft(e.target.value);
|
|
215
|
+
setTaken(false);
|
|
216
|
+
}}
|
|
217
|
+
onKeyDown={(e) => {
|
|
218
|
+
if (e.key === 'Enter') {
|
|
219
|
+
e.preventDefault();
|
|
220
|
+
finish(true);
|
|
221
|
+
} else if (e.key === 'Escape') {
|
|
222
|
+
e.preventDefault();
|
|
223
|
+
cancel(true);
|
|
224
|
+
}
|
|
225
|
+
}}
|
|
226
|
+
onBlur={() => finish(false)}
|
|
227
|
+
/>
|
|
228
|
+
) : (
|
|
229
|
+
// Tags that people add, rename and delete are not a fixed short set, so they are toggle Tags in a row that wraps.
|
|
230
|
+
<Cluster gap="small">
|
|
231
|
+
<Tag variant="contained" size="medium" label="All" state={selected === null ? 'selected' : 'enabled'} onClick={() => setSelected(null)} />
|
|
232
|
+
{tags.map((t) => (
|
|
233
|
+
<Tag key={t.id} variant="contained" size="medium" label={t.name} state={t.id === selected ? 'selected' : 'enabled'} onClick={() => setSelected(t.id)} />
|
|
234
|
+
))}
|
|
235
|
+
{/* One More button, for the tag that is selected, so the row has one extra stop and not one per tag. */}
|
|
236
|
+
{tag && (
|
|
237
|
+
<Tooltip title="More">
|
|
238
|
+
<IconButton
|
|
239
|
+
ref={moreButton}
|
|
240
|
+
color="iconOnly"
|
|
241
|
+
state={menuOpen ? 'selected' : 'enabled'}
|
|
242
|
+
size="small"
|
|
243
|
+
iconName="Ellipsis"
|
|
244
|
+
ariaLabel={`More actions for tag ${tag.name}`}
|
|
245
|
+
aria-haspopup="menu"
|
|
246
|
+
aria-expanded={menuOpen}
|
|
247
|
+
onClick={(e: { currentTarget: HTMLElement }) => openMenu(e.currentTarget)}
|
|
248
|
+
/>
|
|
249
|
+
</Tooltip>
|
|
250
|
+
)}
|
|
251
|
+
<Button ref={addButton} size="small" type="tertiary" state="enabled" label="Add Tag" decoIcon="Plus" onClickButton={() => startEditing('add')} />
|
|
252
|
+
</Cluster>
|
|
253
|
+
)}
|
|
254
|
+
{shown.length > 0 ? (
|
|
255
|
+
<TableContainer>
|
|
256
|
+
{shown.map((i) => (
|
|
257
|
+
<TableRow key={i.id}>
|
|
258
|
+
<TableCell>{i.title}</TableCell>
|
|
259
|
+
<TableCell width="120px">{nameOf(i.tagId)}</TableCell>
|
|
260
|
+
</TableRow>
|
|
261
|
+
))}
|
|
262
|
+
</TableContainer>
|
|
263
|
+
) : (
|
|
264
|
+
<EmptyBox size="small" icon="Tag" text={`No items tagged '${tag?.name}'`} secondText="Items you tag appear here." />
|
|
265
|
+
)}
|
|
266
|
+
</Stack>
|
|
267
|
+
<Popover open={menuOpen} anchorEl={menuAnchor} onClose={() => setMenuOpen(false)} returnFocus>
|
|
268
|
+
<Menu navigable aria-label="Tag actions" width={180}>
|
|
269
|
+
<MenuItem size="small" iconName="Pencil" label="Rename" onClick={rename} />
|
|
270
|
+
{/* Delete is last, and danger. */}
|
|
271
|
+
<MenuItem size="small" color="danger" iconName="Trash2" label="Delete" onClick={askToDelete} />
|
|
272
|
+
</Menu>
|
|
273
|
+
</Popover>
|
|
274
|
+
<Modal
|
|
275
|
+
isOpen={confirming}
|
|
276
|
+
size="small"
|
|
277
|
+
title="Delete Tag"
|
|
278
|
+
onClose={keepTag}
|
|
279
|
+
actions={
|
|
280
|
+
<>
|
|
281
|
+
<Button size="small" type="tertiary" state={deleting ? 'disabled' : 'enabled'} label="Cancel" onClickButton={keepTag} />
|
|
282
|
+
<Button size="small" type="primary" color="danger" state="enabled" label="Delete" loading={deleting} onClickButton={confirmDelete} />
|
|
283
|
+
</>
|
|
284
|
+
}
|
|
285
|
+
>
|
|
286
|
+
<Paragraph measure="none">{`This deletes the tag '${doomed.name}'.`}</Paragraph>
|
|
287
|
+
<Paragraph tone="secondary" size="body2" measure="none">
|
|
288
|
+
{doomed.count === 1 ? 'Its 1 item stays in All, with no tag.' : `Its ${doomed.count} items stay in All, with no tag.`}
|
|
289
|
+
</Paragraph>
|
|
290
|
+
</Modal>
|
|
291
|
+
</Center>
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Native
|
|
297
|
+
|
|
298
|
+
On Apple use a horizontal `ScrollView` of toggle `Button`s, with a `.contextMenu` on each tag: Rename, then Delete in the `.destructive` role, which asks in a `confirmationDialog`. On Android use `FilterChip`s in a `LazyRow`.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person asks to delete something large that cannot be brought back, such as a workspace or an account.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Commentify matches its phrase with any case and ignores spaces around it, and labels its Button 'Deleting…' while it runs. Scindo labels its Button 'Deleting...' on the web and on Apple. On the web its Delete Workspace Modal shows a failed request as a red caption written by hand.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Ask for typing only when the loss is permanent and large, such as a workspace with everything in it, or an account.
|
|
@@ -218,5 +216,3 @@ export default function TypeToConfirmInline() {
|
|
|
218
216
|
## Native
|
|
219
217
|
|
|
220
218
|
On Apple use an `.alert` with a `TextField` in it. Put the action in the `.destructive` role and disable it until the text matches.
|
|
221
|
-
|
|
222
|
-
Seen in: Commentify, Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Other people in the thread are writing a message that has not arrived yet.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web names people by their full name and ends the line with three dots.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Show one line just above the Composer, in small secondary text: `<Paragraph size="caption" tone="secondary">`.
|
|
@@ -92,5 +90,3 @@ export default function TypingAndStatusLine() {
|
|
|
92
90
|
);
|
|
93
91
|
}
|
|
94
92
|
```
|
|
95
|
-
|
|
96
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person closes or leaves something they changed and did not save.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo on the web guards no unsaved changes. It drops the changes to a document when the person chooses Cancel, with no question.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Ask only when there are changes. With nothing changed, close at once.
|
|
@@ -235,5 +233,3 @@ export default function UnsavedChangesDiscard() {
|
|
|
235
233
|
## Native
|
|
236
234
|
|
|
237
235
|
On macOS a document window that closes with changes asks with the system alert: 'Save', 'Don't Save' and 'Cancel'. When the product cannot save, use a `confirmationDialog` with 'Discard' in the `.destructive` role and 'Keep Editing' in the `.cancel` role.
|
|
238
|
-
|
|
239
|
-
Seen in: Scindo.
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
A person reaches something their plan does not include, or a limit of their plan.
|
|
4
4
|
|
|
5
|
-
**Not built yet:** Scindo's upgrade prompt on the web is an overlay built by hand that does not close on Escape, is titled 'Upgrade Required' and shows Upgrade to everyone. Commentify's upgrade Modal labels its Buttons 'Maybe Later' and 'Upgrade'.
|
|
6
|
-
|
|
7
5
|
## Do
|
|
8
6
|
|
|
9
7
|
- Say what is locked and which plan unlocks it: 'Exporting to PDF is part of the Pro plan.'
|
|
@@ -170,5 +168,3 @@ export default function UpgradePromptInline() {
|
|
|
170
168
|
## Native
|
|
171
169
|
|
|
172
170
|
On Apple show the notice in place, with an Upgrade Button only for admins. It opens the plan sheet in the app, never a link to a web page.
|
|
173
|
-
|
|
174
|
-
Seen in: Commentify, Scindo.
|