@roadlittledawn/docs-design-system-react 0.1.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 +136 -0
- package/dist/components/Button.d.ts +17 -0
- package/dist/components/Button.js +28 -0
- package/dist/components/Button.stories.d.ts +45 -0
- package/dist/components/Button.stories.js +98 -0
- package/dist/components/Callout.d.ts +17 -0
- package/dist/components/Callout.js +19 -0
- package/dist/components/Callout.stories.d.ts +36 -0
- package/dist/components/Callout.stories.js +80 -0
- package/dist/components/Card.d.ts +23 -0
- package/dist/components/Card.js +21 -0
- package/dist/components/Card.stories.d.ts +32 -0
- package/dist/components/Card.stories.js +68 -0
- package/dist/components/CardGrid.d.ts +14 -0
- package/dist/components/CardGrid.js +6 -0
- package/dist/components/CardGrid.stories.d.ts +24 -0
- package/dist/components/CardGrid.stories.js +55 -0
- package/dist/components/CodeBlock.d.ts +43 -0
- package/dist/components/CodeBlock.js +240 -0
- package/dist/components/CodeBlock.stories.d.ts +45 -0
- package/dist/components/CodeBlock.stories.js +154 -0
- package/dist/components/Collapser.d.ts +18 -0
- package/dist/components/Collapser.js +25 -0
- package/dist/components/Collapser.stories.d.ts +28 -0
- package/dist/components/Collapser.stories.js +62 -0
- package/dist/components/Heading.d.ts +11 -0
- package/dist/components/Heading.js +7 -0
- package/dist/components/Heading.stories.d.ts +32 -0
- package/dist/components/Heading.stories.js +66 -0
- package/dist/components/Link.d.ts +11 -0
- package/dist/components/Link.js +10 -0
- package/dist/components/Link.stories.d.ts +32 -0
- package/dist/components/Link.stories.js +63 -0
- package/dist/components/Typography.d.ts +14 -0
- package/dist/components/Typography.js +9 -0
- package/dist/components/Typography.stories.d.ts +36 -0
- package/dist/components/Typography.stories.js +78 -0
- package/dist/hooks/useKeyPress.d.ts +5 -0
- package/dist/hooks/useKeyPress.js +60 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +12 -0
- package/dist/styles.css +857 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# @roadlittledawn/docs-design-system-react
|
|
2
|
+
|
|
3
|
+
React components for building documentation interfaces.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @roadlittledawn/docs-design-system-react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Callout, CodeBlock, Card } from '@roadlittledawn/docs-design-system-react';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Importing Styles
|
|
18
|
+
|
|
19
|
+
Import the component styles in your app:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import '@roadlittledawn/docs-design-system-react/styles.css';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Components
|
|
26
|
+
|
|
27
|
+
### Callout
|
|
28
|
+
|
|
29
|
+
Highlight important information, warnings, tips, or notes.
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
<Callout variant="tip">This is a helpful tip!</Callout>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### CodeBlock
|
|
36
|
+
|
|
37
|
+
Syntax-highlighted code with copy functionality.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<CodeBlock language="javascript">
|
|
41
|
+
{`const greeting = "Hello, world!";`}
|
|
42
|
+
</CodeBlock>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Collapser
|
|
46
|
+
|
|
47
|
+
Expandable/collapsible sections for optional or detailed content.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Collapser title="More details">
|
|
51
|
+
Hidden content revealed on expand.
|
|
52
|
+
</Collapser>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Card
|
|
56
|
+
|
|
57
|
+
Clickable card for navigation or content grouping.
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<Card title="Getting Started" href="/docs/intro">
|
|
61
|
+
Learn the basics.
|
|
62
|
+
</Card>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### CardGrid
|
|
66
|
+
|
|
67
|
+
Grid layout for organizing multiple cards.
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
<CardGrid columns={3}>
|
|
71
|
+
<Card title="Guide 1" href="/guide-1">Description</Card>
|
|
72
|
+
<Card title="Guide 2" href="/guide-2">Description</Card>
|
|
73
|
+
</CardGrid>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Typography
|
|
77
|
+
|
|
78
|
+
Text component with semantic variants.
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
<Typography variant="body">Paragraph text</Typography>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Heading
|
|
85
|
+
|
|
86
|
+
Semantic heading levels.
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<Heading level={2}>Section Title</Heading>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Link
|
|
93
|
+
|
|
94
|
+
Styled anchor with external link detection.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<Link href="/docs">Internal link</Link>
|
|
98
|
+
<Link href="https://example.com">External link</Link>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Button
|
|
102
|
+
|
|
103
|
+
Action button with variants.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<Button variant="primary" onClick={handleClick}>Click me</Button>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Hooks
|
|
110
|
+
|
|
111
|
+
### useKeyPress
|
|
112
|
+
|
|
113
|
+
Listen for keyboard events.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
const isPressed = useKeyPress('Escape');
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
Full component documentation with live examples is available in our Storybook.
|
|
122
|
+
|
|
123
|
+
**Storybook URL:** _Coming soon_
|
|
124
|
+
|
|
125
|
+
## Development
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Install dependencies
|
|
129
|
+
npm install
|
|
130
|
+
|
|
131
|
+
# Build the package
|
|
132
|
+
npm run build
|
|
133
|
+
|
|
134
|
+
# Watch mode for development
|
|
135
|
+
npm run dev
|
|
136
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Visual style variant of the button
|
|
5
|
+
* @default 'primary'
|
|
6
|
+
*/
|
|
7
|
+
variant?: "primary" | "secondary" | "outline";
|
|
8
|
+
/**
|
|
9
|
+
* Size of the button
|
|
10
|
+
* @default 'md'
|
|
11
|
+
*/
|
|
12
|
+
size?: "sm" | "md" | "lg";
|
|
13
|
+
/** Button content */
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
export var Button = function (_a) {
|
|
25
|
+
var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, children = _a.children, _d = _a.className, className = _d === void 0 ? "" : _d, props = __rest(_a, ["variant", "size", "children", "className"]);
|
|
26
|
+
var classNames = "dds-button dds-button-".concat(variant, " dds-button-").concat(size, " ").concat(className).trim();
|
|
27
|
+
return (_jsx("button", __assign({ className: classNames }, props, { children: children })));
|
|
28
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
/**
|
|
4
|
+
* The Button component is used for user actions and navigation.
|
|
5
|
+
* It supports multiple variants and sizes to accommodate different use cases.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof Button>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof Button>;
|
|
10
|
+
/**
|
|
11
|
+
* The primary button style is used for the main action on a page.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Primary: Story;
|
|
14
|
+
/**
|
|
15
|
+
* The secondary button style is used for alternative or less important actions.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Secondary: Story;
|
|
18
|
+
/**
|
|
19
|
+
* The outline button style is used for tertiary actions or when you need a more subtle button.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Outline: Story;
|
|
22
|
+
/**
|
|
23
|
+
* Small button size for compact interfaces or less prominent actions.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Small: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Medium is the default button size, suitable for most use cases.
|
|
28
|
+
*/
|
|
29
|
+
export declare const Medium: Story;
|
|
30
|
+
/**
|
|
31
|
+
* Large button size for prominent calls-to-action.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Large: Story;
|
|
34
|
+
/**
|
|
35
|
+
* Disabled state for buttons that are temporarily unavailable.
|
|
36
|
+
*/
|
|
37
|
+
export declare const Disabled: Story;
|
|
38
|
+
/**
|
|
39
|
+
* Example showing all button variants side by side for comparison.
|
|
40
|
+
*/
|
|
41
|
+
export declare const AllVariants: Story;
|
|
42
|
+
/**
|
|
43
|
+
* Example showing all button sizes side by side for comparison.
|
|
44
|
+
*/
|
|
45
|
+
export declare const AllSizes: Story;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
/**
|
|
4
|
+
* The Button component is used for user actions and navigation.
|
|
5
|
+
* It supports multiple variants and sizes to accommodate different use cases.
|
|
6
|
+
*/
|
|
7
|
+
var meta = {
|
|
8
|
+
title: 'Components/Button',
|
|
9
|
+
component: Button,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: "\nThe Button component provides a consistent way to trigger actions across your documentation.\n\n## When to Use\n\n- Primary actions like \"Submit\", \"Save\", or \"Continue\"\n- Secondary actions like \"Cancel\" or \"Go Back\"\n- Important calls-to-action within documentation pages\n\n## When Not to Use\n\n- For navigation between pages (use the Link component instead)\n- For less important actions (consider using a text link)\n- When you need a clickable card (use Card with href prop)\n\n## Accessibility\n\n- All buttons include proper HTML button semantics\n- Buttons are keyboard accessible\n- Use descriptive button text for screen readers\n ",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
/**
|
|
21
|
+
* The primary button style is used for the main action on a page.
|
|
22
|
+
*/
|
|
23
|
+
export var Primary = {
|
|
24
|
+
args: {
|
|
25
|
+
variant: 'primary',
|
|
26
|
+
children: 'Primary Button',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The secondary button style is used for alternative or less important actions.
|
|
31
|
+
*/
|
|
32
|
+
export var Secondary = {
|
|
33
|
+
args: {
|
|
34
|
+
variant: 'secondary',
|
|
35
|
+
children: 'Secondary Button',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The outline button style is used for tertiary actions or when you need a more subtle button.
|
|
40
|
+
*/
|
|
41
|
+
export var Outline = {
|
|
42
|
+
args: {
|
|
43
|
+
variant: 'outline',
|
|
44
|
+
children: 'Outline Button',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Small button size for compact interfaces or less prominent actions.
|
|
49
|
+
*/
|
|
50
|
+
export var Small = {
|
|
51
|
+
args: {
|
|
52
|
+
variant: 'primary',
|
|
53
|
+
size: 'sm',
|
|
54
|
+
children: 'Small Button',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Medium is the default button size, suitable for most use cases.
|
|
59
|
+
*/
|
|
60
|
+
export var Medium = {
|
|
61
|
+
args: {
|
|
62
|
+
variant: 'primary',
|
|
63
|
+
size: 'md',
|
|
64
|
+
children: 'Medium Button',
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Large button size for prominent calls-to-action.
|
|
69
|
+
*/
|
|
70
|
+
export var Large = {
|
|
71
|
+
args: {
|
|
72
|
+
variant: 'primary',
|
|
73
|
+
size: 'lg',
|
|
74
|
+
children: 'Large Button',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Disabled state for buttons that are temporarily unavailable.
|
|
79
|
+
*/
|
|
80
|
+
export var Disabled = {
|
|
81
|
+
args: {
|
|
82
|
+
variant: 'primary',
|
|
83
|
+
children: 'Disabled Button',
|
|
84
|
+
disabled: true,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Example showing all button variants side by side for comparison.
|
|
89
|
+
*/
|
|
90
|
+
export var AllVariants = {
|
|
91
|
+
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
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Example showing all button sizes side by side for comparison.
|
|
95
|
+
*/
|
|
96
|
+
export var AllSizes = {
|
|
97
|
+
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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export type CalloutVariant = "caution" | "important" | "tip" | "course";
|
|
3
|
+
interface CalloutProps {
|
|
4
|
+
/** Visual style variant of the callout (caution, important, tip, or course) */
|
|
5
|
+
variant: CalloutVariant;
|
|
6
|
+
/**
|
|
7
|
+
* Optional title for the callout. Pass null to hide the title completely
|
|
8
|
+
* @default Default title based on variant ("Caution", "Important", "Tip", or "Course")
|
|
9
|
+
*/
|
|
10
|
+
title?: string | null;
|
|
11
|
+
/** Callout content */
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Additional CSS classes */
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function Callout({ variant, title, children, className, }: CalloutProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
var defaultTitles = {
|
|
3
|
+
caution: "Caution",
|
|
4
|
+
important: "Important",
|
|
5
|
+
tip: "Tip",
|
|
6
|
+
course: "Course",
|
|
7
|
+
};
|
|
8
|
+
export function Callout(_a) {
|
|
9
|
+
var variant = _a.variant, title = _a.title, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
10
|
+
var calloutClasses = [
|
|
11
|
+
"dds-callout",
|
|
12
|
+
"dds-callout-".concat(variant),
|
|
13
|
+
className,
|
|
14
|
+
]
|
|
15
|
+
.filter(Boolean)
|
|
16
|
+
.join(" ");
|
|
17
|
+
var titleClasses = ["dds-callout-title", "dds-callout-title-".concat(variant)].join(" ");
|
|
18
|
+
return (_jsxs("div", { className: calloutClasses, children: [title !== null && (_jsx("h4", { className: titleClasses, children: title || defaultTitles[variant] })), children] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Callout } from './Callout';
|
|
3
|
+
/**
|
|
4
|
+
* The Callout component highlights important information, warnings, tips, and course-specific content.
|
|
5
|
+
*/
|
|
6
|
+
declare const meta: Meta<typeof Callout>;
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof Callout>;
|
|
9
|
+
/**
|
|
10
|
+
* Caution callout for warnings and things to avoid.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Caution: Story;
|
|
13
|
+
/**
|
|
14
|
+
* Important callout for critical information.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Important: Story;
|
|
17
|
+
/**
|
|
18
|
+
* Tip callout for helpful suggestions.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Tip: Story;
|
|
21
|
+
/**
|
|
22
|
+
* Course callout for learning-oriented content.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Course: Story;
|
|
25
|
+
/**
|
|
26
|
+
* Callout with a custom title.
|
|
27
|
+
*/
|
|
28
|
+
export declare const CustomTitle: Story;
|
|
29
|
+
/**
|
|
30
|
+
* Callout without a title.
|
|
31
|
+
*/
|
|
32
|
+
export declare const NoTitle: Story;
|
|
33
|
+
/**
|
|
34
|
+
* All callout variants displayed together for comparison.
|
|
35
|
+
*/
|
|
36
|
+
export declare const AllVariants: Story;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Callout } from './Callout';
|
|
3
|
+
/**
|
|
4
|
+
* The Callout component highlights important information, warnings, tips, and course-specific content.
|
|
5
|
+
*/
|
|
6
|
+
var meta = {
|
|
7
|
+
title: 'Components/Callout',
|
|
8
|
+
component: Callout,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: "\nThe Callout component draws attention to important information within documentation pages.\n\n## When to Use\n\n- **Caution**: For warnings about potential issues or things to avoid\n- **Important**: For critical information users must know\n- **Tip**: For helpful suggestions and best practices\n- **Course**: For course-specific or learning-oriented content\n\n## When Not to Use\n\n- For general content (use regular paragraphs)\n- For code examples (use code blocks)\n- For navigation (use Link or Button components)\n\n## Accessibility\n\n- Uses semantic heading tags for titles\n- Color alone is not used to convey meaning (icons and labels provide context)\n ",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
/**
|
|
20
|
+
* Caution callout for warnings and things to avoid.
|
|
21
|
+
*/
|
|
22
|
+
export var Caution = {
|
|
23
|
+
args: {
|
|
24
|
+
variant: 'caution',
|
|
25
|
+
children: 'This operation cannot be undone. Make sure you have a backup before proceeding.',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Important callout for critical information.
|
|
30
|
+
*/
|
|
31
|
+
export var Important = {
|
|
32
|
+
args: {
|
|
33
|
+
variant: 'important',
|
|
34
|
+
children: 'All users must update their passwords by the end of the month to comply with the new security policy.',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Tip callout for helpful suggestions.
|
|
39
|
+
*/
|
|
40
|
+
export var Tip = {
|
|
41
|
+
args: {
|
|
42
|
+
variant: 'tip',
|
|
43
|
+
children: 'You can use keyboard shortcuts (Cmd+K or Ctrl+K) to quickly search the documentation.',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Course callout for learning-oriented content.
|
|
48
|
+
*/
|
|
49
|
+
export var Course = {
|
|
50
|
+
args: {
|
|
51
|
+
variant: 'course',
|
|
52
|
+
children: 'In this section, you will learn how to configure your development environment and install the necessary dependencies.',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Callout with a custom title.
|
|
57
|
+
*/
|
|
58
|
+
export var CustomTitle = {
|
|
59
|
+
args: {
|
|
60
|
+
variant: 'important',
|
|
61
|
+
title: 'Security Notice',
|
|
62
|
+
children: 'Two-factor authentication is now required for all administrator accounts.',
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Callout without a title.
|
|
67
|
+
*/
|
|
68
|
+
export var NoTitle = {
|
|
69
|
+
args: {
|
|
70
|
+
variant: 'tip',
|
|
71
|
+
title: null,
|
|
72
|
+
children: 'This callout has no title and displays only the content.',
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* All callout variants displayed together for comparison.
|
|
77
|
+
*/
|
|
78
|
+
export var AllVariants = {
|
|
79
|
+
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
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
interface CardProps {
|
|
3
|
+
/** Optional title displayed at the top of the card */
|
|
4
|
+
title?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Color of the title text
|
|
7
|
+
* @default 'gray'
|
|
8
|
+
*/
|
|
9
|
+
titleColor?: "blue" | "green" | "purple" | "red" | "yellow" | "gray";
|
|
10
|
+
/**
|
|
11
|
+
* Background color of the card
|
|
12
|
+
* @default 'white'
|
|
13
|
+
*/
|
|
14
|
+
backgroundColor?: "blue" | "green" | "purple" | "red" | "yellow" | "gray" | "white";
|
|
15
|
+
/** Optional link URL. When provided, the entire card becomes clickable */
|
|
16
|
+
href?: string;
|
|
17
|
+
/** Card content */
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
/** Additional CSS classes */
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function Card({ title, titleColor, backgroundColor, href, children, className, }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function Card(_a) {
|
|
3
|
+
var title = _a.title, _b = _a.titleColor, titleColor = _b === void 0 ? "gray" : _b, _c = _a.backgroundColor, backgroundColor = _c === void 0 ? "white" : _c, href = _a.href, children = _a.children, _d = _a.className, className = _d === void 0 ? "" : _d;
|
|
4
|
+
var cardClasses = [
|
|
5
|
+
"dds-card",
|
|
6
|
+
"dds-card-bg-".concat(backgroundColor),
|
|
7
|
+
href ? "dds-card-clickable" : "",
|
|
8
|
+
className,
|
|
9
|
+
]
|
|
10
|
+
.filter(Boolean)
|
|
11
|
+
.join(" ");
|
|
12
|
+
var titleClasses = ["dds-card-title", "dds-card-title-".concat(titleColor)].join(" ");
|
|
13
|
+
var textClasses = backgroundColor !== "white"
|
|
14
|
+
? "dds-card-text-".concat(backgroundColor)
|
|
15
|
+
: "dds-card-text-gray";
|
|
16
|
+
var content = (_jsxs("div", { className: cardClasses, children: [title && _jsx("h3", { className: titleClasses, children: title }), _jsx("div", { className: textClasses, children: children })] }));
|
|
17
|
+
if (href) {
|
|
18
|
+
return (_jsx("a", { href: href, className: "no-text-decoration", children: content }));
|
|
19
|
+
}
|
|
20
|
+
return content;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Card } from './Card';
|
|
3
|
+
/**
|
|
4
|
+
* The Card component displays content in a contained, elevated box with optional title and background color.
|
|
5
|
+
*/
|
|
6
|
+
declare const meta: Meta<typeof Card>;
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof Card>;
|
|
9
|
+
/**
|
|
10
|
+
* Basic card with title and content.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Basic: Story;
|
|
13
|
+
/**
|
|
14
|
+
* Clickable card that links to another page.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Clickable: Story;
|
|
17
|
+
/**
|
|
18
|
+
* Card with colored background.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ColoredBackground: Story;
|
|
21
|
+
/**
|
|
22
|
+
* Card without a title.
|
|
23
|
+
*/
|
|
24
|
+
export declare const NoTitle: Story;
|
|
25
|
+
/**
|
|
26
|
+
* All title color variants.
|
|
27
|
+
*/
|
|
28
|
+
export declare const TitleColors: Story;
|
|
29
|
+
/**
|
|
30
|
+
* All background color variants.
|
|
31
|
+
*/
|
|
32
|
+
export declare const BackgroundColors: Story;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from './Card';
|
|
3
|
+
/**
|
|
4
|
+
* The Card component displays content in a contained, elevated box with optional title and background color.
|
|
5
|
+
*/
|
|
6
|
+
var meta = {
|
|
7
|
+
title: 'Components/Card',
|
|
8
|
+
component: Card,
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: "\nThe Card component provides a flexible container for displaying content with visual hierarchy.\n\n## When to Use\n\n- To group related content together\n- To create clickable navigation elements\n- To display feature highlights or key information\n- To organize content in grid layouts\n\n## When Not to Use\n\n- For plain text content (use typography components)\n- For alerts or notifications (use Callout)\n- For extensive content (consider using sections or pages)\n\n## Accessibility\n\n- Clickable cards use proper link semantics\n- Color is not the only means of conveying information\n ",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
/**
|
|
20
|
+
* Basic card with title and content.
|
|
21
|
+
*/
|
|
22
|
+
export var Basic = {
|
|
23
|
+
args: {
|
|
24
|
+
title: 'Getting Started',
|
|
25
|
+
children: 'Learn the basics of using this documentation system.',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Clickable card that links to another page.
|
|
30
|
+
*/
|
|
31
|
+
export var Clickable = {
|
|
32
|
+
args: {
|
|
33
|
+
title: 'API Reference',
|
|
34
|
+
href: '/docs/api',
|
|
35
|
+
children: 'Complete reference for all available components and utilities.',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Card with colored background.
|
|
40
|
+
*/
|
|
41
|
+
export var ColoredBackground = {
|
|
42
|
+
args: {
|
|
43
|
+
title: 'New Feature',
|
|
44
|
+
titleColor: 'blue',
|
|
45
|
+
backgroundColor: 'blue',
|
|
46
|
+
children: 'Check out our latest component additions.',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Card without a title.
|
|
51
|
+
*/
|
|
52
|
+
export var NoTitle = {
|
|
53
|
+
args: {
|
|
54
|
+
children: 'This card displays content without a title.',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* All title color variants.
|
|
59
|
+
*/
|
|
60
|
+
export var TitleColors = {
|
|
61
|
+
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
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* All background color variants.
|
|
65
|
+
*/
|
|
66
|
+
export var BackgroundColors = {
|
|
67
|
+
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
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface CardGridProps {
|
|
3
|
+
/**
|
|
4
|
+
* Number of columns in the grid
|
|
5
|
+
* @default 3
|
|
6
|
+
*/
|
|
7
|
+
columns?: 2 | 3 | 4;
|
|
8
|
+
/** Grid content (typically Card components) */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
/** Additional CSS classes */
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function CardGrid({ columns, children, className }: CardGridProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
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();
|
|
5
|
+
return (_jsx("div", { className: classNames, children: children }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { CardGrid } from './CardGrid';
|
|
3
|
+
/**
|
|
4
|
+
* The CardGrid component arranges Card components in a responsive grid layout.
|
|
5
|
+
*/
|
|
6
|
+
declare const meta: Meta<typeof CardGrid>;
|
|
7
|
+
export default meta;
|
|
8
|
+
type Story = StoryObj<typeof CardGrid>;
|
|
9
|
+
/**
|
|
10
|
+
* Grid with 2 columns (responsive).
|
|
11
|
+
*/
|
|
12
|
+
export declare const TwoColumns: Story;
|
|
13
|
+
/**
|
|
14
|
+
* Grid with 3 columns (default, responsive).
|
|
15
|
+
*/
|
|
16
|
+
export declare const ThreeColumns: Story;
|
|
17
|
+
/**
|
|
18
|
+
* Grid with 4 columns (responsive).
|
|
19
|
+
*/
|
|
20
|
+
export declare const FourColumns: Story;
|
|
21
|
+
/**
|
|
22
|
+
* Grid with clickable cards.
|
|
23
|
+
*/
|
|
24
|
+
export declare const ClickableCards: Story;
|