@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,6 +1,7 @@
1
+ import * as React from "react";
1
2
  import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
2
3
  /**
3
- * AspectRatio component for maintaining consistent width-to-height ratios
4
+ * AspectRatio - Maintains consistent width-to-height ratios for content
4
5
  *
5
6
  * A foundational layout component that preserves specific aspect ratios regardless
6
7
  * of container size. Essential for responsive images, videos, and media content that
@@ -9,7 +10,8 @@ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
9
10
  *
10
11
  * This component creates a CSS-based aspect ratio container using the modern
11
12
  * `aspect-ratio` property, ensuring content maintains its intended proportions
12
- * without layout shifts or JavaScript calculations.
13
+ * without layout shifts or JavaScript calculations. The component acts as a
14
+ * constraint wrapper that forces its children to maintain the specified ratio.
13
15
  *
14
16
  * @example Basic image with 16:9 aspect ratio
15
17
  * ```tsx
@@ -35,7 +37,7 @@ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
35
37
  * </AspectRatio>
36
38
  * ```
37
39
  *
38
- * @example Video player container
40
+ * @example Video player with 16:9 widescreen ratio
39
41
  * ```tsx
40
42
  * <div className="w-full max-w-2xl">
41
43
  * <AspectRatio ratio={16 / 9}>
@@ -48,7 +50,7 @@ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
48
50
  * </div>
49
51
  * ```
50
52
  *
51
- * @example Responsive image gallery with portrait orientation
53
+ * @example Portrait orientation for image galleries
52
54
  * ```tsx
53
55
  * <div className="grid grid-cols-1 md:grid-cols-3 gap-4">
54
56
  * {images.map((image) => (
@@ -75,20 +77,52 @@ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
75
77
  * </AspectRatio>
76
78
  * ```
77
79
  *
80
+ * @example Using asChild for composition
81
+ * ```tsx
82
+ * <AspectRatio ratio={16 / 9} asChild>
83
+ * <div className="bg-gradient-to-br from-blue-400 to-purple-600 rounded-lg p-6">
84
+ * <h3 className="text-white text-xl font-bold">Custom Content</h3>
85
+ * </div>
86
+ * </AspectRatio>
87
+ * ```
88
+ *
89
+ * @example Common aspect ratios for different use cases
90
+ * ```tsx
91
+ * // Square (social media posts, avatars)
92
+ * <AspectRatio ratio={1}>Content</AspectRatio>
93
+ *
94
+ * // 16:9 (videos, hero images, banners)
95
+ * <AspectRatio ratio={16 / 9}>Content</AspectRatio>
96
+ *
97
+ * // 4:3 (traditional photos, tablets)
98
+ * <AspectRatio ratio={4 / 3}>Content</AspectRatio>
99
+ *
100
+ * // 3:2 (35mm photos, DSLR images)
101
+ * <AspectRatio ratio={3 / 2}>Content</AspectRatio>
102
+ *
103
+ * // 9:16 (mobile stories, vertical videos)
104
+ * <AspectRatio ratio={9 / 16}>Content</AspectRatio>
105
+ * ```
106
+ *
78
107
  * @param ratio - The desired aspect ratio as width/height (e.g., 16/9, 4/3, 1)
79
108
  * @param children - Content to be constrained within the aspect ratio
80
109
  * @param className - Additional CSS classes for styling
110
+ * @param asChild - Merge props with child element instead of wrapping
111
+ * @param ref - React ref forwarded to the container element
81
112
  *
82
113
  * @accessibility
83
114
  * - Inherits all accessibility features from Radix UI AspectRatio primitive
84
- * - Preserves semantic meaning of child content
85
- * - Does not interfere with screen reader navigation
86
- * - Maintains keyboard navigation for interactive child elements
115
+ * - Preserves semantic meaning and structure of child content
116
+ * - Does not interfere with screen reader navigation or content reading
117
+ * - Maintains proper keyboard navigation for interactive child elements
118
+ * - Supports ARIA attributes passed through props
119
+ * - Container is semantically neutral and doesn't affect focus management
87
120
  *
88
- * @see {@link https://ui.shadcn.com/docs/components/aspect-ratio} shadcn/ui documentation
89
- * @since 1.0.0
121
+ * @see {@link https://ui.shadcn.com/docs/components/aspect-ratio} shadcn/ui AspectRatio
90
122
  * @see {@link https://www.radix-ui.com/primitives/docs/components/aspect-ratio} Radix UI AspectRatio
123
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio} CSS aspect-ratio property
124
+ * @since 1.0.0
91
125
  */
92
- declare function AspectRatio({ ...props }: React.ComponentProps<typeof AspectRatioPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
126
+ declare const AspectRatio: React.ForwardRefExoticComponent<Omit<AspectRatioPrimitive.AspectRatioProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
93
127
  export { AspectRatio };
94
128
  //# sourceMappingURL=aspect-ratio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"aspect-ratio.d.ts","sourceRoot":"","sources":["../../../src/components/ui/aspect-ratio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFG;AACH,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAExD;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"aspect-ratio.d.ts","sourceRoot":"","sources":["../../../src/components/ui/aspect-ratio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AAkBrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0HG;AACH,QAAA,MAAM,WAAW,iKAOf,CAAC;AAIH,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -17,6 +17,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
17
17
  * - **Shape variants**: Circular by default with support for rounded corners
18
18
  * - **Accessibility first**: Built-in ARIA attributes and keyboard navigation
19
19
  * - **Composable design**: Works with AvatarImage and AvatarFallback sub-components
20
+ * - **Polymorphic rendering**: Supports asChild prop for custom element rendering
20
21
  *
21
22
  * ## Common Use Cases
22
23
  * - User profile displays in headers and navigation
@@ -85,8 +86,20 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
85
86
  * </div>
86
87
  * ```
87
88
  *
89
+ * @example Using asChild for custom elements
90
+ * ```tsx
91
+ * <Avatar asChild>
92
+ * <button onClick={handleClick}>
93
+ * <AvatarImage src="/user.jpg" alt="User Profile" />
94
+ * <AvatarFallback>UP</AvatarFallback>
95
+ * </button>
96
+ * </Avatar>
97
+ * ```
98
+ *
88
99
  * @param className Additional CSS classes for styling. Common patterns include size utilities (size-6, size-8, size-10, size-12, size-16) and border radius overrides (rounded-lg, rounded-md, rounded-none)
89
100
  * @param children Should contain AvatarImage and AvatarFallback components for proper functionality
101
+ * @param asChild Change the default rendered element for the one passed as a child, merging their props and behavior
102
+ * @default false
90
103
  *
91
104
  * @accessibility
92
105
  * - Automatically manages focus and ARIA attributes through Radix UI
@@ -95,6 +108,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
95
108
  * - Ensure sufficient color contrast for fallback text (minimum 4.5:1 ratio)
96
109
  * - Component supports keyboard navigation and screen reader announcements
97
110
  * - Status indicators should include appropriate ARIA labels
111
+ * - When using asChild with interactive elements, ensure proper focus management
98
112
  *
99
113
  * @see {@link AvatarImage} The image component for displaying avatar pictures
100
114
  * @see {@link AvatarFallback} The fallback component for displaying initials or icons when images fail
@@ -112,16 +126,23 @@ declare function Avatar({ className, ...props }: React.ComponentProps<typeof Ava
112
126
  * and the AvatarFallback will be displayed instead.
113
127
  *
114
128
  * ## Key Features
115
- * - Automatic image loading state management
116
- * - Graceful error handling for broken image URLs
117
- * - Proper aspect ratio maintenance (square by default)
118
- * - Inherits parent Avatar's size and border radius
119
- * - Accessible image implementation
129
+ * - **Automatic loading state management**: Handles "idle", "loading", "loaded", and "error" states
130
+ * - **Graceful error handling**: Automatically falls back when images fail to load
131
+ * - **Proper aspect ratio maintenance**: Square aspect ratio maintained by default
132
+ * - **Flexible rendering**: Supports asChild for custom element composition
133
+ * - **Loading status callbacks**: Provides onLoadingStatusChange for custom loading logic
134
+ * - **Accessible implementation**: Proper alt text handling and ARIA support
135
+ *
136
+ * ## Loading States
137
+ * The component automatically manages these states:
138
+ * - **idle**: Initial state before loading begins
139
+ * - **loading**: Image is currently being loaded
140
+ * - **loaded**: Image has loaded successfully and is displayed
141
+ * - **error**: Image failed to load, fallback will be shown
120
142
  *
121
143
  * @component
122
- * @example
144
+ * @example Basic usage with remote image
123
145
  * ```tsx
124
- * // Basic usage with remote image
125
146
  * <Avatar>
126
147
  * <AvatarImage
127
148
  * src="https://github.com/username.png"
@@ -131,9 +152,8 @@ declare function Avatar({ className, ...props }: React.ComponentProps<typeof Ava
131
152
  * </Avatar>
132
153
  * ```
133
154
  *
134
- * @example
155
+ * @example Local image with descriptive alt text
135
156
  * ```tsx
136
- * // Local image with descriptive alt text
137
157
  * <Avatar>
138
158
  * <AvatarImage
139
159
  * src="/uploads/user-avatar.jpg"
@@ -143,19 +163,51 @@ declare function Avatar({ className, ...props }: React.ComponentProps<typeof Ava
143
163
  * </Avatar>
144
164
  * ```
145
165
  *
146
- * @param src - The URL of the image to display. Can be relative or absolute URL
147
- * @param alt - Descriptive alternative text for the image. Should describe the person or entity, not just "avatar" or "profile picture"
148
- * @param className - Additional CSS classes to apply to the image element
149
- * @param onLoadingStatusChange - Optional callback fired when the loading status changes
166
+ * @example With loading status callback
167
+ * ```tsx
168
+ * <Avatar>
169
+ * <AvatarImage
170
+ * src="/large-image.jpg"
171
+ * alt="High resolution avatar"
172
+ * onLoadingStatusChange={(status) => {
173
+ * if (status === 'loading') {
174
+ * console.log('Image is loading...');
175
+ * } else if (status === 'error') {
176
+ * console.log('Failed to load image');
177
+ * }
178
+ * }}
179
+ * />
180
+ * <AvatarFallback>HR</AvatarFallback>
181
+ * </Avatar>
182
+ * ```
183
+ *
184
+ * @example Using asChild for custom image elements
185
+ * ```tsx
186
+ * <Avatar>
187
+ * <AvatarImage src="/user.jpg" alt="User" asChild>
188
+ * <img loading="lazy" decoding="async" />
189
+ * </AvatarImage>
190
+ * <AvatarFallback>U</AvatarFallback>
191
+ * </Avatar>
192
+ * ```
193
+ *
194
+ * @param src The URL of the image to display. Can be relative or absolute URL. When src changes, loading will restart
195
+ * @param alt Descriptive alternative text for the image. Should describe the person or entity, not just "avatar" or "profile picture"
196
+ * @param className Additional CSS classes to apply to the image element. Applied to the img element or asChild component
197
+ * @param onLoadingStatusChange Optional callback fired when the loading status changes. Receives status: "idle" | "loading" | "loaded" | "error"
198
+ * @param asChild Change the default rendered element for the one passed as a child, merging their props and behavior
199
+ * @default false
150
200
  *
151
201
  * @accessibility
152
202
  * - Always provide descriptive alt text that identifies the person or entity
153
203
  * - The image is automatically hidden from assistive technologies when loading or failed
154
204
  * - Use meaningful descriptions like "John Doe's profile picture" rather than generic terms
155
205
  * - The component handles ARIA attributes automatically via Radix UI
206
+ * - Loading and error states are communicated to screen readers appropriately
156
207
  *
157
- * @see {@link Avatar} - The parent container component
158
- * @see {@link AvatarFallback} - The fallback component shown when image is unavailable
208
+ * @see {@link Avatar} The parent container component
209
+ * @see {@link AvatarFallback} The fallback component shown when image is unavailable
210
+ * @see {@link https://www.radix-ui.com/docs/primitives/components/avatar#image} Radix UI Avatar.Image API
159
211
  * @since 1.0.0
160
212
  */
161
213
  declare function AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>): import("react/jsx-runtime").JSX.Element;
@@ -166,32 +218,39 @@ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeo
166
218
  * or is not provided. It's built on Radix UI's Avatar.Fallback primitive and provides a
167
219
  * visually appealing placeholder that maintains the avatar's design consistency.
168
220
  *
221
+ * ## When AvatarFallback is Shown
222
+ * The fallback is automatically displayed in these scenarios:
223
+ * - **Image loading**: While the AvatarImage is being loaded
224
+ * - **Image error**: When the AvatarImage fails to load (broken URL, network error)
225
+ * - **No image**: When no AvatarImage component is provided
226
+ * - **Empty src**: When AvatarImage has no src prop or empty src
227
+ *
169
228
  * ## Common Use Cases
170
- * - User initials (most common pattern)
171
- * - Generic user icons
172
- * - Company/brand initials for organization avatars
173
- * - Loading states with animations
174
- * - Placeholder content for new users
229
+ * - **User initials**: Most common pattern (2-3 characters)
230
+ * - **Generic icons**: User, person, or company icons
231
+ * - **Brand initials**: For organization avatars
232
+ * - **Loading states**: With animations or loading indicators
233
+ * - **Placeholder content**: For new or anonymous users
234
+ * - **Custom graphics**: SVG icons or other visual elements
175
235
  *
176
236
  * ## Design Considerations
177
237
  * - Uses muted background color for subtle appearance
178
238
  * - Automatically centers content both horizontally and vertically
179
239
  * - Inherits size and border radius from parent Avatar
180
240
  * - Should complement the overall design system
241
+ * - Supports delay to prevent flash during fast image loads
181
242
  *
182
243
  * @component
183
- * @example
244
+ * @example User initials (recommended pattern)
184
245
  * ```tsx
185
- * // User initials (recommended pattern)
186
246
  * <Avatar>
187
247
  * <AvatarImage src="/avatar.jpg" alt="John Doe" />
188
248
  * <AvatarFallback>JD</AvatarFallback>
189
249
  * </Avatar>
190
250
  * ```
191
251
  *
192
- * @example
252
+ * @example Icon fallback for unknown users
193
253
  * ```tsx
194
- * // Icon fallback for unknown users
195
254
  * import { User } from "lucide-react";
196
255
  *
197
256
  * <Avatar>
@@ -202,9 +261,8 @@ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeo
202
261
  * </Avatar>
203
262
  * ```
204
263
  *
205
- * @example
264
+ * @example Custom colored fallback
206
265
  * ```tsx
207
- * // Custom colored fallback
208
266
  * <Avatar>
209
267
  * <AvatarImage src="/user.jpg" alt="Jane Smith" />
210
268
  * <AvatarFallback className="bg-blue-500 text-white">
@@ -213,9 +271,8 @@ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeo
213
271
  * </Avatar>
214
272
  * ```
215
273
  *
216
- * @example
274
+ * @example Loading state with animation
217
275
  * ```tsx
218
- * // Loading state with animation
219
276
  * <Avatar>
220
277
  * <AvatarImage src="/loading-image.jpg" alt="Loading" />
221
278
  * <AvatarFallback className="animate-pulse">
@@ -224,9 +281,34 @@ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeo
224
281
  * </Avatar>
225
282
  * ```
226
283
  *
227
- * @param children - The fallback content to display. Common patterns include user initials (2-3 characters), icons, or loading indicators
228
- * @param className - Additional CSS classes. Use for custom background colors, text styling, or animations
229
- * @param delayMs - Optional delay in milliseconds before showing the fallback (Radix UI feature)
284
+ * @example With delay to prevent flash
285
+ * ```tsx
286
+ * <Avatar>
287
+ * <AvatarImage src="/slow-loading-image.jpg" alt="User" />
288
+ * <AvatarFallback delayMs={600}>
289
+ * UN
290
+ * </AvatarFallback>
291
+ * </Avatar>
292
+ * ```
293
+ *
294
+ * @example Using asChild for custom elements
295
+ * ```tsx
296
+ * <Avatar>
297
+ * <AvatarImage src="/user.jpg" alt="User" />
298
+ * <AvatarFallback asChild>
299
+ * <div className="bg-gradient-to-br from-blue-400 to-purple-600">
300
+ * <span className="text-white font-semibold">UN</span>
301
+ * </div>
302
+ * </AvatarFallback>
303
+ * </Avatar>
304
+ * ```
305
+ *
306
+ * @param children The fallback content to display. Common patterns include user initials (2-3 characters), icons, or loading indicators
307
+ * @param className Additional CSS classes. Use for custom background colors, text styling, or animations
308
+ * @param delayMs Optional delay in milliseconds before showing the fallback. Useful for delaying rendering so it only appears for those with slower connections
309
+ * @default undefined
310
+ * @param asChild Change the default rendered element for the one passed as a child, merging their props and behavior
311
+ * @default false
230
312
  *
231
313
  * @accessibility
232
314
  * - Content should be meaningful and descriptive
@@ -234,9 +316,11 @@ declare function AvatarImage({ className, ...props }: React.ComponentProps<typeo
234
316
  * - Keep text concise - typically 1-3 characters for initials
235
317
  * - Icons should have appropriate sizing relative to the avatar
236
318
  * - The component is automatically accessible via Radix UI implementation
319
+ * - Consider adding aria-label for complex fallback content
237
320
  *
238
- * @see {@link Avatar} - The parent container component
239
- * @see {@link AvatarImage} - The image component that this component provides fallback for
321
+ * @see {@link Avatar} The parent container component
322
+ * @see {@link AvatarImage} The image component that this component provides fallback for
323
+ * @see {@link https://www.radix-ui.com/docs/primitives/components/avatar#fallback} Radix UI Avatar.Fallback API
240
324
  * @since 1.0.0
241
325
  */
242
326
  declare function AvatarFallback({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Fallback>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAI1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AACH,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAWnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,QAAQ,CAAC,2CAWvD;AAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAkE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHG;AACH,iBAAS,MAAM,CAAC,EACd,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAWnD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+GG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,QAAQ,CAAC,2CAWvD;AAED,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC"}
@@ -16,11 +16,10 @@ import { type VariantProps } from "class-variance-authority";
16
16
  * - Accessibility features (focus rings, error states)
17
17
  * - Smooth transitions for interactive states
18
18
  *
19
- * ## Variants
20
- * - **default**: Primary brand color, high emphasis
21
- * - **secondary**: Muted background, medium emphasis
22
- * - **destructive**: Error/warning states, urgent attention
23
- * - **outline**: Subtle border-only style, low emphasis
19
+ * @variant default - Primary brand color badge for important status indicators and primary actions
20
+ * @variant secondary - Muted background badge for supplementary information and low-priority labels
21
+ * @variant destructive - Error/warning badge for critical states, failures, and urgent attention
22
+ * @variant outline - Subtle border-only badge for minimal emphasis and subtle labeling
24
23
  *
25
24
  * @param props - Variant configuration object
26
25
  * @param props.variant - The visual variant to apply
@@ -43,38 +42,15 @@ declare const badgeVariants: (props?: ({
43
42
  variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
44
43
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
45
44
  /**
46
- * A versatile badge component for displaying status indicators, labels, counts, and notifications.
47
- *
48
- * Badges are small status descriptors for UI elements. They provide visual feedback about the state,
49
- * category, or importance of content. The component is built with accessibility in mind and supports
50
- * multiple visual variants for different semantic meanings.
51
- *
52
- * ## Key Features
53
- * - Multiple semantic variants (default, secondary, destructive, outline)
54
- * - Icon support with proper sizing and spacing
55
- * - Polymorphic rendering via `asChild` prop
56
- * - Accessibility-first design with proper focus management
57
- * - Support for interactive states (hover, focus, invalid)
58
- * - Built-in responsive behavior
59
- *
60
- * ## When to Use
61
- * - Status indicators (active, pending, error)
62
- * - Notification counts and badges
63
- * - Category labels and tags
64
- * - Priority indicators
65
- * - Quick action buttons (when used with asChild)
66
- *
67
- * ## Accessibility Features
68
- * - Keyboard navigation support with focus-visible ring
69
- * - High contrast colors for all variants
70
- * - Support for `aria-invalid` state with visual feedback
71
- * - Semantic color mapping (destructive = error, etc.)
72
- * - Screen reader friendly content structure
73
- *
74
- * @component
45
+ * Badge - Versatile status indicator component for labels, counts, and notifications
46
+ *
47
+ * A small status descriptor component that provides visual feedback about state, category,
48
+ * or importance of content. Built on Radix UI Slot primitives with accessibility-first design
49
+ * and support for multiple semantic variants and interactive states.
50
+ *
75
51
  * @example
76
52
  * ```tsx
77
- * // Basic status badge
53
+ * // Basic status badges
78
54
  * <Badge>New</Badge>
79
55
  * <Badge variant="secondary">Draft</Badge>
80
56
  * <Badge variant="destructive">Error</Badge>
@@ -83,16 +59,16 @@ declare const badgeVariants: (props?: ({
83
59
  *
84
60
  * @example
85
61
  * ```tsx
86
- * // Badge with icon
62
+ * // Badge with icon content
87
63
  * import { Check, AlertTriangle } from "lucide-react";
88
64
  *
89
65
  * <Badge>
90
- * <Check />
66
+ * <Check className="mr-1" />
91
67
  * Completed
92
68
  * </Badge>
93
69
  *
94
70
  * <Badge variant="destructive">
95
- * <AlertTriangle />
71
+ * <AlertTriangle className="mr-1" />
96
72
  * Failed
97
73
  * </Badge>
98
74
  * ```
@@ -100,9 +76,9 @@ declare const badgeVariants: (props?: ({
100
76
  * @example
101
77
  * ```tsx
102
78
  * // Notification count badge
103
- * <div className="relative">
104
- * <Bell />
105
- * <Badge className="absolute -top-2 -right-2 size-5 p-0 text-xs">
79
+ * <div className="relative inline-block">
80
+ * <Bell className="h-6 w-6" />
81
+ * <Badge className="absolute -top-2 -right-2 h-5 w-5 p-0 text-xs flex items-center justify-center">
106
82
  * 3
107
83
  * </Badge>
108
84
  * </div>
@@ -110,11 +86,11 @@ declare const badgeVariants: (props?: ({
110
86
  *
111
87
  * @example
112
88
  * ```tsx
113
- * // Interactive badge as link
89
+ * // Interactive badge as link using asChild
114
90
  * import Link from "next/link";
115
91
  *
116
92
  * <Badge asChild>
117
- * <Link href="/notifications">
93
+ * <Link href="/notifications" className="cursor-pointer">
118
94
  * 3 new messages
119
95
  * </Link>
120
96
  * </Badge>
@@ -122,41 +98,44 @@ declare const badgeVariants: (props?: ({
122
98
  *
123
99
  * @example
124
100
  * ```tsx
125
- * // Removable tag badge
126
- * <Badge className="pr-1">
101
+ * // Interactive badge as button
102
+ * <Badge asChild>
103
+ * <button onClick={handleDismiss} className="cursor-pointer">
104
+ * Dismiss Alert
105
+ * </button>
106
+ * </Badge>
107
+ * ```
108
+ *
109
+ * @example
110
+ * ```tsx
111
+ * // Removable tag badge with close button
112
+ * <Badge className="pr-1 gap-1">
127
113
  * React
128
- * <button className="ml-1 hover:bg-primary-foreground/20 rounded-full p-0.5">
129
- * <X className="size-3" />
114
+ * <button
115
+ * onClick={handleRemove}
116
+ * className="ml-1 hover:bg-primary-foreground/20 rounded-full p-0.5"
117
+ * aria-label="Remove React tag"
118
+ * >
119
+ * <X className="h-3 w-3" />
130
120
  * </button>
131
121
  * </Badge>
132
122
  * ```
133
123
  *
134
- * @see {@link Button} - For primary actionable elements
135
- * @see [shadcn/ui Badge Documentation](https://ui.shadcn.com/docs/components/badge)
124
+ * @accessibility
125
+ * - Full keyboard navigation support with focus-visible ring indicators
126
+ * - High contrast colors across all variants for WCAG AA compliance
127
+ * - Support for aria-invalid state with visual feedback for form validation
128
+ * - Semantic color mapping (destructive variant indicates errors)
129
+ * - Screen reader friendly content structure and labeling
130
+ * - When used with asChild, inherits accessibility properties of child element
131
+ * - Focus management handled by underlying Radix UI Slot primitive
132
+ *
133
+ * @see {@link Button} For primary interactive elements and calls-to-action
134
+ * @see {@link https://ui.shadcn.com/docs/components/badge} shadcn/ui Badge Documentation
135
+ * @see {@link https://www.radix-ui.com/primitives/docs/utilities/slot} Radix UI Slot Documentation
136
136
  * @since 1.0.0
137
137
  */
138
- declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
139
- /**
140
- * If true, the badge will render its child element instead of a span element.
141
- * Useful for creating badge-styled links, buttons, or other interactive elements.
142
- *
143
- * When true, you must provide exactly one child element that can receive props.
144
- * The child element will receive all the badge styling and attributes.
145
- *
146
- * @default false
147
- * @example
148
- * ```tsx
149
- * // Badge as a link
150
- * <Badge asChild>
151
- * <Link href="/profile">Profile</Link>
152
- * </Badge>
153
- *
154
- * // Badge as a button
155
- * <Badge asChild>
156
- * <button onClick={handleClick}>Click me</button>
157
- * </Badge>
158
- * ```
159
- */
138
+ declare function Badge({ className, variant, asChild, ...props }: React.HTMLAttributes<HTMLSpanElement> & VariantProps<typeof badgeVariants> & {
160
139
  asChild?: boolean;
161
140
  }): import("react/jsx-runtime").JSX.Element;
162
141
  export { Badge, badgeVariants };
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,QAAA,MAAM,aAAa;;8EAuBlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4FG;AACH,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAC7B,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IACnC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,2CAUF;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/ui/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,QAAA,MAAM,aAAa;;8EAmBlB,CAAC;AA0BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AACH,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,GACtC,YAAY,CAAC,OAAO,aAAa,CAAC,GAAG;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,2CAUF;AAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC"}