@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,66 +1,148 @@
1
1
  import { cn } from "@/lib/utils";
2
2
 
3
3
  /**
4
- * A skeleton component for displaying loading placeholders that improve perceived performance
4
+ * Props for Skeleton component (Documentation only - NOT used in component implementation)
5
+ * These types are for documentation generation and should not replace HTML div inferred types
6
+ */
7
+ // eslint-disable-next-line unused-imports/no-unused-vars
8
+ type SkeletonDocsProps = {
9
+ /** Additional CSS classes for customizing size, shape, and appearance */
10
+ className?: string;
11
+ /** Custom children content (rarely used as skeletons are typically empty) */
12
+ children?: React.ReactNode;
13
+ /** ARIA label for accessibility when the skeleton represents specific content */
14
+ "aria-label"?: string;
15
+ /** ARIA description for accessibility when additional context is needed */
16
+ "aria-describedby"?: string;
17
+ /** Role attribute for semantic meaning (defaults to generic presentation) @default "presentation" */
18
+ role?: string;
19
+ /** Test ID for component testing */
20
+ "data-testid"?: string;
21
+ } & React.HTMLAttributes<HTMLDivElement>;
22
+
23
+ /**
24
+ * Skeleton - Animated loading placeholder that improves perceived performance
5
25
  *
6
- * The Skeleton component creates animated placeholders that mimic the structure and layout
7
- * of content that is being loaded. It uses a subtle pulse animation to indicate loading
8
- * state and maintains layout stability during data fetching operations.
26
+ * A lightweight component that creates animated placeholders mimicking the structure
27
+ * and layout of content being loaded. Features a subtle pulse animation to indicate
28
+ * loading state while maintaining layout stability during data fetching operations.
9
29
  *
10
- * Based on shadcn/ui skeleton patterns, this component is designed to be highly composable
11
- * and can be shaped to match any content structure using Tailwind CSS classes.
30
+ * Built on standard HTML div element with Tailwind CSS animations. Designed to be
31
+ * highly composable and can be shaped to match any content structure using className.
32
+ * The component uses semantic presentation role by default for optimal accessibility.
12
33
  *
13
34
  * @example
14
35
  * ```tsx
15
- * // Basic usage - simple text placeholder
36
+ * // Basic text content placeholder
16
37
  * <Skeleton className="h-4 w-[250px]" />
17
38
  * ```
18
39
  *
19
40
  * @example
20
41
  * ```tsx
21
- * // Avatar skeleton - circular placeholder
22
- * <Skeleton className="h-12 w-12 rounded-full" />
42
+ * // Avatar placeholder - circular skeleton
43
+ * <Skeleton className="h-12 w-12 rounded-full" aria-label="Loading user avatar" />
44
+ * ```
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // Button placeholder with proper dimensions
49
+ * <Skeleton className="h-10 w-24 rounded-md" aria-label="Loading action button" />
23
50
  * ```
24
51
  *
25
52
  * @example
26
53
  * ```tsx
27
- * // Card skeleton - structured content placeholder
28
- * <div className="space-y-2">
29
- * <Skeleton className="h-6 w-3/4" />
30
- * <Skeleton className="h-4 w-full" />
31
- * <Skeleton className="h-4 w-5/6" />
54
+ * // Image placeholder with aspect ratio
55
+ * <Skeleton className="h-48 w-full rounded-lg" aria-label="Loading featured image" />
56
+ * ```
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * // Card content structure - multiple related skeletons
61
+ * <div className="space-y-3" aria-busy="true" aria-label="Loading article content">
62
+ * <Skeleton className="h-6 w-3/4" /> // Title
63
+ * <Skeleton className="h-4 w-full" /> // First line
64
+ * <Skeleton className="h-4 w-5/6" /> // Second line
65
+ * <Skeleton className="h-4 w-4/5" /> // Third line
32
66
  * </div>
33
67
  * ```
34
68
  *
35
69
  * @example
36
70
  * ```tsx
37
- * // Complex layout with multiple skeletons
38
- * <Card>
39
- * <CardHeader>
40
- * <div className="flex items-center gap-3">
41
- * <Skeleton className="h-10 w-10 rounded-full" />
42
- * <div className="space-y-2">
43
- * <Skeleton className="h-4 w-24" />
44
- * <Skeleton className="h-3 w-16" />
45
- * </div>
71
+ * // Complex user profile layout
72
+ * <Card className="p-6">
73
+ * <div className="flex items-center gap-4 mb-4">
74
+ * <Skeleton className="h-16 w-16 rounded-full" aria-label="Loading profile picture" />
75
+ * <div className="space-y-2">
76
+ * <Skeleton className="h-5 w-32" /> // Name
77
+ * <Skeleton className="h-4 w-24" /> // Title
78
+ * <Skeleton className="h-3 w-20" /> // Status
46
79
  * </div>
47
- * </CardHeader>
48
- * <CardContent>
80
+ * </div>
81
+ * <div className="space-y-3">
49
82
  * <Skeleton className="h-4 w-full" />
50
83
  * <Skeleton className="h-4 w-4/5" />
51
- * </CardContent>
84
+ * <Skeleton className="h-32 w-full rounded-md" /> // Content area
85
+ * </div>
52
86
  * </Card>
53
87
  * ```
54
88
  *
55
- * @param className - Additional CSS classes for customizing size, shape, and appearance
56
- * @param props - Standard HTML div element props
89
+ * @example
90
+ * ```tsx
91
+ * // Data table loading state
92
+ * <div className="space-y-2" aria-busy="true" aria-label="Loading table data">
93
+ * {Array.from({ length: 5 }).map((_, index) => (
94
+ * <div key={index} className="flex items-center gap-4 p-2">
95
+ * <Skeleton className="h-8 w-8 rounded-full" />
96
+ * <Skeleton className="h-4 w-32" />
97
+ * <Skeleton className="h-4 w-24" />
98
+ * <Skeleton className="h-4 w-16" />
99
+ * <div className="ml-auto">
100
+ * <Skeleton className="h-8 w-20 rounded-md" />
101
+ * </div>
102
+ * </div>
103
+ * ))}
104
+ * </div>
105
+ * ```
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * // Navigation menu loading
110
+ * <nav className="space-y-2" aria-label="Loading navigation">
111
+ * {Array.from({ length: 4 }).map((_, index) => (
112
+ * <div key={index} className="flex items-center gap-3 p-2">
113
+ * <Skeleton className="h-5 w-5 rounded" /> // Icon
114
+ * <Skeleton className="h-4 w-20" /> // Label
115
+ * </div>
116
+ * ))}
117
+ * </nav>
118
+ * ```
57
119
  *
58
120
  * @accessibility
59
- * The component includes a pulse animation to indicate loading state and maintains
60
- * layout stability. Consider adding aria-busy="true" or aria-label="Loading content"
61
- * to parent containers for better screen reader support.
121
+ * - Uses pulse animation to indicate loading state without being distracting
122
+ * - Maintains layout dimensions to prevent content jumping when real content loads
123
+ * - Supports ARIA labels for screen reader context when representing specific content
124
+ * - Consider wrapping multiple related skeletons in containers with aria-busy="true"
125
+ * - Respects prefers-reduced-motion user preference through Tailwind's animate-pulse
126
+ * - Use meaningful aria-label values to describe what content is being loaded
127
+ * - Group related skeletons with appropriate ARIA landmarks for better navigation
128
+ *
129
+ * @performance
130
+ * - Lightweight implementation with minimal DOM overhead
131
+ * - CSS-based pulse animation is GPU-accelerated and performant
132
+ * - No JavaScript animations or intervals for optimal battery life
133
+ * - Optimized for SSR and hydration without layout shifts
134
+ *
135
+ * @styling
136
+ * - Base classes: bg-accent animate-pulse rounded-md
137
+ * - Highly customizable via className prop with Tailwind utilities
138
+ * - Common patterns: h-4 w-[200px] (text), h-12 w-12 rounded-full (avatar)
139
+ * - Responsive sizing: w-full md:w-1/2 lg:w-1/3 for adaptive layouts
140
+ * - Shape variants: rounded-none (rectangular), rounded-full (circular), rounded-lg (images)
62
141
  *
63
- * @see {@link https://ui.shadcn.com/docs/components/skeleton} shadcn/ui Skeleton documentation
142
+ * @see {@link https://ui.shadcn.com/docs/components/skeleton} shadcn/ui Skeleton Documentation
143
+ * @see {@link Card} Often used within card layouts for structured content loading
144
+ * @see {@link Avatar} Use with Avatar components for profile loading states
145
+ * @see {@link Button} Match button dimensions for interactive element placeholders
64
146
  * @since 1.0.0
65
147
  */
66
148
  function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
@@ -4,24 +4,66 @@ import * as SliderPrimitive from "@radix-ui/react-slider";
4
4
  import { cn } from "@/lib/utils";
5
5
 
6
6
  /**
7
- * Slider component for selecting numeric values within a range
7
+ * Props for Slider (Documentation only - NOT used in component implementation)
8
+ * These types are for documentation generation and should not replace Radix inferred types
9
+ */
10
+ // eslint-disable-next-line unused-imports/no-unused-vars
11
+ type SliderDocsProps = {
12
+ /** Additional CSS classes for styling customization */
13
+ className?: string;
14
+ /** Change the default rendered element for the one passed as a child, merging their props and behavior @default false */
15
+ asChild?: boolean;
16
+ /** The default value(s) of the slider when initially rendered. Use when you do not need to control the state of the slider. Provide an array with single value for a single thumb, or multiple values for multiple thumbs. */
17
+ defaultValue?: number[];
18
+ /** The controlled value(s) of the slider. Must be used in conjunction with onValueChange. Provide an array with single value for a single thumb, or multiple values for multiple thumbs. */
19
+ value?: number[];
20
+ /** Event handler called when the slider value changes during interaction. Receives an array of current values. */
21
+ onValueChange?: (value: number[]) => void;
22
+ /** Event handler called when the value changes at the end of an interaction (mouse up, touch end, key release). Useful when you only need to capture a final value e.g. to update a backend service. */
23
+ onValueCommit?: (value: number[]) => void;
24
+ /** The name of the slider. Submitted with its owning form as part of a name/value pair. When multiple thumbs are used, multiple inputs will be rendered. */
25
+ name?: string;
26
+ /** When true, prevents the user from interacting with the slider. Disabled sliders cannot be focused and do not receive keyboard events. @default false */
27
+ disabled?: boolean;
28
+ /** The orientation of the slider. Affects layout and keyboard navigation behavior. @default "horizontal" */
29
+ orientation?: "horizontal" | "vertical";
30
+ /** The reading direction of the slider. If omitted, inherits globally from DirectionProvider or assumes LTR reading mode. Affects the direction of value changes with arrow keys. */
31
+ dir?: "ltr" | "rtl";
32
+ /** Whether the slider is visually inverted. When true, the range appears on the opposite side and keyboard navigation is reversed. @default false */
33
+ inverted?: boolean;
34
+ /** The minimum value for the range. Must be less than max. @default 0 */
35
+ min?: number;
36
+ /** The maximum value for the range. Must be greater than min. @default 100 */
37
+ max?: number;
38
+ /** The stepping interval. Values will be rounded to multiples of this number. Use 0 for infinite precision. @default 1 */
39
+ step?: number;
40
+ /** The minimum permitted steps between multiple thumbs. Prevents thumbs from overlapping or getting too close to each other. @default 0 */
41
+ minStepsBetweenThumbs?: number;
42
+ /** The ID of the form that the slider belongs to. If omitted, the slider will be associated with a parent form if one exists. Used for form submission and validation. */
43
+ form?: string;
44
+ } & React.ComponentProps<typeof SliderPrimitive.Root>;
45
+
46
+ /**
47
+ * Slider - Range input control for selecting numeric values
8
48
  *
9
49
  * A versatile range input control built on Radix UI Slider primitives that allows users
10
50
  * to select single or multiple values by dragging thumbs along a track. Supports both
11
- * horizontal and vertical orientations, custom ranges, step intervals, and accessibility
12
- * features for keyboard and touch interaction.
51
+ * horizontal and vertical orientations, custom ranges, step intervals, and comprehensive
52
+ * accessibility features for keyboard and touch interaction.
13
53
  *
14
- * Based on the shadcn/ui Slider component with enhanced styling and behavior.
54
+ * The component automatically renders the appropriate number of thumbs based on the
55
+ * number of values provided, supporting both single-value and multi-value range selection.
56
+ * Built with enhanced styling and smooth animations for an optimal user experience.
15
57
  *
16
58
  * @example
17
59
  * ```tsx
18
60
  * // Basic single-value slider
19
- * <Slider defaultValue={[33]} max={100} step={1} />
61
+ * <Slider defaultValue={[50]} max={100} step={1} />
20
62
  * ```
21
63
  *
22
64
  * @example
23
65
  * ```tsx
24
- * // Controlled slider with state
66
+ * // Controlled slider with state management
25
67
  * const [value, setValue] = useState([25])
26
68
  *
27
69
  * <Slider
@@ -34,7 +76,7 @@ import { cn } from "@/lib/utils";
34
76
  *
35
77
  * @example
36
78
  * ```tsx
37
- * // Range slider with two thumbs
79
+ * // Range slider with two thumbs for selecting a range
38
80
  * <Slider
39
81
  * defaultValue={[25, 75]}
40
82
  * max={100}
@@ -45,7 +87,7 @@ import { cn } from "@/lib/utils";
45
87
  *
46
88
  * @example
47
89
  * ```tsx
48
- * // Vertical orientation
90
+ * // Vertical orientation for space-constrained layouts
49
91
  * <Slider
50
92
  * defaultValue={[50]}
51
93
  * max={100}
@@ -56,7 +98,7 @@ import { cn } from "@/lib/utils";
56
98
  *
57
99
  * @example
58
100
  * ```tsx
59
- * // Custom range and step
101
+ * // Custom range and step intervals for precise control
60
102
  * <Slider
61
103
  * defaultValue={[500]}
62
104
  * min={0}
@@ -65,34 +107,38 @@ import { cn } from "@/lib/utils";
65
107
  * />
66
108
  * ```
67
109
  *
110
+ * @example
111
+ * ```tsx
112
+ * // Form integration with name and onValueCommit
113
+ * <form>
114
+ * <Slider
115
+ * name="volume"
116
+ * defaultValue={[75]}
117
+ * max={100}
118
+ * onValueCommit={(value) => console.log('Final value:', value)}
119
+ * />
120
+ * </form>
121
+ * ```
122
+ *
68
123
  * @accessibility
69
124
  * - Implements WAI-ARIA slider pattern with proper roles and properties
70
- * - Arrow keys adjust value by step amount (Left/Down decrease, Right/Up increase)
71
- * - Page Up/Page Down adjust by larger increments (10 × step)
72
- * - Home/End keys jump to minimum/maximum values
73
- * - Supports keyboard navigation with focus visible indicators
74
- * - Touch and mouse interaction supported
75
- * - Screen reader announcements for value changes
125
+ * - Full keyboard navigation support:
126
+ * - Arrow keys adjust value by step amount (Left/Down decrease, Right/Up increase)
127
+ * - Page Up/Page Down adjust by larger increments (typically 10 × step)
128
+ * - Shift + Arrow keys for larger adjustments
129
+ * - Home/End keys jump to minimum/maximum values
130
+ * - Focus management with visible focus indicators and ring styling
131
+ * - Touch and mouse interaction fully supported with proper pointer events
132
+ * - Screen reader announcements for value changes and state updates
76
133
  * - Disabled state properly communicated to assistive technologies
134
+ * - Automatic form integration with proper name/value pairs
135
+ * - RTL (right-to-left) text direction support
77
136
  *
78
- * @see {@link https://ui.shadcn.com/docs/components/slider} for design patterns
79
- * @see {@link https://www.radix-ui.com/docs/primitives/components/slider} for API reference
80
- *
137
+ * @see {@link https://ui.shadcn.com/docs/components/slider} shadcn/ui Slider Documentation
138
+ * @see {@link https://www.radix-ui.com/docs/primitives/components/slider} Radix UI Slider API Reference
139
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/slider/} WAI-ARIA Slider Pattern
81
140
  * @since 1.0.0
82
141
  */
83
- /**
84
- * @param className - Additional CSS classes for styling customization
85
- * @param defaultValue - The default value(s) of the slider (uncontrolled)
86
- * @param value - The controlled value(s) of the slider
87
- * @param min - The minimum value of the slider (default: 0)
88
- * @param max - The maximum value of the slider (default: 100)
89
- * @param step - The step interval for value changes (default: 1)
90
- * @param orientation - The orientation of the slider ("horizontal" | "vertical")
91
- * @param disabled - Whether the slider is disabled
92
- * @param onValueChange - Callback fired when the value changes
93
- * @param minStepsBetweenThumbs - Minimum steps between thumbs in range mode
94
- * @param ...props - Additional props passed to the underlying Radix Slider Root
95
- */
96
142
  function Slider({
97
143
  className,
98
144
  defaultValue,