@yandex/ui
Version:
Yandex UI components
64 lines (63 loc) • 2.91 kB
TypeScript
import { ElementType, ReactNode, CSSProperties, PureComponent } from 'react';
import './Text.css';
export declare type TextAlignValue = 'start' | 'end' | 'center' | 'justify';
export declare type TextOverflowValue = 'fade' | 'ellipsis' | 'fade-horizontal';
export declare type TextColorValue = 'brand' | 'inverse' | 'primary' | 'promo' | 'secondary' | 'ghost' | 'control-primary' | 'alert' | 'warning' | 'disable' | 'success' | 'control-secondary' | 'control-passive' | 'control-ghost' | 'control-faint' | 'control-disable' | 'control-link' | 'control-error' | 'link' | 'link-external' | 'link-minor' | 'link-hover';
export declare type TextTypographyValue = 'display-xl' | 'display-l' | 'display-m' | 'display-s' | 'headline-xl' | 'headline-l' | 'headline-s' | 'headline-xs' | 'headline-m' | 'subheader-xl' | 'subheader-l' | 'subheader-m' | 'subheader-s' | 'body-short-xl' | 'body-short-l' | 'body-short-m' | 'body-short-s' | 'body-long-xl' | 'body-long-l' | 'body-long-m' | 'body-long-s' | 'caption-xl' | 'caption-l' | 'caption-m' | 'overline-l' | 'overline-m' | 'overline-s' | 'control-xxs' | 'control-xs' | 'control-s' | 'control-l' | 'control-xl' | 'control-m' | 'control-xxl';
export interface TextProps {
/**
* Тип элемента для отображения как (строка или компонент).
*/
as?: ElementType;
/**
* Основной контент
*/
children?: ReactNode;
/**
* Дополнительный класс
*/
className?: string;
/**
* Задает выравнивание текста в компоненте.
*/
align?: TextAlignValue;
/**
* Задает отображение переполненного текста
*/
overflow?: TextOverflowValue;
/**
* Максимальное количество строк текста (работает в связке с overflow)
*/
maxLines?: number;
/**
* Дополнительные стили
*/
style?: CSSProperties;
/**
* Цвет текста
*/
color?: TextColorValue;
/**
* Задает типографику текста в компоненте.
*/
typography?: TextTypographyValue;
}
export declare const cnText: import("@bem-react/classname").ClassNameFormatter;
/**
* Базовый примитив представления текстовых данных.
* @param { TextProps } props
*/
export declare class Text extends PureComponent<TextProps> {
static displayName: string;
private static getLineHeight;
private static isFade;
private static isEllipsis;
private textElement;
componentDidMount(): void;
componentWillUnmount(): void;
componentDidUpdate(prevProps: Readonly<TextProps>): void;
private updateText;
private getLineHeight;
private setTextElement;
render(): JSX.Element;
}