@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
|
@@ -4,6 +4,167 @@ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
|
4
4
|
import { cn } from "@/lib/utils";
|
|
5
5
|
import { buttonVariants } from "@/components/ui/button";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Props for AlertDialog (Documentation only - NOT used in component implementation)
|
|
9
|
+
*
|
|
10
|
+
* Controls the overall state and behavior of the alert dialog. Alert dialogs are
|
|
11
|
+
* specifically designed for critical confirmations that require user attention
|
|
12
|
+
* and cannot be dismissed by clicking outside.
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
15
|
+
type AlertDialogDocsProps = {
|
|
16
|
+
/** Whether the dialog is open by default (uncontrolled mode) @default undefined */
|
|
17
|
+
defaultOpen?: boolean;
|
|
18
|
+
/** Whether the dialog is open (controlled mode) @default undefined */
|
|
19
|
+
open?: boolean;
|
|
20
|
+
/** Callback fired when the open state changes @param open - The new open state */
|
|
21
|
+
onOpenChange?: (open: boolean) => void;
|
|
22
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Root>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Props for AlertDialogTrigger (Documentation only - NOT used in component implementation)
|
|
26
|
+
*
|
|
27
|
+
* The element that opens the alert dialog when activated. Usually a button,
|
|
28
|
+
* but can be any interactive element through composition.
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
31
|
+
type AlertDialogTriggerDocsProps = {
|
|
32
|
+
/** Render as child element, merging props and behavior @default false */
|
|
33
|
+
asChild?: boolean;
|
|
34
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Trigger>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Props for AlertDialogPortal (Documentation only - NOT used in component implementation)
|
|
38
|
+
*
|
|
39
|
+
* Controls where the dialog content is rendered in the DOM tree.
|
|
40
|
+
* Used internally by AlertDialogContent.
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
43
|
+
type AlertDialogPortalDocsProps = {
|
|
44
|
+
/** Force mount the component even when not open @default undefined */
|
|
45
|
+
forceMount?: boolean;
|
|
46
|
+
/** Container element to portal into @default document.body */
|
|
47
|
+
container?: HTMLElement;
|
|
48
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Portal>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Props for AlertDialogOverlay (Documentation only - NOT used in component implementation)
|
|
52
|
+
*
|
|
53
|
+
* The semi-transparent backdrop that prevents interaction with background content.
|
|
54
|
+
* Includes fade animations and proper z-index stacking.
|
|
55
|
+
*/
|
|
56
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
57
|
+
type AlertDialogOverlayDocsProps = {
|
|
58
|
+
/** Render as child element, merging props and behavior @default false */
|
|
59
|
+
asChild?: boolean;
|
|
60
|
+
/** Force mount the component even when not open @default undefined */
|
|
61
|
+
forceMount?: boolean;
|
|
62
|
+
/** Additional CSS classes for styling */
|
|
63
|
+
className?: string;
|
|
64
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Overlay>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Props for AlertDialogContent (Documentation only - NOT used in component implementation)
|
|
68
|
+
*
|
|
69
|
+
* The main container for alert dialog content. Automatically handles portal
|
|
70
|
+
* rendering, overlay backdrop, and focus management.
|
|
71
|
+
*/
|
|
72
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
73
|
+
type AlertDialogContentDocsProps = {
|
|
74
|
+
/** Render as child element, merging props and behavior @default false */
|
|
75
|
+
asChild?: boolean;
|
|
76
|
+
/** Force mount the component even when not open @default undefined */
|
|
77
|
+
forceMount?: boolean;
|
|
78
|
+
/** Callback fired when focus moves to the trigger after opening @param event - Focus event */
|
|
79
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
80
|
+
/** Callback fired when focus moves to the trigger after closing @param event - Focus event */
|
|
81
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
82
|
+
/** Callback fired when Escape key is pressed @param event - Keyboard event */
|
|
83
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
84
|
+
/** Additional CSS classes for styling */
|
|
85
|
+
className?: string;
|
|
86
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Content>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Props for AlertDialogHeader (Documentation only - NOT used in component implementation)
|
|
90
|
+
*
|
|
91
|
+
* Container for the dialog title and description with consistent spacing
|
|
92
|
+
* and responsive alignment.
|
|
93
|
+
*/
|
|
94
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
95
|
+
type AlertDialogHeaderDocsProps = {
|
|
96
|
+
/** Additional CSS classes for styling */
|
|
97
|
+
className?: string;
|
|
98
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Props for AlertDialogFooter (Documentation only - NOT used in component implementation)
|
|
102
|
+
*
|
|
103
|
+
* Container for action buttons with responsive layout. Uses reverse column
|
|
104
|
+
* layout on mobile (cancel on top) and row layout on larger screens.
|
|
105
|
+
*/
|
|
106
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
107
|
+
type AlertDialogFooterDocsProps = {
|
|
108
|
+
/** Additional CSS classes for styling */
|
|
109
|
+
className?: string;
|
|
110
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Props for AlertDialogTitle (Documentation only - NOT used in component implementation)
|
|
114
|
+
*
|
|
115
|
+
* The main heading that describes what the alert dialog is asking.
|
|
116
|
+
* Provides proper ARIA labeling for accessibility.
|
|
117
|
+
*/
|
|
118
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
119
|
+
type AlertDialogTitleDocsProps = {
|
|
120
|
+
/** Render as child element, merging props and behavior @default false */
|
|
121
|
+
asChild?: boolean;
|
|
122
|
+
/** Additional CSS classes for styling */
|
|
123
|
+
className?: string;
|
|
124
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Title>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Props for AlertDialogDescription (Documentation only - NOT used in component implementation)
|
|
128
|
+
*
|
|
129
|
+
* Additional context and explanation for the alert dialog action.
|
|
130
|
+
* Provides proper ARIA description for accessibility.
|
|
131
|
+
*/
|
|
132
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
133
|
+
type AlertDialogDescriptionDocsProps = {
|
|
134
|
+
/** Render as child element, merging props and behavior @default false */
|
|
135
|
+
asChild?: boolean;
|
|
136
|
+
/** Additional CSS classes for styling */
|
|
137
|
+
className?: string;
|
|
138
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Description>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Props for AlertDialogAction (Documentation only - NOT used in component implementation)
|
|
142
|
+
*
|
|
143
|
+
* The primary action button that confirms or executes the alerted action.
|
|
144
|
+
* Receives focus automatically when dialog opens. Styled with button variants.
|
|
145
|
+
*/
|
|
146
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
147
|
+
type AlertDialogActionDocsProps = {
|
|
148
|
+
/** Render as child element, merging props and behavior @default false */
|
|
149
|
+
asChild?: boolean;
|
|
150
|
+
/** Additional CSS classes for styling (useful for destructive actions) */
|
|
151
|
+
className?: string;
|
|
152
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Action>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Props for AlertDialogCancel (Documentation only - NOT used in component implementation)
|
|
156
|
+
*
|
|
157
|
+
* The cancel button that dismisses the dialog without performing the action.
|
|
158
|
+
* Styled as outline variant by default to de-emphasize compared to action.
|
|
159
|
+
*/
|
|
160
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
161
|
+
type AlertDialogCancelDocsProps = {
|
|
162
|
+
/** Render as child element, merging props and behavior @default false */
|
|
163
|
+
asChild?: boolean;
|
|
164
|
+
/** Additional CSS classes for styling */
|
|
165
|
+
className?: string;
|
|
166
|
+
} & React.ComponentProps<typeof AlertDialogPrimitive.Cancel>;
|
|
167
|
+
|
|
7
168
|
/**
|
|
8
169
|
* Alert dialog component for critical confirmations and destructive actions
|
|
9
170
|
*
|
|
@@ -81,9 +242,27 @@ import { buttonVariants } from "@/components/ui/button";
|
|
|
81
242
|
* Root component of the alert dialog
|
|
82
243
|
*
|
|
83
244
|
* Provides the context and state management for the entire alert dialog.
|
|
84
|
-
* Controls the open/closed state and manages focus behavior.
|
|
245
|
+
* Controls the open/closed state and manages focus behavior. Alert dialogs
|
|
246
|
+
* are specifically designed for critical actions that require user attention
|
|
247
|
+
* and cannot be dismissed by clicking outside.
|
|
248
|
+
*
|
|
249
|
+
* @param defaultOpen - Whether the dialog is open initially (uncontrolled)
|
|
250
|
+
* @param open - Whether the dialog is open (controlled)
|
|
251
|
+
* @param onOpenChange - Callback when open state changes
|
|
252
|
+
* @param props - All other props forwarded to Radix AlertDialog.Root
|
|
85
253
|
*
|
|
86
|
-
* @
|
|
254
|
+
* @example
|
|
255
|
+
* ```tsx
|
|
256
|
+
* // Uncontrolled
|
|
257
|
+
* <AlertDialog defaultOpen={false}>
|
|
258
|
+
* // dialog content
|
|
259
|
+
* </AlertDialog>
|
|
260
|
+
*
|
|
261
|
+
* // Controlled
|
|
262
|
+
* <AlertDialog open={isOpen} onOpenChange={setIsOpen}>
|
|
263
|
+
* // dialog content
|
|
264
|
+
* </AlertDialog>
|
|
265
|
+
* ```
|
|
87
266
|
*/
|
|
88
267
|
function AlertDialog({
|
|
89
268
|
...props
|
|
@@ -95,15 +274,27 @@ function AlertDialog({
|
|
|
95
274
|
* Trigger element that opens the alert dialog
|
|
96
275
|
*
|
|
97
276
|
* The element that opens the alert dialog when activated. Usually a button,
|
|
98
|
-
* but can be any interactive element
|
|
99
|
-
*
|
|
277
|
+
* but can be any interactive element through composition. When opened, the dialog
|
|
278
|
+
* will trap focus and require user interaction before continuing.
|
|
100
279
|
*
|
|
101
|
-
* @param
|
|
280
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
281
|
+
* @param props - All other props forwarded to Radix AlertDialog.Trigger
|
|
102
282
|
*
|
|
103
283
|
* @example
|
|
104
284
|
* ```tsx
|
|
285
|
+
* // Direct usage
|
|
286
|
+
* <AlertDialogTrigger>
|
|
287
|
+
* Delete Account
|
|
288
|
+
* </AlertDialogTrigger>
|
|
289
|
+
*
|
|
290
|
+
* // Composition with Button component
|
|
291
|
+
* <AlertDialogTrigger asChild>
|
|
292
|
+
* <Button variant="destructive">Delete Account</Button>
|
|
293
|
+
* </AlertDialogTrigger>
|
|
294
|
+
*
|
|
295
|
+
* // Composition with custom element
|
|
105
296
|
* <AlertDialogTrigger asChild>
|
|
106
|
-
* <
|
|
297
|
+
* <button className="custom-trigger">Custom Trigger</button>
|
|
107
298
|
* </AlertDialogTrigger>
|
|
108
299
|
* ```
|
|
109
300
|
*/
|
|
@@ -122,7 +313,20 @@ function AlertDialogTrigger({
|
|
|
122
313
|
* This ensures the dialog appears above other content and is properly accessible.
|
|
123
314
|
* Usually not used directly - AlertDialogContent includes this automatically.
|
|
124
315
|
*
|
|
125
|
-
* @param
|
|
316
|
+
* @param forceMount - Force mount the component even when dialog is closed
|
|
317
|
+
* @param container - Container element to portal into (defaults to document.body)
|
|
318
|
+
* @param props - All other props forwarded to Radix AlertDialog.Portal
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```tsx
|
|
322
|
+
* // Custom portal container
|
|
323
|
+
* <AlertDialogPortal container={customContainer}>
|
|
324
|
+
* <AlertDialogOverlay />
|
|
325
|
+
* <AlertDialogPrimitive.Content>
|
|
326
|
+
* // content
|
|
327
|
+
* </AlertDialogPrimitive.Content>
|
|
328
|
+
* </AlertDialogPortal>
|
|
329
|
+
* ```
|
|
126
330
|
*/
|
|
127
331
|
function AlertDialogPortal({
|
|
128
332
|
...props
|
|
@@ -137,15 +341,28 @@ function AlertDialogPortal({
|
|
|
137
341
|
*
|
|
138
342
|
* A semi-transparent backdrop that covers the entire viewport when the dialog is open.
|
|
139
343
|
* Provides visual separation and prevents interaction with background content.
|
|
140
|
-
* Includes fade in/out animations
|
|
344
|
+
* Includes smooth fade in/out animations and proper z-index stacking.
|
|
345
|
+
*
|
|
346
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
347
|
+
* @param forceMount - Force mount the component even when dialog is closed
|
|
348
|
+
* @param className - Additional CSS classes for custom styling
|
|
349
|
+
* @param props - All other props forwarded to Radix AlertDialog.Overlay
|
|
141
350
|
*
|
|
142
|
-
* @
|
|
143
|
-
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```tsx
|
|
353
|
+
* // Custom overlay styling
|
|
354
|
+
* <AlertDialogOverlay className="bg-black/80" />
|
|
355
|
+
*
|
|
356
|
+
* // Force mounted overlay
|
|
357
|
+
* <AlertDialogOverlay forceMount className="custom-backdrop" />
|
|
358
|
+
* ```
|
|
144
359
|
*/
|
|
145
360
|
function AlertDialogOverlay({
|
|
146
361
|
className,
|
|
147
362
|
...props
|
|
148
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>
|
|
363
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay> & {
|
|
364
|
+
className?: string;
|
|
365
|
+
}) {
|
|
149
366
|
return (
|
|
150
367
|
<AlertDialogPrimitive.Overlay
|
|
151
368
|
data-slot="alert-dialog-overlay"
|
|
@@ -163,13 +380,20 @@ function AlertDialogOverlay({
|
|
|
163
380
|
*
|
|
164
381
|
* The primary container that holds all alert dialog content. Automatically includes
|
|
165
382
|
* the portal and overlay, and provides default styling with responsive design.
|
|
166
|
-
* Centered on screen with fade and zoom animations.
|
|
383
|
+
* Centered on screen with smooth fade and zoom animations. Manages focus trapping
|
|
384
|
+
* and keyboard navigation automatically.
|
|
167
385
|
*
|
|
168
|
-
* @param
|
|
169
|
-
* @param
|
|
386
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
387
|
+
* @param forceMount - Force mount the component even when dialog is closed
|
|
388
|
+
* @param onOpenAutoFocus - Callback when dialog opens and focus moves to content
|
|
389
|
+
* @param onCloseAutoFocus - Callback when dialog closes and focus returns to trigger
|
|
390
|
+
* @param onEscapeKeyDown - Callback when Escape key is pressed (can preventDefault)
|
|
391
|
+
* @param className - Additional CSS classes for custom styling
|
|
392
|
+
* @param props - All other props forwarded to Radix AlertDialog.Content
|
|
170
393
|
*
|
|
171
394
|
* @example
|
|
172
395
|
* ```tsx
|
|
396
|
+
* // Basic usage
|
|
173
397
|
* <AlertDialogContent>
|
|
174
398
|
* <AlertDialogHeader>
|
|
175
399
|
* <AlertDialogTitle>Confirm Action</AlertDialogTitle>
|
|
@@ -180,12 +404,35 @@ function AlertDialogOverlay({
|
|
|
180
404
|
* <AlertDialogAction>Continue</AlertDialogAction>
|
|
181
405
|
* </AlertDialogFooter>
|
|
182
406
|
* </AlertDialogContent>
|
|
407
|
+
*
|
|
408
|
+
* // Custom focus handling
|
|
409
|
+
* <AlertDialogContent
|
|
410
|
+
* onOpenAutoFocus={(e) => {
|
|
411
|
+
* e.preventDefault();
|
|
412
|
+
* customFocusTarget.focus();
|
|
413
|
+
* }}
|
|
414
|
+
* onEscapeKeyDown={(e) => {
|
|
415
|
+
* if (hasUnsavedChanges) {
|
|
416
|
+
* e.preventDefault();
|
|
417
|
+
* showUnsavedWarning();
|
|
418
|
+
* }
|
|
419
|
+
* }}
|
|
420
|
+
* >
|
|
421
|
+
* // content
|
|
422
|
+
* </AlertDialogContent>
|
|
423
|
+
*
|
|
424
|
+
* // Custom styling
|
|
425
|
+
* <AlertDialogContent className="max-w-md">
|
|
426
|
+
* // smaller dialog
|
|
427
|
+
* </AlertDialogContent>
|
|
183
428
|
* ```
|
|
184
429
|
*/
|
|
185
430
|
function AlertDialogContent({
|
|
186
431
|
className,
|
|
187
432
|
...props
|
|
188
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Content>
|
|
433
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
|
|
434
|
+
className?: string;
|
|
435
|
+
}) {
|
|
189
436
|
return (
|
|
190
437
|
<AlertDialogPortal>
|
|
191
438
|
<AlertDialogOverlay />
|
|
@@ -206,15 +453,32 @@ function AlertDialogContent({
|
|
|
206
453
|
*
|
|
207
454
|
* Contains the title and description of the alert dialog. Provides consistent
|
|
208
455
|
* spacing and alignment, with responsive text alignment (centered on mobile,
|
|
209
|
-
* left-aligned on larger screens).
|
|
456
|
+
* left-aligned on larger screens). Should contain AlertDialogTitle and
|
|
457
|
+
* optionally AlertDialogDescription for proper accessibility.
|
|
458
|
+
*
|
|
459
|
+
* @param className - Additional CSS classes for custom styling
|
|
460
|
+
* @param props - All other props forwarded to the underlying div element
|
|
210
461
|
*
|
|
211
|
-
* @
|
|
212
|
-
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```tsx
|
|
464
|
+
* <AlertDialogHeader>
|
|
465
|
+
* <AlertDialogTitle>Delete Account</AlertDialogTitle>
|
|
466
|
+
* <AlertDialogDescription>
|
|
467
|
+
* This will permanently delete your account and all associated data.
|
|
468
|
+
* This action cannot be undone.
|
|
469
|
+
* </AlertDialogDescription>
|
|
470
|
+
* </AlertDialogHeader>
|
|
471
|
+
*
|
|
472
|
+
* // Custom styling
|
|
473
|
+
* <AlertDialogHeader className="text-left">
|
|
474
|
+
* <AlertDialogTitle>Custom Header</AlertDialogTitle>
|
|
475
|
+
* </AlertDialogHeader>
|
|
476
|
+
* ```
|
|
213
477
|
*/
|
|
214
478
|
function AlertDialogHeader({
|
|
215
479
|
className,
|
|
216
480
|
...props
|
|
217
|
-
}: React.
|
|
481
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
218
482
|
return (
|
|
219
483
|
<div
|
|
220
484
|
data-slot="alert-dialog-header"
|
|
@@ -229,15 +493,35 @@ function AlertDialogHeader({
|
|
|
229
493
|
*
|
|
230
494
|
* Contains the action buttons (cancel and confirm). Uses responsive layout
|
|
231
495
|
* with stacked buttons on mobile (cancel on top) and horizontal layout
|
|
232
|
-
* on larger screens (cancel on left, action on right).
|
|
496
|
+
* on larger screens (cancel on left, action on right). Should contain
|
|
497
|
+
* AlertDialogCancel and AlertDialogAction for proper UX.
|
|
233
498
|
*
|
|
234
|
-
* @param className - Additional CSS classes
|
|
235
|
-
* @param props - All other props
|
|
499
|
+
* @param className - Additional CSS classes for custom styling
|
|
500
|
+
* @param props - All other props forwarded to the underlying div element
|
|
501
|
+
*
|
|
502
|
+
* @example
|
|
503
|
+
* ```tsx
|
|
504
|
+
* <AlertDialogFooter>
|
|
505
|
+
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
506
|
+
* <AlertDialogAction>Delete Account</AlertDialogAction>
|
|
507
|
+
* </AlertDialogFooter>
|
|
508
|
+
*
|
|
509
|
+
* // Custom button order
|
|
510
|
+
* <AlertDialogFooter className="flex-row">
|
|
511
|
+
* <AlertDialogAction>Continue</AlertDialogAction>
|
|
512
|
+
* <AlertDialogCancel>Go Back</AlertDialogCancel>
|
|
513
|
+
* </AlertDialogFooter>
|
|
514
|
+
*
|
|
515
|
+
* // Single action footer
|
|
516
|
+
* <AlertDialogFooter>
|
|
517
|
+
* <AlertDialogAction>I Understand</AlertDialogAction>
|
|
518
|
+
* </AlertDialogFooter>
|
|
519
|
+
* ```
|
|
236
520
|
*/
|
|
237
521
|
function AlertDialogFooter({
|
|
238
522
|
className,
|
|
239
523
|
...props
|
|
240
|
-
}: React.
|
|
524
|
+
}: React.HTMLAttributes<HTMLDivElement>) {
|
|
241
525
|
return (
|
|
242
526
|
<div
|
|
243
527
|
data-slot="alert-dialog-footer"
|
|
@@ -254,22 +538,37 @@ function AlertDialogFooter({
|
|
|
254
538
|
* Title heading of the alert dialog
|
|
255
539
|
*
|
|
256
540
|
* The main heading that describes the alert or action being confirmed.
|
|
257
|
-
* Automatically provides proper ARIA labeling for screen readers
|
|
258
|
-
* Should be concise and clearly state what the dialog is asking.
|
|
541
|
+
* Automatically provides proper ARIA labeling for screen readers via
|
|
542
|
+
* aria-labelledby. Should be concise and clearly state what the dialog is asking.
|
|
259
543
|
*
|
|
260
|
-
* @param
|
|
261
|
-
* @param
|
|
544
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
545
|
+
* @param className - Additional CSS classes for custom styling
|
|
546
|
+
* @param props - All other props forwarded to Radix AlertDialog.Title
|
|
262
547
|
*
|
|
263
548
|
* @example
|
|
264
549
|
* ```tsx
|
|
550
|
+
* // Standard titles
|
|
265
551
|
* <AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
266
552
|
* <AlertDialogTitle>Delete Account</AlertDialogTitle>
|
|
553
|
+
* <AlertDialogTitle>Confirm Sign Out</AlertDialogTitle>
|
|
554
|
+
*
|
|
555
|
+
* // Custom styling
|
|
556
|
+
* <AlertDialogTitle className="text-red-600 text-xl">
|
|
557
|
+
* Destructive Action
|
|
558
|
+
* </AlertDialogTitle>
|
|
559
|
+
*
|
|
560
|
+
* // Composition with custom element
|
|
561
|
+
* <AlertDialogTitle asChild>
|
|
562
|
+
* <h1 className="custom-title">Custom Title Element</h1>
|
|
563
|
+
* </AlertDialogTitle>
|
|
267
564
|
* ```
|
|
268
565
|
*/
|
|
269
566
|
function AlertDialogTitle({
|
|
270
567
|
className,
|
|
271
568
|
...props
|
|
272
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Title>
|
|
569
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Title> & {
|
|
570
|
+
className?: string;
|
|
571
|
+
}) {
|
|
273
572
|
return (
|
|
274
573
|
<AlertDialogPrimitive.Title
|
|
275
574
|
data-slot="alert-dialog-title"
|
|
@@ -284,23 +583,45 @@ function AlertDialogTitle({
|
|
|
284
583
|
*
|
|
285
584
|
* Provides additional context and explanation for the alert or action.
|
|
286
585
|
* Should clearly explain the consequences of the action being confirmed.
|
|
287
|
-
* Automatically provides proper ARIA description
|
|
586
|
+
* Automatically provides proper ARIA description via aria-describedby for
|
|
587
|
+
* screen readers. Can be omitted if aria-describedby is provided to Content.
|
|
288
588
|
*
|
|
289
|
-
* @param
|
|
290
|
-
* @param
|
|
589
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
590
|
+
* @param className - Additional CSS classes for custom styling
|
|
591
|
+
* @param props - All other props forwarded to Radix AlertDialog.Description
|
|
291
592
|
*
|
|
292
593
|
* @example
|
|
293
594
|
* ```tsx
|
|
595
|
+
* // Standard descriptions
|
|
294
596
|
* <AlertDialogDescription>
|
|
295
597
|
* This action cannot be undone. This will permanently delete your
|
|
296
598
|
* account and remove your data from our servers.
|
|
297
599
|
* </AlertDialogDescription>
|
|
600
|
+
*
|
|
601
|
+
* <AlertDialogDescription>
|
|
602
|
+
* You will be signed out of all devices and will need to sign in again
|
|
603
|
+
* to access your account.
|
|
604
|
+
* </AlertDialogDescription>
|
|
605
|
+
*
|
|
606
|
+
* // Custom styling
|
|
607
|
+
* <AlertDialogDescription className="text-center text-lg">
|
|
608
|
+
* Are you sure you want to continue?
|
|
609
|
+
* </AlertDialogDescription>
|
|
610
|
+
*
|
|
611
|
+
* // Composition with custom element
|
|
612
|
+
* <AlertDialogDescription asChild>
|
|
613
|
+
* <p className="custom-description">
|
|
614
|
+
* Custom description element
|
|
615
|
+
* </p>
|
|
616
|
+
* </AlertDialogDescription>
|
|
298
617
|
* ```
|
|
299
618
|
*/
|
|
300
619
|
function AlertDialogDescription({
|
|
301
620
|
className,
|
|
302
621
|
...props
|
|
303
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Description>
|
|
622
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Description> & {
|
|
623
|
+
className?: string;
|
|
624
|
+
}) {
|
|
304
625
|
return (
|
|
305
626
|
<AlertDialogPrimitive.Description
|
|
306
627
|
data-slot="alert-dialog-description"
|
|
@@ -314,28 +635,44 @@ function AlertDialogDescription({
|
|
|
314
635
|
* Primary action button of the alert dialog
|
|
315
636
|
*
|
|
316
637
|
* The button that confirms or executes the action being alerted about.
|
|
317
|
-
* Automatically receives focus when the dialog opens
|
|
318
|
-
*
|
|
319
|
-
* Closes the dialog when clicked.
|
|
638
|
+
* Automatically receives focus when the dialog opens (unless overridden).
|
|
639
|
+
* Styled using buttonVariants() by default, but can be customized for
|
|
640
|
+
* destructive actions. Closes the dialog when clicked.
|
|
320
641
|
*
|
|
321
|
-
* @param
|
|
322
|
-
* @param
|
|
642
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
643
|
+
* @param className - Additional CSS classes (useful for destructive styling)
|
|
644
|
+
* @param props - All other props forwarded to Radix AlertDialog.Action
|
|
323
645
|
*
|
|
324
646
|
* @example
|
|
325
647
|
* ```tsx
|
|
326
|
-
* // Default action
|
|
648
|
+
* // Default action (primary button style)
|
|
327
649
|
* <AlertDialogAction>Continue</AlertDialogAction>
|
|
650
|
+
* <AlertDialogAction>Save Changes</AlertDialogAction>
|
|
328
651
|
*
|
|
329
|
-
* // Destructive action
|
|
330
|
-
* <AlertDialogAction className=
|
|
652
|
+
* // Destructive action with red styling
|
|
653
|
+
* <AlertDialogAction className={buttonVariants({ variant: "destructive" })}>
|
|
331
654
|
* Delete Account
|
|
332
655
|
* </AlertDialogAction>
|
|
656
|
+
*
|
|
657
|
+
* // Custom styled action
|
|
658
|
+
* <AlertDialogAction className="bg-green-600 hover:bg-green-700">
|
|
659
|
+
* Confirm Action
|
|
660
|
+
* </AlertDialogAction>
|
|
661
|
+
*
|
|
662
|
+
* // Composition with custom button
|
|
663
|
+
* <AlertDialogAction asChild>
|
|
664
|
+
* <Button variant="destructive" size="lg">
|
|
665
|
+
* Delete Forever
|
|
666
|
+
* </Button>
|
|
667
|
+
* </AlertDialogAction>
|
|
333
668
|
* ```
|
|
334
669
|
*/
|
|
335
670
|
function AlertDialogAction({
|
|
336
671
|
className,
|
|
337
672
|
...props
|
|
338
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Action>
|
|
673
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Action> & {
|
|
674
|
+
className?: string;
|
|
675
|
+
}) {
|
|
339
676
|
return (
|
|
340
677
|
<AlertDialogPrimitive.Action
|
|
341
678
|
className={cn(buttonVariants(), className)}
|
|
@@ -348,22 +685,40 @@ function AlertDialogAction({
|
|
|
348
685
|
* Cancel button of the alert dialog
|
|
349
686
|
*
|
|
350
687
|
* The button that dismisses the dialog without performing the action.
|
|
351
|
-
* Styled
|
|
352
|
-
* the primary action. Closes the dialog when clicked
|
|
688
|
+
* Styled using outline variant by default to de-emphasize compared to
|
|
689
|
+
* the primary action. Closes the dialog when clicked without triggering
|
|
690
|
+
* the main action.
|
|
353
691
|
*
|
|
354
|
-
* @param
|
|
355
|
-
* @param
|
|
692
|
+
* @param asChild - Render as child element, merging props and behavior
|
|
693
|
+
* @param className - Additional CSS classes for custom styling
|
|
694
|
+
* @param props - All other props forwarded to Radix AlertDialog.Cancel
|
|
356
695
|
*
|
|
357
696
|
* @example
|
|
358
697
|
* ```tsx
|
|
698
|
+
* // Standard cancel buttons
|
|
359
699
|
* <AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
360
700
|
* <AlertDialogCancel>No, keep it</AlertDialogCancel>
|
|
701
|
+
* <AlertDialogCancel>Go Back</AlertDialogCancel>
|
|
702
|
+
*
|
|
703
|
+
* // Custom styled cancel
|
|
704
|
+
* <AlertDialogCancel className="text-red-600">
|
|
705
|
+
* Don't Delete
|
|
706
|
+
* </AlertDialogCancel>
|
|
707
|
+
*
|
|
708
|
+
* // Composition with custom button
|
|
709
|
+
* <AlertDialogCancel asChild>
|
|
710
|
+
* <Button variant="ghost" size="sm">
|
|
711
|
+
* Maybe Later
|
|
712
|
+
* </Button>
|
|
713
|
+
* </AlertDialogCancel>
|
|
361
714
|
* ```
|
|
362
715
|
*/
|
|
363
716
|
function AlertDialogCancel({
|
|
364
717
|
className,
|
|
365
718
|
...props
|
|
366
|
-
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>
|
|
719
|
+
}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> & {
|
|
720
|
+
className?: string;
|
|
721
|
+
}) {
|
|
367
722
|
return (
|
|
368
723
|
<AlertDialogPrimitive.Cancel
|
|
369
724
|
className={cn(buttonVariants({ variant: "outline" }), className)}
|