@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
|
@@ -1,75 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* DatePicker - A comprehensive date selection component with popover calendar interface
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The currently selected date value. When undefined, no date is selected.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* const [selectedDate, setSelectedDate] = useState<Date>();
|
|
14
|
-
* <DatePicker date={selectedDate} onDateChange={setSelectedDate} />
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
date?: Date;
|
|
18
|
-
/**
|
|
19
|
-
* Callback function invoked when the user selects or clears a date.
|
|
20
|
-
* Receives the selected date or undefined when cleared.
|
|
21
|
-
*
|
|
22
|
-
* @param date - The newly selected date or undefined if cleared
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```tsx
|
|
26
|
-
* <DatePicker onDateChange={(date) => console.log('Selected:', date)} />
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
onDateChange?: (date: Date | undefined) => void;
|
|
30
|
-
/**
|
|
31
|
-
* Placeholder text displayed in the trigger button when no date is selected.
|
|
32
|
-
* Provides context about what kind of date selection is expected.
|
|
33
|
-
*
|
|
34
|
-
* @default "Pick a date"
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```tsx
|
|
38
|
-
* <DatePicker placeholder="Select your birthday" />
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
placeholder?: string;
|
|
42
|
-
/**
|
|
43
|
-
* When true, disables the date picker preventing user interaction.
|
|
44
|
-
* The trigger button will appear disabled and the popover cannot be opened.
|
|
45
|
-
*
|
|
46
|
-
* @default false
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* ```tsx
|
|
50
|
-
* <DatePicker disabled={true} placeholder="Date locked" />
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
disabled?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Additional CSS classes to apply to the trigger button.
|
|
56
|
-
* Useful for customizing width, spacing, or other styling.
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```tsx
|
|
60
|
-
* <DatePicker className="w-full" /> // Full width
|
|
61
|
-
* <DatePicker className="w-[300px]" /> // Fixed width
|
|
62
|
-
* ```
|
|
63
|
-
*/
|
|
64
|
-
className?: string;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* A comprehensive date selection component that combines an accessible button trigger
|
|
68
|
-
* with a full-featured calendar popover for intuitive date picking.
|
|
4
|
+
* A polished date selection component that combines an accessible trigger button with a
|
|
5
|
+
* full-featured calendar popover. Built on Radix UI Popover and Calendar primitives with
|
|
6
|
+
* shadcn/ui styling, providing intuitive date selection with proper accessibility,
|
|
7
|
+
* keyboard navigation, automatic positioning, and internationalization support.
|
|
69
8
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
9
|
+
* The component handles both controlled and uncontrolled usage patterns, integrates
|
|
10
|
+
* seamlessly with forms and validation systems, and provides consistent date formatting
|
|
11
|
+
* using date-fns. The popover automatically positions itself to stay within viewport
|
|
12
|
+
* bounds and includes smooth animations for a polished user experience.
|
|
73
13
|
*
|
|
74
14
|
* @component
|
|
75
15
|
* @example
|
|
@@ -119,27 +59,114 @@ type DatePickerProps = {
|
|
|
119
59
|
* ```
|
|
120
60
|
*
|
|
121
61
|
* @accessibility
|
|
122
|
-
* - **Keyboard Navigation**:
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
62
|
+
* - **Keyboard Navigation**:
|
|
63
|
+
* - Tab to focus the trigger button
|
|
64
|
+
* - Enter/Space to open calendar popover
|
|
65
|
+
* - Arrow keys for date navigation within calendar
|
|
66
|
+
* - Escape to close popover and return focus to trigger
|
|
67
|
+
* - Page Up/Down for month navigation
|
|
68
|
+
* - Home/End for week start/end navigation
|
|
69
|
+
* - **Screen Reader Support**:
|
|
70
|
+
* - Proper ARIA labels describing the date picker purpose
|
|
71
|
+
* - Live region announcements for date selection changes
|
|
72
|
+
* - Calendar grid structure announced correctly
|
|
73
|
+
* - Selected date clearly announced with full formatting
|
|
74
|
+
* - **Focus Management**:
|
|
75
|
+
* - Visible focus indicators with 3px ring on trigger button
|
|
76
|
+
* - Focus trapped within calendar when popover is open
|
|
77
|
+
* - Focus returns to trigger button when popover closes
|
|
78
|
+
* - Initial focus on today's date or selected date when opening
|
|
79
|
+
* - **Visual Indicators**:
|
|
80
|
+
* - Clear visual states for disabled, selected, and focused elements
|
|
81
|
+
* - High contrast borders and backgrounds meeting WCAG 2.1 AA standards
|
|
82
|
+
* - Consistent color coding for different date states
|
|
83
|
+
* - Reduced opacity for disabled state with appropriate cursor
|
|
84
|
+
* - **Date Formatting**:
|
|
85
|
+
* - Consistent date presentation using date-fns localized formatting
|
|
86
|
+
* - Full date format (e.g., "Wednesday, January 15, 2025") for clarity
|
|
87
|
+
* - Placeholder text provides clear guidance about expected input
|
|
127
88
|
*
|
|
128
89
|
* @features
|
|
129
|
-
* - Single date selection with visual confirmation
|
|
130
|
-
* - Popover-
|
|
131
|
-
* - Automatic
|
|
132
|
-
* -
|
|
133
|
-
* - Customizable trigger button
|
|
134
|
-
* - Date formatting
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
90
|
+
* - **Date Selection**: Single date selection with immediate visual confirmation
|
|
91
|
+
* - **Popover Interface**: Non-modal calendar popover that doesn't disrupt page layout
|
|
92
|
+
* - **Smart Positioning**: Automatic positioning with collision detection and boundary awareness
|
|
93
|
+
* - **State Management**: Flexible controlled/uncontrolled patterns with internal state fallback
|
|
94
|
+
* - **Customizable Styling**: Full control over trigger button appearance, width, and spacing
|
|
95
|
+
* - **Internationalization**: Date formatting with date-fns supporting multiple locales
|
|
96
|
+
* - **Form Integration**: Seamless integration with form libraries and validation systems
|
|
97
|
+
* - **Performance**: Optimized rendering with minimal re-renders and efficient state updates
|
|
98
|
+
* - **Animation**: Smooth open/close animations with proper state transitions
|
|
99
|
+
* - **Mobile Support**: Touch-friendly interface with appropriate sizing and spacing
|
|
100
|
+
*
|
|
101
|
+
* @implementation
|
|
102
|
+
* The DatePicker component is implemented as a composition of:
|
|
103
|
+
* - **Popover**: Radix UI primitive providing positioning, portal rendering, and focus management
|
|
104
|
+
* - **PopoverTrigger**: Button element that opens the calendar (uses asChild pattern)
|
|
105
|
+
* - **PopoverContent**: Container for the calendar with auto-positioning
|
|
106
|
+
* - **Calendar**: Full-featured calendar component with keyboard navigation
|
|
107
|
+
* - **Button**: Styled trigger with outline variant and calendar icon
|
|
108
|
+
*
|
|
109
|
+
* State is managed internally with React.useState hooks and synchronized with external
|
|
110
|
+
* props through React.useEffect. The component automatically handles date formatting
|
|
111
|
+
* using date-fns format function with "PPP" pattern for readable date display.
|
|
112
|
+
*
|
|
113
|
+
* @usage-patterns
|
|
114
|
+
* **Controlled Pattern** (Recommended):
|
|
115
|
+
* ```tsx
|
|
116
|
+
* const [date, setDate] = useState<Date>();
|
|
117
|
+
* <DatePicker date={date} onDateChange={setDate} />
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* **Form Library Integration**:
|
|
121
|
+
* ```tsx
|
|
122
|
+
* // React Hook Form
|
|
123
|
+
* <Controller render={({ field }) =>
|
|
124
|
+
* <DatePicker date={field.value} onDateChange={field.onChange} />
|
|
125
|
+
* } />
|
|
126
|
+
*
|
|
127
|
+
* // Formik
|
|
128
|
+
* <Field name="date">
|
|
129
|
+
* {({ field, form }) => (
|
|
130
|
+
* <DatePicker
|
|
131
|
+
* date={field.value}
|
|
132
|
+
* onDateChange={(date) => form.setFieldValue('date', date)}
|
|
133
|
+
* />
|
|
134
|
+
* )}
|
|
135
|
+
* </Field>
|
|
136
|
+
* ```
|
|
137
|
+
*
|
|
138
|
+
* **Validation Integration**:
|
|
139
|
+
* ```tsx
|
|
140
|
+
* const handleDateChange = (date: Date | undefined) => {
|
|
141
|
+
* // Validate date before setting
|
|
142
|
+
* if (date && isValidDate(date)) {
|
|
143
|
+
* setDate(date);
|
|
144
|
+
* clearError();
|
|
145
|
+
* } else {
|
|
146
|
+
* setError('Please select a valid date');
|
|
147
|
+
* }
|
|
148
|
+
* };
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @see {@link Calendar} The underlying calendar component with full date navigation
|
|
152
|
+
* @see {@link Popover} The popover container component for positioning and portal rendering
|
|
153
|
+
* @see {@link PopoverTrigger} Trigger element that opens the calendar popover
|
|
154
|
+
* @see {@link PopoverContent} Content container for the calendar with auto-positioning
|
|
155
|
+
* @see {@link Button} The styled trigger button with variant support
|
|
156
|
+
* @see {@link https://ui.shadcn.com/docs/components/date-picker} shadcn/ui Date Picker documentation
|
|
157
|
+
* @see {@link https://ui.shadcn.com/docs/components/calendar} shadcn/ui Calendar component
|
|
158
|
+
* @see {@link https://ui.shadcn.com/docs/components/popover} shadcn/ui Popover component
|
|
159
|
+
* @see {@link https://date-fns.org/docs/format} date-fns formatting documentation
|
|
160
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/popover} Radix UI Popover primitives
|
|
140
161
|
*
|
|
141
162
|
* @since 1.0.0
|
|
142
163
|
*/
|
|
143
|
-
declare function DatePicker({ date, onDateChange, placeholder, disabled, className, }:
|
|
164
|
+
declare function DatePicker({ date, onDateChange, placeholder, disabled, className, }: {
|
|
165
|
+
date?: Date;
|
|
166
|
+
onDateChange?: (date: Date | undefined) => void;
|
|
167
|
+
placeholder?: string;
|
|
168
|
+
disabled?: boolean;
|
|
169
|
+
className?: string;
|
|
170
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
144
171
|
export { DatePicker };
|
|
145
172
|
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/ui/date-picker.tsx"],"names":[],"mappings":"AAiLA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkKG;AACH,iBAAS,UAAU,CAAC,EAClB,IAAI,EACJ,YAAY,EACZ,WAA2B,EAC3B,QAAgB,EAChB,SAAS,GACV,EAAE;IACD,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,2CAgDA;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -10,7 +10,6 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
|
10
10
|
* Use dialogs for critical interactions, confirmations, forms, or detailed information that
|
|
11
11
|
* requires user focus and prevents interaction with the background content.
|
|
12
12
|
*
|
|
13
|
-
* @component
|
|
14
13
|
* @example
|
|
15
14
|
* ```tsx
|
|
16
15
|
* // Basic confirmation dialog
|
|
@@ -95,72 +94,154 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
|
95
94
|
* - Focus returns to trigger element when dialog closes
|
|
96
95
|
* - Background content becomes inert (non-interactive)
|
|
97
96
|
* - Keyboard navigation between focusable elements
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
102
|
-
* @
|
|
103
|
-
*
|
|
104
|
-
* @see {@link
|
|
105
|
-
* @see {@link
|
|
106
|
-
* @see {@link
|
|
107
|
-
* @see {@link Sheet} - For side panel overlays
|
|
108
|
-
* @see {@link Drawer} - For mobile-friendly bottom overlays
|
|
97
|
+
* - Space/Enter keys open and close dialog
|
|
98
|
+
* - Tab/Shift+Tab moves focus between interactive elements
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://ui.shadcn.com/docs/components/dialog} shadcn/ui Dialog documentation
|
|
101
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/dialog} Radix UI Dialog primitives
|
|
102
|
+
* @see {@link DialogTrigger} Button that opens the dialog
|
|
103
|
+
* @see {@link DialogContent} Main content container with overlay and portal
|
|
104
|
+
* @see {@link DialogHeader} Container for title and description
|
|
105
|
+
* @see {@link DialogFooter} Container for action buttons
|
|
109
106
|
* @since 1.0.0
|
|
110
107
|
*/
|
|
111
|
-
declare function Dialog(
|
|
108
|
+
declare function Dialog(props: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
112
109
|
/**
|
|
113
110
|
* DialogTrigger - The element that opens the dialog when clicked
|
|
114
111
|
*
|
|
115
112
|
* Typically wraps a button or other interactive element. Use asChild
|
|
116
|
-
* prop to render as the child element instead of a button.
|
|
113
|
+
* prop to render as the child element instead of a button. The trigger
|
|
114
|
+
* automatically receives focus management and ARIA attributes.
|
|
117
115
|
*
|
|
118
|
-
* @component
|
|
119
116
|
* @example
|
|
120
117
|
* ```tsx
|
|
121
118
|
* <DialogTrigger asChild>
|
|
122
119
|
* <Button>Open Dialog</Button>
|
|
123
120
|
* </DialogTrigger>
|
|
124
121
|
* ```
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* // Direct button without asChild
|
|
126
|
+
* <DialogTrigger className="custom-trigger-style">
|
|
127
|
+
* Click to open
|
|
128
|
+
* </DialogTrigger>
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* @accessibility
|
|
132
|
+
* - Automatically receives aria-expanded attribute based on dialog state
|
|
133
|
+
* - Keyboard activation with Space and Enter keys
|
|
134
|
+
* - Focus returns here when dialog closes
|
|
135
|
+
* - Screen reader compatible with role="button" when used as direct element
|
|
136
|
+
*
|
|
137
|
+
* @see {@link Dialog} The root dialog container
|
|
138
|
+
* @see {@link DialogContent} The content opened by this trigger
|
|
125
139
|
* @since 1.0.0
|
|
126
140
|
*/
|
|
127
|
-
declare function DialogTrigger(
|
|
141
|
+
declare function DialogTrigger(props: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
128
142
|
/**
|
|
129
143
|
* DialogPortal - Portal container for dialog content
|
|
130
144
|
*
|
|
131
145
|
* Renders dialog content in a React portal at the end of the document body.
|
|
132
|
-
* This ensures proper stacking context and prevents z-index issues.
|
|
146
|
+
* This ensures proper stacking context and prevents z-index issues. Rarely
|
|
147
|
+
* used directly - typically included automatically by DialogContent.
|
|
133
148
|
*
|
|
134
|
-
* @
|
|
149
|
+
* @example
|
|
150
|
+
* ```tsx
|
|
151
|
+
* // Custom portal container
|
|
152
|
+
* const [container, setContainer] = useState(null);
|
|
153
|
+
*
|
|
154
|
+
* <DialogPortal container={container}>
|
|
155
|
+
* <DialogOverlay />
|
|
156
|
+
* <DialogContent>Portal content</DialogContent>
|
|
157
|
+
* </DialogPortal>
|
|
158
|
+
* <div ref={setContainer} />
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
161
|
+
* @accessibility
|
|
162
|
+
* - Ensures dialog renders outside normal DOM flow for proper focus management
|
|
163
|
+
* - Maintains proper stacking order for screen readers
|
|
164
|
+
* - Portal location doesn't affect ARIA relationships
|
|
165
|
+
*
|
|
166
|
+
* @see {@link DialogContent} Component that typically includes this portal
|
|
135
167
|
* @since 1.0.0
|
|
136
168
|
*/
|
|
137
|
-
declare function DialogPortal(
|
|
169
|
+
declare function DialogPortal(props: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
138
170
|
/**
|
|
139
171
|
* DialogClose - A close button that dismisses the dialog
|
|
140
172
|
*
|
|
141
173
|
* Can be placed anywhere within DialogContent to provide a close action.
|
|
142
174
|
* Typically used for custom close buttons in addition to the default X button.
|
|
175
|
+
* Automatically closes the dialog when activated and returns focus to the trigger.
|
|
143
176
|
*
|
|
144
|
-
* @component
|
|
145
177
|
* @example
|
|
146
178
|
* ```tsx
|
|
147
179
|
* <DialogClose asChild>
|
|
148
180
|
* <Button variant="outline">Cancel</Button>
|
|
149
181
|
* </DialogClose>
|
|
150
182
|
* ```
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```tsx
|
|
186
|
+
* // Direct button without asChild
|
|
187
|
+
* <DialogClose className="close-button">
|
|
188
|
+
* Close Dialog
|
|
189
|
+
* </DialogClose>
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* // In footer with multiple actions
|
|
195
|
+
* <DialogFooter>
|
|
196
|
+
* <DialogClose asChild>
|
|
197
|
+
* <Button variant="outline">Cancel</Button>
|
|
198
|
+
* </DialogClose>
|
|
199
|
+
* <Button type="submit">Save</Button>
|
|
200
|
+
* </DialogFooter>
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* @accessibility
|
|
204
|
+
* - Keyboard activation with Space and Enter keys
|
|
205
|
+
* - Screen reader compatible with proper labeling
|
|
206
|
+
* - Focus management returns to dialog trigger
|
|
207
|
+
* - Can be used as implicit cancel action
|
|
208
|
+
*
|
|
209
|
+
* @see {@link DialogContent} Container that includes the default close button
|
|
210
|
+
* @see {@link Dialog} Root component for controlling open state
|
|
151
211
|
* @since 1.0.0
|
|
152
212
|
*/
|
|
153
|
-
declare function DialogClose(
|
|
213
|
+
declare function DialogClose(props: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
154
214
|
/**
|
|
155
215
|
* DialogOverlay - The backdrop overlay behind the dialog
|
|
156
216
|
*
|
|
157
217
|
* Provides a semi-transparent background that covers the main content.
|
|
158
|
-
* Clicking the overlay will close the dialog by default.
|
|
218
|
+
* Clicking the overlay will close the dialog by default. Features smooth
|
|
219
|
+
* fade animations using Tailwind CSS and proper z-index stacking.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```tsx
|
|
223
|
+
* // Custom overlay styling
|
|
224
|
+
* <DialogOverlay className="bg-red-500/20 backdrop-blur-sm" />
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```tsx
|
|
229
|
+
* // Typically used automatically within DialogContent
|
|
230
|
+
* <DialogContent>
|
|
231
|
+
* // DialogOverlay is included automatically
|
|
232
|
+
* <DialogTitle>Dialog content</DialogTitle>
|
|
233
|
+
* </DialogContent>
|
|
234
|
+
* ```
|
|
159
235
|
*
|
|
160
|
-
* @component
|
|
161
236
|
* @accessibility
|
|
162
|
-
* - Prevents interaction with background content
|
|
163
|
-
* - Can be clicked to dismiss dialog (
|
|
237
|
+
* - Prevents interaction with background content (makes it inert)
|
|
238
|
+
* - Can be clicked to dismiss dialog (respects modal prop)
|
|
239
|
+
* - Proper z-index ensures overlay appears above page content
|
|
240
|
+
* - Fade animations respect prefers-reduced-motion settings
|
|
241
|
+
* - Background becomes non-focusable when dialog is open
|
|
242
|
+
*
|
|
243
|
+
* @see {@link DialogContent} Component that typically includes this overlay
|
|
244
|
+
* @see {@link DialogPortal} Portal container for rendering overlay
|
|
164
245
|
* @since 1.0.0
|
|
165
246
|
*/
|
|
166
247
|
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAmK1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAEvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iBAAS,aAAa,CACpB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAG5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,iBAAS,YAAY,CACnB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,2CAG3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,iBAAS,WAAW,CAClB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAG1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAWtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IACxD,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,2CAyBA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAQzE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,2CAQ1D;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|