@roadlittledawn/docs-design-system-react 0.4.0 → 0.6.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 CHANGED
@@ -1,8 +1,9 @@
1
1
  # @roadlittledawn/docs-design-system-react
2
2
 
3
- React components for building documentation interfaces.
3
+ [![npm version](https://img.shields.io/npm/v/@roadlittledawn/docs-design-system-react.svg)](https://www.npmjs.com/package/@roadlittledawn/docs-design-system-react)
4
+ [![GitHub](https://img.shields.io/badge/github-repo-blue.svg)](https://github.com/roadlittledawn/docs-design-system)
4
5
 
5
- See [package on NPM](https://www.npmjs.com/package/@roadlittledawn/docs-design-system-react).
6
+ React components for documentation content and MDX-driven sites.
6
7
 
7
8
  ## Installation
8
9
 
@@ -30,91 +31,9 @@ import "@roadlittledawn/docs-design-system-react/styles.css";
30
31
 
31
32
  ## Components
32
33
 
33
- ### Callout
34
+ Full component documentation with live examples, usage guidelines, and API documentation is available in Storybook:
34
35
 
35
- Highlight important information, warnings, tips, or notes.
36
-
37
- ```tsx
38
- <Callout variant="tip">This is a helpful tip!</Callout>
39
- ```
40
-
41
- ### CodeBlock
42
-
43
- Syntax-highlighted code with copy functionality.
44
-
45
- ```tsx
46
- <CodeBlock language="javascript">
47
- {`const greeting = "Hello, world!";`}
48
- </CodeBlock>
49
- ```
50
-
51
- ### Collapser
52
-
53
- Expandable/collapsible sections for optional or detailed content.
54
-
55
- ```tsx
56
- <Collapser title="More details">Hidden content revealed on expand.</Collapser>
57
- ```
58
-
59
- ### Card
60
-
61
- Clickable card for navigation or content grouping.
62
-
63
- ```tsx
64
- <Card title="Getting Started" href="/docs/intro">
65
- Learn the basics.
66
- </Card>
67
- ```
68
-
69
- ### CardGrid
70
-
71
- Grid layout for organizing multiple cards.
72
-
73
- ```tsx
74
- <CardGrid columns={3}>
75
- <Card title="Guide 1" href="/guide-1">
76
- Description
77
- </Card>
78
- <Card title="Guide 2" href="/guide-2">
79
- Description
80
- </Card>
81
- </CardGrid>
82
- ```
83
-
84
- ### Typography
85
-
86
- Text component with semantic variants.
87
-
88
- ```tsx
89
- <Typography variant="body">Paragraph text</Typography>
90
- ```
91
-
92
- ### Heading
93
-
94
- Semantic heading levels.
95
-
96
- ```tsx
97
- <Heading level={2}>Section Title</Heading>
98
- ```
99
-
100
- ### Link
101
-
102
- Styled anchor with external link detection.
103
-
104
- ```tsx
105
- <Link href="/docs">Internal link</Link>
106
- <Link href="https://example.com">External link</Link>
107
- ```
108
-
109
- ### Button
110
-
111
- Action button with variants.
112
-
113
- ```tsx
114
- <Button variant="primary" onClick={handleClick}>
115
- Click me
116
- </Button>
117
- ```
36
+ **[View Component Documentation →](https://docs-design-system-storybook.netlify.app/?path=/docs/components-button--docs)**
118
37
 
119
38
  ## Dark Mode
120
39
 
@@ -175,11 +94,7 @@ Listen for keyboard events.
175
94
  const isPressed = useKeyPress("Escape");
176
95
  ```
177
96
 
178
- ## Documentation
179
-
180
- Full component documentation with live examples is available in our Storybook.
181
-
182
- **Storybook URL:** _Coming soon_
97
+ Full hook documentation is available in [Storybook](https://docs-design-system-storybook.netlify.app).
183
98
 
184
99
  ## Development
185
100
 
@@ -25,6 +25,13 @@ export var Primary = {
25
25
  variant: 'primary',
26
26
  children: 'Primary Button',
27
27
  },
28
+ parameters: {
29
+ docs: {
30
+ source: {
31
+ code: "<Button variant=\"primary\">Primary Button</Button>",
32
+ },
33
+ },
34
+ },
28
35
  };
29
36
  /**
30
37
  * The secondary button style is used for alternative or less important actions.
@@ -34,6 +41,13 @@ export var Secondary = {
34
41
  variant: 'secondary',
35
42
  children: 'Secondary Button',
36
43
  },
44
+ parameters: {
45
+ docs: {
46
+ source: {
47
+ code: "<Button variant=\"secondary\">Secondary Button</Button>",
48
+ },
49
+ },
50
+ },
37
51
  };
38
52
  /**
39
53
  * The outline button style is used for tertiary actions or when you need a more subtle button.
@@ -43,6 +57,13 @@ export var Outline = {
43
57
  variant: 'outline',
44
58
  children: 'Outline Button',
45
59
  },
60
+ parameters: {
61
+ docs: {
62
+ source: {
63
+ code: "<Button variant=\"outline\">Outline Button</Button>",
64
+ },
65
+ },
66
+ },
46
67
  };
47
68
  /**
48
69
  * Small button size for compact interfaces or less prominent actions.
@@ -53,6 +74,13 @@ export var Small = {
53
74
  size: 'sm',
54
75
  children: 'Small Button',
55
76
  },
77
+ parameters: {
78
+ docs: {
79
+ source: {
80
+ code: "<Button variant=\"primary\" size=\"sm\">Small Button</Button>",
81
+ },
82
+ },
83
+ },
56
84
  };
57
85
  /**
58
86
  * Medium is the default button size, suitable for most use cases.
@@ -63,6 +91,13 @@ export var Medium = {
63
91
  size: 'md',
64
92
  children: 'Medium Button',
65
93
  },
94
+ parameters: {
95
+ docs: {
96
+ source: {
97
+ code: "<Button variant=\"primary\" size=\"md\">Medium Button</Button>",
98
+ },
99
+ },
100
+ },
66
101
  };
67
102
  /**
68
103
  * Large button size for prominent calls-to-action.
@@ -73,6 +108,13 @@ export var Large = {
73
108
  size: 'lg',
74
109
  children: 'Large Button',
75
110
  },
111
+ parameters: {
112
+ docs: {
113
+ source: {
114
+ code: "<Button variant=\"primary\" size=\"lg\">Large Button</Button>",
115
+ },
116
+ },
117
+ },
76
118
  };
77
119
  /**
78
120
  * Disabled state for buttons that are temporarily unavailable.
@@ -83,16 +125,37 @@ export var Disabled = {
83
125
  children: 'Disabled Button',
84
126
  disabled: true,
85
127
  },
128
+ parameters: {
129
+ docs: {
130
+ source: {
131
+ code: "<Button variant=\"primary\" disabled>Disabled Button</Button>",
132
+ },
133
+ },
134
+ },
86
135
  };
87
136
  /**
88
137
  * Example showing all button variants side by side for comparison.
89
138
  */
90
139
  export var AllVariants = {
140
+ parameters: {
141
+ docs: {
142
+ source: {
143
+ code: "<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap', alignItems: 'center' }}>\n <Button variant=\"primary\">Primary</Button>\n <Button variant=\"secondary\">Secondary</Button>\n <Button variant=\"outline\">Outline</Button>\n</div>",
144
+ },
145
+ },
146
+ },
91
147
  render: function () { return (_jsxs("div", { style: { display: 'flex', gap: '1rem', flexWrap: 'wrap', alignItems: 'center' }, children: [_jsx(Button, { variant: "primary", children: "Primary" }), _jsx(Button, { variant: "secondary", children: "Secondary" }), _jsx(Button, { variant: "outline", children: "Outline" })] })); },
92
148
  };
93
149
  /**
94
150
  * Example showing all button sizes side by side for comparison.
95
151
  */
96
152
  export var AllSizes = {
153
+ parameters: {
154
+ docs: {
155
+ source: {
156
+ code: "<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap', alignItems: 'center' }}>\n <Button size=\"sm\">Small</Button>\n <Button size=\"md\">Medium</Button>\n <Button size=\"lg\">Large</Button>\n</div>",
157
+ },
158
+ },
159
+ },
97
160
  render: function () { return (_jsxs("div", { style: { display: 'flex', gap: '1rem', flexWrap: 'wrap', alignItems: 'center' }, children: [_jsx(Button, { size: "sm", children: "Small" }), _jsx(Button, { size: "md", children: "Medium" }), _jsx(Button, { size: "lg", children: "Large" })] })); },
98
161
  };
@@ -24,6 +24,13 @@ export var Caution = {
24
24
  variant: 'caution',
25
25
  children: 'This operation cannot be undone. Make sure you have a backup before proceeding.',
26
26
  },
27
+ parameters: {
28
+ docs: {
29
+ source: {
30
+ code: "<Callout variant=\"caution\">\n This operation cannot be undone. Make sure you have a backup before proceeding.\n</Callout>",
31
+ },
32
+ },
33
+ },
27
34
  };
28
35
  /**
29
36
  * Important callout for critical information.
@@ -33,6 +40,13 @@ export var Important = {
33
40
  variant: 'important',
34
41
  children: 'All users must update their passwords by the end of the month to comply with the new security policy.',
35
42
  },
43
+ parameters: {
44
+ docs: {
45
+ source: {
46
+ code: "<Callout variant=\"important\">\n All users must update their passwords by the end of the month to comply with the new security policy.\n</Callout>",
47
+ },
48
+ },
49
+ },
36
50
  };
37
51
  /**
38
52
  * Tip callout for helpful suggestions.
@@ -42,6 +56,13 @@ export var Tip = {
42
56
  variant: 'tip',
43
57
  children: 'You can use keyboard shortcuts (Cmd+K or Ctrl+K) to quickly search the documentation.',
44
58
  },
59
+ parameters: {
60
+ docs: {
61
+ source: {
62
+ code: "<Callout variant=\"tip\">\n You can use keyboard shortcuts (Cmd+K or Ctrl+K) to quickly search the documentation.\n</Callout>",
63
+ },
64
+ },
65
+ },
45
66
  };
46
67
  /**
47
68
  * Course callout for learning-oriented content.
@@ -51,6 +72,13 @@ export var Course = {
51
72
  variant: 'course',
52
73
  children: 'In this section, you will learn how to configure your development environment and install the necessary dependencies.',
53
74
  },
75
+ parameters: {
76
+ docs: {
77
+ source: {
78
+ code: "<Callout variant=\"course\">\n In this section, you will learn how to configure your development environment and install the necessary dependencies.\n</Callout>",
79
+ },
80
+ },
81
+ },
54
82
  };
55
83
  /**
56
84
  * Callout with a custom title.
@@ -61,6 +89,13 @@ export var CustomTitle = {
61
89
  title: 'Security Notice',
62
90
  children: 'Two-factor authentication is now required for all administrator accounts.',
63
91
  },
92
+ parameters: {
93
+ docs: {
94
+ source: {
95
+ code: "<Callout variant=\"important\" title=\"Security Notice\">\n Two-factor authentication is now required for all administrator accounts.\n</Callout>",
96
+ },
97
+ },
98
+ },
64
99
  };
65
100
  /**
66
101
  * Callout without a title.
@@ -71,10 +106,24 @@ export var NoTitle = {
71
106
  title: null,
72
107
  children: 'This callout has no title and displays only the content.',
73
108
  },
109
+ parameters: {
110
+ docs: {
111
+ source: {
112
+ code: "<Callout variant=\"tip\" title={null}>\n This callout has no title and displays only the content.\n</Callout>",
113
+ },
114
+ },
115
+ },
74
116
  };
75
117
  /**
76
118
  * All callout variants displayed together for comparison.
77
119
  */
78
120
  export var AllVariants = {
121
+ parameters: {
122
+ docs: {
123
+ source: {
124
+ code: "<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>\n <Callout variant=\"caution\">\n Caution: Be careful when modifying system files.\n </Callout>\n <Callout variant=\"important\">\n Important: This feature requires administrator privileges.\n </Callout>\n <Callout variant=\"tip\">\n Tip: Use the search function to find topics quickly.\n </Callout>\n <Callout variant=\"course\">\n Course: This module covers the basics of component design.\n </Callout>\n</div>",
125
+ },
126
+ },
127
+ },
79
128
  render: function () { return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsx(Callout, { variant: "caution", children: "Caution: Be careful when modifying system files." }), _jsx(Callout, { variant: "important", children: "Important: This feature requires administrator privileges." }), _jsx(Callout, { variant: "tip", children: "Tip: Use the search function to find topics quickly." }), _jsx(Callout, { variant: "course", children: "Course: This module covers the basics of component design." })] })); },
80
129
  };
@@ -24,6 +24,13 @@ export var Basic = {
24
24
  title: 'Getting Started',
25
25
  children: 'Learn the basics of using this documentation system.',
26
26
  },
27
+ parameters: {
28
+ docs: {
29
+ source: {
30
+ code: "<Card title=\"Getting Started\">\n Learn the basics of using this documentation system.\n</Card>",
31
+ },
32
+ },
33
+ },
27
34
  };
28
35
  /**
29
36
  * Clickable card that links to another page.
@@ -34,6 +41,13 @@ export var Clickable = {
34
41
  href: '/docs/api',
35
42
  children: 'Complete reference for all available components and utilities.',
36
43
  },
44
+ parameters: {
45
+ docs: {
46
+ source: {
47
+ code: "<Card title=\"API Reference\" href=\"/docs/api\">\n Complete reference for all available components and utilities.\n</Card>",
48
+ },
49
+ },
50
+ },
37
51
  };
38
52
  /**
39
53
  * Card with colored background.
@@ -45,6 +59,13 @@ export var ColoredBackground = {
45
59
  backgroundColor: 'blue',
46
60
  children: 'Check out our latest component additions.',
47
61
  },
62
+ parameters: {
63
+ docs: {
64
+ source: {
65
+ code: "<Card title=\"New Feature\" titleColor=\"blue\" backgroundColor=\"blue\">\n Check out our latest component additions.\n</Card>",
66
+ },
67
+ },
68
+ },
48
69
  };
49
70
  /**
50
71
  * Card without a title.
@@ -53,16 +74,37 @@ export var NoTitle = {
53
74
  args: {
54
75
  children: 'This card displays content without a title.',
55
76
  },
77
+ parameters: {
78
+ docs: {
79
+ source: {
80
+ code: "<Card>This card displays content without a title.</Card>",
81
+ },
82
+ },
83
+ },
56
84
  };
57
85
  /**
58
86
  * All title color variants.
59
87
  */
60
88
  export var TitleColors = {
89
+ parameters: {
90
+ docs: {
91
+ source: {
92
+ code: "<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>\n <Card title=\"Blue Title\" titleColor=\"blue\">Content with blue title</Card>\n <Card title=\"Green Title\" titleColor=\"green\">Content with green title</Card>\n <Card title=\"Purple Title\" titleColor=\"purple\">Content with purple title</Card>\n <Card title=\"Red Title\" titleColor=\"red\">Content with red title</Card>\n <Card title=\"Yellow Title\" titleColor=\"yellow\">Content with yellow title</Card>\n <Card title=\"Gray Title\" titleColor=\"gray\">Content with gray title</Card>\n</div>",
93
+ },
94
+ },
95
+ },
61
96
  render: function () { return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsx(Card, { title: "Blue Title", titleColor: "blue", children: "Content with blue title" }), _jsx(Card, { title: "Green Title", titleColor: "green", children: "Content with green title" }), _jsx(Card, { title: "Purple Title", titleColor: "purple", children: "Content with purple title" }), _jsx(Card, { title: "Red Title", titleColor: "red", children: "Content with red title" }), _jsx(Card, { title: "Yellow Title", titleColor: "yellow", children: "Content with yellow title" }), _jsx(Card, { title: "Gray Title", titleColor: "gray", children: "Content with gray title" })] })); },
62
97
  };
63
98
  /**
64
99
  * All background color variants.
65
100
  */
66
101
  export var BackgroundColors = {
102
+ parameters: {
103
+ docs: {
104
+ source: {
105
+ code: "<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>\n <Card title=\"Blue\" backgroundColor=\"blue\">Card with blue background</Card>\n <Card title=\"Green\" backgroundColor=\"green\">Card with green background</Card>\n <Card title=\"Purple\" backgroundColor=\"purple\">Card with purple background</Card>\n <Card title=\"Red\" backgroundColor=\"red\">Card with red background</Card>\n <Card title=\"Yellow\" backgroundColor=\"yellow\">Card with yellow background</Card>\n <Card title=\"Gray\" backgroundColor=\"gray\">Card with gray background</Card>\n <Card title=\"White\" backgroundColor=\"white\">Card with white background</Card>\n</div>",
106
+ },
107
+ },
108
+ },
67
109
  render: function () { return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsx(Card, { title: "Blue", backgroundColor: "blue", children: "Card with blue background" }), _jsx(Card, { title: "Green", backgroundColor: "green", children: "Card with green background" }), _jsx(Card, { title: "Purple", backgroundColor: "purple", children: "Card with purple background" }), _jsx(Card, { title: "Red", backgroundColor: "red", children: "Card with red background" }), _jsx(Card, { title: "Yellow", backgroundColor: "yellow", children: "Card with yellow background" }), _jsx(Card, { title: "Gray", backgroundColor: "gray", children: "Card with gray background" }), _jsx(Card, { title: "White", backgroundColor: "white", children: "Card with white background" })] })); },
68
110
  };
@@ -25,6 +25,13 @@ export var TwoColumns = {
25
25
  columns: 2,
26
26
  children: (_jsxs(_Fragment, { children: [_jsx(Card, { title: "Getting Started", children: "Learn the basics of our documentation system." }), _jsx(Card, { title: "Components", children: "Explore all available UI components." }), _jsx(Card, { title: "Best Practices", children: "Follow guidelines for effective documentation." }), _jsx(Card, { title: "Examples", children: "See real-world usage examples." })] })),
27
27
  },
28
+ parameters: {
29
+ docs: {
30
+ source: {
31
+ code: "<CardGrid columns={2}>\n <Card title=\"Getting Started\">Learn the basics of our documentation system.</Card>\n <Card title=\"Components\">Explore all available UI components.</Card>\n <Card title=\"Best Practices\">Follow guidelines for effective documentation.</Card>\n <Card title=\"Examples\">See real-world usage examples.</Card>\n</CardGrid>",
32
+ },
33
+ },
34
+ },
28
35
  };
29
36
  /**
30
37
  * Grid with 3 columns (default, responsive).
@@ -34,6 +41,13 @@ export var ThreeColumns = {
34
41
  columns: 3,
35
42
  children: (_jsxs(_Fragment, { children: [_jsx(Card, { title: "Tutorials", children: "Step-by-step learning guides." }), _jsx(Card, { title: "How-To Guides", children: "Task-oriented instructions." }), _jsx(Card, { title: "Reference", children: "Technical reference documentation." }), _jsx(Card, { title: "Explanation", children: "Conceptual background information." }), _jsx(Card, { title: "API", children: "Complete API documentation." }), _jsx(Card, { title: "FAQ", children: "Frequently asked questions." })] })),
36
43
  },
44
+ parameters: {
45
+ docs: {
46
+ source: {
47
+ code: "<CardGrid columns={3}>\n <Card title=\"Tutorials\">Step-by-step learning guides.</Card>\n <Card title=\"How-To Guides\">Task-oriented instructions.</Card>\n <Card title=\"Reference\">Technical reference documentation.</Card>\n <Card title=\"Explanation\">Conceptual background information.</Card>\n <Card title=\"API\">Complete API documentation.</Card>\n <Card title=\"FAQ\">Frequently asked questions.</Card>\n</CardGrid>",
48
+ },
49
+ },
50
+ },
37
51
  };
38
52
  /**
39
53
  * Grid with 4 columns (responsive).
@@ -43,6 +57,13 @@ export var FourColumns = {
43
57
  columns: 4,
44
58
  children: (_jsxs(_Fragment, { children: [_jsx(Card, { titleColor: "blue", backgroundColor: "blue", children: "Feature 1" }), _jsx(Card, { titleColor: "green", backgroundColor: "green", children: "Feature 2" }), _jsx(Card, { titleColor: "purple", backgroundColor: "purple", children: "Feature 3" }), _jsx(Card, { titleColor: "red", backgroundColor: "red", children: "Feature 4" }), _jsx(Card, { titleColor: "yellow", backgroundColor: "yellow", children: "Feature 5" }), _jsx(Card, { titleColor: "gray", backgroundColor: "gray", children: "Feature 6" }), _jsx(Card, { titleColor: "blue", backgroundColor: "blue", children: "Feature 7" }), _jsx(Card, { titleColor: "green", backgroundColor: "green", children: "Feature 8" })] })),
45
59
  },
60
+ parameters: {
61
+ docs: {
62
+ source: {
63
+ code: "<CardGrid columns={4}>\n <Card titleColor=\"blue\" backgroundColor=\"blue\">Feature 1</Card>\n <Card titleColor=\"green\" backgroundColor=\"green\">Feature 2</Card>\n <Card titleColor=\"purple\" backgroundColor=\"purple\">Feature 3</Card>\n <Card titleColor=\"red\" backgroundColor=\"red\">Feature 4</Card>\n <Card titleColor=\"yellow\" backgroundColor=\"yellow\">Feature 5</Card>\n <Card titleColor=\"gray\" backgroundColor=\"gray\">Feature 6</Card>\n <Card titleColor=\"blue\" backgroundColor=\"blue\">Feature 7</Card>\n <Card titleColor=\"green\" backgroundColor=\"green\">Feature 8</Card>\n</CardGrid>",
64
+ },
65
+ },
66
+ },
46
67
  };
47
68
  /**
48
69
  * Grid with clickable cards.
@@ -52,4 +73,11 @@ export var ClickableCards = {
52
73
  columns: 3,
53
74
  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" }), _jsx(Card, { title: "Examples", href: "/examples", children: "Code examples and patterns" })] })),
54
75
  },
76
+ parameters: {
77
+ docs: {
78
+ source: {
79
+ code: "<CardGrid columns={3}>\n <Card title=\"Documentation\" href=\"/docs\">Complete documentation guide</Card>\n <Card title=\"API Reference\" href=\"/api\">Detailed API reference</Card>\n <Card title=\"Examples\" href=\"/examples\">Code examples and patterns</Card>\n</CardGrid>",
80
+ },
81
+ },
82
+ },
55
83
  };
@@ -23,6 +23,13 @@ export var Basic = {
23
23
  code: "function greet(name: string) {\n return `Hello, ${name}!`;\n}\n\nconsole.log(greet(\"World\"));",
24
24
  language: 'typescript',
25
25
  },
26
+ parameters: {
27
+ docs: {
28
+ source: {
29
+ code: "<CodeBlock\n language=\"typescript\"\n code={`function greet(name: string) {\n return \\`Hello, \\${name}!\\`;\n}\n\nconsole.log(greet(\"World\"));`}\n/>",
30
+ },
31
+ },
32
+ },
26
33
  };
27
34
  /**
28
35
  * Code block with a filename displayed.
@@ -33,6 +40,13 @@ export var WithFilename = {
33
40
  language: 'jsx',
34
41
  filename: 'Button.jsx',
35
42
  },
43
+ parameters: {
44
+ docs: {
45
+ source: {
46
+ code: "<CodeBlock\n language=\"jsx\"\n filename=\"Button.jsx\"\n code={`export const Button = ({ children, onClick }) => {\n return (\n <button onClick={onClick}>\n {children}\n </button>\n );\n};`}\n/>",
47
+ },
48
+ },
49
+ },
36
50
  };
37
51
  /**
38
52
  * Code block with highlighted lines.
@@ -43,6 +57,13 @@ export var WithHighlightedLines = {
43
57
  language: 'javascript',
44
58
  highlightLines: [2, 3, 4],
45
59
  },
60
+ parameters: {
61
+ docs: {
62
+ source: {
63
+ code: "<CodeBlock\n language=\"javascript\"\n highlightLines={[2, 3, 4]}\n 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}`}\n/>",
64
+ },
65
+ },
66
+ },
46
67
  };
47
68
  /**
48
69
  * Multiple code snippets displayed in tabs.
@@ -70,6 +91,13 @@ export var WithTabs = {
70
91
  },
71
92
  ],
72
93
  },
94
+ parameters: {
95
+ docs: {
96
+ source: {
97
+ code: "<CodeBlock\n snippets={[\n {\n code: `export const Button = ({ children }) => {\n return <button>{children}</button>;\n};`,\n language: 'jsx',\n filename: 'Button.jsx',\n tabTitle: 'Button.jsx',\n },\n {\n code: `.button {\n padding: 0.5rem 1rem;\n background-color: blue;\n color: white;\n}`,\n language: 'css',\n filename: 'Button.css',\n tabTitle: 'Button.css',\n },\n {\n code: `import { Button } from './Button';\n\nexport default {\n component: Button,\n};`,\n language: 'typescript',\n filename: 'Button.stories.ts',\n tabTitle: 'Button.stories.ts',\n },\n ]}\n/>",
98
+ },
99
+ },
100
+ },
73
101
  };
74
102
  /**
75
103
  * Multiple language versions with language dropdown.
@@ -99,6 +127,13 @@ export var WithLanguageDropdown = {
99
127
  },
100
128
  ],
101
129
  },
130
+ parameters: {
131
+ docs: {
132
+ source: {
133
+ code: "<CodeBlock\n snippets={[\n { code: `function greet(name: string): string {\n return \\`Hello, \\${name}!\\`;\n}`, language: 'typescript', filename: 'greet.ts' },\n { code: `function greet(name) {\n return \\`Hello, \\${name}!\\`;\n}`, language: 'javascript', filename: 'greet.js' },\n { code: `def greet(name):\n return f\"Hello, {name}!\"`, language: 'python', filename: 'greet.py' },\n { code: `def greet(name)\n \"Hello, #{name}!\"\nend`, language: 'ruby', filename: 'greet.rb' },\n ]}\n/>",
134
+ },
135
+ },
136
+ },
102
137
  };
103
138
  /**
104
139
  * Complex example with tabs and highlighted lines.
@@ -122,6 +157,13 @@ export var ComplexExample = {
122
157
  },
123
158
  ],
124
159
  },
160
+ parameters: {
161
+ docs: {
162
+ source: {
163
+ code: "<CodeBlock\n snippets={[\n {\n 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}`,\n language: 'jsx',\n filename: 'Button.jsx',\n tabTitle: 'Button.jsx',\n highlightLines: [3, 4, 5],\n },\n {\n code: `.btn {\n padding: 0.5rem 1rem;\n background-color: #3b82f6;\n color: white;\n border-radius: 0.375rem;\n}`,\n language: 'css',\n filename: 'Button.css',\n tabTitle: 'Button.css',\n highlightLines: [2, 3],\n },\n ]}\n/>",
164
+ },
165
+ },
166
+ },
125
167
  };
126
168
  /**
127
169
  * Example using path prop to load from external markdown file.
@@ -131,6 +173,13 @@ export var WithPath = {
131
173
  args: {
132
174
  path: 'https://raw.githubusercontent.com/storybookjs/storybook/47e331ffbaa61a476ddb873bdb12bf46a93a5131/docs/_snippets/before-each-in-meta-mock-date.md',
133
175
  },
176
+ parameters: {
177
+ docs: {
178
+ source: {
179
+ code: "<CodeBlock path=\"https://raw.githubusercontent.com/storybookjs/storybook/47e331ffbaa61a476ddb873bdb12bf46a93a5131/docs/_snippets/before-each-in-meta-mock-date.md\" />",
180
+ },
181
+ },
182
+ },
134
183
  };
135
184
  /**
136
185
  * JSON code example.
@@ -141,6 +190,13 @@ export var JSONExample = {
141
190
  language: 'json',
142
191
  filename: 'package.json',
143
192
  },
193
+ parameters: {
194
+ docs: {
195
+ source: {
196
+ code: "<CodeBlock\n language=\"json\"\n filename=\"package.json\"\n code={`{\n \"name\": \"docs-design-system\",\n \"version\": \"0.1.0\",\n \"dependencies\": {\n \"react\": \"^18.0.0\"\n }\n}`}\n/>",
197
+ },
198
+ },
199
+ },
144
200
  };
145
201
  /**
146
202
  * Bash/shell script example.
@@ -151,6 +207,13 @@ export var BashExample = {
151
207
  language: 'bash',
152
208
  filename: 'setup.sh',
153
209
  },
210
+ parameters: {
211
+ docs: {
212
+ source: {
213
+ code: "<CodeBlock\n language=\"bash\"\n filename=\"setup.sh\"\n code={`#!/bin/bash\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Run tests\nnpm test`}\n/>",
214
+ },
215
+ },
216
+ },
154
217
  };
155
218
  /**
156
219
  * Multiple TSX files displayed as flat tabs with bottom-border accent.
@@ -172,6 +235,13 @@ export var WithFilenameTabs = {
172
235
  },
173
236
  ],
174
237
  },
238
+ parameters: {
239
+ docs: {
240
+ source: {
241
+ code: "<CodeBlock\n snippets={[\n {\n 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}`,\n language: 'tsx',\n filename: 'Example.tsx',\n tabTitle: 'Example.tsx',\n },\n {\n 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}`,\n language: 'tsx',\n filename: 'Advanced.tsx',\n tabTitle: 'Advanced.tsx',\n },\n ]}\n/>",
242
+ },
243
+ },
244
+ },
175
245
  };
176
246
  /**
177
247
  * Single snippet with a filename — displays a flat filename label in the header.
@@ -182,6 +252,13 @@ export var SingleFilename = {
182
252
  language: 'tsx',
183
253
  filename: 'page.tsx',
184
254
  },
255
+ parameters: {
256
+ docs: {
257
+ source: {
258
+ code: "<CodeBlock\n language=\"tsx\"\n filename=\"page.tsx\"\n code={`export default function Home() {\n return <h1>Welcome</h1>;\n}`}\n/>",
259
+ },
260
+ },
261
+ },
185
262
  };
186
263
  /**
187
264
  * PHP syntax highlighting example.
@@ -192,6 +269,13 @@ export var PHPExample = {
192
269
  language: 'php',
193
270
  filename: 'UserController.php',
194
271
  },
272
+ parameters: {
273
+ docs: {
274
+ source: {
275
+ code: "<CodeBlock\n language=\"php\"\n filename=\"UserController.php\"\n 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}`}\n/>",
276
+ },
277
+ },
278
+ },
195
279
  };
196
280
  /**
197
281
  * Many tabs to verify horizontal scroll behavior.
@@ -231,4 +315,11 @@ export var ManyTabs = {
231
315
  },
232
316
  ],
233
317
  },
318
+ parameters: {
319
+ docs: {
320
+ source: {
321
+ code: "<CodeBlock\n snippets={[\n { code: `export const App = () => <div>App</div>;`, language: 'tsx', tabTitle: 'App.tsx' },\n { code: `export const Header = () => <header>Header</header>;`, language: 'tsx', tabTitle: 'Header.tsx' },\n { code: `export const Footer = () => <footer>Footer</footer>;`, language: 'tsx', tabTitle: 'Footer.tsx' },\n { code: `export const Sidebar = () => <aside>Sidebar</aside>;`, language: 'tsx', tabTitle: 'Sidebar.tsx' },\n { code: `export const Nav = () => <nav>Nav</nav>;`, language: 'tsx', tabTitle: 'Navigation.tsx' },\n { code: `export const Content = () => <main>Content</main>;`, language: 'tsx', tabTitle: 'ContentArea.tsx' },\n ]}\n/>",
322
+ },
323
+ },
324
+ },
234
325
  };