UNPKG

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