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

@arraypress/currency-picker-astro

v1.0.1

Published

Astro frontend currency picker — auto-detects from navigator.language, persists choice, rewrites every [data-price-original] on the page.

Readme

@arraypress/currency-picker-astro

Astro frontend currency picker for static / SSG stores. Auto-detects the user's likely currency from navigator.language, persists choice to localStorage, rewrites every [data-price-original] element on the page on change.

The picker is a reference converter — checkout always charges in your store's native currency. Surface that disclaimer in your own copy so buyers aren't surprised.

Install

npm install @arraypress/currency-picker-astro

Use

---
import { CurrencyPicker } from '@arraypress/currency-picker-astro';
import { defaultCurrencies, defaultLocaleMap } from '@arraypress/currency-picker-astro/presets';
---
<footer>
  <CurrencyPicker
    currencies={defaultCurrencies}
    localeToCurrency={defaultLocaleMap}
  />
</footer>

Or supply your own rate table (recommended for production — keep the rates accurate to within ~24 hours):

<CurrencyPicker
  currencies={[
    { code: 'GBP', symbol: '£', label: 'British Pound (£)', rate: 1.00 },
    { code: 'USD', symbol: '$', label: 'US Dollar ($)',      rate: 1.27 },
    { code: 'EUR', symbol: '€', label: 'Euro (€)',           rate: 1.18 },
    /* … */
  ]}
  localeToCurrency={{ 'en-US': 'USD', 'fr-FR': 'EUR', /* … */ }}
/>

The first entry's code is the base currency. Every rate is expressed as 1 base = rate × other. So with 'GBP' first, 'USD' rate 1.27 means £1 = $1.27.

DOM contract

Annotate every price you want converted:

<span
  data-price-original={price}
  data-price-currency="GBP"
  class="price"
>£{price}</span>
  • data-price-original — raw numeric value in data-price-currency.
  • data-price-currency — ISO-4217 code. Optional — defaults to the base currency if missing.

Elements without data-price-original are skipped. Migrate gradually.

Reactive updates

When your page mutates prices client-side (variation selectors, quantity steppers, etc.), dispatch the refresh event after the swap:

document.dispatchEvent(new CustomEvent('wg:prices-updated'));

The picker re-runs the conversion pass so the new values land in the active currency.

Events

document.addEventListener('currencychange', (e) => {
  console.log('user picked', e.detail.code); // 'USD' | 'EUR' | …
});

Fires after every user-driven change. Auto-detection on first load does not fire this event.

Props

| Prop | Default | Description | |--------------------|--------------------|-------------------------------------------------------------------| | currencies | required | Currency list. First entry is the base. | | localeToCurrency | {} | BCP-47 locale → currency code. Powers navigator.language detect.| | storageKey | 'ap-currency' | localStorage key for persistence. | | variant | 'footer' | 'footer' opens up, 'header' opens down. | | class | — | Extra classes on the trigger button. | | label | 'Choose currency'| aria-label for the trigger. |

Styling

The component ships no styles — it only emits class hooks so you can theme it however you like. Hook against these:

.cp-root          { /* wrapper */ }
.cp-trigger       { /* button */ }
.cp-icon, .cp-caret
.cp-panel         { /* dropdown */ }
.cp-panel--up
.cp-panel--down
.cp-panel[data-open="true"]   { /* visible state */ }
.cp-option        { /* menu row */ }
.cp-option-code, .cp-option-label

Most theme stylesheets already define equivalents — drop your own selectors next to the rest of your design tokens.

License

MIT