@wix/site-ui 1.347.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/Tooltip/index.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Timeout, useTimeout } from "../
|
|
4
|
-
import { useIsoLayoutEffect } from "../
|
|
5
|
-
import { useHoverFloatingInteraction, useHoverInteractionSharedState, getDelay } from "../
|
|
6
|
-
import { createChangeEventDetails } from "../
|
|
7
|
-
import {
|
|
2
|
+
import { utils_formatErrorMessage } from "../5473.js";
|
|
3
|
+
import { Timeout, useTimeout } from "../9197.js";
|
|
4
|
+
import { useIsoLayoutEffect } from "../3357.js";
|
|
5
|
+
import { useHoverFloatingInteraction, useHoverInteractionSharedState, getDelay } from "../1607.js";
|
|
6
|
+
import { createChangeEventDetails } from "../8495.js";
|
|
7
|
+
import { getTarget, closest, contains } from "../4155.js";
|
|
8
8
|
import { getWindow, isElement } from "../3829.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { safePolygon, useHoverReferenceInteraction } from "../
|
|
15
|
-
import { useFocus } from "../
|
|
16
|
-
import { imperativeAction,
|
|
17
|
-
import { isMouseLikePointerType } from "../
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
9
|
+
import { fastComponent, fastComponentRef, ReactStore } from "../226.js";
|
|
10
|
+
import { usePopupHandleStore, BasePopupHandle } from "../6040.js";
|
|
11
|
+
import { useBaseUiId } from "../5969.js";
|
|
12
|
+
import { useTriggerDataForwarding, applyPopupOpenChange, PopupTriggerMap, usePopupInteractionProps, PopupHandleAttachment, useImplicitActiveTrigger, useOpenStateTransitions, usePopupRootStore, FOCUSABLE_POPUP_PROPS, useDismiss } from "../4346.js";
|
|
13
|
+
import { useValueAsRef } from "../7930.js";
|
|
14
|
+
import { safePolygon, useHoverReferenceInteraction } from "../3910.js";
|
|
15
|
+
import { useFocus } from "../6487.js";
|
|
16
|
+
import { imperativeAction, triggerHover, triggerPress, disabled as reason_parts_disabled } from "../9837.js";
|
|
17
|
+
import { isMouseLikePointerType } from "../8358.js";
|
|
18
|
+
import { EMPTY_OBJECT, mergeProps, useRenderElement, NOOP } from "../9591.js";
|
|
19
|
+
import { triggerDisabled } from "../6137.js";
|
|
20
|
+
import { triggerOpenStateMapping, popupStateMapping, popupTransitionStateMapping } from "../6904.js";
|
|
21
|
+
import { POPUP_COLLISION_AVOIDANCE } from "../3398.js";
|
|
22
|
+
import { usePositioner, useAnchorPositioning, getDisabledMountTransitionStyles } from "../497.js";
|
|
23
|
+
import { useOpenChangeComplete } from "../6620.js";
|
|
24
|
+
import { usePopupViewport, popupViewportStateMapping } from "../5298.js";
|
|
25
|
+
import { useStableCallback } from "../7488.js";
|
|
26
|
+
import { addEventListener } from "../1282.js";
|
|
27
|
+
import { NullStore, popupStoreSelectors, createInitialPopupStoreState } from "../1669.js";
|
|
28
|
+
import { FloatingPortalLite_FloatingPortalLite } from "../6191.js";
|
|
27
29
|
import * as __rspack_external_react from "react";
|
|
28
|
-
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
29
30
|
const TooltipRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
30
31
|
if ("production" !== process.env.NODE_ENV) TooltipRootContext.displayName = "TooltipRootContext";
|
|
31
32
|
function useTooltipRootContext(optional) {
|
|
32
33
|
const context = __rspack_external_react.useContext(TooltipRootContext);
|
|
33
|
-
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.' :
|
|
34
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.' : utils_formatErrorMessage(72));
|
|
34
35
|
return context;
|
|
35
36
|
}
|
|
36
37
|
const TooltipProviderContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
@@ -56,6 +57,9 @@ const FloatingDelayGroupContext = /*#__PURE__*/ __rspack_external_react.createCo
|
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
if ("production" !== process.env.NODE_ENV) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext";
|
|
60
|
+
function resetDelayRef(delayRef, initialDelayRef) {
|
|
61
|
+
delayRef.current = initialDelayRef.current;
|
|
62
|
+
}
|
|
59
63
|
function FloatingDelayGroup(props) {
|
|
60
64
|
const { children, delay, timeoutMs = 0 } = props;
|
|
61
65
|
const delayRef = __rspack_external_react.useRef(delay);
|
|
@@ -63,6 +67,22 @@ function FloatingDelayGroup(props) {
|
|
|
63
67
|
const currentIdRef = __rspack_external_react.useRef(null);
|
|
64
68
|
const currentContextRef = __rspack_external_react.useRef(null);
|
|
65
69
|
const timeout = useTimeout();
|
|
70
|
+
useIsoLayoutEffect(()=>{
|
|
71
|
+
initialDelayRef.current = delay;
|
|
72
|
+
if (!currentIdRef.current) {
|
|
73
|
+
delayRef.current = delay;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
delayRef.current = {
|
|
77
|
+
open: getDelay(delayRef.current, 'open'),
|
|
78
|
+
close: getDelay(delay, 'close')
|
|
79
|
+
};
|
|
80
|
+
}, [
|
|
81
|
+
delay,
|
|
82
|
+
currentIdRef,
|
|
83
|
+
delayRef,
|
|
84
|
+
initialDelayRef
|
|
85
|
+
]);
|
|
66
86
|
return /*#__PURE__*/ jsx(FloatingDelayGroupContext.Provider, {
|
|
67
87
|
value: __rspack_external_react.useMemo(()=>({
|
|
68
88
|
hasProvider: true,
|
|
@@ -79,22 +99,27 @@ function FloatingDelayGroup(props) {
|
|
|
79
99
|
children: children
|
|
80
100
|
});
|
|
81
101
|
}
|
|
82
|
-
function useDelayGroup(
|
|
102
|
+
function useDelayGroup(store, options = {
|
|
83
103
|
open: false
|
|
84
104
|
}) {
|
|
85
105
|
const { open } = options;
|
|
86
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
87
106
|
const floatingId = store.useState('floatingId');
|
|
88
107
|
const groupContext = __rspack_external_react.useContext(FloatingDelayGroupContext);
|
|
89
108
|
const { currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, hasProvider, timeout } = groupContext;
|
|
90
109
|
const [isInstantPhase, setIsInstantPhase] = __rspack_external_react.useState(false);
|
|
110
|
+
const openRef = __rspack_external_react.useRef(open);
|
|
111
|
+
useIsoLayoutEffect(()=>{
|
|
112
|
+
openRef.current = open;
|
|
113
|
+
}, [
|
|
114
|
+
open
|
|
115
|
+
]);
|
|
91
116
|
useIsoLayoutEffect(()=>{
|
|
92
117
|
function unset() {
|
|
93
|
-
setIsInstantPhase(false);
|
|
94
118
|
currentContextRef.current?.setIsInstantPhase(false);
|
|
95
119
|
currentIdRef.current = null;
|
|
96
120
|
currentContextRef.current = null;
|
|
97
121
|
delayRef.current = initialDelayRef.current;
|
|
122
|
+
timeout.clear();
|
|
98
123
|
}
|
|
99
124
|
if (!currentIdRef.current) return;
|
|
100
125
|
if (!open && currentIdRef.current === floatingId) {
|
|
@@ -106,7 +131,7 @@ function useDelayGroup(context, options = {
|
|
|
106
131
|
unset();
|
|
107
132
|
});
|
|
108
133
|
return ()=>{
|
|
109
|
-
timeout.clear();
|
|
134
|
+
if (openRef.current || currentIdRef.current !== closingId) timeout.clear();
|
|
110
135
|
};
|
|
111
136
|
}
|
|
112
137
|
unset();
|
|
@@ -155,71 +180,57 @@ function useDelayGroup(context, options = {
|
|
|
155
180
|
timeout
|
|
156
181
|
]);
|
|
157
182
|
useIsoLayoutEffect(()=>()=>{
|
|
158
|
-
|
|
183
|
+
if (currentIdRef.current === floatingId) {
|
|
184
|
+
currentContextRef.current = null;
|
|
185
|
+
if (!openRef.current) return;
|
|
186
|
+
currentIdRef.current = null;
|
|
187
|
+
resetDelayRef(delayRef, initialDelayRef);
|
|
188
|
+
timeout.clear();
|
|
189
|
+
}
|
|
159
190
|
}, [
|
|
160
|
-
currentContextRef
|
|
191
|
+
currentContextRef,
|
|
192
|
+
currentIdRef,
|
|
193
|
+
delayRef,
|
|
194
|
+
floatingId,
|
|
195
|
+
initialDelayRef,
|
|
196
|
+
timeout
|
|
161
197
|
]);
|
|
162
198
|
return __rspack_external_react.useMemo(()=>({
|
|
199
|
+
activeIdRef: currentIdRef,
|
|
163
200
|
hasProvider,
|
|
164
201
|
delayRef,
|
|
165
202
|
isInstantPhase
|
|
166
203
|
}), [
|
|
204
|
+
currentIdRef,
|
|
167
205
|
hasProvider,
|
|
168
206
|
delayRef,
|
|
169
207
|
isInstantPhase
|
|
170
208
|
]);
|
|
171
209
|
}
|
|
172
|
-
let TooltipTriggerDataAttributes_TooltipTriggerDataAttributes = function(TooltipTriggerDataAttributes) {
|
|
173
|
-
TooltipTriggerDataAttributes[TooltipTriggerDataAttributes["popupOpen"] = popupStateMapping_CommonTriggerDataAttributes.popupOpen] = "popupOpen";
|
|
174
|
-
TooltipTriggerDataAttributes["triggerDisabled"] = "data-trigger-disabled";
|
|
175
|
-
return TooltipTriggerDataAttributes;
|
|
176
|
-
}({});
|
|
177
210
|
const TOOLTIP_TRIGGER_IDENTIFIER = 'data-base-ui-tooltip-trigger';
|
|
178
211
|
function getTargetElement(event) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
for(let i = 0; i < path.length; i += 1){
|
|
182
|
-
const element = path[i];
|
|
183
|
-
if (isElement(element)) return element;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
const target = event.target;
|
|
187
|
-
if (isElement(target)) return target;
|
|
188
|
-
return null;
|
|
189
|
-
}
|
|
190
|
-
function closestEnabledTooltipTrigger(element) {
|
|
191
|
-
let current = element;
|
|
192
|
-
while(current){
|
|
193
|
-
if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) return current;
|
|
194
|
-
const parentElement = current.parentElement;
|
|
195
|
-
if (parentElement) {
|
|
196
|
-
current = parentElement;
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
const root = current.getRootNode();
|
|
200
|
-
current = 'host' in root && isElement(root.host) ? root.host : null;
|
|
201
|
-
}
|
|
202
|
-
return null;
|
|
212
|
+
const target = getTarget(event);
|
|
213
|
+
return isElement(target) ? target : null;
|
|
203
214
|
}
|
|
204
215
|
const TooltipTrigger_TooltipTrigger = fastComponentRef(function(componentProps, forwardedRef) {
|
|
205
216
|
const { render, className, style, handle, payload, disabled: disabledProp, delay, closeOnClick = true, closeDelay, id: idProp, ...elementProps } = componentProps;
|
|
206
217
|
const rootContext = useTooltipRootContext(true);
|
|
207
|
-
const
|
|
208
|
-
|
|
218
|
+
const handleStore = usePopupHandleStore(handle);
|
|
219
|
+
const store = handleStore ?? rootContext;
|
|
220
|
+
if (!store) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle.' : utils_formatErrorMessage(82));
|
|
209
221
|
const thisTriggerId = useBaseUiId(idProp);
|
|
210
222
|
const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);
|
|
211
223
|
const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
|
|
212
224
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
213
225
|
const triggerElementRef = __rspack_external_react.useRef(null);
|
|
214
|
-
const delayWithDefault = delay ?? 600;
|
|
215
226
|
const closeDelayWithDefault = closeDelay ?? 0;
|
|
216
227
|
const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
217
228
|
payload,
|
|
218
229
|
closeOnClick,
|
|
219
230
|
closeDelay: closeDelayWithDefault
|
|
220
231
|
});
|
|
221
|
-
const
|
|
222
|
-
const { delayRef, isInstantPhase, hasProvider } = useDelayGroup(floatingRootContext, {
|
|
232
|
+
const providerDelay = useTooltipProviderContext();
|
|
233
|
+
const { activeIdRef, delayRef, isInstantPhase, hasProvider } = useDelayGroup(floatingRootContext, {
|
|
223
234
|
open: isOpenedByThisTrigger
|
|
224
235
|
});
|
|
225
236
|
const hoverInteraction = useHoverInteractionSharedState(floatingRootContext);
|
|
@@ -233,16 +244,13 @@ const TooltipTrigger_TooltipTrigger = fastComponentRef(function(componentProps,
|
|
|
233
244
|
const nestedTriggerOpenTimeout = useTimeout();
|
|
234
245
|
const pointerTypeRef = __rspack_external_react.useRef(void 0);
|
|
235
246
|
function getOpenDelay() {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
let computedOpenDelay = delayWithDefault;
|
|
239
|
-
if (hasProvider) computedOpenDelay = 0 !== groupOpenValue ? delay ?? providerDelay ?? delayWithDefault : 0;
|
|
240
|
-
return computedOpenDelay;
|
|
247
|
+
if (hasProvider && null != activeIdRef.current) return 0;
|
|
248
|
+
return delay ?? providerDelay ?? 600;
|
|
241
249
|
}
|
|
242
250
|
function isEnabledNestedTriggerTarget(target) {
|
|
243
251
|
const triggerEl = triggerElementRef.current;
|
|
244
252
|
if (!triggerEl || !target) return false;
|
|
245
|
-
const nearestTrigger =
|
|
253
|
+
const nearestTrigger = closest(target, `[${TOOLTIP_TRIGGER_IDENTIFIER}]`);
|
|
246
254
|
return null !== nearestTrigger && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger);
|
|
247
255
|
}
|
|
248
256
|
function detectNestedTriggerHover(target) {
|
|
@@ -263,11 +271,11 @@ const TooltipTrigger_TooltipTrigger = fastComponentRef(function(componentProps,
|
|
|
263
271
|
handleClose: disableHoverablePopup || 'both' === trackCursorAxis ? null : safePolygon(),
|
|
264
272
|
restMs: getOpenDelay,
|
|
265
273
|
delay () {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
274
|
+
if (null == closeDelay && hasProvider) return {
|
|
275
|
+
close: getDelay(delayRef.current, 'close')
|
|
276
|
+
};
|
|
269
277
|
return {
|
|
270
|
-
close:
|
|
278
|
+
close: closeDelayWithDefault
|
|
271
279
|
};
|
|
272
280
|
},
|
|
273
281
|
triggerElementRef,
|
|
@@ -298,8 +306,7 @@ const TooltipTrigger_TooltipTrigger = fastComponentRef(function(componentProps,
|
|
|
298
306
|
} else nestedTriggerOpenTimeout.start(openDelay, open);
|
|
299
307
|
}
|
|
300
308
|
};
|
|
301
|
-
const rootTriggerProps = store.useState('
|
|
302
|
-
const shouldApplyRootTriggerProps = isMountedByThisTrigger || 'none' !== trackCursorAxis;
|
|
309
|
+
const rootTriggerProps = store.useState('appliedTriggerProps', isMountedByThisTrigger || 'none' !== trackCursorAxis);
|
|
303
310
|
const state = {
|
|
304
311
|
open: isOpenedByThisTrigger
|
|
305
312
|
};
|
|
@@ -313,7 +320,7 @@ const TooltipTrigger_TooltipTrigger = fastComponentRef(function(componentProps,
|
|
|
313
320
|
props: [
|
|
314
321
|
hoverProps,
|
|
315
322
|
focusProps,
|
|
316
|
-
|
|
323
|
+
rootTriggerProps,
|
|
317
324
|
{
|
|
318
325
|
onMouseOver (event) {
|
|
319
326
|
handleNestedTriggerHover(event.nativeEvent);
|
|
@@ -338,7 +345,7 @@ const TooltipTrigger_TooltipTrigger = fastComponentRef(function(componentProps,
|
|
|
338
345
|
if (closeOnClick && !store.select('open')) store.cancelPendingOpen(event.nativeEvent);
|
|
339
346
|
},
|
|
340
347
|
id: thisTriggerId,
|
|
341
|
-
[
|
|
348
|
+
[triggerDisabled]: disabled ? '' : void 0,
|
|
342
349
|
[TOOLTIP_TRIGGER_IDENTIFIER]: disabled ? void 0 : ''
|
|
343
350
|
},
|
|
344
351
|
elementProps
|
|
@@ -352,14 +359,14 @@ const TooltipPositionerContext = /*#__PURE__*/ __rspack_external_react.createCon
|
|
|
352
359
|
if ("production" !== process.env.NODE_ENV) TooltipPositionerContext.displayName = "TooltipPositionerContext";
|
|
353
360
|
function useTooltipPositionerContext() {
|
|
354
361
|
const context = __rspack_external_react.useContext(TooltipPositionerContext);
|
|
355
|
-
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.' :
|
|
362
|
+
if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.' : utils_formatErrorMessage(71));
|
|
356
363
|
return context;
|
|
357
364
|
}
|
|
358
365
|
const TooltipPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
359
366
|
if ("production" !== process.env.NODE_ENV) TooltipPortalContext.displayName = "TooltipPortalContext";
|
|
360
367
|
function useTooltipPortalContext() {
|
|
361
368
|
const value = __rspack_external_react.useContext(TooltipPortalContext);
|
|
362
|
-
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Tooltip.Portal> is missing.' :
|
|
369
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Tooltip.Portal> is missing.' : utils_formatErrorMessage(70));
|
|
363
370
|
return value;
|
|
364
371
|
}
|
|
365
372
|
const TooltipPositioner_TooltipPositioner = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
@@ -373,7 +380,7 @@ const TooltipPositioner_TooltipPositioner = /*#__PURE__*/ __rspack_external_reac
|
|
|
373
380
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
374
381
|
const instantType = store.useState('instantType');
|
|
375
382
|
const transitionStatus = store.useState('transitionStatus');
|
|
376
|
-
const
|
|
383
|
+
const adaptiveOrigin = store.useState('adaptiveOrigin');
|
|
377
384
|
const positioning = useAnchorPositioning({
|
|
378
385
|
anchor,
|
|
379
386
|
positionMethod,
|
|
@@ -390,7 +397,7 @@ const TooltipPositioner_TooltipPositioner = /*#__PURE__*/ __rspack_external_reac
|
|
|
390
397
|
disableAnchorTracking,
|
|
391
398
|
keepMounted,
|
|
392
399
|
collisionAvoidance,
|
|
393
|
-
adaptiveOrigin
|
|
400
|
+
adaptiveOrigin
|
|
394
401
|
});
|
|
395
402
|
const state = __rspack_external_react.useMemo(()=>({
|
|
396
403
|
open,
|
|
@@ -423,10 +430,6 @@ const TooltipPositioner_TooltipPositioner = /*#__PURE__*/ __rspack_external_reac
|
|
|
423
430
|
});
|
|
424
431
|
});
|
|
425
432
|
if ("production" !== process.env.NODE_ENV) TooltipPositioner_TooltipPositioner.displayName = "TooltipPositioner";
|
|
426
|
-
const stateAttributesMapping = {
|
|
427
|
-
...popupStateMapping,
|
|
428
|
-
...transitionStatusMapping
|
|
429
|
-
};
|
|
430
433
|
const TooltipPopup_TooltipPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
431
434
|
const { render, className, style, ...elementProps } = componentProps;
|
|
432
435
|
const store = useTooltipRootContext();
|
|
@@ -465,11 +468,12 @@ const TooltipPopup_TooltipPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
465
468
|
setPopupElement
|
|
466
469
|
],
|
|
467
470
|
props: [
|
|
471
|
+
FOCUSABLE_POPUP_PROPS,
|
|
468
472
|
popupProps,
|
|
469
473
|
getDisabledMountTransitionStyles(transitionStatus),
|
|
470
474
|
elementProps
|
|
471
475
|
],
|
|
472
|
-
stateAttributesMapping:
|
|
476
|
+
stateAttributesMapping: popupTransitionStateMapping
|
|
473
477
|
});
|
|
474
478
|
return element;
|
|
475
479
|
});
|
|
@@ -505,16 +509,6 @@ const TooltipArrow_TooltipArrow = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
505
509
|
return element;
|
|
506
510
|
});
|
|
507
511
|
if ("production" !== process.env.NODE_ENV) TooltipArrow_TooltipArrow.displayName = "TooltipArrow";
|
|
508
|
-
let TooltipViewportCssVars_TooltipViewportCssVars = /*#__PURE__*/ function(TooltipViewportCssVars) {
|
|
509
|
-
TooltipViewportCssVars["popupWidth"] = "--popup-width";
|
|
510
|
-
TooltipViewportCssVars["popupHeight"] = "--popup-height";
|
|
511
|
-
return TooltipViewportCssVars;
|
|
512
|
-
}({});
|
|
513
|
-
const TooltipViewport_stateAttributesMapping = {
|
|
514
|
-
activationDirection: (value)=>value ? {
|
|
515
|
-
'data-activation-direction': value
|
|
516
|
-
} : null
|
|
517
|
-
};
|
|
518
512
|
const TooltipViewport_TooltipViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
519
513
|
const { render, className, style, children, ...elementProps } = componentProps;
|
|
520
514
|
const store = useTooltipRootContext();
|
|
@@ -523,7 +517,6 @@ const TooltipViewport_TooltipViewport = /*#__PURE__*/ __rspack_external_react.fo
|
|
|
523
517
|
const { children: childrenToRender, state: viewportState } = usePopupViewport({
|
|
524
518
|
store,
|
|
525
519
|
side: positioner.side,
|
|
526
|
-
cssVars: TooltipViewportCssVars_TooltipViewportCssVars,
|
|
527
520
|
children
|
|
528
521
|
});
|
|
529
522
|
const state = {
|
|
@@ -540,7 +533,7 @@ const TooltipViewport_TooltipViewport = /*#__PURE__*/ __rspack_external_react.fo
|
|
|
540
533
|
children: childrenToRender
|
|
541
534
|
}
|
|
542
535
|
],
|
|
543
|
-
stateAttributesMapping:
|
|
536
|
+
stateAttributesMapping: popupViewportStateMapping
|
|
544
537
|
});
|
|
545
538
|
});
|
|
546
539
|
if ("production" !== process.env.NODE_ENV) TooltipViewport_TooltipViewport.displayName = "TooltipViewport";
|
|
@@ -563,24 +556,17 @@ function createVirtualElement(domElement, data) {
|
|
|
563
556
|
'mouseenter',
|
|
564
557
|
'mousemove'
|
|
565
558
|
].includes(data.dataRef.current.openEvent?.type || '') && 'touch' !== data.pointerType;
|
|
566
|
-
|
|
567
|
-
|
|
559
|
+
const width = 'y' === data.axis ? domRect.width : 0;
|
|
560
|
+
const height = 'x' === data.axis ? domRect.height : 0;
|
|
568
561
|
let x = domRect.x;
|
|
569
562
|
let y = domRect.y;
|
|
570
563
|
if (null == offsetX && data.x && isXAxis) offsetX = domRect.x - data.x;
|
|
571
564
|
if (null == offsetY && data.y && isYAxis) offsetY = domRect.y - data.y;
|
|
572
565
|
x -= offsetX || 0;
|
|
573
566
|
y -= offsetY || 0;
|
|
574
|
-
width = 0;
|
|
575
|
-
height = 0;
|
|
576
567
|
if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {
|
|
577
|
-
width = 'y' === data.axis ? domRect.width : 0;
|
|
578
|
-
height = 'x' === data.axis ? domRect.height : 0;
|
|
579
568
|
x = isXAxis && null != data.x ? data.x : x;
|
|
580
569
|
y = isYAxis && null != data.y ? data.y : y;
|
|
581
|
-
} else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {
|
|
582
|
-
height = 'x' === data.axis ? domRect.height : height;
|
|
583
|
-
width = 'y' === data.axis ? domRect.width : width;
|
|
584
570
|
}
|
|
585
571
|
isAutoUpdateEvent = true;
|
|
586
572
|
return {
|
|
@@ -599,9 +585,8 @@ function createVirtualElement(domElement, data) {
|
|
|
599
585
|
function isMouseBasedEvent(event) {
|
|
600
586
|
return null != event && null != event.clientX;
|
|
601
587
|
}
|
|
602
|
-
function useClientPoint(
|
|
588
|
+
function useClientPoint(store, props = {}) {
|
|
603
589
|
const { enabled = true, axis = 'both' } = props;
|
|
604
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
605
590
|
const open = store.useState('open');
|
|
606
591
|
const floating = store.useState('floatingElement');
|
|
607
592
|
const domReference = store.useState('domReferenceElement');
|
|
@@ -700,67 +685,44 @@ function useClientPoint(context, props = {}) {
|
|
|
700
685
|
}
|
|
701
686
|
const selectors = {
|
|
702
687
|
...popupStoreSelectors,
|
|
703
|
-
disabled:
|
|
704
|
-
instantType:
|
|
705
|
-
isInstantPhase:
|
|
706
|
-
trackCursorAxis:
|
|
707
|
-
disableHoverablePopup:
|
|
708
|
-
lastOpenChangeReason:
|
|
709
|
-
closeOnClick:
|
|
710
|
-
|
|
711
|
-
|
|
688
|
+
disabled: (state)=>state.disabled,
|
|
689
|
+
instantType: (state)=>state.instantType,
|
|
690
|
+
isInstantPhase: (state)=>state.isInstantPhase,
|
|
691
|
+
trackCursorAxis: (state)=>state.trackCursorAxis,
|
|
692
|
+
disableHoverablePopup: (state)=>state.disableHoverablePopup,
|
|
693
|
+
lastOpenChangeReason: (state)=>state.openChangeReason,
|
|
694
|
+
closeOnClick: (state)=>state.closeOnClick,
|
|
695
|
+
appliedTriggerProps: (state, apply)=>apply ? state.activeTriggerProps : void 0,
|
|
696
|
+
closeDelay: (state)=>state.closeDelay,
|
|
697
|
+
adaptiveOrigin: (state)=>state.adaptiveOrigin
|
|
712
698
|
};
|
|
713
699
|
class TooltipStore extends ReactStore {
|
|
714
|
-
constructor(initialState, floatingId, nested
|
|
700
|
+
constructor(initialState, floatingId, nested){
|
|
715
701
|
const triggerElements = new PopupTriggerMap();
|
|
716
|
-
|
|
717
|
-
...createInitialState(),
|
|
718
|
-
...initialState
|
|
719
|
-
};
|
|
720
|
-
state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
|
|
721
|
-
super(state, {
|
|
722
|
-
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
723
|
-
onOpenChange: void 0,
|
|
724
|
-
onOpenChangeComplete: void 0,
|
|
725
|
-
triggerElements
|
|
726
|
-
}, selectors);
|
|
702
|
+
super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors);
|
|
727
703
|
}
|
|
728
704
|
setOpen = (nextOpen, eventDetails)=>{
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
this.set('preventUnmountingOnClose', true);
|
|
735
|
-
};
|
|
736
|
-
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
737
|
-
if (eventDetails.isCanceled) return;
|
|
738
|
-
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
739
|
-
const changeState = ()=>{
|
|
740
|
-
const updatedState = {
|
|
741
|
-
open: nextOpen,
|
|
742
|
-
openChangeReason: reason
|
|
743
|
-
};
|
|
744
|
-
if (isFocusOpen) updatedState.instantType = 'focus';
|
|
745
|
-
else if (isDismissClose) updatedState.instantType = 'dismiss';
|
|
746
|
-
else if (reason === triggerHover) updatedState.instantType = void 0;
|
|
747
|
-
setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger);
|
|
748
|
-
this.update(updatedState);
|
|
749
|
-
};
|
|
750
|
-
if (isHover) __rspack_external_react_dom_7136dc57.flushSync(changeState);
|
|
751
|
-
else changeState();
|
|
705
|
+
applyPopupOpenChange(this, nextOpen, eventDetails, {
|
|
706
|
+
extraState: {
|
|
707
|
+
openChangeReason: eventDetails.reason
|
|
708
|
+
}
|
|
709
|
+
});
|
|
752
710
|
};
|
|
753
711
|
cancelPendingOpen(event) {
|
|
754
712
|
this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(triggerPress, event));
|
|
755
713
|
}
|
|
756
|
-
static useStore(externalStore, initialState) {
|
|
757
|
-
const store = usePopupStore(externalStore, (floatingId, nested)=>new TooltipStore(initialState, floatingId, nested)).store;
|
|
758
|
-
return store;
|
|
759
|
-
}
|
|
760
714
|
}
|
|
761
|
-
function
|
|
762
|
-
|
|
763
|
-
|
|
715
|
+
function createNullTooltipStore() {
|
|
716
|
+
const triggerElements = new PopupTriggerMap();
|
|
717
|
+
const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);
|
|
718
|
+
return Object.assign(store, {
|
|
719
|
+
setOpen: NOOP,
|
|
720
|
+
cancelPendingOpen: NOOP
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
function createInitialState(initialState, triggerElements, floatingId, nested = false) {
|
|
724
|
+
const state = {
|
|
725
|
+
...createInitialPopupStoreState(triggerElements, floatingId, nested),
|
|
764
726
|
disabled: false,
|
|
765
727
|
instantType: void 0,
|
|
766
728
|
isInstantPhase: false,
|
|
@@ -769,23 +731,27 @@ function createInitialState() {
|
|
|
769
731
|
openChangeReason: null,
|
|
770
732
|
closeOnClick: true,
|
|
771
733
|
closeDelay: 0,
|
|
772
|
-
|
|
734
|
+
adaptiveOrigin: void 0,
|
|
735
|
+
...initialState
|
|
736
|
+
};
|
|
737
|
+
return state;
|
|
738
|
+
}
|
|
739
|
+
function createInitialContext(triggerElements) {
|
|
740
|
+
return {
|
|
741
|
+
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
742
|
+
onOpenChange: void 0,
|
|
743
|
+
onOpenChangeComplete: void 0,
|
|
744
|
+
triggerElements
|
|
773
745
|
};
|
|
774
746
|
}
|
|
775
747
|
const TooltipRoot_TooltipRoot = fastComponent(function(props) {
|
|
776
748
|
const { disabled = false, defaultOpen = false, open: openProp, disableHoverablePopup = false, trackCursorAxis = 'none', actionsRef, onOpenChange, onOpenChangeComplete, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null, children } = props;
|
|
777
|
-
const store =
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
useOnFirstRender(()=>{
|
|
784
|
-
if (void 0 === openProp && false === store.state.open && true === defaultOpen) store.update({
|
|
785
|
-
open: true,
|
|
786
|
-
activeTriggerId: defaultTriggerIdProp
|
|
787
|
-
});
|
|
788
|
-
});
|
|
749
|
+
const store = usePopupRootStore((floatingId, nested)=>new TooltipStore({
|
|
750
|
+
open: defaultOpen,
|
|
751
|
+
openProp,
|
|
752
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
753
|
+
triggerIdProp
|
|
754
|
+
}, floatingId, nested));
|
|
789
755
|
store.useControlledProp('openProp', openProp);
|
|
790
756
|
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
791
757
|
store.useContextCallback('onOpenChange', onOpenChange);
|
|
@@ -797,10 +763,12 @@ const TooltipRoot_TooltipRoot = fastComponent(function(props) {
|
|
|
797
763
|
const payload = store.useState('payload');
|
|
798
764
|
store.useSyncedValues({
|
|
799
765
|
trackCursorAxis,
|
|
800
|
-
disableHoverablePopup
|
|
766
|
+
disableHoverablePopup,
|
|
767
|
+
disabled
|
|
768
|
+
});
|
|
769
|
+
useImplicitActiveTrigger(store, {
|
|
770
|
+
closeOnActiveTriggerUnmount: true
|
|
801
771
|
});
|
|
802
|
-
store.useSyncedValue('disabled', disabled);
|
|
803
|
-
useImplicitActiveTrigger(store);
|
|
804
772
|
const { forceUnmount, transitionStatus } = useOpenStateTransitions(open, store);
|
|
805
773
|
const isInstantPhase = store.useState('isInstantPhase');
|
|
806
774
|
const instantType = store.useState('instantType');
|
|
@@ -837,22 +805,21 @@ const TooltipRoot_TooltipRoot = fastComponent(function(props) {
|
|
|
837
805
|
activeTriggerId,
|
|
838
806
|
open
|
|
839
807
|
]);
|
|
840
|
-
const handleImperativeClose = __rspack_external_react.useCallback(()=>{
|
|
841
|
-
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
842
|
-
}, [
|
|
843
|
-
store
|
|
844
|
-
]);
|
|
845
808
|
__rspack_external_react.useImperativeHandle(actionsRef, ()=>({
|
|
846
809
|
unmount: forceUnmount,
|
|
847
|
-
close:
|
|
810
|
+
close: ()=>store.setOpen(false, createChangeEventDetails(imperativeAction))
|
|
848
811
|
}), [
|
|
849
812
|
forceUnmount,
|
|
850
|
-
|
|
813
|
+
store
|
|
851
814
|
]);
|
|
852
815
|
const shouldRenderInteractions = open || mounted || !disabled && 'none' !== trackCursorAxis;
|
|
853
816
|
return /*#__PURE__*/ jsxs(TooltipRootContext.Provider, {
|
|
854
817
|
value: store,
|
|
855
818
|
children: [
|
|
819
|
+
handle && /*#__PURE__*/ jsx(PopupHandleAttachment, {
|
|
820
|
+
handle: handle,
|
|
821
|
+
store: store
|
|
822
|
+
}),
|
|
856
823
|
shouldRenderInteractions && /*#__PURE__*/ jsx(TooltipInteractions, {
|
|
857
824
|
store: store,
|
|
858
825
|
disabled: disabled,
|
|
@@ -875,22 +842,14 @@ function TooltipInteractions({ store, disabled, trackCursorAxis }) {
|
|
|
875
842
|
enabled: !disabled && 'none' !== trackCursorAxis,
|
|
876
843
|
axis: 'none' === trackCursorAxis ? void 0 : trackCursorAxis
|
|
877
844
|
});
|
|
878
|
-
const
|
|
845
|
+
const triggerProps = __rspack_external_react.useMemo(()=>mergeProps(clientPoint.reference, dismiss.reference), [
|
|
879
846
|
clientPoint.reference,
|
|
880
847
|
dismiss.reference
|
|
881
848
|
]);
|
|
882
|
-
const inactiveTriggerProps = __rspack_external_react.useMemo(()=>mergeProps(clientPoint.trigger, dismiss.trigger), [
|
|
883
|
-
clientPoint.trigger,
|
|
884
|
-
dismiss.trigger
|
|
885
|
-
]);
|
|
886
|
-
const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [
|
|
887
|
-
clientPoint.floating,
|
|
888
|
-
dismiss.floating
|
|
889
|
-
]);
|
|
890
849
|
usePopupInteractionProps(store, {
|
|
891
|
-
activeTriggerProps,
|
|
892
|
-
inactiveTriggerProps,
|
|
893
|
-
popupProps
|
|
850
|
+
activeTriggerProps: triggerProps,
|
|
851
|
+
inactiveTriggerProps: triggerProps,
|
|
852
|
+
popupProps: dismiss.floating ?? EMPTY_OBJECT
|
|
894
853
|
});
|
|
895
854
|
return null;
|
|
896
855
|
}
|
|
@@ -911,13 +870,6 @@ const TooltipPortal_TooltipPortal = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
911
870
|
if ("production" !== process.env.NODE_ENV) TooltipPortal_TooltipPortal.displayName = "TooltipPortal";
|
|
912
871
|
const TooltipProvider_TooltipProvider = function(props) {
|
|
913
872
|
const { delay, closeDelay, timeout = 400 } = props;
|
|
914
|
-
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
915
|
-
delay,
|
|
916
|
-
closeDelay
|
|
917
|
-
}), [
|
|
918
|
-
delay,
|
|
919
|
-
closeDelay
|
|
920
|
-
]);
|
|
921
873
|
const delayValue = __rspack_external_react.useMemo(()=>({
|
|
922
874
|
open: delay,
|
|
923
875
|
close: closeDelay
|
|
@@ -926,7 +878,7 @@ const TooltipProvider_TooltipProvider = function(props) {
|
|
|
926
878
|
closeDelay
|
|
927
879
|
]);
|
|
928
880
|
return /*#__PURE__*/ jsx(TooltipProviderContext.Provider, {
|
|
929
|
-
value:
|
|
881
|
+
value: delay,
|
|
930
882
|
children: /*#__PURE__*/ jsx(FloatingDelayGroup, {
|
|
931
883
|
delay: delayValue,
|
|
932
884
|
timeoutMs: timeout,
|
|
@@ -935,20 +887,18 @@ const TooltipProvider_TooltipProvider = function(props) {
|
|
|
935
887
|
});
|
|
936
888
|
};
|
|
937
889
|
if ("production" !== process.env.NODE_ENV) TooltipProvider_TooltipProvider.displayName = "TooltipProvider";
|
|
938
|
-
class TooltipHandle {
|
|
890
|
+
class TooltipHandle extends BasePopupHandle {
|
|
939
891
|
constructor(){
|
|
940
|
-
|
|
892
|
+
super(createNullTooltipStore(), 'Tooltip');
|
|
941
893
|
}
|
|
942
894
|
open(triggerId) {
|
|
943
|
-
|
|
944
|
-
if (triggerId && !triggerElement) throw new Error("production" !== process.env.NODE_ENV ? `Base UI: TooltipHandle.open: No trigger found with id "${triggerId}".` : esm_formatErrorMessage(81, triggerId));
|
|
945
|
-
this.store.setOpen(true, createChangeEventDetails(imperativeAction, void 0, triggerElement));
|
|
895
|
+
this.openByTrigger(triggerId);
|
|
946
896
|
}
|
|
947
897
|
close() {
|
|
948
|
-
this.
|
|
898
|
+
this.closePopup();
|
|
949
899
|
}
|
|
950
900
|
get isOpen() {
|
|
951
|
-
return this.
|
|
901
|
+
return this.attachedStore?.select('open') ?? false;
|
|
952
902
|
}
|
|
953
903
|
}
|
|
954
904
|
function createTooltipHandle() {
|