UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

27 lines (24 loc) 2.07 kB
import { __rest } from '../../node_modules/tslib/tslib.es6.js'; import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; import classNames from '../../_virtual/index.js'; import { CFormControlWrapper } from './CFormControlWrapper.js'; const CFormSelect = forwardRef((_a, ref) => { var { children, className, feedback, feedbackInvalid, feedbackValid, floatingClassName, floatingLabel, htmlSize, id, invalid, label, options, size, text, tooltipFeedback, valid } = _a, rest = __rest(_a, ["children", "className", "feedback", "feedbackInvalid", "feedbackValid", "floatingClassName", "floatingLabel", "htmlSize", "id", "invalid", "label", "options", "size", "text", "tooltipFeedback", "valid"]); return (React.createElement(CFormControlWrapper, { describedby: rest['aria-describedby'], feedback: feedback, feedbackInvalid: feedbackInvalid, feedbackValid: feedbackValid, floatingClassName: floatingClassName, floatingLabel: floatingLabel, id: id, invalid: invalid, label: label, text: text, tooltipFeedback: tooltipFeedback, valid: valid }, React.createElement("select", Object.assign({ id: id, className: classNames('form-select', { [`form-select-${size}`]: size, 'is-invalid': invalid, 'is-valid': valid, }, className), size: htmlSize }, rest, { ref: ref }), options ? options.map((option, index) => { return (React.createElement("option", Object.assign({}, (typeof option === 'object' && option.disabled && { disabled: option.disabled }), (typeof option === 'object' && option.value !== undefined && { value: option.value }), { key: index }), typeof option === 'string' ? option : option.label)); }) : children))); }); CFormSelect.propTypes = Object.assign({ className: PropTypes.string, htmlSize: PropTypes.number, options: PropTypes.array }, CFormControlWrapper.propTypes); CFormSelect.displayName = 'CFormSelect'; export { CFormSelect }; //# sourceMappingURL=CFormSelect.js.map