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