import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import React, { useMemo } from "react";
import { DownOutlined } from "@ant-design/icons";
import classNames from "classnames";
import "./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 = _objectWithoutProperties(props, _excluded);
	const _options = useMemo(() => {
		return (options || []).map((d) => {
			return /* @__PURE__ */ React.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.createElement("div", {
		className: "pisell-browser-select-wrapper",
		style: _objectSpread2({}, style)
	}, /* @__PURE__ */ React.createElement("select", _objectSpread2(_objectSpread2({}, resetProps), {}, {
		value,
		className: classNames("pisell-date-picker-pisell-browser-select", resetProps.className),
		onChange: handleChange
	}), _options), /* @__PURE__ */ React.createElement(DownOutlined, { className: "browser-select-icon" }));
};
//#endregion
export { BrowserSelect as default };
