@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,64 +1,122 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
3
|
/**
|
|
4
|
-
* Progress
|
|
4
|
+
* Progress - Visual progress indicator for tasks and operations
|
|
5
5
|
*
|
|
6
|
-
* A
|
|
7
|
-
* completion
|
|
8
|
-
*
|
|
6
|
+
* A customizable progress bar component built on Radix UI Progress primitive that displays
|
|
7
|
+
* the completion status of tasks, file uploads, multi-step processes, and other operations
|
|
8
|
+
* requiring user feedback. Features smooth animations, accessibility support, and flexible
|
|
9
|
+
* styling options.
|
|
9
10
|
*
|
|
10
|
-
* @example Basic
|
|
11
|
+
* @example Basic progress bar
|
|
11
12
|
* ```tsx
|
|
12
13
|
* <Progress value={60} />
|
|
13
14
|
* ```
|
|
14
15
|
*
|
|
15
|
-
* @example With
|
|
16
|
+
* @example With custom maximum value
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Progress value={30} max={50} />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Indeterminate state (loading)
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Progress />
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example With accessible label
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Progress
|
|
29
|
+
* value={75}
|
|
30
|
+
* aria-label="Installation progress"
|
|
31
|
+
* getValueLabel={(value, max) => `${value} of ${max} files installed`}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example File upload progress with label
|
|
16
36
|
* ```tsx
|
|
17
37
|
* <div className="space-y-2">
|
|
18
38
|
* <div className="flex justify-between text-sm">
|
|
19
|
-
* <span>
|
|
20
|
-
* <span>{
|
|
39
|
+
* <span>Uploading image.jpg</span>
|
|
40
|
+
* <span>{uploadProgress}%</span>
|
|
21
41
|
* </div>
|
|
22
|
-
* <Progress value={
|
|
42
|
+
* <Progress value={uploadProgress} />
|
|
43
|
+
* </div>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example Custom styling with different heights and colors
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <div className="space-y-4">
|
|
49
|
+
* <Progress value={25} className="h-1" />
|
|
50
|
+
* <Progress value={50} className="h-3" />
|
|
51
|
+
* <Progress value={75} className="h-4 [&>div]:bg-green-500" />
|
|
52
|
+
* <Progress value={100} className="h-6 [&>div]:bg-gradient-to-r [&>div]:from-blue-500 [&>div]:to-purple-500" />
|
|
23
53
|
* </div>
|
|
24
54
|
* ```
|
|
25
55
|
*
|
|
26
|
-
* @example
|
|
56
|
+
* @example Multi-step process indicator
|
|
27
57
|
* ```tsx
|
|
58
|
+
* const currentStep = 3;
|
|
59
|
+
* const totalSteps = 5;
|
|
60
|
+
* const stepProgress = (currentStep / totalSteps) * 100;
|
|
61
|
+
*
|
|
62
|
+
* <div className="space-y-2">
|
|
63
|
+
* <div className="flex justify-between text-sm">
|
|
64
|
+
* <span>Step {currentStep} of {totalSteps}</span>
|
|
65
|
+
* <span>{Math.round(stepProgress)}%</span>
|
|
66
|
+
* </div>
|
|
67
|
+
* <Progress
|
|
68
|
+
* value={stepProgress}
|
|
69
|
+
* getValueLabel={(value, max) => `Step ${currentStep} of ${totalSteps} complete`}
|
|
70
|
+
* />
|
|
71
|
+
* </div>
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @example Form validation progress
|
|
75
|
+
* ```tsx
|
|
76
|
+
* const validFields = 4;
|
|
77
|
+
* const totalFields = 6;
|
|
78
|
+
* const validationProgress = (validFields / totalFields) * 100;
|
|
79
|
+
*
|
|
28
80
|
* <div className="space-y-2">
|
|
29
|
-
* <Progress value={uploadProgress} />
|
|
30
81
|
* <p className="text-sm text-muted-foreground">
|
|
31
|
-
* {
|
|
82
|
+
* Form completion: {validFields}/{totalFields} fields
|
|
32
83
|
* </p>
|
|
84
|
+
* <Progress
|
|
85
|
+
* value={validationProgress}
|
|
86
|
+
* className="[&>div]:bg-emerald-500"
|
|
87
|
+
* aria-label="Form completion progress"
|
|
88
|
+
* />
|
|
33
89
|
* </div>
|
|
34
90
|
* ```
|
|
35
91
|
*
|
|
36
|
-
* @example
|
|
92
|
+
* @example Reading progress indicator
|
|
37
93
|
* ```tsx
|
|
94
|
+
* const scrollProgress = Math.min(100, (scrollY / (documentHeight - windowHeight)) * 100);
|
|
95
|
+
*
|
|
38
96
|
* <Progress
|
|
39
|
-
* value={
|
|
40
|
-
* className="h-
|
|
97
|
+
* value={scrollProgress}
|
|
98
|
+
* className="fixed top-0 left-0 right-0 z-50 h-1 rounded-none"
|
|
99
|
+
* aria-label={`Reading progress: ${Math.round(scrollProgress)}%`}
|
|
41
100
|
* />
|
|
42
101
|
* ```
|
|
43
102
|
*
|
|
44
|
-
* @example Multi-step process
|
|
45
|
-
* ```tsx
|
|
46
|
-
* const stepProgress = (currentStep / totalSteps) * 100;
|
|
47
|
-
* <Progress value={stepProgress} />
|
|
48
|
-
* ```
|
|
49
|
-
*
|
|
50
|
-
* @param value - Progress value from 0 to 100. Undefined shows no progress.
|
|
51
|
-
* @param className - Additional CSS classes for styling customization
|
|
52
|
-
*
|
|
53
103
|
* @accessibility
|
|
54
|
-
* - Built on Radix UI Progress primitive with
|
|
55
|
-
* -
|
|
56
|
-
* - Supports custom aria-label
|
|
57
|
-
* -
|
|
104
|
+
* - Built on Radix UI Progress primitive with full ARIA support
|
|
105
|
+
* - Automatically announces progress changes to screen readers via `aria-valuenow`, `aria-valuemin`, and `aria-valuemax`
|
|
106
|
+
* - Supports custom `aria-label` for descriptive labeling
|
|
107
|
+
* - Uses `getValueLabel` to provide human-readable progress descriptions
|
|
108
|
+
* - Includes `role="progressbar"` for proper semantic meaning
|
|
109
|
+
* - Supports `aria-valuetext` for custom progress descriptions
|
|
110
|
+
* - Visual progress changes are communicated through color, position, and optional text
|
|
111
|
+
* - Keyboard navigation is not required as this is a read-only indicator
|
|
112
|
+
* - Compatible with screen readers and other assistive technologies
|
|
113
|
+
* - Respects user's motion preferences for animations
|
|
58
114
|
*
|
|
59
|
-
* @see {@link https://ui.
|
|
115
|
+
* @see {@link https://www.radix-ui.com/docs/primitives/components/progress} Radix UI Progress Documentation
|
|
116
|
+
* @see {@link https://ui.shadcn.com/docs/components/progress} shadcn/ui Progress Component
|
|
117
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role} MDN progressbar role
|
|
60
118
|
* @since 1.0.0
|
|
61
119
|
*/
|
|
62
|
-
declare function Progress({ className, value, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
120
|
+
declare function Progress({ className, value, max, getValueLabel, ...props }: React.ComponentProps<typeof ProgressPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
63
121
|
export { Progress };
|
|
64
122
|
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/components/ui/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/components/ui/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,0BAA0B,CAAC;AA2C9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHG;AACH,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,KAAK,EACL,GAAS,EACT,aAAa,EACb,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,IAAI,CAAC,2CAoBrD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -4,10 +4,14 @@ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
|
4
4
|
* A radio group component for single selection from multiple options
|
|
5
5
|
*
|
|
6
6
|
* RadioGroup allows users to select exactly one option from a set of mutually exclusive choices.
|
|
7
|
-
* Built on Radix UI primitives with
|
|
8
|
-
* Each radio group should contain RadioGroupItem components paired with Labels for accessibility.
|
|
7
|
+
* Built on Radix UI RadioGroup primitives with enhanced accessibility and keyboard navigation.
|
|
8
|
+
* Each radio group should contain RadioGroupItem components paired with Labels for proper accessibility.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* The component follows the WAI-ARIA Radio Group design pattern and uses roving tabindex to manage
|
|
11
|
+
* focus movement among radio items. It provides comprehensive keyboard navigation with arrow keys
|
|
12
|
+
* and supports both controlled and uncontrolled usage patterns.
|
|
13
|
+
*
|
|
14
|
+
* @example Basic uncontrolled usage
|
|
11
15
|
* ```tsx
|
|
12
16
|
* <RadioGroup defaultValue="option-one">
|
|
13
17
|
* <div className="flex items-center space-x-2">
|
|
@@ -45,9 +49,13 @@ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
|
45
49
|
* }
|
|
46
50
|
* ```
|
|
47
51
|
*
|
|
48
|
-
* @example Horizontal
|
|
52
|
+
* @example Horizontal orientation
|
|
49
53
|
* ```tsx
|
|
50
|
-
* <RadioGroup
|
|
54
|
+
* <RadioGroup
|
|
55
|
+
* defaultValue="option-one"
|
|
56
|
+
* orientation="horizontal"
|
|
57
|
+
* className="flex gap-4"
|
|
58
|
+
* >
|
|
51
59
|
* <div className="flex items-center space-x-2">
|
|
52
60
|
* <RadioGroupItem value="option-one" id="r1" />
|
|
53
61
|
* <Label htmlFor="r1">Option One</Label>
|
|
@@ -59,86 +67,222 @@ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
|
59
67
|
* </RadioGroup>
|
|
60
68
|
* ```
|
|
61
69
|
*
|
|
62
|
-
* @example With descriptions
|
|
70
|
+
* @example With rich content and descriptions
|
|
63
71
|
* ```tsx
|
|
64
|
-
* <RadioGroup defaultValue="card">
|
|
72
|
+
* <RadioGroup defaultValue="card" name="payment-method">
|
|
65
73
|
* <div className="flex items-start space-x-2">
|
|
66
74
|
* <RadioGroupItem value="card" id="card" className="mt-1" />
|
|
67
75
|
* <div className="grid gap-1">
|
|
68
76
|
* <Label htmlFor="card">Credit Card</Label>
|
|
69
77
|
* <p className="text-sm text-muted-foreground">
|
|
70
|
-
* Pay with your credit or debit card
|
|
78
|
+
* Pay with your credit or debit card via secure payment
|
|
79
|
+
* </p>
|
|
80
|
+
* </div>
|
|
81
|
+
* </div>
|
|
82
|
+
* <div className="flex items-start space-x-2">
|
|
83
|
+
* <RadioGroupItem value="paypal" id="paypal" className="mt-1" />
|
|
84
|
+
* <div className="grid gap-1">
|
|
85
|
+
* <Label htmlFor="paypal">PayPal</Label>
|
|
86
|
+
* <p className="text-sm text-muted-foreground">
|
|
87
|
+
* Pay with your PayPal account balance or linked bank account
|
|
71
88
|
* </p>
|
|
72
89
|
* </div>
|
|
73
90
|
* </div>
|
|
74
91
|
* </RadioGroup>
|
|
75
92
|
* ```
|
|
76
93
|
*
|
|
77
|
-
* @
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
94
|
+
* @example Disabled state and form usage
|
|
95
|
+
* ```tsx
|
|
96
|
+
* <form>
|
|
97
|
+
* <RadioGroup
|
|
98
|
+
* name="subscription"
|
|
99
|
+
* required
|
|
100
|
+
* defaultValue="basic"
|
|
101
|
+
* >
|
|
102
|
+
* <div className="flex items-center space-x-2">
|
|
103
|
+
* <RadioGroupItem value="basic" id="basic" />
|
|
104
|
+
* <Label htmlFor="basic">Basic Plan</Label>
|
|
105
|
+
* </div>
|
|
106
|
+
* <div className="flex items-center space-x-2">
|
|
107
|
+
* <RadioGroupItem value="premium" id="premium" disabled />
|
|
108
|
+
* <Label htmlFor="premium" className="opacity-50">
|
|
109
|
+
* Premium Plan (Coming Soon)
|
|
110
|
+
* </Label>
|
|
111
|
+
* </div>
|
|
112
|
+
* </RadioGroup>
|
|
113
|
+
* </form>
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @param defaultValue The value of the radio item that should be checked when initially rendered. Use when you do not need to control the checked state
|
|
117
|
+
* @param value The controlled value of the radio item to check. Should be used in conjunction with onValueChange
|
|
118
|
+
* @param onValueChange Event handler called when the value changes
|
|
119
|
+
* @param disabled When true, prevents the user from interacting with the radio group
|
|
120
|
+
* @param name The name of the group. Submitted with its owning form as part of a name/value pair
|
|
121
|
+
* @param required When true, indicates that the user must check a radio item before the owning form can be submitted
|
|
122
|
+
* @param orientation The orientation of the component, which determines how focus moves @default "vertical"
|
|
123
|
+
* @param dir The reading direction of the radio group. If omitted, assumes LTR reading mode
|
|
124
|
+
* @param loop When true, keyboard navigation will loop from last item to first, and vice versa @default true
|
|
125
|
+
* @param asChild Change the default rendered element for the one passed as a child @default false
|
|
126
|
+
* @param className Additional CSS classes to apply to the radio group
|
|
127
|
+
* @param children RadioGroupItem components and their associated labels
|
|
128
|
+
*
|
|
129
|
+
* @accessibility
|
|
130
|
+
* - Supports keyboard navigation with Tab to enter/exit and Arrow keys to navigate between items
|
|
131
|
+
* - Space key selects the focused radio item
|
|
132
|
+
* - Uses roving tabindex to manage focus within the group
|
|
133
|
+
* - Provides proper ARIA roles and states for screen readers
|
|
134
|
+
* - Announces selected/unselected states to assistive technologies
|
|
135
|
+
* - Supports Right-to-Left (RTL) text direction
|
|
136
|
+
* - Works with form validation and submission
|
|
85
137
|
*
|
|
86
|
-
* @see {@link
|
|
138
|
+
* @see {@link RadioGroupItem} for individual radio button items
|
|
139
|
+
* @see {@link RadioGroupIndicator} for the visual checked indicator
|
|
140
|
+
* @see {@link https://ui.shadcn.com/docs/components/radio-group} shadcn/ui Radio Group documentation
|
|
141
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/radio-group} Radix UI Radio Group primitives
|
|
142
|
+
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/radiobutton/} WAI-ARIA Radio Group Pattern
|
|
87
143
|
* @since 1.0.0
|
|
88
|
-
* @see {@link RadioGroupItem} for individual radio options
|
|
89
|
-
* @see {@link Checkbox} for multiple selection use cases
|
|
90
|
-
* @see {@link Select} for dropdown-style single selection
|
|
91
144
|
*/
|
|
92
145
|
declare function RadioGroup({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
93
146
|
/**
|
|
94
147
|
* Individual radio button item for use within RadioGroup
|
|
95
148
|
*
|
|
96
149
|
* RadioGroupItem represents a single selectable option in a radio group.
|
|
97
|
-
* Must be used within a RadioGroup component and paired with a Label for accessibility.
|
|
150
|
+
* Must be used within a RadioGroup component and should be paired with a Label for proper accessibility.
|
|
98
151
|
* The component automatically handles visual states including checked, unchecked, focused, and disabled.
|
|
152
|
+
* It includes a built-in indicator that displays when the item is selected.
|
|
99
153
|
*
|
|
100
|
-
*
|
|
154
|
+
* Each radio item requires a unique value prop that identifies it within the group.
|
|
155
|
+
* The component forwards all standard button attributes and supports custom styling via className.
|
|
156
|
+
*
|
|
157
|
+
* @example Basic usage with label
|
|
101
158
|
* ```tsx
|
|
102
|
-
* <
|
|
103
|
-
*
|
|
159
|
+
* <div className="flex items-center space-x-2">
|
|
160
|
+
* <RadioGroupItem value="option-one" id="option-one" />
|
|
161
|
+
* <Label htmlFor="option-one">Option One</Label>
|
|
162
|
+
* </div>
|
|
104
163
|
* ```
|
|
105
164
|
*
|
|
106
|
-
* @example
|
|
165
|
+
* @example Custom styling and theming
|
|
107
166
|
* ```tsx
|
|
108
167
|
* <RadioGroupItem
|
|
109
168
|
* value="premium"
|
|
110
169
|
* id="premium"
|
|
111
|
-
* className="border-purple-500 text-purple-500"
|
|
170
|
+
* className="border-purple-500 text-purple-500 data-[state=checked]:bg-purple-50"
|
|
112
171
|
* />
|
|
113
|
-
* <Label htmlFor="premium"
|
|
172
|
+
* <Label htmlFor="premium" className="text-purple-900">
|
|
173
|
+
* Premium Plan
|
|
174
|
+
* </Label>
|
|
114
175
|
* ```
|
|
115
176
|
*
|
|
116
177
|
* @example Disabled state
|
|
117
178
|
* ```tsx
|
|
118
|
-
* <
|
|
119
|
-
*
|
|
120
|
-
*
|
|
179
|
+
* <div className="flex items-center space-x-2">
|
|
180
|
+
* <RadioGroupItem value="unavailable" id="unavailable" disabled />
|
|
181
|
+
* <Label htmlFor="unavailable" className="opacity-50 cursor-not-allowed">
|
|
182
|
+
* Unavailable Option
|
|
183
|
+
* </Label>
|
|
184
|
+
* </div>
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @example With complex content layout
|
|
188
|
+
* ```tsx
|
|
189
|
+
* <div className="flex items-start space-x-3 p-3 border rounded-lg">
|
|
190
|
+
* <RadioGroupItem value="plan-pro" id="plan-pro" className="mt-1" />
|
|
191
|
+
* <div className="grid gap-1">
|
|
192
|
+
* <Label htmlFor="plan-pro" className="font-semibold">
|
|
193
|
+
* Professional Plan
|
|
194
|
+
* </Label>
|
|
195
|
+
* <p className="text-sm text-muted-foreground">
|
|
196
|
+
* Advanced features for growing teams
|
|
197
|
+
* </p>
|
|
198
|
+
* <p className="text-lg font-bold">$29/month</p>
|
|
199
|
+
* </div>
|
|
200
|
+
* </div>
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* @example Form integration with validation
|
|
204
|
+
* ```tsx
|
|
205
|
+
* <RadioGroupItem
|
|
206
|
+
* value="terms-accept"
|
|
207
|
+
* id="terms"
|
|
208
|
+
* required
|
|
209
|
+
* aria-describedby="terms-error"
|
|
210
|
+
* />
|
|
211
|
+
* <Label htmlFor="terms">
|
|
212
|
+
* I accept the terms and conditions
|
|
121
213
|
* </Label>
|
|
122
214
|
* ```
|
|
123
215
|
*
|
|
124
|
-
* @param value
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @param
|
|
128
|
-
* @param
|
|
216
|
+
* @param value The value given as data when submitted with a name (required)
|
|
217
|
+
* @param disabled When true, prevents the user from interacting with the item
|
|
218
|
+
* @param required When true, indicates that the user must check the item before the owning form can be submitted
|
|
219
|
+
* @param asChild Change the default rendered element for the one passed as a child @default false
|
|
220
|
+
* @param id The id attribute for accessibility (should match Label's htmlFor)
|
|
221
|
+
* @param className Additional CSS classes for custom styling
|
|
222
|
+
* @param children Content to render inside the radio item (typically empty as styling is handled by the indicator)
|
|
129
223
|
*
|
|
130
224
|
* @accessibility
|
|
131
|
-
* -
|
|
132
|
-
* - Arrow keys navigate between radio options
|
|
133
|
-
* - Space key
|
|
134
|
-
* - Screen readers announce checked/unchecked state
|
|
135
|
-
* - Focus visible indicator
|
|
136
|
-
* - Proper ARIA attributes
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
225
|
+
* - Receives focus management from parent RadioGroup component
|
|
226
|
+
* - Arrow keys navigate between radio options within the group
|
|
227
|
+
* - Space key selects the focused radio item
|
|
228
|
+
* - Screen readers announce checked/unchecked state changes
|
|
229
|
+
* - Focus visible indicator appears on keyboard navigation
|
|
230
|
+
* - Proper ARIA attributes (role="radio", aria-checked) applied automatically
|
|
231
|
+
* - Works with form validation and submission
|
|
232
|
+
* - Supports required attribute for form validation
|
|
233
|
+
*
|
|
234
|
+
* @see {@link RadioGroup} for the parent container component that manages the group behavior
|
|
235
|
+
* @see {@link RadioGroupIndicator} for the visual checked state indicator
|
|
236
|
+
* @see {@link https://ui.shadcn.com/docs/components/radio-group} shadcn/ui Radio Group usage patterns
|
|
237
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/components/radio-group} Radix UI Radio Group Item documentation
|
|
140
238
|
* @since 1.0.0
|
|
141
239
|
*/
|
|
142
240
|
declare function RadioGroupItem({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
|
|
143
|
-
|
|
241
|
+
/**
|
|
242
|
+
* Visual indicator shown when a RadioGroupItem is in the checked state
|
|
243
|
+
*
|
|
244
|
+
* RadioGroupIndicator automatically appears inside RadioGroupItem when that item is selected.
|
|
245
|
+
* It provides the visual feedback for the checked state using a filled circle icon.
|
|
246
|
+
* The indicator is automatically managed by the RadioGroupItem and only renders when checked.
|
|
247
|
+
*
|
|
248
|
+
* This component is typically not used directly but is included in RadioGroupItem.
|
|
249
|
+
* It can be customized or replaced using the asChild pattern if needed.
|
|
250
|
+
*
|
|
251
|
+
* @example Default usage (automatic within RadioGroupItem)
|
|
252
|
+
* ```tsx
|
|
253
|
+
* // RadioGroupIndicator is automatically included in RadioGroupItem
|
|
254
|
+
* <RadioGroupItem value="selected" id="selected" />
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* @example Custom indicator with asChild
|
|
258
|
+
* ```tsx
|
|
259
|
+
* <RadioGroupItem value="custom" id="custom">
|
|
260
|
+
* <RadioGroupIndicator asChild>
|
|
261
|
+
* <CheckIcon className="size-3 text-primary" />
|
|
262
|
+
* </RadioGroupIndicator>
|
|
263
|
+
* </RadioGroupItem>
|
|
264
|
+
* ```
|
|
265
|
+
*
|
|
266
|
+
* @example Force mounted indicator (for animations)
|
|
267
|
+
* ```tsx
|
|
268
|
+
* <RadioGroupIndicator forceMount className="animate-scale-in" />
|
|
269
|
+
* ```
|
|
270
|
+
*
|
|
271
|
+
* @param forceMount Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries
|
|
272
|
+
* @param asChild Change the default rendered element for the one passed as a child @default false
|
|
273
|
+
* @param className Additional CSS classes for custom styling of the indicator
|
|
274
|
+
* @param children Custom content to render instead of the default CircleIcon (when using asChild)
|
|
275
|
+
*
|
|
276
|
+
* @accessibility
|
|
277
|
+
* - Automatically managed by RadioGroup state - no manual interaction needed
|
|
278
|
+
* - Provides visual confirmation of selection for users who can see
|
|
279
|
+
* - Works with high contrast mode and forced colors
|
|
280
|
+
* - Scales appropriately with font size changes
|
|
281
|
+
*
|
|
282
|
+
* @see {@link RadioGroupItem} for the parent radio button component
|
|
283
|
+
* @see {@link RadioGroup} for the container component
|
|
284
|
+
* @since 1.0.0
|
|
285
|
+
*/
|
|
286
|
+
declare function RadioGroupIndicator({ className, ...props }: React.ComponentProps<typeof RadioGroupPrimitive.Indicator>): import("react/jsx-runtime").JSX.Element;
|
|
287
|
+
export { RadioGroup, RadioGroupItem, RadioGroupIndicator };
|
|
144
288
|
//# sourceMappingURL=radio-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../src/components/ui/radio-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"radio-group.d.ts","sourceRoot":"","sources":["../../../src/components/ui/radio-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,mBAAmB,MAAM,6BAA6B,CAAC;AA6DnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6IG;AACH,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,2CAQvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,IAAI,CAAC,2CAavD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,SAAS,CAAC,2CAU5D;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
|