@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
@@ -6,14 +6,74 @@ import { CircleIcon } from "lucide-react";
6
6
 
7
7
  import { cn } from "@/lib/utils";
8
8
 
9
+ /**
10
+ * Props for RadioGroup component (Documentation only - NOT used in component implementation)
11
+ * These types are for documentation generation and should not replace Radix inferred types
12
+ */
13
+ // eslint-disable-next-line unused-imports/no-unused-vars
14
+ type RadioGroupDocsProps = {
15
+ /** The value of the radio item that should be checked when initially rendered. Use when you do not need to control the checked state */
16
+ defaultValue?: string;
17
+ /** The controlled value of the radio item to check. Should be used in conjunction with onValueChange */
18
+ value?: string;
19
+ /** Event handler called when the value changes */
20
+ onValueChange?: (value: string) => void;
21
+ /** When true, prevents the user from interacting with the radio group */
22
+ disabled?: boolean;
23
+ /** The name of the group. Submitted with its owning form as part of a name/value pair */
24
+ name?: string;
25
+ /** When true, indicates that the user must check a radio item before the owning form can be submitted */
26
+ required?: boolean;
27
+ /** The orientation of the component, which determines how focus moves: horizontal for left/right arrows, vertical for up/down arrows @default "vertical" */
28
+ orientation?: "horizontal" | "vertical";
29
+ /** The reading direction of the radio group. If omitted, assumes LTR (left-to-right) reading mode */
30
+ dir?: "ltr" | "rtl";
31
+ /** When true, keyboard navigation will loop from last item to first, and vice versa @default true */
32
+ loop?: boolean;
33
+ /** Change the default rendered element for the one passed as a child, merging their props and behavior @default false */
34
+ asChild?: boolean;
35
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange">;
36
+
37
+ /**
38
+ * Props for RadioGroupItem component (Documentation only - NOT used in component implementation)
39
+ * These types are for documentation generation and should not replace Radix inferred types
40
+ */
41
+ // eslint-disable-next-line unused-imports/no-unused-vars
42
+ type RadioGroupItemDocsProps = {
43
+ /** The value given as data when submitted with a name */
44
+ value: string;
45
+ /** When true, prevents the user from interacting with the item */
46
+ disabled?: boolean;
47
+ /** When true, indicates that the user must check the item before the owning form can be submitted */
48
+ required?: boolean;
49
+ /** Change the default rendered element for the one passed as a child, merging their props and behavior @default false */
50
+ asChild?: boolean;
51
+ } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "value">;
52
+
53
+ /**
54
+ * Props for RadioGroupIndicator component (Documentation only - NOT used in component implementation)
55
+ * These types are for documentation generation and should not replace Radix inferred types
56
+ */
57
+ // eslint-disable-next-line unused-imports/no-unused-vars
58
+ type RadioGroupIndicatorDocsProps = {
59
+ /** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
60
+ forceMount?: boolean;
61
+ /** Change the default rendered element for the one passed as a child, merging their props and behavior @default false */
62
+ asChild?: boolean;
63
+ } & React.HTMLAttributes<HTMLSpanElement>;
64
+
9
65
  /**
10
66
  * A radio group component for single selection from multiple options
11
67
  *
12
68
  * RadioGroup allows users to select exactly one option from a set of mutually exclusive choices.
13
- * Built on Radix UI primitives with custom styling that follows shadcn/ui design patterns.
14
- * Each radio group should contain RadioGroupItem components paired with Labels for accessibility.
69
+ * Built on Radix UI RadioGroup primitives with enhanced accessibility and keyboard navigation.
70
+ * Each radio group should contain RadioGroupItem components paired with Labels for proper accessibility.
71
+ *
72
+ * The component follows the WAI-ARIA Radio Group design pattern and uses roving tabindex to manage
73
+ * focus movement among radio items. It provides comprehensive keyboard navigation with arrow keys
74
+ * and supports both controlled and uncontrolled usage patterns.
15
75
  *
16
- * @example Basic usage
76
+ * @example Basic uncontrolled usage
17
77
  * ```tsx
18
78
  * <RadioGroup defaultValue="option-one">
19
79
  * <div className="flex items-center space-x-2">
@@ -51,9 +111,13 @@ import { cn } from "@/lib/utils";
51
111
  * }
52
112
  * ```
53
113
  *
54
- * @example Horizontal layout
114
+ * @example Horizontal orientation
55
115
  * ```tsx
56
- * <RadioGroup defaultValue="option-one" className="flex gap-4">
116
+ * <RadioGroup
117
+ * defaultValue="option-one"
118
+ * orientation="horizontal"
119
+ * className="flex gap-4"
120
+ * >
57
121
  * <div className="flex items-center space-x-2">
58
122
  * <RadioGroupItem value="option-one" id="r1" />
59
123
  * <Label htmlFor="r1">Option One</Label>
@@ -65,35 +129,80 @@ import { cn } from "@/lib/utils";
65
129
  * </RadioGroup>
66
130
  * ```
67
131
  *
68
- * @example With descriptions
132
+ * @example With rich content and descriptions
69
133
  * ```tsx
70
- * <RadioGroup defaultValue="card">
134
+ * <RadioGroup defaultValue="card" name="payment-method">
71
135
  * <div className="flex items-start space-x-2">
72
136
  * <RadioGroupItem value="card" id="card" className="mt-1" />
73
137
  * <div className="grid gap-1">
74
138
  * <Label htmlFor="card">Credit Card</Label>
75
139
  * <p className="text-sm text-muted-foreground">
76
- * Pay with your credit or debit card
140
+ * Pay with your credit or debit card via secure payment
141
+ * </p>
142
+ * </div>
143
+ * </div>
144
+ * <div className="flex items-start space-x-2">
145
+ * <RadioGroupItem value="paypal" id="paypal" className="mt-1" />
146
+ * <div className="grid gap-1">
147
+ * <Label htmlFor="paypal">PayPal</Label>
148
+ * <p className="text-sm text-muted-foreground">
149
+ * Pay with your PayPal account balance or linked bank account
77
150
  * </p>
78
151
  * </div>
79
152
  * </div>
80
153
  * </RadioGroup>
81
154
  * ```
82
155
  *
83
- * @param defaultValue - The default selected value when uncontrolled
84
- * @param value - The controlled value of the radio group
85
- * @param onValueChange - Callback fired when the value changes
86
- * @param disabled - Whether the entire radio group is disabled
87
- * @param required - Whether the radio group is required for form validation
88
- * @param orientation - The orientation of the radio group (defaults to vertical)
89
- * @param className - Additional CSS classes to apply to the radio group
90
- * @param children - RadioGroupItem components and their associated labels
156
+ * @example Disabled state and form usage
157
+ * ```tsx
158
+ * <form>
159
+ * <RadioGroup
160
+ * name="subscription"
161
+ * required
162
+ * defaultValue="basic"
163
+ * >
164
+ * <div className="flex items-center space-x-2">
165
+ * <RadioGroupItem value="basic" id="basic" />
166
+ * <Label htmlFor="basic">Basic Plan</Label>
167
+ * </div>
168
+ * <div className="flex items-center space-x-2">
169
+ * <RadioGroupItem value="premium" id="premium" disabled />
170
+ * <Label htmlFor="premium" className="opacity-50">
171
+ * Premium Plan (Coming Soon)
172
+ * </Label>
173
+ * </div>
174
+ * </RadioGroup>
175
+ * </form>
176
+ * ```
91
177
  *
92
- * @see {@link https://ui.shadcn.com/docs/components/radio-group} for design patterns
178
+ * @param defaultValue The value of the radio item that should be checked when initially rendered. Use when you do not need to control the checked state
179
+ * @param value The controlled value of the radio item to check. Should be used in conjunction with onValueChange
180
+ * @param onValueChange Event handler called when the value changes
181
+ * @param disabled When true, prevents the user from interacting with the radio group
182
+ * @param name The name of the group. Submitted with its owning form as part of a name/value pair
183
+ * @param required When true, indicates that the user must check a radio item before the owning form can be submitted
184
+ * @param orientation The orientation of the component, which determines how focus moves @default "vertical"
185
+ * @param dir The reading direction of the radio group. If omitted, assumes LTR reading mode
186
+ * @param loop When true, keyboard navigation will loop from last item to first, and vice versa @default true
187
+ * @param asChild Change the default rendered element for the one passed as a child @default false
188
+ * @param className Additional CSS classes to apply to the radio group
189
+ * @param children RadioGroupItem components and their associated labels
190
+ *
191
+ * @accessibility
192
+ * - Supports keyboard navigation with Tab to enter/exit and Arrow keys to navigate between items
193
+ * - Space key selects the focused radio item
194
+ * - Uses roving tabindex to manage focus within the group
195
+ * - Provides proper ARIA roles and states for screen readers
196
+ * - Announces selected/unselected states to assistive technologies
197
+ * - Supports Right-to-Left (RTL) text direction
198
+ * - Works with form validation and submission
199
+ *
200
+ * @see {@link RadioGroupItem} for individual radio button items
201
+ * @see {@link RadioGroupIndicator} for the visual checked indicator
202
+ * @see {@link https://ui.shadcn.com/docs/components/radio-group} shadcn/ui Radio Group documentation
203
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/radio-group} Radix UI Radio Group primitives
204
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/} WAI-ARIA Radio Group Pattern
93
205
  * @since 1.0.0
94
- * @see {@link RadioGroupItem} for individual radio options
95
- * @see {@link Checkbox} for multiple selection use cases
96
- * @see {@link Select} for dropdown-style single selection
97
206
  */
98
207
  function RadioGroup({
99
208
  className,
@@ -112,49 +221,94 @@ function RadioGroup({
112
221
  * Individual radio button item for use within RadioGroup
113
222
  *
114
223
  * RadioGroupItem represents a single selectable option in a radio group.
115
- * Must be used within a RadioGroup component and paired with a Label for accessibility.
224
+ * Must be used within a RadioGroup component and should be paired with a Label for proper accessibility.
116
225
  * The component automatically handles visual states including checked, unchecked, focused, and disabled.
226
+ * It includes a built-in indicator that displays when the item is selected.
227
+ *
228
+ * Each radio item requires a unique value prop that identifies it within the group.
229
+ * The component forwards all standard button attributes and supports custom styling via className.
117
230
  *
118
- * @example Basic usage
231
+ * @example Basic usage with label
119
232
  * ```tsx
120
- * <RadioGroupItem value="option-one" id="option-one" />
121
- * <Label htmlFor="option-one">Option One</Label>
233
+ * <div className="flex items-center space-x-2">
234
+ * <RadioGroupItem value="option-one" id="option-one" />
235
+ * <Label htmlFor="option-one">Option One</Label>
236
+ * </div>
122
237
  * ```
123
238
  *
124
- * @example With custom styling
239
+ * @example Custom styling and theming
125
240
  * ```tsx
126
241
  * <RadioGroupItem
127
242
  * value="premium"
128
243
  * id="premium"
129
- * className="border-purple-500 text-purple-500"
244
+ * className="border-purple-500 text-purple-500 data-[state=checked]:bg-purple-50"
130
245
  * />
131
- * <Label htmlFor="premium">Premium Plan</Label>
246
+ * <Label htmlFor="premium" className="text-purple-900">
247
+ * Premium Plan
248
+ * </Label>
132
249
  * ```
133
250
  *
134
251
  * @example Disabled state
135
252
  * ```tsx
136
- * <RadioGroupItem value="unavailable" id="unavailable" disabled />
137
- * <Label htmlFor="unavailable" className="opacity-50">
138
- * Unavailable Option
253
+ * <div className="flex items-center space-x-2">
254
+ * <RadioGroupItem value="unavailable" id="unavailable" disabled />
255
+ * <Label htmlFor="unavailable" className="opacity-50 cursor-not-allowed">
256
+ * Unavailable Option
257
+ * </Label>
258
+ * </div>
259
+ * ```
260
+ *
261
+ * @example With complex content layout
262
+ * ```tsx
263
+ * <div className="flex items-start space-x-3 p-3 border rounded-lg">
264
+ * <RadioGroupItem value="plan-pro" id="plan-pro" className="mt-1" />
265
+ * <div className="grid gap-1">
266
+ * <Label htmlFor="plan-pro" className="font-semibold">
267
+ * Professional Plan
268
+ * </Label>
269
+ * <p className="text-sm text-muted-foreground">
270
+ * Advanced features for growing teams
271
+ * </p>
272
+ * <p className="text-lg font-bold">$29/month</p>
273
+ * </div>
274
+ * </div>
275
+ * ```
276
+ *
277
+ * @example Form integration with validation
278
+ * ```tsx
279
+ * <RadioGroupItem
280
+ * value="terms-accept"
281
+ * id="terms"
282
+ * required
283
+ * aria-describedby="terms-error"
284
+ * />
285
+ * <Label htmlFor="terms">
286
+ * I accept the terms and conditions
139
287
  * </Label>
140
288
  * ```
141
289
  *
142
- * @param value - The unique value for this radio option
143
- * @param id - The id attribute for accessibility (should match Label's htmlFor)
144
- * @param disabled - Whether this specific radio option is disabled
145
- * @param className - Additional CSS classes for custom styling
146
- * @param ref - React ref forwarded to the underlying input element
290
+ * @param value The value given as data when submitted with a name (required)
291
+ * @param disabled When true, prevents the user from interacting with the item
292
+ * @param required When true, indicates that the user must check the item before the owning form can be submitted
293
+ * @param asChild Change the default rendered element for the one passed as a child @default false
294
+ * @param id The id attribute for accessibility (should match Label's htmlFor)
295
+ * @param className Additional CSS classes for custom styling
296
+ * @param children Content to render inside the radio item (typically empty as styling is handled by the indicator)
147
297
  *
148
298
  * @accessibility
149
- * - Automatically receives focus management from parent RadioGroup
150
- * - Arrow keys navigate between radio options
151
- * - Space key toggles selection
152
- * - Screen readers announce checked/unchecked state
153
- * - Focus visible indicator for keyboard navigation
154
- * - Proper ARIA attributes and roles
155
- *
156
- * @see {@link RadioGroup} for the parent container component
157
- * @see {@link https://ui.shadcn.com/docs/components/radio-group} for usage patterns
299
+ * - Receives focus management from parent RadioGroup component
300
+ * - Arrow keys navigate between radio options within the group
301
+ * - Space key selects the focused radio item
302
+ * - Screen readers announce checked/unchecked state changes
303
+ * - Focus visible indicator appears on keyboard navigation
304
+ * - Proper ARIA attributes (role="radio", aria-checked) applied automatically
305
+ * - Works with form validation and submission
306
+ * - Supports required attribute for form validation
307
+ *
308
+ * @see {@link RadioGroup} for the parent container component that manages the group behavior
309
+ * @see {@link RadioGroupIndicator} for the visual checked state indicator
310
+ * @see {@link https://ui.shadcn.com/docs/components/radio-group} shadcn/ui Radio Group usage patterns
311
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/radio-group} Radix UI Radio Group Item documentation
158
312
  * @since 1.0.0
159
313
  */
160
314
  function RadioGroupItem({
@@ -170,14 +324,69 @@ function RadioGroupItem({
170
324
  )}
171
325
  {...props}
172
326
  >
173
- <RadioGroupPrimitive.Indicator
174
- data-slot="radio-group-indicator"
175
- className="relative flex items-center justify-center"
176
- >
177
- <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
178
- </RadioGroupPrimitive.Indicator>
327
+ <RadioGroupIndicator />
179
328
  </RadioGroupPrimitive.Item>
180
329
  );
181
330
  }
182
331
 
183
- export { RadioGroup, RadioGroupItem };
332
+ /**
333
+ * Visual indicator shown when a RadioGroupItem is in the checked state
334
+ *
335
+ * RadioGroupIndicator automatically appears inside RadioGroupItem when that item is selected.
336
+ * It provides the visual feedback for the checked state using a filled circle icon.
337
+ * The indicator is automatically managed by the RadioGroupItem and only renders when checked.
338
+ *
339
+ * This component is typically not used directly but is included in RadioGroupItem.
340
+ * It can be customized or replaced using the asChild pattern if needed.
341
+ *
342
+ * @example Default usage (automatic within RadioGroupItem)
343
+ * ```tsx
344
+ * // RadioGroupIndicator is automatically included in RadioGroupItem
345
+ * <RadioGroupItem value="selected" id="selected" />
346
+ * ```
347
+ *
348
+ * @example Custom indicator with asChild
349
+ * ```tsx
350
+ * <RadioGroupItem value="custom" id="custom">
351
+ * <RadioGroupIndicator asChild>
352
+ * <CheckIcon className="size-3 text-primary" />
353
+ * </RadioGroupIndicator>
354
+ * </RadioGroupItem>
355
+ * ```
356
+ *
357
+ * @example Force mounted indicator (for animations)
358
+ * ```tsx
359
+ * <RadioGroupIndicator forceMount className="animate-scale-in" />
360
+ * ```
361
+ *
362
+ * @param forceMount Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries
363
+ * @param asChild Change the default rendered element for the one passed as a child @default false
364
+ * @param className Additional CSS classes for custom styling of the indicator
365
+ * @param children Custom content to render instead of the default CircleIcon (when using asChild)
366
+ *
367
+ * @accessibility
368
+ * - Automatically managed by RadioGroup state - no manual interaction needed
369
+ * - Provides visual confirmation of selection for users who can see
370
+ * - Works with high contrast mode and forced colors
371
+ * - Scales appropriately with font size changes
372
+ *
373
+ * @see {@link RadioGroupItem} for the parent radio button component
374
+ * @see {@link RadioGroup} for the container component
375
+ * @since 1.0.0
376
+ */
377
+ function RadioGroupIndicator({
378
+ className,
379
+ ...props
380
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Indicator>) {
381
+ return (
382
+ <RadioGroupPrimitive.Indicator
383
+ data-slot="radio-group-indicator"
384
+ className={cn("relative flex items-center justify-center", className)}
385
+ {...props}
386
+ >
387
+ <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
388
+ </RadioGroupPrimitive.Indicator>
389
+ );
390
+ }
391
+
392
+ export { RadioGroup, RadioGroupItem, RadioGroupIndicator };