oneslash-design-system 2.23.1 → 2.24.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 +13 -2
- package/dist/cases/activity-timeline/activity.d.ts +1 -0
- package/dist/cases/activity-timeline/activity.jsx +43 -0
- package/dist/cases/activity-timeline/versions.d.ts +1 -0
- package/dist/cases/activity-timeline/versions.jsx +130 -0
- package/dist/cases/activity-timeline.md +315 -0
- package/dist/cases/agent-plan-proposal.md +1 -0
- package/dist/cases/ask-page/answered.d.ts +1 -0
- package/dist/cases/ask-page/answered.jsx +240 -0
- package/dist/cases/ask-page/first-visit.d.ts +1 -0
- package/dist/cases/ask-page/first-visit.jsx +118 -0
- package/dist/cases/ask-page.md +542 -0
- package/dist/cases/chart/bars.d.ts +1 -0
- package/dist/cases/chart/bars.jsx +83 -0
- package/dist/cases/chart/lines.d.ts +1 -0
- package/dist/cases/chart/lines.jsx +71 -0
- package/dist/cases/chart.md +258 -0
- package/dist/cases/comment-thread/card.d.ts +1 -0
- package/dist/cases/comment-thread/card.jsx +141 -0
- package/dist/cases/comment-thread/thread.d.ts +1 -0
- package/dist/cases/comment-thread/thread.jsx +87 -0
- package/dist/cases/comment-thread.md +349 -0
- package/dist/cases/dashboard/numbers-first.jsx +62 -1
- package/dist/cases/dashboard.md +75 -3
- package/dist/cases/leaderboard/ranked.d.ts +1 -0
- package/dist/cases/leaderboard/ranked.jsx +44 -0
- package/dist/cases/leaderboard/table.d.ts +1 -0
- package/dist/cases/leaderboard/table.jsx +87 -0
- package/dist/cases/leaderboard.md +177 -0
- package/dist/cases/number-format.md +4 -2
- package/dist/cases/onboarding/checklist.d.ts +1 -0
- package/dist/cases/onboarding/checklist.jsx +92 -0
- package/dist/cases/onboarding/steps.d.ts +3 -0
- package/dist/cases/onboarding/steps.jsx +177 -0
- package/dist/cases/onboarding.md +368 -0
- package/dist/cases/plan-sign-off/one-approver.d.ts +1 -0
- package/dist/cases/plan-sign-off/one-approver.jsx +129 -0
- package/dist/cases/plan-sign-off/team.d.ts +1 -0
- package/dist/cases/plan-sign-off/team.jsx +213 -0
- package/dist/cases/plan-sign-off.md +541 -0
- package/dist/cases/stat-row.md +1 -1
- package/dist/cases/task-header/agent-sets-status.d.ts +1 -0
- package/dist/cases/task-header/agent-sets-status.jsx +164 -0
- package/dist/cases/task-header/people-change-status.d.ts +1 -0
- package/dist/cases/task-header/people-change-status.jsx +175 -0
- package/dist/cases/task-header.md +576 -0
- package/dist/cases.json +645 -7
- package/dist/components/barChart.d.ts +35 -0
- package/dist/components/barChart.jsx +90 -0
- package/dist/components/heading.d.ts +2 -2
- package/dist/components/heading.jsx +5 -3
- package/dist/components/lineChart.d.ts +39 -0
- package/dist/components/lineChart.jsx +128 -0
- package/dist/components/timeline.d.ts +32 -0
- package/dist/components/timeline.jsx +54 -0
- package/dist/components/titleBar.d.ts +3 -1
- package/dist/components/titleBar.jsx +9 -4
- package/dist/internal/chart.d.ts +39 -0
- package/dist/internal/chart.js +110 -0
- package/dist/internal/chartFrame.d.ts +29 -0
- package/dist/internal/chartFrame.jsx +57 -0
- package/dist/native-mapping.json +19 -1
- package/dist/stories/BarChart.stories.d.ts +10 -0
- package/dist/stories/BarChart.stories.jsx +104 -0
- package/dist/stories/Cases.generated.stories.d.ts +16 -0
- package/dist/stories/Cases.generated.stories.jsx +32 -0
- package/dist/stories/Heading.stories.d.ts +1 -0
- package/dist/stories/Heading.stories.jsx +17 -0
- package/dist/stories/LineChart.stories.d.ts +9 -0
- package/dist/stories/LineChart.stories.jsx +34 -0
- package/dist/stories/Onboarding.probe.stories.d.ts +6 -0
- package/dist/stories/Onboarding.probe.stories.jsx +12 -0
- package/dist/stories/Timeline.stories.d.ts +8 -0
- package/dist/stories/Timeline.stories.jsx +49 -0
- package/dist/stories/TitleBar.stories.d.ts +1 -0
- package/dist/stories/TitleBar.stories.jsx +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
import { useEffect, useRef, useState } from 'react';
|
|
12
|
+
import AppShell from '../../components/appShell';
|
|
13
|
+
import SidePane from '../../components/sidePane';
|
|
14
|
+
import Navigation from '../../components/navigation';
|
|
15
|
+
import MenuItem from '../../components/menuItem';
|
|
16
|
+
import TitleBar from '../../components/titleBar';
|
|
17
|
+
import IconButton from '../../components/iconButton';
|
|
18
|
+
import Tooltip from '../../components/tooltip';
|
|
19
|
+
import Heading from '../../components/heading';
|
|
20
|
+
import Paragraph from '../../components/paragraph';
|
|
21
|
+
import List from '../../components/list';
|
|
22
|
+
import Line from '../../components/line';
|
|
23
|
+
import Button from '../../components/button';
|
|
24
|
+
import Progress from '../../components/progress';
|
|
25
|
+
import Textarea from '../../components/textarea';
|
|
26
|
+
import Alert from '../../components/alert';
|
|
27
|
+
import { Cluster, Stack } from '../../components/layout';
|
|
28
|
+
var task = 'Launch checklist';
|
|
29
|
+
// A real app reads this from the session.
|
|
30
|
+
var me = 'Dana Lee';
|
|
31
|
+
// Everyone on the task signs off. Acme Agent starts only when all have.
|
|
32
|
+
var members = ['Ben Carter', 'Omar Reyes', me];
|
|
33
|
+
var steps = [
|
|
34
|
+
'Acme Agent updates the home page and its tests.',
|
|
35
|
+
'Omar Reyes writes the new copy.',
|
|
36
|
+
'Dana Lee checks the screens on a phone.',
|
|
37
|
+
'Ben Carter merges the pull request.',
|
|
38
|
+
];
|
|
39
|
+
// The places. A real app lets each link go to its page.
|
|
40
|
+
var sidebar = (<Navigation aria-label="Main">
|
|
41
|
+
<MenuItem size="small" label="Tasks" iconName="ListChecks" href="/tasks" isSelected aria-current="page" onClick={function (event) { return event.preventDefault(); }}/>
|
|
42
|
+
</Navigation>);
|
|
43
|
+
export default function PlanSignOffTeam() {
|
|
44
|
+
var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
|
|
45
|
+
// The person opened the plan from the task header. The example starts with the pane open.
|
|
46
|
+
var _b = useState(true), open = _b[0], setOpen = _b[1];
|
|
47
|
+
// Who signed and when, kept as the record.
|
|
48
|
+
var _c = useState([
|
|
49
|
+
{ name: 'Ben Carter', on: 'Nov 16, 2026' },
|
|
50
|
+
{ name: 'Omar Reyes', on: 'Nov 16, 2026' },
|
|
51
|
+
]), signers = _c[0], setSigners = _c[1];
|
|
52
|
+
var _d = useState('waiting'), step = _d[0], setStep = _d[1];
|
|
53
|
+
var _e = useState(null), pending = _e[0], setPending = _e[1];
|
|
54
|
+
var _f = useState(''), draft = _f[0], setDraft = _f[1];
|
|
55
|
+
// After a rewrite: how many sign-offs it removed. The rewrite also closed the gaps the agent found.
|
|
56
|
+
var _g = useState(null), cleared = _g[0], setCleared = _g[1];
|
|
57
|
+
var pane = useRef(null);
|
|
58
|
+
var firstHeading = useRef(null);
|
|
59
|
+
var reviewButton = useRef(null);
|
|
60
|
+
var requestButton = useRef(null);
|
|
61
|
+
var signOffButton = useRef(null);
|
|
62
|
+
var withdrawButton = useRef(null);
|
|
63
|
+
var timer = useRef();
|
|
64
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
65
|
+
var focusNext = useRef();
|
|
66
|
+
// On unmount it stops the request.
|
|
67
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
68
|
+
useEffect(function () {
|
|
69
|
+
var move = focusNext.current;
|
|
70
|
+
focusNext.current = undefined;
|
|
71
|
+
move === null || move === void 0 ? void 0 : move();
|
|
72
|
+
});
|
|
73
|
+
var waitingFor = members.filter(function (m) { return !signers.some(function (s) { return s.name === m; }); });
|
|
74
|
+
var waitingLine = waitingFor.length === 1 ? waitingFor[0] : "".concat(waitingFor.slice(0, -1).join(', '), " and ").concat(waitingFor[waitingFor.length - 1]);
|
|
75
|
+
// Dana's sign-off is in. When it was the last, Acme Agent starts: the Buttons go and focus goes to the pane's title.
|
|
76
|
+
// Otherwise 'Withdraw Sign-Off' takes the place of 'Sign Off' and takes focus.
|
|
77
|
+
function addMySignOff() {
|
|
78
|
+
var next = __spreadArray(__spreadArray([], signers, true), [{ name: me, on: 'Nov 16, 2026' }], false);
|
|
79
|
+
setSigners(next);
|
|
80
|
+
if (next.length === members.length) {
|
|
81
|
+
setStep('done');
|
|
82
|
+
focusNext.current = function () { var _a; return (_a = pane.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setStep('signed');
|
|
86
|
+
focusNext.current = function () { var _a; return (_a = withdrawButton.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Acme Agent checks the plan for gaps first. 'Sign Off' keeps its label while it checks.
|
|
90
|
+
// The first plan has two, so 'Sign Off' gives way to 'Review Plan' and 'Sign Off Anyway', and focus goes to the first.
|
|
91
|
+
function signOff() {
|
|
92
|
+
if (pending)
|
|
93
|
+
return;
|
|
94
|
+
setPending('check');
|
|
95
|
+
// Stands in for the request to the server.
|
|
96
|
+
timer.current = setTimeout(function () {
|
|
97
|
+
setPending(null);
|
|
98
|
+
if (cleared !== null) {
|
|
99
|
+
addMySignOff();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
setStep('gaps');
|
|
103
|
+
focusNext.current = function () { var _a; return (_a = reviewButton.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); };
|
|
104
|
+
}, 1200);
|
|
105
|
+
}
|
|
106
|
+
function startRequest() {
|
|
107
|
+
if (pending)
|
|
108
|
+
return;
|
|
109
|
+
setDraft('');
|
|
110
|
+
setStep('requesting');
|
|
111
|
+
}
|
|
112
|
+
// 'Discard' leaves the field and keeps the plan as it is. Focus goes back to 'Request Changes'.
|
|
113
|
+
function discard() {
|
|
114
|
+
setStep('waiting');
|
|
115
|
+
focusNext.current = function () { var _a; return (_a = requestButton.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); };
|
|
116
|
+
}
|
|
117
|
+
var empty = draft.trim() === '';
|
|
118
|
+
// 'Send' gives the agent what should change. The rewritten plan clears every sign-off, and the warning says so.
|
|
119
|
+
// Focus goes to the pane's title, so the person reads the new plan from the top.
|
|
120
|
+
function send() {
|
|
121
|
+
if (pending || empty)
|
|
122
|
+
return;
|
|
123
|
+
setPending('send');
|
|
124
|
+
// Stands in for the agent rewriting the plan.
|
|
125
|
+
timer.current = setTimeout(function () {
|
|
126
|
+
setPending(null);
|
|
127
|
+
setCleared(signers.length);
|
|
128
|
+
setSigners([]);
|
|
129
|
+
setStep('waiting');
|
|
130
|
+
focusNext.current = function () { var _a; return (_a = pane.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
131
|
+
}, 1200);
|
|
132
|
+
}
|
|
133
|
+
// Withdrawing puts Dana back on the waiting list, and 'Sign Off' comes back with focus.
|
|
134
|
+
function withdraw() {
|
|
135
|
+
if (pending)
|
|
136
|
+
return;
|
|
137
|
+
setPending('withdraw');
|
|
138
|
+
// Stands in for the request to the server.
|
|
139
|
+
timer.current = setTimeout(function () {
|
|
140
|
+
setPending(null);
|
|
141
|
+
setSigners(function (list) { return list.filter(function (s) { return s.name !== me; }); });
|
|
142
|
+
setStep('waiting');
|
|
143
|
+
focusNext.current = function () { var _a; return (_a = signOffButton.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); };
|
|
144
|
+
}, 1200);
|
|
145
|
+
}
|
|
146
|
+
// The person goes back to read the plan. The warning and its Buttons stay.
|
|
147
|
+
function reviewPlan() {
|
|
148
|
+
var _a;
|
|
149
|
+
(_a = firstHeading.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
150
|
+
}
|
|
151
|
+
function signOffAnyway() {
|
|
152
|
+
if (pending)
|
|
153
|
+
return;
|
|
154
|
+
setPending('sign');
|
|
155
|
+
// Stands in for the request to the server.
|
|
156
|
+
timer.current = setTimeout(function () {
|
|
157
|
+
setPending(null);
|
|
158
|
+
addMySignOff();
|
|
159
|
+
}, 1200);
|
|
160
|
+
}
|
|
161
|
+
return (<AppShell title="Tasks" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar} pane={open && (<SidePane ref={pane} title="Plan" onClose={function () { return setOpen(false); }}>
|
|
162
|
+
<Stack gap="large">
|
|
163
|
+
<Stack gap="small">
|
|
164
|
+
<Heading ref={firstHeading} tabIndex={-1} level={3} size="subtitle1">Goal</Heading>
|
|
165
|
+
<Paragraph measure="none">Ship the new home page on Nov 20, 2026, with the sign-up form above the pricing table.</Paragraph>
|
|
166
|
+
</Stack>
|
|
167
|
+
<Stack gap="small">
|
|
168
|
+
<Heading level={3} size="subtitle1">Steps</Heading>
|
|
169
|
+
<List marker="number" items={steps}/>
|
|
170
|
+
</Stack>
|
|
171
|
+
<Stack gap="small">
|
|
172
|
+
<Heading level={3} size="subtitle1">Out of scope</Heading>
|
|
173
|
+
<Paragraph measure="none">The pricing page stays as it is.</Paragraph>
|
|
174
|
+
</Stack>
|
|
175
|
+
<Paragraph size="caption" tone="secondary" measure="none">{cleared === null ? 'Written by Acme Agent, Nov 16, 2026, 2:40 PM' : 'Rewritten by Acme Agent, Nov 16, 2026, 3:10 PM'}</Paragraph>
|
|
176
|
+
<Line />
|
|
177
|
+
{/* The sign-off comes last, after the whole plan. */}
|
|
178
|
+
<Stack gap="medium">
|
|
179
|
+
<Heading level={3} size="subtitle1">Sign-off</Heading>
|
|
180
|
+
<Progress kind="share" label="Signed off" value={signers.length} max={members.length} valueText={"".concat(signers.length, " of ").concat(members.length, " people")}/>
|
|
181
|
+
{signers.length > 0 && <List items={signers.map(function (s) { return "".concat(s.name, ", ").concat(s.on); })}/>}
|
|
182
|
+
{cleared !== null && step !== 'done' && (<Alert variant="inline" type="warning" autoDismiss={false} message={"The plan changed, so the ".concat(cleared, " sign-offs were removed. Each person signs off again.")}/>)}
|
|
183
|
+
{step === 'done' ? (
|
|
184
|
+
// An inline Alert is a polite status, so a screen reader hears it.
|
|
185
|
+
<Alert variant="inline" type="success" autoDismiss={false} message="Signed off by everyone. Acme Agent starts the work."/>) : (<Paragraph measure="none">Waiting for {waitingLine}.</Paragraph>)}
|
|
186
|
+
{step === 'requesting' && (<Textarea id="plan-sign-off-team-change-request" label="What should change?" value={draft} onChange={function (e) { return setDraft(e.target.value); }} onSubmit={send} autoFocus disabled={pending === 'send'}/>)}
|
|
187
|
+
{step === 'gaps' && (<Alert variant="inline" type="warning" autoDismiss={false} message="Acme Agent found 2 gaps in the plan." secondMessage="No one owns the press kit. The support hand-off has no date."/>)}
|
|
188
|
+
{step === 'waiting' && (<Cluster gap="small">
|
|
189
|
+
<Button ref={requestButton} size="small" type="secondary" state={pending ? 'disabled' : 'enabled'} label="Request Changes" onClickButton={startRequest}/>
|
|
190
|
+
<Button ref={signOffButton} size="small" type="primary" state="enabled" label="Sign Off" loading={pending === 'check'} onClickButton={signOff}/>
|
|
191
|
+
</Cluster>)}
|
|
192
|
+
{step === 'requesting' && (<Cluster gap="small">
|
|
193
|
+
<Button size="small" type="tertiary" state={pending === 'send' ? 'disabled' : 'enabled'} label="Discard" onClickButton={discard}/>
|
|
194
|
+
<Button size="small" type="primary" state={empty ? 'disabled' : 'enabled'} label="Send" loading={pending === 'send'} onClickButton={send}/>
|
|
195
|
+
</Cluster>)}
|
|
196
|
+
{step === 'signed' && (<Cluster gap="small">
|
|
197
|
+
<Button ref={withdrawButton} size="small" type="tertiary" state="enabled" label="Withdraw Sign-Off" loading={pending === 'withdraw'} onClickButton={withdraw}/>
|
|
198
|
+
</Cluster>)}
|
|
199
|
+
{step === 'gaps' && (<Cluster gap="small">
|
|
200
|
+
<Button ref={reviewButton} size="small" type="secondary" state={pending ? 'disabled' : 'enabled'} label="Review Plan" onClickButton={reviewPlan}/>
|
|
201
|
+
<Button size="small" type="primary" state="enabled" label="Sign Off Anyway" loading={pending === 'sign'} onClickButton={signOffAnyway}/>
|
|
202
|
+
</Cluster>)}
|
|
203
|
+
</Stack>
|
|
204
|
+
</Stack>
|
|
205
|
+
</SidePane>)}>
|
|
206
|
+
<Stack gap="large">
|
|
207
|
+
<TitleBar title={task} actions={<Tooltip title="Plan">
|
|
208
|
+
<IconButton color="iconOnly" state={open ? 'selected' : 'enabled'} size="medium" iconName="FileText" ariaLabel={"Show the plan for ".concat(task)} aria-expanded={open} onClick={function () { var _a; return (open ? (_a = pane.current) === null || _a === void 0 ? void 0 : _a.focus() : setOpen(true)); }}/>
|
|
209
|
+
</Tooltip>}/>
|
|
210
|
+
<Paragraph tone="secondary" measure="none">Acme Agent wrote a plan for this task. Everyone on the task signs it off before the work starts.</Paragraph>
|
|
211
|
+
</Stack>
|
|
212
|
+
</AppShell>);
|
|
213
|
+
}
|