UNPKG

@coreui/react

Version:

UI Components Library for React.js

27 lines (24 loc) 2.14 kB
import { __assign } from '../../node_modules/tslib/tslib.es6.js'; import React from 'react'; import PropTypes from 'prop-types'; import { CFormControlValidation } from './CFormControlValidation.js'; import { CFormFloating } from './CFormFloating.js'; import { CFormLabel } from './CFormLabel.js'; import { CFormText } from './CFormText.js'; var CFormControlWrapper = function (_a) { var children = _a.children, describedby = _a.describedby, feedback = _a.feedback, feedbackInvalid = _a.feedbackInvalid, feedbackValid = _a.feedbackValid, floatingClassName = _a.floatingClassName, floatingLabel = _a.floatingLabel, id = _a.id, invalid = _a.invalid, label = _a.label, text = _a.text, tooltipFeedback = _a.tooltipFeedback, valid = _a.valid; var FormControlValidation = function () { return (React.createElement(CFormControlValidation, { describedby: describedby, feedback: feedback, feedbackInvalid: feedbackInvalid, feedbackValid: feedbackValid, floatingLabel: floatingLabel, invalid: invalid, tooltipFeedback: tooltipFeedback, valid: valid })); }; return floatingLabel ? (React.createElement(CFormFloating, { className: floatingClassName }, children, React.createElement(CFormLabel, { htmlFor: id }, label || floatingLabel), text && React.createElement(CFormText, { id: describedby }, text), React.createElement(FormControlValidation, null))) : (React.createElement(React.Fragment, null, label && React.createElement(CFormLabel, { htmlFor: id }, label), children, text && React.createElement(CFormText, { id: describedby }, text), React.createElement(FormControlValidation, null))); }; CFormControlWrapper.propTypes = __assign({ children: PropTypes.node, floatingClassName: PropTypes.string, floatingLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.string]), label: PropTypes.oneOfType([PropTypes.node, PropTypes.string]), text: PropTypes.oneOfType([PropTypes.node, PropTypes.string]) }, CFormControlValidation.propTypes); CFormControlWrapper.displayName = 'CFormControlWrapper'; export { CFormControlWrapper }; //# sourceMappingURL=CFormControlWrapper.js.map