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

@lendi-ui/auto-complete

v6.0.2

Published

AutoCompleteStateless and AutocompleteStateful component.

Downloads

2,098

Readme

@lendi-ui/auto-complete

AutoCompleteStateless and AutocompleteStateful component.

Installation

yarn add @lendi-ui/auto-complete

Usage

import { AutoComplete, AutoCompleteStateless } from '@lendi-ui/auto-complete';

<AutoComplete dataSource={(input) => Promise.resolve([{
    label: 'AMP Bank',
    value: 'AMP',
  },
  {
    label: 'ANZ',
    value: 'anz',
  }])}/>

AutoCompleteStateful component

<PropTable>
  <PropTable.Entry name="before" type="React.ReactElement" description="Before icon for AutoComplete"/>
  <PropTable.Entry name="className" type="string" description="External classname to override style of the component"/>
  <PropTable.Entry name="dataSource" required type="(input) => Promise.resolve([{label, value}]) | [{label, value}]"
   description="Datasource - It could resolve to a promise of an array of {label, value} or just an array of {label, value}, where label is searchable"/>
  <PropTable.Entry name="isAutoFocus" type="boolean" defaultValue={false} description="Whether the Input is automatically focused on when form loads."/>
  <PropTable.Entry name="isDisabled" type="boolean" description="Disable AutoComplete"/>
  <PropTable.Entry name="isError" type="boolean" description="Errored AutoComplete"/>
  <PropTable.Entry name="isFullWidth" type="boolean" description="Fullwidth for AutoComplete"/>
  <PropTable.Entry name="isInverse" type="boolean" defaultValue={false} description="Whether the InputButton is inversed"/>
  <PropTable.Entry name="isReadOnly" type="boolean" defaultValue={false} description="Whether the Input is read-only."/>
  <PropTable.Entry name="isRequired" type="boolean" defaultValue={false} description="Whether the Input is required."/>
  <PropTable.Entry name="onSelectItem" type="(selectedItem: string | number)=> void" description="Selected item from the datasource"/>
  <PropTable.Entry name="placeholder" type="string" description="Placeholder for AutoComplete"/>
  <PropTable.Entry name="size" type={`"lg" | "md" | "sm"`} defaultValue='md' description="Size to AutoComplete"/>
  <PropTable.Entry name="value" type="string" description="AutoComplete value"/>
</PropTable>

AutoCompleteStateless component

<PropTable>
  <PropTable.Entry name="before" type="React.ReactElement" description="Before icon for AutoComplete"/>
  <PropTable.Entry name="className" type="string" description="External classname to override style of the component"/>
  <PropTable.Entry name="dataSource" required type="[{label, value}]" description="The items to display in the dropdown menu"/>
  <PropTable.Entry name="isAutoFocus" type="boolean" defaultValue={false} description="Whether the Input is automatically focused on when form loads."/>
  <PropTable.Entry name="isDisabled" type="boolean" description="Disable AutoComplete"/>
  <PropTable.Entry name="isError" type="boolean" description="Errored AutoComplete"/>
  <PropTable.Entry name="isFullWidth" type="boolean" description="Fullwidth for AutoComplete"/>
  <PropTable.Entry name="isInverse" type="boolean" defaultValue={false} description="Whether the InputButton is inversed"/>
  <PropTable.Entry name="isLoading" type="boolean" defaultValue={false} description="Loading indicator"/>
  <PropTable.Entry name="isReadOnly" type="boolean" defaultValue={false} description="Whether the Input is read-only."/>
  <PropTable.Entry name="isRequired" type="boolean" defaultValue={false} description="Whether the Input is required."/>
  <PropTable.Entry name="open" type="boolean" defaultValue={false} description="Displays/hides the dropdown menu"/>
  <PropTable.Entry name="onBlur" type="(event: React.FocusEvent<HTMLInputElement>)=> void" description="Blur handler"/>
  <PropTable.Entry name="onChange" type="(event: React.ChangeEvent<HTMLInputElement>)=> void" description="Change handler"/>
  <PropTable.Entry name="onFocus" type="(event: React.FocusEvent<HTMLInputElement>) => void" description="Focus handler"/>
  <PropTable.Entry name="onKeyDown" type="(event: React.KeyboardEvent<HTMLDivElement>) => void" description="OnKeyDown handler"/>
  <PropTable.Entry name="onMenuVisibilityChange" type="(isOpen: boolean) => void" description="By default Autocomplete will manage its own menu visibility, using basic logic to decide whether or not to display it (e.g. open on focus, keypress, close on blur, select, escape, etc). If you need full control over when the menu opens and closes you can put Autocomplete into 'managed menu visibility mode' by supplying props.open. This will force AutocompleteStateless to ignore its internal menu visibility status and always hide/show the menu based on props.open. Pair this with props.onMenuVisibilityChange - which is invoked each time the internal visibility state changes - for full control over the menu's visibility"/>
  <PropTable.Entry name="onReset" type="() => void" description="Called when clear(cross) button is being called, consumer need to implement it to clear input"/>
  <PropTable.Entry name="onSelect" type="(selectedItem: string | number)=> void" description="Selected item from the datasource"/>
  <PropTable.Entry name="placeholder" type="string" description="Placeholder for AutoComplete"/>
  <PropTable.Entry name="size" type={`"lg" | "md" | "sm"`} defaultValue='md' description="Size to AutoComplete"/>
  <PropTable.Entry name="value" type="string" description="AutoComplete value"/>
</PropTable>