1 | import * as React from 'react';
|
2 | import TabsContext from '../Tabs/TabsContext';
|
3 | import { CompoundComponentContext } from '../utils/useCompound';
|
4 | import { jsx as _jsx } from "react/jsx-runtime";
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export default function TabsProvider(props) {
|
11 | var valueProp = props.value,
|
12 | children = props.children;
|
13 | var direction = valueProp.direction,
|
14 | getItemIndex = valueProp.getItemIndex,
|
15 | onSelected = valueProp.onSelected,
|
16 | orientation = valueProp.orientation,
|
17 | registerItem = valueProp.registerItem,
|
18 | registerTabIdLookup = valueProp.registerTabIdLookup,
|
19 | selectionFollowsFocus = valueProp.selectionFollowsFocus,
|
20 | totalSubitemCount = valueProp.totalSubitemCount,
|
21 | value = valueProp.value,
|
22 | getTabId = valueProp.getTabId,
|
23 | getTabPanelId = valueProp.getTabPanelId;
|
24 | var compoundComponentContextValue = React.useMemo(function () {
|
25 | return {
|
26 | getItemIndex: getItemIndex,
|
27 | registerItem: registerItem,
|
28 | totalSubitemCount: totalSubitemCount
|
29 | };
|
30 | }, [registerItem, getItemIndex, totalSubitemCount]);
|
31 | var tabsContextValue = React.useMemo(function () {
|
32 | return {
|
33 | direction: direction,
|
34 | getTabId: getTabId,
|
35 | getTabPanelId: getTabPanelId,
|
36 | onSelected: onSelected,
|
37 | orientation: orientation,
|
38 | registerTabIdLookup: registerTabIdLookup,
|
39 | selectionFollowsFocus: selectionFollowsFocus,
|
40 | value: value
|
41 | };
|
42 | }, [direction, getTabId, getTabPanelId, onSelected, orientation, registerTabIdLookup, selectionFollowsFocus, value]);
|
43 | return _jsx(CompoundComponentContext.Provider, {
|
44 | value: compoundComponentContextValue,
|
45 | children: _jsx(TabsContext.Provider, {
|
46 | value: tabsContextValue,
|
47 | children: children
|
48 | })
|
49 | });
|
50 | } |
\ | No newline at end of file |