@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
|
@@ -9,27 +9,25 @@ import { cn } from "@/lib/utils";
|
|
|
9
9
|
*
|
|
10
10
|
* Defines all possible typography variants, sizes, and styling options.
|
|
11
11
|
* Uses Tailwind CSS 4 with custom CSS properties for theming.
|
|
12
|
+
* Provides consistent text styling across the entire application.
|
|
12
13
|
*
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
14
|
+
* @variant heading - Primary headings for page/section titles (text-lg, font-semibold, leading-tight)
|
|
15
|
+
* @variant subheading - Secondary headings for subsections (text-base, font-medium, leading-relaxed)
|
|
16
|
+
* @variant body - Standard body text for readable content (text-sm, leading-relaxed)
|
|
17
|
+
* @variant bodyEmphasized - Emphasized body text with medium weight for important information (text-sm, font-medium)
|
|
18
|
+
* @variant details - Smaller text for details, captions, and descriptions (text-xs, leading-normal)
|
|
19
|
+
* @variant field - Text for form fields, labels, and input elements (text-base, leading-normal)
|
|
20
|
+
* @variant code - Monospace text for code snippets and technical content (text-base, font-mono)
|
|
21
|
+
* @variant microcopy - Very small text for fine print, timestamps, and metadata (text-microcopy, leading-tight)
|
|
22
|
+
* @variant tableCell - Text optimized for table cell content with proper line height (text-base, leading-normal)
|
|
23
|
+
* @variant tableHeader - Text for table headers with medium weight for emphasis (text-base, font-medium)
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://cva.style/docs} CVA documentation for variant patterns
|
|
26
|
+
* @see {@link https://ui.shadcn.com/docs/components/typography} Typography component inspiration
|
|
15
27
|
* @since 1.0.0
|
|
16
28
|
*/
|
|
17
29
|
const typographyVariants = cva("", {
|
|
18
30
|
variants: {
|
|
19
|
-
/**
|
|
20
|
-
* Typography variant types based on semantic meaning and visual hierarchy
|
|
21
|
-
*
|
|
22
|
-
* @variant heading - Primary headings for page/section titles (20px)
|
|
23
|
-
* @variant subheading - Secondary headings for subsections (17px)
|
|
24
|
-
* @variant body - Standard body text for content (14px)
|
|
25
|
-
* @variant bodyEmphasized - Emphasized body text with medium weight (14px)
|
|
26
|
-
* @variant details - Smaller text for details and descriptions (12px)
|
|
27
|
-
* @variant field - Text for form fields and labels (17px)
|
|
28
|
-
* @variant code - Monospace text for code snippets (17px)
|
|
29
|
-
* @variant microcopy - Very small text for captions and fine print (10px)
|
|
30
|
-
* @variant tableCell - Text for table cell content (17px)
|
|
31
|
-
* @variant tableHeader - Text for table headers with emphasis (17px)
|
|
32
|
-
*/
|
|
33
31
|
variant: {
|
|
34
32
|
heading: "text-lg font-semibold leading-tight",
|
|
35
33
|
subheading: "text-base font-medium leading-relaxed",
|
|
@@ -43,14 +41,14 @@ const typographyVariants = cva("", {
|
|
|
43
41
|
tableHeader: "text-base font-medium leading-normal",
|
|
44
42
|
},
|
|
45
43
|
/**
|
|
46
|
-
* Color variants for different semantic meanings
|
|
44
|
+
* Color variants for different semantic meanings and visual hierarchy
|
|
47
45
|
*
|
|
48
|
-
* @
|
|
49
|
-
* @
|
|
50
|
-
* @
|
|
51
|
-
* @
|
|
52
|
-
* @
|
|
53
|
-
* @
|
|
46
|
+
* @variant default - Default text color that adapts to light/dark theme (text-foreground)
|
|
47
|
+
* @variant muted - Subdued text color for secondary information and descriptions (text-muted-foreground)
|
|
48
|
+
* @variant accent - Accent color for emphasis, highlights, and interactive elements (text-accent-foreground)
|
|
49
|
+
* @variant destructive - Red color for error messages, warnings, and destructive actions (text-destructive)
|
|
50
|
+
* @variant success - Green color for success messages, confirmations, and positive states (text-success)
|
|
51
|
+
* @variant warning - Orange/yellow color for warnings, cautions, and attention-seeking content (text-warning)
|
|
54
52
|
*/
|
|
55
53
|
color: {
|
|
56
54
|
default: "text-foreground",
|
|
@@ -61,7 +59,12 @@ const typographyVariants = cva("", {
|
|
|
61
59
|
warning: "text-warning",
|
|
62
60
|
},
|
|
63
61
|
/**
|
|
64
|
-
* Text alignment options
|
|
62
|
+
* Text alignment options for layout control
|
|
63
|
+
*
|
|
64
|
+
* @variant left - Left-aligned text (default for LTR languages)
|
|
65
|
+
* @variant center - Center-aligned text for headings and callouts
|
|
66
|
+
* @variant right - Right-aligned text for numerical data and RTL content
|
|
67
|
+
* @variant justify - Justified text for formal documents and articles
|
|
65
68
|
*/
|
|
66
69
|
align: {
|
|
67
70
|
left: "text-left",
|
|
@@ -70,7 +73,11 @@ const typographyVariants = cva("", {
|
|
|
70
73
|
justify: "text-justify",
|
|
71
74
|
},
|
|
72
75
|
/**
|
|
73
|
-
* Text transformation options
|
|
76
|
+
* Text transformation options for stylistic effects
|
|
77
|
+
*
|
|
78
|
+
* @variant uppercase - ALL CAPS for emphasis and labels
|
|
79
|
+
* @variant lowercase - all lowercase for stylistic consistency
|
|
80
|
+
* @variant capitalize - Title Case For Headings And Proper Nouns
|
|
74
81
|
*/
|
|
75
82
|
transform: {
|
|
76
83
|
uppercase: "uppercase",
|
|
@@ -78,7 +85,12 @@ const typographyVariants = cva("", {
|
|
|
78
85
|
capitalize: "capitalize",
|
|
79
86
|
},
|
|
80
87
|
/**
|
|
81
|
-
* Font weight variations
|
|
88
|
+
* Font weight variations for visual hierarchy
|
|
89
|
+
*
|
|
90
|
+
* @variant normal - Normal font weight (400) for body text
|
|
91
|
+
* @variant medium - Medium font weight (500) for subtle emphasis
|
|
92
|
+
* @variant semibold - Semibold font weight (600) for headings and important text
|
|
93
|
+
* @variant bold - Bold font weight (700) for strong emphasis
|
|
82
94
|
*/
|
|
83
95
|
weight: {
|
|
84
96
|
normal: "font-normal",
|
|
@@ -94,133 +106,188 @@ const typographyVariants = cva("", {
|
|
|
94
106
|
},
|
|
95
107
|
});
|
|
96
108
|
|
|
109
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
110
|
+
type TypographyDocsProps = {
|
|
111
|
+
/** Typography variant that determines text size, weight, and line height @default "body" */
|
|
112
|
+
variant?:
|
|
113
|
+
| "heading"
|
|
114
|
+
| "subheading"
|
|
115
|
+
| "body"
|
|
116
|
+
| "bodyEmphasized"
|
|
117
|
+
| "details"
|
|
118
|
+
| "field"
|
|
119
|
+
| "code"
|
|
120
|
+
| "microcopy"
|
|
121
|
+
| "tableCell"
|
|
122
|
+
| "tableHeader";
|
|
123
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
124
|
+
color?:
|
|
125
|
+
| "default"
|
|
126
|
+
| "muted"
|
|
127
|
+
| "accent"
|
|
128
|
+
| "destructive"
|
|
129
|
+
| "success"
|
|
130
|
+
| "warning";
|
|
131
|
+
/** Text alignment within the container @default "left" */
|
|
132
|
+
align?: "left" | "center" | "right" | "justify";
|
|
133
|
+
/** Text transformation for stylistic effects */
|
|
134
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
135
|
+
/** Font weight override for visual emphasis */
|
|
136
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
137
|
+
/** The HTML element or component to render as @default "p" */
|
|
138
|
+
as?: React.ElementType;
|
|
139
|
+
/** For label elements, the associated input ID for accessibility */
|
|
140
|
+
htmlFor?: string;
|
|
141
|
+
/** Whether to render as a Slot component for composition patterns. When true, the component merges its props onto its immediate child instead of rendering its own DOM element @default false */
|
|
142
|
+
asChild?: boolean;
|
|
143
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
144
|
+
italic?: boolean;
|
|
145
|
+
/** Whether the text should have underline decoration @default false */
|
|
146
|
+
underline?: boolean;
|
|
147
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
148
|
+
strikethrough?: boolean;
|
|
149
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
150
|
+
truncate?: boolean;
|
|
151
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
152
|
+
srOnly?: boolean;
|
|
153
|
+
/** Additional CSS classes for custom styling */
|
|
154
|
+
className?: string;
|
|
155
|
+
/** Content to render within the typography element */
|
|
156
|
+
children?: React.ReactNode;
|
|
157
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
158
|
+
|
|
97
159
|
/**
|
|
98
|
-
*
|
|
160
|
+
* Base props for all Typography components
|
|
99
161
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
162
|
+
type TypographyBaseProps = {
|
|
163
|
+
/** Typography variant that determines text size, weight, and line height */
|
|
164
|
+
variant?: VariantProps<typeof typographyVariants>["variant"];
|
|
165
|
+
/** Color variant for semantic meaning and visual hierarchy */
|
|
166
|
+
color?: VariantProps<typeof typographyVariants>["color"];
|
|
167
|
+
/** Text alignment within the container */
|
|
168
|
+
align?: VariantProps<typeof typographyVariants>["align"];
|
|
169
|
+
/** Text transformation for stylistic effects */
|
|
170
|
+
transform?: VariantProps<typeof typographyVariants>["transform"];
|
|
171
|
+
/** Font weight override for visual emphasis */
|
|
172
|
+
weight?: VariantProps<typeof typographyVariants>["weight"];
|
|
173
|
+
/** The HTML element or component to render as @default "p" */
|
|
107
174
|
as?: React.ElementType;
|
|
108
|
-
/**
|
|
109
|
-
* For label elements, the associated input ID
|
|
110
|
-
*/
|
|
175
|
+
/** For label elements, the associated input ID for accessibility */
|
|
111
176
|
htmlFor?: string;
|
|
112
|
-
/**
|
|
113
|
-
* Whether to render as a Slot component for composition
|
|
114
|
-
* @default false
|
|
115
|
-
*/
|
|
177
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
116
178
|
asChild?: boolean;
|
|
117
|
-
/**
|
|
118
|
-
* Whether the text should be italic
|
|
119
|
-
* @default false
|
|
120
|
-
*/
|
|
179
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
121
180
|
italic?: boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Whether the text should be underlined
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
181
|
+
/** Whether the text should have underline decoration @default false */
|
|
126
182
|
underline?: boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Whether the text should be struck through
|
|
129
|
-
* @default false
|
|
130
|
-
*/
|
|
183
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
131
184
|
strikethrough?: boolean;
|
|
132
|
-
/**
|
|
133
|
-
* Whether the text should have a truncated overflow with ellipsis
|
|
134
|
-
* @default false
|
|
135
|
-
*/
|
|
185
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
136
186
|
truncate?: boolean;
|
|
137
|
-
/**
|
|
138
|
-
* Screen reader only text (visually hidden but accessible)
|
|
139
|
-
* @default false
|
|
140
|
-
*/
|
|
187
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
141
188
|
srOnly?: boolean;
|
|
142
|
-
|
|
189
|
+
/** Additional CSS classes for custom styling */
|
|
190
|
+
className?: string;
|
|
191
|
+
/** Content to render within the typography element */
|
|
192
|
+
children?: React.ReactNode;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Complete props for the Typography component
|
|
197
|
+
*/
|
|
198
|
+
type TypographyProps = TypographyBaseProps &
|
|
199
|
+
Omit<React.HTMLAttributes<HTMLElement>, keyof TypographyBaseProps>;
|
|
143
200
|
|
|
144
201
|
/**
|
|
145
|
-
* Typography component for consistent
|
|
202
|
+
* Typography - Comprehensive text styling component for consistent design system implementation
|
|
146
203
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* and
|
|
204
|
+
* A flexible typography component that provides semantic text variants, color options, and accessibility features.
|
|
205
|
+
* Built with class-variance-authority (CVA) for type-safe variant management and supports both semantic HTML
|
|
206
|
+
* elements and composition patterns via Radix UI Slot. Designed to handle all text styling needs across
|
|
207
|
+
* the application with consistent visual hierarchy and accessibility compliance.
|
|
150
208
|
*
|
|
151
|
-
* @component
|
|
152
209
|
* @example
|
|
153
210
|
* ```tsx
|
|
154
|
-
* // Basic heading
|
|
211
|
+
* // Basic heading with semantic HTML
|
|
155
212
|
* <Typography variant="heading" as="h1">
|
|
156
213
|
* Welcome to Neynar
|
|
157
214
|
* </Typography>
|
|
158
215
|
*
|
|
159
|
-
* // Body text with color
|
|
216
|
+
* // Body text with color variant
|
|
160
217
|
* <Typography variant="body" color="muted">
|
|
161
|
-
* This is
|
|
218
|
+
* This is secondary body text with reduced visual prominence.
|
|
162
219
|
* </Typography>
|
|
163
220
|
*
|
|
164
|
-
* // Code snippet
|
|
221
|
+
* // Code snippet with proper semantics
|
|
165
222
|
* <Typography variant="code" as="code">
|
|
166
223
|
* const message = "Hello, world!";
|
|
167
224
|
* </Typography>
|
|
168
|
-
*
|
|
169
|
-
* // Table header
|
|
170
|
-
* <Typography variant="tableHeader" as="th">
|
|
171
|
-
* Column Header
|
|
172
|
-
* </Typography>
|
|
173
225
|
* ```
|
|
174
226
|
*
|
|
175
227
|
* @example
|
|
176
228
|
* ```tsx
|
|
177
|
-
* //
|
|
229
|
+
* // Advanced styling with multiple variants
|
|
178
230
|
* <Typography
|
|
179
231
|
* variant="subheading"
|
|
180
232
|
* color="accent"
|
|
181
233
|
* align="center"
|
|
234
|
+
* weight="semibold"
|
|
182
235
|
* italic
|
|
183
236
|
* underline
|
|
237
|
+
* className="mb-4"
|
|
184
238
|
* >
|
|
185
|
-
* Styled Subheading
|
|
239
|
+
* Styled Subheading with Multiple Variants
|
|
186
240
|
* </Typography>
|
|
187
241
|
*
|
|
188
|
-
* // Truncated text
|
|
242
|
+
* // Truncated text for constrained layouts
|
|
189
243
|
* <Typography variant="body" truncate className="max-w-xs">
|
|
190
|
-
* This is a very long text that will be truncated with ellipsis
|
|
244
|
+
* This is a very long text that will be truncated with ellipsis when it exceeds the container width
|
|
191
245
|
* </Typography>
|
|
246
|
+
* ```
|
|
192
247
|
*
|
|
193
|
-
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```tsx
|
|
250
|
+
* // Accessibility features
|
|
194
251
|
* <Typography variant="details" srOnly>
|
|
195
|
-
* Additional context for screen readers
|
|
252
|
+
* Additional context for screen readers only
|
|
196
253
|
* </Typography>
|
|
197
|
-
* ```
|
|
198
254
|
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* @param props.srOnly - Hide visually but keep accessible
|
|
212
|
-
* @param props.className - Additional CSS classes
|
|
213
|
-
* @param props.children - Content to render
|
|
255
|
+
* // Form label with proper association
|
|
256
|
+
* <Typography variant="field" as="label" htmlFor="email-input">
|
|
257
|
+
* Email Address
|
|
258
|
+
* </Typography>
|
|
259
|
+
*
|
|
260
|
+
* // Composition with asChild for complex structures
|
|
261
|
+
* <Typography variant="body" asChild>
|
|
262
|
+
* <a href="/about" className="hover:underline">
|
|
263
|
+
* Learn more about our platform
|
|
264
|
+
* </a>
|
|
265
|
+
* </Typography>
|
|
266
|
+
* ```
|
|
214
267
|
*
|
|
215
268
|
* @accessibility
|
|
216
|
-
* - Uses
|
|
217
|
-
* -
|
|
218
|
-
* -
|
|
219
|
-
* -
|
|
269
|
+
* - **Semantic HTML**: Uses appropriate HTML elements via `as` prop for proper document structure
|
|
270
|
+
* - **Screen Reader Support**: `srOnly` prop provides content accessible only to assistive technologies
|
|
271
|
+
* - **Color Contrast**: All color variants meet WCAG 2.1 AA contrast requirements (4.5:1 minimum)
|
|
272
|
+
* - **Label Association**: `htmlFor` prop properly associates labels with form controls
|
|
273
|
+
* - **Focus Management**: Interactive elements receive proper focus indicators
|
|
274
|
+
* - **Text Scaling**: All font sizes scale appropriately with user's browser text size preferences
|
|
275
|
+
* - **High Contrast Mode**: Respects system high contrast mode preferences
|
|
276
|
+
*
|
|
277
|
+
* @performance
|
|
278
|
+
* - Uses CVA for efficient class generation and tree-shaking
|
|
279
|
+
* - Minimal runtime overhead with compile-time optimizations
|
|
280
|
+
* - Cached class combinations for repeated variant usage
|
|
220
281
|
*
|
|
282
|
+
* @see {@link H1} Semantic H1 heading component
|
|
283
|
+
* @see {@link H2} Semantic H2 heading component
|
|
284
|
+
* @see {@link P} Semantic paragraph component
|
|
285
|
+
* @see {@link Code} Semantic code element component
|
|
286
|
+
* @see {@link https://cva.style/docs} Class Variance Authority documentation
|
|
287
|
+
* @see {@link https://ui.shadcn.com/docs/components/typography} shadcn/ui Typography reference
|
|
221
288
|
* @since 1.0.0
|
|
222
289
|
*/
|
|
223
|
-
|
|
290
|
+
function Typography({
|
|
224
291
|
className,
|
|
225
292
|
variant,
|
|
226
293
|
color,
|
|
@@ -238,9 +305,9 @@ export function Typography({
|
|
|
238
305
|
}: TypographyProps) {
|
|
239
306
|
const Comp = asChild ? Slot : Element;
|
|
240
307
|
|
|
241
|
-
|
|
242
308
|
return (
|
|
243
309
|
<Comp
|
|
310
|
+
data-slot="typography"
|
|
244
311
|
className={cn(
|
|
245
312
|
typographyVariants({ variant, color, align, transform, weight }),
|
|
246
313
|
{
|
|
@@ -259,210 +326,1093 @@ export function Typography({
|
|
|
259
326
|
|
|
260
327
|
/**
|
|
261
328
|
* Individual semantic typography components with pre-configured defaults
|
|
329
|
+
*
|
|
330
|
+
* These components provide semantic HTML elements with pre-configured typography variants,
|
|
331
|
+
* ensuring consistent styling while maintaining proper document structure and accessibility.
|
|
332
|
+
* Each component uses the appropriate HTML element and typography variant for its semantic meaning.
|
|
262
333
|
*/
|
|
263
334
|
|
|
335
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
336
|
+
type H1DocsProps = {
|
|
337
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
338
|
+
color?:
|
|
339
|
+
| "default"
|
|
340
|
+
| "muted"
|
|
341
|
+
| "accent"
|
|
342
|
+
| "destructive"
|
|
343
|
+
| "success"
|
|
344
|
+
| "warning";
|
|
345
|
+
/** Text alignment within the container @default "left" */
|
|
346
|
+
align?: "left" | "center" | "right" | "justify";
|
|
347
|
+
/** Text transformation for stylistic effects */
|
|
348
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
349
|
+
/** Font weight override for visual emphasis */
|
|
350
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
351
|
+
/** For label elements, the associated input ID for accessibility */
|
|
352
|
+
htmlFor?: string;
|
|
353
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
354
|
+
asChild?: boolean;
|
|
355
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
356
|
+
italic?: boolean;
|
|
357
|
+
/** Whether the text should have underline decoration @default false */
|
|
358
|
+
underline?: boolean;
|
|
359
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
360
|
+
strikethrough?: boolean;
|
|
361
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
362
|
+
truncate?: boolean;
|
|
363
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
364
|
+
srOnly?: boolean;
|
|
365
|
+
/** Additional CSS classes for custom styling */
|
|
366
|
+
className?: string;
|
|
367
|
+
/** Content to render within the typography element */
|
|
368
|
+
children?: React.ReactNode;
|
|
369
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
370
|
+
|
|
371
|
+
/** Props for H1 heading component */
|
|
372
|
+
type H1Props = Omit<TypographyProps, "as" | "variant">;
|
|
373
|
+
|
|
264
374
|
/**
|
|
265
|
-
* H1 heading component
|
|
375
|
+
* H1 - Primary page heading component
|
|
376
|
+
*
|
|
377
|
+
* The main heading for a page or major section. Uses the "heading" variant with h1 semantic element.
|
|
378
|
+
* Should be used once per page for proper document outline and SEO.
|
|
266
379
|
*
|
|
267
380
|
* @example
|
|
268
381
|
* ```tsx
|
|
269
|
-
*
|
|
270
|
-
* <H1
|
|
382
|
+
* // Page title
|
|
383
|
+
* <H1>Welcome to Neynar Platform</H1>
|
|
384
|
+
*
|
|
385
|
+
* // With color variant
|
|
386
|
+
* <H1 color="muted">Draft: Article Title</H1>
|
|
387
|
+
*
|
|
388
|
+
* // With custom styling
|
|
389
|
+
* <H1 align="center" className="mb-8">
|
|
390
|
+
* Centered Page Heading
|
|
391
|
+
* </H1>
|
|
271
392
|
* ```
|
|
393
|
+
*
|
|
394
|
+
* @accessibility
|
|
395
|
+
* - Creates proper document outline structure
|
|
396
|
+
* - Should be the first heading on the page
|
|
397
|
+
* - Provides main page topic for screen readers
|
|
398
|
+
* - Helps with keyboard navigation landmarks
|
|
399
|
+
*
|
|
400
|
+
* @see {@link H2} Secondary heading component
|
|
401
|
+
* @see {@link Typography} Base typography component
|
|
272
402
|
*/
|
|
273
|
-
|
|
403
|
+
function H1(props: H1Props) {
|
|
274
404
|
return <Typography variant="heading" as="h1" {...props} />;
|
|
275
405
|
}
|
|
276
406
|
|
|
407
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
408
|
+
type H2DocsProps = {
|
|
409
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
410
|
+
color?:
|
|
411
|
+
| "default"
|
|
412
|
+
| "muted"
|
|
413
|
+
| "accent"
|
|
414
|
+
| "destructive"
|
|
415
|
+
| "success"
|
|
416
|
+
| "warning";
|
|
417
|
+
/** Text alignment within the container @default "left" */
|
|
418
|
+
align?: "left" | "center" | "right" | "justify";
|
|
419
|
+
/** Text transformation for stylistic effects */
|
|
420
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
421
|
+
/** Font weight override for visual emphasis */
|
|
422
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
423
|
+
/** For label elements, the associated input ID for accessibility */
|
|
424
|
+
htmlFor?: string;
|
|
425
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
426
|
+
asChild?: boolean;
|
|
427
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
428
|
+
italic?: boolean;
|
|
429
|
+
/** Whether the text should have underline decoration @default false */
|
|
430
|
+
underline?: boolean;
|
|
431
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
432
|
+
strikethrough?: boolean;
|
|
433
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
434
|
+
truncate?: boolean;
|
|
435
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
436
|
+
srOnly?: boolean;
|
|
437
|
+
/** Additional CSS classes for custom styling */
|
|
438
|
+
className?: string;
|
|
439
|
+
/** Content to render within the typography element */
|
|
440
|
+
children?: React.ReactNode;
|
|
441
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
442
|
+
|
|
443
|
+
/** Props for H2 heading component */
|
|
444
|
+
type H2Props = Omit<TypographyProps, "as" | "variant">;
|
|
445
|
+
|
|
277
446
|
/**
|
|
278
|
-
* H2 heading component
|
|
447
|
+
* H2 - Secondary section heading component
|
|
448
|
+
*
|
|
449
|
+
* Section headings that divide page content into logical groups. Uses the "subheading" variant
|
|
450
|
+
* with h2 semantic element. Essential for creating proper document hierarchy.
|
|
279
451
|
*
|
|
280
452
|
* @example
|
|
281
453
|
* ```tsx
|
|
282
|
-
*
|
|
283
|
-
* <H2
|
|
454
|
+
* // Section heading
|
|
455
|
+
* <H2>Getting Started</H2>
|
|
456
|
+
*
|
|
457
|
+
* // With accent color
|
|
458
|
+
* <H2 color="accent">Featured Content</H2>
|
|
459
|
+
*
|
|
460
|
+
* // With additional styling
|
|
461
|
+
* <H2 weight="bold" className="border-b pb-2">
|
|
462
|
+
* Section with Border
|
|
463
|
+
* </H2>
|
|
284
464
|
* ```
|
|
465
|
+
*
|
|
466
|
+
* @accessibility
|
|
467
|
+
* - Maintains document outline hierarchy
|
|
468
|
+
* - Should follow H1 and precede H3 elements
|
|
469
|
+
* - Provides section navigation for screen readers
|
|
470
|
+
* - Essential for skip navigation functionality
|
|
471
|
+
*
|
|
472
|
+
* @see {@link H1} Primary heading component
|
|
473
|
+
* @see {@link H3} Tertiary heading component
|
|
285
474
|
*/
|
|
286
|
-
|
|
475
|
+
function H2(props: H2Props) {
|
|
287
476
|
return <Typography variant="subheading" as="h2" {...props} />;
|
|
288
477
|
}
|
|
289
478
|
|
|
479
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
480
|
+
type H3DocsProps = {
|
|
481
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
482
|
+
color?:
|
|
483
|
+
| "default"
|
|
484
|
+
| "muted"
|
|
485
|
+
| "accent"
|
|
486
|
+
| "destructive"
|
|
487
|
+
| "success"
|
|
488
|
+
| "warning";
|
|
489
|
+
/** Text alignment within the container @default "left" */
|
|
490
|
+
align?: "left" | "center" | "right" | "justify";
|
|
491
|
+
/** Text transformation for stylistic effects */
|
|
492
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
493
|
+
/** Font weight override for visual emphasis */
|
|
494
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
495
|
+
/** For label elements, the associated input ID for accessibility */
|
|
496
|
+
htmlFor?: string;
|
|
497
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
498
|
+
asChild?: boolean;
|
|
499
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
500
|
+
italic?: boolean;
|
|
501
|
+
/** Whether the text should have underline decoration @default false */
|
|
502
|
+
underline?: boolean;
|
|
503
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
504
|
+
strikethrough?: boolean;
|
|
505
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
506
|
+
truncate?: boolean;
|
|
507
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
508
|
+
srOnly?: boolean;
|
|
509
|
+
/** Additional CSS classes for custom styling */
|
|
510
|
+
className?: string;
|
|
511
|
+
/** Content to render within the typography element */
|
|
512
|
+
children?: React.ReactNode;
|
|
513
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
514
|
+
|
|
515
|
+
/** Props for H3 heading component */
|
|
516
|
+
type H3Props = Omit<TypographyProps, "as" | "variant">;
|
|
517
|
+
|
|
290
518
|
/**
|
|
291
|
-
* H3 heading component
|
|
519
|
+
* H3 - Tertiary subsection heading component
|
|
520
|
+
*
|
|
521
|
+
* Subsection headings for further content division. Uses the "subheading" variant
|
|
522
|
+
* with h3 semantic element for consistent visual hierarchy.
|
|
292
523
|
*
|
|
293
524
|
* @example
|
|
294
525
|
* ```tsx
|
|
295
|
-
*
|
|
526
|
+
* // Subsection heading
|
|
527
|
+
* <H3>Installation Guide</H3>
|
|
528
|
+
*
|
|
529
|
+
* // In a card or content block
|
|
530
|
+
* <H3 color="muted" className="mb-3">
|
|
531
|
+
* Optional Configuration
|
|
532
|
+
* </H3>
|
|
296
533
|
* ```
|
|
534
|
+
*
|
|
535
|
+
* @accessibility
|
|
536
|
+
* - Should follow H2 elements in document flow
|
|
537
|
+
* - Helps create detailed content structure
|
|
538
|
+
* - Improves navigation with assistive technologies
|
|
539
|
+
* - Supports table of contents generation
|
|
297
540
|
*/
|
|
298
|
-
|
|
541
|
+
function H3(props: H3Props) {
|
|
299
542
|
return <Typography variant="subheading" as="h3" {...props} />;
|
|
300
543
|
}
|
|
301
544
|
|
|
545
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
546
|
+
type H4DocsProps = {
|
|
547
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
548
|
+
color?:
|
|
549
|
+
| "default"
|
|
550
|
+
| "muted"
|
|
551
|
+
| "accent"
|
|
552
|
+
| "destructive"
|
|
553
|
+
| "success"
|
|
554
|
+
| "warning";
|
|
555
|
+
/** Text alignment within the container @default "left" */
|
|
556
|
+
align?: "left" | "center" | "right" | "justify";
|
|
557
|
+
/** Text transformation for stylistic effects */
|
|
558
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
559
|
+
/** Font weight override for visual emphasis */
|
|
560
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
561
|
+
/** For label elements, the associated input ID for accessibility */
|
|
562
|
+
htmlFor?: string;
|
|
563
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
564
|
+
asChild?: boolean;
|
|
565
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
566
|
+
italic?: boolean;
|
|
567
|
+
/** Whether the text should have underline decoration @default false */
|
|
568
|
+
underline?: boolean;
|
|
569
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
570
|
+
strikethrough?: boolean;
|
|
571
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
572
|
+
truncate?: boolean;
|
|
573
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
574
|
+
srOnly?: boolean;
|
|
575
|
+
/** Additional CSS classes for custom styling */
|
|
576
|
+
className?: string;
|
|
577
|
+
/** Content to render within the typography element */
|
|
578
|
+
children?: React.ReactNode;
|
|
579
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
580
|
+
|
|
581
|
+
/** Props for H4 heading component */
|
|
582
|
+
type H4Props = Omit<TypographyProps, "as" | "variant">;
|
|
583
|
+
|
|
302
584
|
/**
|
|
303
|
-
* H4 heading component
|
|
585
|
+
* H4 - Minor heading component for detailed sections
|
|
586
|
+
*
|
|
587
|
+
* Minor headings for detailed content organization. Uses "bodyEmphasized" variant
|
|
588
|
+
* with h4 semantic element for subtle but distinct hierarchy.
|
|
304
589
|
*
|
|
305
590
|
* @example
|
|
306
591
|
* ```tsx
|
|
307
|
-
*
|
|
592
|
+
* // Minor section heading
|
|
593
|
+
* <H4>Configuration Options</H4>
|
|
594
|
+
*
|
|
595
|
+
* // In detailed documentation
|
|
596
|
+
* <H4 color="muted">Advanced Settings</H4>
|
|
308
597
|
* ```
|
|
598
|
+
*
|
|
599
|
+
* @accessibility
|
|
600
|
+
* - Maintains proper heading hierarchy flow
|
|
601
|
+
* - Provides fine-grained content organization
|
|
602
|
+
* - Supports screen reader document navigation
|
|
309
603
|
*/
|
|
310
|
-
|
|
604
|
+
function H4(props: H4Props) {
|
|
311
605
|
return <Typography variant="bodyEmphasized" as="h4" {...props} />;
|
|
312
606
|
}
|
|
313
607
|
|
|
608
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
609
|
+
type H5DocsProps = {
|
|
610
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
611
|
+
color?:
|
|
612
|
+
| "default"
|
|
613
|
+
| "muted"
|
|
614
|
+
| "accent"
|
|
615
|
+
| "destructive"
|
|
616
|
+
| "success"
|
|
617
|
+
| "warning";
|
|
618
|
+
/** Text alignment within the container @default "left" */
|
|
619
|
+
align?: "left" | "center" | "right" | "justify";
|
|
620
|
+
/** Text transformation for stylistic effects */
|
|
621
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
622
|
+
/** Font weight override for visual emphasis */
|
|
623
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
624
|
+
/** For label elements, the associated input ID for accessibility */
|
|
625
|
+
htmlFor?: string;
|
|
626
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
627
|
+
asChild?: boolean;
|
|
628
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
629
|
+
italic?: boolean;
|
|
630
|
+
/** Whether the text should have underline decoration @default false */
|
|
631
|
+
underline?: boolean;
|
|
632
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
633
|
+
strikethrough?: boolean;
|
|
634
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
635
|
+
truncate?: boolean;
|
|
636
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
637
|
+
srOnly?: boolean;
|
|
638
|
+
/** Additional CSS classes for custom styling */
|
|
639
|
+
className?: string;
|
|
640
|
+
/** Content to render within the typography element */
|
|
641
|
+
children?: React.ReactNode;
|
|
642
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
643
|
+
|
|
644
|
+
/** Props for H5 heading component */
|
|
645
|
+
type H5Props = Omit<TypographyProps, "as" | "variant">;
|
|
646
|
+
|
|
314
647
|
/**
|
|
315
|
-
* H5 heading component
|
|
648
|
+
* H5 - Small heading component for micro-sections
|
|
649
|
+
*
|
|
650
|
+
* Small headings for very specific content divisions. Uses "bodyEmphasized" variant
|
|
651
|
+
* with h5 semantic element.
|
|
316
652
|
*
|
|
317
653
|
* @example
|
|
318
654
|
* ```tsx
|
|
319
|
-
*
|
|
655
|
+
* // Small section heading
|
|
656
|
+
* <H5>Error Codes</H5>
|
|
657
|
+
*
|
|
658
|
+
* // In lists or detailed breakdowns
|
|
659
|
+
* <H5 weight="semibold">Step 1: Setup</H5>
|
|
320
660
|
* ```
|
|
321
661
|
*/
|
|
322
|
-
|
|
662
|
+
function H5(props: H5Props) {
|
|
323
663
|
return <Typography variant="bodyEmphasized" as="h5" {...props} />;
|
|
324
664
|
}
|
|
325
665
|
|
|
666
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
667
|
+
type H6DocsProps = {
|
|
668
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
669
|
+
color?:
|
|
670
|
+
| "default"
|
|
671
|
+
| "muted"
|
|
672
|
+
| "accent"
|
|
673
|
+
| "destructive"
|
|
674
|
+
| "success"
|
|
675
|
+
| "warning";
|
|
676
|
+
/** Text alignment within the container @default "left" */
|
|
677
|
+
align?: "left" | "center" | "right" | "justify";
|
|
678
|
+
/** Text transformation for stylistic effects */
|
|
679
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
680
|
+
/** Font weight override for visual emphasis */
|
|
681
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
682
|
+
/** For label elements, the associated input ID for accessibility */
|
|
683
|
+
htmlFor?: string;
|
|
684
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
685
|
+
asChild?: boolean;
|
|
686
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
687
|
+
italic?: boolean;
|
|
688
|
+
/** Whether the text should have underline decoration @default false */
|
|
689
|
+
underline?: boolean;
|
|
690
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
691
|
+
strikethrough?: boolean;
|
|
692
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
693
|
+
truncate?: boolean;
|
|
694
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
695
|
+
srOnly?: boolean;
|
|
696
|
+
/** Additional CSS classes for custom styling */
|
|
697
|
+
className?: string;
|
|
698
|
+
/** Content to render within the typography element */
|
|
699
|
+
children?: React.ReactNode;
|
|
700
|
+
} & React.HTMLAttributes<HTMLHeadingElement>;
|
|
701
|
+
|
|
702
|
+
/** Props for H6 heading component */
|
|
703
|
+
type H6Props = Omit<TypographyProps, "as" | "variant">;
|
|
704
|
+
|
|
326
705
|
/**
|
|
327
|
-
* H6 heading component
|
|
706
|
+
* H6 - Smallest heading component for minimal emphasis
|
|
707
|
+
*
|
|
708
|
+
* The smallest semantic heading level. Uses "details" variant with h6 element
|
|
709
|
+
* for minimal but semantic emphasis.
|
|
328
710
|
*
|
|
329
711
|
* @example
|
|
330
712
|
* ```tsx
|
|
331
|
-
*
|
|
713
|
+
* // Smallest heading
|
|
714
|
+
* <H6>Notes and Disclaimers</H6>
|
|
715
|
+
*
|
|
716
|
+
* // In deeply nested content
|
|
717
|
+
* <H6 color="muted">Technical Details</H6>
|
|
332
718
|
* ```
|
|
333
719
|
*/
|
|
334
|
-
|
|
720
|
+
function H6(props: H6Props) {
|
|
335
721
|
return <Typography variant="details" as="h6" {...props} />;
|
|
336
722
|
}
|
|
337
723
|
|
|
724
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
725
|
+
type PDocsProps = {
|
|
726
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
727
|
+
color?:
|
|
728
|
+
| "default"
|
|
729
|
+
| "muted"
|
|
730
|
+
| "accent"
|
|
731
|
+
| "destructive"
|
|
732
|
+
| "success"
|
|
733
|
+
| "warning";
|
|
734
|
+
/** Text alignment within the container @default "left" */
|
|
735
|
+
align?: "left" | "center" | "right" | "justify";
|
|
736
|
+
/** Text transformation for stylistic effects */
|
|
737
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
738
|
+
/** Font weight override for visual emphasis */
|
|
739
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
740
|
+
/** For label elements, the associated input ID for accessibility */
|
|
741
|
+
htmlFor?: string;
|
|
742
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
743
|
+
asChild?: boolean;
|
|
744
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
745
|
+
italic?: boolean;
|
|
746
|
+
/** Whether the text should have underline decoration @default false */
|
|
747
|
+
underline?: boolean;
|
|
748
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
749
|
+
strikethrough?: boolean;
|
|
750
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
751
|
+
truncate?: boolean;
|
|
752
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
753
|
+
srOnly?: boolean;
|
|
754
|
+
/** Additional CSS classes for custom styling */
|
|
755
|
+
className?: string;
|
|
756
|
+
/** Content to render within the typography element */
|
|
757
|
+
children?: React.ReactNode;
|
|
758
|
+
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
759
|
+
|
|
760
|
+
/** Props for P paragraph component */
|
|
761
|
+
type PProps = Omit<TypographyProps, "as" | "variant">;
|
|
762
|
+
|
|
338
763
|
/**
|
|
339
|
-
* Paragraph component for body text
|
|
764
|
+
* P - Paragraph component for body text content
|
|
765
|
+
*
|
|
766
|
+
* Standard paragraph element for readable body text. Uses "body" variant with p semantic element.
|
|
767
|
+
* Optimized for readability with appropriate line height and font size.
|
|
340
768
|
*
|
|
341
769
|
* @example
|
|
342
770
|
* ```tsx
|
|
343
|
-
*
|
|
344
|
-
* <P
|
|
345
|
-
*
|
|
771
|
+
* // Standard paragraph
|
|
772
|
+
* <P>This is standard body text that provides information to the user.</P>
|
|
773
|
+
*
|
|
774
|
+
* // With color variants
|
|
775
|
+
* <P color="muted">Secondary information with reduced visual prominence.</P>
|
|
776
|
+
*
|
|
777
|
+
* // With custom spacing
|
|
778
|
+
* <P className="mb-6">Paragraph with custom bottom margin for layout control.</P>
|
|
779
|
+
*
|
|
780
|
+
* // Truncated paragraph
|
|
781
|
+
* <P truncate className="max-w-md">
|
|
782
|
+
* Long paragraph content that will be truncated with ellipsis
|
|
783
|
+
* </P>
|
|
346
784
|
* ```
|
|
785
|
+
*
|
|
786
|
+
* @accessibility
|
|
787
|
+
* - Provides proper semantic structure for body content
|
|
788
|
+
* - Maintains readable line height for accessibility
|
|
789
|
+
* - Supports screen reader text flow and navigation
|
|
790
|
+
*
|
|
791
|
+
* @see {@link Typography} Base typography component
|
|
347
792
|
*/
|
|
348
|
-
|
|
793
|
+
function P(props: PProps) {
|
|
349
794
|
return <Typography variant="body" as="p" {...props} />;
|
|
350
795
|
}
|
|
351
796
|
|
|
797
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
798
|
+
type SpanDocsProps = {
|
|
799
|
+
/** Typography variant that determines text size, weight, and line height @default "body" */
|
|
800
|
+
variant?:
|
|
801
|
+
| "heading"
|
|
802
|
+
| "subheading"
|
|
803
|
+
| "body"
|
|
804
|
+
| "bodyEmphasized"
|
|
805
|
+
| "details"
|
|
806
|
+
| "field"
|
|
807
|
+
| "code"
|
|
808
|
+
| "microcopy"
|
|
809
|
+
| "tableCell"
|
|
810
|
+
| "tableHeader";
|
|
811
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
812
|
+
color?:
|
|
813
|
+
| "default"
|
|
814
|
+
| "muted"
|
|
815
|
+
| "accent"
|
|
816
|
+
| "destructive"
|
|
817
|
+
| "success"
|
|
818
|
+
| "warning";
|
|
819
|
+
/** Text alignment within the container @default "left" */
|
|
820
|
+
align?: "left" | "center" | "right" | "justify";
|
|
821
|
+
/** Text transformation for stylistic effects */
|
|
822
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
823
|
+
/** Font weight override for visual emphasis */
|
|
824
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
825
|
+
/** For label elements, the associated input ID for accessibility */
|
|
826
|
+
htmlFor?: string;
|
|
827
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
828
|
+
asChild?: boolean;
|
|
829
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
830
|
+
italic?: boolean;
|
|
831
|
+
/** Whether the text should have underline decoration @default false */
|
|
832
|
+
underline?: boolean;
|
|
833
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
834
|
+
strikethrough?: boolean;
|
|
835
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
836
|
+
truncate?: boolean;
|
|
837
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
838
|
+
srOnly?: boolean;
|
|
839
|
+
/** Additional CSS classes for custom styling */
|
|
840
|
+
className?: string;
|
|
841
|
+
/** Content to render within the typography element */
|
|
842
|
+
children?: React.ReactNode;
|
|
843
|
+
} & React.HTMLAttributes<HTMLSpanElement>;
|
|
844
|
+
|
|
845
|
+
/** Props for Span inline component */
|
|
846
|
+
type SpanProps = Omit<TypographyProps, "as">;
|
|
847
|
+
|
|
352
848
|
/**
|
|
353
|
-
* Span component for
|
|
849
|
+
* Span - Inline text component for text fragments and styling
|
|
850
|
+
*
|
|
851
|
+
* Generic inline element for styling text fragments within other content.
|
|
852
|
+
* Supports all typography variants while maintaining inline display behavior.
|
|
354
853
|
*
|
|
355
854
|
* @example
|
|
356
855
|
* ```tsx
|
|
357
|
-
*
|
|
358
|
-
* <
|
|
856
|
+
* // Inline text styling
|
|
857
|
+
* <p>
|
|
858
|
+
* Regular text with <Span color="accent" weight="semibold">highlighted</Span> content
|
|
859
|
+
* </p>
|
|
860
|
+
*
|
|
861
|
+
* // Small inline details
|
|
862
|
+
* <Span variant="details" color="muted">
|
|
863
|
+
* Updated 5 minutes ago
|
|
864
|
+
* </Span>
|
|
865
|
+
*
|
|
866
|
+
* // Inline code reference
|
|
867
|
+
* <Span variant="code" className="bg-muted px-1 rounded">
|
|
868
|
+
* onClick
|
|
869
|
+
* </Span>
|
|
359
870
|
* ```
|
|
871
|
+
*
|
|
872
|
+
* @accessibility
|
|
873
|
+
* - Maintains inline text flow for screen readers
|
|
874
|
+
* - Preserves semantic meaning within larger text blocks
|
|
875
|
+
* - Does not interrupt document structure or navigation
|
|
360
876
|
*/
|
|
361
|
-
|
|
877
|
+
function Span(props: SpanProps) {
|
|
362
878
|
return <Typography as="span" {...props} />;
|
|
363
879
|
}
|
|
364
880
|
|
|
881
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
882
|
+
type CodeDocsProps = {
|
|
883
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
884
|
+
color?:
|
|
885
|
+
| "default"
|
|
886
|
+
| "muted"
|
|
887
|
+
| "accent"
|
|
888
|
+
| "destructive"
|
|
889
|
+
| "success"
|
|
890
|
+
| "warning";
|
|
891
|
+
/** Text alignment within the container @default "left" */
|
|
892
|
+
align?: "left" | "center" | "right" | "justify";
|
|
893
|
+
/** Text transformation for stylistic effects */
|
|
894
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
895
|
+
/** Font weight override for visual emphasis */
|
|
896
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
897
|
+
/** For label elements, the associated input ID for accessibility */
|
|
898
|
+
htmlFor?: string;
|
|
899
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
900
|
+
asChild?: boolean;
|
|
901
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
902
|
+
italic?: boolean;
|
|
903
|
+
/** Whether the text should have underline decoration @default false */
|
|
904
|
+
underline?: boolean;
|
|
905
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
906
|
+
strikethrough?: boolean;
|
|
907
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
908
|
+
truncate?: boolean;
|
|
909
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
910
|
+
srOnly?: boolean;
|
|
911
|
+
/** Additional CSS classes for custom styling */
|
|
912
|
+
className?: string;
|
|
913
|
+
/** Content to render within the typography element */
|
|
914
|
+
children?: React.ReactNode;
|
|
915
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
916
|
+
|
|
917
|
+
/** Props for Code component */
|
|
918
|
+
type CodeProps = Omit<TypographyProps, "as" | "variant">;
|
|
919
|
+
|
|
365
920
|
/**
|
|
366
|
-
* Code component for
|
|
921
|
+
* Code - Inline code component for technical content
|
|
922
|
+
*
|
|
923
|
+
* Semantic code element for inline code snippets, variable names, and technical references.
|
|
924
|
+
* Uses monospace font and "code" variant for clear distinction from regular text.
|
|
367
925
|
*
|
|
368
926
|
* @example
|
|
369
927
|
* ```tsx
|
|
370
|
-
*
|
|
371
|
-
* <Code
|
|
928
|
+
* // Inline code snippet
|
|
929
|
+
* <Code>const message = "Hello, world!";</Code>
|
|
930
|
+
*
|
|
931
|
+
* // Terminal command
|
|
932
|
+
* <Code color="muted">npm install @neynar/react</Code>
|
|
933
|
+
*
|
|
934
|
+
* // Variable reference
|
|
935
|
+
* <p>Set the <Code>API_KEY</Code> environment variable.</p>
|
|
936
|
+
*
|
|
937
|
+
* // With background styling
|
|
938
|
+
* <Code className="bg-muted px-2 py-1 rounded">
|
|
939
|
+
* function handleClick()
|
|
940
|
+
* </Code>
|
|
372
941
|
* ```
|
|
942
|
+
*
|
|
943
|
+
* @accessibility
|
|
944
|
+
* - Uses semantic code element for proper meaning
|
|
945
|
+
* - Monospace font aids in code readability
|
|
946
|
+
* - Screen readers understand this as technical content
|
|
947
|
+
* - Maintains proper inline behavior within text
|
|
948
|
+
*
|
|
949
|
+
* @see {@link Typography} Base typography component for multi-line code blocks
|
|
373
950
|
*/
|
|
374
|
-
|
|
951
|
+
function Code(props: CodeProps) {
|
|
375
952
|
return <Typography variant="code" as="code" {...props} />;
|
|
376
953
|
}
|
|
377
954
|
|
|
955
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
956
|
+
type SmallDocsProps = {
|
|
957
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
958
|
+
color?:
|
|
959
|
+
| "default"
|
|
960
|
+
| "muted"
|
|
961
|
+
| "accent"
|
|
962
|
+
| "destructive"
|
|
963
|
+
| "success"
|
|
964
|
+
| "warning";
|
|
965
|
+
/** Text alignment within the container @default "left" */
|
|
966
|
+
align?: "left" | "center" | "right" | "justify";
|
|
967
|
+
/** Text transformation for stylistic effects */
|
|
968
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
969
|
+
/** Font weight override for visual emphasis */
|
|
970
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
971
|
+
/** For label elements, the associated input ID for accessibility */
|
|
972
|
+
htmlFor?: string;
|
|
973
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
974
|
+
asChild?: boolean;
|
|
975
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
976
|
+
italic?: boolean;
|
|
977
|
+
/** Whether the text should have underline decoration @default false */
|
|
978
|
+
underline?: boolean;
|
|
979
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
980
|
+
strikethrough?: boolean;
|
|
981
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
982
|
+
truncate?: boolean;
|
|
983
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
984
|
+
srOnly?: boolean;
|
|
985
|
+
/** Additional CSS classes for custom styling */
|
|
986
|
+
className?: string;
|
|
987
|
+
/** Content to render within the typography element */
|
|
988
|
+
children?: React.ReactNode;
|
|
989
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
990
|
+
|
|
991
|
+
/** Props for Small component */
|
|
992
|
+
type SmallProps = Omit<TypographyProps, "as" | "variant">;
|
|
378
993
|
|
|
379
994
|
/**
|
|
380
|
-
* Small component for
|
|
995
|
+
* Small - Fine print component for supplementary information
|
|
996
|
+
*
|
|
997
|
+
* Semantic small element for fine print, disclaimers, timestamps, and supplementary information.
|
|
998
|
+
* Uses "microcopy" variant for reduced visual prominence while maintaining readability.
|
|
381
999
|
*
|
|
382
1000
|
* @example
|
|
383
1001
|
* ```tsx
|
|
384
|
-
*
|
|
385
|
-
* <Small
|
|
1002
|
+
* // Legal disclaimer
|
|
1003
|
+
* <Small>Terms and conditions apply. See details for more information.</Small>
|
|
1004
|
+
*
|
|
1005
|
+
* // Timestamp or metadata
|
|
1006
|
+
* <Small color="muted">Last updated 2 minutes ago</Small>
|
|
1007
|
+
*
|
|
1008
|
+
* // Copyright notice
|
|
1009
|
+
* <Small className="text-center">
|
|
1010
|
+
* © 2024 Neynar. All rights reserved.
|
|
1011
|
+
* </Small>
|
|
1012
|
+
*
|
|
1013
|
+
* // Form help text
|
|
1014
|
+
* <Small color="muted">Password must be at least 8 characters long.</Small>
|
|
386
1015
|
* ```
|
|
1016
|
+
*
|
|
1017
|
+
* @accessibility
|
|
1018
|
+
* - Uses semantic small element for proper meaning
|
|
1019
|
+
* - Indicates fine print or less important information
|
|
1020
|
+
* - Maintains sufficient contrast for readability
|
|
1021
|
+
* - Works well with form help text and descriptions
|
|
387
1022
|
*/
|
|
388
|
-
|
|
1023
|
+
function Small(props: SmallProps) {
|
|
389
1024
|
return <Typography variant="microcopy" as="small" {...props} />;
|
|
390
1025
|
}
|
|
391
1026
|
|
|
1027
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1028
|
+
type StrongDocsProps = {
|
|
1029
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
1030
|
+
color?:
|
|
1031
|
+
| "default"
|
|
1032
|
+
| "muted"
|
|
1033
|
+
| "accent"
|
|
1034
|
+
| "destructive"
|
|
1035
|
+
| "success"
|
|
1036
|
+
| "warning";
|
|
1037
|
+
/** Text alignment within the container @default "left" */
|
|
1038
|
+
align?: "left" | "center" | "right" | "justify";
|
|
1039
|
+
/** Text transformation for stylistic effects */
|
|
1040
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1041
|
+
/** Font weight override for visual emphasis */
|
|
1042
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1043
|
+
/** For label elements, the associated input ID for accessibility */
|
|
1044
|
+
htmlFor?: string;
|
|
1045
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1046
|
+
asChild?: boolean;
|
|
1047
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
1048
|
+
italic?: boolean;
|
|
1049
|
+
/** Whether the text should have underline decoration @default false */
|
|
1050
|
+
underline?: boolean;
|
|
1051
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
1052
|
+
strikethrough?: boolean;
|
|
1053
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1054
|
+
truncate?: boolean;
|
|
1055
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
1056
|
+
srOnly?: boolean;
|
|
1057
|
+
/** Additional CSS classes for custom styling */
|
|
1058
|
+
className?: string;
|
|
1059
|
+
/** Content to render within the typography element */
|
|
1060
|
+
children?: React.ReactNode;
|
|
1061
|
+
} & React.HTMLAttributes<HTMLElement>;
|
|
1062
|
+
|
|
1063
|
+
/** Props for Strong component */
|
|
1064
|
+
type StrongProps = Omit<TypographyProps, "as" | "variant">;
|
|
1065
|
+
|
|
392
1066
|
/**
|
|
393
|
-
* Strong component for
|
|
1067
|
+
* Strong - Emphasized text component for important content
|
|
1068
|
+
*
|
|
1069
|
+
* Semantic strong element for text that needs strong emphasis or importance.
|
|
1070
|
+
* Uses "bodyEmphasized" variant with strong semantic meaning.
|
|
394
1071
|
*
|
|
395
1072
|
* @example
|
|
396
1073
|
* ```tsx
|
|
397
|
-
*
|
|
398
|
-
* <Strong
|
|
1074
|
+
* // Important information
|
|
1075
|
+
* <Strong>Important: This action cannot be undone.</Strong>
|
|
1076
|
+
*
|
|
1077
|
+
* // Critical warning
|
|
1078
|
+
* <Strong color="destructive">Error: Invalid credentials provided.</Strong>
|
|
1079
|
+
*
|
|
1080
|
+
* // In body text
|
|
1081
|
+
* <p>
|
|
1082
|
+
* Make sure to <Strong>save your changes</Strong> before leaving the page.
|
|
1083
|
+
* </p>
|
|
1084
|
+
*
|
|
1085
|
+
* // Success message
|
|
1086
|
+
* <Strong color="success">Account created successfully!</Strong>
|
|
399
1087
|
* ```
|
|
1088
|
+
*
|
|
1089
|
+
* @accessibility
|
|
1090
|
+
* - Uses semantic strong element for emphasis
|
|
1091
|
+
* - Screen readers understand this as important content
|
|
1092
|
+
* - Provides semantic meaning beyond visual styling
|
|
1093
|
+
* - Maintains proper emphasis hierarchy in content
|
|
400
1094
|
*/
|
|
401
|
-
|
|
1095
|
+
function Strong(props: StrongProps) {
|
|
402
1096
|
return <Typography variant="bodyEmphasized" as="strong" {...props} />;
|
|
403
1097
|
}
|
|
404
1098
|
|
|
1099
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1100
|
+
type LeadDocsProps = {
|
|
1101
|
+
/** Color variant for semantic meaning and visual hierarchy @default "muted" */
|
|
1102
|
+
color?:
|
|
1103
|
+
| "default"
|
|
1104
|
+
| "muted"
|
|
1105
|
+
| "accent"
|
|
1106
|
+
| "destructive"
|
|
1107
|
+
| "success"
|
|
1108
|
+
| "warning";
|
|
1109
|
+
/** Text alignment within the container @default "left" */
|
|
1110
|
+
align?: "left" | "center" | "right" | "justify";
|
|
1111
|
+
/** Text transformation for stylistic effects */
|
|
1112
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1113
|
+
/** Font weight override for visual emphasis */
|
|
1114
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1115
|
+
/** For label elements, the associated input ID for accessibility */
|
|
1116
|
+
htmlFor?: string;
|
|
1117
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1118
|
+
asChild?: boolean;
|
|
1119
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
1120
|
+
italic?: boolean;
|
|
1121
|
+
/** Whether the text should have underline decoration @default false */
|
|
1122
|
+
underline?: boolean;
|
|
1123
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
1124
|
+
strikethrough?: boolean;
|
|
1125
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1126
|
+
truncate?: boolean;
|
|
1127
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
1128
|
+
srOnly?: boolean;
|
|
1129
|
+
/** Additional CSS classes for custom styling */
|
|
1130
|
+
className?: string;
|
|
1131
|
+
/** Content to render within the typography element */
|
|
1132
|
+
children?: React.ReactNode;
|
|
1133
|
+
} & React.HTMLAttributes<HTMLParagraphElement>;
|
|
1134
|
+
|
|
1135
|
+
/** Props for Lead component */
|
|
1136
|
+
type LeadProps = Omit<TypographyProps, "as" | "variant" | "color"> & {
|
|
1137
|
+
/** Color override for lead text @default "muted" */
|
|
1138
|
+
color?: TypographyProps["color"];
|
|
1139
|
+
};
|
|
1140
|
+
|
|
405
1141
|
/**
|
|
406
|
-
* Lead component for
|
|
1142
|
+
* Lead - Introductory paragraph component for article openings
|
|
1143
|
+
*
|
|
1144
|
+
* Lead paragraph for article introductions, page descriptions, and summary content.
|
|
1145
|
+
* Uses "subheading" variant with muted color for visual hierarchy.
|
|
407
1146
|
*
|
|
408
1147
|
* @example
|
|
409
1148
|
* ```tsx
|
|
410
|
-
*
|
|
1149
|
+
* // Article introduction
|
|
1150
|
+
* <Lead>
|
|
1151
|
+
* This comprehensive guide covers everything you need to know about
|
|
1152
|
+
* building modern web applications with React and TypeScript.
|
|
1153
|
+
* </Lead>
|
|
1154
|
+
*
|
|
1155
|
+
* // Page description
|
|
1156
|
+
* <Lead className="mb-8">
|
|
1157
|
+
* Discover powerful APIs and tools to build the next generation
|
|
1158
|
+
* of social applications on Farcaster.
|
|
1159
|
+
* </Lead>
|
|
1160
|
+
*
|
|
1161
|
+
* // With custom color
|
|
1162
|
+
* <Lead color="default">
|
|
1163
|
+
* This lead paragraph uses the default text color for more prominence.
|
|
1164
|
+
* </Lead>
|
|
411
1165
|
* ```
|
|
1166
|
+
*
|
|
1167
|
+
* @accessibility
|
|
1168
|
+
* - Provides clear content hierarchy for screen readers
|
|
1169
|
+
* - Larger text size improves readability for introductory content
|
|
1170
|
+
* - Maintains proper document flow and structure
|
|
412
1171
|
*/
|
|
413
|
-
|
|
414
|
-
return <Typography variant="subheading" as="p" color=
|
|
1172
|
+
function Lead({ color = "muted", ...props }: LeadProps) {
|
|
1173
|
+
return <Typography variant="subheading" as="p" color={color} {...props} />;
|
|
415
1174
|
}
|
|
416
1175
|
|
|
1176
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1177
|
+
type ADocsProps = {
|
|
1178
|
+
/** Typography variant that determines text size, weight, and line height @default "body" */
|
|
1179
|
+
variant?:
|
|
1180
|
+
| "heading"
|
|
1181
|
+
| "subheading"
|
|
1182
|
+
| "body"
|
|
1183
|
+
| "bodyEmphasized"
|
|
1184
|
+
| "details"
|
|
1185
|
+
| "field"
|
|
1186
|
+
| "code"
|
|
1187
|
+
| "microcopy"
|
|
1188
|
+
| "tableCell"
|
|
1189
|
+
| "tableHeader";
|
|
1190
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
1191
|
+
color?:
|
|
1192
|
+
| "default"
|
|
1193
|
+
| "muted"
|
|
1194
|
+
| "accent"
|
|
1195
|
+
| "destructive"
|
|
1196
|
+
| "success"
|
|
1197
|
+
| "warning";
|
|
1198
|
+
/** Text alignment within the container @default "left" */
|
|
1199
|
+
align?: "left" | "center" | "right" | "justify";
|
|
1200
|
+
/** Text transformation for stylistic effects */
|
|
1201
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1202
|
+
/** Font weight override for visual emphasis */
|
|
1203
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1204
|
+
/** For label elements, the associated input ID for accessibility */
|
|
1205
|
+
htmlFor?: string;
|
|
1206
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1207
|
+
asChild?: boolean;
|
|
1208
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
1209
|
+
italic?: boolean;
|
|
1210
|
+
/** Whether the text should have underline decoration @default false */
|
|
1211
|
+
underline?: boolean;
|
|
1212
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
1213
|
+
strikethrough?: boolean;
|
|
1214
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1215
|
+
truncate?: boolean;
|
|
1216
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
1217
|
+
srOnly?: boolean;
|
|
1218
|
+
/** Link destination URL */
|
|
1219
|
+
href?: string;
|
|
1220
|
+
/** Additional CSS classes for custom styling */
|
|
1221
|
+
className?: string;
|
|
1222
|
+
/** Content to render within the typography element */
|
|
1223
|
+
children?: React.ReactNode;
|
|
1224
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
1225
|
+
|
|
1226
|
+
/** Props for A anchor component */
|
|
1227
|
+
type AProps = Omit<TypographyProps, "as" | "variant"> & {
|
|
1228
|
+
/** Link destination URL */
|
|
1229
|
+
href?: string;
|
|
1230
|
+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
1231
|
+
|
|
417
1232
|
/**
|
|
418
|
-
* Anchor
|
|
1233
|
+
* A - Anchor component for interactive text links
|
|
1234
|
+
*
|
|
1235
|
+
* Semantic anchor element for links with built-in hover states and accessibility features.
|
|
1236
|
+
* Uses "body" variant with underline and smooth color transitions.
|
|
419
1237
|
*
|
|
420
1238
|
* @example
|
|
421
1239
|
* ```tsx
|
|
422
|
-
*
|
|
423
|
-
* <A href="
|
|
424
|
-
*
|
|
1240
|
+
* // External link
|
|
1241
|
+
* <A href="https://neynar.com" target="_blank" rel="noopener noreferrer">
|
|
1242
|
+
* Visit Neynar Website
|
|
1243
|
+
* </A>
|
|
1244
|
+
*
|
|
1245
|
+
* // Internal navigation
|
|
1246
|
+
* <A href="/dashboard" color="accent">
|
|
1247
|
+
* Go to Dashboard
|
|
1248
|
+
* </A>
|
|
1249
|
+
*
|
|
1250
|
+
* // Composition with Next.js Link
|
|
1251
|
+
* <A asChild>
|
|
1252
|
+
* <Link href="/about">
|
|
1253
|
+
* Learn More About Us
|
|
1254
|
+
* </Link>
|
|
1255
|
+
* </A>
|
|
1256
|
+
*
|
|
1257
|
+
* // In paragraph text
|
|
1258
|
+
* <P>
|
|
1259
|
+
* For more information, <A href="/docs">check our documentation</A> or
|
|
1260
|
+
* contact support.
|
|
1261
|
+
* </P>
|
|
425
1262
|
* ```
|
|
1263
|
+
*
|
|
1264
|
+
* @accessibility
|
|
1265
|
+
* - Uses semantic anchor element for proper link behavior
|
|
1266
|
+
* - Includes hover and focus states for interaction feedback
|
|
1267
|
+
* - Supports keyboard navigation (Enter key activation)
|
|
1268
|
+
* - Maintains color contrast requirements for links
|
|
1269
|
+
* - Works with screen reader link navigation modes
|
|
1270
|
+
* - Supports external link indicators when needed
|
|
1271
|
+
*
|
|
1272
|
+
* @see {@link Typography} Base typography component with asChild
|
|
426
1273
|
*/
|
|
427
|
-
|
|
428
|
-
href,
|
|
429
|
-
asChild = false,
|
|
430
|
-
className,
|
|
431
|
-
...props
|
|
432
|
-
}: Omit<TypographyProps, "as" | "variant"> & React.AnchorHTMLAttributes<HTMLAnchorElement>) {
|
|
1274
|
+
function A({ href, asChild = false, className, ...props }: AProps) {
|
|
433
1275
|
return (
|
|
434
1276
|
<Typography
|
|
435
1277
|
variant="body"
|
|
436
1278
|
as={asChild ? undefined : "a"}
|
|
437
1279
|
asChild={asChild}
|
|
438
|
-
className={cn(
|
|
1280
|
+
className={cn(
|
|
1281
|
+
"underline underline-offset-2 hover:text-primary transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",
|
|
1282
|
+
className,
|
|
1283
|
+
)}
|
|
439
1284
|
{...(href ? { href } : {})}
|
|
440
1285
|
{...props}
|
|
441
1286
|
/>
|
|
442
1287
|
);
|
|
443
1288
|
}
|
|
444
1289
|
|
|
1290
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
1291
|
+
type BlockquoteDocsProps = {
|
|
1292
|
+
/** Color variant for semantic meaning and visual hierarchy @default "default" */
|
|
1293
|
+
color?:
|
|
1294
|
+
| "default"
|
|
1295
|
+
| "muted"
|
|
1296
|
+
| "accent"
|
|
1297
|
+
| "destructive"
|
|
1298
|
+
| "success"
|
|
1299
|
+
| "warning";
|
|
1300
|
+
/** Text alignment within the container @default "left" */
|
|
1301
|
+
align?: "left" | "center" | "right" | "justify";
|
|
1302
|
+
/** Text transformation for stylistic effects */
|
|
1303
|
+
transform?: "uppercase" | "lowercase" | "capitalize";
|
|
1304
|
+
/** Font weight override for visual emphasis */
|
|
1305
|
+
weight?: "normal" | "medium" | "semibold" | "bold";
|
|
1306
|
+
/** For label elements, the associated input ID for accessibility */
|
|
1307
|
+
htmlFor?: string;
|
|
1308
|
+
/** Whether to render as a Slot component for composition patterns @default false */
|
|
1309
|
+
asChild?: boolean;
|
|
1310
|
+
/** Whether the text should be rendered in italic style @default false */
|
|
1311
|
+
italic?: boolean;
|
|
1312
|
+
/** Whether the text should have underline decoration @default false */
|
|
1313
|
+
underline?: boolean;
|
|
1314
|
+
/** Whether the text should have strikethrough decoration @default false */
|
|
1315
|
+
strikethrough?: boolean;
|
|
1316
|
+
/** Whether text should be truncated with ellipsis on overflow @default false */
|
|
1317
|
+
truncate?: boolean;
|
|
1318
|
+
/** Hide visually but keep accessible to screen readers @default false */
|
|
1319
|
+
srOnly?: boolean;
|
|
1320
|
+
/** Additional CSS classes for custom styling */
|
|
1321
|
+
className?: string;
|
|
1322
|
+
/** Content to render within the typography element */
|
|
1323
|
+
children?: React.ReactNode;
|
|
1324
|
+
} & React.HTMLAttributes<HTMLQuoteElement>;
|
|
1325
|
+
|
|
1326
|
+
/** Props for Blockquote component */
|
|
1327
|
+
type BlockquoteProps = Omit<TypographyProps, "as" | "variant">;
|
|
1328
|
+
|
|
445
1329
|
/**
|
|
446
|
-
* Blockquote component for
|
|
1330
|
+
* Blockquote - Quoted text component for citations and excerpts
|
|
1331
|
+
*
|
|
1332
|
+
* Semantic blockquote element for extended quotations, testimonials, and excerpts.
|
|
1333
|
+
* Features italic styling and left border for visual distinction.
|
|
447
1334
|
*
|
|
448
1335
|
* @example
|
|
449
1336
|
* ```tsx
|
|
450
|
-
*
|
|
1337
|
+
* // Simple quote
|
|
1338
|
+
* <Blockquote>
|
|
1339
|
+
* "The best way to predict the future is to invent it."
|
|
1340
|
+
* </Blockquote>
|
|
1341
|
+
*
|
|
1342
|
+
* // With attribution
|
|
1343
|
+
* <div>
|
|
1344
|
+
* <Blockquote className="mb-2">
|
|
1345
|
+
* "Building great products requires deep understanding of user needs
|
|
1346
|
+
* and technical excellence in equal measure."
|
|
1347
|
+
* </Blockquote>
|
|
1348
|
+
* <Small>— Product Engineering Team</Small>
|
|
1349
|
+
* </div>
|
|
1350
|
+
*
|
|
1351
|
+
* // Customer testimonial
|
|
1352
|
+
* <Blockquote color="muted" className="bg-muted/50 p-4 rounded-lg">
|
|
1353
|
+
* "Neynar's APIs have transformed how we build social features.
|
|
1354
|
+
* The developer experience is exceptional."
|
|
1355
|
+
* </Blockquote>
|
|
451
1356
|
* ```
|
|
1357
|
+
*
|
|
1358
|
+
* @accessibility
|
|
1359
|
+
* - Uses semantic blockquote element for proper quotation meaning
|
|
1360
|
+
* - Screen readers understand this as quoted content
|
|
1361
|
+
* - Maintains proper text flow and readability
|
|
1362
|
+
* - Supports citation attribution when paired with cite element
|
|
1363
|
+
*
|
|
1364
|
+
* @see {@link Small} For attribution text
|
|
1365
|
+
* @see {@link Typography} Base typography component
|
|
452
1366
|
*/
|
|
453
|
-
|
|
1367
|
+
function Blockquote({ className, ...props }: BlockquoteProps) {
|
|
454
1368
|
return (
|
|
455
1369
|
<Typography
|
|
456
1370
|
variant="body"
|
|
457
1371
|
as="blockquote"
|
|
458
1372
|
italic
|
|
459
|
-
className="border-l-4 border-border pl-4"
|
|
1373
|
+
className={cn("border-l-4 border-border pl-4 my-2", className)}
|
|
460
1374
|
{...props}
|
|
461
1375
|
/>
|
|
462
1376
|
);
|
|
463
1377
|
}
|
|
464
1378
|
|
|
1379
|
+
export {
|
|
1380
|
+
Typography,
|
|
1381
|
+
H1,
|
|
1382
|
+
H2,
|
|
1383
|
+
H3,
|
|
1384
|
+
H4,
|
|
1385
|
+
H5,
|
|
1386
|
+
H6,
|
|
1387
|
+
P,
|
|
1388
|
+
Span,
|
|
1389
|
+
Code,
|
|
1390
|
+
Small,
|
|
1391
|
+
Strong,
|
|
1392
|
+
Lead,
|
|
1393
|
+
A,
|
|
1394
|
+
Blockquote,
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
export type {
|
|
1398
|
+
TypographyProps,
|
|
1399
|
+
H1Props,
|
|
1400
|
+
H2Props,
|
|
1401
|
+
H3Props,
|
|
1402
|
+
H4Props,
|
|
1403
|
+
H5Props,
|
|
1404
|
+
H6Props,
|
|
1405
|
+
PProps,
|
|
1406
|
+
SpanProps,
|
|
1407
|
+
CodeProps,
|
|
1408
|
+
SmallProps,
|
|
1409
|
+
StrongProps,
|
|
1410
|
+
LeadProps,
|
|
1411
|
+
AProps,
|
|
1412
|
+
BlockquoteProps,
|
|
1413
|
+
};
|
|
1414
|
+
|
|
465
1415
|
/**
|
|
466
|
-
* Type export for
|
|
1416
|
+
* Type export for CVA variant props
|
|
467
1417
|
*/
|
|
468
1418
|
export type { VariantProps as TypographyVariantProps } from "class-variance-authority";
|