# @zizzo/react-debounced-select-search

> Like react-select, but worse, yet easier to reason about.

Latest version **0.2.2** (published 2020-09-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @zizzo/react-debounced-select-search
pnpm add @zizzo/react-debounced-select-search
yarn add @zizzo/react-debounced-select-search
bun add @zizzo/react-debounced-select-search
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2020-09-16 |
| First published | 2020-08-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 10 |
| Unpacked size | 481.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexander Zizzo |
| Maintainers | zizzo |

## Links

- npm: https://www.npmjs.com/package/@zizzo/react-debounced-select-search
- Repository: https://github.com/elzii/react-debounced-select-search
- Homepage: https://github.com/elzii/react-debounced-select-search#readme
- Issues: https://github.com/elzii/react-debounced-select-search/issues
- npm.io page: https://npm.io/package/@zizzo/react-debounced-select-search

## Dependencies (10)

- [react-dnd](https://npm.io/package/react-dnd.md) ^11.1.3
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [react-table](https://npm.io/package/react-table.md) ^7.5.0
- [react-popper](https://npm.io/package/react-popper.md) ^2.2.3
- [@emotion/core](https://npm.io/package/@emotion/core.md) ^10.0.35
- [@popperjs/core](https://npm.io/package/@popperjs/core.md) ^2.4.4
- [@emotion/styled](https://npm.io/package/@emotion/styled.md) ^10.0.27
- [immutability-helper](https://npm.io/package/immutability-helper.md) ^3.1.1
- [react-dnd-html5-backend](https://npm.io/package/react-dnd-html5-backend.md) ^11.1.3
- [compute-scroll-into-view](https://npm.io/package/compute-scroll-into-view.md) ^1.0.14

## Recent versions

- 0.2.2 (latest) — 2020-09-16
- 0.2.1 — 2020-09-16
- 0.2.0 — 2020-09-16
- 0.1.19 — 2020-09-11
- 0.1.18 — 2020-09-11
- 0.1.17 — 2020-09-11
- 0.1.16 — 2020-09-11
- 0.1.15 — 2020-09-08
- 0.1.14 — 2020-09-06
- 0.1.13 — 2020-09-05
- 0.1.12 — 2020-09-04
- 0.1.11 — 2020-09-04
- 0.1.10 — 2020-08-30
- 0.1.0 — 2020-08-30

## README

![Header](https://github.com/elzii/react-debounced-select-search/raw/master/media/Banner.png)

<img src="https://github.com/elzii/react-debounced-select-search/raw/master/media/Screenshot.png" width="500">

### Demo
[Codesandbox Demo](https://codesandbox.io/s/demo-react-debounced-select-search-le3pv)

### Getting Started
`npm i @zizzo/react-debounced-select-search`

### Usage Example
```tsx
import { Select } from '@zizzo/react-debounced-select-search'

const getCocktails = async (query: string) => {
  const url = `https://www.thecocktaildb.com/api/json/v1/1/search.php?s=${query}`
  const response = await fetch(url, {
    method: 'GET'
  })
  const data = await response.json()

  const { drinks } = data
  return drinks.map((item: any) => ({ 
    id: item.idDrink,
    name: item.strDrink, 
    value: item.strDrink,
    thumb: item.strDrinkThumb,
  }))
}

const CustomOption = ({ item, style, onClick, ...props }: any) => {
  return <div className="MyCustomOption" style={{ ...style }}>
    <pre>{JSON.stringify(item, null, 2)}</pre>
  </div>
})

return <Select
  getOptions={getOptions}
  placeholder={'Search cocktails'}
  tabBehavior={'SELECT_HIGHLIGHTED_OPTION'}
  debounceTimeout={200}
  components={{
    Option: CustomOption
  }}
/>
```


### Overriding CSS Theme

Theming is done with CSS variables. Example of overriding using [emotion](https://www.npmjs.com/package/emotion):

```tsx
// ...
import { css } from 'emotion'

return (
  <div className={css`
    .CustomSelect {
        --select-input-padding: 1rem;
        --select-input-border-radius: 4px;
        --select-input-font-size: 1.2rem;
        --select-input-border-color: rgba(0,0,0, 0.35);
        --select-input-focus-color: rgba(63,160,251,1);
        --select-input-icon-width: 56px;
        --select-input-max-width: 500px;
        --select-input-option-background-color: #f3f3f3;
        --select-input-option-background-color-hover: #ff0000;
        --select-input-option-active-background-color-hover: #ffff00;
        --select-input-option-color: inherit;
        --select-input-option-color-hover: white;
        --select-input-chip-background-color: rgba(0,0,0, 0.10);
    }
  `}>
    <Select 
      className="CustomSelect"
      // ...
    />
  </div>
)

```

---
_Source: https://npm.io/package/@zizzo/react-debounced-select-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
