@enact/ui
Version:
A collection of simplified unstyled cross-platform UI components for Enact
82 lines (73 loc) • 2.26 kB
TypeScript
// Type definitions for ui/Card
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 CardBaseProps {
/**
* Determines whether the caption will be placed over the image or not.
*/
captionOverlay?: boolean;
/**
* The caption node to be displayed with the image.
*/
children?: React.ReactNode;
/**
* 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.
*/
css?: object;
/**
* Fits the image to its height and width and positions it on the center of the Card
*/
fitImage?: boolean;
/**
* The component used to render the image component.
*/
imageComponent?: React.ComponentType | JSX.Element;
/**
* The layout orientation of the component.
*/
orientation?: "horizontal" | "vertical";
/**
* A placeholder image to be displayed before the image is loaded.
*/
placeholder?: string;
/**
* Applies a selected visual effect to the image.
*/
selected?: boolean;
/**
* String value or object of values used to determine which image will appear on a specific
screenSize.
*/
src?: string | object;
}
/**
* A basic card without any behavior.
*/
export class CardBase extends React.Component<
Merge<React.HTMLProps<HTMLElement>, CardBaseProps>
> {}
export interface CardDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
export function CardDecorator<P>(
Component: React.ComponentType<P> | string,
): React.ComponentType<P & CardDecoratorProps>;
export interface CardProps
extends Omit<Merge<CardBaseProps, CardDecoratorProps>, "componentRef"> {}
/**
* A minimally styled Card ready for customization by a theme.
*/
export class Card extends React.Component<
Merge<React.HTMLProps<HTMLElement>, CardProps>
> {}
export default Card;