mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-26 18:52:52 +00:00
Add react-places-autocomplete definition
This commit is contained in:
parent
5dc41ce74c
commit
dfd9c2d430
60
types/react-places-autocomplete/index.d.ts
vendored
Normal file
60
types/react-places-autocomplete/index.d.ts
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
// Type definitions for react-places-autocomplete 6.1
|
||||
// Project: https://github.com/kenny-hibino/react-places-autocomplete/
|
||||
// Definitions by: Guilherme Hübner <https://github.com/guilhermehubner>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
//
|
||||
/// <reference types="googlemaps" />
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export interface formattedSuggestionType {
|
||||
mainText: string;
|
||||
secundaryText: string;
|
||||
}
|
||||
|
||||
export interface PropTypes {
|
||||
inputProps: {
|
||||
value: string;
|
||||
onChange: (value: string) => void;
|
||||
type?: string;
|
||||
name?: string;
|
||||
placeholder?: string;
|
||||
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
||||
};
|
||||
onError?: (status: string, clearSuggestion: () => void) => void;
|
||||
onSelect?: (address: string, placeID: string) => void;
|
||||
renderSuggestion?: (suggestion: string, formattedSuggestion: formattedSuggestionType) => React.ReactNode;
|
||||
classNames?: {
|
||||
root?: string;
|
||||
input?: string;
|
||||
autocompleteContainer?: string;
|
||||
autocompleteItem?: string;
|
||||
autocompleteItemActive?: string;
|
||||
};
|
||||
styles?: {
|
||||
root?: React.CSSProperties;
|
||||
input?: React.CSSProperties;
|
||||
autocompleteContainer?: React.CSSProperties;
|
||||
autocompleteItem?: React.CSSProperties;
|
||||
autocompleteItemActive?: React.CSSProperties;
|
||||
};
|
||||
options?: {
|
||||
bounds?: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral;
|
||||
componentRestrictions?: google.maps.GeocoderComponentRestrictions;
|
||||
location?: google.maps.LatLng | google.maps.LatLngLiteral;
|
||||
offset?: number | string;
|
||||
radius?: number | string;
|
||||
types?: string[];
|
||||
};
|
||||
|
||||
debounce?: number;
|
||||
highlightFirstSuggestion?: boolean;
|
||||
renderFooter?: () => React.ReactNode;
|
||||
shouldFetchSuggestions?: (value: string) => boolean;
|
||||
}
|
||||
|
||||
export function geocodeByAddress(address: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void;
|
||||
export function geocodeByPlaceId(placeId: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void;
|
||||
|
||||
export default class PlacesAutocomplete extends React.Component<PropTypes> {}
|
||||
16
types/react-places-autocomplete/tsconfig.json
Normal file
16
types/react-places-autocomplete/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"files": ["index.d.ts"],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
3
types/react-places-autocomplete/tslint.json
Normal file
3
types/react-places-autocomplete/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user