npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ef2/store-locator

v0.9.2

Published

A fully customizable **Google Maps Store Locator** built for Next.js and React. Supports: ✅ **Custom Components** (List, Map, Markers, Panels) ✅ **Dynamic Clustering** with customizable colors ✅ **Context & Hooks** for extending behavior ✅ **TypeS

Readme

📍 Store Locator

A fully customizable Google Maps Store Locator built for Next.js and React. Supports:
Custom Components (List, Map, Markers, Panels)
Dynamic Clustering with customizable colors
Context & Hooks for extending behavior
TypeScript Support for full type safety
Next.js App Router (SSR-Compatible)


🚀 Installation

npm install @ef2/store-locator
# or
yarn add @ef2/store-locator

🛠️ Basic Usage

Import and use the StoreLocator component in your Next.js App Router.

import { StoreLocator } from "@ef2/store-locator";
import locationsData from "../public/data.json";

const formattedLocations = locationsData.map((location) => ({
	position: { lat: location.position.lat, lng: location.position.lng },
	slug: location.slug || "",
	name: location.name || "",
	city: location.city || "",
	postalCode: location.postalCode || "",
	street: location.street || "",
	phone: location.phone || "",
	email: location.email || "",
	image: location.image || "",
}));

export default function Page() {
	return (
		<StoreLocator
			translations={{
				panelTitle: "In de buurt",
				locationQuantity: "locatie",
				locationQuantity_plural: "locaties",
				placeholder: "Zoek op een plaats",
			}}
			mapOptions={{
				defaultZoom: 8,
				defaultCenter: { lat: 52.370216, lng: 4.895168 },
				mapStyle: {
					mapTypeId: "roadmap",
					renderingType: "RASTER",
					mapId: "71c741f5368dc7b2",
				},
			}}
			apiKey={process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY || ""}
			locations={formattedLocations}
			cluster={{
				fillColor: "#000",
				fillOpacity: 0.7,
				strokeWeight: 2,
				strokeColor: "#ffffff",
				textColor: "#000000",
			}}
		/>
	);
}

🎨 Customizing Components

Every part of the StoreLocator component can be overridden using the components prop.

Example: Override the List Component

import CustomList from "./CustomList";

export default function Page() {
	return (
		<StoreLocator
			locations={formattedLocations}
			components={{
				List: CustomList, // ✅ Use custom list component
			}}
		/>
	);
}

Example: Override the SelectedLocation Component

import SelectedLocationTest from "./SelectedLocationTest";

export default function Page() {
	return (
		<StoreLocator
			locations={formattedLocations}
			components={{
				SelectedLocation: SelectedLocationTest, // ✅ Custom selected location UI
			}}
		/>
	);
}

📦 Component Structure

StoreLocator is modular, meaning you can swap components as needed.

| Component | Description | |--------------------|--------------------------------------------------------| | StoreLocator | The main component, includes map, panel, and controls. | | Map | Renders the Google Map. | | Marker | Customizable store location markers. | | Markers | Wrapper for all markers, supports clustering. | | Panel | Sidebar for location results. | | List | Displays locations in a list view. | | PanelTop | The top section of the panel with search/autocomplete. | | SelectedLocation | The UI shown when a location is selected. |


🌍 Multi-Language Support

<StoreLocator
	translations={{
		panelTitle: "Near You",
		locationQuantity: "location",
		locationQuantity_plural: "locations",
		placeholder: "Search for a place",
	}}
/>

🚀 Performance Optimizations

  • Tree-shakable – Only the components you use are included.
  • Lazy-loaded Google Maps – Ensures fast page load times.
  • Uses Context for global state – No unnecessary re-renders.

📦 Importing Individual Hooks & Components

import { useStoreLocator, useStoreLocatorContext } from "@ef2/store-locator/hooks";
import { StoreLocatorProvider } from "@ef2/store-locator/contexts";
import { Location } from "@ef2/store-locator/types";

🛠️ Roadmap

  • 🔹 Improve SSR support for React Server Components
  • 🔹 More customization for clustering and marker icons
  • 🔹 Better accessibility for screen readers

📜 License

This project is licensed under the MIT License.


🙌 Contributing

Want to contribute? Open an issue or submit a PR! 🚀


💬 Questions?

For questions or support, feel free to ask!