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