india-map-react 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,125 @@
1
+ import React$1 from 'react';
2
+
3
+ type StateData = {
4
+ /** Value to drive color scale (choropleth) */
5
+ value?: number;
6
+ /** Custom fill color for this state */
7
+ color?: string;
8
+ /** Any extra metadata you want back in callbacks */
9
+ [key: string]: unknown;
10
+ };
11
+ type MarkerData = {
12
+ /** Unique key */
13
+ id: string;
14
+ /** Display label shown below the marker pin */
15
+ label: string;
16
+ /** Longitude */
17
+ lng: number;
18
+ /** Latitude */
19
+ lat: number;
20
+ /** Custom color for this marker (default: red) */
21
+ color?: string;
22
+ /** Any extra metadata */
23
+ [key: string]: unknown;
24
+ };
25
+ type TooltipPosition = {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ type GeoType = {
30
+ id: string;
31
+ rsmKey: string;
32
+ properties: {
33
+ ST_NM?: string;
34
+ NAME_1?: string;
35
+ [key: string]: unknown;
36
+ };
37
+ };
38
+ type IndiaMapProps = {
39
+ /**
40
+ * Per-state data map: key = state name (matches ST_NM in TopoJSON),
41
+ * value = StateData object.
42
+ *
43
+ * @example
44
+ * stateData={{ "Maharashtra": { value: 120, color: "#4ade80" } }}
45
+ */
46
+ stateData?: Record<string, StateData>;
47
+ /** Array of map markers (pins) to render */
48
+ markers?: MarkerData[];
49
+ /** Default fill color for all states */
50
+ fillColor?: string;
51
+ /** Fill color on hover */
52
+ hoverColor?: string;
53
+ /** Fill color of currently selected state */
54
+ selectedColor?: string;
55
+ /** Stroke (border) color between states */
56
+ strokeColor?: string;
57
+ /** Stroke width between states */
58
+ strokeWidth?: number;
59
+ /**
60
+ * Enable choropleth coloring driven by stateData[state].value.
61
+ * Requires stateData with numeric `value` fields.
62
+ * Colors interpolate between choroplethLow and choroplethHigh.
63
+ */
64
+ enableChoropleth?: boolean;
65
+ /** Low-end color for choropleth scale (default: "#dbeafe") */
66
+ choroplethLow?: string;
67
+ /** High-end color for choropleth scale (default: "#1d4ed8") */
68
+ choroplethHigh?: string;
69
+ /**
70
+ * Controlled selected state. Pass null to deselect.
71
+ * If omitted, the component manages selection internally.
72
+ */
73
+ selectedState?: string | null;
74
+ /** Allow multiple states to be selected at once */
75
+ multiSelect?: boolean;
76
+ /** Disable all mouse interactions */
77
+ disabled?: boolean;
78
+ /** Enable scroll-wheel zoom and drag-to-pan */
79
+ enableZoom?: boolean;
80
+ /** Minimum zoom scale multiplier (default: 1) */
81
+ minZoom?: number;
82
+ /** Maximum zoom scale multiplier (default: 8) */
83
+ maxZoom?: number;
84
+ /** Show a tooltip on hover */
85
+ showTooltip?: boolean;
86
+ /**
87
+ * Custom tooltip renderer. Receives state name + any stateData for it.
88
+ * Return a React node.
89
+ */
90
+ tooltipContent?: (stateName: string, data?: StateData) => React.ReactNode;
91
+ /** Container style */
92
+ style?: React.CSSProperties;
93
+ /** Container className */
94
+ className?: string;
95
+ /** Fired when a state is clicked */
96
+ onStateClick?: (stateName: string, data?: StateData) => void;
97
+ /** Fired when mouse enters a state */
98
+ onStateHover?: (stateName: string, data?: StateData) => void;
99
+ /** Fired when mouse leaves a state */
100
+ onStateLeave?: () => void;
101
+ /** Fired when a marker is clicked */
102
+ onMarkerClick?: (marker: MarkerData) => void;
103
+ };
104
+
105
+ declare const IndiaMap: React$1.FC<IndiaMapProps>;
106
+
107
+ type LegendProps = {
108
+ /** Label for minimum value */
109
+ minLabel?: string | number;
110
+ /** Label for maximum value */
111
+ maxLabel?: string | number;
112
+ /** Low end hex color (must match choroplethLow on IndiaMap) */
113
+ lowColor?: string;
114
+ /** High end hex color (must match choroplethHigh on IndiaMap) */
115
+ highColor?: string;
116
+ /** Legend title */
117
+ title?: string;
118
+ /** Container style */
119
+ style?: React$1.CSSProperties;
120
+ /** Container className */
121
+ className?: string;
122
+ };
123
+ declare const Legend: React$1.FC<LegendProps>;
124
+
125
+ export { type GeoType, IndiaMap, type IndiaMapProps, Legend, type MarkerData, type StateData, type TooltipPosition };
@@ -0,0 +1,125 @@
1
+ import React$1 from 'react';
2
+
3
+ type StateData = {
4
+ /** Value to drive color scale (choropleth) */
5
+ value?: number;
6
+ /** Custom fill color for this state */
7
+ color?: string;
8
+ /** Any extra metadata you want back in callbacks */
9
+ [key: string]: unknown;
10
+ };
11
+ type MarkerData = {
12
+ /** Unique key */
13
+ id: string;
14
+ /** Display label shown below the marker pin */
15
+ label: string;
16
+ /** Longitude */
17
+ lng: number;
18
+ /** Latitude */
19
+ lat: number;
20
+ /** Custom color for this marker (default: red) */
21
+ color?: string;
22
+ /** Any extra metadata */
23
+ [key: string]: unknown;
24
+ };
25
+ type TooltipPosition = {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ type GeoType = {
30
+ id: string;
31
+ rsmKey: string;
32
+ properties: {
33
+ ST_NM?: string;
34
+ NAME_1?: string;
35
+ [key: string]: unknown;
36
+ };
37
+ };
38
+ type IndiaMapProps = {
39
+ /**
40
+ * Per-state data map: key = state name (matches ST_NM in TopoJSON),
41
+ * value = StateData object.
42
+ *
43
+ * @example
44
+ * stateData={{ "Maharashtra": { value: 120, color: "#4ade80" } }}
45
+ */
46
+ stateData?: Record<string, StateData>;
47
+ /** Array of map markers (pins) to render */
48
+ markers?: MarkerData[];
49
+ /** Default fill color for all states */
50
+ fillColor?: string;
51
+ /** Fill color on hover */
52
+ hoverColor?: string;
53
+ /** Fill color of currently selected state */
54
+ selectedColor?: string;
55
+ /** Stroke (border) color between states */
56
+ strokeColor?: string;
57
+ /** Stroke width between states */
58
+ strokeWidth?: number;
59
+ /**
60
+ * Enable choropleth coloring driven by stateData[state].value.
61
+ * Requires stateData with numeric `value` fields.
62
+ * Colors interpolate between choroplethLow and choroplethHigh.
63
+ */
64
+ enableChoropleth?: boolean;
65
+ /** Low-end color for choropleth scale (default: "#dbeafe") */
66
+ choroplethLow?: string;
67
+ /** High-end color for choropleth scale (default: "#1d4ed8") */
68
+ choroplethHigh?: string;
69
+ /**
70
+ * Controlled selected state. Pass null to deselect.
71
+ * If omitted, the component manages selection internally.
72
+ */
73
+ selectedState?: string | null;
74
+ /** Allow multiple states to be selected at once */
75
+ multiSelect?: boolean;
76
+ /** Disable all mouse interactions */
77
+ disabled?: boolean;
78
+ /** Enable scroll-wheel zoom and drag-to-pan */
79
+ enableZoom?: boolean;
80
+ /** Minimum zoom scale multiplier (default: 1) */
81
+ minZoom?: number;
82
+ /** Maximum zoom scale multiplier (default: 8) */
83
+ maxZoom?: number;
84
+ /** Show a tooltip on hover */
85
+ showTooltip?: boolean;
86
+ /**
87
+ * Custom tooltip renderer. Receives state name + any stateData for it.
88
+ * Return a React node.
89
+ */
90
+ tooltipContent?: (stateName: string, data?: StateData) => React.ReactNode;
91
+ /** Container style */
92
+ style?: React.CSSProperties;
93
+ /** Container className */
94
+ className?: string;
95
+ /** Fired when a state is clicked */
96
+ onStateClick?: (stateName: string, data?: StateData) => void;
97
+ /** Fired when mouse enters a state */
98
+ onStateHover?: (stateName: string, data?: StateData) => void;
99
+ /** Fired when mouse leaves a state */
100
+ onStateLeave?: () => void;
101
+ /** Fired when a marker is clicked */
102
+ onMarkerClick?: (marker: MarkerData) => void;
103
+ };
104
+
105
+ declare const IndiaMap: React$1.FC<IndiaMapProps>;
106
+
107
+ type LegendProps = {
108
+ /** Label for minimum value */
109
+ minLabel?: string | number;
110
+ /** Label for maximum value */
111
+ maxLabel?: string | number;
112
+ /** Low end hex color (must match choroplethLow on IndiaMap) */
113
+ lowColor?: string;
114
+ /** High end hex color (must match choroplethHigh on IndiaMap) */
115
+ highColor?: string;
116
+ /** Legend title */
117
+ title?: string;
118
+ /** Container style */
119
+ style?: React$1.CSSProperties;
120
+ /** Container className */
121
+ className?: string;
122
+ };
123
+ declare const Legend: React$1.FC<LegendProps>;
124
+
125
+ export { type GeoType, IndiaMap, type IndiaMapProps, Legend, type MarkerData, type StateData, type TooltipPosition };