@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
@@ -1,17 +1,233 @@
1
1
  import { useTheme } from "@/hooks/use-theme";
2
2
  import { Toaster as Sonner, type ToasterProps, toast } from "sonner";
3
3
 
4
+ /**
5
+ * Props for Toaster (Documentation only - NOT used in component implementation)
6
+ * These types are for documentation generation and should not replace sonner library inferred types
7
+ *
8
+ * Toast notification container configuration that extends the base ToasterProps from the sonner library
9
+ * with enhanced theming integration. All props are optional and have sensible defaults for most use cases.
10
+ */
11
+ // eslint-disable-next-line unused-imports/no-unused-vars
12
+ type ToasterDocsProps = {
13
+ /**
14
+ * Controls whether to invert toast colors for better contrast
15
+ * Useful when the container background differs significantly from the expected theme
16
+ * @default false
17
+ */
18
+ invert?: boolean;
19
+
20
+ /**
21
+ * Theme mode for toast styling
22
+ * Automatically synced with application theme via useTheme hook when not specified
23
+ * @default "system" (auto-detected from useTheme)
24
+ */
25
+ theme?: "light" | "dark" | "system";
26
+
27
+ /**
28
+ * Position of toasts on the screen
29
+ * Determines where new toasts appear and how they stack
30
+ * @default "bottom-right"
31
+ */
32
+ position?:
33
+ | "top-left"
34
+ | "top-right"
35
+ | "bottom-left"
36
+ | "bottom-right"
37
+ | "top-center"
38
+ | "bottom-center";
39
+
40
+ /**
41
+ * Keyboard shortcut to focus the toast region
42
+ * Array of key modifiers and key codes for accessibility
43
+ * @default ["altKey", "KeyT"]
44
+ */
45
+ hotkey?: string[];
46
+
47
+ /**
48
+ * Enable enhanced colors for different toast types
49
+ * Provides more vibrant and distinct colors for success, error, warning, and info toasts
50
+ * @default false
51
+ */
52
+ richColors?: boolean;
53
+
54
+ /**
55
+ * Expand toasts by default to show full content
56
+ * When true, toasts don't require hover to show full text
57
+ * @default false
58
+ */
59
+ expand?: boolean;
60
+
61
+ /**
62
+ * Default duration in milliseconds before auto-dismiss
63
+ * Individual toasts can override this value
64
+ * @default 4000
65
+ */
66
+ duration?: number;
67
+
68
+ /**
69
+ * Spacing between toasts in pixels
70
+ * Controls the visual separation between stacked toasts
71
+ * @default 14
72
+ */
73
+ gap?: number;
74
+
75
+ /**
76
+ * Maximum number of toasts visible simultaneously
77
+ * Older toasts are automatically dismissed when limit is reached
78
+ * @default 3
79
+ */
80
+ visibleToasts?: number;
81
+
82
+ /**
83
+ * Show close button on each toast
84
+ * Provides manual dismiss option for users
85
+ * @default false
86
+ */
87
+ closeButton?: boolean;
88
+
89
+ /**
90
+ * Default options applied to all toasts
91
+ * Individual toast calls can override these defaults
92
+ */
93
+ toastOptions?: {
94
+ /** Additional CSS classes for toast elements */
95
+ className?: string;
96
+ /** Show close button for individual toasts @default false */
97
+ closeButton?: boolean;
98
+ /** CSS classes for description text */
99
+ descriptionClassName?: string;
100
+ /** Inline styles for toast container */
101
+ style?: React.CSSProperties;
102
+ /** Styles for cancel button */
103
+ cancelButtonStyle?: React.CSSProperties;
104
+ /** Styles for action button */
105
+ actionButtonStyle?: React.CSSProperties;
106
+ /** Duration before auto-dismiss in milliseconds */
107
+ duration?: number;
108
+ /** Remove default styling to allow full custom styling @default false */
109
+ unstyled?: boolean;
110
+ /** CSS class overrides for specific toast elements */
111
+ classNames?: {
112
+ toast?: string;
113
+ title?: string;
114
+ description?: string;
115
+ loader?: string;
116
+ closeButton?: string;
117
+ cancelButton?: string;
118
+ actionButton?: string;
119
+ success?: string;
120
+ error?: string;
121
+ info?: string;
122
+ warning?: string;
123
+ loading?: string;
124
+ default?: string;
125
+ content?: string;
126
+ icon?: string;
127
+ };
128
+ /** Accessible label for close button */
129
+ closeButtonAriaLabel?: string;
130
+ };
131
+
132
+ /**
133
+ * Additional CSS classes for the toast container
134
+ * Applied to the root toaster element
135
+ */
136
+ className?: string;
137
+
138
+ /**
139
+ * Additional inline styles for the toast container
140
+ * Applied to the root toaster element
141
+ */
142
+ style?: React.CSSProperties;
143
+
144
+ /**
145
+ * Offset from viewport edges
146
+ * Can be a number (pixels), string with units, or object with directional offsets
147
+ * @default 32
148
+ */
149
+ offset?:
150
+ | string
151
+ | number
152
+ | {
153
+ top?: string | number;
154
+ right?: string | number;
155
+ bottom?: string | number;
156
+ left?: string | number;
157
+ };
158
+
159
+ /**
160
+ * Offset specifically for mobile viewports
161
+ * Overrides offset on mobile devices for better UX
162
+ */
163
+ mobileOffset?:
164
+ | string
165
+ | number
166
+ | {
167
+ top?: string | number;
168
+ right?: string | number;
169
+ bottom?: string | number;
170
+ left?: string | number;
171
+ };
172
+
173
+ /**
174
+ * Text direction for toast content
175
+ * Controls layout direction for RTL languages
176
+ * @default "ltr"
177
+ */
178
+ dir?: "rtl" | "ltr" | "auto";
179
+
180
+ /**
181
+ * Allowed swipe directions for dismissing toasts
182
+ * Controls which gestures can dismiss toasts on touch devices
183
+ * @default ["right"] for left positions, ["left"] for right positions
184
+ */
185
+ swipeDirections?: ("top" | "right" | "bottom" | "left")[];
186
+
187
+ /**
188
+ * Custom icons for different toast types
189
+ * Override default icons with your own components
190
+ */
191
+ icons?: {
192
+ success?: React.ReactNode;
193
+ info?: React.ReactNode;
194
+ warning?: React.ReactNode;
195
+ error?: React.ReactNode;
196
+ loading?: React.ReactNode;
197
+ close?: React.ReactNode;
198
+ };
199
+
200
+ /**
201
+ * Accessible label for the toast container region
202
+ * Announced to screen readers when toasts appear
203
+ * @default "Notifications"
204
+ */
205
+ containerAriaLabel?: string;
206
+ } & ToasterProps;
207
+
4
208
  /**
5
209
  * Toast notification container component built on Sonner
6
210
  *
7
- * An opinionated toast component that provides beautiful, accessible notifications
8
- * with minimal setup. Automatically integrates with the theme system and provides
9
- * consistent styling across the application. This is the recommended toast solution
10
- * for @neynar/ui projects, replacing previous toast implementations.
211
+ * A feature-rich toast component that provides beautiful, accessible notifications
212
+ * with seamless theme integration and extensive customization options. Built on the
213
+ * popular Sonner library with enhanced theming that automatically synchronizes with
214
+ * the application's theme system using the useTheme hook.
11
215
  *
12
- * @example
216
+ * This component serves as the central toast container and should be placed once in
217
+ * your application root. It manages the display, positioning, and lifecycle of all
218
+ * toast notifications throughout your application.
219
+ *
220
+ * **Key Features:**
221
+ * - **Automatic theme synchronization** - Integrates with useTheme for consistent styling
222
+ * - **Flexible positioning** - Six different positions with smart stacking
223
+ * - **Rich accessibility** - Full keyboard navigation and screen reader support
224
+ * - **Promise integration** - Built-in loading/success/error states for async operations
225
+ * - **Gesture support** - Touch-friendly swipe-to-dismiss with configurable directions
226
+ * - **Performance optimized** - Efficient rendering with configurable limits
227
+ * - **Customizable styling** - Comprehensive theming and custom icon support
228
+ *
229
+ * @example Basic setup in root layout
13
230
  * ```tsx
14
- * // Add to your app root layout
15
231
  * import { Toaster } from '@neynar/ui/components/ui/sonner';
16
232
  *
17
233
  * export default function RootLayout({ children }) {
@@ -26,76 +242,138 @@ import { Toaster as Sonner, type ToasterProps, toast } from "sonner";
26
242
  * }
27
243
  * ```
28
244
  *
29
- * @example
245
+ * @example Basic toast usage from anywhere in your app
30
246
  * ```tsx
31
- * // Basic toast usage from anywhere in your app
32
- * import { toast } from 'sonner';
247
+ * import { toast } from '@neynar/ui/components/ui/sonner';
33
248
  *
34
249
  * // Simple notification
35
250
  * toast('Cast published successfully');
36
251
  *
37
- * // Success variant
252
+ * // Success variant with icon
38
253
  * toast.success('Profile updated');
39
254
  *
40
- * // With description and action
255
+ * // Rich toast with description and action
41
256
  * toast('Event created', {
42
257
  * description: 'Sunday, December 03, 2023 at 9:00 AM',
43
258
  * action: {
44
259
  * label: 'Undo',
45
- * onClick: () => console.log('Undo')
260
+ * onClick: () => handleUndo()
46
261
  * }
47
262
  * });
263
+ *
264
+ * // Error with custom styling
265
+ * toast.error('Upload failed', {
266
+ * description: 'File size must be less than 10MB',
267
+ * className: 'error-toast'
268
+ * });
48
269
  * ```
49
270
  *
50
- * @example
271
+ * @example Promise-based toasts for async operations
51
272
  * ```tsx
52
- * // Promise-based toasts for async operations
53
- * toast.promise(saveData(), {
54
- * loading: 'Saving changes...',
55
- * success: 'Data saved successfully!',
56
- * error: 'Failed to save changes'
273
+ * import { toast } from '@neynar/ui/components/ui/sonner';
274
+ *
275
+ * // Automatically handles loading/success/error states
276
+ * toast.promise(saveUserProfile(data), {
277
+ * loading: 'Saving profile changes...',
278
+ * success: (result) => `Profile updated for ${result.username}`,
279
+ * error: 'Failed to save profile changes'
280
+ * });
281
+ *
282
+ * // With custom duration and retry action
283
+ * toast.promise(uploadFile(file), {
284
+ * loading: 'Uploading file...',
285
+ * success: 'File uploaded successfully',
286
+ * error: (error) => ({
287
+ * message: 'Upload failed',
288
+ * description: error.message,
289
+ * action: {
290
+ * label: 'Retry',
291
+ * onClick: () => uploadFile(file)
292
+ * }
293
+ * })
57
294
  * });
58
295
  * ```
59
296
  *
60
- * @example
297
+ * @example Custom positioned toaster with enhanced styling
61
298
  * ```tsx
62
- * // Custom configuration
63
299
  * <Toaster
64
300
  * position="top-center"
65
301
  * expand={true}
66
302
  * richColors
67
303
  * duration={5000}
68
304
  * closeButton
305
+ * visibleToasts={5}
306
+ * gap={16}
307
+ * offset={64}
69
308
  * />
70
309
  * ```
71
310
  *
72
- * @param props - Configuration options for the toast container
73
- * @param props.position - Position of toasts on screen. Options: "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right". Default: "bottom-right"
74
- * @param props.hotkey - Keyboard shortcut to focus toasts. Default: ["altKey", "KeyT"]
75
- * @param props.richColors - Enable enhanced colors for different toast types. Default: false
76
- * @param props.expand - Expand toasts by default to show full content. Default: false
77
- * @param props.duration - Default duration in milliseconds before auto-dismiss. Default: 4000
78
- * @param props.gap - Spacing between toasts in pixels. Default: 14
79
- * @param props.visibleToasts - Maximum number of toasts visible at once. Default: 3
80
- * @param props.closeButton - Show close button on each toast. Default: false
81
- * @param props.toastOptions - Default options applied to all toasts
82
- * @param props.className - Additional CSS classes for the toast container
83
- * @param props.style - Additional inline styles for the toast container
84
- * @param props.offset - Offset from viewport edges in pixels or string
85
- * @param props.dir - Text direction for toast content. Options: "ltr", "rtl", "auto". Default: "ltr"
86
- * @param props.loadingIcon - Custom loading icon component
87
- * @param props.icons - Custom icons for different toast types
311
+ * @example RTL support and mobile optimization
312
+ * ```tsx
313
+ * <Toaster
314
+ * dir="rtl"
315
+ * position="top-right"
316
+ * offset={{ top: 20, right: 20 }}
317
+ * mobileOffset={{ top: 10, right: 10 }}
318
+ * swipeDirections={["left", "top"]}
319
+ * containerAriaLabel="إشعارات"
320
+ * />
321
+ * ```
322
+ *
323
+ * @example Custom icons and advanced configuration
324
+ * ```tsx
325
+ * <Toaster
326
+ * richColors
327
+ * icons={{
328
+ * success: <CheckCircleIcon />,
329
+ * error: <XCircleIcon />,
330
+ * warning: <ExclamationTriangleIcon />,
331
+ * info: <InformationCircleIcon />,
332
+ * loading: <SpinnerIcon />
333
+ * }}
334
+ * toastOptions={{
335
+ * classNames: {
336
+ * toast: 'group toast group-[.toaster]:bg-background',
337
+ * description: 'group-[.toast]:text-muted-foreground',
338
+ * actionButton: 'group-[.toast]:bg-primary',
339
+ * cancelButton: 'group-[.toast]:bg-muted'
340
+ * },
341
+ * closeButtonAriaLabel: 'Close notification'
342
+ * }}
343
+ * />
344
+ * ```
345
+ *
346
+ * @example Keyboard shortcuts and accessibility
347
+ * ```tsx
348
+ * <Toaster
349
+ * hotkey={["ctrlKey", "KeyN"]} // Ctrl+N to focus toasts
350
+ * closeButton
351
+ * containerAriaLabel="Application notifications"
352
+ * toastOptions={{
353
+ * closeButtonAriaLabel: "Dismiss notification",
354
+ * duration: 6000 // Longer duration for accessibility
355
+ * }}
356
+ * />
357
+ * ```
358
+ *
359
+ * @param props - Configuration options for the toast container. All props are optional with sensible defaults.
88
360
  *
89
361
  * @accessibility
90
- * - Toasts are announced to screen readers with appropriate ARIA attributes
91
- * - Keyboard navigation support with customizable hotkey
92
- * - Auto-dismiss functionality with configurable duration
93
- * - Focus management for interactive elements within toasts
94
- * - Respects user's prefers-reduced-motion settings
95
- * - High contrast support for better visibility
96
- *
97
- * @see {@link https://ui.shadcn.com/docs/components/sonner} - shadcn/ui Sonner documentation
98
- * @see {@link https://sonner.emilkowal.ski/} - Official Sonner documentation
362
+ * - **ARIA Live Region**: Toasts are announced to screen readers automatically
363
+ * - **Keyboard Navigation**: Configurable hotkey to focus toast region (default Alt+T)
364
+ * - **Focus Management**: Interactive elements within toasts receive proper focus
365
+ * - **Screen Reader Support**: Toast content is properly announced with role and aria-label
366
+ * - **Close Button Accessibility**: When enabled, includes accessible close buttons
367
+ * - **Motion Preferences**: Respects user's prefers-reduced-motion for animations
368
+ * - **High Contrast**: Compatible with high contrast modes and custom color schemes
369
+ * - **Touch Accessibility**: Swipe gestures work with assistive touch technologies
370
+ * - **Keyboard Dismissal**: Escape key can dismiss toasts when focused
371
+ * - **Semantic Markup**: Uses appropriate ARIA roles and properties for toast region
372
+ *
373
+ * @see {@link https://ui.shadcn.com/docs/components/sonner} shadcn/ui Sonner documentation
374
+ * @see {@link https://sonner.emilkowal.ski/} Official Sonner library documentation
375
+ * @see {@link useTheme} Theme hook for understanding automatic theme integration
376
+ * @see {@link toast} Toast function for creating notifications
99
377
  * @since 1.0.0
100
378
  */
101
379
  function Toaster({ ...props }: ToasterProps) {
@@ -117,4 +395,254 @@ function Toaster({ ...props }: ToasterProps) {
117
395
  );
118
396
  }
119
397
 
120
- export { Toaster, toast };
398
+ /**
399
+ * Props for toast function (Documentation only - NOT used in function implementation)
400
+ * These types are for documentation generation and should not replace sonner library inferred types
401
+ *
402
+ * Configuration options for the toast() function and its variants. Extended from ExternalToast
403
+ * interface provided by the sonner library for comprehensive type coverage.
404
+ */
405
+ // eslint-disable-next-line unused-imports/no-unused-vars
406
+ type ToastFunctionDocsProps = {
407
+ /** Secondary text displayed below the main message */
408
+ description?: string | React.ReactNode;
409
+ /** Duration in milliseconds before auto-dismiss @default 4000 */
410
+ duration?: number;
411
+ /** Custom icon to display instead of default type icon */
412
+ icon?: React.ReactNode;
413
+ /** Primary action button configuration */
414
+ action?: {
415
+ /** Button text or React element */
416
+ label: React.ReactNode;
417
+ /** Click handler for the action button @param event - Mouse click event */
418
+ onClick: (event: MouseEvent) => void;
419
+ };
420
+ /** Cancel/dismiss button configuration */
421
+ cancel?: {
422
+ /** Button text or React element */
423
+ label: React.ReactNode;
424
+ /** Click handler for the cancel button @param event - Mouse click event */
425
+ onClick?: (event: MouseEvent) => void;
426
+ };
427
+ /** Unique identifier for programmatic control */
428
+ id?: string | number;
429
+ /** Additional CSS classes for toast styling */
430
+ className?: string;
431
+ /** Inline styles for toast container */
432
+ style?: React.CSSProperties;
433
+ /** Show close button on this toast @default false */
434
+ closeButton?: boolean;
435
+ /** Whether toast can be dismissed by user interaction @default true */
436
+ dismissible?: boolean;
437
+ /** Callback when toast is dismissed @param toast - Toast object */
438
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
439
+ onDismiss?: (toast: any) => void;
440
+ /** Callback when toast auto-closes @param toast - Toast object */
441
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
442
+ onAutoClose?: (toast: any) => void;
443
+ /** Remove default styling for complete customization @default false */
444
+ unstyled?: boolean;
445
+ /** CSS class overrides for specific toast elements */
446
+ classNames?: {
447
+ toast?: string;
448
+ title?: string;
449
+ description?: string;
450
+ loader?: string;
451
+ closeButton?: string;
452
+ cancelButton?: string;
453
+ actionButton?: string;
454
+ success?: string;
455
+ error?: string;
456
+ info?: string;
457
+ warning?: string;
458
+ loading?: string;
459
+ default?: string;
460
+ };
461
+ /** Inline styles for specific toast elements */
462
+ styles?: {
463
+ toast?: React.CSSProperties;
464
+ title?: React.CSSProperties;
465
+ description?: React.CSSProperties;
466
+ loader?: React.CSSProperties;
467
+ closeButton?: React.CSSProperties;
468
+ cancelButton?: React.CSSProperties;
469
+ actionButton?: React.CSSProperties;
470
+ };
471
+ /** Position override for this specific toast */
472
+ position?:
473
+ | "top-left"
474
+ | "top-right"
475
+ | "bottom-left"
476
+ | "bottom-right"
477
+ | "top-center"
478
+ | "bottom-center";
479
+ /** Enable rich colors for this toast @default false */
480
+ richColors?: boolean;
481
+ /** Text direction for this toast @default "ltr" */
482
+ dir?: "rtl" | "ltr" | "auto";
483
+ /** Accessible label for close button @default "Close toast" */
484
+ closeButtonAriaLabel?: string;
485
+ };
486
+
487
+ /**
488
+ * Toast function with comprehensive methods for creating notifications
489
+ *
490
+ * A powerful toast API that supports multiple notification types, promise handling,
491
+ * and extensive customization. Re-exported from the sonner library with enhanced
492
+ * type safety and documentation for seamless integration with @neynar/ui.
493
+ *
494
+ * **Available Methods:**
495
+ * - `toast(message)` - Basic notification
496
+ * - `toast.success(message)` - Success notification with green styling
497
+ * - `toast.error(message)` - Error notification with red styling
498
+ * - `toast.warning(message)` - Warning notification with yellow styling
499
+ * - `toast.info(message)` - Info notification with blue styling
500
+ * - `toast.loading(message)` - Loading notification with spinner
501
+ * - `toast.promise(promise, states)` - Promise-based notifications with loading/success/error
502
+ * - `toast.custom(jsx)` - Fully custom toast with JSX content
503
+ * - `toast.dismiss(id)` - Programmatically dismiss specific toast
504
+ * - `toast.message(message)` - Alias for basic toast
505
+ *
506
+ * **Common Options (ExternalToast):**
507
+ * ```typescript
508
+ * {
509
+ * description?: string | React.ReactNode,
510
+ * duration?: number,
511
+ * icon?: React.ReactNode,
512
+ * action?: {
513
+ * label: React.ReactNode,
514
+ * onClick: (event: MouseEvent) => void
515
+ * },
516
+ * cancel?: {
517
+ * label: React.ReactNode,
518
+ * onClick: (event: MouseEvent) => void
519
+ * },
520
+ * id?: string | number,
521
+ * className?: string,
522
+ * style?: CSSProperties,
523
+ * closeButton?: boolean,
524
+ * dismissible?: boolean,
525
+ * onDismiss?: (toast) => void,
526
+ * onAutoClose?: (toast) => void
527
+ * }
528
+ * ```
529
+ *
530
+ * @example Basic notifications
531
+ * ```tsx
532
+ * // Simple message
533
+ * toast('User logged in');
534
+ *
535
+ * // With description
536
+ * toast('New message', {
537
+ * description: 'You have a new direct message from @alice'
538
+ * });
539
+ *
540
+ * // Typed notifications
541
+ * toast.success('Profile saved');
542
+ * toast.error('Failed to upload image');
543
+ * toast.warning('Storage space is running low');
544
+ * toast.info('New features available');
545
+ * ```
546
+ *
547
+ * @example Advanced notifications with actions
548
+ * ```tsx
549
+ * // With action button
550
+ * toast('Cast scheduled', {
551
+ * description: 'Will be published in 1 hour',
552
+ * action: {
553
+ * label: 'Cancel',
554
+ * onClick: () => cancelScheduledCast()
555
+ * }
556
+ * });
557
+ *
558
+ * // With both action and cancel
559
+ * toast('Delete account?', {
560
+ * description: 'This action cannot be undone',
561
+ * action: {
562
+ * label: 'Delete',
563
+ * onClick: () => deleteAccount()
564
+ * },
565
+ * cancel: {
566
+ * label: 'Cancel',
567
+ * onClick: () => console.log('Cancelled')
568
+ * }
569
+ * });
570
+ * ```
571
+ *
572
+ * @example Promise-based notifications
573
+ * ```tsx
574
+ * // Basic promise handling
575
+ * toast.promise(uploadFile(file), {
576
+ * loading: 'Uploading...',
577
+ * success: 'Upload complete!',
578
+ * error: 'Upload failed'
579
+ * });
580
+ *
581
+ * // Dynamic success message based on result
582
+ * toast.promise(createUser(userData), {
583
+ * loading: 'Creating account...',
584
+ * success: (user) => `Welcome ${user.name}!`,
585
+ * error: (error) => `Failed: ${error.message}`
586
+ * });
587
+ *
588
+ * // With custom options per state
589
+ * toast.promise(processData(), {
590
+ * loading: 'Processing data...',
591
+ * success: (result) => ({
592
+ * message: 'Processing complete',
593
+ * description: `Processed ${result.count} items`,
594
+ * action: {
595
+ * label: 'View Results',
596
+ * onClick: () => showResults(result)
597
+ * }
598
+ * }),
599
+ * error: 'Processing failed'
600
+ * });
601
+ * ```
602
+ *
603
+ * @example Custom styling and behavior
604
+ * ```tsx
605
+ * // Custom duration and styling
606
+ * toast('Custom toast', {
607
+ * duration: 10000,
608
+ * className: 'my-custom-toast',
609
+ * style: { backgroundColor: '#ff6b6b' },
610
+ * icon: <CustomIcon />
611
+ * });
612
+ *
613
+ * // Non-dismissible toast (manual dismiss only)
614
+ * const toastId = toast('Important notice', {
615
+ * dismissible: false,
616
+ * duration: Infinity,
617
+ * action: {
618
+ * label: 'Acknowledge',
619
+ * onClick: () => toast.dismiss(toastId)
620
+ * }
621
+ * });
622
+ * ```
623
+ *
624
+ * @example Programmatic control
625
+ * ```tsx
626
+ * // Store toast ID for later control
627
+ * const loadingToast = toast.loading('Processing...');
628
+ *
629
+ * // Update the same toast
630
+ * setTimeout(() => {
631
+ * toast.success('Process complete!', { id: loadingToast });
632
+ * }, 2000);
633
+ *
634
+ * // Dismiss specific toast
635
+ * toast.dismiss(loadingToast);
636
+ *
637
+ * // Dismiss all toasts
638
+ * toast.dismiss();
639
+ * ```
640
+ *
641
+ * @returns The toast ID that can be used for programmatic control
642
+ *
643
+ * @see {@link Toaster} Toast container component that must be rendered in your app
644
+ * @see {@link https://sonner.emilkowal.ski/toast} Complete toast API documentation
645
+ */
646
+ const toastFunction: typeof toast = toast;
647
+
648
+ export { Toaster, toastFunction as toast };