lucid-ui
Version:
A UI component library from Xandr.
78 lines • 2.77 kB
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
import { StandardProps, Overwrite } from '../../util/component-types';
export interface ISwitchPropsRaw extends StandardProps {
/** Indicates whether the component should appear and act disabled by having
* a "greyed out" palette and ignoring user interactions.
*
* @default false
* */
isDisabled: boolean;
/** Indicates that the component is in the "selected" state when true and in
* the "unselected" state when false.
*
* @default false
* */
isSelected: boolean;
/** Called when the user clicks on the component or when they press the space
* key while the component is in focus.
*
* @default _.noop
* */
onSelect: (isSelected: boolean, { event, props, }: {
event: React.MouseEvent<HTMLSpanElement> | React.TouchEvent<HTMLSpanElement>;
props: ISwitchProps;
}) => void;
/** Offers a red/green styling to the switch.
*
* @default false
*/
isIncludeExclude: boolean;
}
export declare type ISwitchProps = Overwrite<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, ISwitchPropsRaw>;
export declare const Switch: {
(props: ISwitchProps): React.ReactElement;
defaultProps: {
isDisabled: boolean;
isSelected: boolean;
onSelect: (...args: any[]) => void;
isIncludeExclude: boolean;
};
displayName: string;
peek: {
description: string;
categories: string[];
};
propTypes: {
/**
Appended to the component-specific class names set on the root element.
*/
className: PropTypes.Requireable<string>;
/**
Indicates whether the component should appear and act disabled by having
a "greyed out" palette and ignoring user interactions.
*/
isDisabled: PropTypes.Requireable<boolean>;
/**
Indicates that the component is in the "selected" state when true and in
the "unselected" state when false.
*/
isSelected: PropTypes.Requireable<boolean>;
/**
Called when the user clicks on the component or when they press the space
key while the component is in focus. Signature:
\`(isSelected, { event, props }) => {}\`
*/
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
/**
Passed through to the root element.
*/
style: PropTypes.Requireable<object>;
/**
Offers a red/green styling to the switch.
*/
isIncludeExclude: PropTypes.Requireable<boolean>;
};
};
export default Switch;
//# sourceMappingURL=Switch.d.ts.map