const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_useRecordBoardContext = require("../../hooks/useRecordBoardContext.js");
const require_index = require("../../../pisellFind/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/components/pisellRecordBoard/shellFrame/Search/index.tsx
/** 与 context.searchParams 对应的默认搜索参数字段名 */
const DEFAULT_SEARCH_FIELD = "keyword";
/**
* RecordBoard 下的独立搜索槽：使用 PisellFind，绑定 context.searchParams.keyword 与 onSearch。
* 可通过 childComponentProps.search 透传 PisellFind 的 props。
*/
const RecordBoardSearch = (props) => {
	var _searchParams$DEFAULT;
	const ctx = require_useRecordBoardContext.useRecordBoardContext({ displayName: "search" });
	const { searchParams, onSearch } = ctx;
	const searchProps = ctx;
	const keyword = (_searchParams$DEFAULT = searchParams === null || searchParams === void 0 ? void 0 : searchParams[DEFAULT_SEARCH_FIELD]) !== null && _searchParams$DEFAULT !== void 0 ? _searchParams$DEFAULT : "";
	const handleSearch = (0, react.useCallback)((value) => {
		onSearch(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, searchParams), {}, { [DEFAULT_SEARCH_FIELD]: value || void 0 }));
	}, [onSearch, searchParams]);
	return /* @__PURE__ */ react.default.createElement("div", {
		"data-layout-slot": "search",
		style: { marginBottom: 8 }
	}, /* @__PURE__ */ react.default.createElement(require_index.PisellFind, require_objectSpread2._objectSpread2({
		value: keyword,
		onSearch: handleSearch
	}, searchProps)));
};
RecordBoardSearch.displayName = "RecordBoard.Search";
//#endregion
exports.default = RecordBoardSearch;
