var _excluded = ["triggerType", "buttonText", "placeholder", "showConfirmButton", "showHistory", "historyKey"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React, { forwardRef } from 'react';
import { locales as utilsLocales } from '@pisell/utils';
import { PisellLookup } from "../pisellLookup";
import { getText } from "../../locales";

/**
 * PisellFind Props
 * 继承 PisellLookup 的所有 Props
 */

/**
 * PisellFind Ref
 * 继承 PisellLookup 的所有 Ref 方法
 */

/**
 * PisellFind 组件
 * 基于 PisellLookup 的组件内查找优化版本
 * 
 * 核心特点：
 * - 默认使用 button 触发器
 * - 默认不显示确认按钮（输入即搜索）
 * - 默认开启搜索历史
 * - 默认不展示结果区（结果在页面其他位置展示）
 * 
 * @example
 * ```tsx
 * // 基础用法
 * <PisellFind
 *   onSearch={(keyword) => {
 *     const filtered = data.filter(item => item.name.includes(keyword));
 *     setFilteredData(filtered);
 *   }}
 * />
 * 
 * // 切换为 Input 模式
 * <PisellFind
 *   triggerType="input"
 *   onSearch={(keyword) => filterData(keyword)}
 * />
 * ```
 */
export var PisellFind = /*#__PURE__*/forwardRef(function (props, ref) {
  var _props$triggerType = props.triggerType,
    triggerType = _props$triggerType === void 0 ? 'button' : _props$triggerType,
    _props$buttonText = props.buttonText,
    buttonText = _props$buttonText === void 0 ? function () {
      var key = 'pisell2.recordBoard.toolbar.find';
      var u = utilsLocales.getText(key);
      return u && u !== key ? u : getText(key) || getText('pisell-find-button-text');
    }() : _props$buttonText,
    _props$placeholder = props.placeholder,
    placeholder = _props$placeholder === void 0 ? function () {
      var key = 'pisell2.recordBoard.toolbar.findPlaceholder';
      var u = utilsLocales.getText(key);
      return u && u !== key ? u : getText(key) || getText('pisell-find-placeholder');
    }() : _props$placeholder,
    _props$showConfirmBut = props.showConfirmButton,
    showConfirmButton = _props$showConfirmBut === void 0 ? false : _props$showConfirmBut,
    _props$showHistory = props.showHistory,
    showHistory = _props$showHistory === void 0 ? true : _props$showHistory,
    _props$historyKey = props.historyKey,
    historyKey = _props$historyKey === void 0 ? 'pisell_find_history' : _props$historyKey,
    restProps = _objectWithoutProperties(props, _excluded);
  return /*#__PURE__*/React.createElement(PisellLookup, _extends({
    ref: ref,
    triggerType: triggerType,
    buttonText: buttonText,
    placeholder: placeholder,
    showConfirmButton: showConfirmButton,
    showHistory: showHistory,
    historyKey: historyKey
  }, restProps));
});

// 显示名称
PisellFind.displayName = 'PisellFind';