@xyd-js/storybook 0.0.0-build
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/.storybook/main.ts +40 -0
- package/.storybook/manager-head.html +6 -0
- package/.storybook/manager.ts +18 -0
- package/.storybook/preview.ts +40 -0
- package/.storybook/styles.css +5 -0
- package/.storybook/theme.ts +34 -0
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/eslint.config.js +28 -0
- package/package.json +61 -0
- package/public/logo.svg +10 -0
- package/src/__fixtures__/Icons.tsx +83 -0
- package/src/__fixtures__/atlas-index/package-index.mdx +194 -0
- package/src/__fixtures__/atlas-index/wip1.mdx +131 -0
- package/src/__fixtures__/atlas-index.mdx +53 -0
- package/src/__fixtures__/code-sample.mdx +15 -0
- package/src/__fixtures__/example-source-uniform.ts +41 -0
- package/src/__fixtures__/hello-world.mdx +116 -0
- package/src/components/DemoDocs.tsx +235 -0
- package/src/components/logo.tsx +37 -0
- package/src/decorators/DocsTemplate.tsx +101 -0
- package/src/docs/atlas/Atlas.stories.tsx +51 -0
- package/src/docs/atlas/todo-app.uniform.json +625 -0
- package/src/docs/atlas/uniform-to-references.ts +101 -0
- package/src/docs/components/coder/CodeSample.stories.tsx +29 -0
- package/src/docs/components/pages/PageBlogHome.stories.tsx +52 -0
- package/src/docs/components/pages/PageFirstSlide.stories.tsx +124 -0
- package/src/docs/components/pages/PageHome.stories.tsx +127 -0
- package/src/docs/components/system/Baseline.stories.tsx +126 -0
- package/src/docs/components/writer/Badge.stories.tsx +132 -0
- package/src/docs/components/writer/Banner.stories.tsx +394 -0
- package/src/docs/components/writer/Blockquote.stories.tsx +415 -0
- package/src/docs/components/writer/Breadcrumbs.stories.tsx +282 -0
- package/src/docs/components/writer/Button.stories.tsx +405 -0
- package/src/docs/components/writer/Callout.stories.tsx +183 -0
- package/src/docs/components/writer/Card.stories.tsx +457 -0
- package/src/docs/components/writer/ColorSchemeButton.stories.tsx +322 -0
- package/src/docs/components/writer/Details.stories.tsx +333 -0
- package/src/docs/components/writer/GuideCard.stories.tsx +384 -0
- package/src/docs/components/writer/Heading.stories.tsx +379 -0
- package/src/docs/components/writer/Hr.stories.tsx +325 -0
- package/src/docs/components/writer/IconSocial.stories.tsx +591 -0
- package/src/docs/components/writer/Image.stories.tsx +430 -0
- package/src/docs/components/writer/List.stories.tsx +479 -0
- package/src/docs/components/writer/NavLinks.stories.tsx +380 -0
- package/src/docs/components/writer/Pre.stories.tsx +23 -0
- package/src/docs/components/writer/Steps.stories.tsx +914 -0
- package/src/docs/components/writer/Table.stories.tsx +608 -0
- package/src/docs/components/writer/Tabs.stories.tsx +760 -0
- package/src/docs/components/writer/TocCard.stories.tsx +407 -0
- package/src/docs/components/writer/Update.stories.tsx +457 -0
- package/src/docs/components/writer/VideoGuide.stories.tsx +17 -0
- package/src/docs/templates/CodeSample.stories.tsx +15 -0
- package/src/docs/themes/TODO.md +1 -0
- package/src/docs/themes/logo.tsx +37 -0
- package/src/docs/themes/themes.stories.tsx +269 -0
- package/src/docs/ui/Nav.stories.tsx +58 -0
- package/src/docs/ui/Sidebar.stories.tsx +167 -0
- package/src/docs/ui/SubNav.stories.tsx +29 -0
- package/src/utils/mdx.ts +31 -0
- package/tsconfig.json +39 -0
- package/vite.config.ts +8 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Heading } from '@xyd-js/components/writer';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Heading> = {
|
|
7
|
+
title: 'Components/Writer/Heading',
|
|
8
|
+
component: Heading,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: 'Heading component renders headings with various sizes (h1-h6) and supports additional features like labels, subtitles, and anchor links.',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
children: {
|
|
18
|
+
description: 'The content to display inside the heading',
|
|
19
|
+
control: 'text',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
description: 'The size of the heading (1-6, corresponding to h1-h6)',
|
|
23
|
+
control: { type: 'select' },
|
|
24
|
+
options: [1, 2, 3, 4, 5, 6],
|
|
25
|
+
},
|
|
26
|
+
as: {
|
|
27
|
+
description: 'Optional HTML element to render as (div or span)',
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
options: ['div', 'span'],
|
|
30
|
+
},
|
|
31
|
+
id: {
|
|
32
|
+
description: 'Optional ID for the heading element',
|
|
33
|
+
control: 'text',
|
|
34
|
+
},
|
|
35
|
+
kind: {
|
|
36
|
+
description: 'Optional visual style variant',
|
|
37
|
+
control: { type: 'select' },
|
|
38
|
+
options: ['muted'],
|
|
39
|
+
},
|
|
40
|
+
onClick: {
|
|
41
|
+
description: 'Optional click handler',
|
|
42
|
+
control: false,
|
|
43
|
+
},
|
|
44
|
+
className: {
|
|
45
|
+
description: 'Optional additional CSS class name',
|
|
46
|
+
control: 'text',
|
|
47
|
+
},
|
|
48
|
+
active: {
|
|
49
|
+
description: 'Optional active state',
|
|
50
|
+
control: 'boolean',
|
|
51
|
+
},
|
|
52
|
+
label: {
|
|
53
|
+
description: 'Optional label for the heading',
|
|
54
|
+
control: 'text',
|
|
55
|
+
},
|
|
56
|
+
subtitle: {
|
|
57
|
+
description: 'Optional subtitle for the heading',
|
|
58
|
+
control: 'text',
|
|
59
|
+
},
|
|
60
|
+
noanchor: {
|
|
61
|
+
description: 'Optional to hide the anchor icon',
|
|
62
|
+
control: 'boolean',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default meta;
|
|
68
|
+
type Story = StoryObj<typeof Heading>;
|
|
69
|
+
|
|
70
|
+
// Basic usage with different sizes
|
|
71
|
+
export const Default: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
children: 'Heading 1',
|
|
74
|
+
size: 1,
|
|
75
|
+
},
|
|
76
|
+
render: (args) => (
|
|
77
|
+
<div style={{ padding: '20px' }}>
|
|
78
|
+
<Heading {...args} />
|
|
79
|
+
</div>
|
|
80
|
+
),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// All heading sizes
|
|
84
|
+
export const AllSizes: Story = {
|
|
85
|
+
render: () => (
|
|
86
|
+
<div style={{ padding: '20px' }}>
|
|
87
|
+
<div style={{ marginBottom: '20px' }}>
|
|
88
|
+
<Heading size={1} id="heading-1">
|
|
89
|
+
Heading 1 - Main Title
|
|
90
|
+
</Heading>
|
|
91
|
+
</div>
|
|
92
|
+
<div style={{ marginBottom: '20px' }}>
|
|
93
|
+
<Heading size={2} id="heading-2">
|
|
94
|
+
Heading 2 - Section Title
|
|
95
|
+
</Heading>
|
|
96
|
+
</div>
|
|
97
|
+
<div style={{ marginBottom: '20px' }}>
|
|
98
|
+
<Heading size={3} id="heading-3">
|
|
99
|
+
Heading 3 - Subsection Title
|
|
100
|
+
</Heading>
|
|
101
|
+
</div>
|
|
102
|
+
<div style={{ marginBottom: '20px' }}>
|
|
103
|
+
<Heading size={4} id="heading-4">
|
|
104
|
+
Heading 4 - Minor Section
|
|
105
|
+
</Heading>
|
|
106
|
+
</div>
|
|
107
|
+
<div style={{ marginBottom: '20px' }}>
|
|
108
|
+
<Heading size={5} id="heading-5">
|
|
109
|
+
Heading 5 - Small Section
|
|
110
|
+
</Heading>
|
|
111
|
+
</div>
|
|
112
|
+
<div style={{ marginBottom: '20px' }}>
|
|
113
|
+
<Heading size={6} id="heading-6">
|
|
114
|
+
Heading 6 - Smallest Heading
|
|
115
|
+
</Heading>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
),
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// With muted kind
|
|
122
|
+
export const Muted: Story = {
|
|
123
|
+
args: {
|
|
124
|
+
children: 'Muted Heading',
|
|
125
|
+
size: 3,
|
|
126
|
+
kind: 'muted',
|
|
127
|
+
},
|
|
128
|
+
render: (args) => (
|
|
129
|
+
<div style={{ padding: '20px' }}>
|
|
130
|
+
<Heading {...args} />
|
|
131
|
+
</div>
|
|
132
|
+
),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// With label
|
|
136
|
+
export const WithLabel: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
children: 'Heading with Label',
|
|
139
|
+
size: 2,
|
|
140
|
+
label: 'NEW',
|
|
141
|
+
},
|
|
142
|
+
render: (args) => (
|
|
143
|
+
<div style={{ padding: '20px' }}>
|
|
144
|
+
<Heading {...args} />
|
|
145
|
+
</div>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// With subtitle
|
|
150
|
+
export const WithSubtitle: Story = {
|
|
151
|
+
args: {
|
|
152
|
+
children: 'Main Heading',
|
|
153
|
+
size: 1,
|
|
154
|
+
subtitle: 'This is a subtitle that provides additional context for the main heading.',
|
|
155
|
+
},
|
|
156
|
+
render: (args) => (
|
|
157
|
+
<div style={{ padding: '20px' }}>
|
|
158
|
+
<Heading {...args} />
|
|
159
|
+
</div>
|
|
160
|
+
),
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// With label and subtitle
|
|
164
|
+
export const WithLabelAndSubtitle: Story = {
|
|
165
|
+
args: {
|
|
166
|
+
children: 'Complete Heading',
|
|
167
|
+
size: 2,
|
|
168
|
+
label: 'BETA',
|
|
169
|
+
subtitle: 'This heading demonstrates both a label and subtitle working together.',
|
|
170
|
+
},
|
|
171
|
+
render: (args) => (
|
|
172
|
+
<div style={{ padding: '20px' }}>
|
|
173
|
+
<Heading {...args} />
|
|
174
|
+
</div>
|
|
175
|
+
),
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// Without anchor
|
|
179
|
+
export const WithoutAnchor: Story = {
|
|
180
|
+
args: {
|
|
181
|
+
children: 'Heading without Anchor',
|
|
182
|
+
size: 3,
|
|
183
|
+
noanchor: true,
|
|
184
|
+
},
|
|
185
|
+
render: (args) => (
|
|
186
|
+
<div style={{ padding: '20px' }}>
|
|
187
|
+
<Heading {...args} />
|
|
188
|
+
</div>
|
|
189
|
+
),
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// As different HTML element
|
|
193
|
+
export const AsDiv: Story = {
|
|
194
|
+
args: {
|
|
195
|
+
children: 'Heading as Div',
|
|
196
|
+
size: 2,
|
|
197
|
+
as: 'div',
|
|
198
|
+
},
|
|
199
|
+
render: (args) => (
|
|
200
|
+
<div style={{ padding: '20px' }}>
|
|
201
|
+
<Heading {...args} />
|
|
202
|
+
</div>
|
|
203
|
+
),
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
export const AsSpan: Story = {
|
|
207
|
+
args: {
|
|
208
|
+
children: 'Heading as Span',
|
|
209
|
+
size: 3,
|
|
210
|
+
as: 'span',
|
|
211
|
+
},
|
|
212
|
+
render: (args) => (
|
|
213
|
+
<div style={{ padding: '20px' }}>
|
|
214
|
+
<Heading {...args} />
|
|
215
|
+
</div>
|
|
216
|
+
),
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// Active state
|
|
220
|
+
export const Active: Story = {
|
|
221
|
+
args: {
|
|
222
|
+
children: 'Active Heading',
|
|
223
|
+
size: 2,
|
|
224
|
+
id: 'active-heading',
|
|
225
|
+
active: true,
|
|
226
|
+
},
|
|
227
|
+
render: (args) => (
|
|
228
|
+
<div style={{ padding: '20px' }}>
|
|
229
|
+
<Heading {...args} />
|
|
230
|
+
</div>
|
|
231
|
+
),
|
|
232
|
+
parameters: {
|
|
233
|
+
docs: {
|
|
234
|
+
description: {
|
|
235
|
+
story: 'This heading is in an active state, typically used when the heading corresponds to the current section in navigation.',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// Interactive example
|
|
242
|
+
export const Interactive: Story = {
|
|
243
|
+
args: {
|
|
244
|
+
children: 'Clickable Heading',
|
|
245
|
+
size: 2,
|
|
246
|
+
id: 'interactive-heading',
|
|
247
|
+
},
|
|
248
|
+
render: (args) => (
|
|
249
|
+
<div style={{ padding: '20px' }}>
|
|
250
|
+
<Heading {...args} />
|
|
251
|
+
<p style={{ marginTop: '10px', fontSize: '14px', color: '#666' }}>
|
|
252
|
+
Try clicking on the heading above to see the anchor link behavior.
|
|
253
|
+
</p>
|
|
254
|
+
</div>
|
|
255
|
+
),
|
|
256
|
+
parameters: {
|
|
257
|
+
docs: {
|
|
258
|
+
description: {
|
|
259
|
+
story: 'This heading has an ID and is clickable. Clicking it will update the URL hash and scroll to the heading.',
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// All variants showcase
|
|
266
|
+
export const AllVariants: Story = {
|
|
267
|
+
render: () => (
|
|
268
|
+
<div style={{ padding: '20px' }}>
|
|
269
|
+
<div style={{ marginBottom: '30px' }}>
|
|
270
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Default Headings</h3>
|
|
271
|
+
<Heading size={1} id="default-h1">Default H1</Heading>
|
|
272
|
+
<Heading size={2} id="default-h2">Default H2</Heading>
|
|
273
|
+
<Heading size={3} id="default-h3">Default H3</Heading>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
<div style={{ marginBottom: '30px' }}>
|
|
277
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Muted Headings</h3>
|
|
278
|
+
<Heading size={1} kind="muted" id="muted-h1">Muted H1</Heading>
|
|
279
|
+
<Heading size={2} kind="muted" id="muted-h2">Muted H2</Heading>
|
|
280
|
+
<Heading size={3} kind="muted" id="muted-h3">Muted H3</Heading>
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div style={{ marginBottom: '30px' }}>
|
|
284
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Headings with Labels</h3>
|
|
285
|
+
<Heading size={2} label="NEW" id="label-h2">Heading with Label</Heading>
|
|
286
|
+
<Heading size={3} label="BETA" id="label-h3">Another with Label</Heading>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
<div style={{ marginBottom: '30px' }}>
|
|
290
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Headings with Subtitles</h3>
|
|
291
|
+
<Heading size={1} subtitle="This provides additional context" id="subtitle-h1">
|
|
292
|
+
Main Heading
|
|
293
|
+
</Heading>
|
|
294
|
+
<Heading size={2} subtitle="Another subtitle example" id="subtitle-h2">
|
|
295
|
+
Section Heading
|
|
296
|
+
</Heading>
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
<div style={{ marginBottom: '30px' }}>
|
|
300
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Complete Examples</h3>
|
|
301
|
+
<Heading size={2} label="FEATURED" subtitle="The most comprehensive example" id="complete-h2">
|
|
302
|
+
Complete Heading
|
|
303
|
+
</Heading>
|
|
304
|
+
<Heading size={3} label="DEPRECATED" subtitle="This will be removed soon" id="complete-h3">
|
|
305
|
+
Another Complete Example
|
|
306
|
+
</Heading>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<div style={{ marginBottom: '30px' }}>
|
|
310
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>Without Anchors</h3>
|
|
311
|
+
<Heading size={2} noanchor id="noanchor-h2">No Anchor H2</Heading>
|
|
312
|
+
<Heading size={3} noanchor id="noanchor-h3">No Anchor H3</Heading>
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<div style={{ marginBottom: '30px' }}>
|
|
316
|
+
<h3 style={{ marginBottom: '10px', color: '#666' }}>As Different Elements</h3>
|
|
317
|
+
<Heading size={2} as="div" id="div-h2">Heading as Div</Heading>
|
|
318
|
+
<Heading size={3} as="span" id="span-h3">Heading as Span</Heading>
|
|
319
|
+
</div>
|
|
320
|
+
</div>
|
|
321
|
+
),
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// Real-world example
|
|
325
|
+
export const RealWorldExample: Story = {
|
|
326
|
+
render: () => (
|
|
327
|
+
<div style={{ padding: '20px', maxWidth: '800px' }}>
|
|
328
|
+
<Heading size={1} id="getting-started">
|
|
329
|
+
Getting Started
|
|
330
|
+
</Heading>
|
|
331
|
+
<p style={{ marginBottom: '20px' }}>
|
|
332
|
+
Welcome to our comprehensive guide. This section will help you understand the basics.
|
|
333
|
+
</p>
|
|
334
|
+
|
|
335
|
+
<Heading size={2} id="installation" label="REQUIRED">
|
|
336
|
+
Installation
|
|
337
|
+
</Heading>
|
|
338
|
+
<p style={{ marginBottom: '20px' }}>
|
|
339
|
+
Follow these steps to install the required dependencies.
|
|
340
|
+
</p>
|
|
341
|
+
|
|
342
|
+
<Heading size={3} id="quick-start">
|
|
343
|
+
Quick Start
|
|
344
|
+
</Heading>
|
|
345
|
+
<p style={{ marginBottom: '20px' }}>
|
|
346
|
+
Get up and running in minutes with our quick start guide.
|
|
347
|
+
</p>
|
|
348
|
+
|
|
349
|
+
<Heading size={2} id="configuration" subtitle="Advanced setup options">
|
|
350
|
+
Configuration
|
|
351
|
+
</Heading>
|
|
352
|
+
<p style={{ marginBottom: '20px' }}>
|
|
353
|
+
Learn about advanced configuration options and customization.
|
|
354
|
+
</p>
|
|
355
|
+
|
|
356
|
+
<Heading size={3} id="environment-variables" label="OPTIONAL">
|
|
357
|
+
Environment Variables
|
|
358
|
+
</Heading>
|
|
359
|
+
<p style={{ marginBottom: '20px' }}>
|
|
360
|
+
Configure your environment for optimal performance.
|
|
361
|
+
</p>
|
|
362
|
+
|
|
363
|
+
<Heading size={2} id="next-steps" kind="muted">
|
|
364
|
+
Next Steps
|
|
365
|
+
</Heading>
|
|
366
|
+
<p style={{ marginBottom: '20px' }}>
|
|
367
|
+
Now that you're set up, explore our advanced features and tutorials.
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
370
|
+
),
|
|
371
|
+
parameters: {
|
|
372
|
+
docs: {
|
|
373
|
+
description: {
|
|
374
|
+
story: 'This example shows how headings are typically used in documentation, with various combinations of labels, subtitles, and different sizes.',
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
|