@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,164 @@ import { XIcon } from "lucide-react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Props for Dialog component (Documentation only - NOT used in component implementation)
|
|
9
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
12
|
+
type DialogDocsProps = {
|
|
13
|
+
/** The controlled open state of the dialog. Must be used in conjunction with onOpenChange */
|
|
14
|
+
open?: boolean;
|
|
15
|
+
/** The open state of the dialog when it is initially rendered. Use when you do not need to control its open state @default false */
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
/** Event handler called when the open state of the dialog changes */
|
|
18
|
+
onOpenChange?: (open: boolean) => void;
|
|
19
|
+
/** The modality of the dialog. When set to true, interaction with outside elements will be disabled and only dialog content will be visible to screen readers @default true */
|
|
20
|
+
modal?: boolean;
|
|
21
|
+
/** Child components including DialogTrigger and DialogContent */
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Props for DialogTrigger component (Documentation only - NOT used in component implementation)
|
|
27
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
28
|
+
*/
|
|
29
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
30
|
+
type DialogTriggerDocsProps = {
|
|
31
|
+
/** Render the trigger as its child element when true, merging their props and behavior @default false */
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
/** Additional CSS classes for styling */
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Content to display in the trigger (typically a button or interactive element) */
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Props for DialogPortal component (Documentation only - NOT used in component implementation)
|
|
41
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
44
|
+
type DialogPortalDocsProps = {
|
|
45
|
+
/** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
|
|
46
|
+
forceMount?: boolean;
|
|
47
|
+
/** Specify a container element to portal the content into @default document.body */
|
|
48
|
+
container?: HTMLElement;
|
|
49
|
+
/** Child components to portal (typically DialogOverlay and DialogContent) */
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Props for DialogClose component (Documentation only - NOT used in component implementation)
|
|
55
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
56
|
+
*/
|
|
57
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
58
|
+
type DialogCloseDocsProps = {
|
|
59
|
+
/** Render the close button as its child element when true, merging their props and behavior @default false */
|
|
60
|
+
asChild?: boolean;
|
|
61
|
+
/** Additional CSS classes for styling */
|
|
62
|
+
className?: string;
|
|
63
|
+
/** Content to display in the close button */
|
|
64
|
+
children?: React.ReactNode;
|
|
65
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Props for DialogOverlay component (Documentation only - NOT used in component implementation)
|
|
69
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
70
|
+
*/
|
|
71
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
72
|
+
type DialogOverlayDocsProps = {
|
|
73
|
+
/** Render the overlay as its child element when true, merging their props and behavior @default false */
|
|
74
|
+
asChild?: boolean;
|
|
75
|
+
/** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
|
|
76
|
+
forceMount?: boolean;
|
|
77
|
+
/** Additional CSS classes for custom styling */
|
|
78
|
+
className?: string;
|
|
79
|
+
/** Child components (rarely used for overlays) */
|
|
80
|
+
children?: React.ReactNode;
|
|
81
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Props for DialogContent component (Documentation only - NOT used in component implementation)
|
|
85
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
86
|
+
*/
|
|
87
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
88
|
+
type DialogContentDocsProps = {
|
|
89
|
+
/** Render the content as its child element when true, merging their props and behavior @default false */
|
|
90
|
+
asChild?: boolean;
|
|
91
|
+
/** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
|
|
92
|
+
forceMount?: boolean;
|
|
93
|
+
/** Event handler called when focus moves into the component after opening. It can be prevented by calling event.preventDefault */
|
|
94
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
95
|
+
/** Event handler called when focus moves to the trigger after closing. It can be prevented by calling event.preventDefault */
|
|
96
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
97
|
+
/** Event handler called when the escape key is down. It can be prevented by calling event.preventDefault */
|
|
98
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
99
|
+
/** Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling event.preventDefault */
|
|
100
|
+
onPointerDownOutside?: (event: PointerEvent) => void;
|
|
101
|
+
/** Event handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling event.preventDefault */
|
|
102
|
+
onInteractOutside?: (
|
|
103
|
+
event: React.FocusEvent | MouseEvent | TouchEvent,
|
|
104
|
+
) => void;
|
|
105
|
+
/** Whether to show the X close button in top-right corner @default true */
|
|
106
|
+
showCloseButton?: boolean;
|
|
107
|
+
/** Additional CSS classes for styling the content container */
|
|
108
|
+
className?: string;
|
|
109
|
+
/** Dialog content including header, body, and footer elements */
|
|
110
|
+
children?: React.ReactNode;
|
|
111
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Props for DialogHeader component (Documentation only - NOT used in component implementation)
|
|
115
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
116
|
+
*/
|
|
117
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
118
|
+
type DialogHeaderDocsProps = {
|
|
119
|
+
/** Additional CSS classes for styling */
|
|
120
|
+
className?: string;
|
|
121
|
+
/** Header content including DialogTitle and DialogDescription */
|
|
122
|
+
children?: React.ReactNode;
|
|
123
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Props for DialogFooter component (Documentation only - NOT used in component implementation)
|
|
127
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
128
|
+
*/
|
|
129
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
130
|
+
type DialogFooterDocsProps = {
|
|
131
|
+
/** Additional CSS classes for styling */
|
|
132
|
+
className?: string;
|
|
133
|
+
/** Footer content typically containing action buttons */
|
|
134
|
+
children?: React.ReactNode;
|
|
135
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Props for DialogTitle component (Documentation only - NOT used in component implementation)
|
|
139
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
140
|
+
*/
|
|
141
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
142
|
+
type DialogTitleDocsProps = {
|
|
143
|
+
/** Render the title as its child element when true, merging their props and behavior @default false */
|
|
144
|
+
asChild?: boolean;
|
|
145
|
+
/** Additional CSS classes for styling */
|
|
146
|
+
className?: string;
|
|
147
|
+
/** Title content (text or components) */
|
|
148
|
+
children?: React.ReactNode;
|
|
149
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Props for DialogDescription component (Documentation only - NOT used in component implementation)
|
|
153
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
154
|
+
*/
|
|
155
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
156
|
+
type DialogDescriptionDocsProps = {
|
|
157
|
+
/** Render the description as its child element when true, merging their props and behavior @default false */
|
|
158
|
+
asChild?: boolean;
|
|
159
|
+
/** Additional CSS classes for styling */
|
|
160
|
+
className?: string;
|
|
161
|
+
/** Description content (text or components) */
|
|
162
|
+
children?: React.ReactNode;
|
|
163
|
+
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
164
|
+
|
|
7
165
|
/**
|
|
8
166
|
* Dialog - A modal dialog component for important content or actions
|
|
9
167
|
*
|
|
@@ -14,7 +172,6 @@ import { cn } from "@/lib/utils";
|
|
|
14
172
|
* Use dialogs for critical interactions, confirmations, forms, or detailed information that
|
|
15
173
|
* requires user focus and prevents interaction with the background content.
|
|
16
174
|
*
|
|
17
|
-
* @component
|
|
18
175
|
* @example
|
|
19
176
|
* ```tsx
|
|
20
177
|
* // Basic confirmation dialog
|
|
@@ -99,22 +256,18 @@ import { cn } from "@/lib/utils";
|
|
|
99
256
|
* - Focus returns to trigger element when dialog closes
|
|
100
257
|
* - Background content becomes inert (non-interactive)
|
|
101
258
|
* - Keyboard navigation between focusable elements
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* @
|
|
106
|
-
* @
|
|
107
|
-
*
|
|
108
|
-
* @see {@link
|
|
109
|
-
* @see {@link
|
|
110
|
-
* @see {@link
|
|
111
|
-
* @see {@link Sheet} - For side panel overlays
|
|
112
|
-
* @see {@link Drawer} - For mobile-friendly bottom overlays
|
|
259
|
+
* - Space/Enter keys open and close dialog
|
|
260
|
+
* - Tab/Shift+Tab moves focus between interactive elements
|
|
261
|
+
*
|
|
262
|
+
* @see {@link https://ui.shadcn.com/docs/components/dialog} shadcn/ui Dialog documentation
|
|
263
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/dialog} Radix UI Dialog primitives
|
|
264
|
+
* @see {@link DialogTrigger} Button that opens the dialog
|
|
265
|
+
* @see {@link DialogContent} Main content container with overlay and portal
|
|
266
|
+
* @see {@link DialogHeader} Container for title and description
|
|
267
|
+
* @see {@link DialogFooter} Container for action buttons
|
|
113
268
|
* @since 1.0.0
|
|
114
269
|
*/
|
|
115
|
-
function Dialog({
|
|
116
|
-
...props
|
|
117
|
-
}: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
270
|
+
function Dialog(props: React.ComponentProps<typeof DialogPrimitive.Root>) {
|
|
118
271
|
return <DialogPrimitive.Root data-slot="dialog" {...props} />;
|
|
119
272
|
}
|
|
120
273
|
|
|
@@ -122,20 +275,37 @@ function Dialog({
|
|
|
122
275
|
* DialogTrigger - The element that opens the dialog when clicked
|
|
123
276
|
*
|
|
124
277
|
* Typically wraps a button or other interactive element. Use asChild
|
|
125
|
-
* prop to render as the child element instead of a button.
|
|
278
|
+
* prop to render as the child element instead of a button. The trigger
|
|
279
|
+
* automatically receives focus management and ARIA attributes.
|
|
126
280
|
*
|
|
127
|
-
* @component
|
|
128
281
|
* @example
|
|
129
282
|
* ```tsx
|
|
130
283
|
* <DialogTrigger asChild>
|
|
131
284
|
* <Button>Open Dialog</Button>
|
|
132
285
|
* </DialogTrigger>
|
|
133
286
|
* ```
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```tsx
|
|
290
|
+
* // Direct button without asChild
|
|
291
|
+
* <DialogTrigger className="custom-trigger-style">
|
|
292
|
+
* Click to open
|
|
293
|
+
* </DialogTrigger>
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @accessibility
|
|
297
|
+
* - Automatically receives aria-expanded attribute based on dialog state
|
|
298
|
+
* - Keyboard activation with Space and Enter keys
|
|
299
|
+
* - Focus returns here when dialog closes
|
|
300
|
+
* - Screen reader compatible with role="button" when used as direct element
|
|
301
|
+
*
|
|
302
|
+
* @see {@link Dialog} The root dialog container
|
|
303
|
+
* @see {@link DialogContent} The content opened by this trigger
|
|
134
304
|
* @since 1.0.0
|
|
135
305
|
*/
|
|
136
|
-
function DialogTrigger(
|
|
137
|
-
|
|
138
|
-
|
|
306
|
+
function DialogTrigger(
|
|
307
|
+
props: React.ComponentProps<typeof DialogPrimitive.Trigger>,
|
|
308
|
+
) {
|
|
139
309
|
return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
|
|
140
310
|
}
|
|
141
311
|
|
|
@@ -143,14 +313,32 @@ function DialogTrigger({
|
|
|
143
313
|
* DialogPortal - Portal container for dialog content
|
|
144
314
|
*
|
|
145
315
|
* Renders dialog content in a React portal at the end of the document body.
|
|
146
|
-
* This ensures proper stacking context and prevents z-index issues.
|
|
316
|
+
* This ensures proper stacking context and prevents z-index issues. Rarely
|
|
317
|
+
* used directly - typically included automatically by DialogContent.
|
|
147
318
|
*
|
|
148
|
-
* @
|
|
319
|
+
* @example
|
|
320
|
+
* ```tsx
|
|
321
|
+
* // Custom portal container
|
|
322
|
+
* const [container, setContainer] = useState(null);
|
|
323
|
+
*
|
|
324
|
+
* <DialogPortal container={container}>
|
|
325
|
+
* <DialogOverlay />
|
|
326
|
+
* <DialogContent>Portal content</DialogContent>
|
|
327
|
+
* </DialogPortal>
|
|
328
|
+
* <div ref={setContainer} />
|
|
329
|
+
* ```
|
|
330
|
+
*
|
|
331
|
+
* @accessibility
|
|
332
|
+
* - Ensures dialog renders outside normal DOM flow for proper focus management
|
|
333
|
+
* - Maintains proper stacking order for screen readers
|
|
334
|
+
* - Portal location doesn't affect ARIA relationships
|
|
335
|
+
*
|
|
336
|
+
* @see {@link DialogContent} Component that typically includes this portal
|
|
149
337
|
* @since 1.0.0
|
|
150
338
|
*/
|
|
151
|
-
function DialogPortal(
|
|
152
|
-
|
|
153
|
-
|
|
339
|
+
function DialogPortal(
|
|
340
|
+
props: React.ComponentProps<typeof DialogPrimitive.Portal>,
|
|
341
|
+
) {
|
|
154
342
|
return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
|
|
155
343
|
}
|
|
156
344
|
|
|
@@ -159,19 +347,47 @@ function DialogPortal({
|
|
|
159
347
|
*
|
|
160
348
|
* Can be placed anywhere within DialogContent to provide a close action.
|
|
161
349
|
* Typically used for custom close buttons in addition to the default X button.
|
|
350
|
+
* Automatically closes the dialog when activated and returns focus to the trigger.
|
|
162
351
|
*
|
|
163
|
-
* @component
|
|
164
352
|
* @example
|
|
165
353
|
* ```tsx
|
|
166
354
|
* <DialogClose asChild>
|
|
167
355
|
* <Button variant="outline">Cancel</Button>
|
|
168
356
|
* </DialogClose>
|
|
169
357
|
* ```
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```tsx
|
|
361
|
+
* // Direct button without asChild
|
|
362
|
+
* <DialogClose className="close-button">
|
|
363
|
+
* Close Dialog
|
|
364
|
+
* </DialogClose>
|
|
365
|
+
* ```
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```tsx
|
|
369
|
+
* // In footer with multiple actions
|
|
370
|
+
* <DialogFooter>
|
|
371
|
+
* <DialogClose asChild>
|
|
372
|
+
* <Button variant="outline">Cancel</Button>
|
|
373
|
+
* </DialogClose>
|
|
374
|
+
* <Button type="submit">Save</Button>
|
|
375
|
+
* </DialogFooter>
|
|
376
|
+
* ```
|
|
377
|
+
*
|
|
378
|
+
* @accessibility
|
|
379
|
+
* - Keyboard activation with Space and Enter keys
|
|
380
|
+
* - Screen reader compatible with proper labeling
|
|
381
|
+
* - Focus management returns to dialog trigger
|
|
382
|
+
* - Can be used as implicit cancel action
|
|
383
|
+
*
|
|
384
|
+
* @see {@link DialogContent} Container that includes the default close button
|
|
385
|
+
* @see {@link Dialog} Root component for controlling open state
|
|
170
386
|
* @since 1.0.0
|
|
171
387
|
*/
|
|
172
|
-
function DialogClose(
|
|
173
|
-
|
|
174
|
-
|
|
388
|
+
function DialogClose(
|
|
389
|
+
props: React.ComponentProps<typeof DialogPrimitive.Close>,
|
|
390
|
+
) {
|
|
175
391
|
return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
|
|
176
392
|
}
|
|
177
393
|
|
|
@@ -179,12 +395,33 @@ function DialogClose({
|
|
|
179
395
|
* DialogOverlay - The backdrop overlay behind the dialog
|
|
180
396
|
*
|
|
181
397
|
* Provides a semi-transparent background that covers the main content.
|
|
182
|
-
* Clicking the overlay will close the dialog by default.
|
|
398
|
+
* Clicking the overlay will close the dialog by default. Features smooth
|
|
399
|
+
* fade animations using Tailwind CSS and proper z-index stacking.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```tsx
|
|
403
|
+
* // Custom overlay styling
|
|
404
|
+
* <DialogOverlay className="bg-red-500/20 backdrop-blur-sm" />
|
|
405
|
+
* ```
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* ```tsx
|
|
409
|
+
* // Typically used automatically within DialogContent
|
|
410
|
+
* <DialogContent>
|
|
411
|
+
* // DialogOverlay is included automatically
|
|
412
|
+
* <DialogTitle>Dialog content</DialogTitle>
|
|
413
|
+
* </DialogContent>
|
|
414
|
+
* ```
|
|
183
415
|
*
|
|
184
|
-
* @component
|
|
185
416
|
* @accessibility
|
|
186
|
-
* - Prevents interaction with background content
|
|
187
|
-
* - Can be clicked to dismiss dialog (
|
|
417
|
+
* - Prevents interaction with background content (makes it inert)
|
|
418
|
+
* - Can be clicked to dismiss dialog (respects modal prop)
|
|
419
|
+
* - Proper z-index ensures overlay appears above page content
|
|
420
|
+
* - Fade animations respect prefers-reduced-motion settings
|
|
421
|
+
* - Background becomes non-focusable when dialog is open
|
|
422
|
+
*
|
|
423
|
+
* @see {@link DialogContent} Component that typically includes this overlay
|
|
424
|
+
* @see {@link DialogPortal} Portal container for rendering overlay
|
|
188
425
|
* @since 1.0.0
|
|
189
426
|
*/
|
|
190
427
|
function DialogOverlay({
|