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

react-mac-finder

v1.0.0

Published

A picker of react component look like mac finder.

Downloads

49

Readme

react-mac-finder

Build Status Codecov Dependency Status

NPM Version NPM Downloads

A picker of react component look like mac finder.

暂无简体中文文档

Demo link

https://ruoru.github.io/react-mac-finder

Support environment

  • browser.

Applicable scene

  1. Must have a certain size parent element that wraps the component;
  2. If there are both used selectIndexs array and value, the value are used first, followed by the selectIndexs, and then is defaultValue. Finally, I do not recommend using selectIndexs and value at the same time.
  3. Now can't scroll horizontally;
  4. When you use value, make sure that each option has a value;

Remaining problem

  1. If you find it, please give me an issue;

Interface design

| property name | description | type | default | | ---------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------- | | data * | The data of this component. | Array | [] | | dataKeys | The alias of the data key. | Object | {text: 'text', value: 'value', disable: 'disable', child: 'child'} | | defaultSelectIndexs | The default selection index of data. | Array | - | | selectIndexs | Forces the selection of data by index. If value exists, selectIndexs fails. | Array | - | | value | Forces select same value item of data. | String | Number | - | | onChange | Callback method, each time you change the selected value will run of the method. | Function (value, isEnd, selectIndexs) | - | | disabled | ReadOnly the component value. | Bool | false |

Install

npm install --save react-mac-finder

Example Code

Finder demo code

import React, { Component } from "react";
import { Finder } from "react-mac-finder";

class Finder extends Component {
  constructor(props) {
    super(props);

    this.state = {
      selectIndexs: [],
      value: null,
      isEnd: true,
      data: [
        {
          text: "A1",
          value: "A1",
          child: [
            {
              text: "A11",
              value: "A11",
              child: [
                {
                  text: "A111",
                  value: "A111"
                },
                {
                  text: "A112",
                  value: "A112"
                },
                {
                  text: "A113",
                  value: "A113"
                },
                {
                  text: "A114",
                  value: "A114"
                },
                {
                  text: "A115",
                  value: "A115"
                },
                {
                  text: "A116",
                  value: "A116"
                }
              ]
            },
            {
              text: "A12",
              value: "A12"
            },
            {
              text: "A13",
              value: "A13"
            },
            {
              text: "A14",
              value: "A14"
            },
            {
              text: "A15",
              value: "A15"
            }
          ]
        },
        {
          text: "B1",
          value: "B1",
          disable: true,
          child: [
            {
              text: "B11",
              value: "B11",
              child: [
                {
                  text: "B111",
                  value: "B111"
                },
                {
                  text: "B112",
                  value: "B112"
                },
                {
                  text: "B113",
                  value: "B113"
                }
              ]
            },
            {
              text: "B12",
              value: "B12"
            },
            {
              text: "B13",
              value: "B13"
            }
          ]
        },
        {
          text: "C1",
          value: "C1",
          child: [
            {
              text: "C11",
              value: "C11",
              child: [
                {
                  text: "C111",
                  value: "C111"
                },
                {
                  text: "C112",
                  value: "C112",
                  child: [],
                },
                {
                  text: "C113",
                  value: "C113"
                },
                {
                  text: "C114",
                  value: "C114"
                },
                {
                  text: "C115",
                  value: "C115"
                },
                {
                  text: "C116",
                  value: "C116"
                }
              ]
            },
            {
              text: "C12",
              value: "C12",
              disable: true,
              child: [
                {
                  text: "C121",
                  value: "C121"
                }
              ],
            },
            {
              text: "C13",
              value: "C13"
            },
            {
              text: "C14",
              value: "C14"
            },
            {
              text: "C15",
              value: "C15"
            }
          ]
        },
      ]
    };
  }

  render() {
    const { data, selectIndexs, value, isEnd } = this.state;
    return (
      <>
        <div className="finder-demo">
          <Finder
            value={value}
            data={data}
            onChange={(value, isEnd, selectIndexs) => {
              this.setState({ value, isEnd, selectIndexs });
            }}
          />
        </div>

        <ul className="value-list">
          <li>selectIndexs: {selectIndexs.join(",")}</li>
          <li>
            value:
            <input
              value={value}
              onChange={e => this.setState({ value: e.target.value })}
            />
          </li>
          <li>isEndNode: {`${isEnd}`}</li>
        </ul>
      </>
    );
  }
}
export default Finder;

Local development

$ git clone https://github.com/ruoru/react-mac-finder.git
$ cd react-mac-finder
$ npm install
$ npm start