UNPKG

@coreui/react-pro

Version:

UI Components Library for React.js

30 lines (26 loc) 2.25 kB
'use strict'; var tslib_es6 = require('../../node_modules/tslib/tslib.es6.js'); var React = require('react'); var PropTypes = require('prop-types'); var index = require('../../_virtual/index.js'); var CFormControlWrapper = require('./CFormControlWrapper.js'); const CFormSelect = React.forwardRef((_a, ref) => { var { children, className, feedback, feedbackInvalid, feedbackValid, floatingClassName, floatingLabel, htmlSize, id, invalid, label, options, size, text, tooltipFeedback, valid } = _a, rest = tslib_es6.__rest(_a, ["children", "className", "feedback", "feedbackInvalid", "feedbackValid", "floatingClassName", "floatingLabel", "htmlSize", "id", "invalid", "label", "options", "size", "text", "tooltipFeedback", "valid"]); return (React.createElement(CFormControlWrapper.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: index.default('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.selected && { selected: option.selected }), (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.CFormControlWrapper.propTypes); CFormSelect.displayName = 'CFormSelect'; exports.CFormSelect = CFormSelect; //# sourceMappingURL=CFormSelect.js.map