@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
|
@@ -20,11 +20,10 @@ import { cn } from "@/lib/utils";
|
|
|
20
20
|
* - Accessibility features (focus rings, error states)
|
|
21
21
|
* - Smooth transitions for interactive states
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
* -
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
27
|
-
* - **outline**: Subtle border-only style, low emphasis
|
|
23
|
+
* @variant default - Primary brand color badge for important status indicators and primary actions
|
|
24
|
+
* @variant secondary - Muted background badge for supplementary information and low-priority labels
|
|
25
|
+
* @variant destructive - Error/warning badge for critical states, failures, and urgent attention
|
|
26
|
+
* @variant outline - Subtle border-only badge for minimal emphasis and subtle labeling
|
|
28
27
|
*
|
|
29
28
|
* @param props - Variant configuration object
|
|
30
29
|
* @param props.variant - The visual variant to apply
|
|
@@ -48,16 +47,12 @@ const badgeVariants = cva(
|
|
|
48
47
|
{
|
|
49
48
|
variants: {
|
|
50
49
|
variant: {
|
|
51
|
-
/** Primary badge with brand colors - use for important status or primary actions */
|
|
52
50
|
default:
|
|
53
51
|
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
54
|
-
/** Secondary badge with muted colors - use for supplementary information */
|
|
55
52
|
secondary:
|
|
56
53
|
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
57
|
-
/** Destructive badge for errors/warnings - use for critical states */
|
|
58
54
|
destructive:
|
|
59
55
|
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
60
|
-
/** Outline badge with border only - use for subtle labeling */
|
|
61
56
|
outline:
|
|
62
57
|
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
|
|
63
58
|
},
|
|
@@ -69,38 +64,39 @@ const badgeVariants = cva(
|
|
|
69
64
|
);
|
|
70
65
|
|
|
71
66
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
* -
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
67
|
+
* Props for Badge component (Documentation only - NOT used in component implementation)
|
|
68
|
+
* This type is for documentation generation and should not replace CVA/Radix inferred types
|
|
69
|
+
*/
|
|
70
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
71
|
+
type BadgeDocsProps = {
|
|
72
|
+
/** The visual variant of the badge that determines its color scheme and emphasis level */
|
|
73
|
+
variant?: "default" | "secondary" | "destructive" | "outline";
|
|
74
|
+
/** Additional CSS classes to apply to the badge for custom styling */
|
|
75
|
+
className?: string;
|
|
76
|
+
/** Content to display inside the badge (text, icons, or React components) */
|
|
77
|
+
children?: React.ReactNode;
|
|
78
|
+
/**
|
|
79
|
+
* Renders the badge as its child element instead of a span element.
|
|
80
|
+
* Enables polymorphic behavior for creating badge-styled links, buttons, or other interactive elements.
|
|
81
|
+
*
|
|
82
|
+
* When true, you must provide exactly one child element that can receive props.
|
|
83
|
+
* The child element will receive all badge styling and attributes via Radix UI Slot.
|
|
84
|
+
*
|
|
85
|
+
* @default false
|
|
86
|
+
*/
|
|
87
|
+
asChild?: boolean;
|
|
88
|
+
} & Omit<React.HTMLAttributes<HTMLSpanElement>, "children">;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Badge - Versatile status indicator component for labels, counts, and notifications
|
|
92
|
+
*
|
|
93
|
+
* A small status descriptor component that provides visual feedback about state, category,
|
|
94
|
+
* or importance of content. Built on Radix UI Slot primitives with accessibility-first design
|
|
95
|
+
* and support for multiple semantic variants and interactive states.
|
|
96
|
+
*
|
|
101
97
|
* @example
|
|
102
98
|
* ```tsx
|
|
103
|
-
* // Basic status
|
|
99
|
+
* // Basic status badges
|
|
104
100
|
* <Badge>New</Badge>
|
|
105
101
|
* <Badge variant="secondary">Draft</Badge>
|
|
106
102
|
* <Badge variant="destructive">Error</Badge>
|
|
@@ -109,16 +105,16 @@ const badgeVariants = cva(
|
|
|
109
105
|
*
|
|
110
106
|
* @example
|
|
111
107
|
* ```tsx
|
|
112
|
-
* // Badge with icon
|
|
108
|
+
* // Badge with icon content
|
|
113
109
|
* import { Check, AlertTriangle } from "lucide-react";
|
|
114
110
|
*
|
|
115
111
|
* <Badge>
|
|
116
|
-
* <Check />
|
|
112
|
+
* <Check className="mr-1" />
|
|
117
113
|
* Completed
|
|
118
114
|
* </Badge>
|
|
119
115
|
*
|
|
120
116
|
* <Badge variant="destructive">
|
|
121
|
-
* <AlertTriangle />
|
|
117
|
+
* <AlertTriangle className="mr-1" />
|
|
122
118
|
* Failed
|
|
123
119
|
* </Badge>
|
|
124
120
|
* ```
|
|
@@ -126,9 +122,9 @@ const badgeVariants = cva(
|
|
|
126
122
|
* @example
|
|
127
123
|
* ```tsx
|
|
128
124
|
* // Notification count badge
|
|
129
|
-
* <div className="relative">
|
|
130
|
-
* <Bell />
|
|
131
|
-
* <Badge className="absolute -top-2 -right-2
|
|
125
|
+
* <div className="relative inline-block">
|
|
126
|
+
* <Bell className="h-6 w-6" />
|
|
127
|
+
* <Badge className="absolute -top-2 -right-2 h-5 w-5 p-0 text-xs flex items-center justify-center">
|
|
132
128
|
* 3
|
|
133
129
|
* </Badge>
|
|
134
130
|
* </div>
|
|
@@ -136,11 +132,11 @@ const badgeVariants = cva(
|
|
|
136
132
|
*
|
|
137
133
|
* @example
|
|
138
134
|
* ```tsx
|
|
139
|
-
* // Interactive badge as link
|
|
135
|
+
* // Interactive badge as link using asChild
|
|
140
136
|
* import Link from "next/link";
|
|
141
137
|
*
|
|
142
138
|
* <Badge asChild>
|
|
143
|
-
* <Link href="/notifications">
|
|
139
|
+
* <Link href="/notifications" className="cursor-pointer">
|
|
144
140
|
* 3 new messages
|
|
145
141
|
* </Link>
|
|
146
142
|
* </Badge>
|
|
@@ -148,17 +144,41 @@ const badgeVariants = cva(
|
|
|
148
144
|
*
|
|
149
145
|
* @example
|
|
150
146
|
* ```tsx
|
|
151
|
-
* //
|
|
152
|
-
* <Badge
|
|
147
|
+
* // Interactive badge as button
|
|
148
|
+
* <Badge asChild>
|
|
149
|
+
* <button onClick={handleDismiss} className="cursor-pointer">
|
|
150
|
+
* Dismiss Alert
|
|
151
|
+
* </button>
|
|
152
|
+
* </Badge>
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```tsx
|
|
157
|
+
* // Removable tag badge with close button
|
|
158
|
+
* <Badge className="pr-1 gap-1">
|
|
153
159
|
* React
|
|
154
|
-
* <button
|
|
155
|
-
*
|
|
160
|
+
* <button
|
|
161
|
+
* onClick={handleRemove}
|
|
162
|
+
* className="ml-1 hover:bg-primary-foreground/20 rounded-full p-0.5"
|
|
163
|
+
* aria-label="Remove React tag"
|
|
164
|
+
* >
|
|
165
|
+
* <X className="h-3 w-3" />
|
|
156
166
|
* </button>
|
|
157
167
|
* </Badge>
|
|
158
168
|
* ```
|
|
159
169
|
*
|
|
160
|
-
* @
|
|
161
|
-
*
|
|
170
|
+
* @accessibility
|
|
171
|
+
* - Full keyboard navigation support with focus-visible ring indicators
|
|
172
|
+
* - High contrast colors across all variants for WCAG AA compliance
|
|
173
|
+
* - Support for aria-invalid state with visual feedback for form validation
|
|
174
|
+
* - Semantic color mapping (destructive variant indicates errors)
|
|
175
|
+
* - Screen reader friendly content structure and labeling
|
|
176
|
+
* - When used with asChild, inherits accessibility properties of child element
|
|
177
|
+
* - Focus management handled by underlying Radix UI Slot primitive
|
|
178
|
+
*
|
|
179
|
+
* @see {@link Button} For primary interactive elements and calls-to-action
|
|
180
|
+
* @see {@link https://ui.shadcn.com/docs/components/badge} shadcn/ui Badge Documentation
|
|
181
|
+
* @see {@link https://www.radix-ui.com/primitives/docs/utilities/slot} Radix UI Slot Documentation
|
|
162
182
|
* @since 1.0.0
|
|
163
183
|
*/
|
|
164
184
|
function Badge({
|
|
@@ -166,29 +186,8 @@ function Badge({
|
|
|
166
186
|
variant,
|
|
167
187
|
asChild = false,
|
|
168
188
|
...props
|
|
169
|
-
}: React.
|
|
189
|
+
}: React.HTMLAttributes<HTMLSpanElement> &
|
|
170
190
|
VariantProps<typeof badgeVariants> & {
|
|
171
|
-
/**
|
|
172
|
-
* If true, the badge will render its child element instead of a span element.
|
|
173
|
-
* Useful for creating badge-styled links, buttons, or other interactive elements.
|
|
174
|
-
*
|
|
175
|
-
* When true, you must provide exactly one child element that can receive props.
|
|
176
|
-
* The child element will receive all the badge styling and attributes.
|
|
177
|
-
*
|
|
178
|
-
* @default false
|
|
179
|
-
* @example
|
|
180
|
-
* ```tsx
|
|
181
|
-
* // Badge as a link
|
|
182
|
-
* <Badge asChild>
|
|
183
|
-
* <Link href="/profile">Profile</Link>
|
|
184
|
-
* </Badge>
|
|
185
|
-
*
|
|
186
|
-
* // Badge as a button
|
|
187
|
-
* <Badge asChild>
|
|
188
|
-
* <button onClick={handleClick}>Click me</button>
|
|
189
|
-
* </Badge>
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
191
|
asChild?: boolean;
|
|
193
192
|
}) {
|
|
194
193
|
const Comp = asChild ? Slot : "span";
|