@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
77 lines (76 loc) • 3.17 kB
TypeScript
import { ChangeEventHandler, FocusEventHandler, PropsOf } from "../utils/types.js";
import "../utils/index.js";
import { ThemingProps } from "../theme/types.js";
import "../theme/index.js";
import { SystemProps } from "../system/system.js";
import "../system/index.js";
import { ReactNode } from "react";
//#region src/switch/switch.types.d.ts
type SwitchButtonProps = SystemProps & ThemingProps<'Switch'> & {
/** Provides value to switch in controlled mode. */
checked?: boolean;
/** Deprecated. Please use variant instead. @deprecated */
colorScheme?: 'blue' | 'green' | 'prussian';
/** Disables switch and related elements with the right styling. */
disabled?: boolean;
/** Displays custom content to the left of switch thumb. */
innerLabelOff?: ReactNode;
/** Displays custom content to the right of switch thumb. */
innerLabelOn?: ReactNode;
/** Props object passed to the inner input element. */
inputProps?: PropsOf<'input', SystemProps>;
/** Ref passed to the inner input element. */
inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
/** Passed to the inner input. */
name?: string;
/** Passed to the inner input. */
onBlur?: FocusEventHandler;
/** Passed to the inner input. */
onChange?: ChangeEventHandler;
/** Passed to the inner input. */
onFocus?: FocusEventHandler;
/** Passed to the inner input. */
required?: boolean;
/** Passed to the inner input. */
value?: number | string;
};
type SwitchContext = Pick<SwitchProps, 'checked' | 'colorScheme' | 'disabled' | 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'required' | 'size' | 'value' | 'variant'> & {
defaultChecked?: boolean;
};
type SwitchProps = SystemProps & ThemingProps<'Switch'> & {
/** Socket displaying a custom toggle button component. */
button?: ReactNode;
/** Provides value to switch button in controlled mode. */
checked?: boolean;
/** Deprecated. Please use variant instead. @deprecated */
colorScheme?: 'blue' | 'green' | 'prussian';
/** Disables switch and related elements with the right styling. */
disabled?: boolean;
/** Displays custom content to the left of switch thumb. */
innerLabelOff?: ReactNode;
/** Displays custom content to the right of switch thumb. */
innerLabelOn?: ReactNode;
/** Props object passed to the inner input element. */
inputProps?: PropsOf<'input', SystemProps>;
/** Ref passed to the inner input element. */
inputRef?: React.MutableRefObject<HTMLInputElement | null> | null;
/** Socket displaying content on the left. */
labelLeft?: ReactNode;
/** Socket displaying content on the right. */
labelRight?: ReactNode;
/** Passed to the inner input. */
name?: string;
/** Passed to the inner input. */
onBlur?: FocusEventHandler;
/** Passed to the inner input. */
onChange?: ChangeEventHandler;
/** Passed to the inner input. */
onFocus?: FocusEventHandler;
/** Passed to the inner input. */
required?: boolean;
/** Passed to the inner input. */
value?: string | readonly string[] | number | undefined;
};
//#endregion
export { SwitchButtonProps, SwitchContext, SwitchProps };
//# sourceMappingURL=switch.types.d.ts.map