@enact/ui
Version:
A collection of simplified unstyled cross-platform UI components for Enact
67 lines (58 loc) • 1.84 kB
TypeScript
// Type definitions for ui/BodyText
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
import * as React from "react";
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
export interface BodyTextBaseProps {
/**
* Centers the contents.
*
* Applies the `centered` CSS class which can be customized by
.
*/
centered?: boolean;
/**
* The type of component to use to render the item. May be a DOM node name (e.g 'div',
'p', etc.) or a custom component.
*/
component?: React.ComponentType;
/**
* Called with a reference to the root component.
*
* When using , the `ref` prop is forwarded to this component
as `componentRef` .
*/
componentRef?: object | Function;
/**
* Customizes the component by mapping the supplied collection of CSS class names to the
corresponding internal elements and states of this component.
*
* The following classes are supported:
* * `bodyText` - The root class name
* * `centered` - Applied when `centered` prop is `true`
*/
css?: object;
}
/**
* A simple, unstyled text block component, without
applied.
*/
export class BodyTextBase extends React.Component<
Merge<React.HTMLProps<HTMLElement>, BodyTextBaseProps>
> {}
export interface BodyTextDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
export function BodyTextDecorator<P>(
Component: React.ComponentType<P> | string,
): React.ComponentType<P & BodyTextDecoratorProps>;
export interface BodyTextProps
extends Omit<
Merge<BodyTextBaseProps, BodyTextDecoratorProps>,
"componentRef"
> {}
/**
* A simple, unstyled text block component.
*/
export class BodyText extends React.Component<
Merge<React.HTMLProps<HTMLElement>, BodyTextProps>
> {}
export default BodyText;