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,33 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import SegmentedControl from "../components/segmentedControl";
|
|
3
|
+
var meta = {
|
|
4
|
+
title: "Components/SegmentedControl",
|
|
5
|
+
component: SegmentedControl,
|
|
6
|
+
argTypes: {
|
|
7
|
+
size: { control: "select", options: ["medium", "small", "tiny"] },
|
|
8
|
+
"aria-label": { control: "text" },
|
|
9
|
+
},
|
|
10
|
+
decorators: [function (Story) { return <div style={{ width: 360 }}><Story /></div>; }],
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
var options = [
|
|
14
|
+
{ value: "week", label: "Week" },
|
|
15
|
+
{ value: "month", label: "Month" },
|
|
16
|
+
{ value: "year", label: "Year" },
|
|
17
|
+
];
|
|
18
|
+
var Wrapper = function (args) {
|
|
19
|
+
var _a = useState(args.value), value = _a[0], setValue = _a[1];
|
|
20
|
+
return <SegmentedControl {...args} value={value} onChange={setValue}/>;
|
|
21
|
+
};
|
|
22
|
+
export var Default = {
|
|
23
|
+
render: function (args) { return <Wrapper {...args}/>; },
|
|
24
|
+
args: { options: options, value: "month", "aria-label": "Range" },
|
|
25
|
+
};
|
|
26
|
+
export var Small = {
|
|
27
|
+
render: function (args) { return <Wrapper {...args}/>; },
|
|
28
|
+
args: { options: options, value: "week", "aria-label": "Range", size: "small" },
|
|
29
|
+
};
|
|
30
|
+
export var Fit = {
|
|
31
|
+
render: function (args) { return <Wrapper {...args}/>; },
|
|
32
|
+
args: { options: options, value: "week", "aria-label": "Range", size: "small", width: "fit" },
|
|
33
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import SettingsSection from "../components/settingsSection";
|
|
3
|
+
declare const meta: Meta<typeof SettingsSection>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SettingsSection>;
|
|
6
|
+
export declare const Sections: Story;
|
|
7
|
+
export declare const Danger: Story;
|
|
8
|
+
export declare const Layout: Story;
|
|
9
|
+
export declare const LayoutStrictMode: StoryObj<{
|
|
10
|
+
initialOpen: boolean;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SettingsSection, { SettingsColumns, SettingsLayout } from "../components/settingsSection";
|
|
3
|
+
import FormField from "../components/formField";
|
|
4
|
+
import TextField from "../components/textField";
|
|
5
|
+
import Switch from "../components/switch";
|
|
6
|
+
import Button from "../components/button";
|
|
7
|
+
import Paragraph from "../components/paragraph";
|
|
8
|
+
import Navigation, { NavigationGroup } from "../components/navigation";
|
|
9
|
+
import MenuItem from "../components/menuItem";
|
|
10
|
+
var meta = {
|
|
11
|
+
title: "Components/SettingsSection",
|
|
12
|
+
component: SettingsSection,
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export var Sections = {
|
|
16
|
+
render: function () { return (<div style={{ maxWidth: 880 }}>
|
|
17
|
+
<SettingsColumns>
|
|
18
|
+
<SettingsSection id="settings-profile" title="Profile" description="How others see you in Acme.">
|
|
19
|
+
<FormField id="settings-name" label="Name">
|
|
20
|
+
{function (f) { return <TextField id={f.id} aria-describedby={f["aria-describedby"]} value="Dana Lee" onChange={function () { }}/>; }}
|
|
21
|
+
</FormField>
|
|
22
|
+
<FormField id="settings-email" label="Email">
|
|
23
|
+
{function (f) { return <TextField id={f.id} aria-describedby={f["aria-describedby"]} value="dana@acme.example" onChange={function () { }}/>; }}
|
|
24
|
+
</FormField>
|
|
25
|
+
</SettingsSection>
|
|
26
|
+
<SettingsSection id="settings-notifications" title="Notifications" description="Choose what reaches your inbox.">
|
|
27
|
+
<Switch id="settings-mentions" label="Mentions" description="When someone mentions you." checked onChange={function () { }}/>
|
|
28
|
+
<Switch id="settings-digest" label="Weekly digest" checked={false} onChange={function () { }}/>
|
|
29
|
+
</SettingsSection>
|
|
30
|
+
</SettingsColumns>
|
|
31
|
+
</div>); },
|
|
32
|
+
};
|
|
33
|
+
export var Danger = {
|
|
34
|
+
render: function () { return (<div style={{ maxWidth: 440 }}>
|
|
35
|
+
<SettingsSection id="settings-danger" tone="danger" title="Delete workspace" description="Removes Acme and everything in it. This cannot be undone.">
|
|
36
|
+
<Button type="secondary" color="danger" label="Delete Workspace" state="enabled" size="medium"/>
|
|
37
|
+
</SettingsSection>
|
|
38
|
+
</div>); },
|
|
39
|
+
};
|
|
40
|
+
// At 375px only the nav shows until an item is chosen, then only the content and a back Button (tests/interactions.spec.ts checks it).
|
|
41
|
+
function LayoutProbe(_a) {
|
|
42
|
+
var _b = _a.initialOpen, initialOpen = _b === void 0 ? false : _b;
|
|
43
|
+
var _c = React.useState(initialOpen), open = _c[0], setOpen = _c[1];
|
|
44
|
+
return (<SettingsLayout showContent={open} back={<Button type="tertiary" size="small" state="enabled" label="Back to Settings" onClickButton={function () { return setOpen(false); }}/>} nav={<Navigation aria-label="Settings">
|
|
45
|
+
<NavigationGroup label="Account">
|
|
46
|
+
<MenuItem label="Profile" iconName="User" role="button" aria-current={open ? "page" : undefined} onClick={function () { return setOpen(true); }}/>
|
|
47
|
+
</NavigationGroup>
|
|
48
|
+
</Navigation>}>
|
|
49
|
+
<SettingsSection title="Profile" description="How others see you in Acme.">
|
|
50
|
+
<Paragraph>Dana Lee</Paragraph>
|
|
51
|
+
</SettingsSection>
|
|
52
|
+
</SettingsLayout>);
|
|
53
|
+
}
|
|
54
|
+
export var Layout = {
|
|
55
|
+
render: function () { return <LayoutProbe />; },
|
|
56
|
+
};
|
|
57
|
+
// For tests/interactions.spec.ts only: under StrictMode the mount effect runs twice, and a load at 375px must still focus nothing
|
|
58
|
+
export var LayoutStrictMode = {
|
|
59
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
60
|
+
args: { initialOpen: false },
|
|
61
|
+
render: function (args) { return (<React.StrictMode>
|
|
62
|
+
<LayoutProbe {...args}/>
|
|
63
|
+
</React.StrictMode>); },
|
|
64
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import SourceCard from "../components/sourceCard";
|
|
3
|
+
declare const meta: Meta<typeof SourceCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SourceCard>;
|
|
6
|
+
export declare const Grid: Story;
|
|
7
|
+
export declare const Static: Story;
|
|
8
|
+
export declare const WithAction: Story;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CheckSquare, FileText, MessageSquare, Paperclip } from "lucide-react";
|
|
3
|
+
import SourceCard from "../components/sourceCard";
|
|
4
|
+
import { Grid as CardGrid } from "../components/layout";
|
|
5
|
+
var meta = {
|
|
6
|
+
title: "Components/SourceCard",
|
|
7
|
+
component: SourceCard,
|
|
8
|
+
decorators: [
|
|
9
|
+
function (Story) { return (<div style={{ maxWidth: "560px" }}>
|
|
10
|
+
<Story />
|
|
11
|
+
</div>); },
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
export var Grid = {
|
|
16
|
+
render: function () { return (<CardGrid columns={2}>
|
|
17
|
+
<SourceCard icon={FileText} title="Pricing notes" meta="Knowledge base · Updated Mar 4" href="/docs/pricing"/>
|
|
18
|
+
<SourceCard icon={Paperclip} title="q3-budget.xlsx" meta="Files" href="/files/q3-budget"/>
|
|
19
|
+
<SourceCard icon={MessageSquare} title="Launch plan thread" meta="Chat · #launch" href="/chat/launch"/>
|
|
20
|
+
<SourceCard icon={CheckSquare} title="Write the release notes" meta="Task · Due Friday" onClick={function () { }}/>
|
|
21
|
+
<SourceCard icon={FileText} title="A very long document title that cannot fit on one line of the card" meta="A very long place name that cannot fit on one line of the card either" href="https://example.com/long"/>
|
|
22
|
+
<SourceCard icon={FileText} title="Roadmap" href="/docs/roadmap"/>
|
|
23
|
+
</CardGrid>); },
|
|
24
|
+
};
|
|
25
|
+
export var Static = {
|
|
26
|
+
render: function () { return <SourceCard icon={FileText} title="Weekly summary" meta="Made by Acme Agent · Today"/>; },
|
|
27
|
+
};
|
|
28
|
+
export var WithAction = {
|
|
29
|
+
render: function () { return (<CardGrid columns={2}>
|
|
30
|
+
<SourceCard icon={FileText} title="Pricing notes" meta="Knowledge base" action="Open" href="/docs/pricing"/>
|
|
31
|
+
<SourceCard icon={CheckSquare} title="Write the release notes" meta="Task" action="Show" onClick={function () { }}/>
|
|
32
|
+
</CardGrid>); },
|
|
33
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import StepList from "../components/stepList";
|
|
3
|
+
declare const meta: Meta<typeof StepList>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof StepList>;
|
|
6
|
+
export declare const Progress: Story;
|
|
7
|
+
export declare const Plan: Story;
|
|
8
|
+
export declare const Ended: Story;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import StepList from "../components/stepList";
|
|
3
|
+
var meta = {
|
|
4
|
+
title: "Components/StepList",
|
|
5
|
+
component: StepList,
|
|
6
|
+
decorators: [
|
|
7
|
+
function (Story) { return (<div style={{ maxWidth: "400px" }}>
|
|
8
|
+
<Story />
|
|
9
|
+
</div>); },
|
|
10
|
+
],
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export var Progress = {
|
|
14
|
+
render: function () { return (<StepList aria-label="Acme Agent progress" steps={[
|
|
15
|
+
{ label: "Read the file", status: "done" },
|
|
16
|
+
{ label: "Find the failing test", status: "done" },
|
|
17
|
+
{ label: "Edit the code", status: "running", detail: "src/billing.ts" },
|
|
18
|
+
{ label: "Run the tests" },
|
|
19
|
+
{ label: "Write a summary" },
|
|
20
|
+
]}/>); },
|
|
21
|
+
};
|
|
22
|
+
export var Plan = {
|
|
23
|
+
render: function () { return (<StepList numbered aria-label="Plan" steps={[
|
|
24
|
+
{ label: "Back up the project" },
|
|
25
|
+
{ label: "Update the billing code", detail: "Changes 3 files" },
|
|
26
|
+
{ label: "Run the tests" },
|
|
27
|
+
]}/>); },
|
|
28
|
+
};
|
|
29
|
+
export var Ended = {
|
|
30
|
+
render: function () { return (<StepList aria-label="Import" steps={[
|
|
31
|
+
{ label: "Read the file", status: "done" },
|
|
32
|
+
{ label: "Check the rows", status: "failed", detail: "Row 12 has no email address" },
|
|
33
|
+
{ label: "Save the people", status: "cancelled" },
|
|
34
|
+
]}/>); },
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import Switch from "../components/switch";
|
|
3
|
+
declare const meta: Meta<typeof Switch>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Switch>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithDescription: Story;
|
|
8
|
+
export declare const Busy: Story;
|
|
9
|
+
export declare const Error: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
11
|
+
interface ProbeArgs {
|
|
12
|
+
fails: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Probe: StoryObj<ProbeArgs>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
+
import Switch from "../components/switch";
|
|
3
|
+
import Paragraph from "../components/paragraph";
|
|
4
|
+
var meta = {
|
|
5
|
+
title: "Components/Switch",
|
|
6
|
+
component: Switch,
|
|
7
|
+
argTypes: {
|
|
8
|
+
label: { control: "text" },
|
|
9
|
+
description: { control: "text" },
|
|
10
|
+
checked: { control: "boolean" },
|
|
11
|
+
disabled: { control: "boolean" },
|
|
12
|
+
busy: { control: "boolean" },
|
|
13
|
+
error: { control: "text" },
|
|
14
|
+
},
|
|
15
|
+
decorators: [function (Story) { return <div style={{ width: 360 }}><Story /></div>; }],
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
var SwitchWrapper = function (args) {
|
|
19
|
+
var _a = useState(!!args.checked), checked = _a[0], setChecked = _a[1];
|
|
20
|
+
return <Switch {...args} checked={checked} onChange={setChecked}/>;
|
|
21
|
+
};
|
|
22
|
+
export var Default = {
|
|
23
|
+
render: function (args) { return <SwitchWrapper {...args}/>; },
|
|
24
|
+
args: { id: "switch-default", label: "Email alerts", checked: true },
|
|
25
|
+
};
|
|
26
|
+
export var WithDescription = {
|
|
27
|
+
render: function (args) { return <SwitchWrapper {...args}/>; },
|
|
28
|
+
args: {
|
|
29
|
+
id: "switch-description",
|
|
30
|
+
label: "Weekly summary",
|
|
31
|
+
description: "A short email every Monday with last week's activity.",
|
|
32
|
+
checked: false,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export var Busy = {
|
|
36
|
+
render: function (args) { return <SwitchWrapper {...args}/>; },
|
|
37
|
+
args: { id: "switch-busy", label: "Email alerts", checked: true, busy: true },
|
|
38
|
+
};
|
|
39
|
+
export var Error = {
|
|
40
|
+
render: function (args) { return <SwitchWrapper {...args}/>; },
|
|
41
|
+
args: {
|
|
42
|
+
id: "switch-error",
|
|
43
|
+
label: "Email alerts",
|
|
44
|
+
checked: false,
|
|
45
|
+
error: "Could not save. Try again.",
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export var Disabled = {
|
|
49
|
+
render: function (args) { return <SwitchWrapper {...args}/>; },
|
|
50
|
+
args: { id: "switch-disabled", label: "Email alerts", checked: true, disabled: true },
|
|
51
|
+
};
|
|
52
|
+
// For tests/interactions.spec.ts: the parent sets `busy`, then keeps the new value or, when `fails`,
|
|
53
|
+
// puts `checked` back and sets `error`. The Switch itself stays controlled.
|
|
54
|
+
function ProbeBox(_a) {
|
|
55
|
+
var fails = _a.fails;
|
|
56
|
+
var _b = useState(false), checked = _b[0], setChecked = _b[1];
|
|
57
|
+
var _c = useState(false), busy = _c[0], setBusy = _c[1];
|
|
58
|
+
var _d = useState(), error = _d[0], setError = _d[1];
|
|
59
|
+
var _e = useState(0), calls = _e[0], setCalls = _e[1];
|
|
60
|
+
var timer = useRef(undefined);
|
|
61
|
+
useEffect(function () { return function () { return clearTimeout(timer.current); }; }, []);
|
|
62
|
+
var change = function (next) {
|
|
63
|
+
setCalls(function (n) { return n + 1; });
|
|
64
|
+
setError(undefined);
|
|
65
|
+
setBusy(true);
|
|
66
|
+
setChecked(next);
|
|
67
|
+
timer.current = setTimeout(function () {
|
|
68
|
+
setBusy(false);
|
|
69
|
+
if (fails) {
|
|
70
|
+
setChecked(!next);
|
|
71
|
+
setError("Could not save. Try again.");
|
|
72
|
+
}
|
|
73
|
+
}, 300);
|
|
74
|
+
};
|
|
75
|
+
return (<div style={{ width: 360 }}>
|
|
76
|
+
<Switch id="probe-switch" label="Email alerts" checked={checked} busy={busy} error={error} onChange={change}/>
|
|
77
|
+
<Paragraph>
|
|
78
|
+
Calls: <output data-testid="calls">{calls}</output>
|
|
79
|
+
</Paragraph>
|
|
80
|
+
</div>);
|
|
81
|
+
}
|
|
82
|
+
export var Probe = {
|
|
83
|
+
// For tests/interactions.spec.ts only: hidden from the sidebar and the docs, and skipped by the visual gate
|
|
84
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
85
|
+
args: { fails: false },
|
|
86
|
+
render: function (args) { return <ProbeBox {...args}/>; },
|
|
87
|
+
};
|
|
@@ -191,3 +191,16 @@ export var ReadOnly = {
|
|
|
191
191
|
size: "medium",
|
|
192
192
|
},
|
|
193
193
|
};
|
|
194
|
+
// A search field has no visible label, so `aria-label` names it. `role="combobox"` with `aria-expanded`,
|
|
195
|
+
// `aria-controls` and `aria-activedescendant` points it at a list under it, as in a quick switcher.
|
|
196
|
+
export var SearchWithName = {
|
|
197
|
+
render: function (args) { return <TextFieldWrapper {...args}/>; },
|
|
198
|
+
args: {
|
|
199
|
+
id: "search-textfield",
|
|
200
|
+
type: "search",
|
|
201
|
+
"aria-label": "Search invoices",
|
|
202
|
+
placeholder: "Search invoices",
|
|
203
|
+
value: "",
|
|
204
|
+
size: "medium",
|
|
205
|
+
},
|
|
206
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import UserImage from "../components/userImage";
|
|
3
|
+
import Surface from "../components/surface";
|
|
3
4
|
var meta = {
|
|
4
5
|
title: "Components/UserImage",
|
|
5
6
|
component: UserImage,
|
|
@@ -54,3 +55,21 @@ export var Sizes = {
|
|
|
54
55
|
<UserImage userHandle="Jane Smith" userImgUrl="https://i.pravatar.cc/150?img=5" size={48} referrerPolicy="no-referrer"/>
|
|
55
56
|
</div>); },
|
|
56
57
|
};
|
|
58
|
+
// An agent shows an icon on the panel background, never a photo or an initial. `userHandle` is its accessible name.
|
|
59
|
+
export var Icon = {
|
|
60
|
+
render: function () { return (<div style={{ display: "flex", gap: "8px", alignItems: "center" }}>
|
|
61
|
+
<UserImage userHandle="Acme Agent" icon="Bot"/>
|
|
62
|
+
<UserImage userHandle="Acme Agent" icon="Bot" size={32}/>
|
|
63
|
+
<UserImage userHandle="Acme Agent" icon="Sparkles" size={48}/>
|
|
64
|
+
</div>); },
|
|
65
|
+
};
|
|
66
|
+
// The icon circle reads on the page and on a panel, in light and dark.
|
|
67
|
+
export var IconOnPanel = {
|
|
68
|
+
render: function () { return (<Surface>
|
|
69
|
+
<div style={{ display: "flex", gap: "8px", alignItems: "center" }}>
|
|
70
|
+
<UserImage userHandle="Acme Agent" icon="Bot"/>
|
|
71
|
+
<UserImage userHandle="Acme Agent" icon="Bot" size={32}/>
|
|
72
|
+
<UserImage userHandle="Acme Agent" icon="Sparkles" size={48}/>
|
|
73
|
+
</div>
|
|
74
|
+
</Surface>); },
|
|
75
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneslash-design-system",
|
|
3
3
|
"description": "A design system for the Oneslash projects",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.18.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./components/useHotkey": {
|
|
15
|
+
"types": "./dist/components/useHotkey.d.ts",
|
|
16
|
+
"default": "./dist/components/useHotkey.js"
|
|
17
|
+
},
|
|
14
18
|
"./components/*": {
|
|
15
19
|
"types": "./dist/components/*.d.ts",
|
|
16
20
|
"default": "./dist/components/*.jsx"
|
|
@@ -47,8 +51,9 @@
|
|
|
47
51
|
"pretest": "npm run build",
|
|
48
52
|
"test": "node --test scripts/*.test.js scripts/tokens/*.test.js scripts/cases/*.test.js",
|
|
49
53
|
"check:contrast": "node scripts/check-contrast.js",
|
|
50
|
-
"test:visual": "playwright test",
|
|
51
|
-
"test:visual:update": "playwright test --update-snapshots"
|
|
54
|
+
"test:visual": "playwright test tests/stories.spec.ts",
|
|
55
|
+
"test:visual:update": "playwright test tests/stories.spec.ts --update-snapshots",
|
|
56
|
+
"test:interactions": "playwright test tests/interactions.spec.ts"
|
|
52
57
|
},
|
|
53
58
|
"dependencies": {
|
|
54
59
|
"@popperjs/core": "^2.11.8",
|