Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99813262
TabsUnstyled.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 26, 18:39
Size
3 KB
Mime Type
text/x-java
Expires
Tue, Jan 28, 18:39 (2 d)
Engine
blob
Format
Raw Data
Handle
23827175
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
TabsUnstyled.js
View Options
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["children", "value", "defaultValue", "orientation", "direction", "component", "onChange", "selectionFollowsFocus", "slotProps", "slots"];
import * as React from 'react';
import PropTypes from 'prop-types';
import { useSlotProps } from '../utils';
import composeClasses from '../composeClasses';
import { getTabsUnstyledUtilityClass } from './tabsUnstyledClasses';
import useTabs from './useTabs';
import Context from './TabsContext';
import { jsx as _jsx } from "react/jsx-runtime";
const useUtilityClasses = ownerState => {
const {
orientation
} = ownerState;
const slots = {
root: ['root', orientation]
};
return composeClasses(slots, getTabsUnstyledUtilityClass, {});
};
/**
*
* Demos:
*
* - [Unstyled Tabs](https://mui.com/base/react-tabs/)
*
* API:
*
* - [TabsUnstyled API](https://mui.com/base/api/tabs-unstyled/)
*/
const TabsUnstyled = /*#__PURE__*/React.forwardRef((props, ref) => {
const {
children,
orientation = 'horizontal',
direction = 'ltr',
component,
slotProps = {},
slots = {}
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const {
tabsContextValue
} = useTabs(props);
const ownerState = _extends({}, props, {
orientation,
direction
});
const classes = useUtilityClasses(ownerState);
const TabsRoot = component ?? slots.root ?? 'div';
const tabsRootProps = useSlotProps({
elementType: TabsRoot,
externalSlotProps: slotProps.root,
externalForwardedProps: other,
additionalProps: {
ref
},
ownerState,
className: classes.root
});
return /*#__PURE__*/_jsx(TabsRoot, _extends({}, tabsRootProps, {
children: /*#__PURE__*/_jsx(Context.Provider, {
value: tabsContextValue,
children: children
})
}));
});
process.env.NODE_ENV !== "production" ? TabsUnstyled.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 default value. Use when the component is not controlled.
*/
defaultValue: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.number, PropTypes.string]),
/**
* The direction of the text.
* @default 'ltr'
*/
direction: PropTypes.oneOf(['ltr', 'rtl']),
/**
* Callback invoked when new value is being set.
*/
onChange: PropTypes.func,
/**
* The component orientation (layout flow direction).
* @default 'horizontal'
*/
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
/**
* If `true` the selected tab changes on focus. Otherwise it only
* changes on activation.
*/
selectionFollowsFocus: PropTypes.bool,
/**
* The props used for each slot inside the Tabs.
* @default {}
*/
slotProps: PropTypes.shape({
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
}),
/**
* The components used for each slot inside the Tabs.
* Either a string to use a HTML element or a component.
* @default {}
*/
slots: PropTypes.shape({
root: PropTypes.elementType
}),
/**
* The value of the currently selected `Tab`.
* If you don't want any selected `Tab`, you can set this prop to `false`.
*/
value: PropTypes.oneOfType([PropTypes.oneOf([false]), PropTypes.number, PropTypes.string])
} : void 0;
export default TabsUnstyled;
Event Timeline
Log In to Comment