1 | "use strict";
|
2 |
|
3 | var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
4 |
|
5 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
6 |
|
7 | Object.defineProperty(exports, "__esModule", {
|
8 | value: true
|
9 | });
|
10 | exports.default = exports.styles = void 0;
|
11 |
|
12 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13 |
|
14 | var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
15 |
|
16 | var React = _interopRequireWildcard(require("react"));
|
17 |
|
18 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
19 |
|
20 | var _clsx = _interopRequireDefault(require("clsx"));
|
21 |
|
22 | var _styles = require("@material-ui/core/styles");
|
23 |
|
24 | var _TabContext = require("../TabContext");
|
25 |
|
26 | var styles = function styles(theme) {
|
27 | return {
|
28 |
|
29 | root: {
|
30 | padding: theme.spacing(3)
|
31 | }
|
32 | };
|
33 | };
|
34 |
|
35 | exports.styles = styles;
|
36 | var TabPanel = React.forwardRef(function TabPanel(props, ref) {
|
37 | var children = props.children,
|
38 | className = props.className,
|
39 | classes = props.classes,
|
40 | value = props.value,
|
41 | other = (0, _objectWithoutProperties2.default)(props, ["children", "className", "classes", "value"]);
|
42 | var context = (0, _TabContext.useTabContext)();
|
43 |
|
44 | if (context === null) {
|
45 | throw new TypeError('No TabContext provided');
|
46 | }
|
47 |
|
48 | var id = (0, _TabContext.getPanelId)(context, value);
|
49 | var tabId = (0, _TabContext.getTabId)(context, value);
|
50 | return React.createElement("div", (0, _extends2.default)({
|
51 | "aria-labelledby": tabId,
|
52 | className: (0, _clsx.default)(classes.root, className),
|
53 | hidden: value !== context.value,
|
54 | id: id,
|
55 | ref: ref,
|
56 | role: "tabpanel"
|
57 | }, other), value === context.value && children);
|
58 | });
|
59 | process.env.NODE_ENV !== "production" ? TabPanel.propTypes = {
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | |
66 |
|
67 |
|
68 | children: _propTypes.default.node,
|
69 |
|
70 | |
71 |
|
72 |
|
73 |
|
74 | classes: _propTypes.default.object,
|
75 |
|
76 | |
77 |
|
78 |
|
79 | className: _propTypes.default.string,
|
80 |
|
81 | |
82 |
|
83 |
|
84 |
|
85 | value: _propTypes.default.string.isRequired
|
86 | } : void 0;
|
87 |
|
88 | var _default = (0, _styles.withStyles)(styles, {
|
89 | name: 'MuiTabPanel'
|
90 | })(TabPanel);
|
91 |
|
92 | exports.default = _default; |
\ | No newline at end of file |