UNPKG

@enact/sandstone

Version:

Large-screen/TV support library for Enact, containing a variety of UI components.

56 lines (47 loc) 1.63 kB
// Type definitions for sandstone/Switch import { ToggleableProps as ui_Toggleable_ToggleableProps } from "@enact/ui/Toggleable"; import { SpottableProps as spotlight_Spottable_SpottableProps } from "@enact/spotlight/Spottable"; import { IconProps as sandstone_Icon_IconProps } from "@enact/sandstone/Icon"; 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 SwitchBaseProps extends sandstone_Icon_IconProps { /** * Disables Switch and becomes non-interactive. */ disabled?: boolean; /** * Disables animation. */ noAnimation?: boolean; /** * Sets whether this control is in the 'on' or 'off' state. `true` for 'on', `false` for 'off'. */ selected?: boolean; } /** * Renders the base level DOM structure of the component. */ export class SwitchBase extends React.Component< Merge<React.HTMLProps<HTMLElement>, SwitchBaseProps> > {} export interface SwitchDecoratorProps extends Merge< ui_Toggleable_ToggleableProps, spotlight_Spottable_SpottableProps > {} export function SwitchDecorator<P>( Component: React.ComponentType<P> | string, ): React.ComponentType<P & SwitchDecoratorProps>; export interface SwitchProps extends Merge<SwitchBaseProps, SwitchDecoratorProps> {} /** * A Sandstone-styled component that looks like a toggle switch. * * `Switch` will manage its `selected` state via unless set directly. */ export class Switch extends React.Component< Merge<React.HTMLProps<HTMLElement>, SwitchProps> > {} export default Switch;