UNPKG

@coreui/react

Version:

UI Components Library for React.js

29 lines (25 loc) 2.29 kB
'use strict'; var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js'); var React = require('react'); var PropTypes = require('prop-types'); var CFormControlValidation = require('./CFormControlValidation.js'); var CFormFloating = require('./CFormFloating.js'); var CFormLabel = require('./CFormLabel.js'); var CFormText = require('./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.CFormControlValidation, { describedby: describedby, feedback: feedback, feedbackInvalid: feedbackInvalid, feedbackValid: feedbackValid, floatingLabel: floatingLabel, invalid: invalid, tooltipFeedback: tooltipFeedback, valid: valid })); }; return floatingLabel ? (React.createElement(CFormFloating.CFormFloating, { className: floatingClassName }, children, React.createElement(CFormLabel.CFormLabel, { htmlFor: id }, label || floatingLabel), text && React.createElement(CFormText.CFormText, { id: describedby }, text), React.createElement(FormControlValidation, null))) : (React.createElement(React.Fragment, null, label && React.createElement(CFormLabel.CFormLabel, { htmlFor: id }, label), children, text && React.createElement(CFormText.CFormText, { id: describedby }, text), React.createElement(FormControlValidation, null))); }; CFormControlWrapper.propTypes = tslib_es6.__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.CFormControlValidation.propTypes); CFormControlWrapper.displayName = 'CFormControlWrapper'; exports.CFormControlWrapper = CFormControlWrapper; //# sourceMappingURL=CFormControlWrapper.js.map