Skip to content

Commit 5dbd335

Browse files
committed
v1.16.0
1 parent 57035be commit 5dbd335

File tree

10 files changed

+509
-285
lines changed

10 files changed

+509
-285
lines changed

API.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ All [material-ui](https://material-ui.com/api/select/) props and:
101101

102102
#### Autocomplete
103103

104-
| Props | Required | Type | Description |
105-
|----------|----------|------------------------------------------------|-------------|
106-
| value | true | any | |
107-
| options | true | object { value: string/number, label: string } | |
108-
| onChange | true | Function(string/number) | |
104+
All [react-select](https://github.com/JedWatson/react-select) props and:
105+
106+
107+
| Props | Required | Type | Description |
108+
|----------|----------|-----------------------------------------------|-------------|
109+
| value | true | any / any[] | |
110+
| options | true | array { value: string/number, label: string } | |
111+
| onChange | true | Function(value: any / any[]) | |
109112

110113
#### HTML
111114

components/Autocomplete/Input.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

components/Autocomplete/SuggestionsContainer.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import Chip from '@material-ui/core/Chip';
2+
import MenuItem from '@material-ui/core/MenuItem';
3+
import Paper from '@material-ui/core/Paper';
4+
import TextField from '@material-ui/core/TextField';
5+
import Typography from '@material-ui/core/Typography';
6+
import CancelIcon from '@material-ui/icons/Cancel';
7+
import classNames from 'classnames';
8+
import * as React from 'react';
9+
10+
function NoOptionsMessage(props: any) {
11+
return (
12+
<Typography
13+
color='textSecondary'
14+
className={props.selectProps.classes.noOptionsMessage}
15+
{...props.innerProps}
16+
>
17+
{props.children}
18+
</Typography>
19+
);
20+
}
21+
22+
function inputComponent({ inputRef, ...props }: any) {
23+
return <div ref={inputRef} {...props} />;
24+
}
25+
26+
function Control(props: any) {
27+
return (
28+
<TextField
29+
fullWidth
30+
InputProps={{
31+
inputComponent,
32+
inputProps: {
33+
className: props.selectProps.classes.input,
34+
inputRef: props.innerRef,
35+
children: props.children,
36+
...props.innerProps,
37+
},
38+
}}
39+
{...props.selectProps.textFieldProps}
40+
/>
41+
);
42+
}
43+
44+
function Option(props: any) {
45+
return (
46+
<MenuItem
47+
buttonRef={props.innerRef}
48+
selected={props.isFocused}
49+
component='div'
50+
style={{
51+
fontWeight: props.isSelected ? 500 : 400,
52+
}}
53+
{...props.innerProps}
54+
>
55+
{props.children}
56+
</MenuItem>
57+
);
58+
}
59+
60+
function Placeholder(props: any) {
61+
return (
62+
<Typography
63+
color='textSecondary'
64+
className={props.selectProps.classes.placeholder}
65+
{...props.innerProps}
66+
>
67+
{props.children}
68+
</Typography>
69+
);
70+
}
71+
72+
function SingleValue(props: any) {
73+
return (
74+
<Typography className={props.selectProps.classes.singleValue} {...props.innerProps}>
75+
{props.children}
76+
</Typography>
77+
);
78+
}
79+
80+
function ValueContainer(props: any) {
81+
return <div className={props.selectProps.classes.valueContainer}>{props.children}</div>;
82+
}
83+
84+
function MultiValue(props: any) {
85+
return (
86+
<Chip
87+
tabIndex={-1}
88+
label={props.children}
89+
className={classNames(props.selectProps.classes.chip, {
90+
[props.selectProps.classes.chipFocused]: props.isFocused,
91+
})}
92+
onDelete={props.removeProps.onClick}
93+
deleteIcon={<CancelIcon {...props.removeProps} />}
94+
/>
95+
);
96+
}
97+
98+
function Menu(props: any) {
99+
return (
100+
<Paper square className={props.selectProps.classes.paper} {...props.innerProps}>
101+
{props.children}
102+
</Paper>
103+
);
104+
}
105+
106+
const components = {
107+
Control,
108+
Menu,
109+
MultiValue,
110+
NoOptionsMessage,
111+
Option,
112+
Placeholder,
113+
SingleValue,
114+
ValueContainer,
115+
};
116+
117+
export default components;

0 commit comments

Comments
 (0)