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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@smg-automotive/filters

v2.5.2

Published

Shared filter hooks, types and utilities

Readme

filters-pkg

Usage

pnpm add @smg-automotive/filters

Reference data and search configuration

Range filters (e.g. mileage, price) use slider scales from search-configuration data. Checkbox filters use per–vehicle-category reference data (fuel types, body types, etc.).

Apps fetch this data at build time, write JSON, and pass the result into FilterProvider as histogramRanges and referenceData. In automotive-web, listings-web uses @smg-automotive/build-data-prefetch for Node-safe build prefetch.

| Option | Type | Source | Description | |--------|------|--------|-------------| | histogramRanges | HistogramRanges | Build-time JSON | Search configuration for range filters. | | referenceData | ReferenceData | Build-time JSON | Per–vehicle-category reference data for checkbox filters. |

i18n setup (translations)

The package does not load or bundle translations. Your app uses @smg-automotive/i18n-pkg and passes the t function from useI18n() into FilterProvider. All filter-related keys live under the filtersPkg namespace.

Import the package translation files into your project dictionary so the filtersPkg namespace is available. Merge each locale’s object under a filtersPkg key in the dictionary you pass to I18nProvider. Then t('filtersPkg.mileage'), t('filtersPkg.from'), etc. will resolve.

Use the /translations subpath so that React and client-only code are not loaded (e.g. in server components or RSC):

import {
  filterTranslationsDe,
  filterTranslationsEn,
  filterTranslationsFr,
  filterTranslationsIt,
} from '@smg-automotive/filters/translations';

// Merge into your existing locale dictionaries, e.g.:
// dictionary.de.filtersPkg = filterTranslationsDe;
// dictionary.en.filtersPkg = filterTranslationsEn;
// ...

If you are not in a server/RSC context, you can instead import from the main entry: import { filterTranslations } from '@smg-automotive/filters'.

FilterProvider

Wrap your filter tree with FilterProvider and pass t, brand, histogramRanges, referenceData, and language. Do this inside a component that is already under I18nProvider. Pass build-time JSON as histogramRanges and referenceData. Pass the current locale as language (e.g. from useI18n().language).

| Prop | Type | Required | Description | |------|------|----------|-------------| | t | TFunction | Yes | Translation function from useI18n() (or equivalent). | | brand | Brand | Yes | Current brand (e.g. AutoScout24, MotoScout24). | | histogramRanges | HistogramRanges | Yes | Search configuration for range filters; from build-time JSON. | | referenceData | ReferenceData | Yes | Per–vehicle-category reference data (fuel types, body types, etc.). Used by checkbox filters. | | language | Language | Yes | Current UI language ('de', 'en', 'fr', or 'it'). Used for sorting and display. | | geoLocationLookup | GeoLocationLookup | No | Search and bulk lookup implementation required by useLocationAndRadiusFilter. |

import { FilterProvider } from '@smg-automotive/filters';

import { useI18n } from '../i18n';
import {
  searchConfiguration as histogramRanges,
  referenceData,
} from '../prefetchedData';
import { useBrand } from '../useBrand';

function FilterLayout() {
  const { t, language } = useI18n();
  const brand = useBrand();

  return (
    <FilterProvider
      t={t}
      brand={brand}
      histogramRanges={histogramRanges}
      referenceData={referenceData}
      language={language}
    >
      <YourFilterUI />
    </FilterProvider>
  );
}

Development

pnpm nx run @smg-automotive/filters:package:build
pnpm nx run @smg-automotive/filters:test
pnpm nx run @smg-automotive/filters:lint

Within the monorepo, apps should depend on the package with workspace:* and consume the package source directly. Published packages use the built dist entrypoints declared in publishConfig.

Release a new version

This package is released from the automotive-web monorepo. See the semantic release convention for release behavior and commit message requirements.