@slipstream-ui/core 0.4.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.
Files changed (92) hide show
  1. package/dist/index.d.mts +296 -15
  2. package/dist/index.d.ts +296 -15
  3. package/dist/index.js +1047 -473
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1096 -530
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/manifests/app-shell.manifest.json +50 -0
  8. package/dist/manifests/badge.manifest.json +9 -4
  9. package/dist/manifests/breadcrumb.manifest.json +6 -0
  10. package/dist/manifests/button.manifest.json +14 -0
  11. package/dist/manifests/confirm-dialog.manifest.json +132 -0
  12. package/dist/manifests/data-table.manifest.json +50 -0
  13. package/dist/manifests/dialog.manifest.json +7 -0
  14. package/dist/manifests/drawer.manifest.json +7 -0
  15. package/dist/manifests/link.manifest.json +106 -0
  16. package/dist/manifests/page-header.manifest.json +30 -0
  17. package/dist/manifests/pagination.manifest.json +6 -0
  18. package/dist/manifests/prose.manifest.json +75 -0
  19. package/dist/manifests/search.manifest.json +41 -9
  20. package/dist/manifests/section-heading.manifest.json +108 -0
  21. package/dist/manifests/select.manifest.json +6 -0
  22. package/dist/manifests/site-footer.manifest.json +94 -0
  23. package/dist/manifests/site-header.manifest.json +130 -0
  24. package/dist/manifests/table-of-contents.manifest.json +87 -0
  25. package/package.json +2 -2
  26. package/src/components/alert/Alert.tsx +2 -2
  27. package/src/components/app-shell/AppShell.test.tsx +49 -1
  28. package/src/components/app-shell/AppShell.tsx +147 -43
  29. package/src/components/badge/Badge.test.tsx +21 -0
  30. package/src/components/badge/Badge.tsx +6 -0
  31. package/src/components/breadcrumb/Breadcrumb.test.tsx +16 -0
  32. package/src/components/breadcrumb/Breadcrumb.tsx +10 -5
  33. package/src/components/button/Button.test.tsx +40 -2
  34. package/src/components/button/Button.tsx +31 -7
  35. package/src/components/confirm-dialog/ConfirmDialog.test.tsx +46 -0
  36. package/src/components/confirm-dialog/ConfirmDialog.tsx +86 -0
  37. package/src/components/confirm-dialog/index.ts +1 -0
  38. package/src/components/data-table/DataTable.test.tsx +92 -0
  39. package/src/components/data-table/DataTable.tsx +98 -7
  40. package/src/components/dialog/Dialog.test.tsx +7 -0
  41. package/src/components/dialog/Dialog.tsx +4 -1
  42. package/src/components/drawer/Drawer.test.tsx +11 -2
  43. package/src/components/drawer/Drawer.tsx +5 -2
  44. package/src/components/input/Input.tsx +1 -0
  45. package/src/components/link/Link.test.tsx +60 -0
  46. package/src/components/link/Link.tsx +85 -0
  47. package/src/components/link/index.ts +1 -0
  48. package/src/components/page-header/PageHeader.test.tsx +17 -0
  49. package/src/components/page-header/PageHeader.tsx +22 -6
  50. package/src/components/pagination/Pagination.test.tsx +8 -0
  51. package/src/components/pagination/Pagination.tsx +16 -6
  52. package/src/components/prose/Prose.test.tsx +35 -0
  53. package/src/components/prose/Prose.tsx +61 -0
  54. package/src/components/prose/index.ts +1 -0
  55. package/src/components/search/Search.test.tsx +16 -0
  56. package/src/components/search/Search.tsx +11 -2
  57. package/src/components/section-heading/SectionHeading.test.tsx +32 -0
  58. package/src/components/section-heading/SectionHeading.tsx +54 -0
  59. package/src/components/section-heading/index.ts +1 -0
  60. package/src/components/select/Select.tsx +9 -7
  61. package/src/components/site-footer/SiteFooter.test.tsx +30 -0
  62. package/src/components/site-footer/SiteFooter.tsx +79 -0
  63. package/src/components/site-footer/index.ts +1 -0
  64. package/src/components/site-header/SiteHeader.test.tsx +53 -0
  65. package/src/components/site-header/SiteHeader.tsx +124 -0
  66. package/src/components/site-header/index.ts +1 -0
  67. package/src/components/switch/Switch.test.tsx +10 -0
  68. package/src/components/switch/Switch.tsx +8 -3
  69. package/src/components/table-of-contents/TableOfContents.test.tsx +31 -0
  70. package/src/components/table-of-contents/TableOfContents.tsx +100 -0
  71. package/src/components/table-of-contents/index.ts +1 -0
  72. package/src/components/textarea/Textarea.tsx +1 -0
  73. package/src/index.ts +7 -0
  74. package/src/manifests/app-shell.manifest.json +50 -0
  75. package/src/manifests/badge.manifest.json +9 -4
  76. package/src/manifests/breadcrumb.manifest.json +6 -0
  77. package/src/manifests/button.manifest.json +14 -0
  78. package/src/manifests/confirm-dialog.manifest.json +132 -0
  79. package/src/manifests/data-table.manifest.json +50 -0
  80. package/src/manifests/dialog.manifest.json +7 -0
  81. package/src/manifests/drawer.manifest.json +7 -0
  82. package/src/manifests/link.manifest.json +106 -0
  83. package/src/manifests/page-header.manifest.json +30 -0
  84. package/src/manifests/pagination.manifest.json +6 -0
  85. package/src/manifests/prose.manifest.json +75 -0
  86. package/src/manifests/search.manifest.json +41 -9
  87. package/src/manifests/section-heading.manifest.json +108 -0
  88. package/src/manifests/select.manifest.json +6 -0
  89. package/src/manifests/site-footer.manifest.json +94 -0
  90. package/src/manifests/site-header.manifest.json +130 -0
  91. package/src/manifests/table-of-contents.manifest.json +87 -0
  92. package/src/test/tailwind-v4.test.ts +103 -0
@@ -34,6 +34,36 @@
34
34
  "type": "ReactNode",
35
35
  "required": false,
36
36
  "description": "Sub-row under the title (tabs, filters)."
37
+ },
38
+ {
39
+ "name": "eyebrow",
40
+ "type": "ReactNode",
41
+ "required": false,
42
+ "description": "Kicker above the title."
43
+ },
44
+ {
45
+ "name": "size",
46
+ "type": "'sm' | 'md' | 'lg' | 'hero'",
47
+ "required": false,
48
+ "defaultValue": "md",
49
+ "description": "Heading scale; hero is for marketing pages.",
50
+ "enum": [
51
+ "sm",
52
+ "md",
53
+ "lg",
54
+ "hero"
55
+ ]
56
+ },
57
+ {
58
+ "name": "align",
59
+ "type": "'left' | 'center'",
60
+ "required": false,
61
+ "defaultValue": "left",
62
+ "description": "Text alignment.",
63
+ "enum": [
64
+ "left",
65
+ "center"
66
+ ]
37
67
  }
38
68
  ],
39
69
  "examples": [
@@ -92,6 +92,12 @@
92
92
  "type": "PaginationIcons",
93
93
  "required": false,
94
94
  "description": "Replace the default glyphs."
95
+ },
96
+ {
97
+ "name": "labels",
98
+ "type": "{ pagination?: string; first?: string; previous?: string; next?: string; last?: string; page?: (page: number) => string }",
99
+ "required": false,
100
+ "description": "Localized landmark and control labels."
95
101
  }
96
102
  ],
97
103
  "examples": [
@@ -0,0 +1,75 @@
1
+ {
2
+ "id": "prose",
3
+ "name": "Prose",
4
+ "tier": "molecule",
5
+ "package": "@slipstream-ui/core",
6
+ "importPath": "@slipstream-ui/core",
7
+ "version": "0.1.0",
8
+ "sourceDir": "prose",
9
+ "exportName": "Prose",
10
+ "description": "Self-contained long-form typography for rendered markdown/MDX: headings, links, lists, code, tables, quotes and figures.",
11
+ "designIntent": "Content sites need consistent article typography without depending on the Tailwind typography plugin. Prose styles rendered HTML via child selectors, so any remark/MDX pipeline can drop output inside.",
12
+ "props": [
13
+ {
14
+ "name": "size",
15
+ "type": "'sm' | 'md' | 'lg'",
16
+ "required": false,
17
+ "defaultValue": "md",
18
+ "description": "Type scale for body and headings.",
19
+ "enum": [
20
+ "sm",
21
+ "md",
22
+ "lg"
23
+ ]
24
+ }
25
+ ],
26
+ "examples": [
27
+ {
28
+ "title": "Article body",
29
+ "code": "<Prose size=\"md\">\n {renderedMarkdown}\n</Prose>",
30
+ "description": "Wrap MDX/remark output; keep Shiki/KaTeX as-is."
31
+ }
32
+ ],
33
+ "antiPatterns": [
34
+ {
35
+ "title": "Don't use prose for app UI",
36
+ "explanation": "Prose targets article content; forms and dashboards use Text/Heading.",
37
+ "example": "// Avoid\n<Prose><Button /></Prose>"
38
+ }
39
+ ],
40
+ "accessibility": [
41
+ {
42
+ "feature": "Heading anchors",
43
+ "implementation": "scroll-mt offsets headings under sticky headers",
44
+ "userRequirements": "Generate heading ids in your markdown pipeline"
45
+ }
46
+ ],
47
+ "contentGuidelines": [
48
+ {
49
+ "contentType": "Article copy",
50
+ "guidelines": [
51
+ "Sentence case headings",
52
+ "Short paragraphs"
53
+ ],
54
+ "goodExamples": [
55
+ "## Install the package"
56
+ ],
57
+ "badExamples": [
58
+ "## CLICK HERE"
59
+ ]
60
+ }
61
+ ],
62
+ "compositionRules": [
63
+ {
64
+ "component": "TableOfContents",
65
+ "relationship": "Pair long articles with a TOC + useScrollSpy",
66
+ "example": "<Prose>{content}</Prose><TableOfContents headings={headings} />"
67
+ }
68
+ ],
69
+ "relatedComponents": [
70
+ "TableOfContents",
71
+ "Heading",
72
+ "Text",
73
+ "CodeBlock"
74
+ ]
75
+ }
@@ -10,14 +10,18 @@
10
10
  "type": "SearchOption[]",
11
11
  "required": true,
12
12
  "description": "The full option set; filtered client-side as the user types.",
13
- "examples": ["[{ value: 'react', label: 'React', keywords: 'ui framework' }]"]
13
+ "examples": [
14
+ "[{ value: 'react', label: 'React', keywords: 'ui framework' }]"
15
+ ]
14
16
  },
15
17
  {
16
18
  "name": "defaultValue",
17
19
  "type": "string",
18
20
  "required": false,
19
21
  "description": "Initially selected option value (display starts on its label).",
20
- "examples": ["react"]
22
+ "examples": [
23
+ "react"
24
+ ]
21
25
  },
22
26
  {
23
27
  "name": "onValueChange",
@@ -31,7 +35,9 @@
31
35
  "required": false,
32
36
  "description": "Input placeholder while no query is typed.",
33
37
  "defaultValue": "'Search…'",
34
- "examples": ["'Search components…'"]
38
+ "examples": [
39
+ "'Search components…'"
40
+ ]
35
41
  },
36
42
  {
37
43
  "name": "emptyText",
@@ -39,7 +45,9 @@
39
45
  "required": false,
40
46
  "description": "Shown when no option matches the query.",
41
47
  "defaultValue": "'No matching results'",
42
- "examples": ["'No people found'"]
48
+ "examples": [
49
+ "'No people found'"
50
+ ]
43
51
  },
44
52
  {
45
53
  "name": "disabled",
@@ -47,7 +55,16 @@
47
55
  "required": false,
48
56
  "description": "Disables the input and the dropdown.",
49
57
  "defaultValue": "false",
50
- "examples": ["true", "false"]
58
+ "examples": [
59
+ "true",
60
+ "false"
61
+ ]
62
+ },
63
+ {
64
+ "name": "value",
65
+ "type": "string | null",
66
+ "required": false,
67
+ "description": "Controlled selected value; display follows it (null clears)."
51
68
  }
52
69
  ],
53
70
  "examples": [
@@ -104,9 +121,19 @@
104
121
  "contentGuidelines": [
105
122
  {
106
123
  "contentType": "Option labels",
107
- "guidelines": ["Show the primary identifying text", "Use description for role/context", "Keep labels unique or disambiguate with description"],
108
- "goodExamples": ["Ada Lovelace — Design", "prod-eu-west-1 (Frankfurt)"],
109
- "badExamples": ["Ada", "test"]
124
+ "guidelines": [
125
+ "Show the primary identifying text",
126
+ "Use description for role/context",
127
+ "Keep labels unique or disambiguate with description"
128
+ ],
129
+ "goodExamples": [
130
+ "Ada Lovelace — Design",
131
+ "prod-eu-west-1 (Frankfurt)"
132
+ ],
133
+ "badExamples": [
134
+ "Ada",
135
+ "test"
136
+ ]
110
137
  }
111
138
  ],
112
139
  "compositionRules": [
@@ -120,7 +147,12 @@
120
147
  "relationship": "Choose Search for constrained picks; Autocomplete when free-form values must stay allowed"
121
148
  }
122
149
  ],
123
- "relatedComponents": ["Autocomplete", "Select", "FormField", "CommandPalette"],
150
+ "relatedComponents": [
151
+ "Autocomplete",
152
+ "Select",
153
+ "FormField",
154
+ "CommandPalette"
155
+ ],
124
156
  "package": "@slipstream-ui/core",
125
157
  "importPath": "@slipstream-ui/core",
126
158
  "version": "0.1.0",
@@ -0,0 +1,108 @@
1
+ {
2
+ "id": "section-heading",
3
+ "name": "SectionHeading",
4
+ "tier": "molecule",
5
+ "package": "@slipstream-ui/core",
6
+ "importPath": "@slipstream-ui/core",
7
+ "version": "0.1.0",
8
+ "sourceDir": "section-heading",
9
+ "exportName": "SectionHeading",
10
+ "description": "Section heading block: eyebrow, title (level 2-4), description and actions, with left/center alignment and three sizes.",
11
+ "designIntent": "Marketing and content pages repeat the same eyebrow/title/description/actions cluster for every section. SectionHeading standardizes it without claiming the page h1 (that is PageHeader's job).",
12
+ "props": [
13
+ {
14
+ "name": "title",
15
+ "type": "string",
16
+ "required": true,
17
+ "description": "Section title."
18
+ },
19
+ {
20
+ "name": "description",
21
+ "type": "string",
22
+ "required": false,
23
+ "description": "Supporting copy."
24
+ },
25
+ {
26
+ "name": "eyebrow",
27
+ "type": "ReactNode",
28
+ "required": false,
29
+ "description": "Kicker above the title."
30
+ },
31
+ {
32
+ "name": "actions",
33
+ "type": "ReactNode",
34
+ "required": false,
35
+ "description": "Right-aligned actions."
36
+ },
37
+ {
38
+ "name": "level",
39
+ "type": "2 | 3 | 4",
40
+ "required": false,
41
+ "defaultValue": "2",
42
+ "description": "Heading level rendered for the title."
43
+ },
44
+ {
45
+ "name": "align",
46
+ "type": "'left' | 'center'",
47
+ "required": false,
48
+ "defaultValue": "left",
49
+ "description": "Text and action alignment."
50
+ },
51
+ {
52
+ "name": "size",
53
+ "type": "'sm' | 'md' | 'lg'",
54
+ "required": false,
55
+ "defaultValue": "md",
56
+ "description": "Title scale."
57
+ }
58
+ ],
59
+ "examples": [
60
+ {
61
+ "title": "Marketing section",
62
+ "code": "<SectionHeading\n eyebrow=\"Components\"\n title=\"Built for agents\"\n description=\"Every component ships a spec.\"\n actions={<Link href=\"/docs\">All docs</Link>}\n/>",
63
+ "description": "Eyebrow + title + copy + action link."
64
+ }
65
+ ],
66
+ "antiPatterns": [
67
+ {
68
+ "title": "Don't use it for the page title",
69
+ "explanation": "PageHeader owns the single h1; SectionHeading defaults to h2.",
70
+ "example": "// Avoid two h1s\n<SectionHeading level={1} />\n\n// Prefer\n<PageHeader title=\"Page\" />"
71
+ }
72
+ ],
73
+ "accessibility": [
74
+ {
75
+ "feature": "Configurable heading level",
76
+ "implementation": "Renders h2/h3/h4 via the level prop",
77
+ "userRequirements": "Keep the hierarchy sequential under the page h1"
78
+ }
79
+ ],
80
+ "contentGuidelines": [
81
+ {
82
+ "contentType": "Titles",
83
+ "guidelines": [
84
+ "Noun phrases",
85
+ "Sentence case",
86
+ "Parallel across sections"
87
+ ],
88
+ "goodExamples": [
89
+ "Built for agents"
90
+ ],
91
+ "badExamples": [
92
+ "Section 2"
93
+ ]
94
+ }
95
+ ],
96
+ "compositionRules": [
97
+ {
98
+ "component": "PageHeader",
99
+ "relationship": "PageHeader for the h1; SectionHeading for h2+ sections",
100
+ "example": "<PageHeader title=\"…\" /><SectionHeading title=\"…\" />"
101
+ }
102
+ ],
103
+ "relatedComponents": [
104
+ "PageHeader",
105
+ "Heading",
106
+ "Text"
107
+ ]
108
+ }
@@ -59,6 +59,12 @@
59
59
  "required": false,
60
60
  "defaultValue": "false",
61
61
  "description": "Native multi-select; value/defaultValue/onChange switch to string[]."
62
+ },
63
+ {
64
+ "name": "onValueChange",
65
+ "type": "(value: string | string[]) => void",
66
+ "required": false,
67
+ "description": "Alias for onChange — value-based callback."
62
68
  }
63
69
  ],
64
70
  "examples": [
@@ -0,0 +1,94 @@
1
+ {
2
+ "id": "site-footer",
3
+ "name": "SiteFooter",
4
+ "tier": "organism",
5
+ "package": "@slipstream-ui/core",
6
+ "importPath": "@slipstream-ui/core",
7
+ "version": "0.1.0",
8
+ "sourceDir": "site-footer",
9
+ "exportName": "SiteFooter",
10
+ "description": "Marketing footer: brand + tagline column, link columns and a legal bar; router-agnostic via linkComponent.",
11
+ "designIntent": "Footers are copied between projects with inconsistent link handling. SiteFooter provides the standard multi-column layout, safe external links and a legal row.",
12
+ "props": [
13
+ {
14
+ "name": "brand",
15
+ "type": "ReactNode",
16
+ "required": false,
17
+ "description": "Brand slot."
18
+ },
19
+ {
20
+ "name": "tagline",
21
+ "type": "string",
22
+ "required": false,
23
+ "description": "Short line under the brand."
24
+ },
25
+ {
26
+ "name": "columns",
27
+ "type": "SiteFooterColumn[]",
28
+ "required": true,
29
+ "description": "Link columns: { title, links: { label, href, external? }[] }."
30
+ },
31
+ {
32
+ "name": "legal",
33
+ "type": "ReactNode",
34
+ "required": false,
35
+ "description": "Bottom bar (copyright, legal links)."
36
+ },
37
+ {
38
+ "name": "linkComponent",
39
+ "type": "React.ElementType",
40
+ "required": false,
41
+ "description": "Router link element."
42
+ }
43
+ ],
44
+ "examples": [
45
+ {
46
+ "title": "Standard footer",
47
+ "code": "<SiteFooter\n brand={<img src=\"/logo.svg\" alt=\"Acme\" className=\"h-10\" />}\n tagline=\"Ship UI your AI understands.\"\n columns={[{ title: 'Docs', links: [{ label: 'Intro', href: '/docs' }] }]}\n legal={<span>© 2026 Acme</span>}\n/>",
48
+ "description": "Brand, columns and legal row."
49
+ }
50
+ ],
51
+ "antiPatterns": [
52
+ {
53
+ "title": "Don't duplicate the same links in two columns",
54
+ "explanation": "Keep each destination in exactly one column for predictable scanning.",
55
+ "example": "// Avoid: Docs in Product and Resources"
56
+ }
57
+ ],
58
+ "accessibility": [
59
+ {
60
+ "feature": "Landmark semantics",
61
+ "implementation": "Renders <footer> with headed link groups",
62
+ "userRequirements": "Give columns short, unique titles"
63
+ }
64
+ ],
65
+ "contentGuidelines": [
66
+ {
67
+ "contentType": "Column titles",
68
+ "guidelines": [
69
+ "Nouns",
70
+ "3-8 items per column"
71
+ ],
72
+ "goodExamples": [
73
+ "Product",
74
+ "Legal",
75
+ "Community"
76
+ ],
77
+ "badExamples": [
78
+ "Links"
79
+ ]
80
+ }
81
+ ],
82
+ "compositionRules": [
83
+ {
84
+ "component": "SiteHeader",
85
+ "relationship": "Pair for a complete marketing shell",
86
+ "example": "<SiteHeader … />…<SiteFooter … />"
87
+ }
88
+ ],
89
+ "relatedComponents": [
90
+ "SiteHeader",
91
+ "Link",
92
+ "Separator"
93
+ ]
94
+ }
@@ -0,0 +1,130 @@
1
+ {
2
+ "id": "site-header",
3
+ "name": "SiteHeader",
4
+ "tier": "organism",
5
+ "package": "@slipstream-ui/core",
6
+ "importPath": "@slipstream-ui/core",
7
+ "version": "0.1.0",
8
+ "sourceDir": "site-header",
9
+ "exportName": "SiteHeader",
10
+ "description": "Marketing/site header: sticky bar with brand, horizontal navigation with prefix-aware active states, right-aligned actions and a mobile drawer.",
11
+ "designIntent": "Marketing sites repeat brand/nav/actions/mobile-menu wiring with custom active matching. SiteHeader standardizes the bar, handles /docs matching /docs/components, and stays router-agnostic via linkComponent.",
12
+ "props": [
13
+ {
14
+ "name": "brand",
15
+ "type": "ReactNode",
16
+ "required": true,
17
+ "description": "Brand slot (logo/lockup), wrapped in a link to /."
18
+ },
19
+ {
20
+ "name": "items",
21
+ "type": "SiteNavItem[]",
22
+ "required": true,
23
+ "description": "Primary nav: { href, label, external? }."
24
+ },
25
+ {
26
+ "name": "activeHref",
27
+ "type": "string",
28
+ "required": false,
29
+ "description": "Current route for active styling (aria-current=page)."
30
+ },
31
+ {
32
+ "name": "match",
33
+ "type": "'prefix' | 'exact'",
34
+ "required": false,
35
+ "defaultValue": "prefix",
36
+ "description": "Prefix highlights parents of the current route; exact only identical hrefs.",
37
+ "enum": [
38
+ "prefix",
39
+ "exact"
40
+ ]
41
+ },
42
+ {
43
+ "name": "actions",
44
+ "type": "ReactNode",
45
+ "required": false,
46
+ "description": "Right-aligned actions (theme toggle, GitHub, CTA)."
47
+ },
48
+ {
49
+ "name": "linkComponent",
50
+ "type": "React.ElementType",
51
+ "required": false,
52
+ "description": "Router link element."
53
+ },
54
+ {
55
+ "name": "sticky",
56
+ "type": "boolean",
57
+ "required": false,
58
+ "defaultValue": "true",
59
+ "description": "Pin the bar to the top."
60
+ },
61
+ {
62
+ "name": "mobileLabel",
63
+ "type": "string",
64
+ "required": false,
65
+ "defaultValue": "Menu",
66
+ "description": "Title of the mobile navigation drawer."
67
+ }
68
+ ],
69
+ "examples": [
70
+ {
71
+ "title": "Marketing header",
72
+ "code": "<SiteHeader\n brand={<img src=\"/logo.svg\" alt=\"Acme\" className=\"h-8\" />}\n items={[{ href: '/docs', label: 'Docs' }, { href: '/pricing', label: 'Pricing' }]}\n activeHref={pathname}\n linkComponent={RouterLink}\n actions={<ThemeToggle />}\n/>",
73
+ "description": "Prefix-active nav with a mobile drawer."
74
+ }
75
+ ],
76
+ "antiPatterns": [
77
+ {
78
+ "title": "Don't use it for admin rails",
79
+ "explanation": "Vertical app navigation belongs in Sidebar + AppShell.",
80
+ "example": "// Avoid\n<SiteHeader items={adminNav} />\n\n// Prefer\n<AppShell sidebar={<Sidebar sections={sections} />}>…</AppShell>"
81
+ }
82
+ ],
83
+ "accessibility": [
84
+ {
85
+ "feature": "Current page",
86
+ "implementation": "aria-current=page on the active link (prefix or exact matching)",
87
+ "userRequirements": "Pass activeHref on every route"
88
+ },
89
+ {
90
+ "feature": "Mobile navigation",
91
+ "implementation": "Burger opens a focus-trapped Drawer with the same items",
92
+ "userRequirements": "Keep the same item list for both breakpoints"
93
+ }
94
+ ],
95
+ "contentGuidelines": [
96
+ {
97
+ "contentType": "Nav labels",
98
+ "guidelines": [
99
+ "1-2 nouns",
100
+ "Parallel phrasing"
101
+ ],
102
+ "goodExamples": [
103
+ "Docs",
104
+ "Pricing",
105
+ "Changelog"
106
+ ],
107
+ "badExamples": [
108
+ "Click here for docs"
109
+ ]
110
+ }
111
+ ],
112
+ "compositionRules": [
113
+ {
114
+ "component": "SiteFooter",
115
+ "relationship": "Pair header and footer for a complete marketing shell",
116
+ "example": "<SiteHeader … /><main /><SiteFooter … />"
117
+ },
118
+ {
119
+ "component": "Drawer",
120
+ "relationship": "The mobile menu is a Drawer automatically",
121
+ "example": "<SiteHeader … />"
122
+ }
123
+ ],
124
+ "relatedComponents": [
125
+ "SiteFooter",
126
+ "AppShell",
127
+ "Sidebar",
128
+ "Link"
129
+ ]
130
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "id": "table-of-contents",
3
+ "name": "TableOfContents",
4
+ "tier": "molecule",
5
+ "package": "@slipstream-ui/core",
6
+ "importPath": "@slipstream-ui/core",
7
+ "version": "0.1.0",
8
+ "sourceDir": "table-of-contents",
9
+ "exportName": "TableOfContents",
10
+ "description": "Sticky 'On this page' navigation with nested levels and aria-current, plus a useScrollSpy hook for the active heading.",
11
+ "designIntent": "Long-form pages drift into bespoke TOC implementations. TableOfContents fixes the nested list, active styling and landmark name; useScrollSpy supplies the active id from real scroll position.",
12
+ "props": [
13
+ {
14
+ "name": "headings",
15
+ "type": "TocHeading[]",
16
+ "required": true,
17
+ "description": "Headings: { id, text, level: 2 | 3 | 4 }."
18
+ },
19
+ {
20
+ "name": "activeId",
21
+ "type": "string",
22
+ "required": false,
23
+ "description": "Controlled active heading (pair with useScrollSpy)."
24
+ },
25
+ {
26
+ "name": "label",
27
+ "type": "string",
28
+ "required": false,
29
+ "defaultValue": "On this page",
30
+ "description": "Accessible name of the nav landmark."
31
+ },
32
+ {
33
+ "name": "sticky",
34
+ "type": "boolean",
35
+ "required": false,
36
+ "defaultValue": "true",
37
+ "description": "Stick while the article scrolls."
38
+ }
39
+ ],
40
+ "examples": [
41
+ {
42
+ "title": "Article TOC",
43
+ "code": "const activeId = useScrollSpy(headings.map((h) => h.id));\n\n<TableOfContents headings={headings} activeId={activeId} />",
44
+ "description": "Scroll-spy driven active state."
45
+ }
46
+ ],
47
+ "antiPatterns": [
48
+ {
49
+ "title": "Don't hardcode the active id",
50
+ "explanation": "Compute it from scroll position so the highlight follows the reader.",
51
+ "example": "// Avoid\n<TableOfContents headings={h} activeId=\"intro\" />"
52
+ }
53
+ ],
54
+ "accessibility": [
55
+ {
56
+ "feature": "Landmark + current item",
57
+ "implementation": "nav aria-label plus aria-current=location on the active link",
58
+ "userRequirements": "Keep heading levels sequential"
59
+ }
60
+ ],
61
+ "contentGuidelines": [
62
+ {
63
+ "contentType": "Heading text",
64
+ "guidelines": [
65
+ "Match the on-page heading text exactly"
66
+ ],
67
+ "goodExamples": [
68
+ "Installation"
69
+ ],
70
+ "badExamples": [
71
+ "Section 1"
72
+ ]
73
+ }
74
+ ],
75
+ "compositionRules": [
76
+ {
77
+ "component": "Prose",
78
+ "relationship": "Pairs with article bodies",
79
+ "example": "<TableOfContents headings={headings} activeId={active} />"
80
+ }
81
+ ],
82
+ "relatedComponents": [
83
+ "Prose",
84
+ "Breadcrumb",
85
+ "List"
86
+ ]
87
+ }