| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.TextInputGroup = exports.TextInputGroupContext = void 0; |
| 4 |
const tslib_1 = require("tslib"); |
| 5 |
const jsx_runtime_1 = require("react/jsx-runtime"); |
| 6 |
const react_1 = require("react"); |
| 7 |
const text_input_group_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/TextInputGroup/text-input-group")); |
| 8 |
const react_styles_1 = require("@patternfly/react-styles"); |
| 9 |
exports.TextInputGroupContext = (0, react_1.createContext)({ |
| 10 |
isDisabled: false |
| 11 |
}); |
| 12 |
const TextInputGroup = (_a) => { |
| 13 |
var { children, className, isDisabled, isPlain, validated, innerRef } = _a, props = tslib_1.__rest(_a, ["children", "className", "isDisabled", "isPlain", "validated", "innerRef"]); |
| 14 |
const ref = (0, react_1.useRef)(null); |
| 15 |
const textInputGroupRef = innerRef || ref; |
| 16 |
const hasValidatedModifier = ['success', 'error', 'warning'].includes(validated); |
| 17 |
return ((0, jsx_runtime_1.jsx)(exports.TextInputGroupContext.Provider, { value: { isDisabled, validated }, children: (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: textInputGroupRef, className: (0, react_styles_1.css)(text_input_group_1.default.textInputGroup, isDisabled && text_input_group_1.default.modifiers.disabled, isPlain && text_input_group_1.default.modifiers.plain, hasValidatedModifier && text_input_group_1.default.modifiers[validated], className) }, props, { children: children })) })); |
| 18 |
}; |
| 19 |
exports.TextInputGroup = TextInputGroup; |
| 20 |
exports.TextInputGroup.displayName = 'TextInputGroup'; |
| 21 |
//# sourceMappingURL=TextInputGroup.js.map |