zmp-react
Version:
Build full featured iOS & Android apps using ZMP & React
85 lines (80 loc) • 2.55 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React, { forwardRef, useRef, useImperativeHandle } from 'react';
import SearchBar from '../components/searchbar';
import { classNames } from '../shared/utils';
/* dts-imports
import { Searchbar } from 'zmp-core/types';
*/
/* dts-props
id?: string | number;
className?: string;
style?: React.CSSProperties;
noShadow? : boolean
noHairline? : boolean
form? : boolean
placeholder? : string
disableButton? : boolean
disableButtonText? : string
clearButton? : boolean
value? : string | number | Array<any>
inputEvents? : string
expandable? : boolean
inline? : boolean
searchContainer? : string | object
searchIn? : string
searchItem? : string
searchGroup? : string
searchGroupTitle? : string
foundEl? : string | object
notFoundEl? : string | object
backdrop? : boolean
backdropEl? : string | object
hideOnEnableEl? : string | object
hideOnSearchEl? : string | object
ignore? : string
customSearch? : boolean
removeDiacritics? : boolean
hideDividers? : boolean
hideGroups? : boolean
small? : boolean
disabled?: boolean
init? : boolean
COLOR_PROPS
onSearchbarSearch? : (searchbar?: Searchbar.Searchbar, query?: any, previousQuery?: any) => void
onSearchbarClear? : (searchbar?: Searchbar.Searchbar, previousQuery?: any) => void
onSearchbarEnable? : (searchbar?: Searchbar.Searchbar) => void
onSearchbarDisable? : (searchbar?: Searchbar.Searchbar) => void
onChange? : (event?: any) => void
onInput? : (event?: any) => void
onFocus? : (event?: any) => void
onBlur? : (event?: any) => void
onSubmit? : (event?: any) => void
onClickClear? : (event?: any) => void
onClickDisable? : (event?: any) => void
ref?: React.MutableRefObject<{el: HTMLElement | null; zmpSearchbar: () => Searchbar.Searchbar;}>;
CHILDREN_PROP
*/
var ZMPSearchBar = /*#__PURE__*/forwardRef(function (props, ref) {
var elRef = useRef(null);
var small = props.small,
className = props.className,
disabled = props.disabled;
var classes = className;
if (small) {
classes = classNames(className, 'zmp-searchbar-small');
}
if (disabled) {
classes = classNames(classes, 'disabled');
}
useImperativeHandle(ref, function () {
return elRef.current;
});
return /*#__PURE__*/React.createElement(SearchBar, _extends({}, props, {
ref: elRef,
className: classes,
disableButton: false,
noHairline: true
}));
});
ZMPSearchBar.displayName = 'zmp-searchbar';
export default ZMPSearchBar;