UNPKG

@wulperstudio/cms

Version:
59 lines (58 loc) 2.34 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.TabsRedes = void 0; var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); var _react = _interopRequireDefault(require("react")); var _material = require("@mui/material"); var _uuid = require("uuid"); var _styled = require("./styled"); var _jsxRuntime = require("react/jsx-runtime"); var TabsRedes = exports.TabsRedes = function TabsRedes(props) { var _props$componentsProp; var _React$useState = _react["default"].useState(0), _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2), value = _React$useState2[0], setValue = _React$useState2[1]; var handleChange = function handleChange(newValue) { setValue(newValue); }; return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styled.Root, { children: [props.isVisibleDivider && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, { sx: { borderColor: '#ECECFB' } }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styled.WrapperTabs, { padding: props == null || (_props$componentsProp = props.componentsProps) == null || (_props$componentsProp = _props$componentsProp.root) == null ? void 0 : _props$componentsProp.padding, children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styled.StyledTabs, { value: value, variant: "scrollable", scrollButtons: false, children: props.data.map(function (_ref, i) { var tab = _ref.tab; return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styled.WrapperTab, { onClick: function onClick() { return handleChange(i); }, children: typeof tab === 'function' ? tab(i === value) : tab }, (0, _uuid.v4)()); }) }) }), props.isVisibleDivider && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Divider, { sx: { borderColor: '#ECECFB' } }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { children: props.data.map(function (_ref2, i) { var items = _ref2.items; return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styled.TabPanel, { value: value, index: i, children: items }, (0, _uuid.v4)()); }) })] }); };