@yahoo/uds 3.102.0 → 3.103.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/automated-config/dist/generated/autoVariants.cjs +11 -1
- package/dist/automated-config/dist/generated/autoVariants.d.cts +10 -0
- package/dist/automated-config/dist/generated/autoVariants.d.ts +10 -0
- package/dist/automated-config/dist/generated/autoVariants.js +11 -1
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +1695 -1
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +419 -189
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +419 -189
- package/dist/automated-config/dist/generated/generatedConfigs.js +1694 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +99 -0
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +2 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +99 -0
- package/dist/automated-config/dist/properties.cjs +152 -89
- package/dist/automated-config/dist/properties.d.cts +25 -4
- package/dist/automated-config/dist/properties.d.ts +25 -4
- package/dist/automated-config/dist/properties.js +153 -90
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +5 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +2 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +2 -1
- package/dist/automated-config/dist/utils/buildConfigSchema.js +5 -1
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +2 -2
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +2 -2
- package/dist/automated-config/dist/utils/index.cjs +4 -4
- package/dist/automated-config/dist/utils/index.d.cts +6 -1
- package/dist/automated-config/dist/utils/index.d.ts +6 -1
- package/dist/automated-config/dist/utils/index.js +4 -4
- package/dist/cli/commands/sync.cjs +5 -1
- package/dist/cli/commands/sync.js +5 -1
- package/dist/components/client/Button.js +2 -2
- package/dist/components/client/Toast/Toast.cjs +1 -1
- package/dist/components/client/Toast/Toast.d.cts +1 -1
- package/dist/components/client/Toast/Toast.d.ts +1 -1
- package/dist/components/client/Toast/Toast.js +1 -1
- package/dist/components/client/Tooltip/Tooltip.cjs +65 -0
- package/dist/components/client/Tooltip/Tooltip.d.cts +45 -0
- package/dist/components/client/Tooltip/Tooltip.d.ts +45 -0
- package/dist/components/client/Tooltip/Tooltip.js +63 -0
- package/dist/components/client/Tooltip/TooltipContent.cjs +188 -0
- package/dist/components/client/Tooltip/TooltipContent.d.cts +8 -0
- package/dist/components/client/Tooltip/TooltipContent.d.ts +8 -0
- package/dist/components/client/Tooltip/TooltipContent.js +186 -0
- package/dist/components/client/Tooltip/TooltipTrigger.cjs +20 -0
- package/dist/components/client/Tooltip/TooltipTrigger.d.cts +14 -0
- package/dist/components/client/Tooltip/TooltipTrigger.d.ts +14 -0
- package/dist/components/client/Tooltip/TooltipTrigger.js +18 -0
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.cjs +40 -0
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.cts +28 -0
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.d.ts +28 -0
- package/dist/components/client/Tooltip/UDSTooltipConfigProvider.js +37 -0
- package/dist/components/client/Tooltip/index.cjs +12 -0
- package/dist/components/client/Tooltip/index.d.cts +7 -0
- package/dist/components/client/Tooltip/index.d.ts +7 -0
- package/dist/components/client/Tooltip/index.js +8 -0
- package/dist/components/client/Tooltip/tooltipContext.cjs +12 -0
- package/dist/components/client/Tooltip/tooltipContext.d.cts +12 -0
- package/dist/components/client/Tooltip/tooltipContext.d.ts +12 -0
- package/dist/components/client/Tooltip/tooltipContext.js +10 -0
- package/dist/components/client/Tooltip/useTooltipContent.cjs +186 -0
- package/dist/components/client/Tooltip/useTooltipContent.d.cts +66 -0
- package/dist/components/client/Tooltip/useTooltipContent.d.ts +66 -0
- package/dist/components/client/Tooltip/useTooltipContent.js +184 -0
- package/dist/components/client/Tooltip/util.cjs +248 -0
- package/dist/components/client/Tooltip/util.d.cts +118 -0
- package/dist/components/client/Tooltip/util.d.ts +118 -0
- package/dist/components/client/Tooltip/util.js +240 -0
- package/dist/components/client/index.cjs +8 -0
- package/dist/components/client/index.d.cts +7 -1
- package/dist/components/client/index.d.ts +7 -1
- package/dist/components/client/index.js +5 -1
- package/dist/components/client/providers/UDSConfigProvider.cjs +6 -2
- package/dist/components/client/providers/UDSConfigProvider.d.cts +2 -1
- package/dist/components/client/providers/UDSConfigProvider.d.ts +2 -1
- package/dist/components/client/providers/UDSConfigProvider.js +6 -2
- package/dist/components/index.cjs +12 -0
- package/dist/components/index.d.cts +6 -1
- package/dist/components/index.d.ts +6 -1
- package/dist/components/index.js +9 -1
- package/dist/config/dist/index.cjs +18797 -18698
- package/dist/config/dist/index.js +18797 -18698
- package/dist/css-tokens/dist/index.cjs +2 -0
- package/dist/css-tokens/dist/index.d.cts +2 -1
- package/dist/css-tokens/dist/index.d.ts +2 -1
- package/dist/css-tokens/dist/index.js +2 -1
- package/dist/fixtures/dist/arbitrary.d.cts +11 -0
- package/dist/fixtures/dist/arbitrary.d.ts +11 -0
- package/dist/fixtures/dist/index.cjs +27 -1
- package/dist/fixtures/dist/index.d.cts +17 -3
- package/dist/fixtures/dist/index.d.ts +17 -3
- package/dist/fixtures/dist/index.js +26 -2
- package/dist/fixtures/index.cjs +6 -1
- package/dist/fixtures/index.d.cts +4 -2
- package/dist/fixtures/index.d.ts +4 -2
- package/dist/fixtures/index.js +3 -2
- package/dist/fixtures/src/arbitrary.cjs +23 -0
- package/dist/fixtures/src/arbitrary.d.cts +15 -0
- package/dist/fixtures/src/arbitrary.d.ts +15 -0
- package/dist/fixtures/src/arbitrary.js +18 -0
- package/dist/fixtures/src/util.cjs +26 -0
- package/dist/fixtures/src/util.d.cts +9 -0
- package/dist/fixtures/src/util.d.ts +9 -0
- package/dist/fixtures/src/util.js +25 -0
- package/dist/index.cjs +15 -3
- package/dist/index.d.cts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +11 -6
- package/dist/runtime/index.cjs +2 -0
- package/dist/runtime/index.d.cts +2 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.js +2 -1
- package/dist/runtime/tooltipConfig.cjs +33 -0
- package/dist/runtime/tooltipConfig.d.cts +20 -0
- package/dist/runtime/tooltipConfig.d.ts +20 -0
- package/dist/runtime/tooltipConfig.js +32 -0
- package/dist/runtime/udsConfig.cjs +3 -1
- package/dist/runtime/udsConfig.d.cts +2 -0
- package/dist/runtime/udsConfig.d.ts +2 -0
- package/dist/runtime/udsConfig.js +3 -1
- package/dist/styles/styler.d.cts +53 -43
- package/dist/styles/styler.d.ts +53 -43
- package/dist/styles/variants.d.cts +30 -0
- package/dist/styles/variants.d.ts +30 -0
- package/dist/tailwind/dist/plugin.cjs +2 -1
- package/dist/tailwind/dist/plugin.js +2 -1
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.cjs +30 -0
- package/dist/tailwind/dist/tailwind/plugins/blurBgFallback.js +28 -0
- package/dist/tailwind/dist/tailwind/plugins/components.cjs +1 -0
- package/dist/tailwind/dist/tailwind/plugins/components.js +2 -1
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.cts +4 -4
- package/dist/tailwind/dist/tailwind/utils/getShadowStyles.d.ts +4 -4
- package/dist/tokens/automation/configs/index.cjs +2 -1
- package/dist/tokens/automation/configs/index.d.cts +2 -2
- package/dist/tokens/automation/configs/index.d.ts +2 -2
- package/dist/tokens/automation/configs/index.js +2 -2
- package/dist/tokens/automation/index.cjs +1 -0
- package/dist/tokens/automation/index.d.cts +2 -2
- package/dist/tokens/automation/index.d.ts +2 -2
- package/dist/tokens/automation/index.js +2 -2
- package/dist/tokens/automation/properties.d.cts +2 -2
- package/dist/tokens/automation/properties.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.cjs +1 -0
- package/dist/tokens/consts/cssTokens.d.cts +2 -2
- package/dist/tokens/consts/cssTokens.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.js +2 -2
- package/dist/tokens/index.cjs +2 -0
- package/dist/tokens/index.d.cts +4 -4
- package/dist/tokens/index.d.ts +4 -4
- package/dist/tokens/index.js +3 -3
- package/dist/tokens/types.d.cts +2 -2
- package/dist/tokens/types.d.ts +2 -2
- package/dist/types/dist/index.d.cts +37 -2
- package/dist/types/dist/index.d.ts +37 -2
- package/dist/uds/generated/tailwindPurge.cjs +90 -60
- package/dist/uds/generated/tailwindPurge.js +90 -60
- package/dist/uds/package.cjs +1 -0
- package/dist/uds/package.js +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { cx, getStyles } from "../../../styles/styler.js";
|
|
4
|
+
import { Box } from "../../Box.js";
|
|
5
|
+
import { Text } from "../../Text.js";
|
|
6
|
+
import { IconSlot } from "../../IconSlot.js";
|
|
7
|
+
import { useTooltipConfig } from "./UDSTooltipConfigProvider.js";
|
|
8
|
+
import { TooltipInternalContext } from "./tooltipContext.js";
|
|
9
|
+
import { useForkRef } from "../../../hooks/useForkRef.js";
|
|
10
|
+
import { ARROW_HEIGHT } from "./util.js";
|
|
11
|
+
import { useTooltipContent } from "./useTooltipContent.js";
|
|
12
|
+
import { Fragment, forwardRef, isValidElement, useContext, useRef } from "react";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Tooltip, TooltipArrow, useStoreState, useTooltipContext } from "@ariakit/react";
|
|
15
|
+
|
|
16
|
+
//#region src/components/client/Tooltip/TooltipContent.tsx
|
|
17
|
+
const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth, startTitleIcon, title, endContent, className, id }, ref) {
|
|
18
|
+
const store = useTooltipContext();
|
|
19
|
+
const open = useStoreState(store, "open");
|
|
20
|
+
const internalContext = useContext(TooltipInternalContext);
|
|
21
|
+
const currentPlacement = useStoreState(store, "currentPlacement");
|
|
22
|
+
const placement = useStoreState(store, "placement");
|
|
23
|
+
const effectivePlacement = currentPlacement ?? placement ?? "top";
|
|
24
|
+
const { borderRadius, animationDuration } = useTooltipConfig();
|
|
25
|
+
const defaultBorderRadius = borderRadius["default"];
|
|
26
|
+
const arrowRef = useRef(null);
|
|
27
|
+
const { internalRef, shadowFilterId, maxWidthClass, dimensions, shadows, shadowPadding, svgPath, blurStyle, childTransitionStyle, tooltipShift, onPositionUpdate } = useTooltipContent({
|
|
28
|
+
open: open ?? false,
|
|
29
|
+
effectivePlacement,
|
|
30
|
+
maxWidth,
|
|
31
|
+
borderRadius: defaultBorderRadius,
|
|
32
|
+
arrowRef,
|
|
33
|
+
animationDuration
|
|
34
|
+
});
|
|
35
|
+
const mergedRef = useForkRef(ref, internalRef);
|
|
36
|
+
const classNames = {
|
|
37
|
+
root: getStyles({
|
|
38
|
+
tooltipSizeRoot: "default",
|
|
39
|
+
tooltipVariantRoot: "default",
|
|
40
|
+
className: cx(maxWidthClass, "flex", "z-[9999]", className)
|
|
41
|
+
}),
|
|
42
|
+
svg: getStyles({
|
|
43
|
+
tooltipSizeSvg: "default",
|
|
44
|
+
tooltipVariantSvg: "default",
|
|
45
|
+
className: cx("stroke-1", "uds-bgBlurFillFallback")
|
|
46
|
+
}),
|
|
47
|
+
blur: getStyles({
|
|
48
|
+
tooltipVariantBlur: "default",
|
|
49
|
+
position: "absolute",
|
|
50
|
+
width: "full",
|
|
51
|
+
height: "full",
|
|
52
|
+
className: cx("uds-bgBlurFallback", "top-0", "left-0", "z-[1]", "transition-opacity", `duration-[${animationDuration}ms]`, "ease-in-out")
|
|
53
|
+
}),
|
|
54
|
+
title: getStyles({ tooltipSizeTitle: "default" }),
|
|
55
|
+
body: getStyles({ tooltipSizeBody: "default" }),
|
|
56
|
+
endContent: getStyles({ tooltipSizeEndContent: "default" }),
|
|
57
|
+
icon: getStyles({
|
|
58
|
+
tooltipSizeIcon: "default",
|
|
59
|
+
tooltipVariantIcon: "default"
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
63
|
+
ref: mergedRef,
|
|
64
|
+
className: classNames.root,
|
|
65
|
+
hideOnHoverOutside: internalContext ? internalContext.hideOnHoverOutside : void 0,
|
|
66
|
+
portal: internalContext ? internalContext.portal : true,
|
|
67
|
+
gutter: 10,
|
|
68
|
+
updatePosition: onPositionUpdate,
|
|
69
|
+
style: tooltipShift.x !== 0 || tooltipShift.y !== 0 ? { transform: `translate(${tooltipShift.x}px, ${tooltipShift.y}px)` } : void 0,
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ jsx(Box, {
|
|
72
|
+
className: classNames.blur,
|
|
73
|
+
style: {
|
|
74
|
+
...blurStyle,
|
|
75
|
+
...childTransitionStyle
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
svgPath && /* @__PURE__ */ jsxs("svg", {
|
|
79
|
+
"aria-hidden": true,
|
|
80
|
+
className: "absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none z-[2]",
|
|
81
|
+
style: childTransitionStyle,
|
|
82
|
+
viewBox: `0 0 ${dimensions.width} ${dimensions.height}`,
|
|
83
|
+
children: [
|
|
84
|
+
shadows.length > 0 && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("filter", {
|
|
85
|
+
id: shadowFilterId,
|
|
86
|
+
filterUnits: "userSpaceOnUse",
|
|
87
|
+
x: -(shadowPadding + ARROW_HEIGHT),
|
|
88
|
+
y: -(shadowPadding + ARROW_HEIGHT),
|
|
89
|
+
width: dimensions.width + 2 * (shadowPadding + ARROW_HEIGHT),
|
|
90
|
+
height: dimensions.height + 2 * (shadowPadding + ARROW_HEIGHT),
|
|
91
|
+
colorInterpolationFilters: "sRGB",
|
|
92
|
+
children: [
|
|
93
|
+
shadows.map((shadow, i) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
+
shadow.spread !== 0 && /* @__PURE__ */ jsx("feMorphology", {
|
|
95
|
+
in: "SourceAlpha",
|
|
96
|
+
operator: shadow.spread > 0 ? "dilate" : "erode",
|
|
97
|
+
radius: Math.abs(shadow.spread),
|
|
98
|
+
result: `spread${i}`
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ jsx("feGaussianBlur", {
|
|
101
|
+
in: shadow.spread !== 0 ? `spread${i}` : "SourceAlpha",
|
|
102
|
+
stdDeviation: shadow.blur / 2,
|
|
103
|
+
result: `blurred${i}`
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx("feOffset", {
|
|
106
|
+
in: `blurred${i}`,
|
|
107
|
+
dx: shadow.x,
|
|
108
|
+
dy: shadow.y,
|
|
109
|
+
result: `offset${i}`
|
|
110
|
+
}),
|
|
111
|
+
/* @__PURE__ */ jsx("feFlood", {
|
|
112
|
+
floodColor: shadow.color,
|
|
113
|
+
result: `color${i}`
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ jsx("feComposite", {
|
|
116
|
+
in: `color${i}`,
|
|
117
|
+
in2: `offset${i}`,
|
|
118
|
+
operator: "in",
|
|
119
|
+
result: `shadow${i}`
|
|
120
|
+
})
|
|
121
|
+
] }, i)),
|
|
122
|
+
/* @__PURE__ */ jsx("feMerge", {
|
|
123
|
+
result: "mergedShadows",
|
|
124
|
+
children: shadows.map((_, i) => /* @__PURE__ */ jsx("feMergeNode", { in: `shadow${i}` }, i))
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ jsx("feComposite", {
|
|
127
|
+
in: "mergedShadows",
|
|
128
|
+
in2: "SourceAlpha",
|
|
129
|
+
operator: "out"
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}) }),
|
|
133
|
+
shadows.length > 0 && /* @__PURE__ */ jsx("path", {
|
|
134
|
+
d: svgPath,
|
|
135
|
+
fill: "black",
|
|
136
|
+
filter: `url(#${shadowFilterId})`
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ jsx("path", {
|
|
139
|
+
d: svgPath,
|
|
140
|
+
className: classNames.svg
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsxs(Box, {
|
|
145
|
+
position: "relative",
|
|
146
|
+
flexDirection: "column",
|
|
147
|
+
className: "z-[3] gap-[inherit]",
|
|
148
|
+
style: childTransitionStyle,
|
|
149
|
+
id,
|
|
150
|
+
children: [title && /* @__PURE__ */ jsxs(Box, {
|
|
151
|
+
alignItems: "center",
|
|
152
|
+
columnGap: "1",
|
|
153
|
+
children: [startTitleIcon && /* @__PURE__ */ jsx(IconSlot, {
|
|
154
|
+
iconProps: { variant: "fill" },
|
|
155
|
+
icon: startTitleIcon,
|
|
156
|
+
className: classNames.icon
|
|
157
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
158
|
+
className: classNames.title,
|
|
159
|
+
color: "inherit",
|
|
160
|
+
children: title
|
|
161
|
+
})]
|
|
162
|
+
}), /* @__PURE__ */ jsxs(Box, {
|
|
163
|
+
alignItems: "center",
|
|
164
|
+
columnGap: "1.5",
|
|
165
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
166
|
+
className: classNames.body,
|
|
167
|
+
color: "inherit",
|
|
168
|
+
children
|
|
169
|
+
}), endContent && !isValidElement(endContent) ? /* @__PURE__ */ jsx(Text, {
|
|
170
|
+
className: classNames.endContent,
|
|
171
|
+
color: "inherit",
|
|
172
|
+
children: endContent
|
|
173
|
+
}) : endContent]
|
|
174
|
+
})]
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ jsx(TooltipArrow, {
|
|
177
|
+
ref: arrowRef,
|
|
178
|
+
style: { opacity: 0 }
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
TooltipContent.displayName = "TooltipContent";
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
export { TooltipContent };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let _ariakit_react = require("@ariakit/react");
|
|
8
|
+
|
|
9
|
+
//#region src/components/client/Tooltip/TooltipTrigger.tsx
|
|
10
|
+
function TooltipTrigger({ children }) {
|
|
11
|
+
if ((0, react.isValidElement)(children) && children.type !== react.Fragment) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipAnchor, { render: children });
|
|
12
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipAnchor, {
|
|
13
|
+
className: "inline",
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
TooltipTrigger.displayName = "TooltipTrigger";
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.TooltipTrigger = TooltipTrigger;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipTriggerProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/TooltipTrigger.d.ts
|
|
6
|
+
type TooltipTriggerProps = UniversalTooltipTriggerProps;
|
|
7
|
+
declare function TooltipTrigger({
|
|
8
|
+
children
|
|
9
|
+
}: TooltipTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
10
|
+
declare namespace TooltipTrigger {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TooltipTrigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipTriggerProps } from "../../../types/dist/index.js";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/TooltipTrigger.d.ts
|
|
6
|
+
type TooltipTriggerProps = UniversalTooltipTriggerProps;
|
|
7
|
+
declare function TooltipTrigger({
|
|
8
|
+
children
|
|
9
|
+
}: TooltipTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
10
|
+
declare namespace TooltipTrigger {
|
|
11
|
+
var displayName: string;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TooltipTrigger };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { Fragment, isValidElement } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { TooltipAnchor } from "@ariakit/react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Tooltip/TooltipTrigger.tsx
|
|
8
|
+
function TooltipTrigger({ children }) {
|
|
9
|
+
if (isValidElement(children) && children.type !== Fragment) return /* @__PURE__ */ jsx(TooltipAnchor, { render: children });
|
|
10
|
+
return /* @__PURE__ */ jsx(TooltipAnchor, {
|
|
11
|
+
className: "inline",
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
TooltipTrigger.displayName = "TooltipTrigger";
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TooltipTrigger };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Tooltip/UDSTooltipConfigProvider.tsx
|
|
9
|
+
const TooltipContext = (0, react.createContext)(void 0);
|
|
10
|
+
const UDSTooltipConfigProvider = ({ children, value }) => {
|
|
11
|
+
const existingContext = (0, react.useContext)(TooltipContext);
|
|
12
|
+
if ("type" in value) {
|
|
13
|
+
if (!existingContext) throw new Error("Cannot merge context values without an existing TooltipContext");
|
|
14
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContext.Provider, {
|
|
15
|
+
value: {
|
|
16
|
+
...existingContext,
|
|
17
|
+
...value.value
|
|
18
|
+
},
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContext.Provider, {
|
|
23
|
+
value,
|
|
24
|
+
children
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
UDSTooltipConfigProvider.displayName = "UDSTooltipConfigProvider";
|
|
28
|
+
function useTooltipConfig(options) {
|
|
29
|
+
const context = (0, react.useContext)(TooltipContext);
|
|
30
|
+
if (!context) throw new Error("useTooltipConfig must be used within a UDSConfigProvider or UDSTooltipConfigProvider");
|
|
31
|
+
const { placementMap, placement, ...contextRest } = context;
|
|
32
|
+
return {
|
|
33
|
+
...contextRest,
|
|
34
|
+
ariaKitPlacement: placementMap[options?.placement ?? placement]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.UDSTooltipConfigProvider = UDSTooltipConfigProvider;
|
|
40
|
+
exports.useTooltipConfig = useTooltipConfig;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { TooltipPlacement } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { UDSTooltipConfigContextType } from "../../../runtime/tooltipConfig.cjs";
|
|
4
|
+
import { PropsWithChildren } from "react";
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
import { TooltipProviderProps } from "@ariakit/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Tooltip/UDSTooltipConfigProvider.d.ts
|
|
9
|
+
interface UDSTooltipConfigProviderProps extends PropsWithChildren {
|
|
10
|
+
value: UDSTooltipConfigContextType | {
|
|
11
|
+
type: 'merge';
|
|
12
|
+
value: Partial<UDSTooltipConfigContextType>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const UDSTooltipConfigProvider: {
|
|
16
|
+
({
|
|
17
|
+
children,
|
|
18
|
+
value
|
|
19
|
+
}: UDSTooltipConfigProviderProps): react_jsx_runtime0.JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
declare function useTooltipConfig(options?: {
|
|
23
|
+
placement?: TooltipPlacement;
|
|
24
|
+
}): Omit<UDSTooltipConfigContextType, 'placementMap' | 'placement'> & {
|
|
25
|
+
ariaKitPlacement: TooltipProviderProps['placement'];
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { type UDSTooltipConfigContextType, UDSTooltipConfigProvider, type UDSTooltipConfigProviderProps, useTooltipConfig };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
import { TooltipPlacement } from "../../../types/dist/index.js";
|
|
3
|
+
import { UDSTooltipConfigContextType } from "../../../runtime/tooltipConfig.js";
|
|
4
|
+
import { PropsWithChildren } from "react";
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
import { TooltipProviderProps } from "@ariakit/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Tooltip/UDSTooltipConfigProvider.d.ts
|
|
9
|
+
interface UDSTooltipConfigProviderProps extends PropsWithChildren {
|
|
10
|
+
value: UDSTooltipConfigContextType | {
|
|
11
|
+
type: 'merge';
|
|
12
|
+
value: Partial<UDSTooltipConfigContextType>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const UDSTooltipConfigProvider: {
|
|
16
|
+
({
|
|
17
|
+
children,
|
|
18
|
+
value
|
|
19
|
+
}: UDSTooltipConfigProviderProps): react_jsx_runtime0.JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
declare function useTooltipConfig(options?: {
|
|
23
|
+
placement?: TooltipPlacement;
|
|
24
|
+
}): Omit<UDSTooltipConfigContextType, 'placementMap' | 'placement'> & {
|
|
25
|
+
ariaKitPlacement: TooltipProviderProps['placement'];
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { type UDSTooltipConfigContextType, UDSTooltipConfigProvider, type UDSTooltipConfigProviderProps, useTooltipConfig };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/components/client/Tooltip/UDSTooltipConfigProvider.tsx
|
|
7
|
+
const TooltipContext = createContext(void 0);
|
|
8
|
+
const UDSTooltipConfigProvider = ({ children, value }) => {
|
|
9
|
+
const existingContext = useContext(TooltipContext);
|
|
10
|
+
if ("type" in value) {
|
|
11
|
+
if (!existingContext) throw new Error("Cannot merge context values without an existing TooltipContext");
|
|
12
|
+
return /* @__PURE__ */ jsx(TooltipContext.Provider, {
|
|
13
|
+
value: {
|
|
14
|
+
...existingContext,
|
|
15
|
+
...value.value
|
|
16
|
+
},
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsx(TooltipContext.Provider, {
|
|
21
|
+
value,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
UDSTooltipConfigProvider.displayName = "UDSTooltipConfigProvider";
|
|
26
|
+
function useTooltipConfig(options) {
|
|
27
|
+
const context = useContext(TooltipContext);
|
|
28
|
+
if (!context) throw new Error("useTooltipConfig must be used within a UDSConfigProvider or UDSTooltipConfigProvider");
|
|
29
|
+
const { placementMap, placement, ...contextRest } = context;
|
|
30
|
+
return {
|
|
31
|
+
...contextRest,
|
|
32
|
+
ariaKitPlacement: placementMap[options?.placement ?? placement]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { UDSTooltipConfigProvider, useTooltipConfig };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_components_client_Tooltip_UDSTooltipConfigProvider = require('./UDSTooltipConfigProvider.cjs');
|
|
5
|
+
const require_components_client_Tooltip_Tooltip = require('./Tooltip.cjs');
|
|
6
|
+
const require_components_client_Tooltip_TooltipContent = require('./TooltipContent.cjs');
|
|
7
|
+
const require_components_client_Tooltip_TooltipTrigger = require('./TooltipTrigger.cjs');
|
|
8
|
+
|
|
9
|
+
exports.Tooltip = require_components_client_Tooltip_Tooltip.Tooltip;
|
|
10
|
+
exports.TooltipContent = require_components_client_Tooltip_TooltipContent.TooltipContent;
|
|
11
|
+
exports.TooltipTrigger = require_components_client_Tooltip_TooltipTrigger.TooltipTrigger;
|
|
12
|
+
exports.UDSTooltipConfigProvider = require_components_client_Tooltip_UDSTooltipConfigProvider.UDSTooltipConfigProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipContentProps, UniversalTooltipProps, UniversalTooltipTriggerProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import { Tooltip } from "./Tooltip.cjs";
|
|
4
|
+
import { TooltipContent } from "./TooltipContent.cjs";
|
|
5
|
+
import { TooltipTrigger } from "./TooltipTrigger.cjs";
|
|
6
|
+
import { UDSTooltipConfigProvider, UDSTooltipConfigProviderProps } from "./UDSTooltipConfigProvider.cjs";
|
|
7
|
+
export { Tooltip, TooltipContent, type UniversalTooltipContentProps as TooltipContentProps, type UniversalTooltipProps as TooltipProps, TooltipTrigger, type UniversalTooltipTriggerProps as TooltipTriggerProps, UDSTooltipConfigProvider, type UDSTooltipConfigProviderProps };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipContentProps, UniversalTooltipProps, UniversalTooltipTriggerProps } from "../../../types/dist/index.js";
|
|
3
|
+
import { Tooltip } from "./Tooltip.js";
|
|
4
|
+
import { TooltipContent } from "./TooltipContent.js";
|
|
5
|
+
import { TooltipTrigger } from "./TooltipTrigger.js";
|
|
6
|
+
import { UDSTooltipConfigProvider, UDSTooltipConfigProviderProps } from "./UDSTooltipConfigProvider.js";
|
|
7
|
+
export { Tooltip, TooltipContent, type UniversalTooltipContentProps as TooltipContentProps, type UniversalTooltipProps as TooltipProps, TooltipTrigger, type UniversalTooltipTriggerProps as TooltipTriggerProps, UDSTooltipConfigProvider, type UDSTooltipConfigProviderProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { UDSTooltipConfigProvider } from "./UDSTooltipConfigProvider.js";
|
|
4
|
+
import { Tooltip } from "./Tooltip.js";
|
|
5
|
+
import { TooltipContent } from "./TooltipContent.js";
|
|
6
|
+
import { TooltipTrigger } from "./TooltipTrigger.js";
|
|
7
|
+
|
|
8
|
+
export { Tooltip, TooltipContent, TooltipTrigger, UDSTooltipConfigProvider };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
|
|
7
|
+
//#region src/components/client/Tooltip/tooltipContext.tsx
|
|
8
|
+
/** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
|
|
9
|
+
const TooltipInternalContext = (0, react.createContext)(null);
|
|
10
|
+
|
|
11
|
+
//#endregion
|
|
12
|
+
exports.TooltipInternalContext = TooltipInternalContext;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/client/Tooltip/tooltipContext.d.ts
|
|
5
|
+
interface TooltipInternalContextType {
|
|
6
|
+
hideOnHoverOutside: boolean;
|
|
7
|
+
portal: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
|
|
10
|
+
declare const TooltipInternalContext: react.Context<TooltipInternalContextType | null>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { TooltipInternalContext };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/client/Tooltip/tooltipContext.d.ts
|
|
5
|
+
interface TooltipInternalContextType {
|
|
6
|
+
hideOnHoverOutside: boolean;
|
|
7
|
+
portal: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
|
|
10
|
+
declare const TooltipInternalContext: react.Context<TooltipInternalContextType | null>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { TooltipInternalContext };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/tooltipContext.tsx
|
|
6
|
+
/** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
|
|
7
|
+
const TooltipInternalContext = createContext(null);
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TooltipInternalContext };
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
|
|
5
|
+
const require_index = require('../../../css-tokens/dist/index.cjs');
|
|
6
|
+
const require_components_client_Tooltip_util = require('./util.cjs');
|
|
7
|
+
let react = require("react");
|
|
8
|
+
|
|
9
|
+
//#region src/components/client/Tooltip/useTooltipContent.ts
|
|
10
|
+
function useTooltipContent({ open, effectivePlacement, maxWidth, borderRadius, arrowRef, animationDuration }) {
|
|
11
|
+
const internalRef = (0, react.useRef)(null);
|
|
12
|
+
const shadowFilterId = (0, react.useId)();
|
|
13
|
+
const [dimensions, setDimensions] = (0, react.useState)({
|
|
14
|
+
width: 0,
|
|
15
|
+
height: 0
|
|
16
|
+
});
|
|
17
|
+
const maxWidthClass = (0, react.useMemo)(() => {
|
|
18
|
+
if (maxWidth !== void 0) return typeof maxWidth === "number" ? `max-w-[${maxWidth}px]` : `max-w-[${maxWidth}]`;
|
|
19
|
+
return "max-w-lg";
|
|
20
|
+
}, [maxWidth]);
|
|
21
|
+
(0, react.useEffect)(() => {
|
|
22
|
+
const el = internalRef.current;
|
|
23
|
+
if (!el) return;
|
|
24
|
+
const observer = new ResizeObserver(() => {
|
|
25
|
+
setDimensions({
|
|
26
|
+
width: el.offsetWidth,
|
|
27
|
+
height: el.offsetHeight
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
observer.observe(el);
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
}, [open]);
|
|
33
|
+
const [shadows, setShadows] = (0, react.useState)([]);
|
|
34
|
+
const shadowValueRef = (0, react.useRef)("");
|
|
35
|
+
const readShadows = (0, react.useCallback)(() => {
|
|
36
|
+
if (!internalRef.current) return;
|
|
37
|
+
const shadowValue = getComputedStyle(internalRef.current).getPropertyValue(`--${require_index.DROP_SHADOW_PREFIX}`);
|
|
38
|
+
if (shadowValue !== shadowValueRef.current) {
|
|
39
|
+
shadowValueRef.current = shadowValue;
|
|
40
|
+
setShadows(require_components_client_Tooltip_util.parseShadow(shadowValue));
|
|
41
|
+
}
|
|
42
|
+
}, []);
|
|
43
|
+
const shadowPadding = (0, react.useMemo)(() => {
|
|
44
|
+
if (shadows.length === 0) return 0;
|
|
45
|
+
return shadows.reduce((max, s) => {
|
|
46
|
+
const extentX = Math.abs(s.x) + s.blur + Math.abs(s.spread);
|
|
47
|
+
const extentY = Math.abs(s.y) + s.blur + Math.abs(s.spread);
|
|
48
|
+
return Math.max(max, extentX, extentY);
|
|
49
|
+
}, 0);
|
|
50
|
+
}, [shadows]);
|
|
51
|
+
const [arrowCenter, setArrowCenter] = (0, react.useState)(void 0);
|
|
52
|
+
const computeArrowCenter = (0, react.useCallback)(() => {
|
|
53
|
+
const arrowEl = arrowRef.current;
|
|
54
|
+
const tooltipEl = internalRef.current;
|
|
55
|
+
if (!arrowEl || !tooltipEl) return;
|
|
56
|
+
const arrowRect = arrowEl.getBoundingClientRect();
|
|
57
|
+
const tooltipRect = tooltipEl.getBoundingClientRect();
|
|
58
|
+
const side = require_components_client_Tooltip_util.getArrowSide(effectivePlacement);
|
|
59
|
+
const raw = side === "top" || side === "bottom" ? arrowRect.left + arrowRect.width / 2 - tooltipRect.left : arrowRect.top + arrowRect.height / 2 - tooltipRect.top;
|
|
60
|
+
return Math.round(raw);
|
|
61
|
+
}, [arrowRef, effectivePlacement]);
|
|
62
|
+
const onPositionUpdate = (0, react.useCallback)(async ({ updatePosition }) => {
|
|
63
|
+
await updatePosition();
|
|
64
|
+
const el = internalRef.current;
|
|
65
|
+
if (el) {
|
|
66
|
+
const { offsetWidth, offsetHeight } = el;
|
|
67
|
+
if (offsetWidth > 0 && offsetHeight > 0) setDimensions((prev) => {
|
|
68
|
+
if (prev.width === offsetWidth && prev.height === offsetHeight) return prev;
|
|
69
|
+
return {
|
|
70
|
+
width: offsetWidth,
|
|
71
|
+
height: offsetHeight
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
readShadows();
|
|
75
|
+
}
|
|
76
|
+
const next = computeArrowCenter();
|
|
77
|
+
if (next !== void 0) setArrowCenter((prev) => prev === next ? prev : next);
|
|
78
|
+
}, [computeArrowCenter, readShadows]);
|
|
79
|
+
const svgPath = (0, react.useMemo)(() => {
|
|
80
|
+
return dimensions.width > 0 && dimensions.height > 0 ? require_components_client_Tooltip_util.generateTooltipPath({
|
|
81
|
+
width: dimensions.width,
|
|
82
|
+
height: dimensions.height,
|
|
83
|
+
placement: effectivePlacement,
|
|
84
|
+
borderRadius,
|
|
85
|
+
arrowCenter
|
|
86
|
+
}) : null;
|
|
87
|
+
}, [
|
|
88
|
+
effectivePlacement,
|
|
89
|
+
dimensions.width,
|
|
90
|
+
dimensions.height,
|
|
91
|
+
borderRadius,
|
|
92
|
+
arrowCenter
|
|
93
|
+
]);
|
|
94
|
+
const blurClipPath = (0, react.useMemo)(() => {
|
|
95
|
+
if (dimensions.width <= 0 || dimensions.height <= 0) return null;
|
|
96
|
+
const arrowSide = require_components_client_Tooltip_util.getArrowSide(effectivePlacement);
|
|
97
|
+
const offsetX = arrowSide === "left" ? require_components_client_Tooltip_util.ARROW_HEIGHT : 0;
|
|
98
|
+
const offsetY = arrowSide === "top" ? require_components_client_Tooltip_util.ARROW_HEIGHT : 0;
|
|
99
|
+
return require_components_client_Tooltip_util.generateTooltipPath({
|
|
100
|
+
width: dimensions.width,
|
|
101
|
+
height: dimensions.height,
|
|
102
|
+
placement: effectivePlacement,
|
|
103
|
+
borderRadius,
|
|
104
|
+
arrowCenter,
|
|
105
|
+
offsetX,
|
|
106
|
+
offsetY
|
|
107
|
+
});
|
|
108
|
+
}, [
|
|
109
|
+
effectivePlacement,
|
|
110
|
+
dimensions.width,
|
|
111
|
+
dimensions.height,
|
|
112
|
+
borderRadius,
|
|
113
|
+
arrowCenter
|
|
114
|
+
]);
|
|
115
|
+
const blurStyle = (0, react.useMemo)(() => {
|
|
116
|
+
const style = { clipPath: blurClipPath ? `path('${blurClipPath}')` : void 0 };
|
|
117
|
+
switch (require_components_client_Tooltip_util.getArrowSide(effectivePlacement)) {
|
|
118
|
+
case "top":
|
|
119
|
+
style.height = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
|
|
120
|
+
style.top = "auto";
|
|
121
|
+
style.bottom = "0";
|
|
122
|
+
break;
|
|
123
|
+
case "bottom":
|
|
124
|
+
style.height = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
|
|
125
|
+
break;
|
|
126
|
+
case "left":
|
|
127
|
+
style.width = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
|
|
128
|
+
style.left = "auto";
|
|
129
|
+
style.right = "0";
|
|
130
|
+
break;
|
|
131
|
+
case "right":
|
|
132
|
+
style.width = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
return style;
|
|
136
|
+
}, [blurClipPath, effectivePlacement]);
|
|
137
|
+
const [visible, setVisible] = (0, react.useState)(false);
|
|
138
|
+
if ((!open || !svgPath) && visible) setVisible(false);
|
|
139
|
+
(0, react.useEffect)(() => {
|
|
140
|
+
if (open && svgPath) {
|
|
141
|
+
const raf = requestAnimationFrame(() => {
|
|
142
|
+
setVisible(true);
|
|
143
|
+
});
|
|
144
|
+
return () => cancelAnimationFrame(raf);
|
|
145
|
+
}
|
|
146
|
+
}, [open, svgPath]);
|
|
147
|
+
return {
|
|
148
|
+
internalRef,
|
|
149
|
+
shadowFilterId,
|
|
150
|
+
maxWidthClass,
|
|
151
|
+
dimensions,
|
|
152
|
+
shadows,
|
|
153
|
+
shadowPadding,
|
|
154
|
+
svgPath,
|
|
155
|
+
blurClipPath,
|
|
156
|
+
blurStyle,
|
|
157
|
+
visible,
|
|
158
|
+
childTransitionStyle: {
|
|
159
|
+
opacity: visible ? 1 : 0,
|
|
160
|
+
transition: `opacity ${animationDuration}ms ease-in-out`
|
|
161
|
+
},
|
|
162
|
+
tooltipShift: (0, react.useMemo)(() => {
|
|
163
|
+
if (arrowCenter === void 0 || dimensions.width <= 0 || dimensions.height <= 0) return {
|
|
164
|
+
x: 0,
|
|
165
|
+
y: 0
|
|
166
|
+
};
|
|
167
|
+
return require_components_client_Tooltip_util.getArrowClampDelta({
|
|
168
|
+
width: dimensions.width,
|
|
169
|
+
height: dimensions.height,
|
|
170
|
+
placement: effectivePlacement,
|
|
171
|
+
borderRadius,
|
|
172
|
+
arrowCenter
|
|
173
|
+
});
|
|
174
|
+
}, [
|
|
175
|
+
arrowCenter,
|
|
176
|
+
dimensions.width,
|
|
177
|
+
dimensions.height,
|
|
178
|
+
effectivePlacement,
|
|
179
|
+
borderRadius
|
|
180
|
+
]),
|
|
181
|
+
onPositionUpdate
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
//#endregion
|
|
186
|
+
exports.useTooltipContent = useTooltipContent;
|