Repository URL to install this package:
|
Version:
0.0.15 ▾
|
/**
* @todo @HACK @FIXME @JAMES
* @file 1. is inside view
* 2. this container is coupled to catalog
* but we want to reuse this in store locator
*
*
* @todo remaining tasks on this
* 1. finish local storage for recents
* 2. handle submit
* 3. process label-value list
* 4. load initial suggestions on click based on current routing
*/
import React from 'react';
import { ObservableContainer } from '@skava/packages/libraries/observable-container';
import { SearchInput } from '../SearchInput';
import { defaultSuggestionList } from './fixture';
import { LabelValue } from './typings';
declare class SearchContainer extends ObservableContainer {
static debugName: string;
/**
* @todo @@perf EMPTY
*/
inputReference: SearchInput;
schemaData: {
'@context': string;
'@type': string;
'url': string;
'potentialAction': {
'@type': string;
'target': string;
'query-input': string;
};
};
placeholder: string;
isVisible: boolean;
isActive: boolean;
suggestionList: string[] | ReadonlyArray<string>;
recentList: string[];
label: string;
value?: string;
constructor();
afterCreate(): void;
setLabelValue(labelValue: LabelValue): void;
/**
* @type {Action}
* @param {String} value from search input
* @return {Promise} api call
*
* @todo broken api https://jira.skava.net/browse/SKREACT-639?filter=26436
*
* @example {
* "type":"suggestion",
* "properties":{
* "suggestion":[{"value":
* ["men in electronics|||%2528%252bcampaignid%253a2495%2b%252bavailable%253atrue%2b%252bcategorylevel2%253a%2522men%2522%2b%252bcategorylevel1%253a%2522electronics%2522%2529","men in shoes|||%2528%252bcampaignid%253a2495%2b%252bavailable%253atrue%2b%252bcategorylevel2%253a%2522men%2522%2b%252bcategorylevel1%253a%2522shoes%2522%2529","men in clothing|||%2528%252bcampaignid%253a2495%2b%252bavailable%253atrue%2b%252bcategorylevel2%253a%2522men%2522%2b%252bcategorylevel1%253a%2522clothing%2522%2529"]}]}}
*
* @see http://54.161.84.34:3006/api/searchsuggestion?campaignId=212&search=men&offset=0&limit=20&locale=en_US
*/
updateSearchSuggestions(value: string): Promise<void>;
updateSearchToDefaultIfEmpty(value: string): void;
/**
* @todo @james evaluate a better way to deal with this
* rather than 2-way coupling
*
* @see atoms/SearchInput
* @note dom.observableState is on search input
*/
setInputReference(dom: SearchInput): void;
/**
* @type { Action }
* @todo should us mobx type for array...
* @param text text on the item in recent results
* @api https://mobx.js.org/refguide/array.html
*/
handleRemoveRecentItem: (text: string, event: React.MouseEvent<Element, MouseEvent>) => void;
/**
* @event click
* @type {Action}
* @param text text on the item in recent results
*/
handleOnClickFor: (text: string) => (event: React.MouseEvent<Element, MouseEvent>) => void;
/**
* @event clear
*/
handleClearRecent(event: React.MouseEvent): void;
/**
* @tutorial https://reactjs.org/docs/events.html#keyboard-events
*/
handleKeyboard(event: React.KeyboardEvent): void;
show(): void;
hide(): void;
/**
* @description changes url to go to search page
*/
goToSearch(value: string): void;
/**
* @param value value of dom state
*/
updateSuggestionsAndSave(value: string): void;
/**
* @param value value to save in recent search
* @see https://jira.skava.net/browse/SKREACT-4485
*/
saveSearch(value: string): void;
/**
* @event submit ui
*/
handleSubmit(event: React.MouseEvent): void;
/**
* @param value search value
*/
handleFromSearchSuggestionOrSubmit(value: string): void;
/**
* @event focus
* @description Show search suggestions on focus.
* @todo typing here on target
*/
handleSearchBarFocus(props: {
element: React.ComponentType;
event: React.MouseEvent;
type: 'focus' | 'blur' | 'boundary';
}): () => void;
/**
* @event boundaryClick
*/
handleClickBoundary(event?: React.MouseEvent): void;
/**
* @event clear
*/
handleSearchBarClear(component: React.ComponentType): void;
/**
* @event cancel
*/
handleOnCancel(component: React.ComponentType): void;
readonly searchTerm: any;
}
declare const searchContainer: SearchContainer;
export { searchContainer, SearchContainer, defaultSuggestionList };
export default searchContainer;