Skip to content

Commit

Permalink
fix(types): Fix Col and Input types (reactstrap#2008)
Browse files Browse the repository at this point in the history
- Adds missing cssModule for Col
- Fixes innerRef for Input to allow HTMLTextAreaElement
- Removes CSSModule export in root index.d.ts
  • Loading branch information
kyletsang committed Nov 2, 2020
1 parent 54afca4 commit 363dfbe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 0 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export interface CSSModule {
[className: string]: string;
}

export { default as Alert } from './lib/Alert';
export { AlertProps } from './lib/Alert';
export { default as Badge } from './lib/Badge';
Expand Down
2 changes: 2 additions & 0 deletions types/lib/Col.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { CSSModule } from './index';

export type ColumnProps =
| string
Expand All @@ -13,6 +14,7 @@ export type ColumnProps =
export interface ColProps extends React.HTMLAttributes<HTMLDivElement> {
[key: string]: any;
tag?: React.ElementType;
cssModule?: CSSModule;
xs?: ColumnProps;
sm?: ColumnProps;
md?: ColumnProps;
Expand Down
2 changes: 1 addition & 1 deletion types/lib/Input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface InputProps
valid?: boolean;
invalid?: boolean;
tag?: React.ElementType;
innerRef?: React.Ref<HTMLInputElement>;
innerRef?: React.Ref<HTMLInputElement | HTMLTextAreaElement>;
plaintext?: boolean;
addon?: boolean;
cssModule?: CSSModule;
Expand Down
10 changes: 5 additions & 5 deletions types/reactstrap-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ const Example26 = (props: any) => {
const Example27 = (props: any) => {
return (
<Row noGutters>
<Col sm="6">
<Col sm="6" cssModule={{ col: 'test' }}>
<Card body>
<CardTitle>Special Title Treatment</CardTitle>
<CardText>
Expand Down Expand Up @@ -2151,9 +2151,7 @@ class Example61 extends React.Component {
<Col sm="4">.col .col-sm-4</Col>
</Row>
<Row>
<Col sm={{ size: 6, offset: 1 }}>
.col .col-sm-6 .col-sm-offset-2
</Col>
<Col sm={{ size: 6, offset: 1 }}>.col .col-sm-6 .col-sm-offset-2</Col>
</Row>
<Row>
<Col sm="12" md={{ size: 8, offset: 2 }}>
Expand Down Expand Up @@ -4400,7 +4398,7 @@ class Example107 extends React.Component {
return (
<Input
type="file"
innerRef={(input) => {
innerRef={(input: HTMLInputElement) => {
this.input = input;
}}
/>
Expand Down Expand Up @@ -5746,6 +5744,8 @@ const MegaTest = () => {
<FormGroup ref={React.createRef<FormGroup>()} {...htmlProps} />
<FormText ref={React.createRef<FormText>()} {...htmlProps} />
<Input ref={React.createRef<Input>()} {...htmlProps} />
<Input innerRef={React.createRef<HTMLTextAreaElement>()} />
<Input innerRef={React.createRef<HTMLInputElement>()} />
<InputGroup ref={React.createRef<InputGroup>()} {...htmlProps} />
<InputGroupAddon
ref={React.createRef<InputGroupAddon>()}
Expand Down

0 comments on commit 363dfbe

Please sign in to comment.