/**
 * Copyright IBM Corp. 2020, 2026
 *
 * This source code is licensed under the Apache-2.0 license found in the
 * LICENSE file in the root directory of this source tree.
 */

const require_runtime = require('../../../_virtual/_rolldown/runtime.js');
const require_index = require('../../../node_modules/classnames/index.js');
const require_settings = require('../../../settings.js');
const require_devtools = require('../../../global/js/utils/devtools.js');
let react = require("react");
react = require_runtime.__toESM(react);
let prop_types = require("prop-types");
prop_types = require_runtime.__toESM(prop_types);
let _carbon_react = require("@carbon/react");

//#region src/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.jsx
/**
* Copyright IBM Corp. 2024, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
var import_classnames = /* @__PURE__ */ require_runtime.__toESM(require_index.default);
const blockClass = `${require_settings.pkg.prefix}--filter-panel-search`;
const componentName = "FilterPanelSearch";
const defaults = { searchProps: {} };
/**
* An input field and container to show search results.
* @deprecated This component is deprecated
*/
let FilterPanelSearch = react.default.forwardRef(({ children, className, searchProps = defaults.searchProps, ...rest }, ref) => {
	const [resultsVisible, setResultsVisible] = (0, react.useState)(false);
	let timer;
	const hideResults = () => {
		clearTimeout(timer);
		timer = setTimeout(() => {
			setResultsVisible(false);
		}, 300);
	};
	const showResults = () => {
		clearTimeout(timer);
		setResultsVisible(true);
	};
	(0, react.useEffect)(() => {
		return clearTimeout(timer);
	}, [timer]);
	return /* @__PURE__ */ react.default.createElement("div", {
		...rest,
		className: (0, import_classnames.default)(blockClass, `${blockClass}__container`, className),
		onBlur: hideResults,
		onFocus: showResults,
		ref,
		...require_devtools.getDevtoolsProps(componentName)
	}, /* @__PURE__ */ react.default.createElement(_carbon_react.Search, {
		className: `${blockClass}__input`,
		...searchProps
	}), resultsVisible && !!children && /* @__PURE__ */ react.default.createElement("div", { className: `${blockClass}__results` }, children));
});
FilterPanelSearch.deprecated = {
	level: "warn",
	details: `This component is deprecated`
};
FilterPanelSearch = require_settings.pkg.checkComponentEnabled(FilterPanelSearch, componentName);
FilterPanelSearch.displayName = componentName;
FilterPanelSearch.propTypes = {
	children: prop_types.default.node,
	className: prop_types.default.string,
	searchProps: prop_types.default.shape({ labelText: prop_types.default.string.isRequired }).isRequired
};

//#endregion
Object.defineProperty(exports, 'FilterPanelSearch', {
  enumerable: true,
  get: function () {
    return FilterPanelSearch;
  }
});