UNPKG

@atlaskit/global-search

Version:

A cross-product search component (batteries included)

62 lines (47 loc) 2.77 kB
import _extends from "@babel/runtime/helpers/extends"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } import React from 'react'; import { ResultBase } from '@atlaskit/quick-search'; import Return from '../assets/Return'; var AdvancedSearchResult = /*#__PURE__*/function (_React$Component) { _inherits(AdvancedSearchResult, _React$Component); var _super = _createSuper(AdvancedSearchResult); function AdvancedSearchResult() { _classCallCheck(this, AdvancedSearchResult); return _super.apply(this, arguments); } _createClass(AdvancedSearchResult, [{ key: "getElemAfter", value: function getElemAfter() { var showKeyboardLozenge = this.props.showKeyboardLozenge; if (!showKeyboardLozenge) { return null; } // Supposed to render ReturnHighlighted when the result isSelected, but that doesn't work anymore. See QS-281. return /*#__PURE__*/React.createElement(Return, null); } }, { key: "render", value: function render() { var _this$props = this.props, showKeyboardLozenge = _this$props.showKeyboardLozenge, baseProps = _objectWithoutProperties(_this$props, ["showKeyboardLozenge"]); return /*#__PURE__*/React.createElement(ResultBase, _extends({}, baseProps, { elemAfter: this.getElemAfter(), onClick: this.props.onClick })); } }]); return AdvancedSearchResult; }(React.Component); _defineProperty(AdvancedSearchResult, "defaultProps", { showKeyboardLozenge: false }); export { AdvancedSearchResult as default };