1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 | Object.defineProperty(exports, "__esModule", {
|
5 | value: true
|
6 | });
|
7 | exports.default = void 0;
|
8 | var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9 | var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
10 | var React = _interopRequireWildcard(require("react"));
|
11 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
12 | var _utils = require("../utils");
|
13 | var _composeClasses = _interopRequireDefault(require("../composeClasses"));
|
14 | var _tabPanelClasses = require("./tabPanelClasses");
|
15 | var _useTabPanel = _interopRequireDefault(require("../useTabPanel/useTabPanel"));
|
16 | var _ClassNameConfigurator = require("../utils/ClassNameConfigurator");
|
17 | var _jsxRuntime = require("react/jsx-runtime");
|
18 | const _excluded = ["children", "value", "slotProps", "slots"];
|
19 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
20 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
21 | const useUtilityClasses = ownerState => {
|
22 | const {
|
23 | hidden
|
24 | } = ownerState;
|
25 | const slots = {
|
26 | root: ['root', hidden && 'hidden']
|
27 | };
|
28 | return (0, _composeClasses.default)(slots, (0, _ClassNameConfigurator.useClassNamesOverride)(_tabPanelClasses.getTabPanelUtilityClass));
|
29 | };
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | const TabPanel = React.forwardRef(function TabPanel(props, forwardedRef) {
|
41 | var _slots$root;
|
42 | const {
|
43 | children,
|
44 | slotProps = {},
|
45 | slots = {}
|
46 | } = props,
|
47 | other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
48 | const {
|
49 | hidden,
|
50 | getRootProps
|
51 | } = (0, _useTabPanel.default)(props);
|
52 | const ownerState = (0, _extends2.default)({}, props, {
|
53 | hidden
|
54 | });
|
55 | const classes = useUtilityClasses(ownerState);
|
56 | const TabPanelRoot = (_slots$root = slots.root) != null ? _slots$root : 'div';
|
57 | const tabPanelRootProps = (0, _utils.useSlotProps)({
|
58 | elementType: TabPanelRoot,
|
59 | getSlotProps: getRootProps,
|
60 | externalSlotProps: slotProps.root,
|
61 | externalForwardedProps: other,
|
62 | additionalProps: {
|
63 | role: 'tabpanel',
|
64 | ref: forwardedRef
|
65 | },
|
66 | ownerState,
|
67 | className: classes.root
|
68 | });
|
69 | return (0, _jsxRuntime.jsx)(TabPanelRoot, (0, _extends2.default)({}, tabPanelRootProps, {
|
70 | children: !hidden && children
|
71 | }));
|
72 | });
|
73 | process.env.NODE_ENV !== "production" ? TabPanel.propTypes = {
|
74 |
|
75 |
|
76 |
|
77 |
|
78 | |
79 |
|
80 |
|
81 | children: _propTypes.default.node,
|
82 | |
83 |
|
84 |
|
85 |
|
86 | slotProps: _propTypes.default.shape({
|
87 | root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
88 | }),
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 | slots: _propTypes.default.shape({
|
95 | root: _propTypes.default.elementType
|
96 | }),
|
97 | |
98 |
|
99 |
|
100 |
|
101 |
|
102 | value: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
103 | } : void 0;
|
104 | var _default = TabPanel;
|
105 | exports.default = _default; |
\ | No newline at end of file |