@wix/site-ui 1.346.0 → 1.348.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{6706.js → 1093.js} +3 -3
- package/dist/{8724.js → 1219.js} +2 -2
- package/dist/{7373.js → 1288.js} +8 -2
- package/dist/{5299.js → 1381.js} +98 -127
- package/dist/{3056.js → 1607.js} +32 -34
- package/dist/1629.js +2 -0
- package/dist/1669.js +75 -0
- package/dist/1718.js +26 -0
- package/dist/{1477.js → 201.js} +17 -26
- package/dist/2221.js +9 -0
- package/dist/{2445.js → 226.js} +12 -48
- package/dist/2387.js +7 -0
- package/dist/2580.js +6 -0
- package/dist/{1500.js → 2859.js} +10 -34
- package/dist/3014.js +178 -0
- package/dist/{6247.js → 3054.js} +3 -3
- package/dist/{7642.js → 3093.js} +1 -1
- package/dist/3189.js +5 -0
- package/dist/{7564.js → 331.js} +2 -2
- package/dist/3357.js +7 -0
- package/dist/{487.js → 3398.js} +38 -39
- package/dist/3502.js +224 -0
- package/dist/3695.js +50 -0
- package/dist/3829.js +1 -1
- package/dist/{6588.js → 3859.js} +115 -92
- package/dist/{3670.js → 3910.js} +28 -21
- package/dist/392.js +7 -0
- package/dist/{4549.js → 4155.js} +11 -3
- package/dist/4226.js +7 -0
- package/dist/{6329.js → 4229.js} +1 -1
- package/dist/4293.js +3 -0
- package/dist/4346.js +853 -2
- package/dist/{285.js → 4472.js} +3 -3
- package/dist/4605.js +207 -0
- package/dist/{7366.js → 488.js} +60 -7
- package/dist/{8750.js → 497.js} +190 -375
- package/dist/4989.js +35 -0
- package/dist/{6270.js → 510.js} +157 -196
- package/dist/5258.js +26 -0
- package/dist/{5036.js → 5275.js} +0 -3
- package/dist/{8171.js → 5298.js} +90 -102
- package/dist/5473.js +11 -0
- package/dist/{4745.js → 5490.js} +3 -1
- package/dist/{6089.js → 5561.js} +869 -786
- package/dist/{8996.js → 5595.js} +4 -3
- package/dist/5890.js +25 -0
- package/dist/{6046.js → 5969.js} +1 -1
- package/dist/5984.js +38 -0
- package/dist/{8527.js → 6006.js} +3 -3
- package/dist/6040.js +97 -0
- package/dist/{8758.js → 6137.js} +10 -8
- package/dist/{4281.js → 6140.js} +18 -10
- package/dist/{8960.js → 6191.js} +2 -2
- package/dist/6240.js +121 -0
- package/dist/{4490.js → 6373.js} +7 -5
- package/dist/{904.js → 6487.js} +19 -17
- package/dist/{9635.js → 6498.js} +1 -1
- package/dist/6499.js +4 -7
- package/dist/6508.js +7 -0
- package/dist/{8225.js → 6540.js} +1 -0
- package/dist/6551.js +46 -0
- package/dist/{9369.js → 6620.js} +35 -34
- package/dist/{4143.js → 6838.js} +19 -10
- package/dist/6902.js +48 -0
- package/dist/6904.js +51 -0
- package/dist/70.js +24 -0
- package/dist/7024.js +39 -0
- package/dist/{6882.js → 721.js} +737 -362
- package/dist/{951.js → 7270.js} +4 -4
- package/dist/{3485.js → 7323.js} +143 -111
- package/dist/{7541.js → 7488.js} +2 -2
- package/dist/{4863.js → 7542.js} +7 -6
- package/dist/7551.js +28 -0
- package/dist/{7021.js → 7640.js} +1 -1
- package/dist/{353.js → 7692.js} +3 -7
- package/dist/{4707.js → 7930.js} +2 -2
- package/dist/{8052.js → 8.js} +80 -64
- package/dist/{6914.js → 8129.js} +3 -15
- package/dist/{3319.js → 8358.js} +62 -63
- package/dist/{5864.js → 8407.js} +13 -13
- package/dist/8488.js +15 -0
- package/dist/{4768.js → 8495.js} +1 -1
- package/dist/8734.js +171 -0
- package/dist/{1763.js → 9018.js} +205 -331
- package/dist/9053.js +29 -0
- package/dist/9067.js +41 -0
- package/dist/{2861.js → 9120.js} +2 -2
- package/dist/{42.js → 9197.js} +2 -2
- package/dist/{9189.js → 9248.js} +36 -17
- package/dist/{2801.js → 9252.js} +4 -9
- package/dist/9295.js +7 -0
- package/dist/9303.js +8 -0
- package/dist/{167.js → 9374.js} +1 -1
- package/dist/{9352.js → 9540.js} +17 -47
- package/dist/9576.js +51 -0
- package/dist/{8272.js → 9591.js} +36 -46
- package/dist/{6107.js → 9770.js} +2 -2
- package/dist/{5085.js → 9880.js} +6 -3
- package/dist/Accordion/index.d.ts +207 -41
- package/dist/Accordion/index.js +75 -177
- package/dist/AlertDialog/index.d.ts +440 -140
- package/dist/AlertDialog/index.js +3 -13
- package/dist/Autocomplete/index.d.ts +722 -150
- package/dist/Autocomplete/index.js +16 -29
- package/dist/Avatar/index.d.ts +38 -3
- package/dist/Avatar/index.js +82 -28
- package/dist/Breadcrumbs/index.d.ts +63 -91
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/Button/index.d.ts +11 -0
- package/dist/Button/index.js +2 -2
- package/dist/Checkbox/index.d.ts +206 -36
- package/dist/Checkbox/index.js +293 -8
- package/dist/CheckboxField/index.css +1 -1
- package/dist/CheckboxField/index.d.ts +40 -36
- package/dist/CheckboxGroup/index.d.ts +50 -36
- package/dist/CheckboxGroup/index.js +87 -58
- package/dist/CheckboxGroupField/index.css +1 -1
- package/dist/Collapsible/index.d.ts +128 -36
- package/dist/Collapsible/index.js +21 -25
- package/dist/Combobox/index.d.ts +801 -158
- package/dist/Combobox/index.js +70 -114
- package/dist/ContextMenu/index.d.ts +1162 -195
- package/dist/ContextMenu/index.js +46 -36
- package/dist/Dialog/index.d.ts +425 -133
- package/dist/Dialog/index.js +8 -4
- package/dist/Drawer/index.d.ts +589 -144
- package/dist/Drawer/index.js +482 -562
- package/dist/Field/index.css +1 -1
- package/dist/Field/index.d.ts +341 -42
- package/dist/Field/index.js +123 -273
- package/dist/Fieldset/index.d.ts +11 -0
- package/dist/Fieldset/index.js +10 -17
- package/dist/Form/index.d.ts +43 -39
- package/dist/Form/index.js +58 -50
- package/dist/Input/index.css +1 -1
- package/dist/Input/index.d.ts +94 -42
- package/dist/Input/index.js +1 -1
- package/dist/Menu/index.d.ts +1140 -175
- package/dist/Menu/index.js +51 -67
- package/dist/Menubar/index.d.ts +651 -173
- package/dist/Menubar/index.js +12 -16
- package/dist/Meter/index.js +21 -18
- package/dist/NavigationMenu/index.d.ts +370 -86
- package/dist/NavigationMenu/index.js +144 -178
- package/dist/NumberField/index.css +1 -1
- package/dist/NumberField/index.d.ts +507 -47
- package/dist/NumberField/index.js +434 -718
- package/dist/Popover/index.d.ts +561 -142
- package/dist/Popover/index.js +181 -252
- package/dist/PreviewCard/index.d.ts +507 -143
- package/dist/PreviewCard/index.js +97 -151
- package/dist/Progress/index.d.ts +117 -3
- package/dist/Progress/index.js +37 -36
- package/dist/Radio/index.d.ts +177 -7
- package/dist/Radio/index.js +54 -70
- package/dist/RadioField/index.css +1 -1
- package/dist/RadioField/index.d.ts +23 -7
- package/dist/RadioGroup/index.d.ts +51 -37
- package/dist/RadioGroup/index.js +60 -51
- package/dist/RadioGroupField/index.css +1 -1
- package/dist/RadioGroupField/index.d.ts +40 -37
- package/dist/ScrollArea/index.d.ts +295 -1
- package/dist/ScrollArea/index.js +256 -324
- package/dist/Select/index.d.ts +516 -123
- package/dist/Select/index.js +513 -635
- package/dist/SelectField/index.css +1 -1
- package/dist/SelectField/index.d.ts +109 -134
- package/dist/SelectField/index.js +5 -1
- package/dist/Separator/index.d.ts +12 -0
- package/dist/Separator/index.js +1 -1
- package/dist/Slider/index.d.ts +383 -64
- package/dist/Slider/index.js +298 -374
- package/dist/Switch/index.d.ts +184 -37
- package/dist/Switch/index.js +44 -58
- package/dist/Tabs/index.d.ts +220 -35
- package/dist/Tabs/index.js +199 -193
- package/dist/Toast/index.d.ts +280 -64
- package/dist/Toast/index.js +299 -374
- package/dist/Toggle/index.d.ts +55 -35
- package/dist/Toggle/index.js +19 -13
- package/dist/ToggleGroup/index.d.ts +62 -35
- package/dist/ToggleGroup/index.js +13 -31
- package/dist/Toolbar/index.d.ts +117 -2
- package/dist/Toolbar/index.js +31 -43
- package/dist/Tooltip/index.d.ts +507 -150
- package/dist/Tooltip/index.js +163 -213
- package/dist/index.d.ts +12912 -5382
- package/package.json +3 -3
- package/dist/2205.js +0 -26
- package/dist/2274.js +0 -34
- package/dist/2287.js +0 -17
- package/dist/3020.js +0 -7
- package/dist/3021.js +0 -72
- package/dist/3140.js +0 -4
- package/dist/3248.js +0 -307
- package/dist/4026.js +0 -12
- package/dist/4922.js +0 -15
- package/dist/5659.js +0 -4
- package/dist/5992.js +0 -447
- package/dist/6330.js +0 -30
- package/dist/6535.js +0 -72
- package/dist/6917.js +0 -55
- package/dist/7725.js +0 -10
- package/dist/7871.js +0 -38
- package/dist/8106.js +0 -239
- package/dist/8685.js +0 -102
- package/dist/8935.js +0 -8
- package/dist/8971.js +0 -40
- package/dist/8979.js +0 -10
- package/dist/9048.js +0 -52
- package/dist/9087.js +0 -256
- package/dist/9255.js +0 -136
- /package/dist/{1457.js → 1068.js} +0 -0
- /package/dist/{6003.js → 1234.js} +0 -0
- /package/dist/{4723.js → 1282.js} +0 -0
- /package/dist/{6825.js → 1876.js} +0 -0
- /package/dist/{5778.js → 1885.js} +0 -0
- /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
- /package/dist/{1279.js → 3278.js} +0 -0
- /package/dist/{3296.js → 5568.js} +0 -0
- /package/dist/{8685.css → 6240.css} +0 -0
- /package/dist/{9829.js → 6488.js} +0 -0
- /package/dist/{9863.js → 6534.js} +0 -0
- /package/dist/{4495.js → 7718.js} +0 -0
- /package/dist/{3395.js → 8866.js} +0 -0
- /package/dist/{2418.js → 9837.js} +0 -0
package/dist/Tabs/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import {
|
|
4
|
-
import { useControlled } from "../
|
|
5
|
-
import { useIsoLayoutEffect } from "../
|
|
6
|
-
import { useStableCallback } from "../
|
|
7
|
-
import { createChangeEventDetails } from "../
|
|
8
|
-
import { missing, initial, disabled as reason_parts_disabled } from "../
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { useForcedRerendering } from "../
|
|
19
|
-
import { getCssDimensions } from "../
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
3
|
+
import { utils_formatErrorMessage } from "../5473.js";
|
|
4
|
+
import { useControlled } from "../6006.js";
|
|
5
|
+
import { useIsoLayoutEffect } from "../3357.js";
|
|
6
|
+
import { useStableCallback } from "../7488.js";
|
|
7
|
+
import { createChangeEventDetails } from "../8495.js";
|
|
8
|
+
import { missing, initial, disabled as reason_parts_disabled } from "../9837.js";
|
|
9
|
+
import { EMPTY_ARRAY, useRenderElement } from "../9591.js";
|
|
10
|
+
import { CompositeList } from "../3014.js";
|
|
11
|
+
import { useCompositeRootContext } from "../1219.js";
|
|
12
|
+
import { useBaseUiId } from "../5969.js";
|
|
13
|
+
import { useCompositeItem } from "../9053.js";
|
|
14
|
+
import { contains, activeElement } from "../4155.js";
|
|
15
|
+
import { ownerDocument } from "../6488.js";
|
|
16
|
+
import { useButton } from "../9248.js";
|
|
17
|
+
import { ACTIVE_COMPOSITE_ITEM } from "../1629.js";
|
|
18
|
+
import { useForcedRerendering } from "../4989.js";
|
|
19
|
+
import { getCssDimensions } from "../3093.js";
|
|
20
|
+
import { PrehydrationScript } from "../5984.js";
|
|
21
|
+
import { getWindow, isLastTraversableNode, getParentNode, isHTMLElement } from "../3829.js";
|
|
22
|
+
import { getElementTransform } from "../7551.js";
|
|
23
|
+
import { useOpenChangeComplete } from "../6620.js";
|
|
24
|
+
import { transitionStatusMapping } from "../8488.js";
|
|
25
|
+
import { useCompositeListItem } from "../9576.js";
|
|
26
|
+
import { useTransitionStatus } from "../7542.js";
|
|
27
|
+
import { inertValue } from "../9374.js";
|
|
28
|
+
import { CompositeRoot } from "../3502.js";
|
|
25
29
|
import * as __rspack_external_react from "react";
|
|
26
30
|
const TabsRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
27
31
|
if ("production" !== process.env.NODE_ENV) TabsRootContext.displayName = "TabsRootContext";
|
|
28
32
|
function useTabsRootContext() {
|
|
29
33
|
const context = __rspack_external_react.useContext(TabsRootContext);
|
|
30
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.' :
|
|
34
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.' : utils_formatErrorMessage(64));
|
|
31
35
|
return context;
|
|
32
36
|
}
|
|
33
|
-
|
|
34
|
-
TabsRootDataAttributes["activationDirection"] = "data-activation-direction";
|
|
35
|
-
TabsRootDataAttributes["orientation"] = "data-orientation";
|
|
36
|
-
return TabsRootDataAttributes;
|
|
37
|
-
}({});
|
|
37
|
+
const TabsRootDataAttributes_activationDirection = 'data-activation-direction';
|
|
38
38
|
const tabsStateAttributesMapping = {
|
|
39
39
|
tabActivationDirection: (dir)=>({
|
|
40
|
-
[
|
|
40
|
+
[TabsRootDataAttributes_activationDirection]: dir
|
|
41
41
|
})
|
|
42
42
|
};
|
|
43
43
|
const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
@@ -53,11 +53,8 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
53
53
|
});
|
|
54
54
|
const isControlled = void 0 !== valueProp;
|
|
55
55
|
const [tabMap, setTabMap] = __rspack_external_react.useState(()=>new Map());
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
for (const [tabElement, tabMetadata] of tabMap.entries())if (null != tabMetadata && selectedValue === (tabMetadata.value ?? tabMetadata.index)) return tabElement;
|
|
59
|
-
return null;
|
|
60
|
-
}, [
|
|
56
|
+
const lastKnownTabElementRef = __rspack_external_react.useRef(void 0);
|
|
57
|
+
const getTabElementBySelectedValue = __rspack_external_react.useCallback((selectedValue)=>findTabElement(tabMap, selectedValue), [
|
|
61
58
|
tabMap
|
|
62
59
|
]);
|
|
63
60
|
const [activationDirectionState, setActivationDirectionState] = __rspack_external_react.useState(()=>({
|
|
@@ -89,7 +86,7 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
89
86
|
eventDetails.activationDirection = activationDirection;
|
|
90
87
|
onValueChangeProp?.(newValue, eventDetails);
|
|
91
88
|
if (eventDetails.isCanceled) return;
|
|
92
|
-
setValue(newValue);
|
|
89
|
+
setValue(()=>newValue);
|
|
93
90
|
});
|
|
94
91
|
const notifyAutomaticValueChange = useStableCallback((nextValue, reason)=>{
|
|
95
92
|
onValueChangeProp?.(nextValue, createChangeEventDetails(reason, void 0, void 0, {
|
|
@@ -98,25 +95,24 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
98
95
|
});
|
|
99
96
|
const registerMountedTabPanel = useStableCallback((panelValue, panelId)=>{
|
|
100
97
|
setMountedTabPanels((prev)=>{
|
|
101
|
-
if (prev.get(panelValue) === panelId) return prev;
|
|
102
98
|
const next = new Map(prev);
|
|
103
99
|
next.set(panelValue, panelId);
|
|
104
100
|
return next;
|
|
105
101
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
102
|
+
return ()=>{
|
|
103
|
+
setMountedTabPanels((prev)=>{
|
|
104
|
+
if (prev.get(panelValue) !== panelId) return prev;
|
|
105
|
+
const next = new Map(prev);
|
|
106
|
+
next.delete(panelValue);
|
|
107
|
+
return next;
|
|
108
|
+
});
|
|
109
|
+
};
|
|
114
110
|
});
|
|
115
111
|
const getTabPanelIdByValue = __rspack_external_react.useCallback((tabValue)=>mountedTabPanels.get(tabValue), [
|
|
116
112
|
mountedTabPanels
|
|
117
113
|
]);
|
|
118
114
|
const getTabIdByPanelValue = __rspack_external_react.useCallback((tabPanelValue)=>{
|
|
119
|
-
for (const tabMetadata of tabMap.values())if (tabPanelValue === tabMetadata
|
|
115
|
+
for (const tabMetadata of tabMap.values())if (tabPanelValue === tabMetadata.value) return tabMetadata.id;
|
|
120
116
|
}, [
|
|
121
117
|
tabMap
|
|
122
118
|
]);
|
|
@@ -128,7 +124,6 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
128
124
|
orientation,
|
|
129
125
|
registerMountedTabPanel,
|
|
130
126
|
setTabMap,
|
|
131
|
-
unregisterMountedTabPanel,
|
|
132
127
|
tabActivationDirection,
|
|
133
128
|
value
|
|
134
129
|
}), [
|
|
@@ -139,48 +134,45 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
139
134
|
orientation,
|
|
140
135
|
registerMountedTabPanel,
|
|
141
136
|
setTabMap,
|
|
142
|
-
unregisterMountedTabPanel,
|
|
143
137
|
tabActivationDirection,
|
|
144
138
|
value
|
|
145
139
|
]);
|
|
146
140
|
const selectedTabMetadata = __rspack_external_react.useMemo(()=>{
|
|
147
|
-
for (const tabMetadata of tabMap.values())if (
|
|
141
|
+
for (const tabMetadata of tabMap.values())if (tabMetadata.value === value) return tabMetadata;
|
|
148
142
|
}, [
|
|
149
143
|
tabMap,
|
|
150
144
|
value
|
|
151
145
|
]);
|
|
152
146
|
const firstEnabledTabValue = __rspack_external_react.useMemo(()=>{
|
|
153
|
-
for (const tabMetadata of tabMap.values())if (
|
|
147
|
+
for (const tabMetadata of tabMap.values())if (!tabMetadata.disabled) return tabMetadata.value;
|
|
154
148
|
}, [
|
|
155
149
|
tabMap
|
|
156
150
|
]);
|
|
157
151
|
const shouldNotifyInitialValueChangeRef = __rspack_external_react.useRef(!hasExplicitDefaultValueProp);
|
|
152
|
+
const initialDefaultValueRef = __rspack_external_react.useRef(defaultValueProp);
|
|
158
153
|
const shouldHonorDisabledDefaultValueRef = __rspack_external_react.useRef(hasExplicitDefaultValueProp);
|
|
159
154
|
const didRegisterTabsRef = __rspack_external_react.useRef(false);
|
|
160
155
|
useIsoLayoutEffect(()=>{
|
|
161
156
|
if (isControlled) return;
|
|
162
157
|
function commitAutomaticValueChange(fallbackValue, fallbackReason) {
|
|
163
|
-
setValue(fallbackValue);
|
|
164
|
-
setActivationDirectionState(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
previousValue: fallbackValue,
|
|
168
|
-
tabActivationDirection: 'none'
|
|
169
|
-
};
|
|
158
|
+
setValue(()=>fallbackValue);
|
|
159
|
+
setActivationDirectionState({
|
|
160
|
+
previousValue: fallbackValue,
|
|
161
|
+
tabActivationDirection: 'none'
|
|
170
162
|
});
|
|
171
163
|
notifyAutomaticValueChange(fallbackValue, fallbackReason);
|
|
172
164
|
shouldNotifyInitialValueChangeRef.current = false;
|
|
173
165
|
}
|
|
174
166
|
if (0 === tabMap.size) {
|
|
175
|
-
if (
|
|
176
|
-
commitAutomaticValueChange(null, missing);
|
|
167
|
+
if (didRegisterTabsRef.current && null !== value && !lastKnownTabElementRef.current?.isConnected) commitAutomaticValueChange(null, missing);
|
|
177
168
|
return;
|
|
178
169
|
}
|
|
179
170
|
didRegisterTabsRef.current = true;
|
|
171
|
+
lastKnownTabElementRef.current = tabMap.keys().next().value;
|
|
180
172
|
const selectionIsDisabled = selectedTabMetadata?.disabled;
|
|
181
173
|
const selectionIsMissing = null == selectedTabMetadata && null !== value;
|
|
182
|
-
if (!selectionIsDisabled && value ===
|
|
183
|
-
if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value ===
|
|
174
|
+
if (!selectionIsDisabled && value === initialDefaultValueRef.current) shouldHonorDisabledDefaultValueRef.current = false;
|
|
175
|
+
if (shouldHonorDisabledDefaultValueRef.current && selectionIsDisabled && value === initialDefaultValueRef.current) return;
|
|
184
176
|
const shouldNotifyInitialValueChange = shouldNotifyInitialValueChangeRef.current;
|
|
185
177
|
if (selectionIsDisabled || selectionIsMissing) {
|
|
186
178
|
const fallbackValue = firstEnabledTabValue ?? null;
|
|
@@ -199,7 +191,6 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
199
191
|
shouldNotifyInitialValueChangeRef.current = false;
|
|
200
192
|
}
|
|
201
193
|
}, [
|
|
202
|
-
defaultValueProp,
|
|
203
194
|
firstEnabledTabValue,
|
|
204
195
|
isControlled,
|
|
205
196
|
notifyAutomaticValueChange,
|
|
@@ -227,46 +218,45 @@ const TabsRoot_TabsRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
227
218
|
});
|
|
228
219
|
});
|
|
229
220
|
if ("production" !== process.env.NODE_ENV) TabsRoot_TabsRoot.displayName = "TabsRoot";
|
|
221
|
+
function findTabElement(tabMap, value) {
|
|
222
|
+
for (const [tabElement, tabMetadata] of tabMap.entries())if (value === tabMetadata.value) return tabElement;
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
230
225
|
function computeActivationDirection(oldValue, newValue, orientation, tabMap) {
|
|
231
226
|
if (null == oldValue || null == newValue) return 'none';
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
227
|
+
const [positionProp, backward, forward] = 'horizontal' === orientation ? [
|
|
228
|
+
'left',
|
|
229
|
+
'left',
|
|
230
|
+
'right'
|
|
231
|
+
] : [
|
|
232
|
+
'top',
|
|
233
|
+
'up',
|
|
234
|
+
'down'
|
|
235
|
+
];
|
|
236
|
+
const oldTab = findTabElement(tabMap, oldValue);
|
|
237
|
+
const newTab = findTabElement(tabMap, newValue);
|
|
241
238
|
if (null == oldTab || null == newTab) {
|
|
242
|
-
if (oldTab !== newTab && ('number' == typeof oldValue || 'string' == typeof oldValue) && typeof oldValue === typeof newValue)
|
|
243
|
-
if ('horizontal' === orientation) return newValue > oldValue ? 'right' : 'left';
|
|
244
|
-
return newValue > oldValue ? 'down' : 'up';
|
|
245
|
-
}
|
|
239
|
+
if (oldTab !== newTab && ('number' == typeof oldValue || 'string' == typeof oldValue) && typeof oldValue === typeof newValue) return newValue > oldValue ? forward : backward;
|
|
246
240
|
return 'none';
|
|
247
241
|
}
|
|
248
|
-
const
|
|
249
|
-
const
|
|
250
|
-
if (
|
|
251
|
-
|
|
252
|
-
if (newRect.left > oldRect.left) return 'right';
|
|
253
|
-
} else {
|
|
254
|
-
if (newRect.top < oldRect.top) return 'up';
|
|
255
|
-
if (newRect.top > oldRect.top) return 'down';
|
|
256
|
-
}
|
|
242
|
+
const oldPosition = oldTab.getBoundingClientRect()[positionProp];
|
|
243
|
+
const newPosition = newTab.getBoundingClientRect()[positionProp];
|
|
244
|
+
if (newPosition < oldPosition) return backward;
|
|
245
|
+
if (newPosition > oldPosition) return forward;
|
|
257
246
|
return 'none';
|
|
258
247
|
}
|
|
259
248
|
const TabsListContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
260
249
|
if ("production" !== process.env.NODE_ENV) TabsListContext.displayName = "TabsListContext";
|
|
261
250
|
function useTabsListContext() {
|
|
262
251
|
const context = __rspack_external_react.useContext(TabsListContext);
|
|
263
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.' :
|
|
252
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.' : utils_formatErrorMessage(65));
|
|
264
253
|
return context;
|
|
265
254
|
}
|
|
266
255
|
const TabsTab_TabsTab = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
267
256
|
const { className, disabled = false, render, value, id: idProp, nativeButton = true, style, ...elementProps } = componentProps;
|
|
268
|
-
const { value: activeTabValue, getTabPanelIdByValue, orientation } = useTabsRootContext();
|
|
269
|
-
const { activateOnFocus,
|
|
257
|
+
const { value: activeTabValue, getTabPanelIdByValue, onValueChange, orientation, tabActivationDirection } = useTabsRootContext();
|
|
258
|
+
const { activateOnFocus, registerTabResizeObserverElement, tabsListElement } = useTabsListContext();
|
|
259
|
+
const { highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
|
|
270
260
|
const id = useBaseUiId(idProp);
|
|
271
261
|
const tabMetadata = __rspack_external_react.useMemo(()=>({
|
|
272
262
|
disabled,
|
|
@@ -282,31 +272,28 @@ const TabsTab_TabsTab = /*#__PURE__*/ __rspack_external_react.forwardRef(functio
|
|
|
282
272
|
});
|
|
283
273
|
const active = value === activeTabValue;
|
|
284
274
|
const isNavigatingRef = __rspack_external_react.useRef(false);
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
}, [
|
|
291
|
-
registerTabResizeObserverElement
|
|
292
|
-
]);
|
|
275
|
+
const unobserveTabElementRef = __rspack_external_react.useRef(null);
|
|
276
|
+
const observeTabElement = useStableCallback((element)=>{
|
|
277
|
+
unobserveTabElementRef.current?.();
|
|
278
|
+
unobserveTabElementRef.current = element ? registerTabResizeObserverElement(element) : null;
|
|
279
|
+
});
|
|
293
280
|
useIsoLayoutEffect(()=>{
|
|
294
281
|
if (isNavigatingRef.current) {
|
|
295
282
|
isNavigatingRef.current = false;
|
|
296
283
|
return;
|
|
297
284
|
}
|
|
298
|
-
if (!(active && index > -1 &&
|
|
285
|
+
if (!(active && index > -1 && highlightedIndex !== index)) return;
|
|
299
286
|
const listElement = tabsListElement;
|
|
300
287
|
if (null != listElement) {
|
|
301
288
|
const activeEl = activeElement(ownerDocument(listElement));
|
|
302
289
|
if (activeEl && contains(listElement, activeEl)) return;
|
|
303
290
|
}
|
|
304
|
-
if (!disabled)
|
|
291
|
+
if (!disabled) onHighlightedIndexChange(index);
|
|
305
292
|
}, [
|
|
306
293
|
active,
|
|
307
294
|
index,
|
|
308
|
-
|
|
309
|
-
|
|
295
|
+
highlightedIndex,
|
|
296
|
+
onHighlightedIndexChange,
|
|
310
297
|
disabled,
|
|
311
298
|
tabsListElement
|
|
312
299
|
]);
|
|
@@ -318,39 +305,38 @@ const TabsTab_TabsTab = /*#__PURE__*/ __rspack_external_react.forwardRef(functio
|
|
|
318
305
|
const tabPanelId = getTabPanelIdByValue(value);
|
|
319
306
|
const isPressingRef = __rspack_external_react.useRef(false);
|
|
320
307
|
const isMainButtonRef = __rspack_external_react.useRef(false);
|
|
321
|
-
function
|
|
322
|
-
|
|
323
|
-
onTabActivation(value, createChangeEventDetails("none", event.nativeEvent, void 0, {
|
|
308
|
+
function activate(event) {
|
|
309
|
+
onValueChange(value, createChangeEventDetails("none", event.nativeEvent, void 0, {
|
|
324
310
|
activationDirection: 'none'
|
|
325
311
|
}));
|
|
326
312
|
}
|
|
313
|
+
function onClick(event) {
|
|
314
|
+
if (active || disabled) return;
|
|
315
|
+
activate(event);
|
|
316
|
+
}
|
|
327
317
|
function onFocus(event) {
|
|
328
|
-
if (active) return;
|
|
329
|
-
if (
|
|
330
|
-
if (disabled) return;
|
|
331
|
-
if (activateOnFocus && (!isPressingRef.current || isPressingRef.current && isMainButtonRef.current)) onTabActivation(value, createChangeEventDetails("none", event.nativeEvent, void 0, {
|
|
332
|
-
activationDirection: 'none'
|
|
333
|
-
}));
|
|
318
|
+
if (active || disabled) return;
|
|
319
|
+
if (activateOnFocus && (!isPressingRef.current || isMainButtonRef.current)) activate(event);
|
|
334
320
|
}
|
|
335
321
|
function onPointerDown(event) {
|
|
336
322
|
if (active || disabled) return;
|
|
337
323
|
isPressingRef.current = true;
|
|
338
|
-
|
|
324
|
+
isMainButtonRef.current = 0 === event.button;
|
|
325
|
+
const doc = ownerDocument(event.currentTarget);
|
|
326
|
+
function handlePointerEnd() {
|
|
339
327
|
isPressingRef.current = false;
|
|
340
328
|
isMainButtonRef.current = false;
|
|
329
|
+
doc.removeEventListener('pointerup', handlePointerEnd);
|
|
330
|
+
doc.removeEventListener('pointercancel', handlePointerEnd);
|
|
341
331
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
const doc = ownerDocument(event.currentTarget);
|
|
345
|
-
doc.addEventListener('pointerup', handlePointerUp, {
|
|
346
|
-
once: true
|
|
347
|
-
});
|
|
348
|
-
}
|
|
332
|
+
doc.addEventListener('pointerup', handlePointerEnd);
|
|
333
|
+
doc.addEventListener('pointercancel', handlePointerEnd);
|
|
349
334
|
}
|
|
350
335
|
const state = {
|
|
351
336
|
disabled,
|
|
352
337
|
active,
|
|
353
|
-
orientation
|
|
338
|
+
orientation,
|
|
339
|
+
tabActivationDirection
|
|
354
340
|
};
|
|
355
341
|
const element = useRenderElement('button', componentProps, {
|
|
356
342
|
state,
|
|
@@ -358,7 +344,7 @@ const TabsTab_TabsTab = /*#__PURE__*/ __rspack_external_react.forwardRef(functio
|
|
|
358
344
|
forwardedRef,
|
|
359
345
|
buttonRef,
|
|
360
346
|
compositeRef,
|
|
361
|
-
|
|
347
|
+
observeTabElement
|
|
362
348
|
],
|
|
363
349
|
props: [
|
|
364
350
|
compositeProps,
|
|
@@ -377,32 +363,30 @@ const TabsTab_TabsTab = /*#__PURE__*/ __rspack_external_react.forwardRef(functio
|
|
|
377
363
|
},
|
|
378
364
|
elementProps,
|
|
379
365
|
getButtonProps
|
|
380
|
-
]
|
|
366
|
+
],
|
|
367
|
+
stateAttributesMapping: tabsStateAttributesMapping
|
|
381
368
|
});
|
|
382
369
|
return element;
|
|
383
370
|
});
|
|
384
371
|
if ("production" !== process.env.NODE_ENV) TabsTab_TabsTab.displayName = "TabsTab";
|
|
385
|
-
const script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
return TabsIndicatorCssVars;
|
|
394
|
-
}({});
|
|
372
|
+
const script = '!function(){const t=document.currentScript.previousElementSibling;if(!t)return;const e=t.closest(\'[role="tablist"]\');if(!e)return;const n=e.querySelector("[data-active]");if(!n)return;const o=getComputedStyle(n);if("none"!==o.transform||"none"!==o.translate||"none"!==o.rotate||"none"!==o.scale)return;function r(t){let e=0,n=0,o=t;for(;null!=o;){e+=o.offsetLeft,n+=o.offsetTop;const t=o.offsetParent;null!=t&&(e+=t.clientLeft,n+=t.clientTop),o=t}return{left:e,top:n}}function i(){const{width:o,height:i}=function(t){const e=getComputedStyle(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;return(Math.round(n)!==t.offsetWidth||Math.round(o)!==t.offsetHeight)&&(n=t.offsetWidth,o=t.offsetHeight),{width:n,height:o}}(n),l=function(t,e){const n=r(t),o=r(e);let i=n.left-o.left-e.clientLeft,l=n.top-o.top-e.clientTop,s=t.parentElement;for(;null!=s&&s!==e;)i-=s.scrollLeft,l-=s.scrollTop,s=s.parentElement;return{left:i,top:l}}(n,e),s=Math.min(l.left,e.scrollWidth-o),f=Math.min(l.top,e.scrollHeight-i),c=e.scrollWidth-s-o,u=e.scrollHeight-f-i;function h(e,n){t.style.setProperty(`--active-tab-${e}`,`${n}px`)}return h("left",s),h("right",c),h("top",f),h("bottom",u),h("width",o),h("height",i),o>0&&i>0&&(t.removeAttribute("hidden"),!0)}if(i()||"undefined"==typeof ResizeObserver)return;let l,s;function f(){s.disconnect(),clearTimeout(l)}s=new ResizeObserver(()=>{t.isConnected&&t.hasAttribute("hidden")&&n.hasAttribute("data-active")?i()&&f():f()}),s.observe(n),l=setTimeout(f,1e4)}();';
|
|
373
|
+
const activeTabLeft = '--active-tab-left';
|
|
374
|
+
const activeTabRight = '--active-tab-right';
|
|
375
|
+
const activeTabTop = '--active-tab-top';
|
|
376
|
+
const activeTabBottom = '--active-tab-bottom';
|
|
377
|
+
const activeTabWidth = '--active-tab-width';
|
|
378
|
+
const activeTabHeight = '--active-tab-height';
|
|
379
|
+
var _PrehydrationScript;
|
|
395
380
|
const stateAttributesMapping = {
|
|
396
381
|
...tabsStateAttributesMapping,
|
|
397
382
|
activeTabPosition: ()=>null,
|
|
398
383
|
activeTabSize: ()=>null
|
|
399
384
|
};
|
|
385
|
+
const MAX_LAYOUT_ROUNDING_ERROR = 2;
|
|
400
386
|
const TabsIndicator_TabsIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
401
387
|
const { className, render, renderBeforeHydration = false, style: styleProp, ...elementProps } = componentProps;
|
|
402
|
-
const { nonce } = useCSPContext();
|
|
403
388
|
const { getTabElementBySelectedValue, orientation, tabActivationDirection, value } = useTabsRootContext();
|
|
404
389
|
const { tabsListElement, registerIndicatorUpdateListener } = useTabsListContext();
|
|
405
|
-
const isHydrating = useIsHydrating();
|
|
406
390
|
const rerender = useForcedRerendering();
|
|
407
391
|
__rspack_external_react.useEffect(()=>registerIndicatorUpdateListener(rerender), [
|
|
408
392
|
registerIndicatorUpdateListener,
|
|
@@ -417,23 +401,23 @@ const TabsIndicator_TabsIndicator = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
417
401
|
let isTabSelected = false;
|
|
418
402
|
if (null != value && null != tabsListElement) {
|
|
419
403
|
const activeTab = getTabElementBySelectedValue(value);
|
|
420
|
-
isTabSelected = true;
|
|
421
404
|
if (null != activeTab) {
|
|
405
|
+
isTabSelected = true;
|
|
422
406
|
const { width: computedWidth, height: computedHeight } = getCssDimensions(activeTab);
|
|
423
407
|
const { width: tabListWidth, height: tabListHeight } = getCssDimensions(tabsListElement);
|
|
424
408
|
const tabRect = activeTab.getBoundingClientRect();
|
|
425
409
|
const tabsListRect = tabsListElement.getBoundingClientRect();
|
|
426
410
|
const scaleX = tabListWidth > 0 ? tabsListRect.width / tabListWidth : 1;
|
|
427
411
|
const scaleY = tabListHeight > 0 ? tabsListRect.height / tabListHeight : 1;
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
left =
|
|
436
|
-
top =
|
|
412
|
+
const layoutOffset = getLayoutOffset(activeTab, tabsListElement);
|
|
413
|
+
left = layoutOffset.left;
|
|
414
|
+
top = layoutOffset.top;
|
|
415
|
+
const rectLeft = (tabRect.left - tabsListRect.left) / scaleX + tabsListElement.scrollLeft - tabsListElement.clientLeft;
|
|
416
|
+
const rectTop = (tabRect.top - tabsListRect.top) / scaleY + tabsListElement.scrollTop - tabsListElement.clientTop;
|
|
417
|
+
const tabTranslation = getActiveTabTranslation(activeTab);
|
|
418
|
+
if (Math.abs(rectLeft - tabTranslation.x - left) <= MAX_LAYOUT_ROUNDING_ERROR && Math.abs(rectTop - tabTranslation.y - top) <= MAX_LAYOUT_ROUNDING_ERROR) {
|
|
419
|
+
left = rectLeft;
|
|
420
|
+
top = rectTop;
|
|
437
421
|
}
|
|
438
422
|
width = computedWidth;
|
|
439
423
|
height = computedHeight;
|
|
@@ -452,12 +436,12 @@ const TabsIndicator_TabsIndicator = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
452
436
|
height
|
|
453
437
|
} : null;
|
|
454
438
|
const style = isTabSelected ? {
|
|
455
|
-
[
|
|
456
|
-
[
|
|
457
|
-
[
|
|
458
|
-
[
|
|
459
|
-
[
|
|
460
|
-
[
|
|
439
|
+
[activeTabLeft]: `${left}px`,
|
|
440
|
+
[activeTabRight]: `${right}px`,
|
|
441
|
+
[activeTabTop]: `${top}px`,
|
|
442
|
+
[activeTabBottom]: `${bottom}px`,
|
|
443
|
+
[activeTabWidth]: `${width}px`,
|
|
444
|
+
[activeTabHeight]: `${height}px`
|
|
461
445
|
} : void 0;
|
|
462
446
|
const displayIndicator = isTabSelected && width > 0 && height > 0;
|
|
463
447
|
const state = {
|
|
@@ -486,44 +470,80 @@ const TabsIndicator_TabsIndicator = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
486
470
|
return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
487
471
|
children: [
|
|
488
472
|
element,
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
__html: script
|
|
493
|
-
},
|
|
494
|
-
suppressHydrationWarning: true
|
|
495
|
-
})
|
|
473
|
+
renderBeforeHydration && (_PrehydrationScript || (_PrehydrationScript = /*#__PURE__*/ jsx(PrehydrationScript, {
|
|
474
|
+
script: script
|
|
475
|
+
})))
|
|
496
476
|
]
|
|
497
477
|
});
|
|
498
478
|
});
|
|
499
479
|
if ("production" !== process.env.NODE_ENV) TabsIndicator_TabsIndicator.displayName = "TabsIndicator";
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
480
|
+
function getLayoutOffset(element, ancestor) {
|
|
481
|
+
const elementOffset = getCumulativeOffset(element);
|
|
482
|
+
const ancestorOffset = getCumulativeOffset(ancestor);
|
|
483
|
+
let left = elementOffset.left - ancestorOffset.left - ancestor.clientLeft;
|
|
484
|
+
let top = elementOffset.top - ancestorOffset.top - ancestor.clientTop;
|
|
485
|
+
let node = getParentNode(element);
|
|
486
|
+
while(isHTMLElement(node) && node !== ancestor && !isLastTraversableNode(node)){
|
|
487
|
+
left -= node.scrollLeft;
|
|
488
|
+
top -= node.scrollTop;
|
|
489
|
+
node = getParentNode(node);
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
left,
|
|
493
|
+
top
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
function getCumulativeOffset(element) {
|
|
497
|
+
let left = 0;
|
|
498
|
+
let top = 0;
|
|
499
|
+
let currentElement = element;
|
|
500
|
+
while(null != currentElement){
|
|
501
|
+
left += currentElement.offsetLeft;
|
|
502
|
+
top += currentElement.offsetTop;
|
|
503
|
+
const offsetParent = currentElement.offsetParent;
|
|
504
|
+
if (null != offsetParent) {
|
|
505
|
+
left += offsetParent.clientLeft;
|
|
506
|
+
top += offsetParent.clientTop;
|
|
507
|
+
}
|
|
508
|
+
currentElement = offsetParent;
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
left,
|
|
512
|
+
top
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function getActiveTabTranslation(element) {
|
|
516
|
+
const computedStyle = getWindow(element).getComputedStyle(element);
|
|
517
|
+
const { x, y } = getElementTransform(element, computedStyle);
|
|
518
|
+
let translateX = x;
|
|
519
|
+
let translateY = y;
|
|
520
|
+
const { translate } = computedStyle;
|
|
521
|
+
if (translate && 'none' !== translate) {
|
|
522
|
+
const parts = translate.split(' ');
|
|
523
|
+
translateX += resolveTranslateLength(parts[0], element.offsetWidth);
|
|
524
|
+
translateY += resolveTranslateLength(parts[1], element.offsetHeight);
|
|
525
|
+
}
|
|
526
|
+
return {
|
|
527
|
+
x: translateX,
|
|
528
|
+
y: translateY
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function resolveTranslateLength(value, referenceSize) {
|
|
532
|
+
if (!value) return 0;
|
|
533
|
+
const numeric = parseFloat(value);
|
|
534
|
+
if (!Number.isFinite(numeric)) return 0;
|
|
535
|
+
return value.endsWith('%') ? numeric / 100 * referenceSize : numeric;
|
|
536
|
+
}
|
|
537
|
+
const TabsPanelDataAttributes_index = 'data-index';
|
|
509
538
|
const TabsPanel_stateAttributesMapping = {
|
|
510
539
|
...tabsStateAttributesMapping,
|
|
511
540
|
...transitionStatusMapping
|
|
512
541
|
};
|
|
513
542
|
const TabsPanel_TabsPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
514
543
|
const { className, value, render, keepMounted = false, style, ...elementProps } = componentProps;
|
|
515
|
-
const { value: selectedValue, getTabIdByPanelValue, orientation, tabActivationDirection, registerMountedTabPanel
|
|
544
|
+
const { value: selectedValue, getTabIdByPanelValue, orientation, tabActivationDirection, registerMountedTabPanel } = useTabsRootContext();
|
|
516
545
|
const id = useBaseUiId();
|
|
517
|
-
const
|
|
518
|
-
id,
|
|
519
|
-
value
|
|
520
|
-
}), [
|
|
521
|
-
id,
|
|
522
|
-
value
|
|
523
|
-
]);
|
|
524
|
-
const { ref: listItemRef, index } = useCompositeListItem({
|
|
525
|
-
metadata
|
|
526
|
-
});
|
|
546
|
+
const { ref: listItemRef, index } = useCompositeListItem();
|
|
527
547
|
const open = value === selectedValue;
|
|
528
548
|
const { mounted, transitionStatus, setMounted } = useTransitionStatus(open);
|
|
529
549
|
const hidden = !mounted;
|
|
@@ -550,7 +570,7 @@ const TabsPanel_TabsPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
550
570
|
role: 'tabpanel',
|
|
551
571
|
tabIndex: open ? 0 : -1,
|
|
552
572
|
inert: inertValue(!open),
|
|
553
|
-
[
|
|
573
|
+
[TabsPanelDataAttributes_index]: index
|
|
554
574
|
},
|
|
555
575
|
elementProps
|
|
556
576
|
],
|
|
@@ -564,19 +584,14 @@ const TabsPanel_TabsPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
564
584
|
}
|
|
565
585
|
});
|
|
566
586
|
useIsoLayoutEffect(()=>{
|
|
567
|
-
if (hidden && !keepMounted) return;
|
|
568
|
-
|
|
569
|
-
registerMountedTabPanel(value, id);
|
|
570
|
-
return ()=>{
|
|
571
|
-
unregisterMountedTabPanel(value, id);
|
|
572
|
-
};
|
|
587
|
+
if (null == id || hidden && !keepMounted) return;
|
|
588
|
+
return registerMountedTabPanel(value, id);
|
|
573
589
|
}, [
|
|
574
590
|
hidden,
|
|
575
591
|
keepMounted,
|
|
576
592
|
value,
|
|
577
593
|
id,
|
|
578
|
-
registerMountedTabPanel
|
|
579
|
-
unregisterMountedTabPanel
|
|
594
|
+
registerMountedTabPanel
|
|
580
595
|
]);
|
|
581
596
|
const shouldRender = keepMounted || mounted;
|
|
582
597
|
if (!shouldRender) return null;
|
|
@@ -585,13 +600,13 @@ const TabsPanel_TabsPanel = /*#__PURE__*/ __rspack_external_react.forwardRef(fun
|
|
|
585
600
|
if ("production" !== process.env.NODE_ENV) TabsPanel_TabsPanel.displayName = "TabsPanel";
|
|
586
601
|
const TabsList_TabsList = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
587
602
|
const { activateOnFocus = false, className, loopFocus = true, render, style, ...elementProps } = componentProps;
|
|
588
|
-
const {
|
|
603
|
+
const { orientation, setTabMap, tabActivationDirection } = useTabsRootContext();
|
|
589
604
|
const [highlightedTabIndex, setHighlightedTabIndex] = __rspack_external_react.useState(0);
|
|
590
605
|
const [tabsListElement, setTabsListElement] = __rspack_external_react.useState(null);
|
|
591
606
|
const indicatorUpdateListenersRef = __rspack_external_react.useRef(new Set());
|
|
592
607
|
const tabResizeObserverElementsRef = __rspack_external_react.useRef(new Set());
|
|
593
608
|
const resizeObserverRef = __rspack_external_react.useRef(null);
|
|
594
|
-
|
|
609
|
+
useIsoLayoutEffect(()=>{
|
|
595
610
|
if ("u" < typeof ResizeObserver) return;
|
|
596
611
|
const resizeObserver = new ResizeObserver(()=>{
|
|
597
612
|
indicatorUpdateListenersRef.current.forEach((listener)=>{
|
|
@@ -624,9 +639,6 @@ const TabsList_TabsList = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
624
639
|
resizeObserverRef.current?.unobserve(element);
|
|
625
640
|
};
|
|
626
641
|
});
|
|
627
|
-
const onTabActivation = useStableCallback((newValue, eventDetails)=>{
|
|
628
|
-
if (newValue !== value) onValueChange(newValue, eventDetails);
|
|
629
|
-
});
|
|
630
642
|
const state = {
|
|
631
643
|
orientation,
|
|
632
644
|
tabActivationDirection
|
|
@@ -637,19 +649,13 @@ const TabsList_TabsList = /*#__PURE__*/ __rspack_external_react.forwardRef(funct
|
|
|
637
649
|
};
|
|
638
650
|
const tabsListContextValue = __rspack_external_react.useMemo(()=>({
|
|
639
651
|
activateOnFocus,
|
|
640
|
-
highlightedTabIndex,
|
|
641
652
|
registerIndicatorUpdateListener,
|
|
642
653
|
registerTabResizeObserverElement,
|
|
643
|
-
onTabActivation,
|
|
644
|
-
setHighlightedTabIndex,
|
|
645
654
|
tabsListElement
|
|
646
655
|
}), [
|
|
647
656
|
activateOnFocus,
|
|
648
|
-
highlightedTabIndex,
|
|
649
657
|
registerIndicatorUpdateListener,
|
|
650
658
|
registerTabResizeObserverElement,
|
|
651
|
-
onTabActivation,
|
|
652
|
-
setHighlightedTabIndex,
|
|
653
659
|
tabsListElement
|
|
654
660
|
]);
|
|
655
661
|
return /*#__PURE__*/ jsx(TabsListContext.Provider, {
|