@roadlittledawn/docs-design-system-react 0.6.0 → 0.6.2
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 +4 -0
- package/dist/components/Button.stories.js +28 -0
- package/dist/components/Callout.stories.js +21 -0
- package/dist/components/Card.stories.js +31 -0
- package/dist/components/CardGrid.d.ts +7 -1
- package/dist/components/CardGrid.js +7 -2
- package/dist/components/CardGrid.stories.d.ts +11 -0
- package/dist/components/CardGrid.stories.js +59 -0
- package/dist/components/CodeBlock.js +1 -0
- package/dist/components/CodeBlock.stories.d.ts +2 -2
- package/dist/components/CodeBlock.stories.js +88 -57
- package/dist/components/Collapser.js +1 -0
- package/dist/components/Collapser.stories.js +24 -0
- package/dist/components/CollapserGroup.js +1 -0
- package/dist/components/CollapserGroup.stories.js +29 -0
- package/dist/components/Heading.stories.js +20 -0
- package/dist/components/Link.stories.js +15 -0
- package/dist/components/List.stories.d.ts +32 -0
- package/dist/components/List.stories.js +24 -0
- package/dist/components/Popover.js +1 -0
- package/dist/components/Popover.stories.js +45 -0
- package/dist/components/Tabs.js +1 -0
- package/dist/components/Tabs.stories.js +23 -0
- package/dist/components/Typography.stories.js +17 -0
- package/dist/hooks/useKeyPress.js +1 -0
- package/dist/styles.css +8 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -35,6 +35,10 @@ Full component documentation with live examples, usage guidelines, and API docum
|
|
|
35
35
|
|
|
36
36
|
**[View Component Documentation →](https://docs-design-system-storybook.netlify.app/?path=/docs/components-button--docs)**
|
|
37
37
|
|
|
38
|
+
## Next.js / React Server Components
|
|
39
|
+
|
|
40
|
+
Interactive components (`Collapser`, `CollapserGroup`, `CodeBlock`, `Tabs`, `Popover`) are pre-marked with `'use client'`, so they work in Next.js App Router without any extra setup. Stateless components (`Button`, `Callout`, `Card`, `CardGrid`, `Heading`, `Link`, `List`, `Typography`) have no directive and are fully usable as Server Components.
|
|
41
|
+
|
|
38
42
|
## Dark Mode
|
|
39
43
|
|
|
40
44
|
The package includes built-in dark mode support. All components use transparent backgrounds (unless background color specified via props) in dark mode so they don't clash with your site's own dark theme.
|
|
@@ -8,6 +8,34 @@ var meta = {
|
|
|
8
8
|
title: 'Components/Button',
|
|
9
9
|
component: Button,
|
|
10
10
|
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
variant: {
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
options: ['primary', 'secondary', 'outline'],
|
|
15
|
+
description: 'Visual style variant of the button.',
|
|
16
|
+
table: { defaultValue: { summary: "'primary'" } },
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
options: ['sm', 'md', 'lg'],
|
|
21
|
+
description: 'Size of the button.',
|
|
22
|
+
table: { defaultValue: { summary: "'md'" } },
|
|
23
|
+
},
|
|
24
|
+
children: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Button content.',
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether the button is disabled.',
|
|
31
|
+
table: { defaultValue: { summary: 'false' } },
|
|
32
|
+
},
|
|
33
|
+
className: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'Additional CSS classes.',
|
|
36
|
+
table: { defaultValue: { summary: '""' } },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
11
39
|
parameters: {
|
|
12
40
|
docs: {
|
|
13
41
|
description: {
|
|
@@ -7,6 +7,27 @@ var meta = {
|
|
|
7
7
|
title: 'Components/Callout',
|
|
8
8
|
component: Callout,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['caution', 'important', 'tip', 'course'],
|
|
14
|
+
description: 'Visual style variant that sets the color and icon.',
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Optional title. Defaults to the variant name. Pass `null` to hide entirely.',
|
|
19
|
+
table: { defaultValue: { summary: 'Variant name ("Caution", "Tip", etc.)' } },
|
|
20
|
+
},
|
|
21
|
+
children: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Callout content.',
|
|
24
|
+
},
|
|
25
|
+
className: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Additional CSS classes.',
|
|
28
|
+
table: { defaultValue: { summary: '""' } },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
10
31
|
parameters: {
|
|
11
32
|
docs: {
|
|
12
33
|
description: {
|
|
@@ -7,6 +7,37 @@ var meta = {
|
|
|
7
7
|
title: 'Components/Card',
|
|
8
8
|
component: Card,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
title: {
|
|
12
|
+
control: 'text',
|
|
13
|
+
description: 'Optional title displayed at the top of the card.',
|
|
14
|
+
},
|
|
15
|
+
titleColor: {
|
|
16
|
+
control: { type: 'select' },
|
|
17
|
+
options: ['blue', 'green', 'purple', 'red', 'yellow', 'gray'],
|
|
18
|
+
description: 'Color of the title text.',
|
|
19
|
+
table: { defaultValue: { summary: "'gray'" } },
|
|
20
|
+
},
|
|
21
|
+
backgroundColor: {
|
|
22
|
+
control: { type: 'select' },
|
|
23
|
+
options: ['blue', 'green', 'purple', 'red', 'yellow', 'gray', 'white'],
|
|
24
|
+
description: 'Background color of the card.',
|
|
25
|
+
table: { defaultValue: { summary: "'white'" } },
|
|
26
|
+
},
|
|
27
|
+
href: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
description: 'Optional link URL. When provided, the entire card becomes clickable.',
|
|
30
|
+
},
|
|
31
|
+
children: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'Card content.',
|
|
34
|
+
},
|
|
35
|
+
className: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
description: 'Additional CSS classes.',
|
|
38
|
+
table: { defaultValue: { summary: '""' } },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
10
41
|
parameters: {
|
|
11
42
|
docs: {
|
|
12
43
|
description: {
|
|
@@ -5,10 +5,16 @@ interface CardGridProps {
|
|
|
5
5
|
* @default 3
|
|
6
6
|
*/
|
|
7
7
|
columns?: 2 | 3 | 4;
|
|
8
|
+
/**
|
|
9
|
+
* When true, all cards in each row expand to the height of the tallest card.
|
|
10
|
+
* Useful when cards have varying content lengths.
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
equalHeight?: boolean;
|
|
8
14
|
/** Grid content (typically Card components) */
|
|
9
15
|
children: ReactNode;
|
|
10
16
|
/** Additional CSS classes */
|
|
11
17
|
className?: string;
|
|
12
18
|
}
|
|
13
|
-
export declare function CardGrid({ columns, children, className }: CardGridProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function CardGrid({ columns, equalHeight, children, className }: CardGridProps): import("react/jsx-runtime").JSX.Element;
|
|
14
20
|
export {};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export function CardGrid(_a) {
|
|
3
|
-
var _b = _a.columns, columns = _b === void 0 ? 3 : _b, children = _a.children,
|
|
4
|
-
var classNames =
|
|
3
|
+
var _b = _a.columns, columns = _b === void 0 ? 3 : _b, _c = _a.equalHeight, equalHeight = _c === void 0 ? true : _c, children = _a.children, _d = _a.className, className = _d === void 0 ? '' : _d;
|
|
4
|
+
var classNames = [
|
|
5
|
+
'dds-card-grid',
|
|
6
|
+
"dds-card-grid-".concat(columns),
|
|
7
|
+
equalHeight ? 'dds-card-grid-equal-height' : '',
|
|
8
|
+
className,
|
|
9
|
+
].filter(Boolean).join(' ');
|
|
5
10
|
return (_jsx("div", { className: classNames, children: children }));
|
|
6
11
|
}
|
|
@@ -18,7 +18,18 @@ export declare const ThreeColumns: Story;
|
|
|
18
18
|
* Grid with 4 columns (responsive).
|
|
19
19
|
*/
|
|
20
20
|
export declare const FourColumns: Story;
|
|
21
|
+
/**
|
|
22
|
+
* Cards with varying content lengths stretched to the same height per row.
|
|
23
|
+
* Use `equalHeight` when cards sit side-by-side and uneven content would
|
|
24
|
+
* make the grid look ragged.
|
|
25
|
+
*/
|
|
26
|
+
export declare const EqualHeight: Story;
|
|
21
27
|
/**
|
|
22
28
|
* Grid with clickable cards.
|
|
23
29
|
*/
|
|
24
30
|
export declare const ClickableCards: Story;
|
|
31
|
+
/**
|
|
32
|
+
* Clickable cards with varying content lengths stretched to the same height.
|
|
33
|
+
* The equal height behaviour applies even when cards are wrapped in anchor tags.
|
|
34
|
+
*/
|
|
35
|
+
export declare const EqualHeightClickableCards: Story;
|
|
@@ -8,6 +8,28 @@ var meta = {
|
|
|
8
8
|
title: 'Components/CardGrid',
|
|
9
9
|
component: CardGrid,
|
|
10
10
|
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
columns: {
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
options: [2, 3, 4],
|
|
15
|
+
description: 'Number of columns in the grid.',
|
|
16
|
+
table: { defaultValue: { summary: '3' } },
|
|
17
|
+
},
|
|
18
|
+
equalHeight: {
|
|
19
|
+
control: 'boolean',
|
|
20
|
+
description: 'When true, all cards in each row expand to the height of the tallest card. Useful when cards have varying content lengths.',
|
|
21
|
+
table: { defaultValue: { summary: 'true' } },
|
|
22
|
+
},
|
|
23
|
+
className: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'Additional CSS classes to apply to the grid container.',
|
|
26
|
+
table: { defaultValue: { summary: '""' } },
|
|
27
|
+
},
|
|
28
|
+
children: {
|
|
29
|
+
control: false,
|
|
30
|
+
description: 'Grid content — typically Card components.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
11
33
|
parameters: {
|
|
12
34
|
docs: {
|
|
13
35
|
description: {
|
|
@@ -65,6 +87,25 @@ export var FourColumns = {
|
|
|
65
87
|
},
|
|
66
88
|
},
|
|
67
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Cards with varying content lengths stretched to the same height per row.
|
|
92
|
+
* Use `equalHeight` when cards sit side-by-side and uneven content would
|
|
93
|
+
* make the grid look ragged.
|
|
94
|
+
*/
|
|
95
|
+
export var EqualHeight = {
|
|
96
|
+
args: {
|
|
97
|
+
columns: 3,
|
|
98
|
+
equalHeight: true,
|
|
99
|
+
children: (_jsxs(_Fragment, { children: [_jsx(Card, { title: "Short", children: "Brief content." }), _jsx(Card, { title: "Medium", children: "This card has a bit more content than the first one, so it would normally be taller." }), _jsx(Card, { title: "Long", children: "This card has significantly more content than the others. It goes into much more detail and spans several sentences to demonstrate how equal height keeps the grid looking even and professional." })] })),
|
|
100
|
+
},
|
|
101
|
+
parameters: {
|
|
102
|
+
docs: {
|
|
103
|
+
source: {
|
|
104
|
+
code: "<CardGrid columns={3} equalHeight>\n <Card title=\"Short\">Brief content.</Card>\n <Card title=\"Medium\">This card has a bit more content than the first one.</Card>\n <Card title=\"Long\">This card has significantly more content than the others...</Card>\n</CardGrid>",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
68
109
|
/**
|
|
69
110
|
* Grid with clickable cards.
|
|
70
111
|
*/
|
|
@@ -81,3 +122,21 @@ export var ClickableCards = {
|
|
|
81
122
|
},
|
|
82
123
|
},
|
|
83
124
|
};
|
|
125
|
+
/**
|
|
126
|
+
* Clickable cards with varying content lengths stretched to the same height.
|
|
127
|
+
* The equal height behaviour applies even when cards are wrapped in anchor tags.
|
|
128
|
+
*/
|
|
129
|
+
export var EqualHeightClickableCards = {
|
|
130
|
+
args: {
|
|
131
|
+
columns: 3,
|
|
132
|
+
equalHeight: true,
|
|
133
|
+
children: (_jsxs(_Fragment, { children: [_jsx(Card, { title: "Documentation", href: "/docs", children: "Complete documentation guide." }), _jsx(Card, { title: "API Reference", href: "/api", children: "Detailed API reference with all available endpoints, parameters, and response schemas." }), _jsx(Card, { title: "Examples", href: "/examples", children: "Practical code examples and patterns showing real-world usage across a variety of common documentation scenarios." })] })),
|
|
134
|
+
},
|
|
135
|
+
parameters: {
|
|
136
|
+
docs: {
|
|
137
|
+
source: {
|
|
138
|
+
code: "<CardGrid columns={3} equalHeight>\n <Card title=\"Documentation\" href=\"/docs\">Complete documentation guide.</Card>\n <Card title=\"API Reference\" href=\"/api\">Detailed API reference with all available endpoints, parameters, and response schemas.</Card>\n <Card title=\"Examples\" href=\"/examples\">Practical code examples and patterns showing real-world usage.</Card>\n</CardGrid>",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import { CodeBlock } from
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { CodeBlock } from "./CodeBlock";
|
|
3
3
|
/**
|
|
4
4
|
* The CodeBlock component displays code snippets with syntax highlighting, copy functionality, and support for multiple tabs and languages.
|
|
5
5
|
*/
|
|
@@ -1,11 +1,42 @@
|
|
|
1
|
-
import { CodeBlock } from
|
|
1
|
+
import { CodeBlock } from "./CodeBlock";
|
|
2
2
|
/**
|
|
3
3
|
* The CodeBlock component displays code snippets with syntax highlighting, copy functionality, and support for multiple tabs and languages.
|
|
4
4
|
*/
|
|
5
5
|
var meta = {
|
|
6
|
-
title:
|
|
6
|
+
title: "Components/CodeBlock",
|
|
7
7
|
component: CodeBlock,
|
|
8
|
-
tags: [
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
code: {
|
|
11
|
+
control: "text",
|
|
12
|
+
description: "Single code snippet string. Use `snippets` for multi-tab or multi-language layouts.",
|
|
13
|
+
},
|
|
14
|
+
language: {
|
|
15
|
+
control: "text",
|
|
16
|
+
description: 'Language identifier for syntax highlighting (e.g. `"typescript"`, `"bash"`, `"python"`).',
|
|
17
|
+
},
|
|
18
|
+
filename: {
|
|
19
|
+
control: "text",
|
|
20
|
+
description: "Optional filename label shown in the header when there is only one snippet.",
|
|
21
|
+
},
|
|
22
|
+
highlightLines: {
|
|
23
|
+
control: "object",
|
|
24
|
+
description: "Array of 1-indexed line numbers to highlight (e.g. `[2, 3, 4]`).",
|
|
25
|
+
},
|
|
26
|
+
snippets: {
|
|
27
|
+
control: false,
|
|
28
|
+
description: "Array of code snippets for multi-tab or multi-language display. Takes precedence over `code`.",
|
|
29
|
+
},
|
|
30
|
+
path: {
|
|
31
|
+
control: "text",
|
|
32
|
+
description: "URL or path to a markdown file containing fenced code blocks to load as snippets.",
|
|
33
|
+
},
|
|
34
|
+
className: {
|
|
35
|
+
control: "text",
|
|
36
|
+
description: "Additional CSS classes applied to the outer container.",
|
|
37
|
+
table: { defaultValue: { summary: '""' } },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
9
40
|
parameters: {
|
|
10
41
|
docs: {
|
|
11
42
|
description: {
|
|
@@ -21,7 +52,7 @@ export default meta;
|
|
|
21
52
|
export var Basic = {
|
|
22
53
|
args: {
|
|
23
54
|
code: "function greet(name: string) {\n return `Hello, ${name}!`;\n}\n\nconsole.log(greet(\"World\"));",
|
|
24
|
-
language:
|
|
55
|
+
language: "typescript",
|
|
25
56
|
},
|
|
26
57
|
parameters: {
|
|
27
58
|
docs: {
|
|
@@ -37,8 +68,8 @@ export var Basic = {
|
|
|
37
68
|
export var WithFilename = {
|
|
38
69
|
args: {
|
|
39
70
|
code: "export const Button = ({ children, onClick }) => {\n return (\n <button onClick={onClick}>\n {children}\n </button>\n );\n};",
|
|
40
|
-
language:
|
|
41
|
-
filename:
|
|
71
|
+
language: "jsx",
|
|
72
|
+
filename: "Button.jsx",
|
|
42
73
|
},
|
|
43
74
|
parameters: {
|
|
44
75
|
docs: {
|
|
@@ -54,7 +85,7 @@ export var WithFilename = {
|
|
|
54
85
|
export var WithHighlightedLines = {
|
|
55
86
|
args: {
|
|
56
87
|
code: "function calculateTotal(items) {\n let total = 0;\n for (const item of items) {\n total += item.price * item.quantity;\n }\n return total;\n}",
|
|
57
|
-
language:
|
|
88
|
+
language: "javascript",
|
|
58
89
|
highlightLines: [2, 3, 4],
|
|
59
90
|
},
|
|
60
91
|
parameters: {
|
|
@@ -73,21 +104,21 @@ export var WithTabs = {
|
|
|
73
104
|
snippets: [
|
|
74
105
|
{
|
|
75
106
|
code: "export const Button = ({ children }) => {\n return <button>{children}</button>;\n};",
|
|
76
|
-
language:
|
|
77
|
-
filename:
|
|
78
|
-
tabTitle:
|
|
107
|
+
language: "jsx",
|
|
108
|
+
filename: "Button.jsx",
|
|
109
|
+
tabTitle: "Button.jsx",
|
|
79
110
|
},
|
|
80
111
|
{
|
|
81
112
|
code: ".button {\n padding: 0.5rem 1rem;\n background-color: blue;\n color: white;\n}",
|
|
82
|
-
language:
|
|
83
|
-
filename:
|
|
84
|
-
tabTitle:
|
|
113
|
+
language: "css",
|
|
114
|
+
filename: "Button.css",
|
|
115
|
+
tabTitle: "Button.css",
|
|
85
116
|
},
|
|
86
117
|
{
|
|
87
118
|
code: "import { Button } from './Button';\n\nexport default {\n component: Button,\n};",
|
|
88
|
-
language:
|
|
89
|
-
filename:
|
|
90
|
-
tabTitle:
|
|
119
|
+
language: "typescript",
|
|
120
|
+
filename: "Button.stories.ts",
|
|
121
|
+
tabTitle: "Button.stories.ts",
|
|
91
122
|
},
|
|
92
123
|
],
|
|
93
124
|
},
|
|
@@ -107,23 +138,23 @@ export var WithLanguageDropdown = {
|
|
|
107
138
|
snippets: [
|
|
108
139
|
{
|
|
109
140
|
code: "function greet(name: string): string {\n return `Hello, ${name}!`;\n}",
|
|
110
|
-
language:
|
|
111
|
-
filename:
|
|
141
|
+
language: "typescript",
|
|
142
|
+
filename: "greet.ts",
|
|
112
143
|
},
|
|
113
144
|
{
|
|
114
145
|
code: "function greet(name) {\n return `Hello, ${name}!`;\n}",
|
|
115
|
-
language:
|
|
116
|
-
filename:
|
|
146
|
+
language: "javascript",
|
|
147
|
+
filename: "greet.js",
|
|
117
148
|
},
|
|
118
149
|
{
|
|
119
150
|
code: "def greet(name):\n return f\"Hello, {name}!\"",
|
|
120
|
-
language:
|
|
121
|
-
filename:
|
|
151
|
+
language: "python",
|
|
152
|
+
filename: "greet.py",
|
|
122
153
|
},
|
|
123
154
|
{
|
|
124
155
|
code: "def greet(name)\n \"Hello, #{name}!\"\nend",
|
|
125
|
-
language:
|
|
126
|
-
filename:
|
|
156
|
+
language: "ruby",
|
|
157
|
+
filename: "greet.rb",
|
|
127
158
|
},
|
|
128
159
|
],
|
|
129
160
|
},
|
|
@@ -143,16 +174,16 @@ export var ComplexExample = {
|
|
|
143
174
|
snippets: [
|
|
144
175
|
{
|
|
145
176
|
code: "import React from 'react';\n\nexport function Button({ children, onClick }) {\n return (\n <button onClick={onClick} className=\"btn\">\n {children}\n </button>\n );\n}",
|
|
146
|
-
language:
|
|
147
|
-
filename:
|
|
148
|
-
tabTitle:
|
|
177
|
+
language: "jsx",
|
|
178
|
+
filename: "Button.jsx",
|
|
179
|
+
tabTitle: "Button.jsx",
|
|
149
180
|
highlightLines: [3, 4, 5],
|
|
150
181
|
},
|
|
151
182
|
{
|
|
152
183
|
code: ".btn {\n padding: 0.5rem 1rem;\n background-color: #3b82f6;\n color: white;\n border-radius: 0.375rem;\n}",
|
|
153
|
-
language:
|
|
154
|
-
filename:
|
|
155
|
-
tabTitle:
|
|
184
|
+
language: "css",
|
|
185
|
+
filename: "Button.css",
|
|
186
|
+
tabTitle: "Button.css",
|
|
156
187
|
highlightLines: [2, 3],
|
|
157
188
|
},
|
|
158
189
|
],
|
|
@@ -171,7 +202,7 @@ export var ComplexExample = {
|
|
|
171
202
|
*/
|
|
172
203
|
export var WithPath = {
|
|
173
204
|
args: {
|
|
174
|
-
path:
|
|
205
|
+
path: "https://raw.githubusercontent.com/storybookjs/storybook/47e331ffbaa61a476ddb873bdb12bf46a93a5131/docs/_snippets/before-each-in-meta-mock-date.md",
|
|
175
206
|
},
|
|
176
207
|
parameters: {
|
|
177
208
|
docs: {
|
|
@@ -187,8 +218,8 @@ export var WithPath = {
|
|
|
187
218
|
export var JSONExample = {
|
|
188
219
|
args: {
|
|
189
220
|
code: "{\n \"name\": \"docs-design-system\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"react\": \"^18.0.0\"\n }\n}",
|
|
190
|
-
language:
|
|
191
|
-
filename:
|
|
221
|
+
language: "json",
|
|
222
|
+
filename: "package.json",
|
|
192
223
|
},
|
|
193
224
|
parameters: {
|
|
194
225
|
docs: {
|
|
@@ -204,8 +235,8 @@ export var JSONExample = {
|
|
|
204
235
|
export var BashExample = {
|
|
205
236
|
args: {
|
|
206
237
|
code: "#!/bin/bash\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Run tests\nnpm test",
|
|
207
|
-
language:
|
|
208
|
-
filename:
|
|
238
|
+
language: "bash",
|
|
239
|
+
filename: "setup.sh",
|
|
209
240
|
},
|
|
210
241
|
parameters: {
|
|
211
242
|
docs: {
|
|
@@ -223,15 +254,15 @@ export var WithFilenameTabs = {
|
|
|
223
254
|
snippets: [
|
|
224
255
|
{
|
|
225
256
|
code: "import { CodeBlock } from '@docs-design-system/ui';\n\nexport function Example() {\n return (\n <CodeBlock\n code=\"console.log('hello')\"\n language=\"typescript\"\n />\n );\n}",
|
|
226
|
-
language:
|
|
227
|
-
filename:
|
|
228
|
-
tabTitle:
|
|
257
|
+
language: "tsx",
|
|
258
|
+
filename: "Example.tsx",
|
|
259
|
+
tabTitle: "Example.tsx",
|
|
229
260
|
},
|
|
230
261
|
{
|
|
231
262
|
code: "import { CodeBlock } from '@docs-design-system/ui';\n\nexport function Advanced() {\n return (\n <CodeBlock\n snippets={[\n { code: 'const a = 1;', language: 'typescript', tabTitle: 'a.ts' },\n { code: 'const b = 2;', language: 'typescript', tabTitle: 'b.ts' },\n ]}\n />\n );\n}",
|
|
232
|
-
language:
|
|
233
|
-
filename:
|
|
234
|
-
tabTitle:
|
|
263
|
+
language: "tsx",
|
|
264
|
+
filename: "Advanced.tsx",
|
|
265
|
+
tabTitle: "Advanced.tsx",
|
|
235
266
|
},
|
|
236
267
|
],
|
|
237
268
|
},
|
|
@@ -249,8 +280,8 @@ export var WithFilenameTabs = {
|
|
|
249
280
|
export var SingleFilename = {
|
|
250
281
|
args: {
|
|
251
282
|
code: "export default function Home() {\n return <h1>Welcome</h1>;\n}",
|
|
252
|
-
language:
|
|
253
|
-
filename:
|
|
283
|
+
language: "tsx",
|
|
284
|
+
filename: "page.tsx",
|
|
254
285
|
},
|
|
255
286
|
parameters: {
|
|
256
287
|
docs: {
|
|
@@ -266,8 +297,8 @@ export var SingleFilename = {
|
|
|
266
297
|
export var PHPExample = {
|
|
267
298
|
args: {
|
|
268
299
|
code: "<?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\n\nclass UserController extends Controller\n{\n public function index()\n {\n $users = User::all();\n return view('users.index', compact('users'));\n }\n\n public function show(int $id)\n {\n $user = User::findOrFail($id);\n return response()->json($user);\n }\n}",
|
|
269
|
-
language:
|
|
270
|
-
filename:
|
|
300
|
+
language: "php",
|
|
301
|
+
filename: "UserController.php",
|
|
271
302
|
},
|
|
272
303
|
parameters: {
|
|
273
304
|
docs: {
|
|
@@ -285,33 +316,33 @@ export var ManyTabs = {
|
|
|
285
316
|
snippets: [
|
|
286
317
|
{
|
|
287
318
|
code: "export const App = () => <div>App</div>;",
|
|
288
|
-
language:
|
|
289
|
-
tabTitle:
|
|
319
|
+
language: "tsx",
|
|
320
|
+
tabTitle: "App.tsx",
|
|
290
321
|
},
|
|
291
322
|
{
|
|
292
323
|
code: "export const Header = () => <header>Header</header>;",
|
|
293
|
-
language:
|
|
294
|
-
tabTitle:
|
|
324
|
+
language: "tsx",
|
|
325
|
+
tabTitle: "Header.tsx",
|
|
295
326
|
},
|
|
296
327
|
{
|
|
297
328
|
code: "export const Footer = () => <footer>Footer</footer>;",
|
|
298
|
-
language:
|
|
299
|
-
tabTitle:
|
|
329
|
+
language: "tsx",
|
|
330
|
+
tabTitle: "Footer.tsx",
|
|
300
331
|
},
|
|
301
332
|
{
|
|
302
333
|
code: "export const Sidebar = () => <aside>Sidebar</aside>;",
|
|
303
|
-
language:
|
|
304
|
-
tabTitle:
|
|
334
|
+
language: "tsx",
|
|
335
|
+
tabTitle: "Sidebar.tsx",
|
|
305
336
|
},
|
|
306
337
|
{
|
|
307
338
|
code: "export const Nav = () => <nav>Nav</nav>;",
|
|
308
|
-
language:
|
|
309
|
-
tabTitle:
|
|
339
|
+
language: "tsx",
|
|
340
|
+
tabTitle: "Navigation.tsx",
|
|
310
341
|
},
|
|
311
342
|
{
|
|
312
343
|
code: "export const Content = () => <main>Content</main>;",
|
|
313
|
-
language:
|
|
314
|
-
tabTitle:
|
|
344
|
+
language: "tsx",
|
|
345
|
+
tabTitle: "ContentArea.tsx",
|
|
315
346
|
},
|
|
316
347
|
],
|
|
317
348
|
},
|
|
@@ -8,6 +8,30 @@ var meta = {
|
|
|
8
8
|
title: 'Components/Collapser',
|
|
9
9
|
component: Collapser,
|
|
10
10
|
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
title: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'Title text displayed in the collapsible header.',
|
|
15
|
+
},
|
|
16
|
+
id: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Optional ID for the title element, useful for anchor links.',
|
|
19
|
+
},
|
|
20
|
+
defaultOpen: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: 'Whether the collapser should be open by default (uncontrolled mode).',
|
|
23
|
+
table: { defaultValue: { summary: 'false' } },
|
|
24
|
+
},
|
|
25
|
+
children: {
|
|
26
|
+
control: false,
|
|
27
|
+
description: 'Content to show/hide when toggling.',
|
|
28
|
+
},
|
|
29
|
+
className: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Additional CSS classes.',
|
|
32
|
+
table: { defaultValue: { summary: '""' } },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
11
35
|
parameters: {
|
|
12
36
|
docs: {
|
|
13
37
|
description: {
|
|
@@ -20,6 +20,35 @@ var meta = {
|
|
|
20
20
|
title: 'Components/CollapserGroup',
|
|
21
21
|
component: CollapserGroup,
|
|
22
22
|
tags: ['autodocs'],
|
|
23
|
+
argTypes: {
|
|
24
|
+
spacing: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'CSS gap value between collapser items.',
|
|
27
|
+
table: { defaultValue: { summary: "'0.5rem'" } },
|
|
28
|
+
},
|
|
29
|
+
allowMultiple: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
description: 'When true, multiple collapsers can be open simultaneously. When false, opening one closes the others (accordion mode).',
|
|
32
|
+
table: { defaultValue: { summary: 'true' } },
|
|
33
|
+
},
|
|
34
|
+
defaultOpen: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Index or array of indexes of collapsers that should be open by default. E.g. `0` or `[0, 2]`.',
|
|
37
|
+
},
|
|
38
|
+
onChange: {
|
|
39
|
+
control: false,
|
|
40
|
+
description: 'Callback fired when the open state changes. Receives an array of currently open indexes.',
|
|
41
|
+
},
|
|
42
|
+
children: {
|
|
43
|
+
control: false,
|
|
44
|
+
description: 'Collapser components to render inside the group.',
|
|
45
|
+
},
|
|
46
|
+
className: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'Additional CSS classes.',
|
|
49
|
+
table: { defaultValue: { summary: '""' } },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
23
52
|
parameters: {
|
|
24
53
|
docs: {
|
|
25
54
|
description: {
|
|
@@ -7,6 +7,26 @@ var meta = {
|
|
|
7
7
|
title: 'Components/Heading',
|
|
8
8
|
component: Heading,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
level: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: [1, 2, 3, 4],
|
|
14
|
+
description: 'Heading level — renders as `<h1>` through `<h4>`.',
|
|
15
|
+
},
|
|
16
|
+
id: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Override the auto-generated `id` attribute. By default the `id` is derived from the heading text.',
|
|
19
|
+
},
|
|
20
|
+
children: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Heading content.',
|
|
23
|
+
},
|
|
24
|
+
className: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Additional CSS classes.',
|
|
27
|
+
table: { defaultValue: { summary: '""' } },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
10
30
|
parameters: {
|
|
11
31
|
docs: {
|
|
12
32
|
description: {
|
|
@@ -7,6 +7,21 @@ var meta = {
|
|
|
7
7
|
title: 'Components/Link',
|
|
8
8
|
component: Link,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
href: {
|
|
12
|
+
control: 'text',
|
|
13
|
+
description: 'Link destination. URLs starting with `http://` or `https://` are treated as external and open in a new tab.',
|
|
14
|
+
},
|
|
15
|
+
children: {
|
|
16
|
+
control: 'text',
|
|
17
|
+
description: 'Link content.',
|
|
18
|
+
},
|
|
19
|
+
className: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Additional CSS classes.',
|
|
22
|
+
table: { defaultValue: { summary: '""' } },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
10
25
|
parameters: {
|
|
11
26
|
docs: {
|
|
12
27
|
description: {
|
|
@@ -4,6 +4,38 @@ declare const meta: {
|
|
|
4
4
|
component: import("react").FC<import("./List").ListProps> & {
|
|
5
5
|
Item: typeof import("./List").ListItem;
|
|
6
6
|
};
|
|
7
|
+
argTypes: {
|
|
8
|
+
ordered: {
|
|
9
|
+
control: "boolean";
|
|
10
|
+
description: string;
|
|
11
|
+
table: {
|
|
12
|
+
defaultValue: {
|
|
13
|
+
summary: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
bullet: {
|
|
18
|
+
control: "text";
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
bulletIcon: {
|
|
22
|
+
control: false;
|
|
23
|
+
description: string;
|
|
24
|
+
};
|
|
25
|
+
children: {
|
|
26
|
+
control: false;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
className: {
|
|
30
|
+
control: "text";
|
|
31
|
+
description: string;
|
|
32
|
+
table: {
|
|
33
|
+
defaultValue: {
|
|
34
|
+
summary: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
7
39
|
parameters: {
|
|
8
40
|
layout: string;
|
|
9
41
|
docs: {
|
|
@@ -5,6 +5,30 @@ import { Callout } from "./Callout";
|
|
|
5
5
|
var meta = {
|
|
6
6
|
title: "Components/List",
|
|
7
7
|
component: List,
|
|
8
|
+
argTypes: {
|
|
9
|
+
ordered: {
|
|
10
|
+
control: 'boolean',
|
|
11
|
+
description: 'When true renders an ordered (numbered) list. When false renders an unordered (bullet) list.',
|
|
12
|
+
table: { defaultValue: { summary: 'true' } },
|
|
13
|
+
},
|
|
14
|
+
bullet: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Custom bullet character for unordered lists (e.g. an emoji like `"✅"`). Only applies when `ordered` is false. Ignored when `bulletIcon` is provided.',
|
|
17
|
+
},
|
|
18
|
+
bulletIcon: {
|
|
19
|
+
control: false,
|
|
20
|
+
description: 'Custom bullet icon as a React node (e.g. an SVG). Takes precedence over `bullet`. Only applies when `ordered` is false.',
|
|
21
|
+
},
|
|
22
|
+
children: {
|
|
23
|
+
control: false,
|
|
24
|
+
description: '`List.Item` components to render.',
|
|
25
|
+
},
|
|
26
|
+
className: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Additional CSS classes.',
|
|
29
|
+
table: { defaultValue: { summary: '""' } },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
8
32
|
parameters: {
|
|
9
33
|
layout: "padded",
|
|
10
34
|
docs: {
|
|
@@ -15,6 +15,51 @@ var meta = {
|
|
|
15
15
|
title: "Components/Popover",
|
|
16
16
|
component: Popover,
|
|
17
17
|
tags: ["autodocs"],
|
|
18
|
+
argTypes: {
|
|
19
|
+
content: {
|
|
20
|
+
control: false,
|
|
21
|
+
description: 'Arbitrary React content rendered inside the popover. Use when the built-in `glossary` or `preview` templates do not fit your use case.',
|
|
22
|
+
},
|
|
23
|
+
glossary: {
|
|
24
|
+
control: false,
|
|
25
|
+
description: 'Renders a styled glossary definition popover. Accepts `{ term, title, definition }` where `definition` is a `ReactNode`.',
|
|
26
|
+
},
|
|
27
|
+
preview: {
|
|
28
|
+
control: false,
|
|
29
|
+
description: 'Renders a Wikipedia-style content preview. Accepts `{ title, excerpt?, imageUrl?, href?, linkText? }`.',
|
|
30
|
+
},
|
|
31
|
+
placement: {
|
|
32
|
+
control: { type: 'select' },
|
|
33
|
+
options: ['auto', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end'],
|
|
34
|
+
description: 'Preferred placement relative to the trigger. `"auto"` detects available viewport space.',
|
|
35
|
+
table: { defaultValue: { summary: "'auto'" } },
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
control: { type: 'select' },
|
|
39
|
+
options: ['sm', 'md', 'lg'],
|
|
40
|
+
description: 'Popover width. `sm` = 240px, `md` = 320px, `lg` = 480px.',
|
|
41
|
+
table: { defaultValue: { summary: "'md'" } },
|
|
42
|
+
},
|
|
43
|
+
showDelay: {
|
|
44
|
+
control: 'number',
|
|
45
|
+
description: 'Milliseconds to wait before showing the popover on hover.',
|
|
46
|
+
table: { defaultValue: { summary: '200' } },
|
|
47
|
+
},
|
|
48
|
+
hideDelay: {
|
|
49
|
+
control: 'number',
|
|
50
|
+
description: 'Milliseconds to wait before hiding the popover on hover-out.',
|
|
51
|
+
table: { defaultValue: { summary: '150' } },
|
|
52
|
+
},
|
|
53
|
+
children: {
|
|
54
|
+
control: 'text',
|
|
55
|
+
description: 'The trigger element — the text or content that reveals the popover on hover or tap.',
|
|
56
|
+
},
|
|
57
|
+
className: {
|
|
58
|
+
control: 'text',
|
|
59
|
+
description: 'Additional CSS classes on the trigger wrapper.',
|
|
60
|
+
table: { defaultValue: { summary: '""' } },
|
|
61
|
+
},
|
|
62
|
+
},
|
|
18
63
|
parameters: {
|
|
19
64
|
layout: "centered",
|
|
20
65
|
docs: {
|
package/dist/components/Tabs.js
CHANGED
|
@@ -21,6 +21,29 @@ var meta = {
|
|
|
21
21
|
title: "Components/Tabs",
|
|
22
22
|
component: Tabs,
|
|
23
23
|
tags: ["autodocs"],
|
|
24
|
+
argTypes: {
|
|
25
|
+
defaultActiveTab: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'ID of the tab that is active by default (uncontrolled mode).',
|
|
28
|
+
},
|
|
29
|
+
activeTab: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Controlled active tab ID. Use together with `onTabChange` to manage state externally.',
|
|
32
|
+
},
|
|
33
|
+
onTabChange: {
|
|
34
|
+
control: false,
|
|
35
|
+
description: 'Callback fired when the active tab changes. Receives the new tab ID.',
|
|
36
|
+
},
|
|
37
|
+
children: {
|
|
38
|
+
control: false,
|
|
39
|
+
description: 'Tab content — typically `TabList` and `TabPanel` components.',
|
|
40
|
+
},
|
|
41
|
+
className: {
|
|
42
|
+
control: 'text',
|
|
43
|
+
description: 'Additional CSS classes applied to the outer container.',
|
|
44
|
+
table: { defaultValue: { summary: '""' } },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
24
47
|
parameters: {
|
|
25
48
|
docs: {
|
|
26
49
|
description: {
|
|
@@ -7,6 +7,23 @@ var meta = {
|
|
|
7
7
|
title: 'Components/Typography',
|
|
8
8
|
component: Typography,
|
|
9
9
|
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['h1', 'h2', 'h3', 'h4', 'p', 'caption'],
|
|
14
|
+
description: 'Typography style variant. `h1`–`h4` render as heading elements; `p` and `caption` render as `<p>`.',
|
|
15
|
+
table: { defaultValue: { summary: "'p'" } },
|
|
16
|
+
},
|
|
17
|
+
children: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Text content.',
|
|
20
|
+
},
|
|
21
|
+
className: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Additional CSS classes.',
|
|
24
|
+
table: { defaultValue: { summary: '""' } },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
10
27
|
parameters: {
|
|
11
28
|
docs: {
|
|
12
29
|
description: {
|
package/dist/styles.css
CHANGED
|
@@ -1080,6 +1080,14 @@ a.no-text-decoration {
|
|
|
1080
1080
|
grid-template-columns: repeat(4, 1fr);
|
|
1081
1081
|
}
|
|
1082
1082
|
}
|
|
1083
|
+
/* Equal height: stretch all cards to the tallest in each row */
|
|
1084
|
+
.dds-card-grid-equal-height > * {
|
|
1085
|
+
height: 100%;
|
|
1086
|
+
}
|
|
1087
|
+
.dds-card-grid-equal-height .dds-card {
|
|
1088
|
+
height: 100%;
|
|
1089
|
+
box-sizing: border-box;
|
|
1090
|
+
}
|
|
1083
1091
|
.dds-collapser {
|
|
1084
1092
|
display: flex;
|
|
1085
1093
|
flex-direction: column;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roadlittledawn/docs-design-system-react",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React components for documentation design system",
|
|
6
6
|
"repository": {
|
|
@@ -37,9 +37,10 @@
|
|
|
37
37
|
"postcss-import": "^16.0.0",
|
|
38
38
|
"typescript": "^5.0.0"
|
|
39
39
|
},
|
|
40
|
+
"sideEffects": false,
|
|
40
41
|
"peerDependencies": {
|
|
41
|
-
"react": "^18.0.0",
|
|
42
|
-
"react-dom": "^18.0.0"
|
|
42
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
43
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
43
44
|
},
|
|
44
45
|
"exports": {
|
|
45
46
|
".": {
|