@neynar/ui 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- package/src/components/ui/typography.tsx +1115 -165
|
@@ -2,14 +2,26 @@ import { type ToasterProps, toast } from "sonner";
|
|
|
2
2
|
/**
|
|
3
3
|
* Toast notification container component built on Sonner
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* with
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* A feature-rich toast component that provides beautiful, accessible notifications
|
|
6
|
+
* with seamless theme integration and extensive customization options. Built on the
|
|
7
|
+
* popular Sonner library with enhanced theming that automatically synchronizes with
|
|
8
|
+
* the application's theme system using the useTheme hook.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* This component serves as the central toast container and should be placed once in
|
|
11
|
+
* your application root. It manages the display, positioning, and lifecycle of all
|
|
12
|
+
* toast notifications throughout your application.
|
|
13
|
+
*
|
|
14
|
+
* **Key Features:**
|
|
15
|
+
* - **Automatic theme synchronization** - Integrates with useTheme for consistent styling
|
|
16
|
+
* - **Flexible positioning** - Six different positions with smart stacking
|
|
17
|
+
* - **Rich accessibility** - Full keyboard navigation and screen reader support
|
|
18
|
+
* - **Promise integration** - Built-in loading/success/error states for async operations
|
|
19
|
+
* - **Gesture support** - Touch-friendly swipe-to-dismiss with configurable directions
|
|
20
|
+
* - **Performance optimized** - Efficient rendering with configurable limits
|
|
21
|
+
* - **Customizable styling** - Comprehensive theming and custom icon support
|
|
22
|
+
*
|
|
23
|
+
* @example Basic setup in root layout
|
|
11
24
|
* ```tsx
|
|
12
|
-
* // Add to your app root layout
|
|
13
25
|
* import { Toaster } from '@neynar/ui/components/ui/sonner';
|
|
14
26
|
*
|
|
15
27
|
* export default function RootLayout({ children }) {
|
|
@@ -24,78 +36,300 @@ import { type ToasterProps, toast } from "sonner";
|
|
|
24
36
|
* }
|
|
25
37
|
* ```
|
|
26
38
|
*
|
|
27
|
-
* @example
|
|
39
|
+
* @example Basic toast usage from anywhere in your app
|
|
28
40
|
* ```tsx
|
|
29
|
-
*
|
|
30
|
-
* import { toast } from 'sonner';
|
|
41
|
+
* import { toast } from '@neynar/ui/components/ui/sonner';
|
|
31
42
|
*
|
|
32
43
|
* // Simple notification
|
|
33
44
|
* toast('Cast published successfully');
|
|
34
45
|
*
|
|
35
|
-
* // Success variant
|
|
46
|
+
* // Success variant with icon
|
|
36
47
|
* toast.success('Profile updated');
|
|
37
48
|
*
|
|
38
|
-
* //
|
|
49
|
+
* // Rich toast with description and action
|
|
39
50
|
* toast('Event created', {
|
|
40
51
|
* description: 'Sunday, December 03, 2023 at 9:00 AM',
|
|
41
52
|
* action: {
|
|
42
53
|
* label: 'Undo',
|
|
43
|
-
* onClick: () =>
|
|
54
|
+
* onClick: () => handleUndo()
|
|
44
55
|
* }
|
|
45
56
|
* });
|
|
57
|
+
*
|
|
58
|
+
* // Error with custom styling
|
|
59
|
+
* toast.error('Upload failed', {
|
|
60
|
+
* description: 'File size must be less than 10MB',
|
|
61
|
+
* className: 'error-toast'
|
|
62
|
+
* });
|
|
46
63
|
* ```
|
|
47
64
|
*
|
|
48
|
-
* @example
|
|
65
|
+
* @example Promise-based toasts for async operations
|
|
49
66
|
* ```tsx
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
67
|
+
* import { toast } from '@neynar/ui/components/ui/sonner';
|
|
68
|
+
*
|
|
69
|
+
* // Automatically handles loading/success/error states
|
|
70
|
+
* toast.promise(saveUserProfile(data), {
|
|
71
|
+
* loading: 'Saving profile changes...',
|
|
72
|
+
* success: (result) => `Profile updated for ${result.username}`,
|
|
73
|
+
* error: 'Failed to save profile changes'
|
|
74
|
+
* });
|
|
75
|
+
*
|
|
76
|
+
* // With custom duration and retry action
|
|
77
|
+
* toast.promise(uploadFile(file), {
|
|
78
|
+
* loading: 'Uploading file...',
|
|
79
|
+
* success: 'File uploaded successfully',
|
|
80
|
+
* error: (error) => ({
|
|
81
|
+
* message: 'Upload failed',
|
|
82
|
+
* description: error.message,
|
|
83
|
+
* action: {
|
|
84
|
+
* label: 'Retry',
|
|
85
|
+
* onClick: () => uploadFile(file)
|
|
86
|
+
* }
|
|
87
|
+
* })
|
|
55
88
|
* });
|
|
56
89
|
* ```
|
|
57
90
|
*
|
|
58
|
-
* @example
|
|
91
|
+
* @example Custom positioned toaster with enhanced styling
|
|
59
92
|
* ```tsx
|
|
60
|
-
* // Custom configuration
|
|
61
93
|
* <Toaster
|
|
62
94
|
* position="top-center"
|
|
63
95
|
* expand={true}
|
|
64
96
|
* richColors
|
|
65
97
|
* duration={5000}
|
|
66
98
|
* closeButton
|
|
99
|
+
* visibleToasts={5}
|
|
100
|
+
* gap={16}
|
|
101
|
+
* offset={64}
|
|
102
|
+
* />
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @example RTL support and mobile optimization
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <Toaster
|
|
108
|
+
* dir="rtl"
|
|
109
|
+
* position="top-right"
|
|
110
|
+
* offset={{ top: 20, right: 20 }}
|
|
111
|
+
* mobileOffset={{ top: 10, right: 10 }}
|
|
112
|
+
* swipeDirections={["left", "top"]}
|
|
113
|
+
* containerAriaLabel="إشعارات"
|
|
114
|
+
* />
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example Custom icons and advanced configuration
|
|
118
|
+
* ```tsx
|
|
119
|
+
* <Toaster
|
|
120
|
+
* richColors
|
|
121
|
+
* icons={{
|
|
122
|
+
* success: <CheckCircleIcon />,
|
|
123
|
+
* error: <XCircleIcon />,
|
|
124
|
+
* warning: <ExclamationTriangleIcon />,
|
|
125
|
+
* info: <InformationCircleIcon />,
|
|
126
|
+
* loading: <SpinnerIcon />
|
|
127
|
+
* }}
|
|
128
|
+
* toastOptions={{
|
|
129
|
+
* classNames: {
|
|
130
|
+
* toast: 'group toast group-[.toaster]:bg-background',
|
|
131
|
+
* description: 'group-[.toast]:text-muted-foreground',
|
|
132
|
+
* actionButton: 'group-[.toast]:bg-primary',
|
|
133
|
+
* cancelButton: 'group-[.toast]:bg-muted'
|
|
134
|
+
* },
|
|
135
|
+
* closeButtonAriaLabel: 'Close notification'
|
|
136
|
+
* }}
|
|
137
|
+
* />
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @example Keyboard shortcuts and accessibility
|
|
141
|
+
* ```tsx
|
|
142
|
+
* <Toaster
|
|
143
|
+
* hotkey={["ctrlKey", "KeyN"]} // Ctrl+N to focus toasts
|
|
144
|
+
* closeButton
|
|
145
|
+
* containerAriaLabel="Application notifications"
|
|
146
|
+
* toastOptions={{
|
|
147
|
+
* closeButtonAriaLabel: "Dismiss notification",
|
|
148
|
+
* duration: 6000 // Longer duration for accessibility
|
|
149
|
+
* }}
|
|
67
150
|
* />
|
|
68
151
|
* ```
|
|
69
152
|
*
|
|
70
|
-
* @param props - Configuration options for the toast container
|
|
71
|
-
* @param props.position - Position of toasts on screen. Options: "top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right". Default: "bottom-right"
|
|
72
|
-
* @param props.hotkey - Keyboard shortcut to focus toasts. Default: ["altKey", "KeyT"]
|
|
73
|
-
* @param props.richColors - Enable enhanced colors for different toast types. Default: false
|
|
74
|
-
* @param props.expand - Expand toasts by default to show full content. Default: false
|
|
75
|
-
* @param props.duration - Default duration in milliseconds before auto-dismiss. Default: 4000
|
|
76
|
-
* @param props.gap - Spacing between toasts in pixels. Default: 14
|
|
77
|
-
* @param props.visibleToasts - Maximum number of toasts visible at once. Default: 3
|
|
78
|
-
* @param props.closeButton - Show close button on each toast. Default: false
|
|
79
|
-
* @param props.toastOptions - Default options applied to all toasts
|
|
80
|
-
* @param props.className - Additional CSS classes for the toast container
|
|
81
|
-
* @param props.style - Additional inline styles for the toast container
|
|
82
|
-
* @param props.offset - Offset from viewport edges in pixels or string
|
|
83
|
-
* @param props.dir - Text direction for toast content. Options: "ltr", "rtl", "auto". Default: "ltr"
|
|
84
|
-
* @param props.loadingIcon - Custom loading icon component
|
|
85
|
-
* @param props.icons - Custom icons for different toast types
|
|
153
|
+
* @param props - Configuration options for the toast container. All props are optional with sensible defaults.
|
|
86
154
|
*
|
|
87
155
|
* @accessibility
|
|
88
|
-
* - Toasts are announced to screen readers
|
|
89
|
-
* - Keyboard
|
|
90
|
-
* -
|
|
91
|
-
* -
|
|
92
|
-
* -
|
|
93
|
-
* -
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
156
|
+
* - **ARIA Live Region**: Toasts are announced to screen readers automatically
|
|
157
|
+
* - **Keyboard Navigation**: Configurable hotkey to focus toast region (default Alt+T)
|
|
158
|
+
* - **Focus Management**: Interactive elements within toasts receive proper focus
|
|
159
|
+
* - **Screen Reader Support**: Toast content is properly announced with role and aria-label
|
|
160
|
+
* - **Close Button Accessibility**: When enabled, includes accessible close buttons
|
|
161
|
+
* - **Motion Preferences**: Respects user's prefers-reduced-motion for animations
|
|
162
|
+
* - **High Contrast**: Compatible with high contrast modes and custom color schemes
|
|
163
|
+
* - **Touch Accessibility**: Swipe gestures work with assistive touch technologies
|
|
164
|
+
* - **Keyboard Dismissal**: Escape key can dismiss toasts when focused
|
|
165
|
+
* - **Semantic Markup**: Uses appropriate ARIA roles and properties for toast region
|
|
166
|
+
*
|
|
167
|
+
* @see {@link https://ui.shadcn.com/docs/components/sonner} shadcn/ui Sonner documentation
|
|
168
|
+
* @see {@link https://sonner.emilkowal.ski/} Official Sonner library documentation
|
|
169
|
+
* @see {@link useTheme} Theme hook for understanding automatic theme integration
|
|
170
|
+
* @see {@link toast} Toast function for creating notifications
|
|
97
171
|
* @since 1.0.0
|
|
98
172
|
*/
|
|
99
173
|
declare function Toaster({ ...props }: ToasterProps): import("react/jsx-runtime").JSX.Element;
|
|
100
|
-
|
|
174
|
+
/**
|
|
175
|
+
* Toast function with comprehensive methods for creating notifications
|
|
176
|
+
*
|
|
177
|
+
* A powerful toast API that supports multiple notification types, promise handling,
|
|
178
|
+
* and extensive customization. Re-exported from the sonner library with enhanced
|
|
179
|
+
* type safety and documentation for seamless integration with @neynar/ui.
|
|
180
|
+
*
|
|
181
|
+
* **Available Methods:**
|
|
182
|
+
* - `toast(message)` - Basic notification
|
|
183
|
+
* - `toast.success(message)` - Success notification with green styling
|
|
184
|
+
* - `toast.error(message)` - Error notification with red styling
|
|
185
|
+
* - `toast.warning(message)` - Warning notification with yellow styling
|
|
186
|
+
* - `toast.info(message)` - Info notification with blue styling
|
|
187
|
+
* - `toast.loading(message)` - Loading notification with spinner
|
|
188
|
+
* - `toast.promise(promise, states)` - Promise-based notifications with loading/success/error
|
|
189
|
+
* - `toast.custom(jsx)` - Fully custom toast with JSX content
|
|
190
|
+
* - `toast.dismiss(id)` - Programmatically dismiss specific toast
|
|
191
|
+
* - `toast.message(message)` - Alias for basic toast
|
|
192
|
+
*
|
|
193
|
+
* **Common Options (ExternalToast):**
|
|
194
|
+
* ```typescript
|
|
195
|
+
* {
|
|
196
|
+
* description?: string | React.ReactNode,
|
|
197
|
+
* duration?: number,
|
|
198
|
+
* icon?: React.ReactNode,
|
|
199
|
+
* action?: {
|
|
200
|
+
* label: React.ReactNode,
|
|
201
|
+
* onClick: (event: MouseEvent) => void
|
|
202
|
+
* },
|
|
203
|
+
* cancel?: {
|
|
204
|
+
* label: React.ReactNode,
|
|
205
|
+
* onClick: (event: MouseEvent) => void
|
|
206
|
+
* },
|
|
207
|
+
* id?: string | number,
|
|
208
|
+
* className?: string,
|
|
209
|
+
* style?: CSSProperties,
|
|
210
|
+
* closeButton?: boolean,
|
|
211
|
+
* dismissible?: boolean,
|
|
212
|
+
* onDismiss?: (toast) => void,
|
|
213
|
+
* onAutoClose?: (toast) => void
|
|
214
|
+
* }
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* @example Basic notifications
|
|
218
|
+
* ```tsx
|
|
219
|
+
* // Simple message
|
|
220
|
+
* toast('User logged in');
|
|
221
|
+
*
|
|
222
|
+
* // With description
|
|
223
|
+
* toast('New message', {
|
|
224
|
+
* description: 'You have a new direct message from @alice'
|
|
225
|
+
* });
|
|
226
|
+
*
|
|
227
|
+
* // Typed notifications
|
|
228
|
+
* toast.success('Profile saved');
|
|
229
|
+
* toast.error('Failed to upload image');
|
|
230
|
+
* toast.warning('Storage space is running low');
|
|
231
|
+
* toast.info('New features available');
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* @example Advanced notifications with actions
|
|
235
|
+
* ```tsx
|
|
236
|
+
* // With action button
|
|
237
|
+
* toast('Cast scheduled', {
|
|
238
|
+
* description: 'Will be published in 1 hour',
|
|
239
|
+
* action: {
|
|
240
|
+
* label: 'Cancel',
|
|
241
|
+
* onClick: () => cancelScheduledCast()
|
|
242
|
+
* }
|
|
243
|
+
* });
|
|
244
|
+
*
|
|
245
|
+
* // With both action and cancel
|
|
246
|
+
* toast('Delete account?', {
|
|
247
|
+
* description: 'This action cannot be undone',
|
|
248
|
+
* action: {
|
|
249
|
+
* label: 'Delete',
|
|
250
|
+
* onClick: () => deleteAccount()
|
|
251
|
+
* },
|
|
252
|
+
* cancel: {
|
|
253
|
+
* label: 'Cancel',
|
|
254
|
+
* onClick: () => console.log('Cancelled')
|
|
255
|
+
* }
|
|
256
|
+
* });
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @example Promise-based notifications
|
|
260
|
+
* ```tsx
|
|
261
|
+
* // Basic promise handling
|
|
262
|
+
* toast.promise(uploadFile(file), {
|
|
263
|
+
* loading: 'Uploading...',
|
|
264
|
+
* success: 'Upload complete!',
|
|
265
|
+
* error: 'Upload failed'
|
|
266
|
+
* });
|
|
267
|
+
*
|
|
268
|
+
* // Dynamic success message based on result
|
|
269
|
+
* toast.promise(createUser(userData), {
|
|
270
|
+
* loading: 'Creating account...',
|
|
271
|
+
* success: (user) => `Welcome ${user.name}!`,
|
|
272
|
+
* error: (error) => `Failed: ${error.message}`
|
|
273
|
+
* });
|
|
274
|
+
*
|
|
275
|
+
* // With custom options per state
|
|
276
|
+
* toast.promise(processData(), {
|
|
277
|
+
* loading: 'Processing data...',
|
|
278
|
+
* success: (result) => ({
|
|
279
|
+
* message: 'Processing complete',
|
|
280
|
+
* description: `Processed ${result.count} items`,
|
|
281
|
+
* action: {
|
|
282
|
+
* label: 'View Results',
|
|
283
|
+
* onClick: () => showResults(result)
|
|
284
|
+
* }
|
|
285
|
+
* }),
|
|
286
|
+
* error: 'Processing failed'
|
|
287
|
+
* });
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* @example Custom styling and behavior
|
|
291
|
+
* ```tsx
|
|
292
|
+
* // Custom duration and styling
|
|
293
|
+
* toast('Custom toast', {
|
|
294
|
+
* duration: 10000,
|
|
295
|
+
* className: 'my-custom-toast',
|
|
296
|
+
* style: { backgroundColor: '#ff6b6b' },
|
|
297
|
+
* icon: <CustomIcon />
|
|
298
|
+
* });
|
|
299
|
+
*
|
|
300
|
+
* // Non-dismissible toast (manual dismiss only)
|
|
301
|
+
* const toastId = toast('Important notice', {
|
|
302
|
+
* dismissible: false,
|
|
303
|
+
* duration: Infinity,
|
|
304
|
+
* action: {
|
|
305
|
+
* label: 'Acknowledge',
|
|
306
|
+
* onClick: () => toast.dismiss(toastId)
|
|
307
|
+
* }
|
|
308
|
+
* });
|
|
309
|
+
* ```
|
|
310
|
+
*
|
|
311
|
+
* @example Programmatic control
|
|
312
|
+
* ```tsx
|
|
313
|
+
* // Store toast ID for later control
|
|
314
|
+
* const loadingToast = toast.loading('Processing...');
|
|
315
|
+
*
|
|
316
|
+
* // Update the same toast
|
|
317
|
+
* setTimeout(() => {
|
|
318
|
+
* toast.success('Process complete!', { id: loadingToast });
|
|
319
|
+
* }, 2000);
|
|
320
|
+
*
|
|
321
|
+
* // Dismiss specific toast
|
|
322
|
+
* toast.dismiss(loadingToast);
|
|
323
|
+
*
|
|
324
|
+
* // Dismiss all toasts
|
|
325
|
+
* toast.dismiss();
|
|
326
|
+
* ```
|
|
327
|
+
*
|
|
328
|
+
* @returns The toast ID that can be used for programmatic control
|
|
329
|
+
*
|
|
330
|
+
* @see {@link Toaster} Toast container component that must be rendered in your app
|
|
331
|
+
* @see {@link https://sonner.emilkowal.ski/toast} Complete toast API documentation
|
|
332
|
+
*/
|
|
333
|
+
declare const toastFunction: typeof toast;
|
|
334
|
+
export { Toaster, toastFunction as toast };
|
|
101
335
|
//# sourceMappingURL=sonner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sonner.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../../src/components/ui/sonner.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,YAAY,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AA8MrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0KG;AACH,iBAAS,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,2CAiB1C;AA2FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8JG;AACH,QAAA,MAAM,aAAa,EAAE,OAAO,KAAa,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,aAAa,IAAI,KAAK,EAAE,CAAC"}
|