@neynar/ui 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/dist/components/ui/accordion.d.ts +1 -25
  2. package/dist/components/ui/accordion.d.ts.map +1 -1
  3. package/dist/components/ui/alert-dialog.d.ts +240 -46
  4. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  5. package/dist/components/ui/alert.d.ts +73 -11
  6. package/dist/components/ui/alert.d.ts.map +1 -1
  7. package/dist/components/ui/aspect-ratio.d.ts +44 -10
  8. package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
  9. package/dist/components/ui/avatar.d.ts +117 -33
  10. package/dist/components/ui/avatar.d.ts.map +1 -1
  11. package/dist/components/ui/badge.d.ts +50 -71
  12. package/dist/components/ui/badge.d.ts.map +1 -1
  13. package/dist/components/ui/breadcrumb.d.ts +231 -49
  14. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  15. package/dist/components/ui/button.d.ts +189 -71
  16. package/dist/components/ui/button.d.ts.map +1 -1
  17. package/dist/components/ui/calendar.d.ts +197 -40
  18. package/dist/components/ui/calendar.d.ts.map +1 -1
  19. package/dist/components/ui/card.d.ts +7 -22
  20. package/dist/components/ui/card.d.ts.map +1 -1
  21. package/dist/components/ui/carousel.d.ts +369 -99
  22. package/dist/components/ui/carousel.d.ts.map +1 -1
  23. package/dist/components/ui/chart.d.ts.map +1 -1
  24. package/dist/components/ui/checkbox.d.ts +110 -38
  25. package/dist/components/ui/checkbox.d.ts.map +1 -1
  26. package/dist/components/ui/collapsible.d.ts +246 -61
  27. package/dist/components/ui/collapsible.d.ts.map +1 -1
  28. package/dist/components/ui/combobox.d.ts +207 -159
  29. package/dist/components/ui/combobox.d.ts.map +1 -1
  30. package/dist/components/ui/command.d.ts +336 -67
  31. package/dist/components/ui/command.d.ts.map +1 -1
  32. package/dist/components/ui/container.d.ts +159 -64
  33. package/dist/components/ui/container.d.ts.map +1 -1
  34. package/dist/components/ui/context-menu.d.ts +321 -39
  35. package/dist/components/ui/context-menu.d.ts.map +1 -1
  36. package/dist/components/ui/date-picker.d.ts +113 -86
  37. package/dist/components/ui/date-picker.d.ts.map +1 -1
  38. package/dist/components/ui/dialog.d.ts +106 -25
  39. package/dist/components/ui/dialog.d.ts.map +1 -1
  40. package/dist/components/ui/drawer.d.ts +388 -59
  41. package/dist/components/ui/drawer.d.ts.map +1 -1
  42. package/dist/components/ui/dropdown-menu.d.ts +521 -74
  43. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  44. package/dist/components/ui/empty-state.d.ts +148 -76
  45. package/dist/components/ui/empty-state.d.ts.map +1 -1
  46. package/dist/components/ui/hover-card.d.ts +253 -34
  47. package/dist/components/ui/hover-card.d.ts.map +1 -1
  48. package/dist/components/ui/input.d.ts +143 -44
  49. package/dist/components/ui/input.d.ts.map +1 -1
  50. package/dist/components/ui/label.d.ts +0 -8
  51. package/dist/components/ui/label.d.ts.map +1 -1
  52. package/dist/components/ui/menubar.d.ts +288 -46
  53. package/dist/components/ui/menubar.d.ts.map +1 -1
  54. package/dist/components/ui/navigation-menu.d.ts +444 -127
  55. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  56. package/dist/components/ui/pagination.d.ts +342 -66
  57. package/dist/components/ui/pagination.d.ts.map +1 -1
  58. package/dist/components/ui/popover.d.ts +0 -8
  59. package/dist/components/ui/popover.d.ts.map +1 -1
  60. package/dist/components/ui/progress.d.ts +88 -30
  61. package/dist/components/ui/progress.d.ts.map +1 -1
  62. package/dist/components/ui/radio-group.d.ts +189 -45
  63. package/dist/components/ui/radio-group.d.ts.map +1 -1
  64. package/dist/components/ui/resizable.d.ts +178 -62
  65. package/dist/components/ui/resizable.d.ts.map +1 -1
  66. package/dist/components/ui/scroll-area.d.ts +180 -21
  67. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  68. package/dist/components/ui/select.d.ts +382 -60
  69. package/dist/components/ui/select.d.ts.map +1 -1
  70. package/dist/components/ui/separator.d.ts +52 -39
  71. package/dist/components/ui/separator.d.ts.map +1 -1
  72. package/dist/components/ui/sheet.d.ts +144 -27
  73. package/dist/components/ui/sheet.d.ts.map +1 -1
  74. package/dist/components/ui/sidebar.d.ts +81 -31
  75. package/dist/components/ui/sidebar.d.ts.map +1 -1
  76. package/dist/components/ui/skeleton.d.ts +94 -32
  77. package/dist/components/ui/skeleton.d.ts.map +1 -1
  78. package/dist/components/ui/slider.d.ts +37 -31
  79. package/dist/components/ui/slider.d.ts.map +1 -1
  80. package/dist/components/ui/sonner.d.ts +280 -46
  81. package/dist/components/ui/sonner.d.ts.map +1 -1
  82. package/dist/components/ui/stack.d.ts +289 -148
  83. package/dist/components/ui/stack.d.ts.map +1 -1
  84. package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
  85. package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
  86. package/dist/components/ui/stories/container.stories.d.ts +2 -3
  87. package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
  88. package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
  89. package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
  90. package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
  91. package/dist/components/ui/stories/stack.stories.d.ts +1 -1
  92. package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
  93. package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
  94. package/dist/components/ui/switch.d.ts +44 -38
  95. package/dist/components/ui/switch.d.ts.map +1 -1
  96. package/dist/components/ui/table.d.ts +33 -0
  97. package/dist/components/ui/table.d.ts.map +1 -1
  98. package/dist/components/ui/tabs.d.ts +4 -22
  99. package/dist/components/ui/tabs.d.ts.map +1 -1
  100. package/dist/components/ui/text-field.d.ts +170 -84
  101. package/dist/components/ui/text-field.d.ts.map +1 -1
  102. package/dist/components/ui/textarea.d.ts +106 -29
  103. package/dist/components/ui/textarea.d.ts.map +1 -1
  104. package/dist/components/ui/theme-toggle.d.ts +190 -65
  105. package/dist/components/ui/theme-toggle.d.ts.map +1 -1
  106. package/dist/components/ui/theme.d.ts +107 -23
  107. package/dist/components/ui/theme.d.ts.map +1 -1
  108. package/dist/components/ui/toggle-group.d.ts +143 -67
  109. package/dist/components/ui/toggle-group.d.ts.map +1 -1
  110. package/dist/components/ui/toggle.d.ts +118 -30
  111. package/dist/components/ui/toggle.d.ts.map +1 -1
  112. package/dist/components/ui/tooltip.d.ts +152 -28
  113. package/dist/components/ui/tooltip.d.ts.map +1 -1
  114. package/dist/components/ui/typography.d.ts +452 -134
  115. package/dist/components/ui/typography.d.ts.map +1 -1
  116. package/dist/index.js +9388 -8281
  117. package/dist/index.js.map +1 -1
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/llms.txt +173 -3
  120. package/package.json +5 -2
  121. package/src/components/ui/accordion.tsx +112 -27
  122. package/src/components/ui/alert-dialog.tsx +401 -46
  123. package/src/components/ui/alert.tsx +114 -11
  124. package/src/components/ui/aspect-ratio.tsx +69 -14
  125. package/src/components/ui/avatar.tsx +179 -33
  126. package/src/components/ui/badge.tsx +74 -75
  127. package/src/components/ui/breadcrumb.tsx +335 -50
  128. package/src/components/ui/button.tsx +198 -90
  129. package/src/components/ui/calendar.tsx +867 -43
  130. package/src/components/ui/card.tsx +140 -33
  131. package/src/components/ui/carousel.tsx +529 -98
  132. package/src/components/ui/chart.tsx +222 -1
  133. package/src/components/ui/checkbox.tsx +176 -38
  134. package/src/components/ui/collapsible.tsx +321 -67
  135. package/src/components/ui/combobox.tsx +284 -83
  136. package/src/components/ui/command.tsx +527 -67
  137. package/src/components/ui/container.tsx +217 -65
  138. package/src/components/ui/context-menu.tsx +716 -51
  139. package/src/components/ui/date-picker.tsx +228 -38
  140. package/src/components/ui/dialog.tsx +270 -33
  141. package/src/components/ui/drawer.tsx +546 -67
  142. package/src/components/ui/dropdown-menu.tsx +657 -74
  143. package/src/components/ui/empty-state.tsx +241 -82
  144. package/src/components/ui/hover-card.tsx +328 -39
  145. package/src/components/ui/input.tsx +207 -44
  146. package/src/components/ui/label.tsx +98 -8
  147. package/src/components/ui/menubar.tsx +587 -54
  148. package/src/components/ui/navigation-menu.tsx +557 -128
  149. package/src/components/ui/pagination.tsx +561 -79
  150. package/src/components/ui/popover.tsx +119 -8
  151. package/src/components/ui/progress.tsx +131 -29
  152. package/src/components/ui/radio-group.tsx +260 -51
  153. package/src/components/ui/resizable.tsx +289 -63
  154. package/src/components/ui/scroll-area.tsx +377 -66
  155. package/src/components/ui/select.tsx +545 -60
  156. package/src/components/ui/separator.tsx +146 -40
  157. package/src/components/ui/sheet.tsx +348 -31
  158. package/src/components/ui/sidebar.tsx +471 -29
  159. package/src/components/ui/skeleton.tsx +114 -32
  160. package/src/components/ui/slider.tsx +77 -31
  161. package/src/components/ui/sonner.tsx +574 -46
  162. package/src/components/ui/stack.tsx +423 -101
  163. package/src/components/ui/switch.tsx +78 -39
  164. package/src/components/ui/table.tsx +170 -4
  165. package/src/components/ui/tabs.tsx +108 -22
  166. package/src/components/ui/text-field.tsx +226 -81
  167. package/src/components/ui/textarea.tsx +180 -29
  168. package/src/components/ui/theme-toggle.tsx +313 -65
  169. package/src/components/ui/theme.tsx +117 -23
  170. package/src/components/ui/toggle-group.tsx +280 -69
  171. package/src/components/ui/toggle.tsx +124 -35
  172. package/src/components/ui/tooltip.tsx +239 -29
  173. package/src/components/ui/typography.tsx +1115 -165
@@ -1,75 +1,15 @@
1
1
  /**
2
- * Properties for the DatePicker component
2
+ * DatePicker - A comprehensive date selection component with popover calendar interface
3
3
  *
4
- * @type DatePickerProps
5
- * @since 1.0.0
6
- */
7
- type DatePickerProps = {
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
- * Built on shadcn/ui design principles, this component provides a polished interface
71
- * for date selection with proper accessibility, keyboard navigation, and visual feedback.
72
- * The selected date is displayed using date-fns formatting for consistent presentation.
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**: Full keyboard support with Tab, Enter, Escape, and arrow keys
123
- * - **Screen Reader Support**: Proper ARIA labels and live announcements for date changes
124
- * - **Focus Management**: Focus returns to trigger button when popover closes
125
- * - **Visual Indicators**: Clear visual states for disabled, selected, and focused elements
126
- * - **Date Formatting**: Consistent date presentation using localized formatting
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-based calendar that doesn't interfere with page layout
131
- * - Automatic popover positioning and collision detection
132
- * - Internal state management with optional external control
133
- * - Customizable trigger button styling and width
134
- * - Date formatting using date-fns for internationalization support
135
- *
136
- * @see {@link https://ui.shadcn.com/docs/components/date-picker} shadcn/ui Date Picker patterns
137
- * @see {@link Calendar} - The underlying calendar component
138
- * @see {@link Popover} - The popover container component
139
- * @see {@link Button} - The trigger button component
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, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
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":"AASA;;;;;GAKG;AACH,KAAK,eAAe,GAAG;IACrB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAEhD;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,iBAAS,UAAU,CAAC,EAClB,IAAI,EACJ,YAAY,EACZ,WAA2B,EAC3B,QAAgB,EAChB,SAAS,GACV,EAAE,eAAe,2CAgDjB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
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
- * @param open - Controlled open state of the dialog
100
- * @param onOpenChange - Callback fired when open state changes
101
- * @param modal - Whether dialog is modal (default: true). Non-modal allows background interaction
102
- * @param defaultOpen - Default open state for uncontrolled usage
103
- *
104
- * @see {@link https://ui.shadcn.com/docs/components/dialog} - shadcn/ui Dialog documentation
105
- * @see {@link https://www.radix-ui.com/primitives/docs/components/dialog} - Radix UI Dialog primitives
106
- * @see {@link AlertDialog} - For confirmation dialogs with specific alert semantics
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({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
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({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
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
- * @component
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({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
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({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
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 (configurable)
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;AAK1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AACH,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAEnD;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAEtD;AAED;;;;;;;;GAQG;AACH,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,c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