@neynar/ui 0.2.0 → 0.2.1

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.
@@ -7,35 +7,35 @@ Badge - Versatile status indicator component for labels, counts, and notificatio
7
7
  ## JSX Usage
8
8
 
9
9
  ```jsx
10
- import { Badge } from '@neynar/ui';
10
+ import { Badge } from "@neynar/ui";
11
11
 
12
- <Badge
13
- variant={value}
14
- className="value"
15
- asChild={true}
16
- >
12
+ <Badge variant={value} className="value" asChild={true}>
17
13
  {/* Your content here */}
18
- </Badge>
14
+ </Badge>;
19
15
  ```
20
16
 
21
17
  ## Component Props
22
18
 
23
19
  ### variant
24
- - **Type**: `"default" | "secondary" | "destructive" | "outline"`
20
+
21
+ - **Type**: `"default" | "secondary" | "destructive" | "success" | "warning" | "info" | "outline"`
25
22
  - **Required**: No
26
23
  - **Description**: No description available
27
24
 
28
25
  ### className
26
+
29
27
  - **Type**: `string`
30
28
  - **Required**: No
31
29
  - **Description**: No description available
32
30
 
33
31
  ### children
32
+
34
33
  - **Type**: `React.ReactNode`
35
34
  - **Required**: No
36
35
  - **Description**: No description available
37
36
 
38
37
  ### asChild
38
+
39
39
  - **Type**: `boolean`
40
40
  - **Required**: No
41
41
  - **Description**: No description available
@@ -43,14 +43,20 @@ import { Badge } from '@neynar/ui';
43
43
  ## Examples
44
44
 
45
45
  ### Example 1
46
+
46
47
  ```tsx
47
48
  // Basic status badges
48
49
  <Badge>New</Badge>
49
50
  <Badge variant="secondary">Draft</Badge>
50
51
  <Badge variant="destructive">Error</Badge>
52
+ <Badge variant="success">Success</Badge>
53
+ <Badge variant="warning">Warning</Badge>
54
+ <Badge variant="info">Info</Badge>
51
55
  <Badge variant="outline">Pending</Badge>
52
56
  ```
57
+
53
58
  ### Example 2
59
+
54
60
  ```tsx
55
61
  // Badge with icon content
56
62
  import { Check, AlertTriangle } from "lucide-react";
@@ -63,7 +69,9 @@ import { Check, AlertTriangle } from "lucide-react";
63
69
  Failed
64
70
  </Badge>
65
71
  ```
72
+
66
73
  ### Example 3
74
+
67
75
  ```tsx
68
76
  // Notification count badge
69
77
  <div className="relative inline-block">
@@ -73,7 +81,9 @@ import { Check, AlertTriangle } from "lucide-react";
73
81
  </Badge>
74
82
  </div>
75
83
  ```
84
+
76
85
  ### Example 4
86
+
77
87
  ```tsx
78
88
  // Interactive badge as link using asChild
79
89
  import Link from "next/link";
@@ -81,9 +91,11 @@ import Link from "next/link";
81
91
  <Link href="/notifications" className="cursor-pointer">
82
92
  3 new messages
83
93
  </Link>
84
- </Badge>
94
+ </Badge>;
85
95
  ```
96
+
86
97
  ### Example 5
98
+
87
99
  ```tsx
88
100
  // Interactive badge as button
89
101
  <Badge asChild>
@@ -92,7 +104,9 @@ import Link from "next/link";
92
104
  </button>
93
105
  </Badge>
94
106
  ```
107
+
95
108
  ### Example 6
109
+
96
110
  ```tsx
97
111
  // Removable tag badge with close button
98
112
  <Badge className="pr-1 gap-1">
@@ -105,4 +119,4 @@ import Link from "next/link";
105
119
  <X className="h-3 w-3" />
106
120
  </button>
107
121
  </Badge>
108
- ```
122
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neynar/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "author": "Neynar Inc.",
6
6
  "description": "React UI component library built on shadcn/ui and Tailwind CSS",
@@ -23,6 +23,9 @@ import { cn } from "@/lib/utils";
23
23
  * @variant default - Primary brand color badge for important status indicators and primary actions
24
24
  * @variant secondary - Muted background badge for supplementary information and low-priority labels
25
25
  * @variant destructive - Error/warning badge for critical states, failures, and urgent attention
26
+ * @variant success - Success badge for positive states, successes, and positive attention
27
+ * @variant warning - Warning badge for warning states, warnings, and negative attention
28
+ * @variant info - Info badge for informational states, information, and neutral attention
26
29
  * @variant outline - Subtle border-only badge for minimal emphasis and subtle labeling
27
30
  *
28
31
  * @param props - Variant configuration object
@@ -43,7 +46,7 @@ import { cn } from "@/lib/utils";
43
46
  * ```
44
47
  */
45
48
  const badgeVariants = cva(
46
- "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
49
+ "inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-bold w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
47
50
  {
48
51
  variants: {
49
52
  variant: {
@@ -52,7 +55,12 @@ const badgeVariants = cva(
52
55
  secondary:
53
56
  "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
54
57
  destructive:
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",
58
+ "border-transparent bg-destructive text-destructive-foreground [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
59
+ success:
60
+ "border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90",
61
+ warning:
62
+ "border-transparent bg-warning text-warning-foreground [a&]:hover:bg-warning/90",
63
+ info: "border-transparent bg-info text-info-foreground [a&]:hover:bg-info/90",
56
64
  outline:
57
65
  "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
58
66
  },
@@ -70,7 +78,14 @@ const badgeVariants = cva(
70
78
  // eslint-disable-next-line unused-imports/no-unused-vars
71
79
  type BadgeDocsProps = {
72
80
  /** The visual variant of the badge that determines its color scheme and emphasis level */
73
- variant?: "default" | "secondary" | "destructive" | "outline";
81
+ variant?:
82
+ | "default"
83
+ | "secondary"
84
+ | "destructive"
85
+ | "success"
86
+ | "warning"
87
+ | "info"
88
+ | "outline";
74
89
  /** Additional CSS classes to apply to the badge for custom styling */
75
90
  className?: string;
76
91
  /** Content to display inside the badge (text, icons, or React components) */
@@ -100,6 +115,9 @@ type BadgeDocsProps = {
100
115
  * <Badge>New</Badge>
101
116
  * <Badge variant="secondary">Draft</Badge>
102
117
  * <Badge variant="destructive">Error</Badge>
118
+ * <Badge variant="success">Success</Badge>
119
+ * <Badge variant="warning">Warning</Badge>
120
+ * <Badge variant="info">Info</Badge>
103
121
  * <Badge variant="outline">Pending</Badge>
104
122
  * ```
105
123
  *
@@ -34,6 +34,8 @@
34
34
  --success-foreground: oklch(from #ffffff l c h); /* White text on success */
35
35
  --warning: oklch(from #f59e0b l c h); /* Warning/Orange */
36
36
  --warning-foreground: oklch(from #ffffff l c h); /* White text on warning */
37
+ --info: oklch(from #1976d2 l c h); /* Info/Blue */
38
+ --info-foreground: oklch(from #ffffff l c h); /* White text on info */
37
39
  --border: oklch(from #dddddd l c h); /* Borders/Muted */
38
40
  --input: oklch(from #ffffff l c h); /* Surface/Field */
39
41
  --ring: oklch(from #7f62c6 l c h); /* Farcaster Purple */
@@ -82,9 +84,11 @@
82
84
  from #ffffff l c h
83
85
  ); /* Text/UI/White (fixed) */
84
86
  --success: oklch(from #22c55e l c h); /* Success/Green Dark */
85
- --success-foreground: oklch(from #ffffff l c h); /* White text on success */
87
+ --success-foreground: oklch(from #272d26 l c h); /* White text on success */
86
88
  --warning: oklch(from #fbbf24 l c h); /* Warning/Orange Dark */
87
89
  --warning-foreground: oklch(from #000000 l c h); /* Black text on warning */
90
+ --info: oklch(from #1976d2 l c h); /* Info/Blue Dark */
91
+ --info-foreground: oklch(from #ffffff l c h); /* White text on info */
88
92
  --border: oklch(from #444444 l c h); /* Borders/Muted Dark */
89
93
  --input: oklch(from #222222 l c h); /* Surface/Field Dark */
90
94
  --ring: oklch(from #7f62c6 l c h); /* Farcaster Purple */