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