UNPKG

@spark-web/text

Version:

--- title: Text storybookPath: typography-text--default isExperimentalPackage: false ---

42 lines (41 loc) 3.56 kB
import type { CSSObject } from '@emotion/react'; import type { BoxProps } from '@spark-web/box'; import type { DataAttributeMap } from '@spark-web/utils/internal'; import type { CSSProperties, ReactNode } from 'react'; import type { TextOverflowStrategy } from "./use-overflow-strategy.js"; import type { UseTextProps } from "./use-text.js"; type InlineProps = { align?: never; /** Display as an inline element. */ inline?: boolean; overflowStrategy?: never; }; type BlockProps = { /** The horizontal alignment. */ align?: 'left' | 'center' | 'right'; inline?: never; /** Manage how text behaves with regard to overflow. */ overflowStrategy?: TextOverflowStrategy; }; export type TextProps = Partial<UseTextProps> & { /** The text content. */ children?: ReactNode; /** Customizes the component element. */ css?: CSSObject; /** Sets data attributes on the component. */ data?: DataAttributeMap; /** An identifier which must be unique in the whole document. */ id?: BoxProps['id']; /** When enabled, numbers will be the same width. Similar to a monospaced font. */ tabularNumbers?: boolean; /** Transform the text casing. */ transform?: CSSProperties['textTransform']; /** Truncate the text with an ellipsis after computing the text layout, including line wrapping, * such that the total number of lines does not exceed this number. */ numberOfLines?: number; } & (InlineProps | BlockProps); export declare const Text: <Comp extends import("react").ElementType = "div">(props: { as?: Comp | undefined; ref?: import("react").Ref<Comp extends "symbol" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | keyof HTMLElementTagNameMap ? (HTMLElementTagNameMap & Pick<SVGElementTagNameMap, "symbol" | "svg" | "animate" | "animateMotion" | "animateTransform" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "set" | "stop" | "switch" | "text" | "textPath" | "tspan" | "use" | "view">)[Comp] : Comp extends new (...args: any) => any ? InstanceType<Comp> : undefined> | undefined; } & (Omit<import("react").PropsWithoutRef<import("react").ComponentProps<Comp>>, "as"> & TextProps)) => import("react").ReactElement; export {};