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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mwid/react-country-picker

v0.1.0

Published

<p float="left"> <img src="./assets/search.png" width="44%" align="middle" /> <img src="./assets/demo.gif" width="49%" align="middle" /> </p>

Downloads

1

Readme

🌐 React Country Picker

A country picker component with real-time autocomplete, built with React.

Installation

# npm
npm install @mwid/react-country-picker

# Yarn
yarn add @mwid/react-country-picker

# pnpm
pnpm add @mwid/react-country-picker

Usage

Import:

// TypeScript / ESModules
import { CountryPicker } from "@mwid/react-country-picker";

// CommonJS
const { CountryPicker } = require("@mwid/react-country-picker");

Create a callback for when a country is selected:

const onSelect = useCallback(() => {
	// Do something
}, []);

Add the CountryPicker component to your JSX:

<CountryPicker onSelect={onSelect} />

Props

| Property | Type | Default | Description | | ---------- | ---------------------------- | ------- | -------------------------------------------------------- | | onSelect | (country: Country) => void | | Called when a country is selected from the country list. |

Where Country is:

interface Country {
	officialName: string;
	commonName: string;
	flagSvgUrl: string;
}

Architecture

Project Structure

| src/ | Description | | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | api | All API requests and their request and response body interfaces.Each request should be prefixed with its HTTP method (Eg, GET /countries/all -> getAllCountries) and their request/responses named similarly (Eg, getAllCountriesRequest and getAllCountriesResponse). | | components | React components.Each component resides in its own directory, and sub-components that only it uses are nested under it.Storybook stories are placed in component.stories.tsx, unit tests are placed in component.test.tsx and styled-components primitives are placed in component.style.tsx. | | config | Configuration-related items (that may be changed via environment variables) and constant values. | | hooks | Custom hooks shared across the entire component. | | lib | Re-exports of library functions and factories. Eg, create a database connection instance. | | slices | Redux state slices.Actions are placed in slice.actions.ts, reducers are placed in slice.reducer.ts, selectors are placed in slice.selectors.ts and entity adapters are placed in entity.entity.ts. | | test | Test-specific configuration and setup.Fixtures define unchanging mock data used across multiple tests. | | types | TypeScript types used across the component to define a contract on the structure of data. | | utils | Reusable utility functions and types. |

Technology

Tooling

Front-end

Local Development

Install Node:

curl -L https://git.io/n-install | bash
n auto

Install dependencies:

npm i

Run unit and integration tests:

npm t

Develop in Storybook:

npm run storybook

Build for production:

npm run build

npm Scripts

| Script | Description | | ----------------- | ------------------------------------------ | | build | Build code for production with TypeScript. | | format:check | Check all code formatting with Prettier. | | format:write | Fix all code formatting with Prettier. | | lint | Lint all code with ESLint. | | test | Run all unit and integration tests. | | storybook | Start the Storybook development server. | | storybook:build | Build Storybook for publishing. |

License

This project is licensed under the MIT license.