@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
@@ -3,14 +3,102 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3
3
 
4
4
  import { cn } from "@/lib/utils";
5
5
 
6
+ // eslint-disable-next-line unused-imports/no-unused-vars
7
+ type TooltipProviderDocsProps = {
8
+ /** Time in milliseconds to wait before showing tooltip when hovering over trigger @default 700 */
9
+ delayDuration?: number;
10
+ /** Time in milliseconds to wait before showing tooltip when moving between tooltips @default 300 */
11
+ skipDelayDuration?: number;
12
+ /** Disable hoverable content behavior for WCAG 2.1 compliance @default false */
13
+ disableHoverableContent?: boolean;
14
+ /** React children to wrap with tooltip context */
15
+ children?: React.ReactNode;
16
+ };
17
+
18
+ // eslint-disable-next-line unused-imports/no-unused-vars
19
+ type TooltipDocsProps = {
20
+ /** Whether tooltip is open by default in uncontrolled mode @default false */
21
+ defaultOpen?: boolean;
22
+ /** Control tooltip open state in controlled mode */
23
+ open?: boolean;
24
+ /** Callback fired when tooltip open state changes */
25
+ onOpenChange?: (open: boolean) => void;
26
+ /** Override global delay duration for this specific tooltip @default 700 */
27
+ delayDuration?: number;
28
+ /** Disable hoverable content behavior for this specific tooltip @default false */
29
+ disableHoverableContent?: boolean;
30
+ /** React children containing trigger and content elements */
31
+ children?: React.ReactNode;
32
+ };
33
+
34
+ // eslint-disable-next-line unused-imports/no-unused-vars
35
+ type TooltipTriggerDocsProps = {
36
+ /** Merge props with child element instead of rendering wrapper @default false */
37
+ asChild?: boolean;
38
+ /** React children - the element that triggers tooltip display */
39
+ children?: React.ReactNode;
40
+ } & React.HTMLAttributes<HTMLButtonElement>;
41
+
42
+ // eslint-disable-next-line unused-imports/no-unused-vars
43
+ type TooltipContentDocsProps = {
44
+ /** Merge props with child element instead of rendering wrapper @default false */
45
+ asChild?: boolean;
46
+ /** Accessible label for tooltip content when no visible text */
47
+ "aria-label"?: string;
48
+ /** Callback fired when escape key is pressed */
49
+ onEscapeKeyDown?: (event: KeyboardEvent) => void;
50
+ /** Callback fired when pointer down occurs outside tooltip */
51
+ onPointerDownOutside?: (event: PointerEvent) => void;
52
+ /** Force mount content even when not open for animation purposes @default false */
53
+ forceMount?: boolean;
54
+ /** Preferred side of trigger to display tooltip @default "top" */
55
+ side?: "top" | "right" | "bottom" | "left";
56
+ /** Distance in pixels from trigger element @default 0 */
57
+ sideOffset?: number;
58
+ /** Alignment relative to trigger element @default "center" */
59
+ align?: "start" | "center" | "end";
60
+ /** Offset in pixels from aligned position @default 0 */
61
+ alignOffset?: number;
62
+ /** Enable collision detection to keep tooltip in viewport @default true */
63
+ avoidCollisions?: boolean;
64
+ /** Element or elements to check for collisions against */
65
+ collisionBoundary?: Element | Element[];
66
+ /** Padding in pixels from collision boundary edges */
67
+ collisionPadding?:
68
+ | number
69
+ | { top?: number; right?: number; bottom?: number; left?: number };
70
+ /** Padding in pixels between arrow and content edges @default 0 */
71
+ arrowPadding?: number;
72
+ /** Sticky positioning behavior @default "partial" */
73
+ sticky?: "partial" | "always";
74
+ /** Hide tooltip when trigger becomes fully occluded @default false */
75
+ hideWhenDetached?: boolean;
76
+ /** Additional CSS classes for custom styling */
77
+ className?: string;
78
+ /** React children - content to display in tooltip */
79
+ children?: React.ReactNode;
80
+ };
81
+
82
+ // eslint-disable-next-line unused-imports/no-unused-vars
83
+ type TooltipPortalDocsProps = {
84
+ /** Force mount portal content even when not open @default false */
85
+ forceMount?: boolean;
86
+ /** Container element to portal content into @default document.body */
87
+ container?: HTMLElement;
88
+ /** React children to render in portal */
89
+ children?: React.ReactNode;
90
+ };
91
+
6
92
  /**
7
93
  * TooltipProvider - Global context provider for tooltip functionality
8
94
  *
9
95
  * Wraps your application or component tree to enable tooltip functionality.
10
96
  * Controls global tooltip behavior such as delay duration before showing tooltips.
11
- * Required for tooltip components to function properly.
97
+ * Required for tooltip components to function properly across your app.
12
98
  *
13
- * @param delayDuration - Time in milliseconds to wait before showing tooltip (default: 0)
99
+ * The provider manages global settings that affect all tooltips within its tree,
100
+ * including timing behavior and accessibility features. Individual tooltips can
101
+ * override these settings as needed.
14
102
  *
15
103
  * @example
16
104
  * ```tsx
@@ -22,17 +110,35 @@ import { cn } from "@/lib/utils";
22
110
  *
23
111
  * @example
24
112
  * ```tsx
25
- * // With custom delay
26
- * <TooltipProvider delayDuration={700}>
113
+ * // With custom delay and skip behavior
114
+ * <TooltipProvider
115
+ * delayDuration={500}
116
+ * skipDelayDuration={200}
117
+ * >
27
118
  * <MyComponent />
28
119
  * </TooltipProvider>
29
120
  * ```
30
121
  *
122
+ * @example
123
+ * ```tsx
124
+ * // Disable hoverable content for stricter accessibility
125
+ * <TooltipProvider disableHoverableContent>
126
+ * <Form />
127
+ * </TooltipProvider>
128
+ * ```
129
+ *
130
+ * @accessibility
131
+ * - Manages focus behavior and keyboard navigation globally
132
+ * - Controls WCAG 2.1 compliance through hoverable content settings
133
+ * - Provides consistent timing behavior across all tooltips
134
+ * - Enables skip delay optimization for tooltip-heavy interfaces
135
+ *
31
136
  * @see {@link https://ui.shadcn.com/docs/components/tooltip} for design patterns
137
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/tooltip} for Radix UI documentation
32
138
  * @since 1.0.0
33
139
  */
34
140
  function TooltipProvider({
35
- delayDuration = 0,
141
+ delayDuration = 700,
36
142
  ...props
37
143
  }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
38
144
  return (
@@ -52,6 +158,11 @@ function TooltipProvider({
52
158
  * for displaying help text, definitions, or additional context without cluttering
53
159
  * the interface. Automatically wraps content in a TooltipProvider for convenience.
54
160
  *
161
+ * The tooltip supports both controlled and uncontrolled usage patterns, with
162
+ * intelligent positioning, collision detection, and smooth animations. Built
163
+ * with accessibility as a priority, including proper ARIA attributes and
164
+ * keyboard navigation support.
165
+ *
55
166
  * @example
56
167
  * ```tsx
57
168
  * // Basic tooltip
@@ -84,10 +195,29 @@ function TooltipProvider({
84
195
  *
85
196
  * @example
86
197
  * ```tsx
87
- * // Disabled element with tooltip
198
+ * // Controlled tooltip with custom delay
199
+ * const [open, setOpen] = useState(false)
200
+ *
201
+ * <Tooltip
202
+ * open={open}
203
+ * onOpenChange={setOpen}
204
+ * delayDuration={300}
205
+ * >
206
+ * <TooltipTrigger asChild>
207
+ * <Button onClick={() => setOpen(!open)}>Toggle</Button>
208
+ * </TooltipTrigger>
209
+ * <TooltipContent>
210
+ * <p>Controlled tooltip state</p>
211
+ * </TooltipContent>
212
+ * </Tooltip>
213
+ * ```
214
+ *
215
+ * @example
216
+ * ```tsx
217
+ * // Disabled element with tooltip (requires wrapper)
88
218
  * <Tooltip>
89
219
  * <TooltipTrigger asChild>
90
- * <span>
220
+ * <span className="inline-block">
91
221
  * <Button disabled>Disabled Action</Button>
92
222
  * </span>
93
223
  * </TooltipTrigger>
@@ -116,12 +246,15 @@ function TooltipProvider({
116
246
  * @accessibility
117
247
  * - Fully keyboard accessible (shows on focus, hides on blur)
118
248
  * - Screen reader compatible with proper ARIA attributes
119
- * - Escape key dismisses tooltip
249
+ * - Escape key dismisses tooltip immediately
120
250
  * - Automatic positioning with collision detection
121
251
  * - Respects user's reduced motion preferences
122
- * - Portal rendering prevents z-index issues
252
+ * - Portal rendering prevents z-index stacking issues
253
+ * - WCAG 2.1 compliant with hoverable content support
254
+ * - Works with assistive technologies and voice controls
123
255
  *
124
256
  * @see {@link https://ui.shadcn.com/docs/components/tooltip} for design patterns
257
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/tooltip} for Radix UI documentation
125
258
  * @see {@link Popover} - For interactive floating content
126
259
  * @see {@link HoverCard} - For rich content previews
127
260
  * @since 1.0.0
@@ -141,13 +274,16 @@ function Tooltip({
141
274
  *
142
275
  * Wraps the element that will show the tooltip on hover or focus.
143
276
  * Use the `asChild` prop to merge props with the child element rather
144
- * than rendering an additional wrapper element.
277
+ * than rendering an additional wrapper element. Essential for maintaining
278
+ * semantic meaning and avoiding unnecessary DOM nesting.
145
279
  *
146
- * @param asChild - When true, merges props with the child element instead of rendering a wrapper
280
+ * The trigger automatically handles all interaction events including mouse hover,
281
+ * touch interactions, keyboard focus, and blur events. It preserves the original
282
+ * element's accessibility properties while adding tooltip functionality.
147
283
  *
148
284
  * @example
149
285
  * ```tsx
150
- * // Basic trigger
286
+ * // Basic trigger with button
151
287
  * <TooltipTrigger asChild>
152
288
  * <Button>Hover me</Button>
153
289
  * </TooltipTrigger>
@@ -155,20 +291,48 @@ function Tooltip({
155
291
  *
156
292
  * @example
157
293
  * ```tsx
158
- * // With disabled element (requires wrapper)
294
+ * // With icon button
159
295
  * <TooltipTrigger asChild>
160
- * <span>
161
- * <Button disabled>Disabled</Button>
296
+ * <Button variant="ghost" size="icon">
297
+ * <Settings className="h-4 w-4" />
298
+ * </Button>
299
+ * </TooltipTrigger>
300
+ * ```
301
+ *
302
+ * @example
303
+ * ```tsx
304
+ * // With disabled element (requires wrapper for pointer events)
305
+ * <TooltipTrigger asChild>
306
+ * <span className="inline-block cursor-not-allowed">
307
+ * <Button disabled>Disabled Action</Button>
162
308
  * </span>
163
309
  * </TooltipTrigger>
164
310
  * ```
165
311
  *
312
+ * @example
313
+ * ```tsx
314
+ * // With custom element
315
+ * <TooltipTrigger asChild>
316
+ * <div
317
+ * role="button"
318
+ * tabIndex={0}
319
+ * className="cursor-pointer p-2 rounded hover:bg-gray-100"
320
+ * >
321
+ * Custom trigger element
322
+ * </div>
323
+ * </TooltipTrigger>
324
+ * ```
325
+ *
166
326
  * @accessibility
167
327
  * - Automatically handles hover, focus, and blur events
168
328
  * - Preserves existing keyboard navigation patterns
169
- * - Maintains semantic meaning of wrapped element
170
- * - Works with disabled elements when properly wrapped
329
+ * - Maintains semantic meaning and ARIA attributes of wrapped element
330
+ * - Works with disabled elements when properly wrapped with pointer-events
331
+ * - Supports all standard HTML interactive elements
332
+ * - Respects existing tab order and focus management
333
+ * - Compatible with screen readers and assistive technologies
171
334
  *
335
+ * @see {@link https://www.radix-ui.com/primitives/docs/guides/composition} for asChild pattern
172
336
  * @since 1.0.0
173
337
  */
174
338
  function TooltipTrigger({
@@ -185,10 +349,10 @@ function TooltipTrigger({
185
349
  * the tooltip stays within the viewport. Includes smooth animations and an arrow
186
350
  * pointer for visual connection to the trigger.
187
351
  *
188
- * @param side - Preferred side of the trigger to display on ("top" | "right" | "bottom" | "left")
189
- * @param sideOffset - Distance in pixels from the trigger element (default: 0)
190
- * @param className - Additional CSS classes for custom styling
191
- * @param children - Content to display in the tooltip
352
+ * The content component handles complex positioning logic, including collision
353
+ * detection, viewport boundaries, and responsive positioning. It supports rich
354
+ * content including text, images, and interactive elements while maintaining
355
+ * accessibility standards.
192
356
  *
193
357
  * @example
194
358
  * ```tsx
@@ -200,30 +364,76 @@ function TooltipTrigger({
200
364
  *
201
365
  * @example
202
366
  * ```tsx
203
- * // Positioned tooltip with offset
204
- * <TooltipContent side="left" sideOffset={10}>
205
- * <p>Appears on the left with spacing</p>
367
+ * // Positioned tooltip with custom offset
368
+ * <TooltipContent
369
+ * side="left"
370
+ * sideOffset={12}
371
+ * align="start"
372
+ * alignOffset={-4}
373
+ * >
374
+ * <p>Precisely positioned tooltip</p>
206
375
  * </TooltipContent>
207
376
  * ```
208
377
  *
209
378
  * @example
210
379
  * ```tsx
211
- * // Rich content with custom width
212
- * <TooltipContent className="max-w-[300px]">
213
- * <div className="space-y-1">
214
- * <p className="font-medium">Feature Name</p>
215
- * <p className="text-xs">Detailed description here</p>
380
+ * // Rich content with custom styling
381
+ * <TooltipContent className="max-w-[320px] p-4">
382
+ * <div className="space-y-2">
383
+ * <div className="flex items-center gap-2">
384
+ * <InfoIcon className="h-4 w-4 text-blue-500" />
385
+ * <p className="font-semibold">Pro Feature</p>
386
+ * </div>
387
+ * <p className="text-sm text-gray-600">
388
+ * This feature is available in Pro plans. Upgrade to unlock
389
+ * advanced functionality and premium support.
390
+ * </p>
391
+ * <Button size="sm" className="mt-2">Upgrade Now</Button>
216
392
  * </div>
217
393
  * </TooltipContent>
218
394
  * ```
219
395
  *
396
+ * @example
397
+ * ```tsx
398
+ * // Tooltip with collision boundary
399
+ * <TooltipContent
400
+ * collisionPadding={{ top: 10, bottom: 10 }}
401
+ * hideWhenDetached
402
+ * sticky="always"
403
+ * >
404
+ * <p>Stays within safe boundaries</p>
405
+ * </TooltipContent>
406
+ * ```
407
+ *
408
+ * @example
409
+ * ```tsx
410
+ * // Controlled tooltip with escape handling
411
+ * <TooltipContent
412
+ * onEscapeKeyDown={(e) => {
413
+ * console.log('Tooltip dismissed with Escape');
414
+ * // Custom handling if needed
415
+ * }}
416
+ * onPointerDownOutside={(e) => {
417
+ * console.log('Clicked outside tooltip');
418
+ * }}
419
+ * >
420
+ * <p>Interactive tooltip with event handlers</p>
421
+ * </TooltipContent>
422
+ * ```
423
+ *
220
424
  * @accessibility
221
425
  * - Rendered in a portal to avoid z-index stacking issues
222
426
  * - Properly announced by screen readers with role="tooltip"
223
427
  * - Smooth animations respect reduced motion preferences
224
428
  * - Arrow provides visual connection to trigger element
225
429
  * - Automatically dismisses when trigger loses focus
430
+ * - Escape key immediately closes tooltip
431
+ * - Supports aria-label for screen reader context
432
+ * - Focus is managed properly for hoverable content
433
+ * - Compatible with high contrast themes
226
434
  *
435
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/tooltip#content} for positioning details
436
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/} for ARIA tooltip pattern
227
437
  * @since 1.0.0
228
438
  */
229
439
  function TooltipContent({