Files
DefinitelyTyped/types/react-geosuggest/index.d.ts
Tom Crockett fe3fcd77c9 [React] Remove string index fallback for CSS properties (#24911)
* [React] Remove string index fallback for CSS properties (resolves #24568)

* Require a minimum version of 2.2 for csstype

* Fix aphrodite types

* Fix react-confirm test

* Use Omit

* Fix react-geosuggest types

* Fix victory test

* Make customStyle and customStyleOnEditCell into functions
2018-04-11 22:34:31 +01:00

91 lines
2.7 KiB
TypeScript

// Type definitions for react-geosuggest 2.7
// Project: https://github.com/ubilabs/react-geosuggest
// Definitions by: Brad Menchl <https://github.com/brmenchl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="googlemaps" />
import { Component, InputHTMLAttributes } from "react";
export default class Geosuggest extends Component<GeosuggestProps> {
focus(): void;
blur(): void;
update(value: string): void;
clear(): void;
selectSuggest(value?: Suggest): void;
}
// Replace with Exclude once on 2.8+
export type Diff<T extends string, U extends string> = (
& { [P in T]: P }
& { [P in U]: never }
& { [x: string]: never }
)[T];
export type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export interface GeosuggestProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'style'> {
placeholder?: string;
initialValue?: string;
className?: string;
style?: Styles;
inputClassName?: string;
disabled?: boolean;
location?: google.maps.LatLng;
radius?: number;
bounds?: google.maps.LatLngBounds;
country?: string | string[];
types?: QueryType[];
fixtures?: Fixture[];
maxFixtures?: number;
googleMaps?: typeof google.maps;
ignoreTab?: boolean;
queryDelay?: number;
minLength?: number;
highlightMatch?: boolean;
onFocus?(value: any): void;
onBlur?(value: any): void;
onChange?(value: any): void;
onKeyDown?(event: any): void;
onKeyPress?(event: any): void;
onSuggestSelect?(suggest: Suggest): void;
onUpdateSuggests?(suggests: any, activeSuggest: any): void;
onActivateSuggest?(suggest: Suggest): void;
onSuggestNoResults?(userInput: string): void;
getSuggestLabel?(googleSuggest: google.maps.places.AutocompletePrediction): string;
renderSuggestItem?(googleSuggest: google.maps.places.AutocompletePrediction): any;
skipSuggest?(googleSuggest: google.maps.places.AutocompletePrediction): boolean;
autoActivateFirstSuggest?: boolean;
label?: string;
suggestsClassName?: string;
suggestsHiddenClassName?: string;
suggestItemClassName?: string;
suggestItemActiveClassName?: string;
autoComplete?: string;
}
export interface Styles {
input?: Record<string, any>;
suggestItem?: Record<string, any>;
suggests?: Record<string, any>;
}
export type QueryType
= 'establishment'
| 'geocode'
| '(cities)'
| '(regions)';
export interface Fixture {
className?: string;
label: string;
location?: google.maps.LatLng;
}
export interface Suggest {
gmaps?: google.maps.GeocoderResult;
label: string;
location: {lat: string, lng: string};
placeId: string;
}