// Libs import * as React from 'react'; import { BaseInputProps, BaseInputState, BaseInput, } from '../base/input/BaseInput'; import { withThemeContext } from '../themeProvider/withThemeContext'; import { ThemeContextProps } from '../themeProvider/ThemeContext'; import classNames from 'classnames'; // Misc export type InputGroupProps = React.PropsWithChildren< Pick< BaseInputProps, 'title' | 'className' | 'tooltip' | 'formContext' > & ThemeContextProps > & { bodyClassName?: string; headerClassName?: string; }; export interface InputGroupState extends BaseInputState {} export class InputGroup extends BaseInput< InputGroupProps, InputGroupState, never > { // tslint:disable-next-line:no-any public static defaultProps: any = { ignoreContext: true, }; constructor(props: InputGroupProps) { super(props); } public render() { return this.props.title !== undefined ? (
{this.props.title != undefined && (
{this.renderTitle()}
)} {React.Children.count(this.props.children) > 0 && (
{this.props.children}
)}
) : ( this.props.children ); } } export default withThemeContext< InputGroupProps, InstanceType >(InputGroup, 'inputGroup');