@syscore/ui-library 2.0.0-beta-publish-workflow-beta.10 → 2.0.0-beta-publish-workflow-beta.12
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/client/components/ui/avatar-identity.tsx +16 -3
- package/client/components/ui/avatar.tsx +32 -4
- package/client/components/ui/back-link.tsx +35 -0
- package/client/components/ui/button.tsx +3 -0
- package/client/components/ui/card.tsx +20 -3
- package/client/components/ui/centered-page.tsx +27 -0
- package/client/components/ui/checkbox-field.tsx +57 -0
- package/client/components/ui/data-grid.tsx +258 -0
- package/client/components/ui/dialog.tsx +6 -0
- package/client/components/ui/icon-button.tsx +45 -0
- package/client/components/ui/layout.tsx +32 -5
- package/client/components/ui/modal-panel.tsx +35 -4
- package/client/components/ui/outline-node.tsx +112 -0
- package/client/components/ui/radio-card.tsx +54 -0
- package/client/components/ui/resource-thumbnail.tsx +12 -1
- package/client/components/ui/side-nav.tsx +280 -0
- package/client/components/ui/status-pill.tsx +37 -4
- package/client/components/ui/table.tsx +26 -4
- package/client/components/ui/typography.tsx +33 -2
- package/client/global.css +980 -4
- package/client/ui/Avatar.stories.tsx +78 -0
- package/client/ui/BackLink.stories.tsx +50 -0
- package/client/ui/Button.stories.tsx +26 -0
- package/client/ui/Card.stories.tsx +30 -0
- package/client/ui/CenteredPage.stories.tsx +43 -0
- package/client/ui/CheckboxField.stories.tsx +68 -0
- package/client/ui/DataGrid.stories.tsx +114 -0
- package/client/ui/Dialog.stories.tsx +31 -0
- package/client/ui/IconButton.stories.tsx +77 -0
- package/client/ui/OutlineNode.stories.tsx +106 -0
- package/client/ui/RadioCard.stories.tsx +75 -0
- package/client/ui/SideNav.stories.tsx +105 -0
- package/client/ui/StatusPill.stories.tsx +78 -0
- package/client/ui/Table/Table.stories.tsx +32 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +105 -0
- package/dist/index.es.js +653 -40
- package/package.json +3 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { RadioCardGroup, RadioCardItem } from "../components/ui/radio-card";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Components/RadioCard",
|
|
7
|
+
component: RadioCardGroup,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
"Single choice where each option is a card with a title and a line of detail, for example a role and what it allows. Built on Radix RadioGroup.",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
} satisfies Meta<typeof RadioCardGroup>;
|
|
19
|
+
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
|
|
24
|
+
const roles = (
|
|
25
|
+
<>
|
|
26
|
+
<RadioCardItem value="customer" title="Customer" description="Uses the customer platform only." />
|
|
27
|
+
<RadioCardItem value="admin" title="Admin" description="Can manage invoices, memberships and reviews." />
|
|
28
|
+
<RadioCardItem value="super" title="Super admin" description="Everything, including roles and the audit log." />
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const Default: Story = {
|
|
33
|
+
render: () => (
|
|
34
|
+
<div style={{ width: 360 }}>
|
|
35
|
+
<RadioCardGroup defaultValue="admin">{roles}</RadioCardGroup>
|
|
36
|
+
</div>
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Disabled: Story = {
|
|
41
|
+
render: () => (
|
|
42
|
+
<div style={{ width: 360 }}>
|
|
43
|
+
<RadioCardGroup defaultValue="customer">
|
|
44
|
+
<RadioCardItem value="customer" title="Customer" description="Current role." />
|
|
45
|
+
<RadioCardItem value="admin" title="Admin" description="Not available." disabled />
|
|
46
|
+
</RadioCardGroup>
|
|
47
|
+
</div>
|
|
48
|
+
),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const AllVariants: Story = {
|
|
52
|
+
render: () => (
|
|
53
|
+
<div style={{ display: "flex", gap: 24 }}>
|
|
54
|
+
<div style={{ width: 320 }}>
|
|
55
|
+
<RadioCardGroup defaultValue="customer">{roles}</RadioCardGroup>
|
|
56
|
+
</div>
|
|
57
|
+
<div style={{ width: 320 }}>
|
|
58
|
+
<RadioCardGroup defaultValue="super">{roles}</RadioCardGroup>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const InteractiveRadioCard: Story = {
|
|
65
|
+
render: () => {
|
|
66
|
+
const [value, setValue] = React.useState("customer");
|
|
67
|
+
return (
|
|
68
|
+
<div style={{ width: 360 }}>
|
|
69
|
+
<RadioCardGroup value={value} onValueChange={setValue}>
|
|
70
|
+
{roles}
|
|
71
|
+
</RadioCardGroup>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { BarChart3, FileText, LayoutDashboard, Shield, Users } from "lucide-react";
|
|
4
|
+
import { SideNav, SideNavBranch, SideNavGroup, SideNavItem } from "../components/ui/side-nav";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Components/SideNav",
|
|
8
|
+
component: SideNav,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
"Grouped, icon-led navigation for an app shell's side panel. Put it inside `LayoutPanel` " +
|
|
16
|
+
"(`width=\"rail\"` when `collapsed`). Use `asChild` on an item to render a router link.",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta<typeof SideNav>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
function Demo({ collapsed = false }: { collapsed?: boolean }) {
|
|
27
|
+
const [current, setCurrent] = React.useState("dashboard");
|
|
28
|
+
const item = (id: string, label: string, icon: React.ReactNode) => (
|
|
29
|
+
<SideNavItem
|
|
30
|
+
icon={icon}
|
|
31
|
+
active={current === id}
|
|
32
|
+
onClick={() => setCurrent(id)}
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
</SideNavItem>
|
|
36
|
+
);
|
|
37
|
+
return (
|
|
38
|
+
<div style={{ width: collapsed ? 72 : 260, padding: "24px 12px", background: "#fff" }}>
|
|
39
|
+
<SideNav aria-label="Sections" collapsed={collapsed}>
|
|
40
|
+
<SideNavGroup label="Overview">
|
|
41
|
+
{item("dashboard", "Dashboard", <LayoutDashboard />)}
|
|
42
|
+
</SideNavGroup>
|
|
43
|
+
<SideNavGroup label="Customers & billing">
|
|
44
|
+
{item("customers", "Customers", <Users />)}
|
|
45
|
+
{item("invoices", "Invoices", <FileText />)}
|
|
46
|
+
{item("reports", "Reports", <BarChart3 />)}
|
|
47
|
+
</SideNavGroup>
|
|
48
|
+
</SideNav>
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function FoldingDemo({ collapsed = false }: { collapsed?: boolean }) {
|
|
54
|
+
const [current, setCurrent] = React.useState("users");
|
|
55
|
+
const item = (id: string, label: string, icon?: React.ReactNode) => (
|
|
56
|
+
<SideNavItem icon={icon} active={current === id} onClick={() => setCurrent(id)}>
|
|
57
|
+
{label}
|
|
58
|
+
</SideNavItem>
|
|
59
|
+
);
|
|
60
|
+
return (
|
|
61
|
+
<div style={{ width: collapsed ? 72 : 260, padding: "24px 12px", background: "#fff" }}>
|
|
62
|
+
<SideNav aria-label="Sections" collapsed={collapsed}>
|
|
63
|
+
<SideNavGroup label="Billing" collapsible>
|
|
64
|
+
{item("invoices", "Invoices", <FileText />)}
|
|
65
|
+
{item("estimates", "Estimates", <BarChart3 />)}
|
|
66
|
+
</SideNavGroup>
|
|
67
|
+
<SideNavGroup label="Administration" collapsible>
|
|
68
|
+
<SideNavBranch
|
|
69
|
+
icon={<Users />}
|
|
70
|
+
label="Users & roles"
|
|
71
|
+
active={["users", "roles", "permissions"].includes(current)}
|
|
72
|
+
defaultOpen
|
|
73
|
+
onClick={() => setCurrent("users")}
|
|
74
|
+
>
|
|
75
|
+
{item("users", "Users")}
|
|
76
|
+
{item("roles", "Roles")}
|
|
77
|
+
{item("permissions", "Permissions")}
|
|
78
|
+
</SideNavBranch>
|
|
79
|
+
{item("audit", "Audit log", <Shield />)}
|
|
80
|
+
</SideNavGroup>
|
|
81
|
+
</SideNav>
|
|
82
|
+
</div>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export const Default: Story = { render: () => <Demo /> };
|
|
87
|
+
|
|
88
|
+
export const FoldingGroupsAndBranch: Story = { render: () => <FoldingDemo /> };
|
|
89
|
+
|
|
90
|
+
export const FoldingCollapsedRail: Story = { render: () => <FoldingDemo collapsed /> };
|
|
91
|
+
export const Collapsed: Story = { render: () => <Demo collapsed /> };
|
|
92
|
+
|
|
93
|
+
export const AllVariants: Story = {
|
|
94
|
+
render: () => (
|
|
95
|
+
<div style={{ display: "flex", gap: 32 }}>
|
|
96
|
+
<Demo />
|
|
97
|
+
<Demo collapsed />
|
|
98
|
+
</div>
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const InteractiveSideNav: Story = {
|
|
103
|
+
args: { collapsed: false },
|
|
104
|
+
render: (args) => <Demo collapsed={args.collapsed} />,
|
|
105
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { StatusPill, type StatusPillTone } from "../components/ui/status-pill";
|
|
3
|
+
|
|
4
|
+
const TONES: { tone: StatusPillTone; label: string }[] = [
|
|
5
|
+
{ tone: "unpaid", label: "Unpaid" },
|
|
6
|
+
{ tone: "paid", label: "Paid" },
|
|
7
|
+
{ tone: "waived", label: "Waived" },
|
|
8
|
+
{ tone: "void", label: "Void" },
|
|
9
|
+
{ tone: "neutral", label: "Neutral" },
|
|
10
|
+
{ tone: "info", label: "Info" },
|
|
11
|
+
{ tone: "success", label: "Success" },
|
|
12
|
+
{ tone: "warning", label: "Warning" },
|
|
13
|
+
{ tone: "danger", label: "Danger" },
|
|
14
|
+
{ tone: "accent", label: "Accent" },
|
|
15
|
+
{ tone: "inactive", label: "Inactive" },
|
|
16
|
+
{ tone: "plain", label: "Plain" },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const meta = {
|
|
20
|
+
title: "Components/StatusPill",
|
|
21
|
+
component: StatusPill,
|
|
22
|
+
tags: ["autodocs"],
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: "centered",
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component:
|
|
28
|
+
"Small static status badge. `unpaid / paid / waived / void` are invoice states; " +
|
|
29
|
+
"`info / success / warning / danger / accent / inactive` are generic tones for roles, " +
|
|
30
|
+
"record states and flags.",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
} satisfies Meta<typeof StatusPill>;
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<typeof meta>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: { tone: "neutral", children: "Neutral" },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Info: Story = { args: { tone: "info", children: "Admin" } };
|
|
45
|
+
export const Success: Story = { args: { tone: "success", children: "Active" } };
|
|
46
|
+
export const Warning: Story = { args: { tone: "warning", children: "Renewal due" } };
|
|
47
|
+
export const Danger: Story = { args: { tone: "danger", children: "Overdue" } };
|
|
48
|
+
export const Accent: Story = { args: { tone: "accent", children: "Super admin" } };
|
|
49
|
+
export const Inactive: Story = { args: { tone: "inactive", children: "Deactivated" } };
|
|
50
|
+
|
|
51
|
+
export const Chip: Story = {
|
|
52
|
+
args: { tone: "info", appearance: "chip", children: "WELL admin" },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const AllVariants: Story = {
|
|
56
|
+
args: { children: "All variants" },
|
|
57
|
+
render: () => (
|
|
58
|
+
<div style={{ display: "flex", flexWrap: "wrap", gap: 8, maxWidth: 480 }}>
|
|
59
|
+
{TONES.map(({ tone, label }) => (
|
|
60
|
+
<StatusPill key={tone} tone={tone}>
|
|
61
|
+
{label}
|
|
62
|
+
</StatusPill>
|
|
63
|
+
))}
|
|
64
|
+
{TONES.map(({ tone, label }) => (
|
|
65
|
+
<StatusPill key={`chip-${tone}`} tone={tone} appearance="chip">
|
|
66
|
+
{label}
|
|
67
|
+
</StatusPill>
|
|
68
|
+
))}
|
|
69
|
+
</div>
|
|
70
|
+
),
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const InteractiveStatusPill: Story = {
|
|
74
|
+
args: { tone: "success", children: "Published" },
|
|
75
|
+
argTypes: {
|
|
76
|
+
tone: { control: "select", options: TONES.map((t) => t.tone) },
|
|
77
|
+
},
|
|
78
|
+
};
|
|
@@ -252,3 +252,35 @@ export const AllVariants: Story = {
|
|
|
252
252
|
</div>
|
|
253
253
|
),
|
|
254
254
|
};
|
|
255
|
+
|
|
256
|
+
/** `appearance="card"`: bordered, rounded card with a tinted header, soft row dividers and a hover highlight. */
|
|
257
|
+
export const CardAppearance: Story = {
|
|
258
|
+
render: () => (
|
|
259
|
+
<Table appearance="card">
|
|
260
|
+
<TableHeader>
|
|
261
|
+
<TableRow>
|
|
262
|
+
<TableHeaderCell label="Customer" />
|
|
263
|
+
<TableHeaderCell label="Role" />
|
|
264
|
+
<TableHeaderCell label="Action" align="right" />
|
|
265
|
+
</TableRow>
|
|
266
|
+
</TableHeader>
|
|
267
|
+
<TableBody>
|
|
268
|
+
{[
|
|
269
|
+
["Ananya Rao", "Customer"],
|
|
270
|
+
["Marcus Lee", "Customer"],
|
|
271
|
+
["Priya Nair", "Admin"],
|
|
272
|
+
].map(([name, role]) => (
|
|
273
|
+
<TableRow key={name}>
|
|
274
|
+
<TableCell text={name} />
|
|
275
|
+
<TableCell text={role} />
|
|
276
|
+
<TableCell align="right">
|
|
277
|
+
<TableAction aria-label={`Edit ${name}`}>
|
|
278
|
+
<Pencil size={16} />
|
|
279
|
+
</TableAction>
|
|
280
|
+
</TableCell>
|
|
281
|
+
</TableRow>
|
|
282
|
+
))}
|
|
283
|
+
</TableBody>
|
|
284
|
+
</Table>
|
|
285
|
+
),
|
|
286
|
+
};
|