0.2.8 • Published 3 years ago

@eqworks/omni-search v0.2.8

Weekly downloads
50
License
MIT
Repository
github
Last release
3 years ago

omni-search Master

EQWorks business specific elements for Omni Search

Requires peer dependencies:

  • react - ^16
  • react-dom - ^16
  • algoliasearch - ^4.1.0
  • use-debounce - ^3.4.2
import {
  useAlgolia,
  OmniSearch,
  useFuse,
  BaseSearch,
  Marketplacesearch,
} from '@eqworks/omni-search'

Documentation

useAlgolia

useAlgolia(indexName, searchAPIkey, specs, algoliaIDkey)Hook

Algolia custom hook. Should be called after server API call that retrieves the search key

Kind: global function

ParamTypeDefaultDescription
indexNamestring"'mix_index'"algolia index name to be used on the search
searchAPIkeystringthe search key provided from the server, to this client specificaly, to allow searching under the given index
specsobject{}the custom algolia specs. Default is 20 results/search
algoliaIDkeystringalgolia user identification key

Returns: Hook {Object}

NameTypeDescription
algoliaIndexobjectthe algolia index if user wants a method other than search
searchfunctionthe search function per keystroke
debouncedSearchfunctionthe debounced search function
resultsarraythe results of the search

OmniSearch

< OmniSearch {...{
    debouncedSearch,
    results,
    getSelection,
    autocompleteProps,
    inputProps
  }}
/>

OmniSearch Component - overlord SUI parity written with MUI

Kind: global function

Properties

NameTypeDescription
debouncedSearchfunctionthe debounced algolia search function
resultsarraythe results of the search
getSelectionfunctionsetState => a function that retrieves the details of the selected item (object to be stored in a state)
autocompletePropsobjectoverride props from <Autocomplete>
inputPropsobjectoverride props from <InputBase>

useFuse(data, options) ⇒ Hook

const fuse = useFuse(data)

Fuse custom hook. Should be called after server API call that retrieves data

Kind: global function

ParamTypeDescription
dataArraythe array of objects to initiate Fuse with
optionsobjectoptional: Fuse specs for the search. Default to marketplace config

returns: Hook {Object}

NameTypeDescription
fuseobjectthe initiated fuse object to call search on a term or any other method

MarketplaceSearch

< MarketplaceSearch {...{setSearch, search, updateHistory, ...props}} />

MarketplaceSearch Component - locus tailored, MUI parity

Kind: global function

Properties

ParamTypeDescription
setSearchfunctionfrom useState
searchstringfrom useState
updateHistoryfunctioninvoked inside onKeyPress
...propsobjectany InputBase props to override default

BaseSearch

<BaseSearch {...{onChange, ...props}}/>

BaseSearch Component: versatile search input

Kind: global function

Properties

ParamTypeDescription
onChangefunctionthe call to action to manipulate the event value entered
...propsobjectany InputBase props to override default
0.2.8

3 years ago

0.2.8-alpha.1

3 years ago

0.2.7-alpha.4

4 years ago

0.2.7-alpha.2

4 years ago

0.2.7-alpha.3

4 years ago

0.2.6-alpha

4 years ago

0.2.5-alpha

4 years ago

0.2.4-alpha

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.2

4 years ago

0.2.0

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago