@wulperstudio/cms
Version:
Wulper Studio Library Components CMS
64 lines • 2.1 kB
JavaScript
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["children", "value", "index"];
import React from 'react';
import { v4 } from 'uuid';
import { Box } from '@mui/material';
import { StyledTab, StyledTabs } from './styled';
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
// Se remueve de la exportacion
function TabPanel(props) {
var children = props.children,
value = props.value,
index = props.index,
other = _objectWithoutProperties(props, _excluded);
return /*#__PURE__*/_jsx(Box, Object.assign({
role: "tabpanel",
hidden: value !== index,
id: "vertical-tabpanel-".concat(index),
"aria-labelledby": "vertical-tab-".concat(index)
}, other.containerProps, {
children: value === index && /*#__PURE__*/_jsx(Box, Object.assign({
sx: {
pt: 3
}
}, other.childrenProps, {
children: children
}))
}));
}
var WTabs = function WTabs(_ref) {
var tabs = _ref.tabs,
tabsProps = _ref.tabsProps,
tabProps = _ref.tabProps,
tabPanelProps = _ref.tabPanelProps;
var _React$useState = React.useState(0),
_React$useState2 = _slicedToArray(_React$useState, 2),
value = _React$useState2[0],
setValue = _React$useState2[1];
var handleChange = function handleChange(event, newValue) {
setValue(newValue);
};
return /*#__PURE__*/_jsxs(_Fragment, {
children: [/*#__PURE__*/_jsx(StyledTabs, Object.assign({
value: value,
onChange: handleChange
}, tabsProps, {
children: tabs.map(function (_ref2) {
var label = _ref2.label;
return /*#__PURE__*/_jsx(StyledTab, Object.assign({
label: label
}, tabProps), v4());
})
})), tabs.map(function (_ref3, i) {
var items = _ref3.items;
return /*#__PURE__*/_jsx(TabPanel, Object.assign({
value: value,
index: i
}, tabPanelProps, {
children: items
}), v4());
})]
});
};
export default WTabs;