import React__default from 'react';
import { _ as __rest, a as __assign } from './_tslib-5c49bd3f.js';
import { jsx } from '@emotion/react/jsx-runtime';

var TabProvider = function (_a) {
    var children = _a.children, props = __rest(_a, ["children"]);
    var _b = React__default.useState(props.activeTabId || ''), activeTabId = _b[0], setActiveTabId = _b[1];
    var handleChange = React__default.useCallback(function (id) {
        setActiveTabId(id);
        if (props.onChange) {
            props.onChange(id);
        }
    }, [props.onChange]);
    var derivedActiveTabId = props.activeTabId !== undefined ? props.activeTabId : activeTabId;
    var contextValue = React__default.useMemo(function () { return ({
        activeTabId: derivedActiveTabId,
        onChange: handleChange,
    }); }, [derivedActiveTabId, handleChange]);
    return (jsx(TabContext.Provider, __assign({ value: contextValue }, { children: children }), void 0));
};
var TabContext = React__default.createContext(null);

export { TabContext, TabProvider };
//# sourceMappingURL=TabProvider.js.map
