@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.
Files changed (43) hide show
  1. package/README.md +136 -0
  2. package/dist/components/Button.d.ts +17 -0
  3. package/dist/components/Button.js +28 -0
  4. package/dist/components/Button.stories.d.ts +45 -0
  5. package/dist/components/Button.stories.js +98 -0
  6. package/dist/components/Callout.d.ts +17 -0
  7. package/dist/components/Callout.js +19 -0
  8. package/dist/components/Callout.stories.d.ts +36 -0
  9. package/dist/components/Callout.stories.js +80 -0
  10. package/dist/components/Card.d.ts +23 -0
  11. package/dist/components/Card.js +21 -0
  12. package/dist/components/Card.stories.d.ts +32 -0
  13. package/dist/components/Card.stories.js +68 -0
  14. package/dist/components/CardGrid.d.ts +14 -0
  15. package/dist/components/CardGrid.js +6 -0
  16. package/dist/components/CardGrid.stories.d.ts +24 -0
  17. package/dist/components/CardGrid.stories.js +55 -0
  18. package/dist/components/CodeBlock.d.ts +43 -0
  19. package/dist/components/CodeBlock.js +240 -0
  20. package/dist/components/CodeBlock.stories.d.ts +45 -0
  21. package/dist/components/CodeBlock.stories.js +154 -0
  22. package/dist/components/Collapser.d.ts +18 -0
  23. package/dist/components/Collapser.js +25 -0
  24. package/dist/components/Collapser.stories.d.ts +28 -0
  25. package/dist/components/Collapser.stories.js +62 -0
  26. package/dist/components/Heading.d.ts +11 -0
  27. package/dist/components/Heading.js +7 -0
  28. package/dist/components/Heading.stories.d.ts +32 -0
  29. package/dist/components/Heading.stories.js +66 -0
  30. package/dist/components/Link.d.ts +11 -0
  31. package/dist/components/Link.js +10 -0
  32. package/dist/components/Link.stories.d.ts +32 -0
  33. package/dist/components/Link.stories.js +63 -0
  34. package/dist/components/Typography.d.ts +14 -0
  35. package/dist/components/Typography.js +9 -0
  36. package/dist/components/Typography.stories.d.ts +36 -0
  37. package/dist/components/Typography.stories.js +78 -0
  38. package/dist/hooks/useKeyPress.d.ts +5 -0
  39. package/dist/hooks/useKeyPress.js +60 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.js +12 -0
  42. package/dist/styles.css +857 -0
  43. package/package.json +44 -0
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Collapser } from './Collapser';
3
+ /**
4
+ * The Collapser component creates expandable/collapsible content sections with smooth animations.
5
+ */
6
+ var meta = {
7
+ title: 'Components/Collapser',
8
+ component: Collapser,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: "\nThe Collapser component allows users to show and hide content sections to reduce visual clutter.\n\n## When to Use\n\n- For FAQ sections where answers can be toggled\n- To hide advanced options or detailed information\n- For progressive disclosure of content\n- When you have lengthy content that doesn't need to be visible all the time\n\n## When Not to Use\n\n- For primary navigation (use proper navigation components)\n- For critical information that should always be visible\n- When most users will need to expand all sections (just show the content)\n\n## Accessibility\n\n- Uses proper ARIA attributes (aria-expanded)\n- Keyboard accessible with Enter and Space keys\n- Supports additional keyboard shortcuts: 's' or 'f' to show, 'h' to hide\n- Screen reader friendly\n\n## Keyboard Shortcuts\n\n- **s** or **f**: Show/expand the content\n- **h**: Hide/collapse the content\n- **Enter** or **Space**: Toggle expand/collapse\n ",
14
+ },
15
+ },
16
+ },
17
+ };
18
+ export default meta;
19
+ /**
20
+ * Basic collapser that starts collapsed.
21
+ */
22
+ export var Basic = {
23
+ args: {
24
+ title: 'Click to expand',
25
+ children: (_jsx("p", { children: "This content is hidden by default and can be revealed by clicking the title. It includes smooth height animations for a better user experience." })),
26
+ },
27
+ };
28
+ /**
29
+ * Collapser that starts in the open state.
30
+ */
31
+ export var DefaultOpen = {
32
+ args: {
33
+ title: 'This section starts open',
34
+ defaultOpen: true,
35
+ children: (_jsx("p", { children: "This collapser is open by default. Users can still click to collapse it." })),
36
+ },
37
+ };
38
+ /**
39
+ * Collapser with an ID for the title.
40
+ */
41
+ export var WithID = {
42
+ args: {
43
+ title: 'Section with ID',
44
+ id: 'faq-question-1',
45
+ children: (_jsx("p", { children: "This collapser has an ID on its title, which is useful for anchor links and accessibility purposes." })),
46
+ },
47
+ };
48
+ /**
49
+ * Collapser containing complex content.
50
+ */
51
+ export var ComplexContent = {
52
+ args: {
53
+ title: 'How do I install the components?',
54
+ children: (_jsxs("div", { children: [_jsx("p", { children: "You can install the components using npm:" }), _jsx("pre", { style: { background: '#f5f5f5', padding: '1rem', borderRadius: '4px' }, children: "npm install @docs-design-system/ui" }), _jsx("p", { children: "Then import them in your React application:" }), _jsx("pre", { style: { background: '#f5f5f5', padding: '1rem', borderRadius: '4px' }, children: "import { Button, Card } from '@docs-design-system/ui';" })] })),
55
+ },
56
+ };
57
+ /**
58
+ * Multiple collapsers in a FAQ-style layout.
59
+ */
60
+ export var FAQExample = {
61
+ render: function () { return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx(Collapser, { title: "What is this documentation system?", children: _jsx("p", { children: "This is a comprehensive documentation design system that provides reusable components and guidelines for creating effective technical documentation." }) }), _jsx(Collapser, { title: "How do I get started?", children: _jsx("p", { children: "Start by installing the component package, then explore the components in Storybook to understand their usage and configuration options." }) }), _jsx(Collapser, { title: "Can I customize the components?", children: _jsx("p", { children: "Yes! All components accept a className prop for custom styling, and you can override the default styles using CSS." }) }), _jsx(Collapser, { title: "Is this accessible?", children: _jsx("p", { children: "Accessibility is a core principle. All components follow WAI-ARIA best practices and are keyboard navigable." }) })] })); },
62
+ };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ interface HeadingProps {
3
+ /** Heading level (h1, h2, h3, or h4) */
4
+ level: 1 | 2 | 3 | 4;
5
+ /** Heading content */
6
+ children?: React.ReactNode;
7
+ /** Additional CSS classes */
8
+ className?: string;
9
+ }
10
+ export declare function Heading({ level, children, className }: HeadingProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export function Heading(_a) {
3
+ var level = _a.level, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
4
+ var Tag = "h".concat(level);
5
+ var classNames = "dds-heading dds-heading-".concat(level, " ").concat(className).trim();
6
+ return _jsx(Tag, { className: classNames, children: children });
7
+ }
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Heading } from './Heading';
3
+ /**
4
+ * The Heading component renders semantic HTML headings with consistent styling.
5
+ */
6
+ declare const meta: Meta<typeof Heading>;
7
+ export default meta;
8
+ type Story = StoryObj<typeof Heading>;
9
+ /**
10
+ * Level 1 heading (h1) - typically used once per page for the main title.
11
+ */
12
+ export declare const Level1: Story;
13
+ /**
14
+ * Level 2 heading (h2) - used for major sections.
15
+ */
16
+ export declare const Level2: Story;
17
+ /**
18
+ * Level 3 heading (h3) - used for subsections.
19
+ */
20
+ export declare const Level3: Story;
21
+ /**
22
+ * Level 4 heading (h4) - used for sub-subsections.
23
+ */
24
+ export declare const Level4: Story;
25
+ /**
26
+ * All heading levels displayed together to show the hierarchy.
27
+ */
28
+ export declare const AllLevels: Story;
29
+ /**
30
+ * Example of a properly structured document hierarchy.
31
+ */
32
+ export declare const DocumentStructure: Story;
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Heading } from './Heading';
3
+ /**
4
+ * The Heading component renders semantic HTML headings with consistent styling.
5
+ */
6
+ var meta = {
7
+ title: 'Components/Heading',
8
+ component: Heading,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: "\nThe Heading component provides semantic HTML headings (h1-h4) with consistent styling.\n\n## When to Use\n\n- For page and section titles\n- To create proper document structure\n- When semantic HTML heading levels are important for SEO and accessibility\n- For creating a clear content hierarchy\n\n## When Not to Use\n\n- For text that looks like a heading but isn't structurally a heading (use Typography)\n- For headings deeper than h4 (h5, h6 are not supported - reconsider your document structure)\n- For buttons or links that look like headings\n\n## Accessibility\n\n- Uses proper semantic HTML heading elements (h1-h4)\n- Creates a logical document outline for screen readers\n- Helps users navigate content with assistive technology\n- Important for SEO and document structure\n\n## Best Practices\n\n- Use only one h1 per page\n- Don't skip heading levels (don't jump from h2 to h4)\n- Keep headings concise and descriptive\n- Use headings to create a logical document structure\n ",
14
+ },
15
+ },
16
+ },
17
+ };
18
+ export default meta;
19
+ /**
20
+ * Level 1 heading (h1) - typically used once per page for the main title.
21
+ */
22
+ export var Level1 = {
23
+ args: {
24
+ level: 1,
25
+ children: 'Page Title (H1)',
26
+ },
27
+ };
28
+ /**
29
+ * Level 2 heading (h2) - used for major sections.
30
+ */
31
+ export var Level2 = {
32
+ args: {
33
+ level: 2,
34
+ children: 'Section Title (H2)',
35
+ },
36
+ };
37
+ /**
38
+ * Level 3 heading (h3) - used for subsections.
39
+ */
40
+ export var Level3 = {
41
+ args: {
42
+ level: 3,
43
+ children: 'Subsection Title (H3)',
44
+ },
45
+ };
46
+ /**
47
+ * Level 4 heading (h4) - used for sub-subsections.
48
+ */
49
+ export var Level4 = {
50
+ args: {
51
+ level: 4,
52
+ children: 'Sub-subsection Title (H4)',
53
+ },
54
+ };
55
+ /**
56
+ * All heading levels displayed together to show the hierarchy.
57
+ */
58
+ export var AllLevels = {
59
+ render: function () { return (_jsxs("div", { children: [_jsx(Heading, { level: 1, children: "Level 1 - Main Page Title" }), _jsx("p", { style: { marginBottom: '1rem', color: '#666' }, children: "Use h1 for the main page title. There should only be one h1 per page." }), _jsx(Heading, { level: 2, children: "Level 2 - Major Section" }), _jsx("p", { style: { marginBottom: '1rem', color: '#666' }, children: "Use h2 for major sections of your page." }), _jsx(Heading, { level: 3, children: "Level 3 - Subsection" }), _jsx("p", { style: { marginBottom: '1rem', color: '#666' }, children: "Use h3 for subsections within major sections." }), _jsx(Heading, { level: 4, children: "Level 4 - Sub-subsection" }), _jsx("p", { style: { color: '#666' }, children: "Use h4 for sub-subsections. If you need deeper levels, reconsider your document structure." })] })); },
60
+ };
61
+ /**
62
+ * Example of a properly structured document hierarchy.
63
+ */
64
+ export var DocumentStructure = {
65
+ render: function () { return (_jsxs("div", { children: [_jsx(Heading, { level: 1, children: "Getting Started Guide" }), _jsx("p", { children: "Introduction to the documentation system..." }), _jsx(Heading, { level: 2, children: "Installation" }), _jsx("p", { children: "How to install the components..." }), _jsx(Heading, { level: 3, children: "Prerequisites" }), _jsx("p", { children: "What you need before installing..." }), _jsx(Heading, { level: 3, children: "Installation Steps" }), _jsx("p", { children: "Step-by-step installation instructions..." }), _jsx(Heading, { level: 2, children: "Configuration" }), _jsx("p", { children: "How to configure the system..." }), _jsx(Heading, { level: 3, children: "Basic Configuration" }), _jsx("p", { children: "Essential configuration options..." }), _jsx(Heading, { level: 4, children: "Environment Variables" }), _jsx("p", { children: "Required environment variables..." })] })); },
66
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface LinkProps {
3
+ /** URL to link to. External links (starting with http:// or https://) open in new tab */
4
+ href: string;
5
+ /** Link content */
6
+ children?: React.ReactNode;
7
+ /** Additional CSS classes */
8
+ className?: string;
9
+ }
10
+ export declare function Link({ href, children, className }: LinkProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export function Link(_a) {
3
+ var href = _a.href, children = _a.children, _b = _a.className, className = _b === void 0 ? '' : _b;
4
+ var isExternal = href.startsWith('http://') || href.startsWith('https://');
5
+ var classNames = "dds-link ".concat(className).trim();
6
+ if (isExternal) {
7
+ return (_jsxs("a", { href: href, className: classNames, target: "_blank", rel: "noopener noreferrer", children: [children, _jsx("svg", { className: "dds-link-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) })] }));
8
+ }
9
+ return _jsx("a", { href: href, className: classNames, children: children });
10
+ }
@@ -0,0 +1,32 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Link } from './Link';
3
+ /**
4
+ * The Link component creates styled hyperlinks with automatic external link handling.
5
+ */
6
+ declare const meta: Meta<typeof Link>;
7
+ export default meta;
8
+ type Story = StoryObj<typeof Link>;
9
+ /**
10
+ * Internal link (relative URL).
11
+ */
12
+ export declare const Internal: Story;
13
+ /**
14
+ * External link (absolute URL) - opens in new tab with icon.
15
+ */
16
+ export declare const External: Story;
17
+ /**
18
+ * Anchor link to a section on the same page.
19
+ */
20
+ export declare const AnchorLink: Story;
21
+ /**
22
+ * Link within body text.
23
+ */
24
+ export declare const InlineLink: Story;
25
+ /**
26
+ * Multiple links in a list.
27
+ */
28
+ export declare const LinkList: Story;
29
+ /**
30
+ * Comparison of internal and external links.
31
+ */
32
+ export declare const InternalVsExternal: Story;
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Link } from './Link';
3
+ /**
4
+ * The Link component creates styled hyperlinks with automatic external link handling.
5
+ */
6
+ var meta = {
7
+ title: 'Components/Link',
8
+ component: Link,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: "\nThe Link component provides consistent link styling and automatically handles external links.\n\n## When to Use\n\n- For navigation between pages\n- For links to external resources\n- For anchor links within a page\n- When you need a text link instead of a button\n\n## When Not to Use\n\n- For primary actions (use Button component)\n- For navigation that looks like a button (use Button)\n- For clickable cards (use Card with href prop)\n\n## Accessibility\n\n- Uses proper HTML anchor elements\n- External links automatically open in new tabs with proper security attributes\n- External links include a visual indicator icon\n- Screen readers announce the link purpose\n\n## External Link Behavior\n\nLinks starting with `http://` or `https://` are automatically treated as external:\n- Open in a new tab (target=\"_blank\")\n- Include security attributes (rel=\"noopener noreferrer\")\n- Display an external link icon\n ",
14
+ },
15
+ },
16
+ },
17
+ };
18
+ export default meta;
19
+ /**
20
+ * Internal link (relative URL).
21
+ */
22
+ export var Internal = {
23
+ args: {
24
+ href: '/docs/components',
25
+ children: 'View Components Documentation',
26
+ },
27
+ };
28
+ /**
29
+ * External link (absolute URL) - opens in new tab with icon.
30
+ */
31
+ export var External = {
32
+ args: {
33
+ href: 'https://github.com/your-repo/docs-design-system',
34
+ children: 'View on GitHub',
35
+ },
36
+ };
37
+ /**
38
+ * Anchor link to a section on the same page.
39
+ */
40
+ export var AnchorLink = {
41
+ args: {
42
+ href: '#installation',
43
+ children: 'Jump to Installation',
44
+ },
45
+ };
46
+ /**
47
+ * Link within body text.
48
+ */
49
+ export var InlineLink = {
50
+ render: function () { return (_jsxs("p", { children: ["For more information, check out the", ' ', _jsx(Link, { href: "/docs/getting-started", children: "Getting Started guide" }), ' ', "or visit our", ' ', _jsx(Link, { href: "https://github.com", children: "GitHub repository" }), "."] })); },
51
+ };
52
+ /**
53
+ * Multiple links in a list.
54
+ */
55
+ export var LinkList = {
56
+ render: function () { return (_jsxs("ul", { style: { listStyle: 'none', padding: 0, display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: [_jsx("li", { children: _jsx(Link, { href: "/docs/introduction", children: "Introduction" }) }), _jsx("li", { children: _jsx(Link, { href: "/docs/components", children: "Components" }) }), _jsx("li", { children: _jsx(Link, { href: "/docs/best-practices", children: "Best Practices" }) }), _jsx("li", { children: _jsx(Link, { href: "https://github.com", children: "GitHub" }) }), _jsx("li", { children: _jsx(Link, { href: "https://npmjs.com", children: "NPM" }) })] })); },
57
+ };
58
+ /**
59
+ * Comparison of internal and external links.
60
+ */
61
+ export var InternalVsExternal = {
62
+ render: function () { return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsxs("div", { children: [_jsx("strong", { children: "Internal Link:" }), _jsx("br", {}), _jsx(Link, { href: "/docs/components", children: "Components (internal)" }), _jsx("p", { style: { fontSize: '0.875rem', color: '#666', marginTop: '0.5rem' }, children: "Opens in the same tab, no icon" })] }), _jsxs("div", { children: [_jsx("strong", { children: "External Link:" }), _jsx("br", {}), _jsx(Link, { href: "https://example.com", children: "Example.com (external)" }), _jsx("p", { style: { fontSize: '0.875rem', color: '#666', marginTop: '0.5rem' }, children: "Opens in new tab, includes external link icon" })] })] })); },
63
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface TypographyProps {
3
+ /**
4
+ * Typography style variant
5
+ * @default 'p'
6
+ */
7
+ variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'p' | 'caption';
8
+ /** Text content */
9
+ children: React.ReactNode;
10
+ /** Additional CSS classes */
11
+ className?: string;
12
+ }
13
+ export declare const Typography: React.FC<TypographyProps>;
14
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export var Typography = function (_a) {
3
+ var _b = _a.variant, variant = _b === void 0 ? 'p' : _b, children = _a.children, _c = _a.className, className = _c === void 0 ? '' : _c;
4
+ var Component = variant === 'p' || variant === 'caption' ? 'p' : variant;
5
+ var classNames = "dds-typography dds-typography-".concat(variant, " ").concat(className).trim();
6
+ return React.createElement(Component, {
7
+ className: classNames
8
+ }, children);
9
+ };
@@ -0,0 +1,36 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { Typography } from './Typography';
3
+ /**
4
+ * The Typography component provides consistent text styling across your documentation.
5
+ */
6
+ declare const meta: Meta<typeof Typography>;
7
+ export default meta;
8
+ type Story = StoryObj<typeof Typography>;
9
+ /**
10
+ * H1 heading style.
11
+ */
12
+ export declare const H1: Story;
13
+ /**
14
+ * H2 heading style.
15
+ */
16
+ export declare const H2: Story;
17
+ /**
18
+ * H3 heading style.
19
+ */
20
+ export declare const H3: Story;
21
+ /**
22
+ * H4 heading style.
23
+ */
24
+ export declare const H4: Story;
25
+ /**
26
+ * Paragraph style (default).
27
+ */
28
+ export declare const Paragraph: Story;
29
+ /**
30
+ * Caption style for small text.
31
+ */
32
+ export declare const Caption: Story;
33
+ /**
34
+ * All typography variants displayed together.
35
+ */
36
+ export declare const AllVariants: Story;
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Typography } from './Typography';
3
+ /**
4
+ * The Typography component provides consistent text styling across your documentation.
5
+ */
6
+ var meta = {
7
+ title: 'Components/Typography',
8
+ component: Typography,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ docs: {
12
+ description: {
13
+ component: "\nThe Typography component renders text with predefined styles for consistency.\n\n## When to Use\n\n- For body text and paragraphs\n- For captions and small text\n- When you need consistent text styling\n- For headings when you don't need semantic HTML heading levels\n\n## When Not to Use\n\n- For semantic headings (use Heading component)\n- For buttons (use Button component)\n- For links (use Link component)\n\n## Accessibility\n\n- Uses proper HTML elements based on variant\n- Maintains readable contrast ratios\n- Supports custom classes for additional styling\n ",
14
+ },
15
+ },
16
+ },
17
+ };
18
+ export default meta;
19
+ /**
20
+ * H1 heading style.
21
+ */
22
+ export var H1 = {
23
+ args: {
24
+ variant: 'h1',
25
+ children: 'Heading 1 Style',
26
+ },
27
+ };
28
+ /**
29
+ * H2 heading style.
30
+ */
31
+ export var H2 = {
32
+ args: {
33
+ variant: 'h2',
34
+ children: 'Heading 2 Style',
35
+ },
36
+ };
37
+ /**
38
+ * H3 heading style.
39
+ */
40
+ export var H3 = {
41
+ args: {
42
+ variant: 'h3',
43
+ children: 'Heading 3 Style',
44
+ },
45
+ };
46
+ /**
47
+ * H4 heading style.
48
+ */
49
+ export var H4 = {
50
+ args: {
51
+ variant: 'h4',
52
+ children: 'Heading 4 Style',
53
+ },
54
+ };
55
+ /**
56
+ * Paragraph style (default).
57
+ */
58
+ export var Paragraph = {
59
+ args: {
60
+ variant: 'p',
61
+ children: 'This is a paragraph with the default typography style. It provides readable text for body content.',
62
+ },
63
+ };
64
+ /**
65
+ * Caption style for small text.
66
+ */
67
+ export var Caption = {
68
+ args: {
69
+ variant: 'caption',
70
+ children: 'This is caption text, typically used for figure captions or footnotes.',
71
+ },
72
+ };
73
+ /**
74
+ * All typography variants displayed together.
75
+ */
76
+ export var AllVariants = {
77
+ render: function () { return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsx(Typography, { variant: "h1", children: "Heading 1 Style" }), _jsx(Typography, { variant: "h2", children: "Heading 2 Style" }), _jsx(Typography, { variant: "h3", children: "Heading 3 Style" }), _jsx(Typography, { variant: "h4", children: "Heading 4 Style" }), _jsx(Typography, { variant: "p", children: "This is paragraph text. It's the default variant and is suitable for body content and general text throughout your documentation." }), _jsx(Typography, { variant: "caption", children: "This is caption text, used for smaller annotations or supplementary information." })] })); },
78
+ };
@@ -0,0 +1,5 @@
1
+ interface UseKeyPressOptions {
2
+ ignoreTextInput?: boolean;
3
+ }
4
+ export declare const useKeyPress: (keys: string | string[], handler: (event: KeyboardEvent) => void, { ignoreTextInput }?: UseKeyPressOptions) => void;
5
+ export {};
@@ -0,0 +1,60 @@
1
+ import { useEffect, useRef, useMemo } from 'react';
2
+ var normalizeKeyCombination = function (keys) {
3
+ var parts = keys.split(/\s*\+\s*/);
4
+ if (parts.length === 1) {
5
+ return [null, parts[0]];
6
+ }
7
+ return [parts[0], parts[1]];
8
+ };
9
+ var matchesModifierKey = function (modifier, event) {
10
+ switch (modifier) {
11
+ case null:
12
+ return true;
13
+ case 'cmd':
14
+ return event.metaKey || event.ctrlKey;
15
+ case 'ctrl':
16
+ return event.ctrlKey;
17
+ case 'shift':
18
+ return event.shiftKey;
19
+ case 'alt':
20
+ return event.altKey;
21
+ default:
22
+ return false;
23
+ }
24
+ };
25
+ var matchesAnyCombination = function (combinations, event) {
26
+ return combinations.some(function (_a) {
27
+ var modifier = _a[0], key = _a[1];
28
+ return event.key === key && matchesModifierKey(modifier, event);
29
+ });
30
+ };
31
+ var isTypingInInput = function (event) {
32
+ var target = event.target;
33
+ return target.matches('input') || target.matches('textarea');
34
+ };
35
+ export var useKeyPress = function (keys, handler, _a) {
36
+ var _b = _a === void 0 ? {} : _a, _c = _b.ignoreTextInput, ignoreTextInput = _c === void 0 ? true : _c;
37
+ var savedHandler = useRef(handler);
38
+ var combinations = useMemo(function () {
39
+ return Array.isArray(keys)
40
+ ? keys.map(normalizeKeyCombination)
41
+ : [normalizeKeyCombination(keys)];
42
+ }, [keys]);
43
+ useEffect(function () {
44
+ savedHandler.current = handler;
45
+ }, [handler]);
46
+ useEffect(function () {
47
+ var handleKeyDown = function (event) {
48
+ if (ignoreTextInput && isTypingInInput(event)) {
49
+ return;
50
+ }
51
+ if (matchesAnyCombination(combinations, event)) {
52
+ savedHandler.current(event);
53
+ }
54
+ };
55
+ document.addEventListener('keydown', handleKeyDown);
56
+ return function () {
57
+ document.removeEventListener('keydown', handleKeyDown);
58
+ };
59
+ }, [combinations, ignoreTextInput]);
60
+ };
@@ -0,0 +1,10 @@
1
+ export * from './components/Button';
2
+ export * from './components/Callout';
3
+ export * from './components/Card';
4
+ export * from './components/CardGrid';
5
+ export * from './components/Collapser';
6
+ export * from './components/CodeBlock';
7
+ export * from './components/Typography';
8
+ export * from './components/Heading';
9
+ export * from './components/Link';
10
+ export * from './hooks/useKeyPress';
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // Export all components
2
+ export * from './components/Button';
3
+ export * from './components/Callout';
4
+ export * from './components/Card';
5
+ export * from './components/CardGrid';
6
+ export * from './components/Collapser';
7
+ export * from './components/CodeBlock';
8
+ export * from './components/Typography';
9
+ export * from './components/Heading';
10
+ export * from './components/Link';
11
+ // Export hooks
12
+ export * from './hooks/useKeyPress';