@roadlittledawn/docs-design-system-react 0.3.0 → 0.5.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.
@@ -0,0 +1,183 @@
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
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Popover } from "./Popover";
14
+ var meta = {
15
+ title: "Components/Popover",
16
+ component: Popover,
17
+ tags: ["autodocs"],
18
+ parameters: {
19
+ layout: "centered",
20
+ docs: {
21
+ description: {
22
+ component: "\nA hover/tap-activated popover for enriching inline content in documentation.\nBuilt on the native [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) for reliable top-layer rendering \u2014 no z-index wars, no overflow clipping.\n\nCommon use cases include glossary term definitions and Wikipedia-style content previews.\n\n## Content modes\n\nThe `Popover` supports three mutually exclusive content modes, checked in this order:\n\n1. **`content`** \u2014 arbitrary `ReactNode`; you control everything\n2. **`glossary`** \u2014 structured `{ term, title, definition }` template\n3. **`preview`** \u2014 structured `{ title, excerpt, imageUrl, href }` template\n\n## When to Use\n\n- Inline term definitions that would interrupt reading flow if expanded in-place\n- Link previews that let users get context without navigating away\n- Any contextual content that benefits from being on-demand rather than always visible\n\n## When Not to Use\n\n- For critical information users must read \u2014 use a `Callout` instead\n- As a primary navigation mechanism\n- For content that needs persistent visibility\n\n## Mobile behavior\n\nOn screens \u2264 640 px the popover renders as a bottom sheet instead of a floating panel.\nHover events don't apply; the popover toggles on tap.\n\n## Accessibility\n\n- Trigger has `tabIndex={0}` and shows the popover on focus (keyboard accessible)\n- Popover panel has `role=\"tooltip\"` and is linked via `aria-describedby`\n- The native Popover API handles Escape-key dismissal automatically\n- Light-dismiss (click outside) is provided by `popover=\"auto\"`\n ",
23
+ },
24
+ },
25
+ },
26
+ };
27
+ export default meta;
28
+ /**
29
+ * The glossary template renders a structured definition popover.
30
+ * The `definition` field accepts `ReactNode` — pre-render any markdown
31
+ * using your preferred renderer before passing it in.
32
+ */
33
+ export var GlossaryDefinition = {
34
+ args: {
35
+ glossary: {
36
+ term: "observability",
37
+ title: "Observability",
38
+ definition: (_jsxs(_Fragment, { children: ["The ability to understand the internal state of a system by examining its external outputs \u2014 primarily", " ", _jsx("a", { href: "https://example.com/metrics", children: "metrics" }), ", logs, and traces."] })),
39
+ },
40
+ },
41
+ parameters: {
42
+ docs: {
43
+ source: {
44
+ code: "<Popover\n glossary={{\n term: \"observability\",\n title: \"Observability\",\n definition: (\n <>\n The ability to understand the internal state of a system by examining\n its external outputs \u2014 primarily{\" \"}\n <a href=\"https://example.com/metrics\">metrics</a>, logs, and traces.\n </>\n ),\n }}\n>\n observability\n</Popover>",
45
+ },
46
+ },
47
+ },
48
+ render: function (args) { return (_jsxs("p", { style: { fontFamily: "sans-serif", fontSize: "1rem", color: "var(--dds-tabs-panel-text)" }, children: ["Modern software reliability depends on", " ", _jsx(Popover, __assign({}, args, { children: "observability" })), " to diagnose production issues quickly."] })); },
49
+ };
50
+ /**
51
+ * The preview template renders a Wikipedia-style content preview with an
52
+ * optional featured image, excerpt, and "Read more" link.
53
+ */
54
+ export var ContentPreview = {
55
+ args: {
56
+ preview: {
57
+ title: "New Relic",
58
+ excerpt: "New Relic is an observability platform that helps engineers plan, build, deploy, and run software. Over 17,000 customers use New Relic to improve uptime, performance, and operational efficiency.",
59
+ imageUrl: "https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=640&q=80",
60
+ href: "https://newrelic.com",
61
+ linkText: "Read more",
62
+ },
63
+ size: "lg",
64
+ },
65
+ parameters: {
66
+ docs: {
67
+ source: {
68
+ code: "<Popover\n size=\"lg\"\n preview={{\n title: \"New Relic\",\n excerpt: \"New Relic is an observability platform that helps engineers plan, build, deploy, and run software.\",\n imageUrl: \"/images/newrelic.jpg\",\n href: \"https://newrelic.com\",\n linkText: \"Read more\",\n }}\n>\n New Relic\n</Popover>",
69
+ },
70
+ },
71
+ },
72
+ render: function (args) { return (_jsxs("p", { style: { fontFamily: "sans-serif", fontSize: "1rem", color: "var(--dds-tabs-panel-text)" }, children: ["The monitoring data is sent to ", _jsx(Popover, __assign({}, args, { children: "New Relic" })), " ", "where you can build dashboards and alerts."] })); },
73
+ };
74
+ /**
75
+ * Pass any React element as the `content` prop when the built-in templates
76
+ * don't fit your use case.
77
+ */
78
+ export var CustomContent = {
79
+ args: {
80
+ content: (_jsxs("div", { style: { padding: "1rem" }, children: [_jsx("strong", { style: { display: "block", marginBottom: "0.5rem" }, children: "API Rate Limits" }), _jsxs("table", { style: { fontSize: "0.8125rem", borderCollapse: "collapse", width: "100%" }, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { textAlign: "left", paddingBottom: "0.25rem", borderBottom: "1px solid #e5e7eb" }, children: "Plan" }), _jsx("th", { style: { textAlign: "right", paddingBottom: "0.25rem", borderBottom: "1px solid #e5e7eb" }, children: "Req/min" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { children: "Free" }), _jsx("td", { style: { textAlign: "right" }, children: "60" })] }), _jsxs("tr", { children: [_jsx("td", { children: "Pro" }), _jsx("td", { style: { textAlign: "right" }, children: "1,000" })] }), _jsxs("tr", { children: [_jsx("td", { children: "Enterprise" }), _jsx("td", { style: { textAlign: "right" }, children: "Unlimited" })] })] })] })] })),
81
+ size: "md",
82
+ },
83
+ parameters: {
84
+ docs: {
85
+ source: {
86
+ code: "<Popover\n content={\n <div style={{ padding: \"1rem\" }}>\n <strong>API Rate Limits</strong>\n {/* custom table or any JSX */}\n </div>\n }\n>\n rate limits\n</Popover>",
87
+ },
88
+ },
89
+ },
90
+ render: function (args) { return (_jsxs("p", { style: { fontFamily: "sans-serif", fontSize: "1rem", color: "var(--dds-tabs-panel-text)" }, children: ["Each API key is subject to ", _jsx(Popover, __assign({}, args, { children: "rate limits" })), " based on your subscription plan."] })); },
91
+ };
92
+ /**
93
+ * Size variants — sm (240px), md (320px), lg (480px).
94
+ */
95
+ export var Sizes = {
96
+ parameters: {
97
+ docs: {
98
+ source: {
99
+ code: "<Popover size=\"sm\" glossary={{ term: \"sm\", title: \"Small (240px)\", definition: \"A compact popover for brief definitions.\" }}>\n small\n</Popover>\n\n<Popover size=\"md\" glossary={{ term: \"md\", title: \"Medium (320px)\", definition: \"The default size, suitable for most glossary and preview use cases.\" }}>\n medium\n</Popover>\n\n<Popover size=\"lg\" glossary={{ term: \"lg\", title: \"Large (480px)\", definition: \"A wider panel for rich content previews with images or tables.\" }}>\n large\n</Popover>",
100
+ },
101
+ },
102
+ },
103
+ render: function () { return (_jsxs("div", { style: {
104
+ fontFamily: "sans-serif",
105
+ fontSize: "1rem",
106
+ display: "flex",
107
+ gap: "2rem",
108
+ alignItems: "center",
109
+ color: "var(--dds-tabs-panel-text)",
110
+ }, children: [_jsx(Popover, { size: "sm", glossary: {
111
+ term: "sm",
112
+ title: "Small (240px)",
113
+ definition: "A compact popover for brief definitions.",
114
+ }, children: "small" }), _jsx(Popover, { size: "md", glossary: {
115
+ term: "md",
116
+ title: "Medium (320px)",
117
+ definition: "The default size, suitable for most glossary and preview use cases.",
118
+ }, children: "medium" }), _jsx(Popover, { size: "lg", glossary: {
119
+ term: "lg",
120
+ title: "Large (480px)",
121
+ definition: "A wider panel for rich content previews with images or tables.",
122
+ }, children: "large" })] })); },
123
+ };
124
+ /**
125
+ * Placement variants control which side of the trigger the popover appears on.
126
+ * "auto" (default) detects available viewport space.
127
+ */
128
+ export var Placement = {
129
+ parameters: {
130
+ docs: {
131
+ source: {
132
+ code: "<Popover placement=\"top\" glossary={...}>shows above</Popover>\n<Popover placement=\"bottom\" glossary={...}>shows below</Popover>\n<Popover placement=\"top-start\" glossary={...}>top-start</Popover>\n<Popover placement=\"bottom-end\" glossary={...}>bottom-end</Popover>",
133
+ },
134
+ },
135
+ },
136
+ render: function () { return (_jsx("div", { style: {
137
+ fontFamily: "sans-serif",
138
+ fontSize: "1rem",
139
+ display: "flex",
140
+ flexWrap: "wrap",
141
+ gap: "2rem",
142
+ justifyContent: "center",
143
+ padding: "6rem 2rem",
144
+ color: "var(--dds-tabs-panel-text)",
145
+ }, children: [
146
+ "top",
147
+ "top-start",
148
+ "top-end",
149
+ "bottom",
150
+ "bottom-start",
151
+ "bottom-end",
152
+ ].map(function (p) { return (_jsx(Popover, { placement: p, glossary: {
153
+ term: p,
154
+ title: "placement=\"".concat(p, "\""),
155
+ definition: "The popover opens ".concat(p.replace("-", " "), " relative to its trigger."),
156
+ }, children: p }, p)); }) })); },
157
+ };
158
+ /**
159
+ * Multiple popovers in a paragraph — only one can be open at a time
160
+ * (native Popover API `popover="auto"` behaviour).
161
+ */
162
+ export var InlineParagraph = {
163
+ parameters: {
164
+ docs: {
165
+ source: {
166
+ code: "<p>\n <Popover glossary={{ term: \"apm\", title: \"APM\", definition: \"Application Performance Monitoring...\" }}>APM</Popover>\n {\" \"}data flows into{\" \"}\n <Popover preview={{ title: \"New Relic\", excerpt: \"...\", href: \"https://newrelic.com\" }}>New Relic</Popover>\n {\" \"}where you can configure{\" \"}\n <Popover glossary={{ term: \"alert\", title: \"Alert\", definition: \"A notification triggered when a signal crosses a threshold.\" }}>alerts</Popover>.\n</p>",
167
+ },
168
+ },
169
+ },
170
+ render: function () { return (_jsxs("p", { style: { fontFamily: "sans-serif", fontSize: "1rem", maxWidth: "480px", lineHeight: 1.7, color: "var(--dds-tabs-panel-text)", margin: 0 }, children: [_jsx(Popover, { glossary: {
171
+ term: "apm",
172
+ title: "APM",
173
+ definition: "Application Performance Monitoring — tracks the performance of software applications and their underlying infrastructure.",
174
+ }, children: "APM" }), " ", "data flows into", " ", _jsx(Popover, { preview: {
175
+ title: "New Relic",
176
+ excerpt: "New Relic is an observability platform used by over 17,000 customers.",
177
+ href: "https://newrelic.com",
178
+ }, children: "New Relic" }), " ", "where you can configure", " ", _jsx(Popover, { glossary: {
179
+ term: "alert",
180
+ title: "Alert",
181
+ definition: "A notification triggered when a metric or signal crosses a defined threshold.",
182
+ }, children: "alerts" }), " ", "to notify your on-call team."] })); },
183
+ };
@@ -0,0 +1,40 @@
1
+ import React from "react";
2
+ interface TabsProps {
3
+ /** ID of the initially active tab */
4
+ defaultActiveTab?: string;
5
+ /** Controlled active tab ID */
6
+ activeTab?: string;
7
+ /** Callback when tab changes */
8
+ onTabChange?: (id: string) => void;
9
+ /** Tab content */
10
+ children: React.ReactNode;
11
+ /** Additional CSS classes */
12
+ className?: string;
13
+ }
14
+ export declare function Tabs({ defaultActiveTab, activeTab: controlledActiveTab, onTabChange, children, className, }: TabsProps): import("react/jsx-runtime").JSX.Element;
15
+ interface TabListProps {
16
+ /** Tab buttons */
17
+ children: React.ReactNode;
18
+ /** Additional CSS classes */
19
+ className?: string;
20
+ }
21
+ export declare function TabList({ children, className }: TabListProps): import("react/jsx-runtime").JSX.Element;
22
+ interface TabProps {
23
+ /** Unique identifier for this tab */
24
+ id: string;
25
+ /** Tab label */
26
+ children: React.ReactNode;
27
+ /** Additional CSS classes */
28
+ className?: string;
29
+ }
30
+ export declare function Tab({ id, children, className }: TabProps): import("react/jsx-runtime").JSX.Element;
31
+ interface TabPanelProps {
32
+ /** ID matching the corresponding Tab */
33
+ id: string;
34
+ /** Panel content */
35
+ children: React.ReactNode;
36
+ /** Additional CSS classes */
37
+ className?: string;
38
+ }
39
+ export declare function TabPanel({ id, children, className }: TabPanelProps): import("react/jsx-runtime").JSX.Element | null;
40
+ export {};
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState, createContext, useContext } from "react";
3
+ var TabsContext = createContext(null);
4
+ export function Tabs(_a) {
5
+ var defaultActiveTab = _a.defaultActiveTab, controlledActiveTab = _a.activeTab, onTabChange = _a.onTabChange, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
6
+ var _c = useState(defaultActiveTab || ""), internalActiveTab = _c[0], setInternalActiveTab = _c[1];
7
+ var isControlled = controlledActiveTab !== undefined;
8
+ var activeTab = isControlled ? controlledActiveTab : internalActiveTab;
9
+ var setActiveTab = function (id) {
10
+ if (!isControlled) {
11
+ setInternalActiveTab(id);
12
+ }
13
+ onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(id);
14
+ };
15
+ return (_jsx(TabsContext.Provider, { value: { activeTab: activeTab, setActiveTab: setActiveTab }, children: _jsx("div", { className: "dds-tabs ".concat(className).trim(), children: children }) }));
16
+ }
17
+ export function TabList(_a) {
18
+ var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
19
+ return (_jsx("div", { className: "dds-tabs-list ".concat(className).trim(), role: "tablist", children: children }));
20
+ }
21
+ export function Tab(_a) {
22
+ var id = _a.id, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
23
+ var context = useContext(TabsContext);
24
+ if (!context) {
25
+ throw new Error("Tab must be used within Tabs component");
26
+ }
27
+ var activeTab = context.activeTab, setActiveTab = context.setActiveTab;
28
+ var isActive = activeTab === id;
29
+ return (_jsx("button", { className: "dds-tab ".concat(isActive ? "dds-tab-active" : "", " ").concat(className).trim(), onClick: function () { return setActiveTab(id); }, role: "tab", "aria-selected": isActive, "aria-controls": "panel-".concat(id), id: "tab-".concat(id), type: "button", children: children }));
30
+ }
31
+ export function TabPanel(_a) {
32
+ var id = _a.id, children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
33
+ var context = useContext(TabsContext);
34
+ if (!context) {
35
+ throw new Error("TabPanel must be used within Tabs component");
36
+ }
37
+ var activeTab = context.activeTab;
38
+ var isActive = activeTab === id;
39
+ if (!isActive)
40
+ return null;
41
+ return (_jsx("div", { className: "dds-tab-panel ".concat(className).trim(), role: "tabpanel", "aria-labelledby": "tab-".concat(id), id: "panel-".concat(id), children: children }));
42
+ }
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { Tabs } from "./Tabs";
3
+ /**
4
+ * Tabs organize and segment related content, reducing cognitive load by allowing users
5
+ * to toggle between views without navigating to new pages.
6
+ */
7
+ declare const meta: Meta<typeof Tabs>;
8
+ export default meta;
9
+ type Story = StoryObj<typeof Tabs>;
10
+ /**
11
+ * Basic tabs with three sections of content.
12
+ */
13
+ export declare const Basic: Story;
14
+ /**
15
+ * Tabs showing code examples in different programming languages.
16
+ */
17
+ export declare const CodeExamples: Story;
18
+ /**
19
+ * Tabs with longer content demonstrating scrollable tab list.
20
+ */
21
+ export declare const ManyTabs: Story;
22
+ /**
23
+ * Controlled tabs where the active tab is managed by parent component state.
24
+ */
25
+ export declare const Controlled: Story;
@@ -0,0 +1,89 @@
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
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from "react";
14
+ import { Tabs, TabList, Tab, TabPanel } from "./Tabs";
15
+ import { CodeBlock } from "./CodeBlock";
16
+ /**
17
+ * Tabs organize and segment related content, reducing cognitive load by allowing users
18
+ * to toggle between views without navigating to new pages.
19
+ */
20
+ var meta = {
21
+ title: "Components/Tabs",
22
+ component: Tabs,
23
+ tags: ["autodocs"],
24
+ parameters: {
25
+ docs: {
26
+ description: {
27
+ component: "\nTabs are best used to organize, segment, and reduce cognitive load when presenting large amounts of related but distinct content.\n\n## When to Use\n\n- **Segmenting Related Alternatives**: Show different solutions for the same task (e.g., code examples in Python, Java, JavaScript)\n- **Managing Complex/Long Documents**: Break down extensive documentation into smaller, more manageable sections\n- **Context-Switching**: Allow users to switch between different views (e.g., \"Overview,\" \"Usage,\" \"API Reference\") while staying in the same context\n- **Organizing Workflows**: Separate complex workflows, such as student work from instructions, or setup steps from troubleshooting\n- **Reducing Clutter**: Hide non-essential or less frequently used information, showing only relevant details at one time\n\n## When Not to Use\n\n- When content is short and can be easily scrolled\n- When users need to compare all content simultaneously\n- If the information in the tabs is not related\n- For navigation between pages (use Link component instead)\n\n## Best Practices\n\n- **Default View**: Always set a logical default tab (e.g., the most commonly used language or platform)\n- **Clear Labels**: Ensure tab labels are concise, descriptive, and clearly distinguish between options\n- **Limit Number**: Avoid using too many tabs (more than 5-6 can clutter the interface)\n- **Avoid Nested Tabs**: Too many levels of navigation can confuse users\n\n## Tabs vs Collapsers\n\nUse **tabs** for a small number of distinct, parallel content sections where users rarely need to compare them simultaneously. Use **collapsers** (accordions) for long, vertical content, mobile-first layouts, or FAQs to minimize scrolling and allow users to see all options at once.\n\n## Accessibility\n\n- Uses proper ARIA attributes (`role=\"tab\"`, `role=\"tabpanel\"`, `aria-selected`)\n- Tab buttons are keyboard accessible\n- Active tab is clearly indicated visually and to screen readers\n ",
28
+ },
29
+ },
30
+ },
31
+ };
32
+ export default meta;
33
+ /**
34
+ * Basic tabs with three sections of content.
35
+ */
36
+ export var Basic = {
37
+ args: {
38
+ defaultActiveTab: "overview",
39
+ },
40
+ parameters: {
41
+ docs: {
42
+ source: {
43
+ code: "<Tabs defaultActiveTab=\"overview\">\n <TabList>\n <Tab id=\"overview\">Overview</Tab>\n <Tab id=\"usage\">Usage</Tab>\n <Tab id=\"api\">API Reference</Tab>\n </TabList>\n <TabPanel id=\"overview\">\n <p>\n This is the overview section. It provides a high-level introduction\n to the topic.\n </p>\n </TabPanel>\n <TabPanel id=\"usage\">\n <p>\n This is the usage section. It contains practical examples and\n instructions.\n </p>\n </TabPanel>\n <TabPanel id=\"api\">\n <p>\n This is the API reference section. It documents the technical\n interface.\n </p>\n </TabPanel>\n</Tabs>",
44
+ },
45
+ },
46
+ },
47
+ render: function (args) { return (_jsxs(Tabs, __assign({}, args, { children: [_jsxs(TabList, { children: [_jsx(Tab, { id: "overview", children: "Overview" }), _jsx(Tab, { id: "usage", children: "Usage" }), _jsx(Tab, { id: "api", children: "API Reference" })] }), _jsx(TabPanel, { id: "overview", children: _jsx("p", { children: "This is the overview section. It provides a high-level introduction to the topic." }) }), _jsx(TabPanel, { id: "usage", children: _jsx("p", { children: "This is the usage section. It contains practical examples and instructions." }) }), _jsx(TabPanel, { id: "api", children: _jsx("p", { children: "This is the API reference section. It documents the technical interface." }) })] }))); },
48
+ };
49
+ /**
50
+ * Tabs showing code examples in different programming languages.
51
+ */
52
+ export var CodeExamples = {
53
+ args: {
54
+ defaultActiveTab: "javascript",
55
+ },
56
+ parameters: {
57
+ docs: {
58
+ source: {
59
+ code: "<Tabs defaultActiveTab=\"javascript\">\n <TabList>\n <Tab id=\"javascript\">JavaScript</Tab>\n <Tab id=\"python\">Python</Tab>\n <Tab id=\"java\">Java</Tab>\n </TabList>\n <TabPanel id=\"javascript\">\n <CodeBlock \n language=\"javascript\" \n code={`const greeting = \"Hello, world!\";\nconsole.log(greeting);`} \n />\n </TabPanel>\n <TabPanel id=\"python\">\n <CodeBlock \n language=\"python\" \n code={`greeting = \"Hello, world!\"\nprint(greeting)`} \n />\n </TabPanel>\n <TabPanel id=\"java\">\n <CodeBlock \n language=\"java\" \n code={`String greeting = \"Hello, world!\";\nSystem.out.println(greeting);`} \n />\n </TabPanel>\n</Tabs>",
60
+ },
61
+ },
62
+ },
63
+ render: function (args) { return (_jsxs(Tabs, __assign({}, args, { children: [_jsxs(TabList, { children: [_jsx(Tab, { id: "javascript", children: "JavaScript" }), _jsx(Tab, { id: "python", children: "Python" }), _jsx(Tab, { id: "java", children: "Java" })] }), _jsx(TabPanel, { id: "javascript", children: _jsx(CodeBlock, { language: "javascript", code: "const greeting = \"Hello, world!\";\nconsole.log(greeting);" }) }), _jsx(TabPanel, { id: "python", children: _jsx(CodeBlock, { language: "python", code: "greeting = \"Hello, world!\"\nprint(greeting)" }) }), _jsx(TabPanel, { id: "java", children: _jsx(CodeBlock, { language: "java", code: "String greeting = \"Hello, world!\";\nSystem.out.println(greeting);" }) })] }))); },
64
+ };
65
+ /**
66
+ * Tabs with longer content demonstrating scrollable tab list.
67
+ */
68
+ export var ManyTabs = {
69
+ args: {
70
+ defaultActiveTab: "tab1",
71
+ },
72
+ parameters: {
73
+ docs: {
74
+ source: {
75
+ code: "<Tabs defaultActiveTab=\"tab1\">\n <TabList>\n <Tab id=\"tab1\">Introduction</Tab>\n <Tab id=\"tab2\">Getting Started</Tab>\n <Tab id=\"tab3\">Configuration</Tab>\n <Tab id=\"tab4\">Advanced Usage</Tab>\n <Tab id=\"tab5\">Troubleshooting</Tab>\n <Tab id=\"tab6\">FAQ</Tab>\n </TabList>\n <TabPanel id=\"tab1\">\n <p>Introduction content goes here.</p>\n </TabPanel>\n <TabPanel id=\"tab2\">\n <p>Getting started content goes here.</p>\n </TabPanel>\n <TabPanel id=\"tab3\">\n <p>Configuration content goes here.</p>\n </TabPanel>\n <TabPanel id=\"tab4\">\n <p>Advanced usage content goes here.</p>\n </TabPanel>\n <TabPanel id=\"tab5\">\n <p>Troubleshooting content goes here.</p>\n </TabPanel>\n <TabPanel id=\"tab6\">\n <p>FAQ content goes here.</p>\n </TabPanel>\n</Tabs>",
76
+ },
77
+ },
78
+ },
79
+ render: function (args) { return (_jsxs(Tabs, __assign({}, args, { children: [_jsxs(TabList, { children: [_jsx(Tab, { id: "tab1", children: "Introduction" }), _jsx(Tab, { id: "tab2", children: "Getting Started" }), _jsx(Tab, { id: "tab3", children: "Configuration" }), _jsx(Tab, { id: "tab4", children: "Advanced Usage" }), _jsx(Tab, { id: "tab5", children: "Troubleshooting" }), _jsx(Tab, { id: "tab6", children: "FAQ" })] }), _jsx(TabPanel, { id: "tab1", children: _jsx("p", { children: "Introduction content goes here." }) }), _jsx(TabPanel, { id: "tab2", children: _jsx("p", { children: "Getting started content goes here." }) }), _jsx(TabPanel, { id: "tab3", children: _jsx("p", { children: "Configuration content goes here." }) }), _jsx(TabPanel, { id: "tab4", children: _jsx("p", { children: "Advanced usage content goes here." }) }), _jsx(TabPanel, { id: "tab5", children: _jsx("p", { children: "Troubleshooting content goes here." }) }), _jsx(TabPanel, { id: "tab6", children: _jsx("p", { children: "FAQ content goes here." }) })] }))); },
80
+ };
81
+ /**
82
+ * Controlled tabs where the active tab is managed by parent component state.
83
+ */
84
+ export var Controlled = {
85
+ render: function ControlledExample() {
86
+ var _a = React.useState("tab1"), activeTab = _a[0], setActiveTab = _a[1];
87
+ return (_jsxs("div", { children: [_jsxs("p", { style: { marginBottom: "1rem", color: "var(--dds-tabs-panel-text)" }, children: ["Active tab: ", _jsx("strong", { children: activeTab })] }), _jsxs(Tabs, { activeTab: activeTab, onTabChange: setActiveTab, children: [_jsxs(TabList, { children: [_jsx(Tab, { id: "tab1", children: "Tab 1" }), _jsx(Tab, { id: "tab2", children: "Tab 2" }), _jsx(Tab, { id: "tab3", children: "Tab 3" })] }), _jsx(TabPanel, { id: "tab1", children: _jsx("p", { children: "Content for tab 1" }) }), _jsx(TabPanel, { id: "tab2", children: _jsx("p", { children: "Content for tab 2" }) }), _jsx(TabPanel, { id: "tab3", children: _jsx("p", { children: "Content for tab 3" }) })] })] }));
88
+ },
89
+ };
@@ -24,6 +24,13 @@ export var H1 = {
24
24
  variant: 'h1',
25
25
  children: 'Heading 1 Style',
26
26
  },
27
+ parameters: {
28
+ docs: {
29
+ source: {
30
+ code: "<Typography variant=\"h1\">Heading 1 Style</Typography>",
31
+ },
32
+ },
33
+ },
27
34
  };
28
35
  /**
29
36
  * H2 heading style.
@@ -33,6 +40,13 @@ export var H2 = {
33
40
  variant: 'h2',
34
41
  children: 'Heading 2 Style',
35
42
  },
43
+ parameters: {
44
+ docs: {
45
+ source: {
46
+ code: "<Typography variant=\"h2\">Heading 2 Style</Typography>",
47
+ },
48
+ },
49
+ },
36
50
  };
37
51
  /**
38
52
  * H3 heading style.
@@ -42,6 +56,13 @@ export var H3 = {
42
56
  variant: 'h3',
43
57
  children: 'Heading 3 Style',
44
58
  },
59
+ parameters: {
60
+ docs: {
61
+ source: {
62
+ code: "<Typography variant=\"h3\">Heading 3 Style</Typography>",
63
+ },
64
+ },
65
+ },
45
66
  };
46
67
  /**
47
68
  * H4 heading style.
@@ -51,6 +72,13 @@ export var H4 = {
51
72
  variant: 'h4',
52
73
  children: 'Heading 4 Style',
53
74
  },
75
+ parameters: {
76
+ docs: {
77
+ source: {
78
+ code: "<Typography variant=\"h4\">Heading 4 Style</Typography>",
79
+ },
80
+ },
81
+ },
54
82
  };
55
83
  /**
56
84
  * Paragraph style (default).
@@ -60,6 +88,13 @@ export var Paragraph = {
60
88
  variant: 'p',
61
89
  children: 'This is a paragraph with the default typography style. It provides readable text for body content.',
62
90
  },
91
+ parameters: {
92
+ docs: {
93
+ source: {
94
+ code: "<Typography variant=\"p\">\n This is a paragraph with the default typography style. It provides readable text for body content.\n</Typography>",
95
+ },
96
+ },
97
+ },
63
98
  };
64
99
  /**
65
100
  * Caption style for small text.
@@ -69,10 +104,24 @@ export var Caption = {
69
104
  variant: 'caption',
70
105
  children: 'This is caption text, typically used for figure captions or footnotes.',
71
106
  },
107
+ parameters: {
108
+ docs: {
109
+ source: {
110
+ code: "<Typography variant=\"caption\">\n This is caption text, typically used for figure captions or footnotes.\n</Typography>",
111
+ },
112
+ },
113
+ },
72
114
  };
73
115
  /**
74
116
  * All typography variants displayed together.
75
117
  */
76
118
  export var AllVariants = {
119
+ parameters: {
120
+ docs: {
121
+ source: {
122
+ code: "<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>\n <Typography variant=\"h1\">Heading 1 Style</Typography>\n <Typography variant=\"h2\">Heading 2 Style</Typography>\n <Typography variant=\"h3\">Heading 3 Style</Typography>\n <Typography variant=\"h4\">Heading 4 Style</Typography>\n <Typography variant=\"p\">\n This is paragraph text. It's the default variant and is suitable for\n body content and general text throughout your documentation.\n </Typography>\n <Typography variant=\"caption\">\n This is caption text, used for smaller annotations or supplementary information.\n </Typography>\n</div>",
123
+ },
124
+ },
125
+ },
77
126
  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
127
  };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export * from './components/CardGrid';
5
5
  export * from './components/Collapser';
6
6
  export * from './components/CollapserGroup';
7
7
  export * from './components/CodeBlock';
8
+ export * from './components/Tabs';
9
+ export * from './components/Popover';
8
10
  export * from './components/Typography';
9
11
  export * from './components/Heading';
10
12
  export * from './components/Link';
package/dist/index.js CHANGED
@@ -6,6 +6,8 @@ export * from './components/CardGrid';
6
6
  export * from './components/Collapser';
7
7
  export * from './components/CollapserGroup';
8
8
  export * from './components/CodeBlock';
9
+ export * from './components/Tabs';
10
+ export * from './components/Popover';
9
11
  export * from './components/Typography';
10
12
  export * from './components/Heading';
11
13
  export * from './components/Link';