@@ -7,7 +7,7 @@ const dBtnXs = 'btn-xs'
77const dLink = 'link'
88const dLinkPrimary = 'link-primary'
99
10- export type TypographySize = 'sm' | 'base' | 'lg' | 'xl' | '2xl'
10+ export type TypographySize = 'xs' | ' sm' | 'base' | 'lg' | 'xl' | '2xl'
1111export type TitleLevel = 1 | 2 | 3 | 4 | 5
1212
1313export interface TypographyProps extends React . HTMLAttributes < HTMLDivElement > {
@@ -42,6 +42,7 @@ export interface TextProps extends React.HTMLAttributes<HTMLSpanElement> {
4242 underline ?: boolean
4343 delete ?: boolean
4444 type ?: 'default' | 'secondary' | 'success' | 'warning' | 'error'
45+ size ?: TypographySize
4546 copyable ?: boolean
4647 'data-testid' ?: string
4748}
@@ -94,6 +95,7 @@ function CopyButton({ text, 'data-testid': testId }: { text: string; 'data-testi
9495
9596function TypographyRoot ( { children, size = 'base' , className = '' , 'data-testid' : testId , ...rest } : TypographyProps ) {
9697 const sizeClasses = {
98+ xs : 'prose-xs text-xs' ,
9799 sm : 'prose-sm text-sm' ,
98100 base : 'prose-base text-base' ,
99101 lg : 'prose-lg text-lg' ,
@@ -223,6 +225,7 @@ function Text({
223225 underline,
224226 delete : del ,
225227 type = 'default' ,
228+ size,
226229 copyable,
227230 className = '' ,
228231 'data-testid' : testId ,
@@ -267,7 +270,18 @@ function Text({
267270 content = < del className = "line-through opacity-70" > { content } </ del >
268271 }
269272
270- const classes = `group inline ${ typeClasses [ type ] } ${ className } ` . trim ( )
273+ const classes = [
274+ 'group' ,
275+ 'inline' ,
276+ typeClasses [ type ] ,
277+ size === 'xs' && 'text-xs' ,
278+ size === 'sm' && 'text-sm' ,
279+ size === 'base' && 'text-base' ,
280+ size === 'lg' && 'text-lg' ,
281+ size === 'xl' && 'text-xl' ,
282+ size === '2xl' && 'text-2xl' ,
283+ className ,
284+ ] . filter ( Boolean ) . join ( ' ' )
271285
272286 return (
273287 < span className = { classes } data-testid = { testId } { ...rest } >
0 commit comments