"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); exports.__esModule = true; exports.default = void 0; var _react = _interopRequireWildcard(require("react")); var _uncontrollable = require("uncontrollable"); var _TabContext = _interopRequireDefault(require("./TabContext")); var _SelectableContext = _interopRequireDefault(require("./SelectableContext")); var TabContainer = function TabContainer(props) { var _useUncontrolled = (0, _uncontrollable.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 = (0, _react.useMemo)(function () { return generateCustomChildId || function (key, type) { return id ? id + "-" + type + "-" + key : null; }; }, [id, generateCustomChildId]); var tabContext = (0, _react.useMemo)(function () { return { onSelect: onSelect, activeKey: activeKey, transition: transition, mountOnEnter: mountOnEnter, unmountOnExit: unmountOnExit, getControlledId: function getControlledId(key) { return generateChildId(key, 'tabpane'); }, getControllerId: function getControllerId(key) { return generateChildId(key, 'tab'); } }; }, [onSelect, activeKey, transition, mountOnEnter, unmountOnExit, generateChildId]); return _react.default.createElement(_TabContext.default.Provider, { value: tabContext }, _react.default.createElement(_SelectableContext.default.Provider, { value: onSelect }, children)); }; var _default = TabContainer; exports.default = _default; module.exports = exports["default"];