Skip to content

Commit

Permalink
[Input] Allow div props on InputAdornment in TypeScript (#11077)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtandersson authored and oliviertassinari committed Apr 20, 2018
1 parent 6e8ffbf commit ad628c8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/material-ui/src/Input/InputAdornment.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import { StandardProps } from '..';

export interface InputAdornmentProps extends StandardProps<{}, InputAdornmentClassKey> {
export interface InputAdornmentProps
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, InputAdornmentClassKey> {
component?: React.ReactType<InputAdornmentProps>;
disableTypography?: boolean;
position: 'start' | 'end';
Expand Down
6 changes: 3 additions & 3 deletions packages/material-ui/src/styles/withStyles.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export default function withStyles<ClassKey extends string>(
style: StyleRules<ClassKey> | StyleRulesCallback<ClassKey>,
options?: WithStylesOptions,
): {
(
component: React.ComponentType<WithStyles<ClassKey>>,
): React.ComponentType<StyledComponentProps<ClassKey>>;
(component: React.ComponentType<WithStyles<ClassKey>>): React.ComponentType<
StyledComponentProps<ClassKey>
>;
<P extends ConsistentWith<WithStyles<ClassKey>>>(
component: React.ComponentType<P & WithStyles<ClassKey>>,
): React.ComponentType<P & StyledComponentProps<ClassKey>>;
Expand Down
11 changes: 8 additions & 3 deletions packages/material-ui/test/typescript/components.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
Grow,
IconButton,
Input,
InputAdornment,
LinearProgress,
List,
ListItem,
Expand Down Expand Up @@ -784,16 +785,20 @@ const TextFieldTest = () => (
</div>
);

const SelectTest = () => {
const SelectTest = () => (
<Select input={<Input />} value={10} onChange={e => log(e.currentTarget.value)}>
<MenuItem value="">
<em>None</em>
</MenuItem>
<MenuItem value={10}>Ten</MenuItem>
<MenuItem value={20}>Twenty</MenuItem>
<MenuItem value={30}>Thirty</MenuItem>
</Select>;
};
</Select>
);

const InputAdornmentTest = () => (
<InputAdornment position="end" onClick={() => alert('Hello')} />
);

const ResponsiveComponentTest = () => {
const ResponsiveComponent = withMobileDialog({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,3 @@ const DecoratedUnionProps = decorate<ArtProps>( // <-- without the type argument
);

const unionPropElem = <DecoratedUnionProps category="book" author="Twain, Mark" />;

0 comments on commit ad628c8

Please sign in to comment.