UNPKG

@braineet/ui

Version:

Braineet design system

23 lines 1.18 kB
var _excluded = ["children"]; function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } import React, { Children, cloneElement } from 'react'; import Box from '../box'; import { useTabs } from './context'; import { jsx as _jsx } from "react/jsx-runtime"; var TabPanels = function TabPanels(_ref) { var children = _ref.children, restProps = _objectWithoutPropertiesLoose(_ref, _excluded); var _useTabs = useTabs(), activeTab = _useTabs.activeTab; var clones = Children.map(children, function (child, index) { if (!child) return; return /*#__PURE__*/cloneElement(child, { isActive: index === activeTab }); }); return /*#__PURE__*/_jsx(Box, _extends({}, restProps, { children: clones })); }; export default TabPanels;