ethiopia-map 0.1.4

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,12 @@
1
+ import "./styles.css";
2
+ export { EthiopiaMap, EthiopiaMapSurface, useSelectedRegionId, type EthiopiaMapSurfaceProps, } from "./components/EthiopiaMap";
3
+ export { EthiopiaMapLegend } from "./components/EthiopiaMapLegend";
4
+ export { EthiopiaLocationsPanel } from "./components/EthiopiaLocationsPanel";
5
+ export { EthiopiaRegionServicesCard, type EthiopiaRegionServicesCardProps, } from "./components/EthiopiaRegionServicesCard";
6
+ export { EthiopiaRegionServicesPanel, type EthiopiaRegionServicesPanelProps, } from "./components/EthiopiaRegionServicesPanel";
7
+ export { EthiopiaSelectedRegionCard } from "./components/EthiopiaSelectedRegionCard";
8
+ export { EthiopiaMapProvider, EthiopiaMapRoot, useEthiopiaMap, } from "./context";
9
+ export { defaultLocations, defaultRegionData, defaultRegionServiceStats, } from "./data/defaultData";
10
+ export { regionPathMap, type RegionPathMapping } from "./data/regionPaths";
11
+ export { ETHIOPIA_AUTO_TOUR_SEQUENCE, ETHIOPIA_REGION_IDS } from "./types";
12
+ export type { AutoTourStep, ComparisonDirection, ComparisonOutcome, EthiopiaLocationsPanelProps, EthiopiaMapConfig, EthiopiaMapHandle, EthiopiaMapLayer, EthiopiaMapLegendProps, EthiopiaMapProps, EthiopiaMapProviderProps, EthiopiaMapSelection, EthiopiaRegionId, EthiopiaServiceRowsIncrementalConfig, EthiopiaSelectedRegionCardProps, EthiopiaTheme, EthiopiaViewMode, ExportVideoOptions, LatLngLocation, PartialRegionRecord, RegionDatum, RegionRecord, RegionSummaryStat, RegionServiceStats, SelectionAnimationMode, ServiceComparison, ServiceStat, ServiceValueKind, } from "./types";
@@ -0,0 +1,137 @@
1
+ import type { CSSProperties, ReactNode } from "react";
2
+ export declare const ETHIOPIA_AUTO_TOUR_SEQUENCE: readonly ["afar", "tigray", "amhara", "benishangul-gumuz", "gambela", "south-west-ethiopia", "south-ethiopia", "sidama", "central-ethiopia", "addis-ababa", "dire-dawa", "harari", "somali", "oromia", null];
3
+ export declare const ETHIOPIA_REGION_IDS: readonly ["tigray", "afar", "amhara", "benishangul-gumuz", "gambela", "south-west-ethiopia", "central-ethiopia", "sidama", "south-ethiopia", "oromia", "addis-ababa", "somali", "dire-dawa", "harari"];
4
+ export type EthiopiaRegionId = (typeof ETHIOPIA_REGION_IDS)[number];
5
+ export type EthiopiaTheme = "light" | "dark";
6
+ export type EthiopiaMapLayer = "regions" | "heat" | "terrain";
7
+ export type EthiopiaViewMode = "map" | "bars";
8
+ export type SelectionAnimationMode = "pulse" | "static" | "none" | "outline";
9
+ export type AutoTourStep = EthiopiaRegionId | null;
10
+ export type ServiceValueKind = "number" | "percent";
11
+ export type ComparisonDirection = "increase" | "decrease" | "none";
12
+ export type ComparisonOutcome = "positive" | "negative" | "neutral";
13
+ export type RegionRecord<T> = Record<EthiopiaRegionId, T>;
14
+ export type PartialRegionRecord<T> = Partial<Record<EthiopiaRegionId, T>>;
15
+ export interface RegionDatum {
16
+ name: string;
17
+ value: number;
18
+ trend?: string;
19
+ copy?: string;
20
+ color?: string;
21
+ summaryStats?: readonly RegionSummaryStat[];
22
+ }
23
+ export interface RegionSummaryStat {
24
+ label: string;
25
+ value: string | number | null;
26
+ }
27
+ export interface ServiceComparison {
28
+ enabled: true;
29
+ percent: number;
30
+ period: string;
31
+ direction: ComparisonDirection;
32
+ outcome: ComparisonOutcome;
33
+ }
34
+ export interface ServiceStat {
35
+ label: string;
36
+ valueKind: ServiceValueKind;
37
+ value: number;
38
+ unit?: string;
39
+ comparison?: ServiceComparison | null;
40
+ }
41
+ export type RegionServiceStats = PartialRegionRecord<readonly ServiceStat[]>;
42
+ export interface EthiopiaServiceRowsIncrementalConfig {
43
+ enabled?: boolean;
44
+ initialCount?: number;
45
+ step?: number;
46
+ thresholdPx?: number;
47
+ showMoreFallback?: boolean;
48
+ animateNewRows?: boolean;
49
+ rowAnimationDelayMs?: number;
50
+ rowAnimationDurationMs?: number;
51
+ sentinelVisible?: boolean;
52
+ }
53
+ export interface LatLngLocation {
54
+ id?: string | number;
55
+ name?: string;
56
+ region?: EthiopiaRegionId | string;
57
+ lat: number;
58
+ lng: number;
59
+ category?: string;
60
+ color?: string;
61
+ radius?: number;
62
+ intensity?: number;
63
+ }
64
+ export interface EthiopiaMapSelection {
65
+ regionId: EthiopiaRegionId | null;
66
+ region: RegionDatum | null;
67
+ }
68
+ export interface EthiopiaMapConfig {
69
+ theme?: EthiopiaTheme;
70
+ layer?: EthiopiaMapLayer;
71
+ defaultLayer?: EthiopiaMapLayer;
72
+ onLayerChange?: (layer: EthiopiaMapLayer) => void;
73
+ viewMode?: EthiopiaViewMode;
74
+ selectionAnimation?: SelectionAnimationMode;
75
+ showLabels?: boolean;
76
+ showMarkers?: boolean;
77
+ showInMapStats?: boolean;
78
+ autoTour?: boolean;
79
+ autoTourSequence?: readonly AutoTourStep[];
80
+ autoTourIntervalMs?: number;
81
+ regionColors?: PartialRegionRecord<string>;
82
+ }
83
+ export interface EthiopiaMapProviderProps extends EthiopiaMapConfig {
84
+ data: RegionRecord<RegionDatum>;
85
+ serviceStats?: RegionServiceStats;
86
+ locations?: readonly LatLngLocation[];
87
+ selectedRegionId?: EthiopiaRegionId | null;
88
+ defaultSelectedRegionId?: EthiopiaRegionId | null;
89
+ onRegionSelect?: (selection: EthiopiaMapSelection) => void;
90
+ children: ReactNode;
91
+ }
92
+ export interface EthiopiaMapProps extends Omit<EthiopiaMapProviderProps, "children"> {
93
+ className?: string;
94
+ style?: CSSProperties;
95
+ svgText?: string;
96
+ svgUrl?: string;
97
+ terrainImageUrl?: string;
98
+ inMapStatsClassName?: string;
99
+ inMapStatsStyle?: CSSProperties;
100
+ inMapStatsListClassName?: string;
101
+ inMapStatsListStyle?: CSSProperties;
102
+ inMapStatsEmptyText?: string;
103
+ incrementalRows?: EthiopiaServiceRowsIncrementalConfig;
104
+ showLayerControl?: boolean;
105
+ layerControlClassName?: string;
106
+ layerControlLabels?: Partial<Record<"regions" | "terrain", string>>;
107
+ }
108
+ export interface ExportVideoOptions {
109
+ regionId?: EthiopiaRegionId;
110
+ }
111
+ export interface EthiopiaMapHandle {
112
+ exportPNG: (filename?: string) => Promise<void>;
113
+ exportJPG: (filename?: string) => Promise<void>;
114
+ exportVideo: (filename?: string, options?: ExportVideoOptions) => Promise<void>;
115
+ }
116
+ export interface EthiopiaMapLegendProps {
117
+ className?: string;
118
+ title?: string;
119
+ kicker?: string;
120
+ maxItems?: number;
121
+ onRegionClick?: (regionId: EthiopiaRegionId) => void;
122
+ }
123
+ export interface EthiopiaSelectedRegionCardProps {
124
+ className?: string;
125
+ emptyTitle?: string;
126
+ emptyCopy?: string;
127
+ showStats?: boolean;
128
+ previewSelectionAnimation?: SelectionAnimationMode;
129
+ summaryStats?: (selection: EthiopiaMapSelection) => readonly RegionSummaryStat[];
130
+ renderPreview?: (selection: EthiopiaMapSelection) => ReactNode;
131
+ }
132
+ export interface EthiopiaLocationsPanelProps {
133
+ className?: string;
134
+ title?: string;
135
+ kicker?: string;
136
+ showMarkerToggle?: boolean;
137
+ }
@@ -0,0 +1,5 @@
1
+ import type { EthiopiaRegionId, RegionRecord, RegionDatum } from "../types";
2
+ export declare function maxRegionValue(data: RegionRecord<RegionDatum>): number;
3
+ export declare function regionFill(regionId: EthiopiaRegionId, data: RegionRecord<RegionDatum>, overrides: Partial<Record<EthiopiaRegionId, string>>): string;
4
+ export declare function formatServiceValue(value: number, valueKind: "number" | "percent"): string;
5
+ export declare function formatCompactValue(value: string | number | null | undefined): string;
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "ethiopia-map",
3
+ "version": "0.1.4",
4
+ "description": "Interactive Ethiopian map components for React and Next.js applications.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "sideEffects": [
8
+ "**/*.css"
9
+ ],
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "main": "./dist/ethiopia-map.umd.cjs",
15
+ "module": "./dist/ethiopia-map.js",
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "import": "./dist/ethiopia-map.js",
21
+ "require": "./dist/ethiopia-map.umd.cjs"
22
+ },
23
+ "./react": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/ethiopia-map.js",
26
+ "require": "./dist/ethiopia-map.umd.cjs"
27
+ },
28
+ "./styles.css": "./dist/ethiopia-map.css"
29
+ },
30
+ "peerDependencies": {
31
+ "react": ">=18",
32
+ "react-dom": ">=18"
33
+ },
34
+ "scripts": {
35
+ "dev": "vite --host 0.0.0.0 --port 5174 --strictPort",
36
+ "build": "vite build && tsc -p tsconfig.build.json",
37
+ "typecheck": "tsc --noEmit",
38
+ "prepublishOnly": "npm run typecheck && npm run build"
39
+ },
40
+ "keywords": [
41
+ "ethiopia",
42
+ "ethiopian",
43
+ "ethiopia map",
44
+ "ethiopian map",
45
+ "react ethiopia map",
46
+ "react ethiopian map",
47
+ "interactive ethiopia map",
48
+ "svg map",
49
+ "ethiopia svg map",
50
+ "react map",
51
+ "react component",
52
+ "typescript",
53
+ "gis",
54
+ "ethio-map-kit"
55
+ ],
56
+ "dependencies": {}
57
+ }