1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = TabsListProvider;
|
7 | var React = _interopRequireWildcard(require("react"));
|
8 | var _ListContext = require("../useList/ListContext");
|
9 | var _useCompound = require("../utils/useCompound");
|
10 | var _jsxRuntime = require("react/jsx-runtime");
|
11 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
12 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | function TabsListProvider(props) {
|
19 | const {
|
20 | value,
|
21 | children
|
22 | } = props;
|
23 | const {
|
24 | dispatch,
|
25 | getItemIndex,
|
26 | getItemState,
|
27 | registerHighlightChangeHandler,
|
28 | registerSelectionChangeHandler,
|
29 | registerItem,
|
30 | totalSubitemCount
|
31 | } = value;
|
32 | const listContextValue = React.useMemo(() => ({
|
33 | dispatch,
|
34 | getItemState,
|
35 | getItemIndex,
|
36 | registerHighlightChangeHandler,
|
37 | registerSelectionChangeHandler
|
38 | }), [dispatch, getItemIndex, getItemState, registerHighlightChangeHandler, registerSelectionChangeHandler]);
|
39 | const compoundComponentContextValue = React.useMemo(() => ({
|
40 | getItemIndex,
|
41 | registerItem,
|
42 | totalSubitemCount
|
43 | }), [registerItem, getItemIndex, totalSubitemCount]);
|
44 | return (0, _jsxRuntime.jsx)(_useCompound.CompoundComponentContext.Provider, {
|
45 | value: compoundComponentContextValue,
|
46 | children: (0, _jsxRuntime.jsx)(_ListContext.ListContext.Provider, {
|
47 | value: listContextValue,
|
48 | children: children
|
49 | })
|
50 | });
|
51 | } |
\ | No newline at end of file |