1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3 | import * as React from 'react';
|
4 | import PropTypes from 'prop-types';
|
5 | import { useSlotProps } from '../utils';
|
6 | import composeClasses from '../composeClasses';
|
7 | import { getTabPanelUtilityClass } from './tabPanelClasses';
|
8 | import useTabPanel from '../useTabPanel/useTabPanel';
|
9 | import { useClassNamesOverride } from '../utils/ClassNameConfigurator';
|
10 | import { jsx as _jsx } from "react/jsx-runtime";
|
11 | var useUtilityClasses = function useUtilityClasses(ownerState) {
|
12 | var hidden = ownerState.hidden;
|
13 | var slots = {
|
14 | root: ['root', hidden && 'hidden']
|
15 | };
|
16 | return composeClasses(slots, useClassNamesOverride(getTabPanelUtilityClass));
|
17 | };
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var TabPanel = React.forwardRef(function TabPanel(props, forwardedRef) {
|
29 | var _slots$root;
|
30 | var children = props.children,
|
31 | value = props.value,
|
32 | _props$slotProps = props.slotProps,
|
33 | slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
34 | _props$slots = props.slots,
|
35 | slots = _props$slots === void 0 ? {} : _props$slots,
|
36 | other = _objectWithoutProperties(props, ["children", "value", "slotProps", "slots"]);
|
37 | var _useTabPanel = useTabPanel(props),
|
38 | hidden = _useTabPanel.hidden,
|
39 | getRootProps = _useTabPanel.getRootProps;
|
40 | var ownerState = _extends({}, props, {
|
41 | hidden: hidden
|
42 | });
|
43 | var classes = useUtilityClasses(ownerState);
|
44 | var TabPanelRoot = (_slots$root = slots.root) != null ? _slots$root : 'div';
|
45 | var tabPanelRootProps = useSlotProps({
|
46 | elementType: TabPanelRoot,
|
47 | getSlotProps: getRootProps,
|
48 | externalSlotProps: slotProps.root,
|
49 | externalForwardedProps: other,
|
50 | additionalProps: {
|
51 | role: 'tabpanel',
|
52 | ref: forwardedRef
|
53 | },
|
54 | ownerState: ownerState,
|
55 | className: classes.root
|
56 | });
|
57 | return _jsx(TabPanelRoot, _extends({}, tabPanelRootProps, {
|
58 | children: !hidden && children
|
59 | }));
|
60 | });
|
61 | process.env.NODE_ENV !== "production" ? TabPanel.propTypes = {
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | |
67 |
|
68 |
|
69 | children: PropTypes.node,
|
70 | |
71 |
|
72 |
|
73 |
|
74 | slotProps: PropTypes.shape({
|
75 | root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
76 | }),
|
77 | |
78 |
|
79 |
|
80 |
|
81 |
|
82 | slots: PropTypes.shape({
|
83 | root: PropTypes.elementType
|
84 | }),
|
85 | |
86 |
|
87 |
|
88 |
|
89 |
|
90 | value: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
91 | } : void 0;
|
92 | export default TabPanel; |
\ | No newline at end of file |