UNPKG

1.74 kBJavaScriptView Raw
1import { __rest } from "tslib";
2import * as React from 'react';
3import styles from '@patternfly/react-styles/css/components/TextInputGroup/text-input-group';
4import { css } from '@patternfly/react-styles';
5import { TextInputGroupContext } from './TextInputGroup';
6export const TextInputGroupMain = (_a) => {
7 var { children, className, icon, type = 'text', hint, onChange = () => undefined, onFocus, onBlur, 'aria-label': ariaLabel = 'Type to filter', value: inputValue, placeholder: inputPlaceHolder } = _a, props = __rest(_a, ["children", "className", "icon", "type", "hint", "onChange", "onFocus", "onBlur", 'aria-label', "value", "placeholder"]);
8 const { isDisabled } = React.useContext(TextInputGroupContext);
9 const handleChange = (event) => {
10 onChange(event.currentTarget.value, event);
11 };
12 return (React.createElement("div", Object.assign({ className: css(styles.textInputGroupMain, icon && styles.modifiers.icon, className) }, props),
13 children,
14 React.createElement("span", { className: css(styles.textInputGroupText) },
15 hint && (React.createElement("input", { className: css(styles.textInputGroupTextInput, styles.modifiers.hint), type: "text", disabled: true, "aria-hidden": "true", value: hint })),
16 icon && React.createElement("span", { className: css(styles.textInputGroupIcon) }, icon),
17 React.createElement("input", { type: type, className: css(styles.textInputGroupTextInput), "aria-label": ariaLabel, disabled: isDisabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, value: inputValue || '', placeholder: inputPlaceHolder }))));
18};
19TextInputGroupMain.displayName = 'TextInputGroupMain';
20//# sourceMappingURL=TextInputGroupMain.js.map
\No newline at end of file