@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.
Files changed (38) hide show
  1. package/client/components/ui/avatar-identity.tsx +16 -3
  2. package/client/components/ui/avatar.tsx +32 -4
  3. package/client/components/ui/back-link.tsx +35 -0
  4. package/client/components/ui/button.tsx +3 -0
  5. package/client/components/ui/card.tsx +20 -3
  6. package/client/components/ui/centered-page.tsx +27 -0
  7. package/client/components/ui/checkbox-field.tsx +57 -0
  8. package/client/components/ui/data-grid.tsx +258 -0
  9. package/client/components/ui/dialog.tsx +6 -0
  10. package/client/components/ui/icon-button.tsx +45 -0
  11. package/client/components/ui/layout.tsx +32 -5
  12. package/client/components/ui/modal-panel.tsx +35 -4
  13. package/client/components/ui/outline-node.tsx +112 -0
  14. package/client/components/ui/radio-card.tsx +54 -0
  15. package/client/components/ui/resource-thumbnail.tsx +12 -1
  16. package/client/components/ui/side-nav.tsx +280 -0
  17. package/client/components/ui/status-pill.tsx +37 -4
  18. package/client/components/ui/table.tsx +26 -4
  19. package/client/components/ui/typography.tsx +33 -2
  20. package/client/global.css +980 -4
  21. package/client/ui/Avatar.stories.tsx +78 -0
  22. package/client/ui/BackLink.stories.tsx +50 -0
  23. package/client/ui/Button.stories.tsx +26 -0
  24. package/client/ui/Card.stories.tsx +30 -0
  25. package/client/ui/CenteredPage.stories.tsx +43 -0
  26. package/client/ui/CheckboxField.stories.tsx +68 -0
  27. package/client/ui/DataGrid.stories.tsx +114 -0
  28. package/client/ui/Dialog.stories.tsx +31 -0
  29. package/client/ui/IconButton.stories.tsx +77 -0
  30. package/client/ui/OutlineNode.stories.tsx +106 -0
  31. package/client/ui/RadioCard.stories.tsx +75 -0
  32. package/client/ui/SideNav.stories.tsx +105 -0
  33. package/client/ui/StatusPill.stories.tsx +78 -0
  34. package/client/ui/Table/Table.stories.tsx +32 -0
  35. package/dist/index.cjs.js +1 -1
  36. package/dist/index.d.ts +105 -0
  37. package/dist/index.es.js +653 -40
  38. package/package.json +3 -1
@@ -0,0 +1,78 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Avatar, AvatarFallback, AvatarImage } from "../components/ui/avatar";
3
+
4
+ const meta = {
5
+ title: "Components/Avatar",
6
+ component: Avatar,
7
+ tags: ["autodocs"],
8
+ parameters: {
9
+ layout: "centered",
10
+ docs: {
11
+ description: {
12
+ component:
13
+ "Round user avatar. `size`: `sm` (32px), `md` (40px, default), `lg` (64px), `xl` (176px). " +
14
+ "`appearance=\"brand\"` shows initials on the brand teal with a thin gradient ring, " +
15
+ "for the signed-in user's disc in a header.",
16
+ },
17
+ },
18
+ },
19
+ } satisfies Meta<typeof Avatar>;
20
+
21
+ export default meta;
22
+
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ export const Default: Story = {
26
+ render: () => (
27
+ <Avatar>
28
+ <AvatarFallback>DS</AvatarFallback>
29
+ </Avatar>
30
+ ),
31
+ };
32
+
33
+ export const WithImage: Story = {
34
+ render: () => (
35
+ <Avatar>
36
+ <AvatarImage src="https://i.pravatar.cc/80?img=12" alt="Dheeraj Sanagani" />
37
+ <AvatarFallback>DS</AvatarFallback>
38
+ </Avatar>
39
+ ),
40
+ };
41
+
42
+ export const Brand: Story = {
43
+ render: () => (
44
+ <Avatar appearance="brand">
45
+ <AvatarFallback>DS</AvatarFallback>
46
+ </Avatar>
47
+ ),
48
+ };
49
+
50
+ export const AllVariants: Story = {
51
+ render: () => (
52
+ <div style={{ display: "flex", alignItems: "center", gap: 16 }}>
53
+ {(["sm", "md", "lg", "xl"] as const).map((size) => (
54
+ <Avatar key={size} size={size}>
55
+ <AvatarFallback>DS</AvatarFallback>
56
+ </Avatar>
57
+ ))}
58
+ {(["sm", "md", "lg", "xl"] as const).map((size) => (
59
+ <Avatar key={`brand-${size}`} size={size} appearance="brand">
60
+ <AvatarFallback>DS</AvatarFallback>
61
+ </Avatar>
62
+ ))}
63
+ </div>
64
+ ),
65
+ };
66
+
67
+ export const InteractiveAvatar: Story = {
68
+ args: { size: "md", appearance: "default" },
69
+ argTypes: {
70
+ size: { control: "select", options: ["sm", "md", "lg", "xl"] },
71
+ appearance: { control: "select", options: ["default", "brand"] },
72
+ },
73
+ render: (args) => (
74
+ <Avatar {...args}>
75
+ <AvatarFallback>DS</AvatarFallback>
76
+ </Avatar>
77
+ ),
78
+ };
@@ -0,0 +1,50 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { BackLink } from "../components/ui/back-link";
3
+
4
+ const meta = {
5
+ title: "Components/BackLink",
6
+ component: BackLink,
7
+ tags: ["autodocs"],
8
+ parameters: {
9
+ layout: "centered",
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'The "← Back to <list>" control above a detail page\'s title. A `<button>` by default; ' +
14
+ "use `asChild` with a router `<Link>` or `<a>` to navigate by href.",
15
+ },
16
+ },
17
+ },
18
+ } satisfies Meta<typeof BackLink>;
19
+
20
+ export default meta;
21
+
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ export const Default: Story = { args: { children: "Back" } };
25
+
26
+ export const WithLabel: Story = { args: { children: "Estimates" } };
27
+
28
+ export const AsLink: Story = {
29
+ render: () => (
30
+ <BackLink asChild>
31
+ <a href="#estimates">Estimates</a>
32
+ </BackLink>
33
+ ),
34
+ };
35
+
36
+ export const AllVariants: Story = {
37
+ render: () => (
38
+ <div style={{ display: "flex", flexDirection: "column", gap: 12, alignItems: "flex-start" }}>
39
+ <BackLink>Back</BackLink>
40
+ <BackLink>Standard content</BackLink>
41
+ <BackLink asChild>
42
+ <a href="#invoices">Invoices (link)</a>
43
+ </BackLink>
44
+ </div>
45
+ ),
46
+ };
47
+
48
+ export const InteractiveBackLink: Story = {
49
+ args: { children: "Back", onClick: () => undefined },
50
+ };
@@ -146,6 +146,32 @@ export const UtilityGeneralTertiary: Story = {
146
146
  ),
147
147
  };
148
148
 
149
+ export const UtilityDangerPrimary: Story = {
150
+ render: () => (
151
+ <div className="space-y-6">
152
+ <div>
153
+ <p className="text-sm text-gray-600 mb-2">Danger, primary — confirms a destructive action</p>
154
+ <Button variant="danger-primary" size="utility">
155
+ Delete
156
+ </Button>
157
+ </div>
158
+ </div>
159
+ ),
160
+ };
161
+
162
+ export const UtilityDangerSecondary: Story = {
163
+ render: () => (
164
+ <div className="space-y-6">
165
+ <div>
166
+ <p className="text-sm text-gray-600 mb-2">Danger, secondary — starts a destructive action</p>
167
+ <Button variant="danger-secondary" size="utility">
168
+ Delete
169
+ </Button>
170
+ </div>
171
+ </div>
172
+ ),
173
+ };
174
+
149
175
  export const UtilityTransparentTertiary: Story = {
150
176
  render: () => (
151
177
  <div className="space-y-6">
@@ -453,3 +453,33 @@ export const ConceptCard: Story = {
453
453
  );
454
454
  },
455
455
  };
456
+
457
+ export const Panel: Story = {
458
+ render: () => (
459
+ <Card variant="panel" className="w-full max-w-sm">
460
+ <CardTitle>Price</CardTitle>
461
+ <CardContent>A bordered 16px-radius panel for a side summary. Add `sticky` to pin it while the page scrolls.</CardContent>
462
+ </Card>
463
+ ),
464
+ };
465
+
466
+ export const Inset: Story = {
467
+ render: () => (
468
+ <Card variant="inset" className="w-full max-w-sm">
469
+ <CardTitle>Project 1</CardTitle>
470
+ <CardContent>A bordered 12px-radius box nested inside a form or another card.</CardContent>
471
+ </Card>
472
+ ),
473
+ };
474
+
475
+ export const RelaxedSpacing: Story = {
476
+ render: () => (
477
+ <Card variant="outlined" spacing="relaxed" className="w-full max-w-sm">
478
+ <CardHeader>
479
+ <CardTitle>Relaxed spacing</CardTitle>
480
+ <CardDescription>More air between the heading, its description and the content.</CardDescription>
481
+ </CardHeader>
482
+ <CardContent>Used on dense back-office pages.</CardContent>
483
+ </Card>
484
+ ),
485
+ };
@@ -0,0 +1,43 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { CenteredPage } from "../components/ui/centered-page";
3
+ import { ModalPanel, ModalTitle } from "../components/ui/modal-panel";
4
+ import { Text } from "../components/ui/typography";
5
+
6
+ const meta = {
7
+ title: "Components/CenteredPage",
8
+ component: CenteredPage,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ layout: "fullscreen",
12
+ docs: {
13
+ description: {
14
+ component:
15
+ "A full-window page that sets a single 420px panel near the top, centred, on the page background. " +
16
+ "Used for a signed-out landing or a hand-off screen.",
17
+ },
18
+ },
19
+ },
20
+ } satisfies Meta<typeof CenteredPage>;
21
+
22
+ export default meta;
23
+
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Default: Story = {
27
+ render: () => (
28
+ <CenteredPage>
29
+ <ModalPanel align="center" paddingTop="4xl" paddingBottom="2xl" gap="2xl">
30
+ <ModalTitle as="h1" size="large">
31
+ WELL Admin
32
+ </ModalTitle>
33
+ <Text variant="body-base" tone="muted" style={{ textAlign: "center" }}>
34
+ A short line about what this place is.
35
+ </Text>
36
+ </ModalPanel>
37
+ </CenteredPage>
38
+ ),
39
+ };
40
+
41
+ export const AllVariants: Story = { render: Default.render };
42
+
43
+ export const InteractiveCenteredPage: Story = { render: Default.render };
@@ -0,0 +1,68 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { CheckboxField } from "../components/ui/checkbox-field";
4
+
5
+ const meta = {
6
+ title: "Components/CheckboxField",
7
+ component: CheckboxField,
8
+ tags: ["autodocs"],
9
+ parameters: {
10
+ layout: "centered",
11
+ docs: {
12
+ description: {
13
+ component:
14
+ "A checkbox with its label (and optional description) as one control. Clicking the text toggles the box.",
15
+ },
16
+ },
17
+ },
18
+ } satisfies Meta<typeof CheckboxField>;
19
+
20
+ export default meta;
21
+
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ export const Default: Story = {
25
+ args: { label: "Published (visible to customers)" },
26
+ };
27
+
28
+ export const Checked: Story = {
29
+ args: { label: "Featured in the public directory", defaultChecked: true },
30
+ };
31
+
32
+ export const WithDescription: Story = {
33
+ args: {
34
+ label: "Active",
35
+ description: "Inactive items are hidden from customers.",
36
+ defaultChecked: true,
37
+ },
38
+ };
39
+
40
+ export const Disabled: Story = {
41
+ args: { label: "Locked option", disabled: true },
42
+ };
43
+
44
+ export const AllVariants: Story = {
45
+ args: { label: "All variants" },
46
+ render: () => (
47
+ <div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
48
+ <CheckboxField label="Default" />
49
+ <CheckboxField label="Checked" defaultChecked />
50
+ <CheckboxField label="With description" description="Helper text under the label." />
51
+ <CheckboxField label="Disabled" disabled />
52
+ </div>
53
+ ),
54
+ };
55
+
56
+ export const InteractiveCheckboxField: Story = {
57
+ args: { label: "This term is the active one" },
58
+ render: () => {
59
+ const [checked, setChecked] = React.useState(false);
60
+ return (
61
+ <CheckboxField
62
+ label="This term is the active one"
63
+ checked={checked}
64
+ onCheckedChange={(value) => setChecked(value === true)}
65
+ />
66
+ );
67
+ },
68
+ };
@@ -0,0 +1,114 @@
1
+ import * as React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { DataGrid, type DataGridColumn, type DataGridSort } from "../components/ui/data-grid";
4
+ import { StatusPill } from "../components/ui/status-pill";
5
+ import { Input } from "../components/ui/input";
6
+
7
+ interface Role {
8
+ id: number;
9
+ name: string;
10
+ scope: string;
11
+ permissions: number;
12
+ builtIn: boolean;
13
+ }
14
+
15
+ const ROLES: Role[] = [
16
+ { id: 1, name: "platform.super_admin", scope: "platform", permissions: 5, builtIn: true },
17
+ { id: 2, name: "platform.admin", scope: "platform", permissions: 2, builtIn: true },
18
+ { id: 3, name: "platform.user", scope: "platform", permissions: 0, builtIn: true },
19
+ { id: 4, name: "support.reader", scope: "platform", permissions: 1, builtIn: false },
20
+ { id: 5, name: "org.manager", scope: "organization", permissions: 3, builtIn: false },
21
+ ];
22
+
23
+ const COLUMNS: DataGridColumn<Role>[] = [
24
+ { key: "name", header: "Role", value: (r) => r.name, sortable: true, filter: true, flex: 2 },
25
+ { key: "scope", header: "Applies to", value: (r) => r.scope, sortable: true, filter: true },
26
+ { key: "permissions", header: "Permissions", value: (r) => r.permissions, sortable: true, align: "right", width: 140 },
27
+ {
28
+ key: "kind",
29
+ header: "Kind",
30
+ value: (r) => (r.builtIn ? "Built in" : "Custom"),
31
+ cell: (r) => (
32
+ <StatusPill appearance="chip" tone={r.builtIn ? "plain" : "info"}>
33
+ {r.builtIn ? "Built in" : "Custom"}
34
+ </StatusPill>
35
+ ),
36
+ sortable: true,
37
+ width: 150,
38
+ },
39
+ ];
40
+
41
+ const meta = {
42
+ title: "Components/DataGrid",
43
+ component: DataGrid,
44
+ tags: ["autodocs"],
45
+ args: { rows: ROLES, columns: COLUMNS as unknown as DataGridColumn<unknown>[] },
46
+ parameters: {
47
+ layout: "padded",
48
+ docs: {
49
+ description: {
50
+ component:
51
+ "An interactive table on AG Grid (community): sortable and resizable columns, filters, a quick search, " +
52
+ "custom cells, loading and empty states. It renders the rows it is given — paging stays with the screen. " +
53
+ "Leave `onSortChange` out and the grid sorts and filters the rows itself; pass `sort` and `onSortChange` " +
54
+ "when the server sorts and refetch in that order.",
55
+ },
56
+ },
57
+ },
58
+ } satisfies Meta<typeof DataGrid>;
59
+
60
+ export default meta;
61
+
62
+ type Story = StoryObj<typeof meta>;
63
+
64
+ export const Default: Story = {
65
+ render: () => <DataGrid<Role> aria-label="Roles" rows={ROLES} columns={COLUMNS} getRowId={(r) => String(r.id)} />,
66
+ };
67
+
68
+ export const WithQuickSearch: Story = {
69
+ render: () => {
70
+ const [search, setSearch] = React.useState("");
71
+ return (
72
+ <div style={{ display: "flex", flexDirection: "column", gap: 16 }}>
73
+ <div style={{ maxWidth: 320 }}>
74
+ <Input aria-label="Search roles" placeholder="Search roles" value={search} onChange={(e) => setSearch(e.target.value)} />
75
+ </div>
76
+ <DataGrid<Role> aria-label="Roles" rows={ROLES} columns={COLUMNS} getRowId={(r) => String(r.id)} quickFilter={search} />
77
+ </div>
78
+ );
79
+ },
80
+ };
81
+
82
+ export const ServerSorted: Story = {
83
+ render: () => {
84
+ const [sort, setSort] = React.useState<DataGridSort | null>({ key: "name", direction: "asc" });
85
+ // Stands in for a refetch: the parent, not the grid, puts the rows in order.
86
+ const rows = React.useMemo(() => {
87
+ const key = (sort?.key ?? "name") as "name" | "scope" | "permissions";
88
+ const direction = sort?.direction === "desc" ? -1 : 1;
89
+ return [...ROLES].sort((a, b) => (a[key] > b[key] ? 1 : a[key] < b[key] ? -1 : 0) * direction);
90
+ }, [sort]);
91
+ return <DataGrid<Role> aria-label="Roles" rows={rows} columns={COLUMNS} sort={sort} onSortChange={setSort} getRowId={(r) => String(r.id)} />;
92
+ },
93
+ };
94
+
95
+ export const Loading: Story = {
96
+ render: () => <DataGrid<Role> aria-label="Roles" rows={[]} columns={COLUMNS} loading />,
97
+ };
98
+
99
+ export const Empty: Story = {
100
+ render: () => <DataGrid<Role> aria-label="Roles" rows={[]} columns={COLUMNS} emptyText="No roles yet." />,
101
+ };
102
+
103
+ export const AllVariants: Story = {
104
+ render: () => (
105
+ <div style={{ display: "flex", flexDirection: "column", gap: 32 }}>
106
+ <DataGrid<Role> aria-label="Roles" rows={ROLES} columns={COLUMNS} getRowId={(r) => String(r.id)} />
107
+ <DataGrid<Role> aria-label="No roles" rows={[]} columns={COLUMNS} emptyText="No roles yet." />
108
+ </div>
109
+ ),
110
+ };
111
+
112
+ export const InteractiveDataGrid: Story = {
113
+ render: () => <DataGrid<Role> aria-label="Roles" rows={ROLES} columns={COLUMNS} getRowId={(r) => String(r.id)} onRowClick={() => undefined} />,
114
+ };
@@ -417,3 +417,34 @@ export const WithResponsiveDrawer: Story = {
417
417
  );
418
418
  },
419
419
  };
420
+
421
+ export const FormAppearance: Story = {
422
+ render: () => {
423
+ const [open, setOpen] = useState(false);
424
+ return (
425
+ <Dialog open={open} onOpenChange={setOpen}>
426
+ <DialogTrigger asChild>
427
+ <Button size="large" variant="general-primary" onClick={() => setOpen(true)}>
428
+ Open form dialog
429
+ </Button>
430
+ </DialogTrigger>
431
+ <DialogContent appearance="form">
432
+ <DialogHeader>
433
+ <DialogTitle>Deactivate Ada?</DialogTitle>
434
+ <DialogDescription>
435
+ The back-office dialog: a 560px panel, left-aligned title and description, roomier padding.
436
+ </DialogDescription>
437
+ </DialogHeader>
438
+ <DialogFooter>
439
+ <Button size="utility" variant="general-secondary" onClick={() => setOpen(false)}>
440
+ Cancel
441
+ </Button>
442
+ <Button size="utility" variant="primary-dark" onClick={() => setOpen(false)}>
443
+ Deactivate
444
+ </Button>
445
+ </DialogFooter>
446
+ </DialogContent>
447
+ </Dialog>
448
+ );
449
+ },
450
+ };
@@ -0,0 +1,77 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { AlignRight, ArrowDown, ArrowUp, Pencil, Trash2 } from "lucide-react";
3
+ import { IconButton } from "../components/ui/icon-button";
4
+ import { Avatar, AvatarFallback } from "../components/ui/avatar";
5
+
6
+ const meta = {
7
+ title: "Components/IconButton",
8
+ component: IconButton,
9
+ tags: ["autodocs"],
10
+ parameters: {
11
+ layout: "centered",
12
+ docs: {
13
+ description: {
14
+ component:
15
+ "A quiet icon-only button. `md` (36px) for shell chrome such as a sidebar toggle, `sm` (28px) " +
16
+ "for rows (move, edit, delete), `bare` for a custom child such as an avatar. Always pass `aria-label`.",
17
+ },
18
+ },
19
+ },
20
+ } satisfies Meta<typeof IconButton>;
21
+
22
+ export default meta;
23
+
24
+ type Story = StoryObj<typeof meta>;
25
+
26
+ export const Default: Story = {
27
+ args: { "aria-label": "Toggle sidebar", children: <AlignRight size={20} /> },
28
+ };
29
+
30
+ export const Small: Story = {
31
+ args: { "aria-label": "Edit", size: "sm", children: <Pencil size={15} /> },
32
+ };
33
+
34
+ export const Disabled: Story = {
35
+ args: { "aria-label": "Move up", size: "sm", disabled: true, children: <ArrowUp size={15} /> },
36
+ };
37
+
38
+ export const Bare: Story = {
39
+ args: {
40
+ "aria-label": "Account",
41
+ size: "bare",
42
+ children: (
43
+ <Avatar appearance="brand">
44
+ <AvatarFallback>SU</AvatarFallback>
45
+ </Avatar>
46
+ ),
47
+ },
48
+ };
49
+
50
+ export const AllVariants: Story = {
51
+ args: { "aria-label": "Toggle sidebar" },
52
+ render: () => (
53
+ <div style={{ display: "flex", gap: 16, alignItems: "center" }}>
54
+ <IconButton aria-label="Toggle sidebar">
55
+ <AlignRight size={20} />
56
+ </IconButton>
57
+ <div style={{ display: "flex", gap: 2 }}>
58
+ <IconButton aria-label="Move up" size="sm">
59
+ <ArrowUp size={15} />
60
+ </IconButton>
61
+ <IconButton aria-label="Move down" size="sm">
62
+ <ArrowDown size={15} />
63
+ </IconButton>
64
+ <IconButton aria-label="Edit" size="sm">
65
+ <Pencil size={15} />
66
+ </IconButton>
67
+ <IconButton aria-label="Delete" size="sm" disabled>
68
+ <Trash2 size={15} />
69
+ </IconButton>
70
+ </div>
71
+ </div>
72
+ ),
73
+ };
74
+
75
+ export const InteractiveIconButton: Story = {
76
+ args: { "aria-label": "Edit", size: "sm", children: <Pencil size={15} />, onClick: () => undefined },
77
+ };
@@ -0,0 +1,106 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { ArrowDown, ArrowUp, Pencil, Trash2 } from "lucide-react";
3
+ import { Button } from "../components/ui/button";
4
+ import {
5
+ OutlineNode,
6
+ OutlineNodeControls,
7
+ OutlineNodeHead,
8
+ OutlineNodeMeta,
9
+ OutlineNodeTitle,
10
+ } from "../components/ui/outline-node";
11
+ import { StatusPill } from "../components/ui/status-pill";
12
+
13
+ const meta = {
14
+ title: "Components/OutlineNode",
15
+ component: OutlineNode,
16
+ tags: ["autodocs"],
17
+ parameters: {
18
+ layout: "padded",
19
+ docs: {
20
+ description: {
21
+ component:
22
+ "One row of an editable outline or tree (concept, feature, requirement). " +
23
+ "`level` sets the look: `section` is a bordered card, `branch` is indented with a guide line, " +
24
+ "`leaf` is a compact row with a hover highlight. Nest child nodes inside the parent.",
25
+ },
26
+ },
27
+ },
28
+ } satisfies Meta<typeof OutlineNode>;
29
+
30
+ export default meta;
31
+
32
+ type Story = StoryObj<typeof meta>;
33
+
34
+ const controls = (
35
+ <OutlineNodeControls>
36
+ <Button variant="transparent-tertiary" size="icon" aria-label="Move up"><ArrowUp size={15} /></Button>
37
+ <Button variant="transparent-tertiary" size="icon" aria-label="Move down"><ArrowDown size={15} /></Button>
38
+ <Button variant="transparent-tertiary" size="icon" aria-label="Edit"><Pencil size={15} /></Button>
39
+ <Button variant="transparent-tertiary" size="icon" aria-label="Delete"><Trash2 size={15} /></Button>
40
+ </OutlineNodeControls>
41
+ );
42
+
43
+ export const Default: Story = {
44
+ render: () => (
45
+ <OutlineNode level="section">
46
+ <OutlineNodeHead>
47
+ <OutlineNodeTitle>
48
+ <strong>AIR</strong> · Clean air
49
+ </OutlineNodeTitle>
50
+ {controls}
51
+ </OutlineNodeHead>
52
+ </OutlineNode>
53
+ ),
54
+ };
55
+
56
+ export const Nested: Story = {
57
+ render: () => (
58
+ <div style={{ maxWidth: 720 }}>
59
+ <OutlineNode level="section">
60
+ <OutlineNodeHead>
61
+ <OutlineNodeTitle>
62
+ <strong>AIR</strong> · Clean air
63
+ </OutlineNodeTitle>
64
+ {controls}
65
+ </OutlineNodeHead>
66
+ <OutlineNode level="branch">
67
+ <OutlineNodeHead>
68
+ <OutlineNodeTitle>
69
+ <strong>A01</strong> · Air quality
70
+ <OutlineNodeMeta>12 pts</OutlineNodeMeta>
71
+ <StatusPill tone="info">Energy</StatusPill>
72
+ </OutlineNodeTitle>
73
+ {controls}
74
+ </OutlineNodeHead>
75
+ <OutlineNode level="leaf">
76
+ <OutlineNodeTitle>
77
+ Meet the particulate limits
78
+ <StatusPill tone="accent">precondition</StatusPill>
79
+ <OutlineNodeMeta>2 pts ×1</OutlineNodeMeta>
80
+ </OutlineNodeTitle>
81
+ {controls}
82
+ </OutlineNode>
83
+ <OutlineNode level="leaf" inactive>
84
+ <OutlineNodeTitle>
85
+ Retired requirement
86
+ <StatusPill tone="inactive">Inactive</StatusPill>
87
+ </OutlineNodeTitle>
88
+ {controls}
89
+ </OutlineNode>
90
+ </OutlineNode>
91
+ </OutlineNode>
92
+ </div>
93
+ ),
94
+ };
95
+
96
+ export const AllVariants: Story = Nested;
97
+
98
+ export const InteractiveOutlineNode: Story = {
99
+ args: { level: "section" },
100
+ argTypes: { level: { control: "select", options: ["section", "branch", "leaf"] } },
101
+ render: (args) => (
102
+ <OutlineNode {...args}>
103
+ <OutlineNodeTitle>Outline row</OutlineNodeTitle>
104
+ </OutlineNode>
105
+ ),
106
+ };