@coreui/react
Version:
UI Components Library for React.js
28 lines (25 loc) • 2.35 kB
JavaScript
import { __rest, __assign } 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';
var CFormSelect = 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 = __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", __assign({ id: id, className: classNames('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", __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 = __assign({ className: PropTypes.string, htmlSize: PropTypes.number, options: PropTypes.array }, CFormControlWrapper.propTypes);
CFormSelect.displayName = 'CFormSelect';
export { CFormSelect };
//# sourceMappingURL=CFormSelect.js.map