UNPKG

turkey-map-react

Version:

An interactive SVG Turkey map for React JS applications.

62 lines (61 loc) 1.85 kB
import React, { Component, MouseEventHandler } from 'react'; import { Property } from 'csstype'; declare type Data = { cities: CityType[]; }; interface IProps { viewBox: ViewBoxType; visible: boolean; hoverable: boolean; customStyle: CustomStyleType; showTooltip: boolean; tooltipText?: string; data: Data; cityWrapper?: (cityComponent: JSX.Element, city: CityType) => JSX.Element; onHover?: (city: CityType) => void; onClick?: (city: CityType) => void; } interface IState { hoveredCityName?: string; tooltipStyle: { left: number; top: number; visibility?: Property.Visibility; animation?: Property.Animation; }; } export declare type CityType = { id: string; plateNumber: number; name: string; path: string; }; export declare type CustomStyleType = { idleColor: string; hoverColor: string; }; export declare type ViewBoxType = { top: number; left: number; width: number; height: number; }; declare type GetCitiesReturn = { element: JSX.Element; cityType: CityType; }; export default class TurkeyMap extends Component<IProps, IState> { constructor(props: IProps); static defaultProps: IProps; cityWrapper: () => JSX.Element[]; handleHover: (city: CityType) => void; onHover: (event: React.MouseEvent<SVGGElement, MouseEvent>) => void; onClick: (event: React.MouseEvent<SVGGElement, MouseEvent>) => void; onMouseMove: MouseEventHandler; onMouseEnter: (event: React.MouseEvent<SVGGElement, MouseEvent>) => void; onMouseLeave: (event: React.MouseEvent<SVGGElement, MouseEvent>) => void; handleMouseEvent: (event: React.MouseEvent<SVGGElement, MouseEvent>, callback: (city: CityType) => void) => void; getCities: () => GetCitiesReturn[]; render(): JSX.Element; } export {};