@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 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/components/ui/theme.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GG;AACH,wBAAgB,KAAK,4CAuCpB"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/components/ui/theme.tsx"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+LG;AACH,wBAAgB,KAAK,4CAuCpB"}
@@ -7,13 +7,18 @@ import { toggleVariants } from "@/components/ui/toggle";
7
7
  *
8
8
  * ToggleGroup provides a way to group related toggle buttons together, allowing users
9
9
  * to select from a set of mutually exclusive options (single selection) or independent
10
- * options (multiple selection). Built on Radix UI Toggle Group primitive with support
11
- * for keyboard navigation and accessibility features.
10
+ * options (multiple selection). Built on Radix UI Toggle Group primitive with enhanced
11
+ * styling through CVA variants and full accessibility support including keyboard navigation.
12
12
  *
13
- * @example
13
+ * The component supports both controlled and uncontrolled usage patterns, with automatic
14
+ * focus management and roving tabindex behavior. Visual variants are inherited by all child
15
+ * items but can be overridden per item if needed.
16
+ *
17
+ * @example Single selection with icons (radio button behavior)
14
18
  * ```tsx
15
- * // Single selection (like radio buttons)
16
- * <ToggleGroup type="single" defaultValue="center">
19
+ * import { AlignLeft, AlignCenter, AlignRight } from "lucide-react";
20
+ *
21
+ * <ToggleGroup type="single" defaultValue="center" aria-label="Text alignment">
17
22
  * <ToggleGroupItem value="left" aria-label="Align left">
18
23
  * <AlignLeft className="h-4 w-4" />
19
24
  * </ToggleGroupItem>
@@ -26,108 +31,179 @@ import { toggleVariants } from "@/components/ui/toggle";
26
31
  * </ToggleGroup>
27
32
  * ```
28
33
  *
29
- * @example
34
+ * @example Multiple selection with controlled state
30
35
  * ```tsx
31
- * // Multiple selection (like checkboxes)
32
- * <ToggleGroup type="multiple" defaultValue={["bold", "italic"]}>
33
- * <ToggleGroupItem value="bold" aria-label="Toggle bold">
34
- * <Bold className="h-4 w-4" />
35
- * </ToggleGroupItem>
36
- * <ToggleGroupItem value="italic" aria-label="Toggle italic">
37
- * <Italic className="h-4 w-4" />
38
- * </ToggleGroupItem>
39
- * <ToggleGroupItem value="underline" aria-label="Toggle underline">
40
- * <Underline className="h-4 w-4" />
41
- * </ToggleGroupItem>
42
- * </ToggleGroup>
36
+ * import { Bold, Italic, Underline } from "lucide-react";
37
+ *
38
+ * function TextEditor() {
39
+ * const [formatting, setFormatting] = useState<string[]>(["bold"]);
40
+ *
41
+ * return (
42
+ * <ToggleGroup
43
+ * type="multiple"
44
+ * value={formatting}
45
+ * onValueChange={setFormatting}
46
+ * aria-label="Text formatting"
47
+ * >
48
+ * <ToggleGroupItem value="bold" aria-label="Toggle bold">
49
+ * <Bold className="h-4 w-4" />
50
+ * </ToggleGroupItem>
51
+ * <ToggleGroupItem value="italic" aria-label="Toggle italic">
52
+ * <Italic className="h-4 w-4" />
53
+ * </ToggleGroupItem>
54
+ * <ToggleGroupItem value="underline" aria-label="Toggle underline">
55
+ * <Underline className="h-4 w-4" />
56
+ * </ToggleGroupItem>
57
+ * </ToggleGroup>
58
+ * );
59
+ * }
43
60
  * ```
44
61
  *
45
- * @example
62
+ * @example Text-based options with outline variant
46
63
  * ```tsx
47
- * // Text-based options with variants
48
- * <ToggleGroup type="single" variant="outline" size="sm">
64
+ * <ToggleGroup type="single" variant="outline" size="sm" defaultValue="draft">
49
65
  * <ToggleGroupItem value="draft">Draft</ToggleGroupItem>
66
+ * <ToggleGroupItem value="review">In Review</ToggleGroupItem>
50
67
  * <ToggleGroupItem value="published">Published</ToggleGroupItem>
51
68
  * <ToggleGroupItem value="archived">Archived</ToggleGroupItem>
52
69
  * </ToggleGroup>
53
70
  * ```
54
71
  *
55
- * @param type - Selection mode: "single" for radio-like behavior, "multiple" for checkbox-like
56
- * @param variant - Visual style: "default" (subtle) or "outline" (bordered)
57
- * @param size - Size variant: "sm", "default", or "lg"
58
- * @param disabled - Whether the entire group is disabled
59
- * @param defaultValue - Initial selected value(s) - string for single, array for multiple
60
- * @param value - Controlled selected value(s) - string for single, array for multiple
61
- * @param onValueChange - Callback when selection changes
72
+ * @example Vertical orientation for sidebar controls
73
+ * ```tsx
74
+ * <ToggleGroup
75
+ * type="multiple"
76
+ * orientation="vertical"
77
+ * variant="outline"
78
+ * className="flex-col"
79
+ * >
80
+ * <ToggleGroupItem value="notifications">Notifications</ToggleGroupItem>
81
+ * <ToggleGroupItem value="sidebar">Show Sidebar</ToggleGroupItem>
82
+ * <ToggleGroupItem value="minimap">Show Minimap</ToggleGroupItem>
83
+ * </ToggleGroup>
84
+ * ```
85
+ *
86
+ * @example Mixed content with icons and text
87
+ * ```tsx
88
+ * <ToggleGroup type="single" variant="outline" size="lg">
89
+ * <ToggleGroupItem value="grid">
90
+ * <Grid className="h-4 w-4" />
91
+ * Grid View
92
+ * </ToggleGroupItem>
93
+ * <ToggleGroupItem value="list">
94
+ * <List className="h-4 w-4" />
95
+ * List View
96
+ * </ToggleGroupItem>
97
+ * </ToggleGroup>
98
+ * ```
99
+ *
100
+ * @variant default - Subtle background styling with transparent base, accent color when pressed
101
+ * @variant outline - Bordered styling with subtle shadow, maintains outline when pressed
62
102
  *
63
103
  * @accessibility
64
- * - Uses role="group" with appropriate ARIA attributes
65
- * - Arrow keys navigate between items with roving tabindex
66
- * - Space or Enter key toggles item selection
67
- * - Home/End keys jump to first/last items
104
+ * - Implements WAI-ARIA ToggleButton pattern with proper roles and states
105
+ * - Uses roving tabindex for keyboard navigation between items
106
+ * - Arrow keys navigate between items (direction based on orientation)
107
+ * - Space or Enter key toggles item selection state
108
+ * - Home key moves focus to first item, End key to last item
109
+ * - Focus wraps from last to first item when loop=true (default)
68
110
  * - Supports disabled state for individual items or entire group
69
- * - Screen readers announce selection state changes
111
+ * - Screen readers announce selection state changes via aria-pressed
112
+ * - Proper focus management with visible focus indicators
113
+ * - Group labeling via aria-label or aria-labelledby recommended
70
114
  *
71
- * @see {@link ToggleGroupItem} - Individual toggle items within the group
72
- * @see {@link Toggle} - Standalone toggle button component
73
- * @see {@link https://ui.shadcn.com/docs/components/toggle-group} - Design system documentation
115
+ * @see {@link ToggleGroupItem} Individual toggle items within the group
116
+ * @see {@link Toggle} Standalone toggle button component
117
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/toggle-group} Radix UI ToggleGroup primitive
118
+ * @see {@link https://ui.shadcn.com/docs/components/toggle-group} Design system documentation
119
+ * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/button/} WAI-ARIA Toggle Button pattern
74
120
  * @since 1.0.0
75
121
  */
76
- declare function ToggleGroup({ className, variant, size, children, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
122
+ declare function ToggleGroup({ className, variant, size, children, ...props }: React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
77
123
  /**
78
124
  * Toggle Group Item - Individual selectable item within a ToggleGroup
79
125
  *
80
- * Represents a single option within a ToggleGroup component. Automatically inherits
81
- * variant and size styling from the parent ToggleGroup context, but these can be
82
- * overridden for specific items if needed. Supports icons, text, or mixed content.
126
+ * Represents a single toggleable option within a ToggleGroup component. Each item
127
+ * automatically inherits variant and size styling from the parent ToggleGroup context
128
+ * through React Context, but these can be overridden for specific styling needs.
129
+ * Supports flexible content including icons, text, or mixed combinations.
83
130
  *
84
- * @example
131
+ * The component participates in the parent ToggleGroup's keyboard navigation and
132
+ * selection behavior, with proper ARIA attributes for accessibility. Focus management
133
+ * and selection state are handled automatically by the Radix UI primitive.
134
+ *
135
+ * @example Text-based item with inherited styling
85
136
  * ```tsx
86
- * // Text-based item
87
137
  * <ToggleGroupItem value="draft">Draft</ToggleGroupItem>
88
138
  * ```
89
139
  *
90
- * @example
140
+ * @example Icon-only item with required accessibility label
91
141
  * ```tsx
92
- * // Icon-only item (requires aria-label)
142
+ * import { Bold } from "lucide-react";
143
+ *
93
144
  * <ToggleGroupItem value="bold" aria-label="Toggle bold formatting">
94
145
  * <Bold className="h-4 w-4" />
95
146
  * </ToggleGroupItem>
96
147
  * ```
97
148
  *
98
- * @example
149
+ * @example Mixed content with icon and descriptive text
99
150
  * ```tsx
100
- * // Mixed content with icon and text
101
- * <ToggleGroupItem value="bold">
102
- * <Bold className="h-4 w-4" />
103
- * Bold
151
+ * import { Calendar } from "lucide-react";
152
+ *
153
+ * <ToggleGroupItem value="calendar">
154
+ * <Calendar className="h-4 w-4" />
155
+ * Calendar View
104
156
  * </ToggleGroupItem>
105
157
  * ```
106
158
  *
107
- * @example
159
+ * @example Override inherited styling for special emphasis
108
160
  * ```tsx
109
- * // Override inherited styling
110
- * <ToggleGroupItem value="special" variant="outline" size="lg">
111
- * Special Option
161
+ * <ToggleGroupItem
162
+ * value="premium"
163
+ * variant="outline"
164
+ * size="lg"
165
+ * className="border-gold text-gold"
166
+ * >
167
+ * Premium Feature
112
168
  * </ToggleGroupItem>
113
169
  * ```
114
170
  *
115
- * @param value - Unique identifier for this item within the group (required)
116
- * @param disabled - Whether this specific item is disabled
117
- * @param variant - Override variant from parent ToggleGroup
118
- * @param size - Override size from parent ToggleGroup
119
- * @param children - Content to display (icons, text, or both)
171
+ * @example Disabled item within functional group
172
+ * ```tsx
173
+ * <ToggleGroupItem
174
+ * value="coming-soon"
175
+ * disabled
176
+ * aria-label="Feature coming soon"
177
+ * >
178
+ * <Sparkles className="h-4 w-4" />
179
+ * Coming Soon
180
+ * </ToggleGroupItem>
181
+ * ```
182
+ *
183
+ * @example Using asChild for custom element composition
184
+ * ```tsx
185
+ * <ToggleGroupItem value="custom" asChild>
186
+ * <a href="/settings" className="no-underline">
187
+ * <Settings className="h-4 w-4" />
188
+ * Settings
189
+ * </a>
190
+ * </ToggleGroupItem>
191
+ * ```
120
192
  *
121
193
  * @accessibility
122
- * - Participates in parent ToggleGroup's keyboard navigation
123
- * - Uses aria-pressed to indicate selection state
124
- * - Supports focus management with visible focus indicators
125
- * - For icon-only items, always provide aria-label for screen readers
126
- * - Disabled items are excluded from keyboard navigation
127
- *
128
- * @see {@link ToggleGroup} - Parent container component
129
- * @see {@link Toggle} - Standalone toggle button
194
+ * - Participates in parent ToggleGroup's roving tabindex navigation
195
+ * - Uses aria-pressed attribute to indicate selection state ("true"/"false")
196
+ * - Supports focus management with visible focus indicators and proper focus ring
197
+ * - For icon-only items, always provide aria-label for screen reader users
198
+ * - Disabled items are excluded from keyboard navigation and marked non-interactive
199
+ * - Inherits semantic meaning from parent group's aria-label or aria-labelledby
200
+ * - Proper button semantics with keyboard activation (Space/Enter)
201
+ *
202
+ * @see {@link ToggleGroup} Parent container component that manages selection state
203
+ * @see {@link Toggle} Standalone toggle button for independent usage
204
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/toggle-group} Radix UI primitive documentation
205
+ * @since 1.0.0
130
206
  */
131
- declare function ToggleGroupItem({ className, children, variant, size, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
207
+ declare function ToggleGroupItem({ className, children, variant, size, ...props }: React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): import("react/jsx-runtime").JSX.Element;
132
208
  export { ToggleGroup, ToggleGroupItem };
133
209
  //# sourceMappingURL=toggle-group.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-group.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toggle-group.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,iBAAS,WAAW,CA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;;;;;;;;;;;;;;GAmFG;AACH,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,2CAqBxG;AAED,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC"}
@@ -1,22 +1,60 @@
1
1
  import * as React from "react";
2
- import * as TogglePrimitive from "@radix-ui/react-toggle";
3
- import { type VariantProps } from "class-variance-authority";
2
+ /**
3
+ * Toggle component variant configuration
4
+ *
5
+ * Defines visual styles and sizing options for the toggle component
6
+ * with proper state indicators and accessibility features.
7
+ *
8
+ * @variant default - Clean transparent background with hover states
9
+ * @variant outline - Bordered style with subtle shadow for emphasis
10
+ *
11
+ * @size sm - Compact 32px height for dense layouts
12
+ * @size default - Standard 36px height for general use
13
+ * @size lg - Large 40px height for prominent actions
14
+ */
4
15
  declare const toggleVariants: (props?: ({
5
16
  variant?: "default" | "outline" | null | undefined;
6
17
  size?: "default" | "sm" | "lg" | null | undefined;
7
18
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
19
+ /**
20
+ * Props for Toggle component
21
+ *
22
+ * Combines Radix UI Toggle primitive props with custom variant styling options.
23
+ * Supports both controlled and uncontrolled usage patterns.
24
+ */
25
+ type ToggleProps = {
26
+ /** Whether to render as a child element instead of the default button */
27
+ asChild?: boolean;
28
+ /** The pressed state of the toggle when initially rendered (uncontrolled) @default false */
29
+ defaultPressed?: boolean;
30
+ /** The controlled pressed state of the toggle */
31
+ pressed?: boolean;
32
+ /** Event handler called when the pressed state changes */
33
+ onPressedChange?: (pressed: boolean) => void;
34
+ /** When true, prevents user interaction with the toggle */
35
+ disabled?: boolean;
36
+ /** Visual style variant for the toggle appearance */
37
+ variant?: "default" | "outline";
38
+ /** Size variant that affects dimensions and padding */
39
+ size?: "sm" | "default" | "lg";
40
+ /** Additional CSS classes for custom styling */
41
+ className?: string;
42
+ /** Toggle content - typically icons, text, or both */
43
+ children?: React.ReactNode;
44
+ } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled' | 'children'>;
8
45
  /**
9
46
  * A two-state button that can be either on or off
10
47
  *
11
48
  * The Toggle component provides an accessible button with on/off state functionality.
12
49
  * Built on Radix UI Toggle primitives with customizable variants and sizes.
13
- * Ideal for text formatting controls, settings toggles, and any binary state controls.
50
+ * Perfect for text formatting controls, feature toggles, and any binary state controls.
51
+ * Automatically manages ARIA attributes and provides keyboard navigation.
14
52
  *
15
- * @example Basic usage with icon
53
+ * @example Basic toggle with icon
16
54
  * ```tsx
17
55
  * import { Bold } from "lucide-react"
18
56
  *
19
- * <Toggle aria-label="Toggle bold">
57
+ * <Toggle aria-label="Toggle bold formatting">
20
58
  * <Bold className="h-4 w-4" />
21
59
  * </Toggle>
22
60
  * ```
@@ -34,7 +72,7 @@ declare const toggleVariants: (props?: ({
34
72
  * </Toggle>
35
73
  * ```
36
74
  *
37
- * @example With text and outline variant
75
+ * @example Toggle with text and outline variant
38
76
  * ```tsx
39
77
  * <Toggle variant="outline" size="lg">
40
78
  * <Italic className="h-4 w-4" />
@@ -44,41 +82,91 @@ declare const toggleVariants: (props?: ({
44
82
  *
45
83
  * @example Text formatting toolbar
46
84
  * ```tsx
47
- * <div className="flex gap-1">
48
- * <Toggle pressed={bold} onPressedChange={setBold}>
85
+ * <div className="flex gap-1 p-2 border rounded-md">
86
+ * <Toggle
87
+ * pressed={formatting.bold}
88
+ * onPressedChange={(pressed) => setFormatting(prev => ({ ...prev, bold: pressed }))}
89
+ * aria-label="Bold"
90
+ * >
49
91
  * <Bold className="h-4 w-4" />
50
92
  * </Toggle>
51
- * <Toggle pressed={italic} onPressedChange={setItalic}>
93
+ * <Toggle
94
+ * pressed={formatting.italic}
95
+ * onPressedChange={(pressed) => setFormatting(prev => ({ ...prev, italic: pressed }))}
96
+ * aria-label="Italic"
97
+ * >
52
98
  * <Italic className="h-4 w-4" />
53
99
  * </Toggle>
100
+ * <Toggle
101
+ * pressed={formatting.underline}
102
+ * onPressedChange={(pressed) => setFormatting(prev => ({ ...prev, underline: pressed }))}
103
+ * aria-label="Underline"
104
+ * >
105
+ * <Underline className="h-4 w-4" />
106
+ * </Toggle>
54
107
  * </div>
55
108
  * ```
56
109
  *
110
+ * @example Toggle group for settings
111
+ * ```tsx
112
+ * <div className="space-y-2">
113
+ * <div className="flex items-center justify-between">
114
+ * <Label htmlFor="notifications">Notifications</Label>
115
+ * <Toggle
116
+ * id="notifications"
117
+ * pressed={settings.notifications}
118
+ * onPressedChange={(pressed) => updateSetting('notifications', pressed)}
119
+ * variant="outline"
120
+ * >
121
+ * <Bell className="h-4 w-4" />
122
+ * </Toggle>
123
+ * </div>
124
+ * <div className="flex items-center justify-between">
125
+ * <Label htmlFor="dark-mode">Dark Mode</Label>
126
+ * <Toggle
127
+ * id="dark-mode"
128
+ * pressed={settings.darkMode}
129
+ * onPressedChange={(pressed) => updateSetting('darkMode', pressed)}
130
+ * variant="outline"
131
+ * >
132
+ * <Moon className="h-4 w-4" />
133
+ * </Toggle>
134
+ * </div>
135
+ * </div>
136
+ * ```
137
+ *
138
+ * @example Disabled state with tooltip
139
+ * ```tsx
140
+ * <Tooltip>
141
+ * <TooltipTrigger asChild>
142
+ * <Toggle disabled aria-label="Unavailable feature">
143
+ * <Lock className="h-4 w-4" />
144
+ * Pro Feature
145
+ * </Toggle>
146
+ * </TooltipTrigger>
147
+ * <TooltipContent>
148
+ * <p>This feature requires a Pro subscription</p>
149
+ * </TooltipContent>
150
+ * </Tooltip>
151
+ * ```
152
+ *
57
153
  * @accessibility
58
- * - Supports keyboard navigation (Space/Enter to toggle)
59
- * - Automatically manages aria-pressed attribute
60
- * - Requires aria-label for icon-only toggles
61
- * - Focus management with visible focus indicators
62
- * - Disabled state properly communicated to assistive technology
154
+ * - Keyboard Support: Space and Enter keys activate/deactivate the toggle
155
+ * - Screen Reader Support: Automatically manages aria-pressed attribute ("true"/"false")
156
+ * - Focus Management: Visible focus indicators with customizable focus ring
157
+ * - State Communication: Uses data-state attribute ("on"/"off") for styling pressed state
158
+ * - Disabled State: Properly communicated to assistive technology with aria-disabled
159
+ * - Labeling: Requires accessible name via aria-label or aria-labelledby for icon-only toggles
160
+ * - High Contrast: Maintains visibility in high contrast mode with proper color combinations
63
161
  *
64
- * @see {@link https://ui.shadcn.com/docs/components/toggle} shadcn/ui Toggle documentation
65
- * @since 1.0.0
162
+ * @see {@link https://www.radix-ui.com/primitives/docs/components/toggle} Radix UI Toggle Documentation
163
+ * @see {@link https://ui.shadcn.com/docs/components/toggle} shadcn/ui Toggle Documentation
66
164
  * @see {@link ToggleGroup} For mutually exclusive toggle groups
165
+ * @since 1.0.0
67
166
  */
68
- /**
69
- * Toggle component props
70
- *
71
- * @param className - Additional CSS classes to apply
72
- * @param variant - Visual style variant ("default" | "outline")
73
- * @param size - Size variant ("sm" | "default" | "lg")
74
- * @param pressed - Controlled pressed state
75
- * @param defaultPressed - Default pressed state for uncontrolled usage
76
- * @param onPressedChange - Callback fired when pressed state changes
77
- * @param disabled - Whether the toggle is disabled
78
- * @param children - Toggle content (typically icons or text)
79
- * @param ...props - Additional props passed to Radix Toggle primitive
80
- */
81
- type ToggleProps = React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>;
82
167
  declare function Toggle({ className, variant, size, ...props }: ToggleProps): import("react/jsx-runtime").JSX.Element;
168
+ declare namespace Toggle {
169
+ var displayName: string;
170
+ }
83
171
  export { Toggle, toggleVariants };
84
172
  //# sourceMappingURL=toggle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAO,KAAK,YA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