@neynar/ui 0.1.3 → 0.2.0

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.
@@ -1,97 +1,26 @@
1
1
  # Typography Components
2
2
 
3
3
  ## Typography
4
- Consistent text styling with semantic variants and accessibility features.
5
-
6
- ```tsx
7
- import { Typography } from "@neynar/ui"
8
-
9
- // Basic usage with semantic variants
10
- <Typography variant="heading" as="h1">
11
- Main Page Title
12
- </Typography>
13
-
14
- <Typography variant="subheading" as="h2">
15
- Section Header
16
- </Typography>
17
-
18
- <Typography variant="body">
19
- Standard paragraph text content with proper line height and spacing.
20
- </Typography>
21
-
22
- <Typography variant="bodyEmphasized">
23
- Emphasized text for important information.
24
- </Typography>
25
-
26
- // Color and styling options
27
- <Typography variant="body" color="muted">
28
- Secondary information in muted color
29
- </Typography>
30
-
31
- <Typography variant="details" color="destructive">
32
- Error or warning text
33
- </Typography>
34
-
35
- // Form field labels
36
- <Typography variant="field" as="label" htmlFor="email">
37
- Email Address
38
- </Typography>
39
4
 
40
- // Code snippets
41
- <Typography variant="code" as="code">
42
- const example = "Hello, world!";
43
- </Typography>
44
-
45
- // Table content
46
- <Typography variant="tableHeader" as="th">
47
- Column Header
48
- </Typography>
49
-
50
- <Typography variant="tableCell" as="td">
51
- Cell content
52
- </Typography>
53
-
54
- // Microcopy for fine print
55
- <Typography variant="microcopy" color="muted">
56
- Terms and conditions apply
57
- </Typography>
58
-
59
- // Advanced styling
60
- <Typography
61
- variant="body"
62
- color="accent"
63
- italic
64
- underline
65
- align="center"
66
- >
67
- Styled text with multiple options
68
- </Typography>
69
-
70
- // Truncated text
71
- <Typography variant="body" truncate className="max-w-xs">
72
- Long text that will be truncated with ellipsis
73
- </Typography>
74
-
75
- // Screen reader only content
76
- <Typography variant="details" srOnly>
77
- Additional context for accessibility
78
- </Typography>
79
- ```
5
+ Consistent text styling with semantic variants and accessibility features.
80
6
 
81
7
  ### Typography Design System
82
8
 
83
9
  The Typography component uses a carefully designed font scale that maps to your design system:
84
10
 
85
- - **heading** (20px) - Main page and section titles
86
- - **subheading** (17px) - Secondary headings for subsections
87
- - **body** (14px) - Standard content text
88
- - **bodyEmphasized** (14px) - Important content with medium weight
89
- - **details** (12px) - Smaller text for descriptions
90
- - **field** (17px) - Form field labels
91
- - **code** (17px) - Monospace text for code
92
- - **microcopy** (10px) - Fine print and captions
93
- - **tableCell** (17px) - Table cell content
94
- - **tableHeader** (17px) - Table headers with emphasis
11
+ - **microcopy** (10px / 1.2)
12
+ - **detail** (13px / 1.2)
13
+ - **body** (15px / 1.1)
14
+ - **bodyBlog** (17px / 1.5)
15
+ - **paragraphLead** (17px 1.2)
16
+ - **eyebrow** (20px / 1.2)
17
+ - **subHeadline** (22px / 1.2)
18
+ - **headline** (36px / 1.2)
19
+ - **sectionTitle** (45px / 1.4)
20
+ - **pageTitle** (56px / 1.4)
21
+ - **displayTitle** (72px / 1.1)
22
+ - **heroTitle** (90px 1.1)
23
+ - **code** (15px / 1.2)
95
24
 
96
25
  ### Accessibility Features
97
26
 
@@ -106,6 +35,7 @@ The Typography component uses a carefully designed font scale that maps to your
106
35
  The Typography system includes semantic HTML components for better accessibility and developer experience:
107
36
 
108
37
  ### H1-H6 (Headings)
38
+
109
39
  ```tsx
110
40
  import { H1, H2, H3, H4, H5, H6 } from "@neynar/ui"
111
41
 
@@ -116,6 +46,7 @@ import { H1, H2, H3, H4, H5, H6 } from "@neynar/ui"
116
46
  ```
117
47
 
118
48
  ### P (Paragraph)
49
+
119
50
  ```tsx
120
51
  import { P } from "@neynar/ui"
121
52
 
@@ -124,6 +55,7 @@ import { P } from "@neynar/ui"
124
55
  ```
125
56
 
126
57
  ### A (Anchor/Link)
58
+
127
59
  ```tsx
128
60
  import { A } from "@neynar/ui"
129
61
 
@@ -142,6 +74,7 @@ import { A } from "@neynar/ui"
142
74
  ```
143
75
 
144
76
  ### Other Semantic Elements
77
+
145
78
  ```tsx
146
79
  import { Span, Code, Small, Strong, Lead, Blockquote } from "@neynar/ui"
147
80
 
@@ -156,6 +89,7 @@ import { Span, Code, Small, Strong, Lead, Blockquote } from "@neynar/ui"
156
89
  ## Framework Integration
157
90
 
158
91
  ### Next.js Link Integration
92
+
159
93
  ```tsx
160
94
  // Create a custom Link component
161
95
  import Link from "next/link";
@@ -170,10 +104,13 @@ function AppLink({ href, children, ...props }) {
170
104
  }
171
105
 
172
106
  // Usage
173
- <AppLink href="/about" variant="subheading">About Us</AppLink>
107
+ <AppLink href="/about" variant="subheading">
108
+ About Us
109
+ </AppLink>;
174
110
  ```
175
111
 
176
112
  ### React Router Integration
113
+
177
114
  ```tsx
178
115
  // Custom Link for React Router
179
116
  import { Link } from "react-router-dom";
@@ -188,7 +125,74 @@ function AppLink({ to, children, ...props }) {
188
125
  }
189
126
 
190
127
  // Usage
191
- <AppLink to="/contact" color="accent">Contact</AppLink>
128
+ <AppLink to="/contact" color="accent">
129
+ Contact
130
+ </AppLink>;
131
+ ```
132
+
133
+ ### Typography Component
134
+
135
+ Only use as a last resort if none of the other components apply
136
+
137
+ ```tsx
138
+ import { Typography } from "@neynar/ui"
139
+
140
+ // Basic usage with semantic variants
141
+ <Typography variant="heroTitle" as="h1">
142
+ Main Page Title
143
+ </Typography>
144
+
145
+ <Typography variant="pageTitle" as="h2">
146
+ Section Header
147
+ </Typography>
148
+
149
+ <Typography variant="body">
150
+ Standard paragraph text content with proper line height and spacing.
151
+ </Typography>
152
+
153
+ <Typography variant="body" weight="bold">
154
+ Emphasized text for important information.
155
+ </Typography>
156
+
157
+ // Color and styling options
158
+ <Typography variant="body" color="muted">
159
+ Secondary information in muted color
160
+ </Typography>
161
+
162
+ <Typography variant="detail" color="destructive">
163
+ Error or warning text
164
+ </Typography>
165
+
166
+ // Form field labels
167
+ <Typography variant="detail" as="label" htmlFor="email">
168
+ Email Address
169
+ </Typography>
170
+
171
+ // Microcopy for fine print
172
+ <Typography variant="microcopy" color="muted">
173
+ Terms and conditions apply
174
+ </Typography>
175
+
176
+ // Advanced styling
177
+ <Typography
178
+ variant="body"
179
+ color="accent"
180
+ italic
181
+ underline
182
+ align="center"
183
+ >
184
+ Styled text with multiple options
185
+ </Typography>
186
+
187
+ // Truncated text
188
+ <Typography variant="body" truncate className="max-w-xs">
189
+ Long text that will be truncated with ellipsis
190
+ </Typography>
191
+
192
+ // Screen reader only content
193
+ <Typography variant="details" srOnly>
194
+ Additional context for accessibility
195
+ </Typography>
192
196
  ```
193
197
 
194
198
  ### Performance Notes
@@ -196,4 +200,4 @@ function AppLink({ to, children, ...props }) {
196
200
  - Uses CSS custom properties for consistent theming
197
201
  - Leverages Tailwind's default font scale for optimal bundle size
198
202
  - Supports tree-shaking when used with selective imports
199
- - Semantic components improve SEO and accessibility
203
+ - Semantic components improve SEO and accessibility
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neynar/ui",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "author": "Neynar Inc.",
6
6
  "description": "React UI component library built on shadcn/ui and Tailwind CSS",
@@ -5,6 +5,7 @@ import { cn } from "@/lib/utils";
5
5
  * Spacing options for Stack component using Tailwind CSS spacing scale
6
6
  *
7
7
  * Maps to Tailwind spacing utilities:
8
+ * - 0 = 0rem (0px) - No spacing
8
9
  * - 1 = 0.25rem (4px) - Ultra-tight spacing for dense layouts
9
10
  * - 2 = 0.5rem (8px) - Tight spacing for compact components
10
11
  * - 3 = 0.75rem (12px) - Close spacing for related items
@@ -13,7 +14,7 @@ import { cn } from "@/lib/utils";
13
14
  * - 8 = 2rem (32px) - Wide spacing for distinct content areas
14
15
  * - 12 = 3rem (48px) - Extra-wide spacing for major layout divisions
15
16
  */
16
- type StackSpacing = 1 | 2 | 3 | 4 | 6 | 8 | 12;
17
+ type StackSpacing = 0 | 1 | 2 | 3 | 4 | 6 | 8 | 12;
17
18
 
18
19
  /**
19
20
  * Layout direction options for Stack component
@@ -49,6 +50,7 @@ type StackDocsProps = React.HTMLAttributes<HTMLDivElement> & {
49
50
  * rem values for predictable visual hierarchy.
50
51
  *
51
52
  * **Spacing Guidelines:**
53
+ * - Use `0` for no spacing, good for typography and inline elements
52
54
  * - Use `1-2` for tightly related items (button groups, form fields)
53
55
  * - Use `3-4` for standard component spacing (default recommended)
54
56
  * - Use `6-8` for section separation and content areas
@@ -475,6 +477,7 @@ const Stack = React.forwardRef<
475
477
  className={cn(
476
478
  direction === "vertical" ? "flex flex-col" : "flex flex-row",
477
479
  {
480
+ "space-y-0": direction === "vertical" && spacing === 0,
478
481
  "space-y-1": direction === "vertical" && spacing === 1,
479
482
  "space-y-2": direction === "vertical" && spacing === 2,
480
483
  "space-y-3": direction === "vertical" && spacing === 3,
@@ -482,6 +485,7 @@ const Stack = React.forwardRef<
482
485
  "space-y-6": direction === "vertical" && spacing === 6,
483
486
  "space-y-8": direction === "vertical" && spacing === 8,
484
487
  "space-y-12": direction === "vertical" && spacing === 12,
488
+ "space-x-0": direction === "horizontal" && spacing === 0,
485
489
  "space-x-1": direction === "horizontal" && spacing === 1,
486
490
  "space-x-2": direction === "horizontal" && spacing === 2,
487
491
  "space-x-3": direction === "horizontal" && spacing === 3,