UNPKG

@coreui/react

Version:

UI Components Library for React.js

30 lines (26 loc) 2.44 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'); var CFormSelect = React.forwardRef(function (_a, ref) { var _b; var children = _a.children, className = _a.className, feedback = _a.feedback, feedbackInvalid = _a.feedbackInvalid, feedbackValid = _a.feedbackValid, floatingClassName = _a.floatingClassName, floatingLabel = _a.floatingLabel, htmlSize = _a.htmlSize, id = _a.id, invalid = _a.invalid, label = _a.label, options = _a.options, size = _a.size, text = _a.text, tooltipFeedback = _a.tooltipFeedback, valid = _a.valid, 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", tslib_es6.__assign({ id: id, className: index.default('form-select', (_b = {}, _b["form-select-".concat(size)] = size, _b['is-invalid'] = invalid, _b['is-valid'] = valid, _b), className), size: htmlSize }, rest, { ref: ref }), options ? options.map(function (option, index) { return (React.createElement("option", tslib_es6.__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 = tslib_es6.__assign({ className: PropTypes.string, htmlSize: PropTypes.number, options: PropTypes.array }, CFormControlWrapper.CFormControlWrapper.propTypes); CFormSelect.displayName = 'CFormSelect'; exports.CFormSelect = CFormSelect; //# sourceMappingURL=CFormSelect.js.map