UNPKG

@enact/ui

Version:

A collection of simplified unstyled cross-platform UI components for Enact

65 lines (56 loc) 1.98 kB
// Type definitions for ui/Item import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef"; import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable"; 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 ItemBaseProps { /** * The node to be displayed as the main content of the item. */ children?: React.ReactNode; /** * The type of component to use to render the item. May be a DOM node name (e.g 'div', 'span', etc.) or a custom component. */ component?: string | React.ComponentType; /** * 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: * * `item` - The root class name * * `inline` - Applied when `inline` prop is true */ css?: object; /** * Applies a disabled state to the item. */ disabled?: boolean; /** * Applies inline styling to the item. */ inline?: boolean; } /** * A basic list item component structure without any behaviors applied to it. * * It also has support for overlay to place things before and after the main content. */ export class ItemBase extends React.Component< Merge<React.HTMLProps<HTMLElement>, ItemBaseProps> > {} export interface ItemDecoratorProps extends Merge<ui_ForwardRef_ForwardRefProps, ui_Touchable_TouchableProps> {} export function ItemDecorator<P>( Component: React.ComponentType<P> | string, ): React.ComponentType<P & ItemDecoratorProps>; export interface ItemProps extends Omit<Merge<ItemBaseProps, ItemDecoratorProps>, "componentRef"> {} /** * A minimally-styled ready-to-use list item component with touch support. */ export class Item extends React.Component< Merge<React.HTMLProps<HTMLElement>, ItemProps> > {} export default Item;