@s-ui/react-molecule-autosuggest
Version:
`MoleculeAutosuggest` is an input that will display a list of suggestions while values are entered It allows Single and Multiple Selection
29 lines • 1.29 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["onClickClear", "isVisibleClear", "iconClear", "rightIcon", "children"];
import PropTypes from 'prop-types';
import Injector from '@s-ui/react-primitive-injector';
import { CLASS_CONTAINER, CLASS_ICON_CLEAR } from './config.js';
import { jsx as _jsx } from "react/jsx-runtime";
var InputWithClearUI = function InputWithClearUI(_ref) {
var onClickClear = _ref.onClickClear,
isVisibleClear = _ref.isVisibleClear,
iconClear = _ref.iconClear,
_ref$rightIcon = _ref.rightIcon,
rightIcon = _ref$rightIcon === void 0 ? /*#__PURE__*/_jsx("i", {}) : _ref$rightIcon,
children = _ref.children,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
return /*#__PURE__*/_jsx("div", {
className: CLASS_CONTAINER,
children: /*#__PURE__*/_jsx(Injector, _extends({}, props, {
rightIcon: isVisibleClear && iconClear ? /*#__PURE__*/_jsx("span", {
className: CLASS_ICON_CLEAR,
onClick: onClickClear,
children: iconClear
}) : rightIcon,
children: children
}))
});
};
InputWithClearUI.displayName = 'InputWithClearUI';
export default InputWithClearUI;