Page MenuHomec4science

TabPanelUnstyled.js
No OneTemporary

File Metadata

Created
Sun, Jan 26, 18:36

TabPanelUnstyled.js

import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["children", "component", "value", "slotProps", "slots"];
import * as React from 'react';
import PropTypes from 'prop-types';
import { useSlotProps } from '../utils';
import composeClasses from '../composeClasses';
import { getTabPanelUnstyledUtilityClass } from './tabPanelUnstyledClasses';
import useTabPanel from './useTabPanel';
import { jsx as _jsx } from "react/jsx-runtime";
const useUtilityClasses = ownerState => {
const {
hidden
} = ownerState;
const slots = {
root: ['root', hidden && 'hidden']
};
return composeClasses(slots, getTabPanelUnstyledUtilityClass, {});
};
/**
*
* Demos:
*
* - [Unstyled Tabs](https://mui.com/base/react-tabs/)
*
* API:
*
* - [TabPanelUnstyled API](https://mui.com/base/api/tab-panel-unstyled/)
*/
const TabPanelUnstyled = /*#__PURE__*/React.forwardRef(function TabPanelUnstyled(props, ref) {
const {
children,
component,
slotProps = {},
slots = {}
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
hidden,
getRootProps
} = useTabPanel(props);
const ownerState = _extends({}, props, {
hidden
});
const classes = useUtilityClasses(ownerState);
const TabPanelRoot = component ?? slots.root ?? 'div';
const tabPanelRootProps = useSlotProps({
elementType: TabPanelRoot,
getSlotProps: getRootProps,
externalSlotProps: slotProps.root,
externalForwardedProps: other,
additionalProps: {
role: 'tabpanel',
ref
},
ownerState,
className: classes.root
});
return /*#__PURE__*/_jsx(TabPanelRoot, _extends({}, tabPanelRootProps, {
children: !hidden && children
}));
});
process.env.NODE_ENV !== "production" ? TabPanelUnstyled.propTypes /* remove-proptypes */ = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The content of the component.
*/
children: PropTypes.node,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component: PropTypes.elementType,
/**
* The props used for each slot inside the TabPanel.
* @default {}
*/
slotProps: PropTypes.shape({
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
}),
/**
* The components used for each slot inside the TabPanel.
* Either a string to use a HTML element or a component.
* @default {}
*/
slots: PropTypes.shape({
root: PropTypes.elementType
}),
/**
* The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.
*/
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
} : void 0;
export default TabPanelUnstyled;

Event Timeline