import "./text.css"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type StyleProps } from "./style_props"; import { type TypeRungName } from "./type_ramp"; import { type TextColor } from "./text_ink"; export type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6; /** The ramp's own keys, so no rung exists in one and not the other. */ export type TextSize = TypeRungName; type TextAlign = "left" | "right" | "center"; type TextDecoration = "underline" | "line-through" | "underline line-through"; export type TextWeight = "regular" | "medium" | "semibold"; type TextTransform = "uppercase" | "lowercase" | "capitalize"; type TextUserSelect = "none" | "auto" | "text"; /** A heading comes from `level`. */ type TextElement = "span" | "p" | "div" | "label" | "strong" | "em"; export interface TextProps extends StyleProps { children?: React.ReactNode; testID?: string; size?: TextSize; color?: TextColor; /** A role, not a font: the call site says what the text is (headline, wordmark, figure; `code` for a * literal a reader types back — a path, a header, an identifier) and the theme decides the face. */ family?: "display" | "code"; /** A stacked pair's line box instead of prose; set on both lines, or the stack is lopsided. */ leading?: "tight"; /** Breaks at any character, for spaceless values (ids, URLs, hashes, filenames), where `break-word` only * breaks an overflowing lone word. Opt-in, since prose would break mid-word. */ wrap?: "anywhere"; align?: TextAlign; weight?: TextWeight; /** Ellipsised on the last line. `"container"` uses the surrounding sheet's `--lotics-text-lines`, for a * component whose `@container` query decides the count, or an excerpt keeping a record brief's. */ lines?: number | "container"; userSelect?: TextUserSelect; transform?: TextTransform; decoration?: TextDecoration; /** Renders a real ``, so middle-click works; anything that acts is a control via * `render={