import { JSXElementConstructor } from 'react'; import { TypographyAlign, TypographyColor, TypographyDisplay } from '@mezzanine-ui/core/typography'; import { TypographySemanticType } from '@mezzanine-ui/system/typography'; import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types'; export type TypographyComponent = `h${1 | 2 | 3 | 4 | 5 | 6}` | 'p' | 'span' | 'label' | 'div' | 'caption' | 'a' | JSXElementConstructor; interface TypographyPropsBase { /** * The css variable for `text-align`. */ align?: TypographyAlign; /** * The text semantic color from the palette. */ color?: TypographyColor; /** * The css variable for `display`. */ display?: TypographyDisplay; /** * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis. * * Note that text overflow can only happen with `block` or `inline-block` level elements * @default false */ ellipsis?: boolean; /** * If `true`, the text will not wrap. * @default false */ noWrap?: boolean; /** * Applies the typography semantic type. * @default 'body' */ variant?: TypographySemanticType; } export type TypographyProps = ComponentOverridableForwardRefComponentPropsFactory; /** * 文字排版元件,提供一致的語意化文字樣式。 * * 透過 `variant` 套用設計系統中定義的語意排版類型(如 `h1`、`h2`、`h3`、`body`、`caption` 等), * 並自動推斷對應的 HTML 標籤(`h1–h3` → `

`,body 系列 → `

`,其餘 → ``)。 * 可透過 `color` 套用調色盤中的文字色彩,`align` 控制對齊方式,`ellipsis` 啟用單行截斷省略號。 * 支援透過 `component` prop 覆寫根元素標籤。 * * @example * ```tsx * import Typography from '@mezzanine-ui/react/Typography'; * * // 標題 * 頁面標題 * * // 本文 * 這是一段說明文字。 * * // 套用色彩 * 錯誤提示訊息 * * // 單行截斷(需搭配 block 或 inline-block 容器) * 超長文字會在此被截斷顯示省略號... * ``` */ declare const Typography: import("react").ForwardRefExoticComponent, keyof TypographyPropsBase> & TypographyPropsBase, "component"> & { component?: TypographyComponent | undefined; } & import("react").RefAttributes>; export default Typography;