@roadlittledawn/docs-design-system-react 0.6.1 → 0.7.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.
@@ -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, _c = _a.className, className = _c === void 0 ? '' : _c;
4
- var classNames = "dds-card-grid dds-card-grid-".concat(columns, " ").concat(className).trim();
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,5 +1,5 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { CodeBlock } from './CodeBlock';
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 './CodeBlock';
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: 'Components/CodeBlock',
6
+ title: "Components/CodeBlock",
7
7
  component: CodeBlock,
8
- tags: ['autodocs'],
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: 'typescript',
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: 'jsx',
41
- filename: 'Button.jsx',
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: 'javascript',
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: 'jsx',
77
- filename: 'Button.jsx',
78
- tabTitle: 'Button.jsx',
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: 'css',
83
- filename: 'Button.css',
84
- tabTitle: 'Button.css',
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: 'typescript',
89
- filename: 'Button.stories.ts',
90
- tabTitle: 'Button.stories.ts',
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: 'typescript',
111
- filename: 'greet.ts',
141
+ language: "typescript",
142
+ filename: "greet.ts",
112
143
  },
113
144
  {
114
145
  code: "function greet(name) {\n return `Hello, ${name}!`;\n}",
115
- language: 'javascript',
116
- filename: 'greet.js',
146
+ language: "javascript",
147
+ filename: "greet.js",
117
148
  },
118
149
  {
119
150
  code: "def greet(name):\n return f\"Hello, {name}!\"",
120
- language: 'python',
121
- filename: 'greet.py',
151
+ language: "python",
152
+ filename: "greet.py",
122
153
  },
123
154
  {
124
155
  code: "def greet(name)\n \"Hello, #{name}!\"\nend",
125
- language: 'ruby',
126
- filename: 'greet.rb',
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: 'jsx',
147
- filename: 'Button.jsx',
148
- tabTitle: 'Button.jsx',
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: 'css',
154
- filename: 'Button.css',
155
- tabTitle: 'Button.css',
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: 'https://raw.githubusercontent.com/storybookjs/storybook/47e331ffbaa61a476ddb873bdb12bf46a93a5131/docs/_snippets/before-each-in-meta-mock-date.md',
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: 'json',
191
- filename: 'package.json',
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: 'bash',
208
- filename: 'setup.sh',
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: 'tsx',
227
- filename: 'Example.tsx',
228
- tabTitle: 'Example.tsx',
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: 'tsx',
233
- filename: 'Advanced.tsx',
234
- tabTitle: 'Advanced.tsx',
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: 'tsx',
253
- filename: 'page.tsx',
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: 'php',
270
- filename: 'UserController.php',
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: 'tsx',
289
- tabTitle: 'App.tsx',
319
+ language: "tsx",
320
+ tabTitle: "App.tsx",
290
321
  },
291
322
  {
292
323
  code: "export const Header = () => <header>Header</header>;",
293
- language: 'tsx',
294
- tabTitle: 'Header.tsx',
324
+ language: "tsx",
325
+ tabTitle: "Header.tsx",
295
326
  },
296
327
  {
297
328
  code: "export const Footer = () => <footer>Footer</footer>;",
298
- language: 'tsx',
299
- tabTitle: 'Footer.tsx',
329
+ language: "tsx",
330
+ tabTitle: "Footer.tsx",
300
331
  },
301
332
  {
302
333
  code: "export const Sidebar = () => <aside>Sidebar</aside>;",
303
- language: 'tsx',
304
- tabTitle: 'Sidebar.tsx',
334
+ language: "tsx",
335
+ tabTitle: "Sidebar.tsx",
305
336
  },
306
337
  {
307
338
  code: "export const Nav = () => <nav>Nav</nav>;",
308
- language: 'tsx',
309
- tabTitle: 'Navigation.tsx',
339
+ language: "tsx",
340
+ tabTitle: "Navigation.tsx",
310
341
  },
311
342
  {
312
343
  code: "export const Content = () => <main>Content</main>;",
313
- language: 'tsx',
314
- tabTitle: 'ContentArea.tsx',
344
+ language: "tsx",
345
+ tabTitle: "ContentArea.tsx",
315
346
  },
316
347
  ],
317
348
  },
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from "react";
2
- interface CollapserProps {
2
+ export interface CollapserProps {
3
3
  /** Title text or element displayed in the collapsible header */
4
4
  title: string | ReactNode;
5
5
  /** Optional ID for the title element */
@@ -21,6 +21,23 @@ interface CollapserProps {
21
21
  children: ReactNode;
22
22
  /** Additional CSS classes */
23
23
  className?: string;
24
+ /**
25
+ * Alignment of the title within the header.
26
+ * Use 'right' for right-aligned titles, typically paired with an icon on the left.
27
+ * @default 'left'
28
+ */
29
+ align?: 'left' | 'right';
30
+ /**
31
+ * Optional icon or React element rendered on the left side of the header,
32
+ * before the title text. Useful for visual identification of each section.
33
+ */
34
+ icon?: ReactNode;
35
+ /**
36
+ * Numeric step label shown on the far left of the header.
37
+ * Automatically injected by `CollapserGroup` when `numbered` is true;
38
+ * can also be set manually on individual collapsers.
39
+ * Use `--dds-collapser-step-number-color` to customise its colour.
40
+ */
41
+ stepNumber?: number;
24
42
  }
25
- export declare function Collapser({ title, id, defaultOpen, open: controlledOpen, onToggle, children, className, }: CollapserProps): import("react/jsx-runtime").JSX.Element;
26
- export {};
43
+ export declare function Collapser({ title, id, defaultOpen, open: controlledOpen, onToggle, children, className, align, icon, stepNumber, }: CollapserProps): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,13 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useState, useRef, useEffect } from "react";
4
4
  import { useKeyPress } from "../hooks/useKeyPress";
5
5
  export function Collapser(_a) {
6
- var title = _a.title, id = _a.id, _b = _a.defaultOpen, defaultOpen = _b === void 0 ? false : _b, controlledOpen = _a.open, onToggle = _a.onToggle, children = _a.children, _c = _a.className, className = _c === void 0 ? "" : _c;
7
- var _d = useState(defaultOpen), uncontrolledOpen = _d[0], setUncontrolledOpen = _d[1];
6
+ var title = _a.title, id = _a.id, _b = _a.defaultOpen, defaultOpen = _b === void 0 ? false : _b, controlledOpen = _a.open, onToggle = _a.onToggle, children = _a.children, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.align, align = _d === void 0 ? 'left' : _d, icon = _a.icon, stepNumber = _a.stepNumber;
7
+ var _e = useState(defaultOpen), uncontrolledOpen = _e[0], setUncontrolledOpen = _e[1];
8
8
  var isControlled = controlledOpen !== undefined;
9
9
  var isOpen = isControlled ? controlledOpen : uncontrolledOpen;
10
- var _e = useState(undefined), height = _e[0], setHeight = _e[1];
10
+ var _f = useState(undefined), height = _f[0], setHeight = _f[1];
11
11
  var contentRef = useRef(null);
12
12
  // Keyboard shortcuts: 's' or 'f' to show, 'h' to hide
13
13
  useKeyPress(['s', 'f', 'h'], function (e) {
@@ -28,10 +28,14 @@ export function Collapser(_a) {
28
28
  setUncontrolledOpen(!uncontrolledOpen);
29
29
  }
30
30
  };
31
- var collapserClasses = ["dds-collapser", className]
31
+ var collapserClasses = [
32
+ "dds-collapser",
33
+ align === 'right' ? "dds-collapser--align-right" : "",
34
+ className,
35
+ ]
32
36
  .filter(Boolean)
33
37
  .join(" ");
34
- return (_jsxs("div", { className: collapserClasses, children: [_jsxs("button", { onClick: toggleOpen, type: "button", className: "dds-collapser-button", "aria-expanded": isOpen, children: [_jsx("h5", { id: id, className: "dds-collapser-title", children: title }), _jsx("svg", { className: "dds-collapser-icon ".concat(isOpen ? "dds-collapser-icon-open" : ""), width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "6 9 12 15 18 9" }) })] }), _jsx("div", { className: "dds-collapser-content-wrapper", style: {
38
+ return (_jsxs("div", { className: collapserClasses, children: [_jsxs("button", { onClick: toggleOpen, type: "button", className: "dds-collapser-button", "aria-expanded": isOpen, children: [stepNumber !== undefined && (_jsxs("span", { className: "dds-collapser-step-number", children: [stepNumber, "."] })), icon && (_jsx("span", { className: "dds-collapser-header-icon", "aria-hidden": "true", children: icon })), _jsx("h5", { id: id, className: "dds-collapser-title", children: title }), _jsx("svg", { className: "dds-collapser-icon ".concat(isOpen ? "dds-collapser-icon-open" : ""), width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "6 9 12 15 18 9" }) })] }), _jsx("div", { className: "dds-collapser-content-wrapper", style: {
35
39
  height: isOpen ? height : 0,
36
40
  }, children: _jsx("div", { ref: contentRef, className: "dds-collapser-content", children: children }) })] }));
37
41
  }
@@ -18,11 +18,44 @@ export declare const DefaultOpen: Story;
18
18
  * Collapser with an ID for the title.
19
19
  */
20
20
  export declare const WithID: Story;
21
+ /**
22
+ * Collapser with an icon rendered on the left side of the header.
23
+ * The icon prop accepts any React element — use your own icon component or SVG.
24
+ */
25
+ export declare const WithIcon: Story;
26
+ /**
27
+ * Collapser with the title right-aligned within the header.
28
+ * Use this for design layouts where the title should appear on the right
29
+ * and content (such as a step number or icon) anchors the left.
30
+ */
31
+ export declare const RightAligned: Story;
32
+ /**
33
+ * Collapser with both an icon and right-aligned title — matching the
34
+ * reference screenshot layout where an icon anchors the left and the
35
+ * title text flows to the right before the chevron.
36
+ */
37
+ export declare const WithIconRightAligned: Story;
21
38
  /**
22
39
  * Collapser containing complex content.
23
40
  */
24
41
  export declare const ComplexContent: Story;
42
+ /**
43
+ * Shows all four header layout variants side-by-side for visual comparison:
44
+ * default left-aligned, left-aligned with icon, right-aligned, and right-aligned with icon.
45
+ */
46
+ export declare const AllVariants: Story;
25
47
  /**
26
48
  * Multiple collapsers in a FAQ-style layout using CollapserGroup.
27
49
  */
28
50
  export declare const FAQExample: Story;
51
+ /**
52
+ * Example matching the reference screenshot: collapsers in a group where each
53
+ * has a distinct icon on the left and right-aligned title text.
54
+ */
55
+ export declare const IconGroupExample: Story;
56
+ /**
57
+ * CollapserGroup with `numbered` auto-numbers each entry.
58
+ * Matches the reference screenshot pattern: step number + icon on the left,
59
+ * title right-aligned, chevron on the far right.
60
+ */
61
+ export declare const NumberedGroup: Story;