UNPKG

lucid-ui

Version:

A UI component library from Xandr.

82 lines 3.17 kB
import React from 'react'; import PropTypes from 'prop-types'; import { StandardProps, Overwrite } from '../../util/component-types'; interface Item { id: string; icon?: React.ReactElement; label?: React.ReactElement | string; isSelected?: boolean; isPartial?: boolean; tabIndex?: number; isDisabled?: boolean; className?: string; } interface IIconSelectPropsRaw extends StandardProps { /** Items in the IconSelect group. Each item should have an id. */ items: Item[]; /** Defines the type of IconSelect box. A 'single' select will create a radio input type Item. A 'multiple' select will create a checkbox input type. */ kind: 'single' | 'multiple'; /** A function that is called with the id of the Item in the IconSelect group is clicked. */ onSelect: (id: string, { event, props, }: { event: React.MouseEvent; props: IIconSelectProps; }) => void; /** Disabled all IconSelect Items. */ isDisabled: boolean; } export declare type IIconSelectProps = Overwrite<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, IIconSelectPropsRaw>; export declare const IconSelect: { (props: IIconSelectProps): React.ReactElement; displayName: string; defaultProps: { kind: "multiple"; isDisabled: boolean; onSelect: (...args: any[]) => void; }; peek: { description: string; categories: string[]; }; propTypes: { /** Appended to the component-specific class names set on the root element. Value is run through the \`classnames\` library. */ className: PropTypes.Requireable<string>; /** Added to the end of the IconSelect group. */ children: PropTypes.Requireable<PropTypes.ReactNodeLike>; /** Items in the IconSelect group. Each item should have an id. */ items: PropTypes.Validator<(PropTypes.InferProps<{ id: PropTypes.Validator<string>; icon: PropTypes.Requireable<PropTypes.ReactNodeLike>; label: PropTypes.Requireable<PropTypes.ReactNodeLike>; isSelected: PropTypes.Requireable<boolean>; isPartial: PropTypes.Requireable<boolean>; tabIndex: PropTypes.Requireable<number>; isDisabled: PropTypes.Requireable<boolean>; className: PropTypes.Requireable<string>; }> | null | undefined)[]>; /** Defines the type of IconSelect box. A 'single' select will create a radio input type Item. A 'multiple' select will create a checkbox input type. */ kind: PropTypes.Requireable<string>; /** A function that is called with the id of the Item in the IconSelect group is clicked. Signature: \`(id, { event }) => {}\` */ onSelect: PropTypes.Requireable<(...args: any[]) => any>; /** Disabled all IconSelect Items. */ isDisabled: PropTypes.Requireable<boolean>; }; }; export default IconSelect; //# sourceMappingURL=IconSelect.d.ts.map