const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _ant_design_icons = require("@ant-design/icons");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./index.less");
//#region src/components/browserSelect/index.tsx
const _excluded = [
	"options",
	"onChange",
	"value",
	"style"
];
/**
* @title: 系统级别的下拉框
* @description:
* @param {BrowserSelectProps} props
* @return {*}
* @Author: zhiwei.Wang
* @Date: 2024-01-30 16:43
*/
const BrowserSelect = (props) => {
	const { options, onChange, value, style } = props, resetProps = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const _options = (0, react.useMemo)(() => {
		return (options || []).map((d) => {
			return /* @__PURE__ */ react.default.createElement("option", {
				value: d.value,
				key: d.value
			}, d.label);
		});
	}, [options]);
	const handleChange = (e) => {
		e.persist();
		const selectedValue = e.target.value;
		const selectedOption = options.find((opt) => String(opt.value) === selectedValue);
		if (selectedOption) onChange === null || onChange === void 0 || onChange(selectedOption.value, selectedOption);
	};
	return /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-browser-select-wrapper",
		style: require_objectSpread2._objectSpread2({}, style)
	}, /* @__PURE__ */ react.default.createElement("select", require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, resetProps), {}, {
		value,
		className: (0, classnames.default)("pisell-date-picker-pisell-browser-select", resetProps.className),
		onChange: handleChange
	}), _options), /* @__PURE__ */ react.default.createElement(_ant_design_icons.DownOutlined, { className: "browser-select-icon" }));
};
//#endregion
exports.default = BrowserSelect;
