@enact/sandstone
Version:
Large-screen/TV support library for Enact, containing a variety of UI components.
57 lines (48 loc) • 1.68 kB
TypeScript
// Type definitions for sandstone/SwitchItem
import { ToggleableProps as ui_Toggleable_ToggleableProps } from "@enact/ui/Toggleable";
import { ItemProps as sandstone_Item_ItemProps } from "@enact/sandstone/Item";
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 SwitchItemBaseProps
extends Omit<sandstone_Item_ItemProps, "iconComponent"> {
/**
* 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:
* * `switchItem` - The root class name
*/
css?: object;
/**
* If true the switch will be selected.
*/
selected?: boolean;
/**
* Nodes to be inserted after `children` and before the switch.
*/
slotAfter?: React.ReactNode;
}
/**
* Renders an item with a .
*/
export class SwitchItemBase extends React.Component<
Merge<React.HTMLProps<HTMLElement>, SwitchItemBaseProps>
> {}
export interface SwitchItemDecoratorProps
extends ui_Toggleable_ToggleableProps {}
export function SwitchItemDecorator<P>(
Component: React.ComponentType<P> | string,
): React.ComponentType<P & SwitchItemDecoratorProps>;
export interface SwitchItemProps
extends Merge<SwitchItemBaseProps, SwitchItemDecoratorProps> {}
/**
* A Sandstone-styled item with a switch component.
*
* `SwitchItem` will manage its `selected` state via unless set
directly.
*/
export class SwitchItem extends React.Component<
Merge<React.HTMLProps<HTMLElement>, SwitchItemProps>
> {}
export default SwitchItem;