| 1 |
import styles from '@patternfly/react-styles/css/components/InputGroup/input-group'; |
| 2 |
import { css } from '@patternfly/react-styles'; |
| 3 |
import { InputGroupItem } from './InputGroupItem'; |
| 4 |
|
| 5 |
export interface InputGroupTextProps extends React.HTMLProps<HTMLSpanElement | HTMLLabelElement> { |
| 6 |
/** Additional classes added to the input group text. */ |
| 7 |
className?: string; |
| 8 |
/** Content rendered inside the input group text. */ |
| 9 |
children: React.ReactNode; |
| 10 |
/** Component that wraps the input group text. */ |
| 11 |
component?: React.ReactNode; |
| 12 |
/** Flag to to indicate if the input group item is plain. */ |
| 13 |
isPlain?: boolean; |
| 14 |
/** Flag to indicate if the input group text is disabled. */ |
| 15 |
isDisabled?: boolean; |
| 16 |
} |
| 17 |
|
| 18 |
export const InputGroupText: React.FunctionComponent<InputGroupTextProps> = ({ |
| 19 |
className, |
| 20 |
component = 'span', |
| 21 |
children, |
| 22 |
isPlain, |
| 23 |
isDisabled, |
| 24 |
...props |
| 25 |
}: InputGroupTextProps) => { |
| 26 |
const Component = component as any; |
| 27 |
return ( |
| 28 |
<InputGroupItem isPlain={isPlain} isBox isDisabled={isDisabled}> |
| 29 |
<Component className={css(styles.inputGroupText, className)} {...props}> |
| 30 |
{children} |
| 31 |
</Component> |
| 32 |
</InputGroupItem> |
| 33 |
); |
| 34 |
}; |
| 35 |
InputGroupText.displayName = 'InputGroupText'; |