require("../../../_virtual/_rolldown/runtime.js");
let react = require("react");
//#region src/components/PisellSuperTabs/hooks/useTabsState.ts
/**
* Tabs 状态管理 Hook
* @description 处理受控/非受控模式的状态管理
* @template T - 数据项类型
*/
const useTabsState = (params) => {
	const { value, defaultValue, onChange, isControlled } = params;
	const [innerValue, setInnerValue] = (0, react.useState)(defaultValue);
	return {
		activeKey: isControlled ? value : innerValue,
		handleTabChange: (0, react.useCallback)((key, item) => {
			if (!isControlled) setInnerValue(key);
			onChange === null || onChange === void 0 || onChange(key, item);
		}, [isControlled, onChange])
	};
};
//#endregion
exports.useTabsState = useTabsState;
