Skip to content

Commit e243fa4

Browse files
authored
fix(typings): update types to support ref (#4447)
1 parent 49ef16a commit e243fa4

File tree

175 files changed

+484
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+484
-419
lines changed

index.d.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ export {
5252
StrictBreadcrumbSectionProps,
5353
} from './dist/commonjs/collections/Breadcrumb/BreadcrumbSection'
5454

55-
export {
56-
default as Form,
57-
FormComponent,
58-
FormProps,
59-
StrictFormProps,
60-
} from './dist/commonjs/collections/Form'
55+
export { default as Form, FormProps, StrictFormProps } from './dist/commonjs/collections/Form'
6156
export {
6257
default as FormButton,
6358
FormButtonProps,

src/addons/Confirm/Confirm.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
22

3-
import { SemanticShorthandItem } from '../../generic'
3+
import { ForwardRefComponent, SemanticShorthandItem } from '../../generic'
44
import { ButtonProps } from '../../elements/Button'
55
import { StrictModalProps } from '../../modules/Modal'
66
import { ModalContentProps } from '../../modules/Modal/ModalContent'
@@ -42,10 +42,10 @@ export interface StrictConfirmProps extends StrictModalProps {
4242
/** Whether or not the modal is visible. */
4343
open?: boolean
4444

45-
/** A confirm can vary in size. */
45+
/** A Confirm can vary in size. */
4646
size?: 'mini' | 'tiny' | 'small' | 'large' | 'fullscreen'
4747
}
4848

49-
declare const Confirm: React.ComponentClass<ConfirmProps>
49+
declare const Confirm: ForwardRefComponent<ConfirmProps, HTMLDivElement>
5050

5151
export default Confirm

src/addons/Pagination/Pagination.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
22

3-
import { SemanticShorthandItem } from '../../generic'
3+
import { ForwardRefComponent, SemanticShorthandItem } from '../../generic'
44
import PaginationItem, { PaginationItemProps } from './PaginationItem'
55

66
export interface PaginationProps extends StrictPaginationProps {
@@ -56,8 +56,8 @@ export interface StrictPaginationProps {
5656
totalPages: number | string
5757
}
5858

59-
declare class Pagination extends React.Component<PaginationProps> {
60-
static Item: typeof PaginationItem
59+
declare const Pagination: ForwardRefComponent<PaginationProps, HTMLDivElement> & {
60+
Item: typeof PaginationItem
6161
}
6262

6363
export default Pagination

src/addons/Pagination/PaginationItem.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react'
2+
import { ForwardRefComponent } from '../../generic'
23

34
export interface PaginationItemProps extends StrictPaginationItemProps {
45
[key: string]: any
@@ -31,6 +32,6 @@ export interface StrictPaginationItemProps {
3132
type?: 'ellipsisItem' | 'firstItem' | 'prevItem' | 'pageItem' | 'nextItem' | 'lastItem'
3233
}
3334

34-
declare class PaginationItem extends React.Component<PaginationItemProps> {}
35+
declare const PaginationItem: ForwardRefComponent<PaginationItemProps, HTMLDivElement>
3536

3637
export default PaginationItem

src/addons/Portal/Portal.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ export interface StrictPortalProps {
9797
triggerRef?: React.Ref<any>
9898
}
9999

100-
declare class Portal extends React.Component<PortalProps> {
101-
static Inner: typeof PortalInner
100+
declare const Portal: React.FC<PortalProps> & {
101+
Inner: typeof PortalInner
102102
}
103103

104104
export default Portal

src/addons/Portal/PortalInner.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ export interface StrictPortalInnerProps {
2828
onUnmount?: (nothing: null, data: PortalInnerProps) => void
2929
}
3030

31-
declare class PortalInner extends React.Component<PortalInnerProps> {}
31+
declare const PortalInner: React.FC<PortalInnerProps>
3232

3333
export default PortalInner

src/addons/Radio/Radio.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from 'react'
1+
import { ForwardRefComponent } from '../../generic'
22
import { StrictCheckboxProps } from '../../modules/Checkbox'
33

44
export interface RadioProps extends StrictRadioProps {
@@ -16,6 +16,6 @@ export interface StrictRadioProps extends StrictCheckboxProps {
1616
type?: 'checkbox' | 'radio'
1717
}
1818

19-
declare const Radio: React.FC<RadioProps>
19+
declare const Radio: ForwardRefComponent<RadioProps, HTMLInputElement>
2020

2121
export default Radio

src/addons/Select/Select.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import * as React from 'react'
2-
31
import { StrictDropdownProps } from '../../modules/Dropdown'
42
import DropdownDivider from '../../modules/Dropdown/DropdownDivider'
53
import DropdownHeader from '../../modules/Dropdown/DropdownHeader'
64
import DropdownItem, { DropdownItemProps } from '../../modules/Dropdown/DropdownItem'
75
import DropdownMenu from '../../modules/Dropdown/DropdownMenu'
6+
import { ForwardRefComponent } from '../../generic'
87

98
export interface SelectProps extends StrictSelectProps {
109
[key: string]: any
@@ -15,13 +14,11 @@ export interface StrictSelectProps extends StrictDropdownProps {
1514
options: DropdownItemProps[]
1615
}
1716

18-
interface SelectComponent extends React.FC<SelectProps> {
17+
declare const Select: ForwardRefComponent<SelectProps, HTMLDivElement> & {
1918
Divider: typeof DropdownDivider
2019
Header: typeof DropdownHeader
2120
Item: typeof DropdownItem
2221
Menu: typeof DropdownMenu
2322
}
2423

25-
declare const Select: SelectComponent
26-
2724
export default Select

src/addons/TextArea/TextArea.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react'
2+
import { ForwardRefComponent } from '../../generic'
23

34
export interface TextAreaProps extends StrictTextAreaProps {
45
[key: string]: any
@@ -31,8 +32,6 @@ export interface StrictTextAreaProps {
3132
value?: number | string
3233
}
3334

34-
declare class TextArea extends React.Component<TextAreaProps> {
35-
focus: () => void
36-
}
35+
declare const TextArea: ForwardRefComponent<TextAreaProps, HTMLTextAreaElement>
3736

3837
export default TextArea

src/collections/Breadcrumb/Breadcrumb.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22

33
import {
4+
ForwardRefComponent,
45
SemanticShorthandCollection,
56
SemanticShorthandContent,
67
SemanticShorthandItem,
@@ -38,11 +39,9 @@ export interface StrictBreadcrumbProps {
3839
size?: 'mini' | 'tiny' | 'small' | 'large' | 'big' | 'huge' | 'massive'
3940
}
4041

41-
interface BreadcrumbComponent extends React.ComponentClass<BreadcrumbProps> {
42+
declare const Breadcrumb: ForwardRefComponent<BreadcrumbProps, HTMLDivElement> & {
4243
Divider: typeof BreadcrumbDivider
4344
Section: typeof BreadcrumbSection
4445
}
4546

46-
declare const Breadcrumb: BreadcrumbComponent
47-
4847
export default Breadcrumb

src/collections/Breadcrumb/BreadcrumbDivider.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
22

3-
import { SemanticShorthandContent, SemanticShorthandItem } from '../../generic'
3+
import { ForwardRefComponent, SemanticShorthandContent, SemanticShorthandItem } from '../../generic'
44
import { IconProps } from '../../elements/Icon'
55

66
export interface BreadcrumbDividerProps extends StrictBreadcrumbDividerProps {
@@ -24,6 +24,6 @@ export interface StrictBreadcrumbDividerProps {
2424
icon?: SemanticShorthandItem<IconProps>
2525
}
2626

27-
declare const BreadcrumbDivider: React.FC<BreadcrumbDividerProps>
27+
declare const BreadcrumbDivider: ForwardRefComponent<BreadcrumbDividerProps, HTMLDivElement>
2828

2929
export default BreadcrumbDivider

src/collections/Breadcrumb/BreadcrumbSection.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react'
2-
import { SemanticShorthandContent } from '../../generic'
2+
import { ForwardRefComponent, SemanticShorthandContent } from '../../generic'
33

44
export interface BreadcrumbSectionProps extends StrictBreadcrumbSectionProps {
55
[key: string]: any
@@ -37,6 +37,6 @@ export interface StrictBreadcrumbSectionProps {
3737
onClick?: (event: React.MouseEvent<HTMLAnchorElement>, data: BreadcrumbSectionProps) => void
3838
}
3939

40-
declare const BreadcrumbSection: React.ComponentClass<BreadcrumbSectionProps>
40+
declare const BreadcrumbSection: ForwardRefComponent<BreadcrumbSectionProps, HTMLDivElement>
4141

4242
export default BreadcrumbSection

src/collections/Form/Form.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import FormInput from './FormInput'
99
import FormRadio from './FormRadio'
1010
import FormSelect from './FormSelect'
1111
import FormTextArea from './FormTextArea'
12+
import { ForwardRefComponent } from '../../generic'
1213

1314
export interface FormProps extends StrictFormProps {
1415
[key: string]: any
@@ -58,7 +59,7 @@ export interface StrictFormProps {
5859
widths?: 'equal'
5960
}
6061

61-
export interface FormComponent extends React.FC<FormProps> {
62+
declare const Form: ForwardRefComponent<FormProps, HTMLFormElement> & {
6263
Field: typeof FormField
6364
Button: typeof FormButton
6465
Checkbox: typeof FormCheckbox
@@ -70,6 +71,4 @@ export interface FormComponent extends React.FC<FormProps> {
7071
TextArea: typeof FormTextArea
7172
}
7273

73-
declare const Form: FormComponent
74-
7574
export default Form

src/collections/Form/FormButton.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import * as React from 'react'
2-
3-
import { SemanticShorthandItem } from '../../generic'
1+
import { ForwardRefComponent, SemanticShorthandItem } from '../../generic'
42
import { StrictButtonProps } from '../../elements/Button'
53
import { LabelProps } from '../../elements/Label'
64
import { StrictFormFieldProps } from './FormField'
@@ -22,6 +20,6 @@ export interface StrictFormButtonProps
2220
label?: SemanticShorthandItem<LabelProps>
2321
}
2422

25-
declare const FormButton: React.FC<FormButtonProps>
23+
declare const FormButton: ForwardRefComponent<FormButtonProps, HTMLButtonElement>
2624

2725
export default FormButton

src/collections/Form/FormCheckbox.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import * as React from 'react'
2-
31
import { StrictCheckboxProps } from '../../modules/Checkbox'
2+
import { ForwardRefComponent } from '../../generic'
43
import { StrictFormFieldProps } from './FormField'
54

65
export interface FormCheckboxProps extends StrictFormCheckboxProps {
@@ -18,6 +17,6 @@ export interface StrictFormCheckboxProps extends StrictFormFieldProps, StrictChe
1817
type?: 'checkbox' | 'radio'
1918
}
2019

21-
declare const FormCheckbox: React.FC<FormCheckboxProps>
20+
declare const FormCheckbox: ForwardRefComponent<FormCheckboxProps, HTMLInputElement>
2221

2322
export default FormCheckbox

src/collections/Form/FormDropdown.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import * as React from 'react'
2-
31
import { StrictDropdownProps } from '../../modules/Dropdown'
2+
import { ForwardRefComponent } from '../../generic'
43
import { StrictFormFieldProps } from './FormField'
54

65
export interface FormDropdownProps extends StrictFormDropdownProps {
@@ -18,6 +17,6 @@ export interface StrictFormDropdownProps extends StrictFormFieldProps, StrictDro
1817
error?: any
1918
}
2019

21-
declare const FormDropdown: React.FC<FormDropdownProps>
20+
declare const FormDropdown: ForwardRefComponent<FormDropdownProps, HTMLDivElement>
2221

2322
export default FormDropdown

src/collections/Form/FormField.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from 'react'
22

33
import {
4+
ForwardRefComponent,
45
HtmlLabelProps,
56
SemanticShorthandContent,
67
SemanticShorthandItem,
@@ -57,6 +58,6 @@ export interface StrictFormFieldProps {
5758
width?: SemanticWIDTHS
5859
}
5960

60-
declare const FormField: React.FC<FormFieldProps>
61+
declare const FormField: ForwardRefComponent<FormFieldProps, HTMLElement>
6162

6263
export default FormField

src/collections/Form/FormGroup.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react'
2-
import { SemanticWIDTHS } from '../../generic'
2+
import { ForwardRefComponent, SemanticWIDTHS } from '../../generic'
33

44
export interface FormGroupProps extends StrictFormGroupProps {
55
[key: string]: any
@@ -34,6 +34,6 @@ export interface StrictFormGroupProps {
3434
widths?: SemanticWIDTHS | 'equal'
3535
}
3636

37-
declare const FormGroup: React.FC<FormGroupProps>
37+
declare const FormGroup: ForwardRefComponent<FormGroupProps, HTMLInputElement>
3838

3939
export default FormGroup

src/collections/Form/FormInput.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import * as React from 'react'
2-
3-
import { SemanticShorthandItem } from '../../generic'
1+
import { ForwardRefComponent, SemanticShorthandItem } from '../../generic'
42
import { LabelProps } from '../../elements/Label'
53
import { StrictInputProps } from '../../elements/Input'
64
import { StrictFormFieldProps } from './FormField'
@@ -25,6 +23,6 @@ export interface StrictFormInputProps
2523
label?: SemanticShorthandItem<LabelProps>
2624
}
2725

28-
declare const FormInput: React.FC<FormInputProps>
26+
declare const FormInput: ForwardRefComponent<FormInputProps, HTMLInputElement>
2927

3028
export default FormInput

src/collections/Form/FormRadio.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import * as React from 'react'
2-
31
import { StrictRadioProps } from '../../addons/Radio'
2+
import { ForwardRefComponent } from '../../generic'
43
import { StrictFormFieldProps } from './FormField'
54

65
export interface FormRadioProps extends StrictFormRadioProps {
@@ -18,6 +17,6 @@ export interface StrictFormRadioProps extends StrictFormFieldProps, StrictRadioP
1817
type?: 'checkbox' | 'radio'
1918
}
2019

21-
declare const FormRadio: React.FC<FormRadioProps>
20+
declare const FormRadio: ForwardRefComponent<FormRadioProps, HTMLInputElement>
2221

2322
export default FormRadio

src/collections/Form/FormSelect.d.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import * as React from 'react'
2-
31
import { StrictSelectProps } from '../../addons/Select'
42
import { DropdownItemProps } from '../../modules/Dropdown/DropdownItem'
53
import { StrictFormFieldProps } from './FormField'
6-
import { SemanticShorthandItem } from '../../generic'
7-
import { LabelProps } from '../../elements/Label'
4+
import { ForwardRefComponent } from '../../generic'
85

96
export interface FormSelectProps extends StrictFormSelectProps {
107
[key: string]: any
@@ -24,6 +21,6 @@ export interface StrictFormSelectProps extends StrictFormFieldProps, StrictSelec
2421
options: DropdownItemProps[]
2522
}
2623

27-
declare const FormSelect: React.FC<FormSelectProps>
24+
declare const FormSelect: ForwardRefComponent<FormSelectProps, HTMLDivElement>
2825

2926
export default FormSelect

src/collections/Form/FormTextArea.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import * as React from 'react'
2-
31
import { StrictTextAreaProps } from '../../addons/TextArea'
2+
import { ForwardRefComponent } from '../../generic'
43
import { StrictFormFieldProps } from './FormField'
54

65
export interface FormTextAreaProps extends StrictFormTextAreaProps {
@@ -15,6 +14,6 @@ export interface StrictFormTextAreaProps extends StrictFormFieldProps, StrictTex
1514
control?: any
1615
}
1716

18-
declare const FormTextArea: React.FC<FormTextAreaProps>
17+
declare const FormTextArea: ForwardRefComponent<FormTextAreaProps, HTMLTextAreaElement>
1918

2019
export default FormTextArea

src/collections/Form/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { default, FormComponent, FormProps, StrictFormProps } from './Form'
1+
export { default, FormProps, StrictFormProps } from './Form'

src/collections/Grid/Grid.d.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import * as React from 'react'
22

3-
import { SemanticTEXTALIGNMENTS, SemanticVERTICALALIGNMENTS, SemanticWIDTHS } from '../../generic'
3+
import {
4+
ForwardRefComponent,
5+
SemanticTEXTALIGNMENTS,
6+
SemanticVERTICALALIGNMENTS,
7+
SemanticWIDTHS,
8+
} from '../../generic'
49
import GridColumn from './GridColumn'
510
import GridRow from './GridRow'
611

@@ -70,11 +75,9 @@ export interface StrictGridProps {
7075
verticalAlign?: SemanticVERTICALALIGNMENTS
7176
}
7277

73-
interface GridComponent extends React.FC<GridProps> {
78+
declare const Grid: ForwardRefComponent<GridProps, HTMLDivElement> & {
7479
Column: typeof GridColumn
7580
Row: typeof GridRow
7681
}
7782

78-
declare const Grid: GridComponent
79-
8083
export default Grid

0 commit comments

Comments
 (0)