import React, { useMemo } from 'react'; import { useUncontrolled } from 'uncontrollable'; import TabContext from './TabContext'; import SelectableContext from './SelectableContext'; var TabContainer = function TabContainer(props) { var _useUncontrolled = useUncontrolled(props, { activeKey: 'onSelect' }), id = _useUncontrolled.id, generateCustomChildId = _useUncontrolled.generateChildId, onSelect = _useUncontrolled.onSelect, activeKey = _useUncontrolled.activeKey, transition = _useUncontrolled.transition, mountOnEnter = _useUncontrolled.mountOnEnter, unmountOnExit = _useUncontrolled.unmountOnExit, children = _useUncontrolled.children; var generateChildId = useMemo(function () { return generateCustomChildId || function (key, type) { return id ? id + "-" + type + "-" + key : null; }; }, [id, generateCustomChildId]); var tabContext = useMemo(function () { return { onSelect: onSelect, activeKey: activeKey, transition: transition, mountOnEnter: mountOnEnter || false, unmountOnExit: unmountOnExit || false, getControlledId: function getControlledId(key) { return generateChildId(key, 'tabpane'); }, getControllerId: function getControllerId(key) { return generateChildId(key, 'tab'); } }; }, [onSelect, activeKey, transition, mountOnEnter, unmountOnExit, generateChildId]); return /*#__PURE__*/React.createElement(TabContext.Provider, { value: tabContext }, /*#__PURE__*/React.createElement(SelectableContext.Provider, { value: onSelect || null }, children)); }; export default TabContainer;