@blueprintjs/core
Version:
Core styles & components
32 lines • 1.54 kB
JavaScript
/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
*/
import classNames from "classnames";
import * as React from "react";
import { DISABLED, FILL, HTML_SELECT, LARGE, MINIMAL } from "../../common/classes";
import { Icon } from "../icon/icon";
// this component is simple enough that tests would be purely tautological.
/* istanbul ignore next */
export class HTMLSelect extends React.PureComponent {
render() {
const { className, disabled, elementRef, fill, iconProps, large, minimal, options = [], ...htmlProps } = this.props;
const classes = classNames(HTML_SELECT, {
[DISABLED]: disabled,
[FILL]: fill,
[LARGE]: large,
[MINIMAL]: minimal,
}, className);
const optionChildren = options.map(option => {
const props = typeof option === "object" ? option : { value: option };
return React.createElement("option", Object.assign({}, props, { key: props.value, children: props.label || props.value }));
});
return (React.createElement("div", { className: classes },
React.createElement("select", Object.assign({ disabled: disabled, ref: elementRef }, htmlProps, { multiple: false }),
optionChildren,
htmlProps.children),
React.createElement(Icon, Object.assign({ icon: "double-caret-vertical" }, iconProps))));
}
}
//# sourceMappingURL=htmlSelect.js.map