import { jsx as _jsx } from "react/jsx-runtime";
import React, { useCallback, useContext, useState } from "react";
const TabContext = /*#__PURE__*/ React.createContext({});
const useTabContext = ()=>useContext(TabContext);
const TabContextProvider = (props)=>{
    // const [visible, setVisible] = useState<boolean>(() => props.collapsed);
    const [data, setData] = useState(props.data || {});
    // const data = {};
    const updateData = useCallback((key, value)=>{
        // console.log("update data", key, value);
        setData((data)=>{
            return {
                ...data,
                [key]: value
            };
        });
    }, []);
    // console.log("----- tab context ----------", props.data, props.height);
    return /*#__PURE__*/ _jsx(TabContext.Provider, {
        value: {
            contentVisible: !props.collapsed,
            height: props.height,
            toggleContentVisible: ()=>{
                // setVisible((visible: boolean) => !visible);
                props.onToggleCollapsed?.();
            },
            data,
            updateData
        },
        children: props.children
    });
};
export { TabContext, useTabContext, TabContextProvider };

//# sourceMappingURL=tabContext.js.map