1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import clsx from 'clsx';
|
6 | import { refType } from '@material-ui/utils';
|
7 | import capitalize from '../utils/capitalize';
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const NativeSelectInput = React.forwardRef(function NativeSelectInput(props, ref) {
|
13 | const {
|
14 | classes,
|
15 | className,
|
16 | disabled,
|
17 | IconComponent,
|
18 | inputRef,
|
19 | variant = 'standard'
|
20 | } = props,
|
21 | other = _objectWithoutPropertiesLoose(props, ["classes", "className", "disabled", "IconComponent", "inputRef", "variant"]);
|
22 |
|
23 | return React.createElement(React.Fragment, null, React.createElement("select", _extends({
|
24 | className: clsx(classes.root,
|
25 | classes.select, classes[variant], className, disabled && classes.disabled),
|
26 | disabled: disabled,
|
27 | ref: inputRef || ref
|
28 | }, other)), props.multiple ? null : React.createElement(IconComponent, {
|
29 | className: clsx(classes.icon, classes[`icon${capitalize(variant)}`], disabled && classes.disabled)
|
30 | }));
|
31 | });
|
32 | process.env.NODE_ENV !== "production" ? NativeSelectInput.propTypes = {
|
33 | |
34 |
|
35 |
|
36 |
|
37 | children: PropTypes.node,
|
38 |
|
39 | |
40 |
|
41 |
|
42 |
|
43 | classes: PropTypes.object.isRequired,
|
44 |
|
45 | |
46 |
|
47 |
|
48 | className: PropTypes.string,
|
49 |
|
50 | |
51 |
|
52 |
|
53 | disabled: PropTypes.bool,
|
54 |
|
55 | |
56 |
|
57 |
|
58 | IconComponent: PropTypes.elementType.isRequired,
|
59 |
|
60 | |
61 |
|
62 |
|
63 |
|
64 | inputRef: refType,
|
65 |
|
66 | |
67 |
|
68 |
|
69 | multiple: PropTypes.bool,
|
70 |
|
71 | |
72 |
|
73 |
|
74 | name: PropTypes.string,
|
75 |
|
76 | |
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 | onChange: PropTypes.func,
|
83 |
|
84 | |
85 |
|
86 |
|
87 | value: PropTypes.any,
|
88 |
|
89 | |
90 |
|
91 |
|
92 | variant: PropTypes.oneOf(['standard', 'outlined', 'filled'])
|
93 | } : void 0;
|
94 | export default NativeSelectInput; |
\ | No newline at end of file |