UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

25 lines (22 loc) 1.85 kB
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'; const CFormControlWrapper = ({ children, describedby, feedback, feedbackInvalid, feedbackValid, floatingClassName, floatingLabel, id, invalid, label, text, tooltipFeedback, valid, }) => { const FormControlValidation = () => (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 = Object.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