@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
@@ -4,13 +4,86 @@ import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
4
4
  import { cn } from "@/lib/utils";
5
5
 
6
6
  /**
7
- * HoverCard component for previewing content available behind a link
7
+ * Props for HoverCard component (Documentation only - NOT used in component implementation)
8
+ * These types are for documentation generation and should not replace Radix inferred types
9
+ */
10
+ // eslint-disable-next-line unused-imports/no-unused-vars
11
+ type HoverCardDocsProps = {
12
+ /** Whether the hover card is initially open in uncontrolled mode */
13
+ defaultOpen?: boolean;
14
+ /** Controlled open state of the hover card */
15
+ open?: boolean;
16
+ /** Callback fired when the open state changes */
17
+ onValueChange?: (open: boolean) => void;
18
+ /** Delay in milliseconds before the hover card opens @default 700 */
19
+ openDelay?: number;
20
+ /** Delay in milliseconds before the hover card closes @default 300 */
21
+ closeDelay?: number;
22
+ /** Child components (HoverCardTrigger and HoverCardContent) */
23
+ children?: React.ReactNode;
24
+ } & React.ComponentProps<typeof HoverCardPrimitive.Root>;
25
+
26
+ /**
27
+ * Props for HoverCardTrigger component (Documentation only - NOT used in component implementation)
28
+ * These types are for documentation generation and should not replace Radix inferred types
29
+ */
30
+ // eslint-disable-next-line unused-imports/no-unused-vars
31
+ type HoverCardTriggerDocsProps = {
32
+ /** Render the trigger as its child element, merging props */
33
+ asChild?: boolean;
34
+ /** Child element that will trigger the hover card on hover */
35
+ children?: React.ReactNode;
36
+ /** Additional CSS classes for custom styling */
37
+ className?: string;
38
+ } & React.ComponentProps<typeof HoverCardPrimitive.Trigger>;
39
+
40
+ /**
41
+ * Props for HoverCardContent component (Documentation only - NOT used in component implementation)
42
+ * These types are for documentation generation and should not replace Radix inferred types
43
+ */
44
+ // eslint-disable-next-line unused-imports/no-unused-vars
45
+ type HoverCardContentDocsProps = {
46
+ /** Side of the trigger to position content @default "bottom" */
47
+ side?: "top" | "right" | "bottom" | "left";
48
+ /** Distance in pixels from the trigger @default 4 */
49
+ sideOffset?: number;
50
+ /** Alignment of content relative to trigger @default "center" */
51
+ align?: "start" | "center" | "end";
52
+ /** Offset in pixels along the alignment axis */
53
+ alignOffset?: number;
54
+ /** Whether to prevent collision with viewport boundaries @default true */
55
+ avoidCollisions?: boolean;
56
+ /** Boundary element for collision detection @default viewport */
57
+ collisionBoundary?: Element | null | Array<Element | null>;
58
+ /** Padding from the collision boundary @default 10 */
59
+ collisionPadding?:
60
+ | number
61
+ | Partial<Record<"top" | "right" | "bottom" | "left", number>>;
62
+ /** Whether the content should stick to the viewport when overflowing @default "partial" */
63
+ sticky?: "partial" | "always";
64
+ /** Whether to hide the content when trigger becomes fully occluded @default false */
65
+ hideWhenDetached?: boolean;
66
+ /** Force content to stay mounted even when closed (for animations) */
67
+ forceMount?: true;
68
+ /** Render content as its child element */
69
+ asChild?: boolean;
70
+ /** Additional CSS classes for custom styling */
71
+ className?: string;
72
+ /** Content to display in the hover card */
73
+ children?: React.ReactNode;
74
+ } & React.ComponentProps<typeof HoverCardPrimitive.Content>;
75
+
76
+ /**
77
+ * HoverCard - Preview content that appears on hover for rich contextual information
8
78
  *
9
- * For sighted users to preview content available behind a link. Displays rich content
10
- * when users hover over a trigger element. Ideal for showing previews, user profiles,
11
- * repository information, or contextual details without requiring navigation.
79
+ * A floating card component that reveals rich content when users hover over a trigger element.
80
+ * Designed specifically for sighted users to preview content available behind links without
81
+ * requiring navigation. Built on Radix UI primitives with smooth animations and intelligent
82
+ * positioning to avoid viewport boundaries.
12
83
  *
13
- * Built on Radix UI Hover Card primitive with custom styling and animations.
84
+ * Perfect for user profiles, repository information, link previews, tooltips with complex
85
+ * content, and any contextual details that enhance the user experience without interrupting
86
+ * their current workflow.
14
87
  *
15
88
  * @example
16
89
  * ```tsx
@@ -54,70 +127,286 @@ import { cn } from "@/lib/utils";
54
127
  *
55
128
  * @example
56
129
  * ```tsx
57
- * // Interactive content
130
+ * // Interactive hover card with buttons
58
131
  * <HoverCard>
59
132
  * <HoverCardTrigger asChild>
60
- * <Button>Settings</Button>
133
+ * <Button variant="ghost">Quick Actions</Button>
61
134
  * </HoverCardTrigger>
62
135
  * <HoverCardContent>
63
136
  * <div className="space-y-2">
64
- * <h4 className="font-semibold">Quick Actions</h4>
65
- * <Button size="sm">Manage Team</Button>
66
- * <Button size="sm">View Reports</Button>
137
+ * <h4 className="font-semibold">Available Actions</h4>
138
+ * <div className="flex flex-col gap-1">
139
+ * <Button size="sm" variant="ghost">Edit Profile</Button>
140
+ * <Button size="sm" variant="ghost">View Analytics</Button>
141
+ * <Button size="sm" variant="ghost">Manage Settings</Button>
142
+ * </div>
143
+ * </div>
144
+ * </HoverCardContent>
145
+ * </HoverCard>
146
+ * ```
147
+ *
148
+ * @example
149
+ * ```tsx
150
+ * // Link preview with rich content
151
+ * <HoverCard openDelay={300}>
152
+ * <HoverCardTrigger asChild>
153
+ * <a href="/article/123" className="text-blue-600 hover:underline">
154
+ * Advanced React Patterns
155
+ * </a>
156
+ * </HoverCardTrigger>
157
+ * <HoverCardContent className="w-96">
158
+ * <div className="space-y-3">
159
+ * <img src="/article-thumbnail.jpg" className="rounded w-full h-32 object-cover" />
160
+ * <div>
161
+ * <h4 className="font-semibold">Advanced React Patterns</h4>
162
+ * <p className="text-sm text-muted-foreground">
163
+ * Learn modern React patterns including render props, compound components,
164
+ * and advanced hook compositions for scalable applications.
165
+ * </p>
166
+ * <div className="flex items-center gap-2 mt-2 text-xs text-muted-foreground">
167
+ * <span>12 min read</span>
168
+ * <span>•</span>
169
+ * <span>Published Mar 15, 2024</span>
170
+ * </div>
171
+ * </div>
67
172
  * </div>
68
173
  * </HoverCardContent>
69
174
  * </HoverCard>
70
175
  * ```
71
176
  *
72
177
  * @accessibility
73
- * **Important**: Hover cards are intended for sighted users only. The content will be
74
- * inaccessible to keyboard users. Consider providing alternative access methods.
178
+ * **Important Limitations**: Hover cards are intended for sighted users only and present
179
+ * significant accessibility challenges. The content is inaccessible to keyboard-only users
180
+ * and screen reader users who cannot hover. Consider these alternatives:
75
181
  *
76
- * - Opens on hover with configurable `openDelay`
77
- * - Stays open when hovering over content
78
- * - Closes with configurable `closeDelay`
79
- * - Auto-positions to avoid viewport overflow
80
- * - Supports focus-based interactions for some accessibility
182
+ * - Provide keyboard-accessible alternatives (buttons, modals, expanded sections)
183
+ * - Ensure all essential information is available through other means
184
+ * - Use hover cards only for supplementary, non-critical content
185
+ * - Consider implementing focus-based triggers for keyboard users
81
186
  *
82
- * @see {@link https://ui.shadcn.com/docs/components/hover-card} shadcn/ui documentation
187
+ * **Current Accessibility Features**:
188
+ * - Opens on mouse hover with configurable delay
189
+ * - Stays open when hovering over the content area
190
+ * - Closes automatically when mouse leaves with configurable delay
191
+ * - Intelligent positioning to avoid viewport overflow
192
+ * - Smooth animations that respect prefers-reduced-motion
193
+ * - Proper focus management within interactive content
194
+ *
195
+ * @see {@link HoverCardTrigger} Element that triggers the hover card on hover
196
+ * @see {@link HoverCardContent} Container for the hover card content and positioning
197
+ * @see {@link https://ui.shadcn.com/docs/components/hover-card} shadcn/ui Hover Card Documentation
198
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/hover-card} Radix UI Hover Card Primitive
199
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/} WAI-ARIA Tooltip Pattern (for accessibility considerations)
83
200
  * @since 1.0.0
84
- * @see {@link https://www.radix-ui.com/primitives/docs/components/hover-card} Radix UI Hover Card
85
201
  */
86
202
  /**
87
- * Root container for the hover card component
203
+ * HoverCard - Root container that manages hover card state and timing
204
+ *
205
+ * The main wrapper component that provides context to all hover card subcomponents.
206
+ * Controls the opening and closing behavior, timing delays, and overall state management.
207
+ * Must contain HoverCardTrigger and HoverCardContent as children.
88
208
  *
89
- * @param openDelay - Delay in milliseconds before the hover card opens (default: 700)
90
- * @param closeDelay - Delay in milliseconds before the hover card closes (default: 300)
91
- * @param open - Controlled open state
92
- * @param onOpenChange - Callback when open state changes
209
+ * @example
210
+ * ```tsx
211
+ * // Basic usage with default timing
212
+ * <HoverCard>
213
+ * <HoverCardTrigger>Hover me</HoverCardTrigger>
214
+ * <HoverCardContent>Content appears here</HoverCardContent>
215
+ * </HoverCard>
216
+ * ```
217
+ *
218
+ * @example
219
+ * ```tsx
220
+ * // Custom timing and controlled state
221
+ * <HoverCard
222
+ * openDelay={200}
223
+ * closeDelay={500}
224
+ * open={isOpen}
225
+ * onValueChange={setIsOpen}
226
+ * >
227
+ * <HoverCardTrigger>Controlled hover card</HoverCardTrigger>
228
+ * <HoverCardContent>This hover card is controlled externally</HoverCardContent>
229
+ * </HoverCard>
230
+ * ```
231
+ *
232
+ * @see {@link HoverCardTrigger} The element that triggers the hover behavior
233
+ * @see {@link HoverCardContent} The content container with positioning logic
93
234
  */
94
- function HoverCard({
95
- ...props
96
- }: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
235
+ function HoverCard(
236
+ props: React.ComponentProps<typeof HoverCardPrimitive.Root>,
237
+ ) {
97
238
  return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
98
239
  }
99
240
 
100
241
  /**
101
- * Trigger element that opens the hover card on hover
242
+ * HoverCardTrigger - Interactive element that activates the hover card on mouse hover
243
+ *
244
+ * The trigger component that users hover over to reveal the hover card content.
245
+ * Can wrap any element or render as its child using the asChild prop. Automatically
246
+ * manages hover detection and integrates with the parent HoverCard's timing configuration.
247
+ *
248
+ * When using asChild, the trigger merges its props with the immediate child element,
249
+ * allowing for seamless integration with buttons, links, or any other interactive elements.
250
+ *
251
+ * @example
252
+ * ```tsx
253
+ * // Basic trigger with text
254
+ * <HoverCardTrigger>
255
+ * <span className="text-blue-600 cursor-pointer">Hover for details</span>
256
+ * </HoverCardTrigger>
257
+ * ```
258
+ *
259
+ * @example
260
+ * ```tsx
261
+ * // Using asChild with a button
262
+ * <HoverCardTrigger asChild>
263
+ * <Button variant="outline">User Profile</Button>
264
+ * </HoverCardTrigger>
265
+ * ```
266
+ *
267
+ * @example
268
+ * ```tsx
269
+ * // With a link element
270
+ * <HoverCardTrigger asChild>
271
+ * <a href="/profile/john" className="font-medium hover:underline">
272
+ * @johndoe
273
+ * </a>
274
+ * </HoverCardTrigger>
275
+ * ```
276
+ *
277
+ * @example
278
+ * ```tsx
279
+ * // Complex trigger with icon
280
+ * <HoverCardTrigger className="inline-flex items-center gap-2">
281
+ * <UserIcon className="h-4 w-4" />
282
+ * <span>View Profile</span>
283
+ * </HoverCardTrigger>
284
+ * ```
102
285
  *
103
- * @param asChild - When true, merges props with immediate child element
286
+ * @accessibility
287
+ * - Responds to mouse hover events to show/hide content
288
+ * - Maintains keyboard focus when asChild is used with focusable elements
289
+ * - Does not provide keyboard-only access to hover card content
290
+ * - Consider providing alternative access methods for keyboard users
291
+ *
292
+ * @see {@link HoverCardContent} The content that appears when this trigger is hovered
104
293
  */
105
- function HoverCardTrigger({
106
- ...props
107
- }: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
294
+ function HoverCardTrigger(
295
+ props: React.ComponentProps<typeof HoverCardPrimitive.Trigger>,
296
+ ) {
108
297
  return (
109
298
  <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
110
299
  );
111
300
  }
112
301
 
113
302
  /**
114
- * Content container with built-in styling and animations
303
+ * HoverCardContent - Floating content container with intelligent positioning and animations
304
+ *
305
+ * The content area that appears when the trigger is hovered. Features built-in animations,
306
+ * intelligent positioning to avoid viewport boundaries, and customizable alignment options.
307
+ * Automatically portaled to prevent z-index and overflow issues, with smooth fade and scale
308
+ * transitions that respect user motion preferences.
309
+ *
310
+ * The content supports rich layouts including text, images, buttons, and complex components.
311
+ * Positioning is automatically calculated based on available space, with collision detection
312
+ * to ensure the content remains visible within the viewport.
313
+ *
314
+ * @example
315
+ * ```tsx
316
+ * // Simple text content
317
+ * <HoverCardContent>
318
+ * <p>This is a simple hover card with text content.</p>
319
+ * </HoverCardContent>
320
+ * ```
321
+ *
322
+ * @example
323
+ * ```tsx
324
+ * // Positioned above the trigger with custom alignment
325
+ * <HoverCardContent side="top" align="start" sideOffset={8}>
326
+ * <div className="text-sm">
327
+ * Content appears above the trigger, aligned to the start edge
328
+ * </div>
329
+ * </HoverCardContent>
330
+ * ```
331
+ *
332
+ * @example
333
+ * ```tsx
334
+ * // Rich content with custom width and complex layout
335
+ * <HoverCardContent className="w-80">
336
+ * <div className="space-y-3">
337
+ * <div className="flex items-center gap-3">
338
+ * <Avatar className="h-12 w-12">
339
+ * <AvatarImage src="/avatar.jpg" />
340
+ * <AvatarFallback>JD</AvatarFallback>
341
+ * </Avatar>
342
+ * <div>
343
+ * <h4 className="font-semibold">John Doe</h4>
344
+ * <p className="text-sm text-muted-foreground">Software Engineer</p>
345
+ * </div>
346
+ * </div>
347
+ * <Separator />
348
+ * <div className="grid grid-cols-2 gap-4 text-sm">
349
+ * <div>
350
+ * <p className="font-medium">Repositories</p>
351
+ * <p className="text-muted-foreground">42</p>
352
+ * </div>
353
+ * <div>
354
+ * <p className="font-medium">Followers</p>
355
+ * <p className="text-muted-foreground">1.2k</p>
356
+ * </div>
357
+ * </div>
358
+ * </div>
359
+ * </HoverCardContent>
360
+ * ```
361
+ *
362
+ * @example
363
+ * ```tsx
364
+ * // Interactive content with buttons
365
+ * <HoverCardContent>
366
+ * <div className="space-y-3">
367
+ * <h4 className="font-semibold">Quick Actions</h4>
368
+ * <div className="flex flex-col gap-2">
369
+ * <Button size="sm" variant="ghost" className="justify-start">
370
+ * <EditIcon className="mr-2 h-4 w-4" />
371
+ * Edit Details
372
+ * </Button>
373
+ * <Button size="sm" variant="ghost" className="justify-start">
374
+ * <ShareIcon className="mr-2 h-4 w-4" />
375
+ * Share Profile
376
+ * </Button>
377
+ * <Button size="sm" variant="ghost" className="justify-start">
378
+ * <SettingsIcon className="mr-2 h-4 w-4" />
379
+ * Settings
380
+ * </Button>
381
+ * </div>
382
+ * </div>
383
+ * </HoverCardContent>
384
+ * ```
385
+ *
386
+ * @accessibility
387
+ * - Content is rendered in a portal to avoid z-index conflicts
388
+ * - Smooth animations that respect prefers-reduced-motion settings
389
+ * - Interactive content within the hover card remains functional
390
+ * - Focus management for interactive elements when content is open
391
+ * - Proper contrast ratios with popover color scheme
392
+ * - Content stays open when hovering over it, allowing interaction
393
+ *
394
+ * @animation
395
+ * - Fade in/out animations using data-[state] attributes
396
+ * - Scale animations (zoom-in-95/zoom-out-95) for smooth appearance
397
+ * - Directional slide animations based on positioning side
398
+ * - Origin-based scaling using CSS custom properties from Radix UI
399
+ * - Animations automatically disabled when prefers-reduced-motion is set
400
+ *
401
+ * @positioning
402
+ * - Auto-positioning with collision detection to stay within viewport
403
+ * - Supports all four sides (top, right, bottom, left) relative to trigger
404
+ * - Three alignment options (start, center, end) for each side
405
+ * - Configurable offsets for fine-tuned positioning
406
+ * - Boundary detection with customizable collision boundaries
407
+ * - Sticky positioning when content would overflow viewport
115
408
  *
116
- * @param side - Side of the trigger to position content ("top" | "right" | "bottom" | "left")
117
- * @param align - Alignment relative to trigger ("start" | "center" | "end")
118
- * @param sideOffset - Distance in pixels from the trigger (default: 4)
119
- * @param alignOffset - Offset in pixels from the alignment axis
120
- * @param className - Additional CSS classes
409
+ * @see {@link HoverCardTrigger} The element that activates this content
121
410
  */
122
411
  function HoverCardContent({
123
412
  className,
@@ -132,7 +421,7 @@ function HoverCardContent({
132
421
  align={align}
133
422
  sideOffset={sideOffset}
134
423
  className={cn(
135
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
424
+ "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
136
425
  className,
137
426
  )}
138
427
  {...props}