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

react-select-pinyin

v0.8.1

Published

React 选择控件(支持拼音搜索)

Readme

React 选择控件(支持拼音搜索)

Build Status


JedWatsonreact-select 挺好用,但是不支持拼音搜索。

react-select-pinyin 基于 react-select 开发,添加了如下特性:

  • 支持输入全拼匹配(如 beijingshi, beijing, beij, b 会匹配北京市)
  • 支持输入首字母匹配(如 bjs, bj, b 会匹配北京市)
  • 支持非开始位置的匹配(如 jingshi, ijins, eij 会匹配北京市)
  • 不支持子串匹配(如 beishi 不会匹配北京市)

Live Demo

http://xcatliu.github.io/react-select-pinyin/

使用方式

CommonJS

若你的项目是基于 CommonJS 风格的,则直接 require 使用即可,具体的 api 和 react-select 一样:

var Select = require('react-select-pinyin');

var options = [
  { value: '110100', label: '北京市' },
  { value: '120100', label: '天津市' }
];

function logChange(val) {
  console.log("选择了: " + val);
}

<Select
  name="form-field-name"
  value="one"
  options={options}
  onChange={logChange}
/>

默认的 css 在 lib/default.css 中,请按照你项目中插入 css 的方式自行取用。

AMD

暂不支持

直接在 script 标签中引入

暂不支持

更多使用方式

更多使用方式请参考:react-select#usage

开发

clone 之后,进入本项目,执行:

npm install
npm start

打开 http://localhost:8000 查看示例。

编辑 srcexample 进行开发。

发布新版本流程

  1. 执行 npm run lint 执行 eslint 检查
  2. 执行 npm run prepublishsrc 中的 jsx 编译成 lib 中的 js,并且会复制 react-select 中的 css 到 lib
  3. 执行 npm version [<newversion> | major | minor | patch | prerelease | preminor | premajor ] 升级版本号
  4. 执行 git push && git push --tags 提交到 GitHub
  5. 执行 npm publish 发布到 npmjs.com
  6. 执行 npm run gh-pages 更新 gh-pages 分支