import ReadOnlyView from "./components/ReadOnlyView.js";
import EditView from "./components/EditView.js";
import DisabledView from "./components/DisabledView.js";
import { getPisellComponentsThemeConfig } from "../../theme/pisell-components.js";
import React from "react";
import { getDisplayState } from "@pisell/utils";
import { ConfigProvider } from "antd";
import "./PisellSingleLineText.less";
//#region src/components/pisellSingleLineText/PisellSingleLineText.tsx
/**
* PisellSingleLineText 单行文本组件
*
* 通用的单行文本输入/展示组件，支持只读、编辑、禁用三种状态。
* 基于 Ant Design Input 组件开发，提供完整的校验框架。
*
* @param props 组件 Props
*
* @example
* // 受控模式
* const [value, setValue] = useState('');
* <PisellSingleLineText
*   value={value}
*   onChange={(v) => setValue(v)}
*   placeholder="请输入"
* />
*
* @example
* // 非受控模式
* <PisellSingleLineText
*   defaultValue="初始值"
*   required
*   minLength={3}
* />
*
* @example
* // 只读态
* <PisellSingleLineText
*   mode="read"
*   value="这是一段很长的文本内容"
*   ellipsis
*   showTooltip
* />
*/
const PisellSingleLineText = (props) => {
	const { mode = "edit", disabled = false } = props;
	const displayState = getDisplayState(mode, disabled);
	const render = () => {
		switch (displayState) {
			case "read": return /* @__PURE__ */ React.createElement(ReadOnlyView, props);
			case "edit": return /* @__PURE__ */ React.createElement(EditView, props);
			case "disabled": return /* @__PURE__ */ React.createElement(DisabledView, props);
			default: return null;
		}
	};
	const theme = getPisellComponentsThemeConfig();
	return /* @__PURE__ */ React.createElement(ConfigProvider, { theme }, render());
};
var PisellSingleLineText_default = React.memo(PisellSingleLineText, (prevProps, nextProps) => {
	return prevProps.value === nextProps.value && prevProps.mode === nextProps.mode && prevProps.disabled === nextProps.disabled;
});
//#endregion
export { PisellSingleLineText_default as default };
