import { createElement, ElementType, forwardRef, HTMLAttributes, ReactElement, ReactNode, } from "react"; import cn from "classnames"; import { bem, ClassNameCloneableChild } from "@react-md/utils"; /** * A union of all the material design provided typography styles. When used with * the Text component, this will generate the correct typography className to * apply and determine what component to be rendered as if none was provided. */ export type TextTypes = | "headline-1" | "headline-2" | "headline-3" | "headline-4" | "headline-5" | "headline-6" | "subtitle-1" | "subtitle-2" | "body-1" | "body-2" | "caption" | "overline" | "button"; export type TextAlign = "left" | "center" | "right"; export type TextDecoration = "underline" | "overline" | "line-through"; export type TextTransform = "capitalize" | "uppercase" | "lowercase"; export type TextWeight = | "thin" | "light" | "regular" | "medium" | "bold" | "semi-bold" | "black"; export type TextColor = | "secondary" | "hint" | "theme-primary" | "theme-secondary" | "theme-warning" | "theme-error"; export type FontStyle = "italic" | "oblique" | "normal"; /** * A union of the default supported elements that the `Text` component can be * rendered as. This is mostly used for adding the correct HTMLAttributes and * enabling the forward ref. */ export type TextElement = | HTMLHeadingElement | HTMLParagraphElement | HTMLSpanElement | HTMLDivElement | HTMLButtonElement | HTMLAnchorElement | HTMLBodyElement | HTMLHtmlElement; export type TextRenderFunction = (props: { className: string }) => ReactElement; export interface TextProps extends HTMLAttributes { /** * An optional className to merge into typography styles. */ className?: string; /** * The component to render as when the children are not a render function. If * this prop is omitted, the component will be determined by the `type` prop * where: * * - `"headline-1" ->

` * - `"headline-2" ->

` * - `"headline-3" ->

` * - `"headline-4" ->

` * - `"headline-5" ->

` * - `"headline-6" ->
` * - `"subtitle-1" ->
` * - `"subtitle-2" ->
` * - `"body-1" ->

` * - `"body-2" ->

` * - `"caption" -> ` * - `"overline" -> ` * - `"button" ->