const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_tagColor = require("../../../utils/tagColor.js");
let react = require("react");
react = require_runtime.__toESM(react);
let _pisell_utils = require("@pisell/utils");
let antd = require("antd");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
//#region src/components/pisellSingleSelect/components/ReadOnlyView.tsx
/**
* PisellSingleSelect - ReadOnlyView (只读态视图)
* 只读状态下使用 Tag 展示选中值
*/
const ReadOnlyView = (props) => {
	var _selectedOption$color;
	const { value, options, label, required, className, style } = props;
	const selectedOption = (0, react.useMemo)(() => value !== null && value !== void 0 ? (0, _pisell_utils.findOptionByValue)(value, options) : void 0, [value, options]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: (0, classnames.default)("pisell-single-select-wrapper", "pisell-single-select-readonly", className),
		style
	}, label && /* @__PURE__ */ react.default.createElement("label", { className: (0, classnames.default)("pisell-single-select-label", { "pisell-single-select-label-required": required }) }, label), /* @__PURE__ */ react.default.createElement("div", { className: "pisell-single-select-readonly-display" }, selectedOption ? /* @__PURE__ */ react.default.createElement(antd.Tag, {
		className: "pisell-single-select-readonly-tag",
		color: (_selectedOption$color = selectedOption.color) !== null && _selectedOption$color !== void 0 ? _selectedOption$color : require_tagColor.getDefaultTagColor(selectedOption.value, 0)
	}, selectedOption.icon && /* @__PURE__ */ react.default.createElement("span", { className: "pisell-single-select-readonly-tag-icon" }, selectedOption.icon), selectedOption.label) : /* @__PURE__ */ react.default.createElement("span", { className: "pisell-single-select-readonly-empty" }, "-")));
};
ReadOnlyView.displayName = "PisellSingleSelectReadOnlyView";
//#endregion
exports.default = ReadOnlyView;
