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

austin-generic-react-micro-components

v1.2.7

Published

___ 1. `Avatar` 2. `Btn` 3. `DatePicker` note implemented using [react-datepicker](https://www.npmjs.com/package/react-datepicker) npm packages [DOCS here](https://reactdatepicker.com/) 4. `TimePicker` 5. `Dropdown` Select (multiselect using chips/ta

Downloads

11

Readme

austin-generic-react-micro-components

Available components


  1. Avatar
  2. Btn
  3. DatePicker note implemented using react-datepicker npm packages DOCS here
  4. TimePicker
  5. Dropdown Select (multiselect using chips/tags)
  6. AsyncDropdown Select fetch options async (multiselect using chips/tags)
  7. Custom colorful multi select chips + Custom avatar select/multiselect
  8. Loading
  9. Popup
  10. InputText with label
  11. Login form (with remember me)

Usage


<Dropdown

<Dropdown
    isMulti={true} // is multiselect
    options={[
        {
            label: 'Normal', 
            value: 'normal'
        },
        {
            label: 'With Data', 
            value: 'with data', 
            dataAttr: [
                {attr: 'test', value: 'on select get back'}
            ]
        },
        {
            label: 'Color when multiselect only', 
            value: 'color', 
            color: ['#000', '#fff']
        },
        {
            label: 'Show color in dropdown list', 
            value: 'color2', 
            color: ['red', '#fff', "true"]},
        {
            label: 'Avatar', 
            value: 'avatar', 
            avatar: 'https://some/image.png'
        },
        {
            label: 'Avatar with color', 
            value: 'avatar with color', 
            avatar: 'https://some/image.png', 
            color: ['green', '#fff', "true"]
        },
    ]}
    onChange={(selection: IDropdownOption[]) => {
        console.log('Selection = ', selection)
    }}
/>

All props

interface IDropdownProps {
    options: IDropdownOption[];
    onChange?(selection: IDropdownOption[]): any;
    selected?: IDropdownOption[];
    placeholder?: string;
    isMulti?: boolean;
    isDisabled?: boolean;
    debouneTime?: number;
}

<AsyncDropdown

This is to be used when the options are NOT predefined and they need to filled asynchronously The construct is same as Dropdown component except the props are as slightly different :

interface IAsyncDropdownProps {
    initialOptions?: IDropdownOption[]; // options
    promise: (input: string) => Promise<IDropdownOption[]>;
    onChange?(selection: IDropdownOption[]): any;
    selected?: IDropdownOption[];
    placeholder?: string;
    isMulti?: boolean;
    hideMultiTags?: boolean;
    isDisabled?: boolean;
    debouneTime?: number;
}

Example usage

<AsyncDropdown
    promise={promiseOptions}
    selected={this.state.selection || undefined}
    initialOptions={[
        {label: 'type to search', value: ''}
    ]}
    onChange={selection => this.setState({selection})}
/>

const promiseOptions = (input: string): Promise<IDropdownOption[]> => {
    return new Promise((resolve: any, reject: any) => {
        axios({
            url: '/users',
        }).then((asyncData: any[]) => {
            let options: IDropdownOption[] = [];

            options = asyncData.map(({id, name}) => {
                return ({
                    label: name,
                    value: id,
                })
            });

            resolve(options);
        }).catch(() => {
            reject(); // this safely closes the dropdown
        });
    });
};

Check changes before publish

  • run yarn link. This should generate something like this
  • You can now run 'yarn link "austin-generic-react-micro-components"' in the projects where you want to use this package and it will be used instead.
  • open another dummy project if not create a react app using npx create-react-app dummy --typescript and then
  • execute yarn link "dummy-counter" and try using user component

Publish note

  • add entry to index.ts (if new feature)
  • update version number
  • yarn build
  • yarn coverage (to update the coverage before publish)
  • git push
  • npm publish