@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.
Files changed (173) hide show
  1. package/dist/components/ui/accordion.d.ts +1 -25
  2. package/dist/components/ui/accordion.d.ts.map +1 -1
  3. package/dist/components/ui/alert-dialog.d.ts +240 -46
  4. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  5. package/dist/components/ui/alert.d.ts +73 -11
  6. package/dist/components/ui/alert.d.ts.map +1 -1
  7. package/dist/components/ui/aspect-ratio.d.ts +44 -10
  8. package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
  9. package/dist/components/ui/avatar.d.ts +117 -33
  10. package/dist/components/ui/avatar.d.ts.map +1 -1
  11. package/dist/components/ui/badge.d.ts +50 -71
  12. package/dist/components/ui/badge.d.ts.map +1 -1
  13. package/dist/components/ui/breadcrumb.d.ts +231 -49
  14. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  15. package/dist/components/ui/button.d.ts +189 -71
  16. package/dist/components/ui/button.d.ts.map +1 -1
  17. package/dist/components/ui/calendar.d.ts +197 -40
  18. package/dist/components/ui/calendar.d.ts.map +1 -1
  19. package/dist/components/ui/card.d.ts +7 -22
  20. package/dist/components/ui/card.d.ts.map +1 -1
  21. package/dist/components/ui/carousel.d.ts +369 -99
  22. package/dist/components/ui/carousel.d.ts.map +1 -1
  23. package/dist/components/ui/chart.d.ts.map +1 -1
  24. package/dist/components/ui/checkbox.d.ts +110 -38
  25. package/dist/components/ui/checkbox.d.ts.map +1 -1
  26. package/dist/components/ui/collapsible.d.ts +246 -61
  27. package/dist/components/ui/collapsible.d.ts.map +1 -1
  28. package/dist/components/ui/combobox.d.ts +207 -159
  29. package/dist/components/ui/combobox.d.ts.map +1 -1
  30. package/dist/components/ui/command.d.ts +336 -67
  31. package/dist/components/ui/command.d.ts.map +1 -1
  32. package/dist/components/ui/container.d.ts +159 -64
  33. package/dist/components/ui/container.d.ts.map +1 -1
  34. package/dist/components/ui/context-menu.d.ts +321 -39
  35. package/dist/components/ui/context-menu.d.ts.map +1 -1
  36. package/dist/components/ui/date-picker.d.ts +113 -86
  37. package/dist/components/ui/date-picker.d.ts.map +1 -1
  38. package/dist/components/ui/dialog.d.ts +106 -25
  39. package/dist/components/ui/dialog.d.ts.map +1 -1
  40. package/dist/components/ui/drawer.d.ts +388 -59
  41. package/dist/components/ui/drawer.d.ts.map +1 -1
  42. package/dist/components/ui/dropdown-menu.d.ts +521 -74
  43. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  44. package/dist/components/ui/empty-state.d.ts +148 -76
  45. package/dist/components/ui/empty-state.d.ts.map +1 -1
  46. package/dist/components/ui/hover-card.d.ts +253 -34
  47. package/dist/components/ui/hover-card.d.ts.map +1 -1
  48. package/dist/components/ui/input.d.ts +143 -44
  49. package/dist/components/ui/input.d.ts.map +1 -1
  50. package/dist/components/ui/label.d.ts +0 -8
  51. package/dist/components/ui/label.d.ts.map +1 -1
  52. package/dist/components/ui/menubar.d.ts +288 -46
  53. package/dist/components/ui/menubar.d.ts.map +1 -1
  54. package/dist/components/ui/navigation-menu.d.ts +444 -127
  55. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  56. package/dist/components/ui/pagination.d.ts +342 -66
  57. package/dist/components/ui/pagination.d.ts.map +1 -1
  58. package/dist/components/ui/popover.d.ts +0 -8
  59. package/dist/components/ui/popover.d.ts.map +1 -1
  60. package/dist/components/ui/progress.d.ts +88 -30
  61. package/dist/components/ui/progress.d.ts.map +1 -1
  62. package/dist/components/ui/radio-group.d.ts +189 -45
  63. package/dist/components/ui/radio-group.d.ts.map +1 -1
  64. package/dist/components/ui/resizable.d.ts +178 -62
  65. package/dist/components/ui/resizable.d.ts.map +1 -1
  66. package/dist/components/ui/scroll-area.d.ts +180 -21
  67. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  68. package/dist/components/ui/select.d.ts +382 -60
  69. package/dist/components/ui/select.d.ts.map +1 -1
  70. package/dist/components/ui/separator.d.ts +52 -39
  71. package/dist/components/ui/separator.d.ts.map +1 -1
  72. package/dist/components/ui/sheet.d.ts +144 -27
  73. package/dist/components/ui/sheet.d.ts.map +1 -1
  74. package/dist/components/ui/sidebar.d.ts +81 -31
  75. package/dist/components/ui/sidebar.d.ts.map +1 -1
  76. package/dist/components/ui/skeleton.d.ts +94 -32
  77. package/dist/components/ui/skeleton.d.ts.map +1 -1
  78. package/dist/components/ui/slider.d.ts +37 -31
  79. package/dist/components/ui/slider.d.ts.map +1 -1
  80. package/dist/components/ui/sonner.d.ts +280 -46
  81. package/dist/components/ui/sonner.d.ts.map +1 -1
  82. package/dist/components/ui/stack.d.ts +289 -148
  83. package/dist/components/ui/stack.d.ts.map +1 -1
  84. package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
  85. package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
  86. package/dist/components/ui/stories/container.stories.d.ts +2 -3
  87. package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
  88. package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
  89. package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
  90. package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
  91. package/dist/components/ui/stories/stack.stories.d.ts +1 -1
  92. package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
  93. package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
  94. package/dist/components/ui/switch.d.ts +44 -38
  95. package/dist/components/ui/switch.d.ts.map +1 -1
  96. package/dist/components/ui/table.d.ts +33 -0
  97. package/dist/components/ui/table.d.ts.map +1 -1
  98. package/dist/components/ui/tabs.d.ts +4 -22
  99. package/dist/components/ui/tabs.d.ts.map +1 -1
  100. package/dist/components/ui/text-field.d.ts +170 -84
  101. package/dist/components/ui/text-field.d.ts.map +1 -1
  102. package/dist/components/ui/textarea.d.ts +106 -29
  103. package/dist/components/ui/textarea.d.ts.map +1 -1
  104. package/dist/components/ui/theme-toggle.d.ts +190 -65
  105. package/dist/components/ui/theme-toggle.d.ts.map +1 -1
  106. package/dist/components/ui/theme.d.ts +107 -23
  107. package/dist/components/ui/theme.d.ts.map +1 -1
  108. package/dist/components/ui/toggle-group.d.ts +143 -67
  109. package/dist/components/ui/toggle-group.d.ts.map +1 -1
  110. package/dist/components/ui/toggle.d.ts +118 -30
  111. package/dist/components/ui/toggle.d.ts.map +1 -1
  112. package/dist/components/ui/tooltip.d.ts +152 -28
  113. package/dist/components/ui/tooltip.d.ts.map +1 -1
  114. package/dist/components/ui/typography.d.ts +452 -134
  115. package/dist/components/ui/typography.d.ts.map +1 -1
  116. package/dist/index.js +9388 -8281
  117. package/dist/index.js.map +1 -1
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/llms.txt +173 -3
  120. package/package.json +5 -2
  121. package/src/components/ui/accordion.tsx +112 -27
  122. package/src/components/ui/alert-dialog.tsx +401 -46
  123. package/src/components/ui/alert.tsx +114 -11
  124. package/src/components/ui/aspect-ratio.tsx +69 -14
  125. package/src/components/ui/avatar.tsx +179 -33
  126. package/src/components/ui/badge.tsx +74 -75
  127. package/src/components/ui/breadcrumb.tsx +335 -50
  128. package/src/components/ui/button.tsx +198 -90
  129. package/src/components/ui/calendar.tsx +867 -43
  130. package/src/components/ui/card.tsx +140 -33
  131. package/src/components/ui/carousel.tsx +529 -98
  132. package/src/components/ui/chart.tsx +222 -1
  133. package/src/components/ui/checkbox.tsx +176 -38
  134. package/src/components/ui/collapsible.tsx +321 -67
  135. package/src/components/ui/combobox.tsx +284 -83
  136. package/src/components/ui/command.tsx +527 -67
  137. package/src/components/ui/container.tsx +217 -65
  138. package/src/components/ui/context-menu.tsx +716 -51
  139. package/src/components/ui/date-picker.tsx +228 -38
  140. package/src/components/ui/dialog.tsx +270 -33
  141. package/src/components/ui/drawer.tsx +546 -67
  142. package/src/components/ui/dropdown-menu.tsx +657 -74
  143. package/src/components/ui/empty-state.tsx +241 -82
  144. package/src/components/ui/hover-card.tsx +328 -39
  145. package/src/components/ui/input.tsx +207 -44
  146. package/src/components/ui/label.tsx +98 -8
  147. package/src/components/ui/menubar.tsx +587 -54
  148. package/src/components/ui/navigation-menu.tsx +557 -128
  149. package/src/components/ui/pagination.tsx +561 -79
  150. package/src/components/ui/popover.tsx +119 -8
  151. package/src/components/ui/progress.tsx +131 -29
  152. package/src/components/ui/radio-group.tsx +260 -51
  153. package/src/components/ui/resizable.tsx +289 -63
  154. package/src/components/ui/scroll-area.tsx +377 -66
  155. package/src/components/ui/select.tsx +545 -60
  156. package/src/components/ui/separator.tsx +146 -40
  157. package/src/components/ui/sheet.tsx +348 -31
  158. package/src/components/ui/sidebar.tsx +471 -29
  159. package/src/components/ui/skeleton.tsx +114 -32
  160. package/src/components/ui/slider.tsx +77 -31
  161. package/src/components/ui/sonner.tsx +574 -46
  162. package/src/components/ui/stack.tsx +423 -101
  163. package/src/components/ui/switch.tsx +78 -39
  164. package/src/components/ui/table.tsx +170 -4
  165. package/src/components/ui/tabs.tsx +108 -22
  166. package/src/components/ui/text-field.tsx +226 -81
  167. package/src/components/ui/textarea.tsx +180 -29
  168. package/src/components/ui/theme-toggle.tsx +313 -65
  169. package/src/components/ui/theme.tsx +117 -23
  170. package/src/components/ui/toggle-group.tsx +280 -69
  171. package/src/components/ui/toggle.tsx +124 -35
  172. package/src/components/ui/tooltip.tsx +239 -29
  173. package/src/components/ui/typography.tsx +1115 -165
@@ -2,58 +2,158 @@ import * as React from "react";
2
2
  import { cn } from "@/lib/utils";
3
3
 
4
4
  /**
5
- * Props for the Stack component
5
+ * Spacing options for Stack component using Tailwind CSS spacing scale
6
6
  *
7
- * @public
7
+ * Maps to Tailwind spacing utilities:
8
+ * - 1 = 0.25rem (4px) - Ultra-tight spacing for dense layouts
9
+ * - 2 = 0.5rem (8px) - Tight spacing for compact components
10
+ * - 3 = 0.75rem (12px) - Close spacing for related items
11
+ * - 4 = 1rem (16px) - Default spacing for general layouts
12
+ * - 6 = 1.5rem (24px) - Loose spacing for section separation
13
+ * - 8 = 2rem (32px) - Wide spacing for distinct content areas
14
+ * - 12 = 3rem (48px) - Extra-wide spacing for major layout divisions
15
+ */
16
+ type StackSpacing = 1 | 2 | 3 | 4 | 6 | 8 | 12;
17
+
18
+ /**
19
+ * Layout direction options for Stack component
20
+ *
21
+ * - "vertical" - Flex column layout with space-y-* utilities
22
+ * - "horizontal" - Flex row layout with space-x-* utilities
8
23
  */
9
- export type StackProps = React.HTMLAttributes<HTMLDivElement> & {
24
+ type StackDirection = "vertical" | "horizontal";
25
+
26
+ /**
27
+ * Props for Stack (Documentation only - NOT used in component implementation)
28
+ *
29
+ * Extends standard HTML div attributes for flexible layout containers.
30
+ * Stack provides consistent spacing between child elements in either
31
+ * vertical or horizontal direction using Tailwind's spacing scale.
32
+ *
33
+ * Inherits all standard HTML div props including:
34
+ * - className: Additional CSS classes for custom styling
35
+ * - id: Element identifier for targeting and accessibility
36
+ * - role: ARIA role for semantic meaning
37
+ * - tabIndex: Tab order control for keyboard navigation
38
+ * - onClick, onKeyDown, etc.: Standard event handlers
39
+ * - data-*: Custom data attributes
40
+ * - aria-*: Accessibility attributes
41
+ */
42
+ // eslint-disable-next-line unused-imports/no-unused-vars
43
+ type StackDocsProps = React.HTMLAttributes<HTMLDivElement> & {
10
44
  /**
11
45
  * The spacing between stack items using Tailwind CSS spacing scale
12
46
  *
13
47
  * Controls the gap between child elements using Tailwind's space utilities.
14
- * Each value corresponds to a Tailwind spacing unit (1 = 0.25rem, 4 = 1rem, etc.)
48
+ * Each value corresponds to a Tailwind spacing unit mapped to consistent
49
+ * rem values for predictable visual hierarchy.
50
+ *
51
+ * **Spacing Guidelines:**
52
+ * - Use `1-2` for tightly related items (button groups, form fields)
53
+ * - Use `3-4` for standard component spacing (default recommended)
54
+ * - Use `6-8` for section separation and content areas
55
+ * - Use `12` for major layout divisions and page sections
56
+ *
57
+ * **Technical Details:**
58
+ * - Uses `space-y-*` utilities for vertical stacks
59
+ * - Uses `space-x-*` utilities for horizontal stacks
60
+ * - Applies margin to all children except the first
61
+ * - Compatible with Tailwind's JIT compilation
15
62
  *
16
63
  * @defaultValue 4
17
64
  * @example
18
65
  * ```tsx
19
- * // Tight spacing for compact layouts
66
+ * // Ultra-tight spacing for button groups
67
+ * <Stack spacing={1} direction="horizontal">
68
+ * <Button size="sm">Edit</Button>
69
+ * <Button size="sm" variant="outline">Delete</Button>
70
+ * </Stack>
71
+ *
72
+ * // Tight spacing for form fields
20
73
  * <Stack spacing={2}>
21
- * <Button>Save</Button>
22
- * <Button>Cancel</Button>
74
+ * <Label htmlFor="email">Email</Label>
75
+ * <Input id="email" type="email" />
76
+ * <Input type="password" placeholder="Password" />
23
77
  * </Stack>
24
78
  *
25
- * // Generous spacing for section separation
79
+ * // Standard spacing for content sections (default)
80
+ * <Stack spacing={4}>
81
+ * <Card>User Profile</Card>
82
+ * <Card>Account Settings</Card>
83
+ * <Card>Privacy Controls</Card>
84
+ * </Stack>
85
+ *
86
+ * // Generous spacing for major page sections
26
87
  * <Stack spacing={8}>
27
- * <section>First section</section>
28
- * <section>Second section</section>
88
+ * <header>Page Header</header>
89
+ * <main>Main Content</main>
90
+ * <footer>Page Footer</footer>
29
91
  * </Stack>
30
92
  * ```
31
93
  */
32
- spacing?: 1 | 2 | 3 | 4 | 6 | 8 | 12;
94
+ spacing?: StackSpacing;
33
95
 
34
96
  /**
35
97
  * The layout direction of the stack
36
98
  *
37
- * - `"vertical"` - Arranges children in a column with vertical spacing
38
- * - `"horizontal"` - Arranges children in a row with horizontal spacing
99
+ * **Vertical Direction (default):**
100
+ * - Uses `flex flex-col` for column layout
101
+ * - Applies `space-y-*` utilities for vertical spacing
102
+ * - Ideal for forms, content sections, navigation lists
103
+ * - Maintains natural document flow for screen readers
104
+ *
105
+ * **Horizontal Direction:**
106
+ * - Uses `flex flex-row` for row layout
107
+ * - Applies `space-x-*` utilities for horizontal spacing
108
+ * - Perfect for button groups, navigation bars, toolbars
109
+ * - Consider using `flex-wrap` class for responsive layouts
110
+ *
111
+ * **Responsive Considerations:**
112
+ * - Can be combined with responsive classes for adaptive layouts
113
+ * - Consider switching from horizontal to vertical on smaller screens
114
+ * - Use additional Tailwind classes for overflow handling
39
115
  *
40
116
  * @defaultValue "vertical"
41
117
  * @example
42
118
  * ```tsx
43
- * // Vertical stack (default)
119
+ * // Vertical stack for content hierarchy (default)
44
120
  * <Stack>
45
- * <Card>Item 1</Card>
46
- * <Card>Item 2</Card>
121
+ * <h2>Section Title</h2>
122
+ * <p>Section description text</p>
123
+ * <Card>Card content</Card>
124
+ * <Card>Another card</Card>
47
125
  * </Stack>
48
126
  *
49
127
  * // Horizontal stack for action buttons
50
- * <Stack direction="horizontal">
51
- * <Button>Primary</Button>
128
+ * <Stack direction="horizontal" spacing={3}>
129
+ * <Button>Primary Action</Button>
52
130
  * <Button variant="outline">Secondary</Button>
131
+ * <Button variant="ghost">Tertiary</Button>
132
+ * </Stack>
133
+ *
134
+ * // Responsive horizontal to vertical stack
135
+ * <Stack
136
+ * direction="horizontal"
137
+ * spacing={2}
138
+ * className="flex-col sm:flex-row"
139
+ * >
140
+ * <Button className="w-full sm:w-auto">Mobile Full Width</Button>
141
+ * <Button variant="outline" className="w-full sm:w-auto">Desktop Inline</Button>
142
+ * </Stack>
143
+ *
144
+ * // Horizontal navigation with overflow scroll
145
+ * <Stack
146
+ * direction="horizontal"
147
+ * spacing={1}
148
+ * className="overflow-x-auto pb-2"
149
+ * >
150
+ * <Badge variant="secondary">Tag 1</Badge>
151
+ * <Badge variant="secondary">Tag 2</Badge>
152
+ * <Badge variant="secondary">Long Tag Name</Badge>
53
153
  * </Stack>
54
154
  * ```
55
155
  */
56
- direction?: "vertical" | "horizontal";
156
+ direction?: StackDirection;
57
157
  };
58
158
 
59
159
  /**
@@ -61,119 +161,341 @@ export type StackProps = React.HTMLAttributes<HTMLDivElement> & {
61
161
  *
62
162
  * Stack is a fundamental layout primitive that arranges child elements in either
63
163
  * vertical or horizontal direction with consistent spacing. Built on flexbox principles,
64
- * it provides a clean API for common layout patterns without requiring custom CSS.
164
+ * it provides a clean, declarative API for common layout patterns without requiring
165
+ * custom CSS or complex flex configurations.
65
166
  *
66
- * This component is particularly useful for:
167
+ * **Core Features:**
168
+ * - Consistent spacing using Tailwind's design system
169
+ * - Flexible direction control (vertical/horizontal)
170
+ * - Zero-config flexbox layouts with predictable behavior
171
+ * - Composable with other UI components and layout utilities
172
+ * - Full accessibility support with semantic HTML structure
173
+ * - TypeScript-first with comprehensive prop validation
174
+ *
175
+ * **Common Use Cases:**
67
176
  * - Form layouts with consistent field spacing
68
177
  * - Button groups and action bars
69
178
  * - Content sections with uniform gaps
70
- * - Navigation lists and menus
71
- * - Card layouts and content grids
179
+ * - Navigation lists and menu structures
180
+ * - Card layouts and dashboard grids
181
+ * - Page sections and content hierarchy
182
+ * - Responsive component layouts
183
+ *
184
+ * **Design System Integration:**
185
+ * Stack integrates seamlessly with design systems by providing consistent
186
+ * spacing that aligns with Tailwind's spacing scale. This ensures visual
187
+ * harmony across your application and reduces the need for custom spacing
188
+ * utilities in most common layout scenarios.
72
189
  *
73
- * @example Basic vertical layout (default)
190
+ * @example Basic vertical content layout (default behavior)
74
191
  * ```tsx
75
192
  * <Stack>
76
- * <Card>Profile Information</Card>
77
- * <Card>Account Settings</Card>
78
- * <Card>Privacy Controls</Card>
193
+ * <h1>Dashboard</h1>
194
+ * <Card>
195
+ * <CardHeader>Profile Information</CardHeader>
196
+ * <CardContent>User profile details</CardContent>
197
+ * </Card>
198
+ * <Card>
199
+ * <CardHeader>Account Settings</CardHeader>
200
+ * <CardContent>Account configuration options</CardContent>
201
+ * </Card>
202
+ * <Card>
203
+ * <CardHeader>Privacy Controls</CardHeader>
204
+ * <CardContent>Privacy and security settings</CardContent>
205
+ * </Card>
79
206
  * </Stack>
80
207
  * ```
81
208
  *
82
- * @example Horizontal action bar
209
+ * @example Horizontal action button bar
83
210
  * ```tsx
84
- * <Stack direction="horizontal" spacing={3}>
85
- * <Button>Save Changes</Button>
86
- * <Button variant="outline">Cancel</Button>
87
- * <Button variant="ghost">Reset</Button>
211
+ * <Stack direction="horizontal" spacing={3} className="justify-end">
212
+ * <Button variant="ghost">Cancel</Button>
213
+ * <Button variant="outline">Save Draft</Button>
214
+ * <Button>Publish</Button>
88
215
  * </Stack>
89
216
  * ```
90
217
  *
91
- * @example Form sections with custom spacing
218
+ * @example Complex form layout with nested stacks
92
219
  * ```tsx
93
- * <Stack spacing={6}>
94
- * <fieldset>
95
- * <legend>Personal Information</legend>
96
- * <Stack spacing={3}>
97
- * <Input placeholder="Full Name" />
98
- * <Input placeholder="Email Address" />
99
- * </Stack>
100
- * </fieldset>
101
- * <fieldset>
102
- * <legend>Preferences</legend>
103
- * <Stack spacing={2}>
104
- * <Checkbox>Email notifications</Checkbox>
105
- * <Checkbox>Marketing updates</Checkbox>
220
+ * <form>
221
+ * <Stack spacing={6}>
222
+ * // Personal Information Section
223
+ * <fieldset>
224
+ * <legend className="text-lg font-semibold mb-4">Personal Information</legend>
225
+ * <Stack spacing={3}>
226
+ * <Stack spacing={1}>
227
+ * <Label htmlFor="fullName">Full Name</Label>
228
+ * <Input id="fullName" placeholder="Enter your full name" />
229
+ * </Stack>
230
+ * <Stack spacing={1}>
231
+ * <Label htmlFor="email">Email Address</Label>
232
+ * <Input id="email" type="email" placeholder="you@example.com" />
233
+ * </Stack>
234
+ * </Stack>
235
+ * </fieldset>
236
+ *
237
+ * // Preferences Section
238
+ * <fieldset>
239
+ * <legend className="text-lg font-semibold mb-4">Preferences</legend>
240
+ * <Stack spacing={2}>
241
+ * <div className="flex items-center space-x-2">
242
+ * <Checkbox id="emailNotifications" />
243
+ * <Label htmlFor="emailNotifications">Email notifications</Label>
244
+ * </div>
245
+ * <div className="flex items-center space-x-2">
246
+ * <Checkbox id="marketingUpdates" />
247
+ * <Label htmlFor="marketingUpdates">Marketing updates</Label>
248
+ * </div>
249
+ * </Stack>
250
+ * </fieldset>
251
+ *
252
+ * // Form Actions
253
+ * <Stack direction="horizontal" spacing={2} className="justify-end">
254
+ * <Button type="button" variant="outline">Reset</Button>
255
+ * <Button type="submit">Save Changes</Button>
106
256
  * </Stack>
107
- * </fieldset>
108
- * </Stack>
257
+ * </Stack>
258
+ * </form>
109
259
  * ```
110
260
  *
111
- * @example Responsive layout with additional styling
261
+ * @example Responsive navigation with adaptive direction
112
262
  * ```tsx
113
263
  * <Stack
114
- * spacing={4}
115
- * className="w-full max-w-md mx-auto p-6"
264
+ * direction="horizontal"
265
+ * spacing={1}
266
+ * className="flex-col sm:flex-row overflow-x-auto sm:overflow-visible"
116
267
  * >
117
- * <h2>User Dashboard</h2>
118
- * <Stack direction="horizontal" spacing={2} className="justify-between">
119
- * <Badge>Online</Badge>
120
- * <Button size="sm">Edit Profile</Button>
121
- * </Stack>
268
+ * <Button variant="ghost" className="w-full sm:w-auto">Dashboard</Button>
269
+ * <Button variant="ghost" className="w-full sm:w-auto">Analytics</Button>
270
+ * <Button variant="ghost" className="w-full sm:w-auto">Settings</Button>
271
+ * <Button variant="ghost" className="w-full sm:w-auto">Help</Button>
122
272
  * </Stack>
123
273
  * ```
124
274
  *
275
+ * @example Dashboard layout with mixed content types
276
+ * ```tsx
277
+ * <div className="container mx-auto p-6">
278
+ * <Stack spacing={8}>
279
+ * // Page Header
280
+ * <Stack spacing={2}>
281
+ * <h1 className="text-3xl font-bold">Analytics Dashboard</h1>
282
+ * <p className="text-muted-foreground">Overview of your application metrics</p>
283
+ * </Stack>
284
+ *
285
+ * // Stats Cards
286
+ * <Stack direction="horizontal" spacing={4} className="grid grid-cols-1 md:grid-cols-3 gap-4">
287
+ * <Card>
288
+ * <CardHeader>
289
+ * <CardTitle>Total Users</CardTitle>
290
+ * </CardHeader>
291
+ * <CardContent>
292
+ * <div className="text-2xl font-bold">2,543</div>
293
+ * </CardContent>
294
+ * </Card>
295
+ * <Card>
296
+ * <CardHeader>
297
+ * <CardTitle>Revenue</CardTitle>
298
+ * </CardHeader>
299
+ * <CardContent>
300
+ * <div className="text-2xl font-bold">$12,543</div>
301
+ * </CardContent>
302
+ * </Card>
303
+ * <Card>
304
+ * <CardHeader>
305
+ * <CardTitle>Growth</CardTitle>
306
+ * </CardHeader>
307
+ * <CardContent>
308
+ * <div className="text-2xl font-bold text-green-600">+12.5%</div>
309
+ * </CardContent>
310
+ * </Card>
311
+ * </Stack>
312
+ *
313
+ * // Content Sections
314
+ * <Stack spacing={6}>
315
+ * <Card>
316
+ * <CardHeader>
317
+ * <CardTitle>Recent Activity</CardTitle>
318
+ * </CardHeader>
319
+ * <CardContent>Activity timeline content</CardContent>
320
+ * </Card>
321
+ * <Card>
322
+ * <CardHeader>
323
+ * <CardTitle>Performance Metrics</CardTitle>
324
+ * </CardHeader>
325
+ * <CardContent>Charts and graphs</CardContent>
326
+ * </Card>
327
+ * </Stack>
328
+ * </Stack>
329
+ * </div>
330
+ * ```
331
+ *
332
+ * @example Advanced usage with custom styling and semantic elements
333
+ * ```tsx
334
+ * <article className="prose max-w-none">
335
+ * <Stack spacing={6}>
336
+ * <header>
337
+ * <Stack spacing={2}>
338
+ * <h1>The Future of Web Development</h1>
339
+ * <Stack direction="horizontal" spacing={4} className="text-sm text-muted-foreground">
340
+ * <time dateTime="2024-01-15">January 15, 2024</time>
341
+ * <address className="not-italic">By Jane Developer</address>
342
+ * <span>5 min read</span>
343
+ * </Stack>
344
+ * </Stack>
345
+ * </header>
346
+ *
347
+ * <main>
348
+ * <Stack spacing={4}>
349
+ * <p>Introduction paragraph with key concepts...</p>
350
+ * <section>
351
+ * <h2>Key Technologies</h2>
352
+ * <Stack spacing={3}>
353
+ * <p>Discussion of modern web technologies...</p>
354
+ * <ul>
355
+ * <li>React and component architecture</li>
356
+ * <li>Server-side rendering with Next.js</li>
357
+ * <li>Type-safe development with TypeScript</li>
358
+ * </ul>
359
+ * </Stack>
360
+ * </section>
361
+ * <section>
362
+ * <h2>Best Practices</h2>
363
+ * <p>Guidelines for effective development...</p>
364
+ * </section>
365
+ * </Stack>
366
+ * </main>
367
+ *
368
+ * <footer>
369
+ * <Stack direction="horizontal" spacing={2} className="justify-between items-center">
370
+ * <Stack direction="horizontal" spacing={1}>
371
+ * <Badge variant="secondary">React</Badge>
372
+ * <Badge variant="secondary">TypeScript</Badge>
373
+ * <Badge variant="secondary">Next.js</Badge>
374
+ * </Stack>
375
+ * <Stack direction="horizontal" spacing={2}>
376
+ * <Button variant="outline" size="sm">Share</Button>
377
+ * <Button variant="outline" size="sm">Save</Button>
378
+ * </Stack>
379
+ * </Stack>
380
+ * </footer>
381
+ * </Stack>
382
+ * </article>
383
+ * ```
384
+ *
125
385
  * @remarks
126
386
  * **Design Philosophy:**
127
- * - Follows the principle of consistent spacing throughout the UI
128
- * - Uses Tailwind's spacing scale for predictable sizing
129
- * - Composable with other layout components
130
- * - Maintains semantic HTML structure
131
- *
132
- * **Performance:**
133
- * - Lightweight wrapper around flexbox CSS
134
- * - No JavaScript overhead for layout calculations
135
- * - Leverages Tailwind's JIT compilation for minimal CSS
136
- *
137
- * **Accessibility:**
138
- * - Preserves natural document flow and reading order
139
- * - Compatible with screen readers and keyboard navigation
140
- * - Supports semantic HTML elements as children
141
- * - Does not interfere with focus management
387
+ * Stack follows the principle of consistent spacing throughout the UI, using Tailwind's
388
+ * carefully crafted spacing scale to create visual hierarchy and rhythm. The component
389
+ * prioritizes composability, allowing complex layouts to be built from simple, predictable
390
+ * building blocks while maintaining semantic HTML structure.
391
+ *
392
+ * **Technical Implementation:**
393
+ * - Uses CSS Flexbox for reliable cross-browser layout behavior
394
+ * - Leverages Tailwind's space-* utilities for optimal performance
395
+ * - Applies margins only to children (not first child) for clean edge handling
396
+ * - Compatible with Tailwind's JIT compilation for minimal bundle size
397
+ * - Supports all standard HTML div attributes for maximum flexibility
398
+ *
399
+ * **Performance Considerations:**
400
+ * - Zero JavaScript runtime overhead - pure CSS-based layout
401
+ * - Optimized for Tailwind's purging and JIT compilation
402
+ * - Efficient rendering with no layout calculation overhead
403
+ * - Scales well with large numbers of child elements
404
+ * - Memory-efficient with minimal DOM structure impact
405
+ *
406
+ * **Responsive Design Integration:**
407
+ * Stack works seamlessly with Tailwind's responsive utilities. You can easily
408
+ * create adaptive layouts that change direction, spacing, or additional styling
409
+ * based on screen size breakpoints.
410
+ *
411
+ * **Common Patterns:**
412
+ * - **Form Layouts**: Use nested stacks for sections, fields, and actions
413
+ * - **Content Hierarchies**: Vary spacing to create visual importance levels
414
+ * - **Component Composition**: Combine with Cards, Buttons, and other components
415
+ * - **Responsive Grids**: Use with CSS Grid classes for complex layouts
416
+ * - **Navigation Patterns**: Create horizontal and vertical navigation structures
417
+ *
418
+ * @accessibility
419
+ * **Keyboard Navigation:**
420
+ * - Preserves natural document flow and tab order
421
+ * - Does not interfere with focus management of child components
422
+ * - Maintains logical reading order for screen readers
423
+ * - Supports all standard keyboard navigation patterns
424
+ *
425
+ * **Screen Reader Support:**
426
+ * - Uses semantic HTML div element with no interference
427
+ * - Preserves natural content structure and hierarchy
428
+ * - Compatible with all ARIA attributes on child elements
429
+ * - Supports landmark roles when used with semantic HTML
430
+ * - Maintains proper heading structure and content relationships
431
+ *
432
+ * **ARIA Compatibility:**
433
+ * - Accepts all ARIA attributes for enhanced accessibility
434
+ * - Does not modify or interfere with child component ARIA properties
435
+ * - Supports role attributes for semantic meaning
436
+ * - Compatible with aria-label, aria-describedby, and other ARIA properties
437
+ *
438
+ * **Focus Management:**
439
+ * - Transparent to focus behavior - delegates to child components
440
+ * - Supports tabIndex for custom focus control when needed
441
+ * - Does not trap or redirect focus automatically
442
+ * - Maintains predictable focus flow in both directions
443
+ *
444
+ * @performance
445
+ * **Bundle Impact:**
446
+ * - Minimal JavaScript bundle size (primarily TypeScript types)
447
+ * - CSS-only layout solution with no runtime calculations
448
+ * - Leverages Tailwind's tree-shaking for optimal CSS output
449
+ * - No external dependencies beyond React and utility functions
450
+ *
451
+ * **Runtime Performance:**
452
+ * - Zero-cost abstraction over native flexbox
453
+ * - No re-renders triggered by prop changes (style-based)
454
+ * - Efficient DOM structure with single wrapper element
455
+ * - Compatible with React's concurrent features and optimizations
142
456
  *
143
457
  * @public
144
458
  * @since 1.0.0
459
+ * @see {@link Button} For action elements commonly used in horizontal stacks
460
+ * @see {@link Card} For content containers commonly arranged in stacks
145
461
  * @see {@link https://tailwindcss.com/docs/space} Tailwind CSS spacing utilities
462
+ * @see {@link https://tailwindcss.com/docs/flexbox-direction} Tailwind CSS flex direction
463
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout} MDN CSS Flexbox Guide
146
464
  */
147
- const Stack = React.forwardRef<HTMLDivElement, StackProps>(
148
- ({ className, spacing = 4, direction = "vertical", ...props }, ref) => {
149
- return (
150
- <div
151
- ref={ref}
152
- className={cn(
153
- direction === "vertical" ? "flex flex-col" : "flex flex-row",
154
- {
155
- "space-y-1": direction === "vertical" && spacing === 1,
156
- "space-y-2": direction === "vertical" && spacing === 2,
157
- "space-y-3": direction === "vertical" && spacing === 3,
158
- "space-y-4": direction === "vertical" && spacing === 4,
159
- "space-y-6": direction === "vertical" && spacing === 6,
160
- "space-y-8": direction === "vertical" && spacing === 8,
161
- "space-y-12": direction === "vertical" && spacing === 12,
162
- "space-x-1": direction === "horizontal" && spacing === 1,
163
- "space-x-2": direction === "horizontal" && spacing === 2,
164
- "space-x-3": direction === "horizontal" && spacing === 3,
165
- "space-x-4": direction === "horizontal" && spacing === 4,
166
- "space-x-6": direction === "horizontal" && spacing === 6,
167
- "space-x-8": direction === "horizontal" && spacing === 8,
168
- "space-x-12": direction === "horizontal" && spacing === 12,
169
- },
170
- className,
171
- )}
172
- {...props}
173
- />
174
- );
175
- },
176
- );
465
+ const Stack = React.forwardRef<
466
+ HTMLDivElement,
467
+ React.HTMLAttributes<HTMLDivElement> & {
468
+ spacing?: StackSpacing;
469
+ direction?: StackDirection;
470
+ }
471
+ >(({ className, spacing = 4, direction = "vertical", ...props }, ref) => {
472
+ return (
473
+ <div
474
+ ref={ref}
475
+ className={cn(
476
+ direction === "vertical" ? "flex flex-col" : "flex flex-row",
477
+ {
478
+ "space-y-1": direction === "vertical" && spacing === 1,
479
+ "space-y-2": direction === "vertical" && spacing === 2,
480
+ "space-y-3": direction === "vertical" && spacing === 3,
481
+ "space-y-4": direction === "vertical" && spacing === 4,
482
+ "space-y-6": direction === "vertical" && spacing === 6,
483
+ "space-y-8": direction === "vertical" && spacing === 8,
484
+ "space-y-12": direction === "vertical" && spacing === 12,
485
+ "space-x-1": direction === "horizontal" && spacing === 1,
486
+ "space-x-2": direction === "horizontal" && spacing === 2,
487
+ "space-x-3": direction === "horizontal" && spacing === 3,
488
+ "space-x-4": direction === "horizontal" && spacing === 4,
489
+ "space-x-6": direction === "horizontal" && spacing === 6,
490
+ "space-x-8": direction === "horizontal" && spacing === 8,
491
+ "space-x-12": direction === "horizontal" && spacing === 12,
492
+ },
493
+ className,
494
+ )}
495
+ {...props}
496
+ />
497
+ );
498
+ });
177
499
 
178
500
  Stack.displayName = "Stack";
179
501