lucid-ui
Version:
A UI component library from Xandr.
70 lines • 2.72 kB
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
import { IButtonProps } from '../Button/Button';
import { StandardProps } from '../../util/component-types';
export interface IButtonGroupState {
selectedIndices: number[];
}
export interface IButtonGroupProps extends StandardProps {
/** A function that is called with the index of the child button clicked. */
onSelect: (selectedIndex: number, { event, props }: {
event: React.MouseEvent;
props: IButtonProps;
}) => void;
/** An array of currently selected \`ButtonGroup.Button\`s indices. You can
also pass the prop \`isActive\` to individual \`ButtonGroup.Button\`
components. */
selectedIndices: number[];
}
declare class ButtonGroup extends React.Component<IButtonGroupProps, IButtonGroupState> {
static displayName: string;
static peek: {
description: string;
categories: string[];
madeFrom: string[];
};
static Button: {
(_props: Partial<IButtonProps>): null;
displayName: string;
peek: {
description: string;
};
};
static reducers: {
onSelect(state: IButtonGroupState | undefined, index: number): IButtonGroupState;
};
static defaultProps: {
onSelect: (...args: any[]) => void;
selectedIndices: never[];
};
static propTypes: {
/**
A function that is called with the index of the child button clicked.
\`props\` refers to the child button props. Signature:
\`(selectedIndex, { event, props }) => {}\`
*/
onSelect: PropTypes.Requireable<(...args: any[]) => any>;
/**
Appended to the component-specific class names set on the root element.
Value is run through the \`classnames\` library.
*/
className: PropTypes.Requireable<any>;
/**
All children should be \`ButtonGroup.Button\`s and they support the same
props as \`Button\`s.
*/
children: PropTypes.Requireable<any>;
/**
An array of currently selected \`ButtonGroup.Button\`s indices. You can
also pass the prop \`isActive\` to individual \`ButtonGroup.Button\`
components.
*/
selectedIndices: PropTypes.Requireable<(number | null | undefined)[]>;
};
handleSelect: (event: any, childProps: any, index: any) => void;
render(): JSX.Element;
}
declare const _default: typeof ButtonGroup & import("../../util/state-management").IHybridComponent<IButtonGroupProps, IButtonGroupState>;
export default _default;
export { ButtonGroup as ButtonGroupDumb };
//# sourceMappingURL=ButtonGroup.d.ts.map