import { getPisellComponentsThemeConfig } from "../../theme/pisell-components.js";
import ReadOnlyView from "./components/ReadOnlyView.js";
import EditView from "./components/EditView.js";
import DisabledView from "./components/DisabledView.js";
import React from "react";
import { getDisplayState } from "@pisell/utils";
import { ConfigProvider } from "antd";
import "./PisellNumber.less";
//#region src/components/pisellNumber/PisellNumber.tsx
/**
* PisellNumber 数值组件
* 
* 通用的数值输入/展示组件，支持只读、编辑、禁用三种状态。
* 基于 Ant Design InputNumber 组件开发，提供完整的校验框架。
* 
* @param props 组件 Props
* 
* @example
* // 受控模式
* const [value, setValue] = useState(0);
* <PisellNumber 
*   value={value}
*   onChange={setValue}
*   min={0}
*   max={100}
* />
* 
* @example
* // 非受控模式
* <PisellNumber 
*   defaultValue={10}
*   min={0}
*   max={999}
*   step={10}
* />
* 
* @example
* // 只读态
* <PisellNumber 
*   mode="read"
*   value={1234.567}
*   precision={2}
*   useGrouping
* />
*/
const PisellNumber = (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());
};
const MemoizedPisellNumber = React.memo(PisellNumber, (prevProps, nextProps) => {
	return prevProps.value === nextProps.value && prevProps.mode === nextProps.mode && prevProps.disabled === nextProps.disabled;
});
//#endregion
export { MemoizedPisellNumber as default };
