@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.
- package/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- 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":"
|
|
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
|
|
11
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
16
|
-
*
|
|
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
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* <
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
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
|
-
*
|
|
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
|
-
* @
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
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
|
-
* -
|
|
65
|
-
* -
|
|
66
|
-
* -
|
|
67
|
-
* -
|
|
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}
|
|
72
|
-
* @see {@link Toggle}
|
|
73
|
-
* @see {@link https://ui.
|
|
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.
|
|
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.
|
|
81
|
-
* variant and size styling from the parent ToggleGroup context
|
|
82
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
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
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
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
|
-
* @
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
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
|
|
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
|
|
126
|
-
* - Disabled items are excluded from keyboard navigation
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
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.
|
|
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;
|
|
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;AAkJxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,2CAiBxG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
-
|
|
3
|
-
|
|
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
|
-
*
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
* -
|
|
59
|
-
* - Automatically manages aria-pressed attribute
|
|
60
|
-
* -
|
|
61
|
-
* -
|
|
62
|
-
* - Disabled
|
|
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.
|
|
65
|
-
* @
|
|
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;
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,cAAc;;;8EAoBnB,CAAC;AAEF;;;;;GAKG;AACH,KAAK,WAAW,GAAG;IACjB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4FAA4F;IAC5F,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iDAAiD;IACjD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,uDAAuD;IACvD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyHG;AAEH,iBAAS,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,2CAQlE;kBARQ,MAAM;;;AAYf,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
|