@brightlocal/ui-components 0.4.1 → 0.5.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.
- package/README.md +2 -1
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert.cjs +1 -1
- package/dist/alert.js +64 -64
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.js +38 -38
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +23 -23
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +34 -34
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +58 -57
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +19 -40
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.js +1 -1
- package/dist/chart.cjs +2 -2
- package/dist/chart.d.ts +3 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +21 -21
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +3 -3
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +39 -42
- package/dist/command.cjs +1 -1
- package/dist/command.js +35 -35
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.js +7 -7
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +22 -22
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +40 -45
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +38 -30
- package/dist/header.d.ts.map +1 -1
- package/dist/header.js +1 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +334 -319
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +18 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +10 -10
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +6 -6
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +16 -16
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +1 -8
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +23 -11
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +12 -12
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +15 -15
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +3 -3
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +46 -50
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +19 -19
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +7 -8
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +28 -28
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +10 -12
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +9 -9
- package/dist/typography.cjs +1 -0
- package/dist/typography.d.ts +176 -0
- package/dist/typography.d.ts.map +1 -0
- package/dist/typography.js +331 -0
- package/package.json +2 -2
- package/src/blocks/data-table.tsx +10 -10
- package/src/blocks/sidebar.tsx +13 -13
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert.tsx +10 -10
- package/src/components/breadcrumb.tsx +3 -3
- package/src/components/button.tsx +7 -7
- package/src/components/calendar.tsx +4 -22
- package/src/components/centred-layout.tsx +1 -1
- package/src/components/chart.tsx +5 -5
- package/src/components/checkbox.tsx +3 -3
- package/src/components/combobox.tsx +4 -8
- package/src/components/command.tsx +5 -5
- package/src/components/context-menu.tsx +2 -2
- package/src/components/date-picker.tsx +1 -1
- package/src/components/dialog.tsx +3 -3
- package/src/components/dropdown-menu.tsx +6 -11
- package/src/components/field.tsx +27 -19
- package/src/components/header.tsx +1 -4
- package/src/components/input-chip.tsx +1 -4
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +3 -3
- package/src/components/input-password.tsx +2 -10
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +1 -1
- package/src/components/link.tsx +1 -5
- package/src/components/logo.tsx +11 -5
- package/src/components/menubar.tsx +2 -2
- package/src/components/pagination.tsx +4 -8
- package/src/components/radio-group.tsx +2 -2
- package/src/components/select.tsx +8 -12
- package/src/components/sheet.tsx +5 -5
- package/src/components/sonner.tsx +4 -5
- package/src/components/switch.tsx +1 -1
- package/src/components/tabs.tsx +0 -2
- package/src/components/toggle.tsx +1 -1
- package/src/components/typography.tsx +678 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Common props shared by all typography components.
|
|
9
|
+
* Provides consistent testing, analytics, and composition patterns.
|
|
10
|
+
*/
|
|
11
|
+
interface TypographyBaseProps {
|
|
12
|
+
/**
|
|
13
|
+
* Render as a different element using Radix Slot pattern.
|
|
14
|
+
* When true, merges props onto the child element.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
asChild?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Data hook for automated testing (REQUIRED).
|
|
20
|
+
* Used to identify component in tests and E2E automation.
|
|
21
|
+
* @example "page-title", "section-heading"
|
|
22
|
+
*/
|
|
23
|
+
dataHook: string;
|
|
24
|
+
/**
|
|
25
|
+
* Tracking element identifier for analytics.
|
|
26
|
+
* Defaults to component name if not provided.
|
|
27
|
+
*/
|
|
28
|
+
trackingEl?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Tracking label for analytics context.
|
|
31
|
+
* Additional context for tracking events.
|
|
32
|
+
*/
|
|
33
|
+
trackingLabel?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// H1 - Main page heading
|
|
38
|
+
// =============================================================================
|
|
39
|
+
const h1Variants = cva(
|
|
40
|
+
"self-stretch text-foreground text-4xl font-extrabold font-sans leading-10 lg:text-5xl lg:font-medium lg:font-display lg:leading-12"
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Props for the TypographyH1 component.
|
|
45
|
+
* Extends native h1 props with design system tracking attributes.
|
|
46
|
+
*/
|
|
47
|
+
interface TypographyH1Props
|
|
48
|
+
extends React.ComponentProps<"h1">, TypographyBaseProps {}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Main page heading component (h1).
|
|
52
|
+
* Used for the primary title on a page. Responsive sizing with display font on larger screens.
|
|
53
|
+
*/
|
|
54
|
+
const TypographyH1 = React.forwardRef<HTMLHeadingElement, TypographyH1Props>(
|
|
55
|
+
(
|
|
56
|
+
{
|
|
57
|
+
className,
|
|
58
|
+
asChild = false,
|
|
59
|
+
dataHook,
|
|
60
|
+
trackingEl,
|
|
61
|
+
trackingLabel,
|
|
62
|
+
...props
|
|
63
|
+
},
|
|
64
|
+
ref
|
|
65
|
+
) => {
|
|
66
|
+
const Comp = asChild ? Slot : "h1";
|
|
67
|
+
return (
|
|
68
|
+
<Comp
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn(h1Variants(), className)}
|
|
71
|
+
data-hook={dataHook}
|
|
72
|
+
data-slot="typography-h1"
|
|
73
|
+
data-tracking-el={trackingEl}
|
|
74
|
+
data-tracking-label={trackingLabel}
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
TypographyH1.displayName = "TypographyH1";
|
|
81
|
+
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// H2 - Section heading
|
|
84
|
+
// =============================================================================
|
|
85
|
+
const h2Variants = cva(
|
|
86
|
+
"text-foreground text-3xl font-semibold font-sans leading-9"
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Props for the TypographyH2 component.
|
|
91
|
+
* Extends native h2 props with design system tracking attributes.
|
|
92
|
+
*/
|
|
93
|
+
interface TypographyH2Props
|
|
94
|
+
extends React.ComponentProps<"h2">, TypographyBaseProps {}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Section heading component (h2).
|
|
98
|
+
* Used for major section titles within a page.
|
|
99
|
+
*/
|
|
100
|
+
const TypographyH2 = React.forwardRef<HTMLHeadingElement, TypographyH2Props>(
|
|
101
|
+
(
|
|
102
|
+
{
|
|
103
|
+
className,
|
|
104
|
+
asChild = false,
|
|
105
|
+
dataHook,
|
|
106
|
+
trackingEl,
|
|
107
|
+
trackingLabel,
|
|
108
|
+
...props
|
|
109
|
+
},
|
|
110
|
+
ref
|
|
111
|
+
) => {
|
|
112
|
+
const Comp = asChild ? Slot : "h2";
|
|
113
|
+
return (
|
|
114
|
+
<Comp
|
|
115
|
+
ref={ref}
|
|
116
|
+
className={cn(h2Variants(), className)}
|
|
117
|
+
data-hook={dataHook}
|
|
118
|
+
data-slot="typography-h2"
|
|
119
|
+
data-tracking-el={trackingEl}
|
|
120
|
+
data-tracking-label={trackingLabel}
|
|
121
|
+
{...props}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
TypographyH2.displayName = "TypographyH2";
|
|
127
|
+
|
|
128
|
+
// =============================================================================
|
|
129
|
+
// H3 - Subsection heading
|
|
130
|
+
// =============================================================================
|
|
131
|
+
const h3Variants = cva(
|
|
132
|
+
"text-foreground text-2xl font-semibold font-sans leading-8"
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Props for the TypographyH3 component.
|
|
137
|
+
* Extends native h3 props with design system tracking attributes.
|
|
138
|
+
*/
|
|
139
|
+
interface TypographyH3Props
|
|
140
|
+
extends React.ComponentProps<"h3">, TypographyBaseProps {}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Subsection heading component (h3).
|
|
144
|
+
* Used for subsections within a major section.
|
|
145
|
+
*/
|
|
146
|
+
const TypographyH3 = React.forwardRef<HTMLHeadingElement, TypographyH3Props>(
|
|
147
|
+
(
|
|
148
|
+
{
|
|
149
|
+
className,
|
|
150
|
+
asChild = false,
|
|
151
|
+
dataHook,
|
|
152
|
+
trackingEl,
|
|
153
|
+
trackingLabel,
|
|
154
|
+
...props
|
|
155
|
+
},
|
|
156
|
+
ref
|
|
157
|
+
) => {
|
|
158
|
+
const Comp = asChild ? Slot : "h3";
|
|
159
|
+
return (
|
|
160
|
+
<Comp
|
|
161
|
+
ref={ref}
|
|
162
|
+
className={cn(h3Variants(), className)}
|
|
163
|
+
data-hook={dataHook}
|
|
164
|
+
data-slot="typography-h3"
|
|
165
|
+
data-tracking-el={trackingEl}
|
|
166
|
+
data-tracking-label={trackingLabel}
|
|
167
|
+
{...props}
|
|
168
|
+
/>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
TypographyH3.displayName = "TypographyH3";
|
|
173
|
+
|
|
174
|
+
// =============================================================================
|
|
175
|
+
// H4 - Minor heading
|
|
176
|
+
// =============================================================================
|
|
177
|
+
const h4Variants = cva(
|
|
178
|
+
"text-foreground text-xl font-semibold font-sans leading-7"
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Props for the TypographyH4 component.
|
|
183
|
+
* Extends native h4 props with design system tracking attributes.
|
|
184
|
+
*/
|
|
185
|
+
interface TypographyH4Props
|
|
186
|
+
extends React.ComponentProps<"h4">, TypographyBaseProps {}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Minor heading component (h4).
|
|
190
|
+
* Used for smaller section headings and card titles.
|
|
191
|
+
*/
|
|
192
|
+
const TypographyH4 = React.forwardRef<HTMLHeadingElement, TypographyH4Props>(
|
|
193
|
+
(
|
|
194
|
+
{
|
|
195
|
+
className,
|
|
196
|
+
asChild = false,
|
|
197
|
+
dataHook,
|
|
198
|
+
trackingEl,
|
|
199
|
+
trackingLabel,
|
|
200
|
+
...props
|
|
201
|
+
},
|
|
202
|
+
ref
|
|
203
|
+
) => {
|
|
204
|
+
const Comp = asChild ? Slot : "h4";
|
|
205
|
+
return (
|
|
206
|
+
<Comp
|
|
207
|
+
ref={ref}
|
|
208
|
+
className={cn(h4Variants(), className)}
|
|
209
|
+
data-hook={dataHook}
|
|
210
|
+
data-slot="typography-h4"
|
|
211
|
+
data-tracking-el={trackingEl}
|
|
212
|
+
data-tracking-label={trackingLabel}
|
|
213
|
+
{...props}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
TypographyH4.displayName = "TypographyH4";
|
|
219
|
+
|
|
220
|
+
// =============================================================================
|
|
221
|
+
// Paragraph
|
|
222
|
+
// =============================================================================
|
|
223
|
+
const pVariants = cva("text-foreground text-base font-normal font-sans");
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Props for the TypographyP component.
|
|
227
|
+
* Extends native p props with design system tracking attributes.
|
|
228
|
+
*/
|
|
229
|
+
interface TypographyPProps
|
|
230
|
+
extends React.ComponentProps<"p">, TypographyBaseProps {}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Paragraph text component (p).
|
|
234
|
+
* Used for body text and general content.
|
|
235
|
+
*/
|
|
236
|
+
const TypographyP = React.forwardRef<HTMLParagraphElement, TypographyPProps>(
|
|
237
|
+
(
|
|
238
|
+
{
|
|
239
|
+
className,
|
|
240
|
+
asChild = false,
|
|
241
|
+
dataHook,
|
|
242
|
+
trackingEl,
|
|
243
|
+
trackingLabel,
|
|
244
|
+
...props
|
|
245
|
+
},
|
|
246
|
+
ref
|
|
247
|
+
) => {
|
|
248
|
+
const Comp = asChild ? Slot : "p";
|
|
249
|
+
return (
|
|
250
|
+
<Comp
|
|
251
|
+
ref={ref}
|
|
252
|
+
className={cn(pVariants(), className)}
|
|
253
|
+
data-hook={dataHook}
|
|
254
|
+
data-slot="typography-p"
|
|
255
|
+
data-tracking-el={trackingEl}
|
|
256
|
+
data-tracking-label={trackingLabel}
|
|
257
|
+
{...props}
|
|
258
|
+
/>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
TypographyP.displayName = "TypographyP";
|
|
263
|
+
|
|
264
|
+
// =============================================================================
|
|
265
|
+
// Blockquote
|
|
266
|
+
// =============================================================================
|
|
267
|
+
const blockquoteVariants = cva(
|
|
268
|
+
"mt-6 border-l-2 pl-6 text-foreground text-base font-normal font-sans"
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Props for the TypographyBlockquote component.
|
|
273
|
+
* Extends native blockquote props with design system tracking attributes.
|
|
274
|
+
*/
|
|
275
|
+
interface TypographyBlockquoteProps
|
|
276
|
+
extends React.ComponentProps<"blockquote">, TypographyBaseProps {}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Blockquote component for quoted content.
|
|
280
|
+
* Displays with a left border accent for visual distinction.
|
|
281
|
+
*/
|
|
282
|
+
const TypographyBlockquote = React.forwardRef<
|
|
283
|
+
HTMLQuoteElement,
|
|
284
|
+
TypographyBlockquoteProps
|
|
285
|
+
>(
|
|
286
|
+
(
|
|
287
|
+
{
|
|
288
|
+
className,
|
|
289
|
+
asChild = false,
|
|
290
|
+
dataHook,
|
|
291
|
+
trackingEl,
|
|
292
|
+
trackingLabel,
|
|
293
|
+
...props
|
|
294
|
+
},
|
|
295
|
+
ref
|
|
296
|
+
) => {
|
|
297
|
+
const Comp = asChild ? Slot : "blockquote";
|
|
298
|
+
return (
|
|
299
|
+
<Comp
|
|
300
|
+
ref={ref}
|
|
301
|
+
className={cn(blockquoteVariants(), className)}
|
|
302
|
+
data-hook={dataHook}
|
|
303
|
+
data-slot="typography-blockquote"
|
|
304
|
+
data-tracking-el={trackingEl}
|
|
305
|
+
data-tracking-label={trackingLabel}
|
|
306
|
+
{...props}
|
|
307
|
+
/>
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
);
|
|
311
|
+
TypographyBlockquote.displayName = "TypographyBlockquote";
|
|
312
|
+
|
|
313
|
+
// =============================================================================
|
|
314
|
+
// Unordered List
|
|
315
|
+
// =============================================================================
|
|
316
|
+
const listVariants = cva(
|
|
317
|
+
"self-stretch ml-6 list-disc text-foreground text-base font-normal font-sans leading-6"
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Props for the TypographyList component.
|
|
322
|
+
* Extends native ul props with design system tracking attributes.
|
|
323
|
+
*/
|
|
324
|
+
interface TypographyListProps
|
|
325
|
+
extends React.ComponentProps<"ul">, TypographyBaseProps {}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Unordered list component (ul).
|
|
329
|
+
* Used for bullet-point lists with consistent styling.
|
|
330
|
+
*/
|
|
331
|
+
const TypographyList = React.forwardRef<HTMLUListElement, TypographyListProps>(
|
|
332
|
+
(
|
|
333
|
+
{
|
|
334
|
+
className,
|
|
335
|
+
asChild = false,
|
|
336
|
+
dataHook,
|
|
337
|
+
trackingEl,
|
|
338
|
+
trackingLabel,
|
|
339
|
+
...props
|
|
340
|
+
},
|
|
341
|
+
ref
|
|
342
|
+
) => {
|
|
343
|
+
const Comp = asChild ? Slot : "ul";
|
|
344
|
+
return (
|
|
345
|
+
<Comp
|
|
346
|
+
ref={ref}
|
|
347
|
+
className={cn(listVariants(), className)}
|
|
348
|
+
data-hook={dataHook}
|
|
349
|
+
data-slot="typography-list"
|
|
350
|
+
data-tracking-el={trackingEl}
|
|
351
|
+
data-tracking-label={trackingLabel}
|
|
352
|
+
{...props}
|
|
353
|
+
/>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
);
|
|
357
|
+
TypographyList.displayName = "TypographyList";
|
|
358
|
+
|
|
359
|
+
// =============================================================================
|
|
360
|
+
// Inline Code
|
|
361
|
+
// =============================================================================
|
|
362
|
+
const inlineCodeVariants = cva(
|
|
363
|
+
"inline-flex justify-center items-center gap-2 bg-muted rounded-md px-[4.80px] py-[3.20px] text-foreground text-sm font-normal font-mono leading-5"
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Props for the TypographyInlineCode component.
|
|
368
|
+
* Extends native code props with design system tracking attributes.
|
|
369
|
+
*/
|
|
370
|
+
interface TypographyInlineCodeProps
|
|
371
|
+
extends React.ComponentProps<"code">, TypographyBaseProps {}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Inline code component for code snippets within text.
|
|
375
|
+
* Displays with monospace font and muted background.
|
|
376
|
+
*/
|
|
377
|
+
const TypographyInlineCode = React.forwardRef<
|
|
378
|
+
HTMLElement,
|
|
379
|
+
TypographyInlineCodeProps
|
|
380
|
+
>(
|
|
381
|
+
(
|
|
382
|
+
{
|
|
383
|
+
className,
|
|
384
|
+
asChild = false,
|
|
385
|
+
dataHook,
|
|
386
|
+
trackingEl,
|
|
387
|
+
trackingLabel,
|
|
388
|
+
...props
|
|
389
|
+
},
|
|
390
|
+
ref
|
|
391
|
+
) => {
|
|
392
|
+
const Comp = asChild ? Slot : "code";
|
|
393
|
+
return (
|
|
394
|
+
<Comp
|
|
395
|
+
ref={ref}
|
|
396
|
+
className={cn(inlineCodeVariants(), className)}
|
|
397
|
+
data-hook={dataHook}
|
|
398
|
+
data-slot="typography-inline-code"
|
|
399
|
+
data-tracking-el={trackingEl}
|
|
400
|
+
data-tracking-label={trackingLabel}
|
|
401
|
+
{...props}
|
|
402
|
+
/>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
);
|
|
406
|
+
TypographyInlineCode.displayName = "TypographyInlineCode";
|
|
407
|
+
|
|
408
|
+
// =============================================================================
|
|
409
|
+
// Code Block
|
|
410
|
+
// =============================================================================
|
|
411
|
+
const codeVariants = cva(
|
|
412
|
+
"block w-full p-4 bg-zinc-900 rounded-lg border border-border text-white/50 text-base font-normal font-mono leading-6 overflow-x-auto"
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Props for the TypographyCode component.
|
|
417
|
+
* Extends native pre props with design system tracking attributes.
|
|
418
|
+
*/
|
|
419
|
+
interface TypographyCodeProps
|
|
420
|
+
extends React.ComponentProps<"pre">, TypographyBaseProps {}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Code block component for multi-line code snippets.
|
|
424
|
+
* Displays with dark background, monospace font, and horizontal scroll.
|
|
425
|
+
*/
|
|
426
|
+
const TypographyCode = React.forwardRef<HTMLPreElement, TypographyCodeProps>(
|
|
427
|
+
(
|
|
428
|
+
{
|
|
429
|
+
className,
|
|
430
|
+
asChild = false,
|
|
431
|
+
dataHook,
|
|
432
|
+
trackingEl,
|
|
433
|
+
trackingLabel,
|
|
434
|
+
...props
|
|
435
|
+
},
|
|
436
|
+
ref
|
|
437
|
+
) => {
|
|
438
|
+
const Comp = asChild ? Slot : "pre";
|
|
439
|
+
return (
|
|
440
|
+
<Comp
|
|
441
|
+
ref={ref}
|
|
442
|
+
className={cn(codeVariants(), className)}
|
|
443
|
+
data-hook={dataHook}
|
|
444
|
+
data-slot="typography-code"
|
|
445
|
+
data-tracking-el={trackingEl}
|
|
446
|
+
data-tracking-label={trackingLabel}
|
|
447
|
+
{...props}
|
|
448
|
+
/>
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
TypographyCode.displayName = "TypographyCode";
|
|
453
|
+
|
|
454
|
+
// =============================================================================
|
|
455
|
+
// Lead - Larger introductory text
|
|
456
|
+
// =============================================================================
|
|
457
|
+
const leadVariants = cva(
|
|
458
|
+
"text-muted-foreground text-xl font-normal font-sans leading-7"
|
|
459
|
+
);
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Props for the TypographyLead component.
|
|
463
|
+
* Extends native p props with design system tracking attributes.
|
|
464
|
+
*/
|
|
465
|
+
interface TypographyLeadProps
|
|
466
|
+
extends React.ComponentProps<"p">, TypographyBaseProps {}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Lead paragraph component for introductory text.
|
|
470
|
+
* Displays larger, muted text for page introductions and summaries.
|
|
471
|
+
*/
|
|
472
|
+
const TypographyLead = React.forwardRef<
|
|
473
|
+
HTMLParagraphElement,
|
|
474
|
+
TypographyLeadProps
|
|
475
|
+
>(
|
|
476
|
+
(
|
|
477
|
+
{
|
|
478
|
+
className,
|
|
479
|
+
asChild = false,
|
|
480
|
+
dataHook,
|
|
481
|
+
trackingEl,
|
|
482
|
+
trackingLabel,
|
|
483
|
+
...props
|
|
484
|
+
},
|
|
485
|
+
ref
|
|
486
|
+
) => {
|
|
487
|
+
const Comp = asChild ? Slot : "p";
|
|
488
|
+
return (
|
|
489
|
+
<Comp
|
|
490
|
+
ref={ref}
|
|
491
|
+
className={cn(leadVariants(), className)}
|
|
492
|
+
data-hook={dataHook}
|
|
493
|
+
data-slot="typography-lead"
|
|
494
|
+
data-tracking-el={trackingEl}
|
|
495
|
+
data-tracking-label={trackingLabel}
|
|
496
|
+
{...props}
|
|
497
|
+
/>
|
|
498
|
+
);
|
|
499
|
+
}
|
|
500
|
+
);
|
|
501
|
+
TypographyLead.displayName = "TypographyLead";
|
|
502
|
+
|
|
503
|
+
// =============================================================================
|
|
504
|
+
// Large - Bold larger text
|
|
505
|
+
// =============================================================================
|
|
506
|
+
const largeVariants = cva(
|
|
507
|
+
"text-foreground text-lg font-semibold font-sans leading-7"
|
|
508
|
+
);
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Props for the TypographyLarge component.
|
|
512
|
+
* Extends native div props with design system tracking attributes.
|
|
513
|
+
*/
|
|
514
|
+
interface TypographyLargeProps
|
|
515
|
+
extends React.ComponentProps<"div">, TypographyBaseProps {}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Large text component for emphasized content.
|
|
519
|
+
* Displays larger, semibold text for callouts and highlights.
|
|
520
|
+
*/
|
|
521
|
+
const TypographyLarge = React.forwardRef<HTMLDivElement, TypographyLargeProps>(
|
|
522
|
+
(
|
|
523
|
+
{
|
|
524
|
+
className,
|
|
525
|
+
asChild = false,
|
|
526
|
+
dataHook,
|
|
527
|
+
trackingEl,
|
|
528
|
+
trackingLabel,
|
|
529
|
+
...props
|
|
530
|
+
},
|
|
531
|
+
ref
|
|
532
|
+
) => {
|
|
533
|
+
const Comp = asChild ? Slot : "div";
|
|
534
|
+
return (
|
|
535
|
+
<Comp
|
|
536
|
+
ref={ref}
|
|
537
|
+
className={cn(largeVariants(), className)}
|
|
538
|
+
data-hook={dataHook}
|
|
539
|
+
data-slot="typography-large"
|
|
540
|
+
data-tracking-el={trackingEl}
|
|
541
|
+
data-tracking-label={trackingLabel}
|
|
542
|
+
{...props}
|
|
543
|
+
/>
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
);
|
|
547
|
+
TypographyLarge.displayName = "TypographyLarge";
|
|
548
|
+
|
|
549
|
+
// =============================================================================
|
|
550
|
+
// Small - Compact text
|
|
551
|
+
// =============================================================================
|
|
552
|
+
const smallVariants = cva(
|
|
553
|
+
"text-foreground text-sm font-medium font-sans leading-5"
|
|
554
|
+
);
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Props for the TypographySmall component.
|
|
558
|
+
* Extends native small props with design system tracking attributes.
|
|
559
|
+
*/
|
|
560
|
+
interface TypographySmallProps
|
|
561
|
+
extends React.ComponentProps<"small">, TypographyBaseProps {}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Small text component for compact content.
|
|
565
|
+
* Used for captions, labels, and supplementary information.
|
|
566
|
+
*/
|
|
567
|
+
const TypographySmall = React.forwardRef<HTMLElement, TypographySmallProps>(
|
|
568
|
+
(
|
|
569
|
+
{
|
|
570
|
+
className,
|
|
571
|
+
asChild = false,
|
|
572
|
+
dataHook,
|
|
573
|
+
trackingEl,
|
|
574
|
+
trackingLabel,
|
|
575
|
+
...props
|
|
576
|
+
},
|
|
577
|
+
ref
|
|
578
|
+
) => {
|
|
579
|
+
const Comp = asChild ? Slot : "small";
|
|
580
|
+
return (
|
|
581
|
+
<Comp
|
|
582
|
+
ref={ref}
|
|
583
|
+
className={cn(smallVariants(), className)}
|
|
584
|
+
data-hook={dataHook}
|
|
585
|
+
data-slot="typography-small"
|
|
586
|
+
data-tracking-el={trackingEl}
|
|
587
|
+
data-tracking-label={trackingLabel}
|
|
588
|
+
{...props}
|
|
589
|
+
/>
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
);
|
|
593
|
+
TypographySmall.displayName = "TypographySmall";
|
|
594
|
+
|
|
595
|
+
// =============================================================================
|
|
596
|
+
// Muted - De-emphasized text
|
|
597
|
+
// =============================================================================
|
|
598
|
+
const mutedVariants = cva(
|
|
599
|
+
"text-muted-foreground text-sm font-medium font-sans leading-5"
|
|
600
|
+
);
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Props for the TypographyMuted component.
|
|
604
|
+
* Extends native p props with design system tracking attributes.
|
|
605
|
+
*/
|
|
606
|
+
interface TypographyMutedProps
|
|
607
|
+
extends React.ComponentProps<"p">, TypographyBaseProps {}
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Muted text component for de-emphasized content.
|
|
611
|
+
* Displays with reduced visual prominence for secondary information.
|
|
612
|
+
*/
|
|
613
|
+
const TypographyMuted = React.forwardRef<
|
|
614
|
+
HTMLParagraphElement,
|
|
615
|
+
TypographyMutedProps
|
|
616
|
+
>(
|
|
617
|
+
(
|
|
618
|
+
{
|
|
619
|
+
className,
|
|
620
|
+
asChild = false,
|
|
621
|
+
dataHook,
|
|
622
|
+
trackingEl,
|
|
623
|
+
trackingLabel,
|
|
624
|
+
...props
|
|
625
|
+
},
|
|
626
|
+
ref
|
|
627
|
+
) => {
|
|
628
|
+
const Comp = asChild ? Slot : "p";
|
|
629
|
+
return (
|
|
630
|
+
<Comp
|
|
631
|
+
ref={ref}
|
|
632
|
+
className={cn(mutedVariants(), className)}
|
|
633
|
+
data-hook={dataHook}
|
|
634
|
+
data-slot="typography-muted"
|
|
635
|
+
data-tracking-el={trackingEl}
|
|
636
|
+
data-tracking-label={trackingLabel}
|
|
637
|
+
{...props}
|
|
638
|
+
/>
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
);
|
|
642
|
+
TypographyMuted.displayName = "TypographyMuted";
|
|
643
|
+
|
|
644
|
+
// =============================================================================
|
|
645
|
+
// Exports
|
|
646
|
+
// =============================================================================
|
|
647
|
+
export {
|
|
648
|
+
TypographyH1,
|
|
649
|
+
TypographyH2,
|
|
650
|
+
TypographyH3,
|
|
651
|
+
TypographyH4,
|
|
652
|
+
TypographyP,
|
|
653
|
+
TypographyBlockquote,
|
|
654
|
+
blockquoteVariants,
|
|
655
|
+
TypographyList,
|
|
656
|
+
TypographyInlineCode,
|
|
657
|
+
TypographyCode,
|
|
658
|
+
TypographyLead,
|
|
659
|
+
TypographyLarge,
|
|
660
|
+
TypographySmall,
|
|
661
|
+
TypographyMuted,
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
export type {
|
|
665
|
+
TypographyH1Props,
|
|
666
|
+
TypographyH2Props,
|
|
667
|
+
TypographyH3Props,
|
|
668
|
+
TypographyH4Props,
|
|
669
|
+
TypographyPProps,
|
|
670
|
+
TypographyBlockquoteProps,
|
|
671
|
+
TypographyListProps,
|
|
672
|
+
TypographyInlineCodeProps,
|
|
673
|
+
TypographyCodeProps,
|
|
674
|
+
TypographyLeadProps,
|
|
675
|
+
TypographyLargeProps,
|
|
676
|
+
TypographySmallProps,
|
|
677
|
+
TypographyMutedProps,
|
|
678
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -58,6 +58,7 @@ export * from "./components/textarea";
|
|
|
58
58
|
export * from "./components/toggle";
|
|
59
59
|
export * from "./components/toggle-group";
|
|
60
60
|
export * from "./components/tooltip";
|
|
61
|
+
export * from "./components/typography";
|
|
61
62
|
|
|
62
63
|
// Blocks
|
|
63
64
|
export * from "./blocks/data-table";
|