import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import Tabs$1 from "../../tabs/index.js";
import React, { useCallback, useMemo } from "react";
//#region src/components/table/Tabs/index.tsx
const Tabs = ({ items = [], type = "default", onChange, show = false }) => {
	const tabItems = useMemo(() => {
		return items.map((item, index) => _objectSpread2(_objectSpread2({}, item), {}, {
			key: String(index),
			label: item.name
		}));
	}, [items]);
	const handleChange = useCallback((activeKey) => {
		const currentTab = items[Number(activeKey)];
		if (currentTab && onChange) onChange(currentTab);
	}, [items, onChange]);
	if (!(items === null || items === void 0 ? void 0 : items.length) || !show) return null;
	return /* @__PURE__ */ React.createElement(Tabs$1, {
		items: tabItems,
		onChange: handleChange,
		type
	});
};
//#endregion
export { Tabs as default };
