oneslash-design-system 2.18.0 → 2.19.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 +26 -1
- package/dist/cases/app-shell/sidebar.d.ts +1 -0
- package/dist/cases/app-shell/sidebar.jsx +124 -0
- package/dist/cases/app-shell/top-tabs.d.ts +1 -0
- package/dist/cases/app-shell/top-tabs.jsx +106 -0
- package/dist/cases/app-shell.md +364 -0
- package/dist/cases/artifact-card/card.jsx +32 -6
- package/dist/cases/artifact-card.md +55 -7
- package/dist/cases/error-page/in-shell.jsx +26 -17
- package/dist/cases/error-page.md +42 -21
- package/dist/cases/master-detail/list-then-page.d.ts +1 -0
- package/dist/cases/master-detail/list-then-page.jsx +65 -0
- package/dist/cases/master-detail/split.d.ts +1 -0
- package/dist/cases/master-detail/split.jsx +49 -0
- package/dist/cases/master-detail.md +213 -0
- package/dist/cases/mobile-menu/links.d.ts +1 -0
- package/dist/cases/mobile-menu/links.jsx +24 -0
- package/dist/cases/mobile-menu/sections.d.ts +1 -0
- package/dist/cases/mobile-menu/sections.jsx +61 -0
- package/dist/cases/mobile-menu.md +170 -0
- package/dist/cases/not-found-page/in-shell.jsx +26 -17
- package/dist/cases/not-found-page.md +41 -20
- package/dist/cases/on-this-page/aside.d.ts +1 -0
- package/dist/cases/on-this-page/aside.jsx +39 -0
- package/dist/cases/on-this-page.md +80 -0
- package/dist/cases/page-header/actions.d.ts +1 -0
- package/dist/cases/page-header/actions.jsx +65 -0
- package/dist/cases/page-header/sub-page.d.ts +1 -0
- package/dist/cases/page-header/sub-page.jsx +37 -0
- package/dist/cases/page-header.md +195 -0
- package/dist/cases/phone-navigation.md +32 -0
- package/dist/cases/route-loading/region.jsx +27 -18
- package/dist/cases/route-loading.md +42 -21
- package/dist/cases/side-pane/beside.d.ts +1 -0
- package/dist/cases/side-pane/beside.jsx +79 -0
- package/dist/cases/side-pane/over.d.ts +1 -0
- package/dist/cases/side-pane/over.jsx +58 -0
- package/dist/cases/side-pane.md +238 -0
- package/dist/cases/sidebar-nav/flat.d.ts +1 -0
- package/dist/cases/sidebar-nav/flat.jsx +81 -0
- package/dist/cases/sidebar-nav/nested.d.ts +1 -0
- package/dist/cases/sidebar-nav/nested.jsx +122 -0
- package/dist/cases/sidebar-nav.md +261 -0
- package/dist/cases/site-footer/columns.d.ts +1 -0
- package/dist/cases/site-footer/columns.jsx +51 -0
- package/dist/cases/site-footer/simple.d.ts +1 -0
- package/dist/cases/site-footer/simple.jsx +24 -0
- package/dist/cases/site-footer.md +133 -0
- package/dist/cases/site-header/links.d.ts +1 -0
- package/dist/cases/site-header/links.jsx +26 -0
- package/dist/cases/site-header/sections.d.ts +1 -0
- package/dist/cases/site-header/sections.jsx +64 -0
- package/dist/cases/site-header.md +183 -0
- package/dist/cases/theme-switcher/menu.d.ts +1 -0
- package/dist/cases/theme-switcher/menu.jsx +47 -0
- package/dist/cases/theme-switcher/segmented.d.ts +1 -0
- package/dist/cases/theme-switcher/segmented.jsx +26 -0
- package/dist/cases/theme-switcher.md +149 -0
- package/dist/cases.json +666 -19
- package/dist/components/appShell.d.ts +44 -0
- package/dist/components/appShell.jsx +121 -0
- package/dist/components/drawer.d.ts +31 -0
- package/dist/components/drawer.jsx +121 -0
- package/dist/components/heading.d.ts +3 -1
- package/dist/components/heading.jsx +2 -2
- package/dist/components/link.d.ts +6 -1
- package/dist/components/link.jsx +11 -3
- package/dist/components/menuItem.d.ts +7 -1
- package/dist/components/menuItem.jsx +4 -3
- package/dist/components/modal.jsx +12 -23
- package/dist/components/onThisPage.d.ts +29 -0
- package/dist/components/onThisPage.jsx +151 -0
- package/dist/components/pageShell.d.ts +7 -1
- package/dist/components/pageShell.jsx +14 -1
- package/dist/components/popover.jsx +4 -0
- package/dist/components/settingsSection.d.ts +6 -1
- package/dist/components/settingsSection.jsx +10 -3
- package/dist/components/sidePane.d.ts +32 -0
- package/dist/components/sidePane.jsx +128 -0
- package/dist/components/siteFooter.d.ts +24 -0
- package/dist/components/siteFooter.jsx +48 -0
- package/dist/components/siteHeader.d.ts +55 -0
- package/dist/components/siteHeader.jsx +125 -0
- package/dist/components/titleBar.d.ts +17 -0
- package/dist/components/titleBar.jsx +17 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/internal/overlayStack.d.ts +24 -0
- package/dist/internal/overlayStack.js +71 -0
- package/dist/internal/resize.d.ts +9 -0
- package/dist/internal/resize.js +31 -0
- package/dist/internal/scrollSpy.d.ts +24 -0
- package/dist/internal/scrollSpy.js +53 -0
- package/dist/internal/siteBrand.d.ts +6 -0
- package/dist/internal/siteBrand.jsx +11 -0
- package/dist/native-mapping.json +43 -1
- package/dist/stories/AppShell.stories.d.ts +15 -0
- package/dist/stories/AppShell.stories.jsx +137 -0
- package/dist/stories/Cases.generated.stories.d.ts +19 -0
- package/dist/stories/Cases.generated.stories.jsx +38 -0
- package/dist/stories/Drawer.stories.d.ts +10 -0
- package/dist/stories/Drawer.stories.jsx +123 -0
- package/dist/stories/Link.stories.d.ts +1 -0
- package/dist/stories/Link.stories.jsx +8 -0
- package/dist/stories/OnThisPage.stories.d.ts +10 -0
- package/dist/stories/OnThisPage.stories.jsx +105 -0
- package/dist/stories/SettingsSection.stories.d.ts +1 -0
- package/dist/stories/SettingsSection.stories.jsx +27 -0
- package/dist/stories/SidePane.stories.d.ts +6 -0
- package/dist/stories/SidePane.stories.jsx +37 -0
- package/dist/stories/SiteFooter.stories.d.ts +7 -0
- package/dist/stories/SiteFooter.stories.jsx +63 -0
- package/dist/stories/SiteHeader.stories.d.ts +10 -0
- package/dist/stories/SiteHeader.stories.jsx +94 -0
- package/dist/stories/TitleBar.stories.d.ts +6 -0
- package/dist/stories/TitleBar.stories.jsx +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import SidePane from "../components/sidePane";
|
|
3
|
+
import IconButton from "../components/iconButton";
|
|
4
|
+
import Paragraph from "../components/paragraph";
|
|
5
|
+
import TitleBar from "../components/titleBar";
|
|
6
|
+
var meta = {
|
|
7
|
+
title: "Components/SidePane",
|
|
8
|
+
component: SidePane,
|
|
9
|
+
parameters: { layout: "fullscreen" },
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
// A page with a document open beside it. From lg up the pane's start edge is a handle: drag it, or
|
|
13
|
+
// focus it and press the arrow keys (16px a step), Home and End.
|
|
14
|
+
function ResizableBox() {
|
|
15
|
+
var _a = useState(true), open = _a[0], setOpen = _a[1];
|
|
16
|
+
var _b = useState(448), width = _b[0], setWidth = _b[1];
|
|
17
|
+
return (<div style={{ margin: "-1rem", display: "flex", height: "100dvh" }}>
|
|
18
|
+
{/* Below lg the open pane takes the page's place, as in AppShell */}
|
|
19
|
+
<div style={{ flex: 1, minWidth: 0, padding: "24px" }} className={open ? "hidden lg:block" : undefined}>
|
|
20
|
+
<TitleBar title="Launch plan" actions={<IconButton color="iconOnly" state={open ? "selected" : "enabled"} size="medium" iconName="FileText" ariaLabel="Brief" aria-expanded={open} onClick={function () { return setOpen(true); }}/>}/>
|
|
21
|
+
<div style={{ marginTop: "16px" }}>
|
|
22
|
+
<Paragraph tone="secondary">Ben Carter: the brief is in the pane. Leave notes on anything that needs a change.</Paragraph>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
{open && (<SidePane title="Brief" onClose={function () { return setOpen(false); }} width={width} onWidthChange={setWidth}>
|
|
26
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "12px" }}>
|
|
27
|
+
<Paragraph measure="none">Acme ships the new home page on Friday. Omar Reyes owns the copy and Dana Lee the screens.</Paragraph>
|
|
28
|
+
<Paragraph measure="none" tone="secondary">The pane stays beside the page, so the thread and the brief read together.</Paragraph>
|
|
29
|
+
</div>
|
|
30
|
+
</SidePane>)}
|
|
31
|
+
</div>);
|
|
32
|
+
}
|
|
33
|
+
// Also shot at 375px by tests/stories.spec.ts (the "shell" tag): there the pane takes the whole width
|
|
34
|
+
export var Resizable = {
|
|
35
|
+
tags: ["shell"],
|
|
36
|
+
render: function () { return <ResizableBox />; },
|
|
37
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import SiteFooter from "../components/siteFooter";
|
|
3
|
+
declare const meta: Meta<typeof SiteFooter>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SiteFooter>;
|
|
6
|
+
export declare const Columns: Story;
|
|
7
|
+
export declare const Simple: Story;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SiteFooter from "../components/siteFooter";
|
|
3
|
+
var meta = {
|
|
4
|
+
title: "Components/SiteFooter",
|
|
5
|
+
component: SiteFooter,
|
|
6
|
+
parameters: { layout: "fullscreen" },
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
var Bleed = function (_a) {
|
|
10
|
+
var children = _a.children;
|
|
11
|
+
return <div style={{ margin: "-1rem" }}>{children}</div>;
|
|
12
|
+
};
|
|
13
|
+
var brand = { href: "/", name: "Acme" };
|
|
14
|
+
var columns = [
|
|
15
|
+
{
|
|
16
|
+
title: "Product",
|
|
17
|
+
links: [
|
|
18
|
+
{ label: "Features", href: "#features" },
|
|
19
|
+
{ label: "Pricing", href: "#pricing" },
|
|
20
|
+
{ label: "Changelog", href: "#changelog" },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "Company",
|
|
25
|
+
links: [
|
|
26
|
+
{ label: "About", href: "#about" },
|
|
27
|
+
{ label: "Careers", href: "#careers" },
|
|
28
|
+
{ label: "Contact", href: "#contact" },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: "Resources",
|
|
33
|
+
links: [
|
|
34
|
+
{ label: "Documentation", href: "#documentation" },
|
|
35
|
+
{ label: "Status", href: "https://status.example.com", external: true },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: "Legal",
|
|
40
|
+
links: [
|
|
41
|
+
{ label: "Privacy", href: "#privacy" },
|
|
42
|
+
{ label: "Terms of Use", href: "#terms" },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
// Also shot at 375px by tests/stories.spec.ts (the "shell" tag): two columns across
|
|
47
|
+
export var Columns = {
|
|
48
|
+
tags: ["shell"],
|
|
49
|
+
render: function () { return (<Bleed>
|
|
50
|
+
<SiteFooter brand={brand} columns={columns} legal="© 2026 Acme"/>
|
|
51
|
+
</Bleed>); },
|
|
52
|
+
};
|
|
53
|
+
export var Simple = {
|
|
54
|
+
tags: ["shell"],
|
|
55
|
+
render: function () { return (<Bleed>
|
|
56
|
+
<SiteFooter links={[
|
|
57
|
+
{ label: "Privacy", href: "#privacy" },
|
|
58
|
+
{ label: "Terms of Use", href: "#terms" },
|
|
59
|
+
{ label: "Status", href: "https://status.example.com", external: true },
|
|
60
|
+
{ label: "Contact", href: "#contact" },
|
|
61
|
+
]} legal="© 2026 Acme"/>
|
|
62
|
+
</Bleed>); },
|
|
63
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import SiteHeader from "../components/siteHeader";
|
|
3
|
+
declare const meta: Meta<typeof SiteHeader>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SiteHeader>;
|
|
6
|
+
export declare const Links: Story;
|
|
7
|
+
export declare const Phone: Story;
|
|
8
|
+
export declare const LongLabels: Story;
|
|
9
|
+
export declare const Probe: Story;
|
|
10
|
+
export declare const UnmountProbe: Story;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import SiteHeader from "../components/siteHeader";
|
|
3
|
+
import Button from "../components/button";
|
|
4
|
+
import Paragraph from "../components/paragraph";
|
|
5
|
+
var meta = {
|
|
6
|
+
title: "Components/SiteHeader",
|
|
7
|
+
component: SiteHeader,
|
|
8
|
+
parameters: { layout: "fullscreen" },
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
// The story frame pads its content; a site header is the top of a page, so it takes the padding back
|
|
12
|
+
var Bleed = function (_a) {
|
|
13
|
+
var children = _a.children;
|
|
14
|
+
return <div style={{ margin: "-1rem" }}>{children}</div>;
|
|
15
|
+
};
|
|
16
|
+
// A square mark for Acme, inline so the story needs no network
|
|
17
|
+
var logo = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='28' viewBox='0 0 96 28'%3E%3Crect width='28' height='28' rx='7' fill='%23336' /%3E%3Ctext x='36' y='21' font-family='sans-serif' font-size='18' font-weight='700' fill='%23336'%3EAcme%3C/text%3E%3C/svg%3E";
|
|
18
|
+
var brand = { href: "/", name: "Acme", src: logo, width: 96, height: 28 };
|
|
19
|
+
var links = [
|
|
20
|
+
{ label: "Features", href: "#features", current: true },
|
|
21
|
+
{ label: "Pricing", href: "#pricing" },
|
|
22
|
+
{ label: "Documentation", href: "#documentation" },
|
|
23
|
+
{ label: "Changelog", href: "#changelog" },
|
|
24
|
+
{ label: "Company", href: "#company" },
|
|
25
|
+
];
|
|
26
|
+
// Log In is secondary: in the menu below md. Sign Up is the main action: in the bar at every width.
|
|
27
|
+
var actions = <Button size="medium" type="tertiary" state="enabled" label="Log In" href="#log-in"/>;
|
|
28
|
+
var phoneAction = <Button size="medium" type="primary" state="enabled" label="Sign Up" href="#sign-up"/>;
|
|
29
|
+
var longLinks = [
|
|
30
|
+
{ label: "Product Features", href: "#features", current: true },
|
|
31
|
+
{ label: "Pricing and Plans", href: "#pricing" },
|
|
32
|
+
{ label: "Documentation", href: "#documentation" },
|
|
33
|
+
{ label: "Release Changelog", href: "#changelog" },
|
|
34
|
+
{ label: "About the Company", href: "#company" },
|
|
35
|
+
];
|
|
36
|
+
var Page = function () { return (<div style={{ padding: "24px", display: "flex", flexDirection: "column", gap: "12px" }}>
|
|
37
|
+
<Paragraph tone="secondary">Ship the launch plan this week. Ben Carter has the new screens.</Paragraph>
|
|
38
|
+
</div>); };
|
|
39
|
+
// Also shot at 375px by tests/stories.spec.ts (the "shell" tag): the brand, Menu and one action in the bar
|
|
40
|
+
export var Links = {
|
|
41
|
+
tags: ["shell"],
|
|
42
|
+
render: function () { return (<Bleed>
|
|
43
|
+
<SiteHeader brand={brand} links={links} actions={actions} phoneAction={phoneAction}/>
|
|
44
|
+
<Page />
|
|
45
|
+
</Bleed>); },
|
|
46
|
+
};
|
|
47
|
+
// Opens the menu once the page is up, so the story shows it
|
|
48
|
+
var OpenMenu = function (_a) {
|
|
49
|
+
var children = _a.children;
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
var _a;
|
|
52
|
+
(_a = document.querySelector('button[aria-label="Menu"]')) === null || _a === void 0 ? void 0 : _a.click();
|
|
53
|
+
}, []);
|
|
54
|
+
return <>{children}</>;
|
|
55
|
+
};
|
|
56
|
+
// Shot at 375px only (the "phone" tag): the menu open, with the links and the other action
|
|
57
|
+
export var Phone = {
|
|
58
|
+
tags: ["phone"],
|
|
59
|
+
render: function () { return (<Bleed>
|
|
60
|
+
<OpenMenu>
|
|
61
|
+
<SiteHeader brand={brand} links={links} actions={actions} phoneAction={phoneAction}/>
|
|
62
|
+
<Page />
|
|
63
|
+
</OpenMenu>
|
|
64
|
+
</Bleed>); },
|
|
65
|
+
};
|
|
66
|
+
// Shot at 768px only (the "tablet" tag): the full bar from md, with long labels
|
|
67
|
+
export var LongLabels = {
|
|
68
|
+
tags: ["tablet"],
|
|
69
|
+
render: function () { return (<Bleed>
|
|
70
|
+
<SiteHeader brand={brand} links={longLinks} actions={actions} phoneAction={phoneAction}/>
|
|
71
|
+
<Page />
|
|
72
|
+
</Bleed>); },
|
|
73
|
+
};
|
|
74
|
+
// For tests/interactions.spec.ts only: five links with long labels and two actions, checked at 375px and 768px
|
|
75
|
+
export var Probe = {
|
|
76
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
77
|
+
render: function () { return (<Bleed>
|
|
78
|
+
<SiteHeader brand={brand} links={longLinks} actions={actions} phoneAction={phoneAction}/>
|
|
79
|
+
<main id="main" tabIndex={-1}>
|
|
80
|
+
<Page />
|
|
81
|
+
</main>
|
|
82
|
+
</Bleed>); },
|
|
83
|
+
};
|
|
84
|
+
// For tests/interactions.spec.ts only: a Button that removes the header, so the test sees --os-header-offset go with it
|
|
85
|
+
export var UnmountProbe = {
|
|
86
|
+
tags: ["!dev", "!autodocs", "test-only"],
|
|
87
|
+
render: function Render() {
|
|
88
|
+
var _a = useState(true), shown = _a[0], setShown = _a[1];
|
|
89
|
+
return (<Bleed>
|
|
90
|
+
{shown && <SiteHeader brand={brand} links={links}/>}
|
|
91
|
+
<Button size="medium" type="secondary" state="enabled" label="Remove Header" onClickButton={function () { return setShown(false); }}/>
|
|
92
|
+
</Bleed>);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TitleBar from "../components/titleBar";
|
|
3
|
+
import Button from "../components/button";
|
|
4
|
+
import IconButton from "../components/iconButton";
|
|
5
|
+
import Tooltip from "../components/tooltip";
|
|
6
|
+
var meta = {
|
|
7
|
+
title: "Components/TitleBar",
|
|
8
|
+
component: TitleBar,
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
var more = <IconButton color="iconOnly" state="enabled" size="medium" iconName="MoreHorizontal" ariaLabel="More" aria-haspopup="menu"/>;
|
|
12
|
+
var newTask = <Button size="medium" type="primary" state="enabled" label="New Task" decoIcon="Plus"/>;
|
|
13
|
+
// A page's own actions: the primary Button, icon buttons with Tooltips, More last. Below md
|
|
14
|
+
// phoneActions keep the primary and fold the rest into More. A sub-page has Back, and a long title wraps.
|
|
15
|
+
// Also shot at 375px by tests/stories.spec.ts (the "shell" tag).
|
|
16
|
+
export var Actions = {
|
|
17
|
+
tags: ["shell"],
|
|
18
|
+
render: function () { return (<div style={{ display: "flex", flexDirection: "column", gap: "32px", maxWidth: 880 }}>
|
|
19
|
+
<TitleBar title="Website" actions={<>
|
|
20
|
+
{newTask}
|
|
21
|
+
<Tooltip title="Search">
|
|
22
|
+
<IconButton color="iconOnly" state="enabled" size="medium" iconName="Search" ariaLabel="Search"/>
|
|
23
|
+
</Tooltip>
|
|
24
|
+
<Tooltip title="Filter">
|
|
25
|
+
<IconButton color="iconOnly" state="enabled" size="medium" iconName="Filter" ariaLabel="Filter"/>
|
|
26
|
+
</Tooltip>
|
|
27
|
+
{more}
|
|
28
|
+
</>} phoneActions={<>
|
|
29
|
+
{newTask}
|
|
30
|
+
{more}
|
|
31
|
+
</>}/>
|
|
32
|
+
<TitleBar title="Move the sign-up form above the pricing table on the home page" back={<Button size="small" type="tertiary" state="enabled" label="Back to Website" decoIcon="ChevronLeft"/>} actions={more}/>
|
|
33
|
+
</div>); },
|
|
34
|
+
};
|