@neynar/ui 0.1.1 → 0.1.2
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/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- package/src/components/ui/typography.tsx +1115 -165
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @neynar/ui Component Library
|
|
2
2
|
|
|
3
|
-
A production-ready React component library with
|
|
3
|
+
A production-ready React component library with 265+ components, hooks, and utilities. Built on Radix UI primitives with Tailwind CSS v4, ensuring WCAG-compliant accessibility and zero runtime overhead.
|
|
4
4
|
|
|
5
5
|
## Quick Reference
|
|
6
6
|
|
|
@@ -9,7 +9,103 @@ import { Button, Card, useIsMobile, cn } from "@neynar/ui"
|
|
|
9
9
|
import "@neynar/ui/styles"
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
## Components
|
|
12
|
+
## 🔍 How to Search Components
|
|
13
|
+
|
|
14
|
+
**IMPORTANT:** DO NOT load the entire `llm-docs/sdk-items-registry.json` file - it contains 265+ items and will exceed context limits.
|
|
15
|
+
|
|
16
|
+
Instead, search efficiently using these methods:
|
|
17
|
+
|
|
18
|
+
### Method 1: Search by Component Name (Recommended)
|
|
19
|
+
```bash
|
|
20
|
+
# Search for specific component documentation
|
|
21
|
+
cat llm-docs/{component-name}.llm.md
|
|
22
|
+
# Example: cat llm-docs/button.llm.md
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Method 2: Search Registry by Keywords
|
|
26
|
+
```bash
|
|
27
|
+
# Use jq to search registry by keywords without loading entire file
|
|
28
|
+
jq 'to_entries[] | select(.value.keywords[]? | contains("button")) | {key: .key, description: .value.description}' llm-docs/sdk-items-registry.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Method 3: List Components by Category
|
|
32
|
+
Use these patterns to find components:
|
|
33
|
+
- **button** → Button, Toggle, ToggleGroup
|
|
34
|
+
- **form** → Input, Textarea, Checkbox, Select, Switch
|
|
35
|
+
- **navigation** → NavigationMenu, Breadcrumb, Tabs, Sidebar
|
|
36
|
+
- **overlay** → Dialog, Sheet, Popover, Tooltip
|
|
37
|
+
- **layout** → Container, Stack, Card, Accordion
|
|
38
|
+
|
|
39
|
+
## Common Mistakes and Corrections
|
|
40
|
+
|
|
41
|
+
**CRITICAL Typography Errors:**
|
|
42
|
+
- ❌ `<h1>`, `<p>`, `<span>` - NEVER use plain HTML elements
|
|
43
|
+
- ❌ `Text` component does NOT exist
|
|
44
|
+
- ❌ `<div>Some text</div>` - wrap text in typography components
|
|
45
|
+
|
|
46
|
+
**CRITICAL Component Name Errors:**
|
|
47
|
+
- ❌ `Stack direction="col"` - use `direction="vertical"`
|
|
48
|
+
- ❌ `Stack gap="4"` - use `spacing="md"`
|
|
49
|
+
- ❌ `Badge variant="success"` - use `variant="secondary"`
|
|
50
|
+
|
|
51
|
+
**Correct Usage:**
|
|
52
|
+
```typescript
|
|
53
|
+
import { H1, H2, P, Span, Code, Stack, Badge } from "@neynar/ui"
|
|
54
|
+
|
|
55
|
+
// ✅ Always use typography components for text
|
|
56
|
+
<H1>Main Title</H1>
|
|
57
|
+
<H2>Section Title</H2>
|
|
58
|
+
<P>Body text content with <Strong>emphasis</Strong></P>
|
|
59
|
+
<Small color="muted">Updated <Code>2024-01-15</Code></Small>
|
|
60
|
+
|
|
61
|
+
// ✅ Typography in containers
|
|
62
|
+
<Card>
|
|
63
|
+
<CardHeader>
|
|
64
|
+
<H3>Card Title</H3>
|
|
65
|
+
<P color="muted">Description text</P>
|
|
66
|
+
</CardHeader>
|
|
67
|
+
</Card>
|
|
68
|
+
|
|
69
|
+
// ✅ Stack with correct props
|
|
70
|
+
<Stack direction="vertical" spacing="md">
|
|
71
|
+
<P>First paragraph</P>
|
|
72
|
+
<P>Second paragraph</P>
|
|
73
|
+
</Stack>
|
|
74
|
+
|
|
75
|
+
// ✅ Badge with valid variants only
|
|
76
|
+
<Badge variant="default">Active</Badge>
|
|
77
|
+
<Badge variant="secondary">Draft</Badge>
|
|
78
|
+
<Badge variant="destructive">Error</Badge>
|
|
79
|
+
<Badge variant="outline">Pending</Badge>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Registry Structure
|
|
83
|
+
|
|
84
|
+
The `llm-docs/sdk-items-registry.json` contains metadata for all components:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"ComponentName": {
|
|
89
|
+
"description": "Brief component description with usage context",
|
|
90
|
+
"file": "component-name.llm.md",
|
|
91
|
+
"type": "component|hook|function|type",
|
|
92
|
+
"keywords": ["relevant", "search", "terms"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Efficient Search Strategy
|
|
98
|
+
|
|
99
|
+
For component discovery, use this approach:
|
|
100
|
+
|
|
101
|
+
1. **Know what you need?** → Use Method 1 (direct file access)
|
|
102
|
+
2. **Searching by functionality?** → Use Method 2 (keyword search)
|
|
103
|
+
3. **Browsing categories?** → Use Method 3 (category patterns)
|
|
104
|
+
4. **Need complete list?** → Use `jq 'keys' llm-docs/sdk-items-registry.json`
|
|
105
|
+
|
|
106
|
+
**Performance Tip:** Each .llm.md file contains complete documentation including props, examples, and TypeScript definitions. Only load what you need.
|
|
107
|
+
|
|
108
|
+
## Component Categories
|
|
13
109
|
|
|
14
110
|
### Layout Components → [docs/llm/components/layout.md](docs/llm/components/layout.md)
|
|
15
111
|
- **Container** - Responsive container with max-width constraints
|
|
@@ -82,7 +178,81 @@ import "@neynar/ui/styles"
|
|
|
82
178
|
- **ThemeToggle** - Dark/light mode switcher
|
|
83
179
|
|
|
84
180
|
### Typography Components → [docs/llm/components/typography.md](docs/llm/components/typography.md)
|
|
85
|
-
|
|
181
|
+
|
|
182
|
+
**CRITICAL: Always use typography components instead of plain HTML elements**
|
|
183
|
+
|
|
184
|
+
The typography system provides semantic HTML components with consistent styling:
|
|
185
|
+
|
|
186
|
+
#### Semantic HTML Components (Use These Instead of Plain HTML)
|
|
187
|
+
```typescript
|
|
188
|
+
// ❌ DON'T use plain HTML elements
|
|
189
|
+
<h1>Title</h1>
|
|
190
|
+
<p>Content</p>
|
|
191
|
+
<span>Text</span>
|
|
192
|
+
<a href="#">Link</a>
|
|
193
|
+
|
|
194
|
+
// ✅ DO use typography components
|
|
195
|
+
<H1>Title</H1>
|
|
196
|
+
<P>Content</P>
|
|
197
|
+
<Span>Text</Span>
|
|
198
|
+
<A href="#">Link</A>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Available Components
|
|
202
|
+
- **H1, H2, H3, H4, H5, H6** - Semantic headings with proper hierarchy
|
|
203
|
+
- **P** - Paragraph text with body variant styling
|
|
204
|
+
- **Span** - Inline text with default styling
|
|
205
|
+
- **A** - Links with proper hover/focus states
|
|
206
|
+
- **Code** - Inline code with monospace styling
|
|
207
|
+
- **Small** - Small text for captions/metadata
|
|
208
|
+
- **Strong** - Bold text for emphasis
|
|
209
|
+
- **Lead** - Large introductory text
|
|
210
|
+
- **Blockquote** - Quoted content with border styling
|
|
211
|
+
|
|
212
|
+
#### Typography Pattern: Use for ALL Text Content
|
|
213
|
+
```typescript
|
|
214
|
+
// Content containers - wrap ALL text with typography components
|
|
215
|
+
<Card>
|
|
216
|
+
<CardHeader>
|
|
217
|
+
<H2>Card Title</H2>
|
|
218
|
+
<P color="muted">Card description</P>
|
|
219
|
+
</CardHeader>
|
|
220
|
+
<CardContent>
|
|
221
|
+
<P>Main content paragraph</P>
|
|
222
|
+
<Small color="muted">Last updated: <Code>2024-01-15</Code></Small>
|
|
223
|
+
</CardContent>
|
|
224
|
+
</Card>
|
|
225
|
+
|
|
226
|
+
// Form labels and descriptions
|
|
227
|
+
<Label>
|
|
228
|
+
<Strong>Field Label</Strong>
|
|
229
|
+
</Label>
|
|
230
|
+
<Small color="muted">Field description text</Small>
|
|
231
|
+
|
|
232
|
+
// Navigation and UI text
|
|
233
|
+
<Button>
|
|
234
|
+
<Span>Button Text</Span>
|
|
235
|
+
</Button>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
#### Color Variants
|
|
239
|
+
- `color="default"` - Standard text color
|
|
240
|
+
- `color="muted"` - Subdued text for secondary info
|
|
241
|
+
- `color="accent"` - Emphasis and highlights
|
|
242
|
+
- `color="destructive"` - Error messages
|
|
243
|
+
- `color="success"` - Success messages
|
|
244
|
+
|
|
245
|
+
#### When to Use Each Component
|
|
246
|
+
- **H1-H6**: Page/section headings (semantic hierarchy)
|
|
247
|
+
- **P**: Body paragraphs and main content
|
|
248
|
+
- **Span**: Inline text within other components
|
|
249
|
+
- **Code**: Inline code, values, technical terms
|
|
250
|
+
- **Small**: Timestamps, captions, fine print
|
|
251
|
+
- **Strong**: Bold emphasis within text
|
|
252
|
+
- **Lead**: Large introductory paragraphs
|
|
253
|
+
- **A**: All clickable text links
|
|
254
|
+
- **Blockquote**: Quoted content
|
|
255
|
+
- **Typography**: ⚠️ Last resort only - when there's no semantic component for the type of content you want to display (semantic components already handle all styling variants)
|
|
86
256
|
|
|
87
257
|
## Utilities & Hooks → [docs/llm/components/utilities.md](docs/llm/components/utilities.md)
|
|
88
258
|
- **cn()** - Class name merging with Tailwind conflict resolution
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neynar/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Neynar Inc.",
|
|
6
6
|
"description": "React UI component library built on shadcn/ui and Tailwind CSS",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"lint": "eslint src/",
|
|
36
36
|
"type-check": "tsc --noEmit",
|
|
37
37
|
"clean": "rm -rf dist",
|
|
38
|
+
"docs:generate": "tsx scripts/llm-tsdoc-generator/index.ts llm-tsdoc-generator.config.json",
|
|
38
39
|
"storybook": "storybook dev --no-open -p 6006",
|
|
39
40
|
"build-storybook": "storybook build"
|
|
40
41
|
},
|
|
@@ -94,7 +95,9 @@
|
|
|
94
95
|
"react-dom": "19.1.1",
|
|
95
96
|
"storybook": "9.1.2",
|
|
96
97
|
"tailwindcss": "4.1.11",
|
|
97
|
-
"
|
|
98
|
+
"ts-morph": "^26.0.0",
|
|
99
|
+
"tsx": "^4.20.5",
|
|
100
|
+
"typescript": "^5.9.2",
|
|
98
101
|
"vite": "7.1.2"
|
|
99
102
|
},
|
|
100
103
|
"peerDependencies": {
|
|
@@ -4,6 +4,115 @@ import { ChevronDownIcon } from "lucide-react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Props for single-item accordion behavior (Documentation only - NOT used in component implementation)
|
|
9
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
10
|
+
*/
|
|
11
|
+
type AccordionSingleDocsProps = {
|
|
12
|
+
/** Accordion type that allows only one item to be open at a time */
|
|
13
|
+
type: "single";
|
|
14
|
+
/** Currently open item value (controlled) */
|
|
15
|
+
value?: string;
|
|
16
|
+
/** Initial open item value (uncontrolled) */
|
|
17
|
+
defaultValue?: string;
|
|
18
|
+
/** Callback fired when the open item changes */
|
|
19
|
+
onValueChange?: (value: string) => void;
|
|
20
|
+
/** Whether the open item can be collapsed by clicking it again */
|
|
21
|
+
collapsible?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Props for multiple-item accordion behavior (Documentation only - NOT used in component implementation)
|
|
26
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
27
|
+
*/
|
|
28
|
+
type AccordionMultipleDocsProps = {
|
|
29
|
+
/** Accordion type that allows multiple items to be open simultaneously */
|
|
30
|
+
type: "multiple";
|
|
31
|
+
/** Currently open item values (controlled) */
|
|
32
|
+
value?: string[];
|
|
33
|
+
/** Initial open item values (uncontrolled) */
|
|
34
|
+
defaultValue?: string[];
|
|
35
|
+
/** Callback fired when the open items change */
|
|
36
|
+
onValueChange?: (value: string[]) => void;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Base props shared by all accordion types (Documentation only - NOT used in component implementation)
|
|
41
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
42
|
+
*/
|
|
43
|
+
type AccordionBaseDocsProps = {
|
|
44
|
+
/** Whether the entire accordion is disabled */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Layout orientation for the accordion */
|
|
47
|
+
orientation?: "horizontal" | "vertical";
|
|
48
|
+
/** Text direction for internationalization */
|
|
49
|
+
dir?: "ltr" | "rtl";
|
|
50
|
+
/** Additional CSS classes for styling */
|
|
51
|
+
className?: string;
|
|
52
|
+
/** Child AccordionItem components */
|
|
53
|
+
children?: React.ReactNode;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Complete props for the Accordion component (Documentation only - NOT used in component implementation)
|
|
58
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
59
|
+
*/
|
|
60
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
61
|
+
type AccordionDocsProps = (
|
|
62
|
+
| AccordionSingleDocsProps
|
|
63
|
+
| AccordionMultipleDocsProps
|
|
64
|
+
) &
|
|
65
|
+
AccordionBaseDocsProps;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Props for AccordionItem component (Documentation only - NOT used in component implementation)
|
|
69
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
70
|
+
*/
|
|
71
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
72
|
+
type AccordionItemDocsProps = {
|
|
73
|
+
/** Unique identifier for this accordion item (required) */
|
|
74
|
+
value: string;
|
|
75
|
+
/** Whether this specific accordion item is disabled */
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/** Additional CSS classes for custom styling */
|
|
78
|
+
className?: string;
|
|
79
|
+
/** Child components (AccordionTrigger and AccordionContent) */
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
} & Omit<
|
|
82
|
+
React.HTMLAttributes<HTMLDivElement>,
|
|
83
|
+
"value" | "disabled" | "children"
|
|
84
|
+
>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Props for AccordionTrigger component (Documentation only - NOT used in component implementation)
|
|
88
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
89
|
+
*/
|
|
90
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
91
|
+
type AccordionTriggerDocsProps = {
|
|
92
|
+
/** Additional CSS classes for custom styling */
|
|
93
|
+
className?: string;
|
|
94
|
+
/** Content to display in the trigger (text, icons, or components) */
|
|
95
|
+
children?: React.ReactNode;
|
|
96
|
+
/** Whether the trigger interaction is disabled */
|
|
97
|
+
disabled?: boolean;
|
|
98
|
+
/** Render the trigger as its child element when true */
|
|
99
|
+
asChild?: boolean;
|
|
100
|
+
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children">;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Props for AccordionContent component (Documentation only - NOT used in component implementation)
|
|
104
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
105
|
+
*/
|
|
106
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
107
|
+
type AccordionContentDocsProps = {
|
|
108
|
+
/** Additional CSS classes for custom styling (applied to inner div) */
|
|
109
|
+
className?: string;
|
|
110
|
+
/** Any React content to display when expanded */
|
|
111
|
+
children?: React.ReactNode;
|
|
112
|
+
/** Forces content to remain mounted when collapsed (useful for animations) */
|
|
113
|
+
forceMount?: true;
|
|
114
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children">;
|
|
115
|
+
|
|
7
116
|
/**
|
|
8
117
|
* Accordion - Collapsible content panels for organizing information
|
|
9
118
|
*
|
|
@@ -52,16 +161,6 @@ import { cn } from "@/lib/utils";
|
|
|
52
161
|
* </Accordion>
|
|
53
162
|
* ```
|
|
54
163
|
*
|
|
55
|
-
* @param type - "single" allows one item open, "multiple" allows multiple items open
|
|
56
|
-
* @param collapsible - When type="single", allows closing the open item (optional)
|
|
57
|
-
* @param defaultValue - Initial value(s) for open items
|
|
58
|
-
* @param value - Controlled value(s) for open items
|
|
59
|
-
* @param onValueChange - Callback when accordion state changes
|
|
60
|
-
* @param className - Additional CSS classes for styling
|
|
61
|
-
* @param orientation - "horizontal" or "vertical" (default: "vertical")
|
|
62
|
-
* @param dir - Text direction "ltr" or "rtl" for internationalization
|
|
63
|
-
* @param disabled - Disables all accordion interactions
|
|
64
|
-
*
|
|
65
164
|
* @accessibility
|
|
66
165
|
* - Full keyboard navigation support (Arrow keys, Space, Enter, Home, End)
|
|
67
166
|
* - ARIA expanded/collapsed states automatically managed
|
|
@@ -77,9 +176,9 @@ import { cn } from "@/lib/utils";
|
|
|
77
176
|
* @see {@link AccordionContent} Collapsible content area with smooth animations
|
|
78
177
|
* @since 1.0.0
|
|
79
178
|
*/
|
|
80
|
-
function Accordion(
|
|
81
|
-
|
|
82
|
-
|
|
179
|
+
function Accordion(
|
|
180
|
+
props: React.ComponentProps<typeof AccordionPrimitive.Root>,
|
|
181
|
+
) {
|
|
83
182
|
return <AccordionPrimitive.Root data-slot="accordion" {...props} />;
|
|
84
183
|
}
|
|
85
184
|
|
|
@@ -109,11 +208,6 @@ function Accordion({
|
|
|
109
208
|
* </AccordionItem>
|
|
110
209
|
* ```
|
|
111
210
|
*
|
|
112
|
-
* @param value - Unique identifier for this accordion item (required)
|
|
113
|
-
* @param className - Additional CSS classes for custom styling
|
|
114
|
-
* @param disabled - Disables this specific accordion item
|
|
115
|
-
* @param children - Should contain AccordionTrigger and AccordionContent
|
|
116
|
-
*
|
|
117
211
|
* @accessibility
|
|
118
212
|
* - Manages expanded/collapsed state via ARIA attributes
|
|
119
213
|
* - Associates trigger with content using aria-controls and aria-labelledby
|
|
@@ -171,11 +265,6 @@ function AccordionItem({
|
|
|
171
265
|
* </AccordionTrigger>
|
|
172
266
|
* ```
|
|
173
267
|
*
|
|
174
|
-
* @param className - Additional CSS classes for custom styling
|
|
175
|
-
* @param children - Content to display in the trigger (text, icons, or components)
|
|
176
|
-
* @param disabled - Disables the trigger interaction
|
|
177
|
-
* @param asChild - Renders the trigger as its child element when true
|
|
178
|
-
*
|
|
179
268
|
* @accessibility
|
|
180
269
|
* - Keyboard activated with Space, Enter, or Arrow keys
|
|
181
270
|
* - aria-expanded automatically indicates current expanded/collapsed state
|
|
@@ -247,10 +336,6 @@ function AccordionTrigger({
|
|
|
247
336
|
* </AccordionContent>
|
|
248
337
|
* ```
|
|
249
338
|
*
|
|
250
|
-
* @param className - Additional CSS classes for custom styling (applied to inner div)
|
|
251
|
-
* @param children - Any React content to display when expanded
|
|
252
|
-
* @param forceMount - Forces content to remain mounted when collapsed (for animations)
|
|
253
|
-
*
|
|
254
339
|
* @accessibility
|
|
255
340
|
* - Hidden content is not focusable or accessible when collapsed
|
|
256
341
|
* - Smooth height animations enhance user experience without motion issues
|