@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
|
@@ -4,6 +4,7 @@ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
|
4
4
|
const require_defaultTokensConfig = require('../../defaultTokensConfig.cjs');
|
|
5
5
|
const require_runtime_breakpointsConfig = require('../../runtime/breakpointsConfig.cjs');
|
|
6
6
|
const require_runtime_toastConfig = require('../../runtime/toastConfig.cjs');
|
|
7
|
+
const require_runtime_tooltipConfig = require('../../runtime/tooltipConfig.cjs');
|
|
7
8
|
const require_analytics = require('../dist/utils/analytics.cjs');
|
|
8
9
|
const require_colors = require('../dist/lib/colors.cjs');
|
|
9
10
|
const require_print = require('../dist/lib/print.cjs');
|
|
@@ -60,7 +61,8 @@ const syncCommand = {
|
|
|
60
61
|
const exportsJS = [`export const config = ${JSON.stringify(sortedConfig, null, 2)};`];
|
|
61
62
|
const runtimeConfigs = {
|
|
62
63
|
breakpoints: [require_runtime_breakpointsConfig.configToBreakpointsConfigContext(sortedConfig), "UDSBreakpointsConfigContextType"],
|
|
63
|
-
toast: [require_runtime_toastConfig.configToToastConfigContext(sortedConfig), "UDSToastConfigContextType"]
|
|
64
|
+
toast: [require_runtime_toastConfig.configToToastConfigContext(sortedConfig), "UDSToastConfigContextType"],
|
|
65
|
+
tooltip: [require_runtime_tooltipConfig.configToTooltipConfigContext(sortedConfig), "UDSTooltipConfigContextType"]
|
|
64
66
|
};
|
|
65
67
|
const runtimeTypeImports = [];
|
|
66
68
|
for (const [name, [json, type]] of Object.entries(runtimeConfigs)) {
|
|
@@ -74,10 +76,12 @@ const syncCommand = {
|
|
|
74
76
|
exportsTS.push(`export const runtimeConfig: UDSConfigContextType = {
|
|
75
77
|
breakpoints: breakpointsRuntimeConfig,
|
|
76
78
|
toast: toastRuntimeConfig,
|
|
79
|
+
tooltip: tooltipRuntimeConfig,
|
|
77
80
|
};`);
|
|
78
81
|
exportsJS.push(`export const runtimeConfig = {
|
|
79
82
|
breakpoints: breakpointsRuntimeConfig,
|
|
80
83
|
toast: toastRuntimeConfig,
|
|
84
|
+
tooltip: tooltipRuntimeConfig,
|
|
81
85
|
};`);
|
|
82
86
|
const configContentTs = `${importsTS.join("\n")}\n\n${exportsTS.join("\n\n")}\n`;
|
|
83
87
|
const configContentJs = `${exportsJS.join("\n\n")}\n`;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { defaultTokensConfig } from "../../defaultTokensConfig.js";
|
|
3
3
|
import { configToBreakpointsConfigContext } from "../../runtime/breakpointsConfig.js";
|
|
4
4
|
import { configToToastConfigContext } from "../../runtime/toastConfig.js";
|
|
5
|
+
import { configToTooltipConfigContext } from "../../runtime/tooltipConfig.js";
|
|
5
6
|
import { trackEvent } from "../dist/utils/analytics.js";
|
|
6
7
|
import { green, magenta, red, yellow } from "../dist/lib/colors.js";
|
|
7
8
|
import { print } from "../dist/lib/print.js";
|
|
@@ -57,7 +58,8 @@ const syncCommand = {
|
|
|
57
58
|
const exportsJS = [`export const config = ${JSON.stringify(sortedConfig, null, 2)};`];
|
|
58
59
|
const runtimeConfigs = {
|
|
59
60
|
breakpoints: [configToBreakpointsConfigContext(sortedConfig), "UDSBreakpointsConfigContextType"],
|
|
60
|
-
toast: [configToToastConfigContext(sortedConfig), "UDSToastConfigContextType"]
|
|
61
|
+
toast: [configToToastConfigContext(sortedConfig), "UDSToastConfigContextType"],
|
|
62
|
+
tooltip: [configToTooltipConfigContext(sortedConfig), "UDSTooltipConfigContextType"]
|
|
61
63
|
};
|
|
62
64
|
const runtimeTypeImports = [];
|
|
63
65
|
for (const [name, [json, type]] of Object.entries(runtimeConfigs)) {
|
|
@@ -71,10 +73,12 @@ const syncCommand = {
|
|
|
71
73
|
exportsTS.push(`export const runtimeConfig: UDSConfigContextType = {
|
|
72
74
|
breakpoints: breakpointsRuntimeConfig,
|
|
73
75
|
toast: toastRuntimeConfig,
|
|
76
|
+
tooltip: tooltipRuntimeConfig,
|
|
74
77
|
};`);
|
|
75
78
|
exportsJS.push(`export const runtimeConfig = {
|
|
76
79
|
breakpoints: breakpointsRuntimeConfig,
|
|
77
80
|
toast: toastRuntimeConfig,
|
|
81
|
+
tooltip: tooltipRuntimeConfig,
|
|
78
82
|
};`);
|
|
79
83
|
const configContentTs = `${importsTS.join("\n")}\n\n${exportsTS.join("\n\n")}\n`;
|
|
80
84
|
const configContentJs = `${exportsJS.join("\n\n")}\n`;
|
|
@@ -9,7 +9,7 @@ import { generateDefaultClassName } from "../../automated-config/dist/utils/inde
|
|
|
9
9
|
import { SpringMotionConfig } from "./SpringMotionConfig.js";
|
|
10
10
|
import React, { cloneElement, forwardRef, isValidElement, useImperativeHandle, useMemo, useRef } from "react";
|
|
11
11
|
import { buttonIconSvgSize } from "@yahoo/uds/fixtures";
|
|
12
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { Progress } from "@yahoo/uds-icons";
|
|
14
14
|
import { AnimatePresence, m, useReducedMotion } from "motion/react";
|
|
15
15
|
|
|
@@ -266,7 +266,7 @@ const Button = forwardRef(function Button({ size, variant, startIcon, endIcon, i
|
|
|
266
266
|
whileHover: "hover",
|
|
267
267
|
whileTap: "pressed",
|
|
268
268
|
...rest,
|
|
269
|
-
children: cloneElement(children, childProps, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
269
|
+
children: cloneElement(children, childProps, /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
270
270
|
startContent,
|
|
271
271
|
/* @__PURE__ */ jsx("span", {
|
|
272
272
|
className: styles.content,
|
|
@@ -42,7 +42,7 @@ const iconMap = {
|
|
|
42
42
|
* <Toast variant="info" message="This is a toast" />
|
|
43
43
|
*```
|
|
44
44
|
*
|
|
45
|
-
* @related Tooltip
|
|
45
|
+
* @related [Tooltip](https://uds.build/docs/components/tooltip), Popover (coming soon)
|
|
46
46
|
**/
|
|
47
47
|
const Toast = ({ message, onClickCloseButton, size: sizeProp, variant: variantProp, actionButton, onClickActionButton, startIcon, closeIcon = _yahoo_uds_icons.Cross, closeToast, slotProps, className, id, reduceMotion: forceReduceMotion }) => {
|
|
48
48
|
const { iconVariant, iconSize, buttonVariant, buttonSize, size, variant, textVariant, textColor } = require_components_client_Toast_UDSToastConfigProvider.useToastConfig(sizeProp, variantProp);
|
|
@@ -44,7 +44,7 @@ interface ToastProps extends UniversalToastProps, Partial<ReactToastifyContext>
|
|
|
44
44
|
* <Toast variant="info" message="This is a toast" />
|
|
45
45
|
*```
|
|
46
46
|
*
|
|
47
|
-
* @related Tooltip
|
|
47
|
+
* @related [Tooltip](https://uds.build/docs/components/tooltip), Popover (coming soon)
|
|
48
48
|
**/
|
|
49
49
|
declare const Toast: {
|
|
50
50
|
({
|
|
@@ -44,7 +44,7 @@ interface ToastProps extends UniversalToastProps, Partial<ReactToastifyContext>
|
|
|
44
44
|
* <Toast variant="info" message="This is a toast" />
|
|
45
45
|
*```
|
|
46
46
|
*
|
|
47
|
-
* @related Tooltip
|
|
47
|
+
* @related [Tooltip](https://uds.build/docs/components/tooltip), Popover (coming soon)
|
|
48
48
|
**/
|
|
49
49
|
declare const Toast: {
|
|
50
50
|
({
|
|
@@ -40,7 +40,7 @@ const iconMap = {
|
|
|
40
40
|
* <Toast variant="info" message="This is a toast" />
|
|
41
41
|
*```
|
|
42
42
|
*
|
|
43
|
-
* @related Tooltip
|
|
43
|
+
* @related [Tooltip](https://uds.build/docs/components/tooltip), Popover (coming soon)
|
|
44
44
|
**/
|
|
45
45
|
const Toast = ({ message, onClickCloseButton, size: sizeProp, variant: variantProp, actionButton, onClickActionButton, startIcon, closeIcon = Cross, closeToast, slotProps, className, id, reduceMotion: forceReduceMotion }) => {
|
|
46
46
|
const { iconVariant, iconSize, buttonVariant, buttonSize, size, variant, textVariant, textColor } = useToastConfig(sizeProp, variantProp);
|
|
@@ -0,0 +1,65 @@
|
|
|
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_components_client_Tooltip_UDSTooltipConfigProvider = require('./UDSTooltipConfigProvider.cjs');
|
|
6
|
+
const require_components_client_Tooltip_tooltipContext = require('./tooltipContext.cjs');
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _ariakit_react = require("@ariakit/react");
|
|
9
|
+
|
|
10
|
+
//#region src/components/client/Tooltip/Tooltip.tsx
|
|
11
|
+
/**
|
|
12
|
+
* **⚙️️ A Tooltip component that anchors to a trigger element
|
|
13
|
+
*
|
|
14
|
+
* @componentType Client component
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
|
|
18
|
+
*
|
|
19
|
+
* Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
|
|
20
|
+
*
|
|
21
|
+
* @see
|
|
22
|
+
* Check out the {@link https://uds.build/docs/components/tooltip Tooltip Docs} for more info
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* 'use client';
|
|
27
|
+
* import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@yahoo/uds";
|
|
28
|
+
*
|
|
29
|
+
* <Tooltip>
|
|
30
|
+
* <TooltipTrigger>
|
|
31
|
+
* <Button>Tooltip Trigger</Button>
|
|
32
|
+
* </TooltipTrigger>
|
|
33
|
+
* <TooltipContent>basic tooltip content</TooltipContent>
|
|
34
|
+
* </Tooltip>
|
|
35
|
+
*```
|
|
36
|
+
*
|
|
37
|
+
* @related [Toast](https://uds.build/docs/components/toast), Popover (coming soon).
|
|
38
|
+
**/
|
|
39
|
+
function Tooltip({ children, placement, open, portal = true }) {
|
|
40
|
+
const hideOnHoverOutside = open === void 0;
|
|
41
|
+
const controlledProps = open !== void 0 ? {
|
|
42
|
+
showTimeout: 0,
|
|
43
|
+
hideTimeout: 0,
|
|
44
|
+
timeout: 0,
|
|
45
|
+
mounted: open
|
|
46
|
+
} : void 0;
|
|
47
|
+
const { animationDuration, ariaKitPlacement } = require_components_client_Tooltip_UDSTooltipConfigProvider.useTooltipConfig({ placement });
|
|
48
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_client_Tooltip_tooltipContext.TooltipInternalContext.Provider, {
|
|
49
|
+
value: {
|
|
50
|
+
hideOnHoverOutside,
|
|
51
|
+
portal
|
|
52
|
+
},
|
|
53
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipProvider, {
|
|
54
|
+
placement: ariaKitPlacement,
|
|
55
|
+
animated: animationDuration,
|
|
56
|
+
open,
|
|
57
|
+
...controlledProps,
|
|
58
|
+
children
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
Tooltip.displayName = "Tooltip";
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.Tooltip = Tooltip;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/Tooltip.d.ts
|
|
6
|
+
type TooltipProps = UniversalTooltipProps;
|
|
7
|
+
/**
|
|
8
|
+
* **⚙️️ A Tooltip component that anchors to a trigger element
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
|
|
14
|
+
*
|
|
15
|
+
* Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
|
|
16
|
+
*
|
|
17
|
+
* @see
|
|
18
|
+
* Check out the {@link https://uds.build/docs/components/tooltip Tooltip Docs} for more info
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* 'use client';
|
|
23
|
+
* import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@yahoo/uds";
|
|
24
|
+
*
|
|
25
|
+
* <Tooltip>
|
|
26
|
+
* <TooltipTrigger>
|
|
27
|
+
* <Button>Tooltip Trigger</Button>
|
|
28
|
+
* </TooltipTrigger>
|
|
29
|
+
* <TooltipContent>basic tooltip content</TooltipContent>
|
|
30
|
+
* </Tooltip>
|
|
31
|
+
*```
|
|
32
|
+
*
|
|
33
|
+
* @related [Toast](https://uds.build/docs/components/toast), Popover (coming soon).
|
|
34
|
+
**/
|
|
35
|
+
declare function Tooltip({
|
|
36
|
+
children,
|
|
37
|
+
placement,
|
|
38
|
+
open,
|
|
39
|
+
portal
|
|
40
|
+
}: TooltipProps): react_jsx_runtime0.JSX.Element;
|
|
41
|
+
declare namespace Tooltip {
|
|
42
|
+
var displayName: string;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Tooltip };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipProps } from "../../../types/dist/index.js";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/Tooltip.d.ts
|
|
6
|
+
type TooltipProps = UniversalTooltipProps;
|
|
7
|
+
/**
|
|
8
|
+
* **⚙️️ A Tooltip component that anchors to a trigger element
|
|
9
|
+
*
|
|
10
|
+
* @componentType Client component
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
|
|
14
|
+
*
|
|
15
|
+
* Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
|
|
16
|
+
*
|
|
17
|
+
* @see
|
|
18
|
+
* Check out the {@link https://uds.build/docs/components/tooltip Tooltip Docs} for more info
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* 'use client';
|
|
23
|
+
* import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@yahoo/uds";
|
|
24
|
+
*
|
|
25
|
+
* <Tooltip>
|
|
26
|
+
* <TooltipTrigger>
|
|
27
|
+
* <Button>Tooltip Trigger</Button>
|
|
28
|
+
* </TooltipTrigger>
|
|
29
|
+
* <TooltipContent>basic tooltip content</TooltipContent>
|
|
30
|
+
* </Tooltip>
|
|
31
|
+
*```
|
|
32
|
+
*
|
|
33
|
+
* @related [Toast](https://uds.build/docs/components/toast), Popover (coming soon).
|
|
34
|
+
**/
|
|
35
|
+
declare function Tooltip({
|
|
36
|
+
children,
|
|
37
|
+
placement,
|
|
38
|
+
open,
|
|
39
|
+
portal
|
|
40
|
+
}: TooltipProps): react_jsx_runtime0.JSX.Element;
|
|
41
|
+
declare namespace Tooltip {
|
|
42
|
+
var displayName: string;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Tooltip };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
/*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
|
|
3
|
+
import { useTooltipConfig } from "./UDSTooltipConfigProvider.js";
|
|
4
|
+
import { TooltipInternalContext } from "./tooltipContext.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { TooltipProvider } from "@ariakit/react";
|
|
7
|
+
|
|
8
|
+
//#region src/components/client/Tooltip/Tooltip.tsx
|
|
9
|
+
/**
|
|
10
|
+
* **⚙️️ A Tooltip component that anchors to a trigger element
|
|
11
|
+
*
|
|
12
|
+
* @componentType Client component
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
|
|
16
|
+
*
|
|
17
|
+
* Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
|
|
18
|
+
*
|
|
19
|
+
* @see
|
|
20
|
+
* Check out the {@link https://uds.build/docs/components/tooltip Tooltip Docs} for more info
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* 'use client';
|
|
25
|
+
* import { Tooltip, TooltipTrigger, TooltipContent, Button } from "@yahoo/uds";
|
|
26
|
+
*
|
|
27
|
+
* <Tooltip>
|
|
28
|
+
* <TooltipTrigger>
|
|
29
|
+
* <Button>Tooltip Trigger</Button>
|
|
30
|
+
* </TooltipTrigger>
|
|
31
|
+
* <TooltipContent>basic tooltip content</TooltipContent>
|
|
32
|
+
* </Tooltip>
|
|
33
|
+
*```
|
|
34
|
+
*
|
|
35
|
+
* @related [Toast](https://uds.build/docs/components/toast), Popover (coming soon).
|
|
36
|
+
**/
|
|
37
|
+
function Tooltip({ children, placement, open, portal = true }) {
|
|
38
|
+
const hideOnHoverOutside = open === void 0;
|
|
39
|
+
const controlledProps = open !== void 0 ? {
|
|
40
|
+
showTimeout: 0,
|
|
41
|
+
hideTimeout: 0,
|
|
42
|
+
timeout: 0,
|
|
43
|
+
mounted: open
|
|
44
|
+
} : void 0;
|
|
45
|
+
const { animationDuration, ariaKitPlacement } = useTooltipConfig({ placement });
|
|
46
|
+
return /* @__PURE__ */ jsx(TooltipInternalContext.Provider, {
|
|
47
|
+
value: {
|
|
48
|
+
hideOnHoverOutside,
|
|
49
|
+
portal
|
|
50
|
+
},
|
|
51
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
52
|
+
placement: ariaKitPlacement,
|
|
53
|
+
animated: animationDuration,
|
|
54
|
+
open,
|
|
55
|
+
...controlledProps,
|
|
56
|
+
children
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
Tooltip.displayName = "Tooltip";
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Tooltip };
|
|
@@ -0,0 +1,188 @@
|
|
|
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_styles_styler = require('../../../styles/styler.cjs');
|
|
6
|
+
const require_components_Box = require('../../Box.cjs');
|
|
7
|
+
const require_components_Text = require('../../Text.cjs');
|
|
8
|
+
const require_components_IconSlot = require('../../IconSlot.cjs');
|
|
9
|
+
const require_components_client_Tooltip_UDSTooltipConfigProvider = require('./UDSTooltipConfigProvider.cjs');
|
|
10
|
+
const require_components_client_Tooltip_tooltipContext = require('./tooltipContext.cjs');
|
|
11
|
+
const require_hooks_useForkRef = require('../../../hooks/useForkRef.cjs');
|
|
12
|
+
const require_components_client_Tooltip_util = require('./util.cjs');
|
|
13
|
+
const require_components_client_Tooltip_useTooltipContent = require('./useTooltipContent.cjs');
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
+
let _ariakit_react = require("@ariakit/react");
|
|
17
|
+
|
|
18
|
+
//#region src/components/client/Tooltip/TooltipContent.tsx
|
|
19
|
+
const TooltipContent = (0, react.forwardRef)(function TooltipContent({ children, maxWidth, startTitleIcon, title, endContent, className, id }, ref) {
|
|
20
|
+
const store = (0, _ariakit_react.useTooltipContext)();
|
|
21
|
+
const open = (0, _ariakit_react.useStoreState)(store, "open");
|
|
22
|
+
const internalContext = (0, react.useContext)(require_components_client_Tooltip_tooltipContext.TooltipInternalContext);
|
|
23
|
+
const currentPlacement = (0, _ariakit_react.useStoreState)(store, "currentPlacement");
|
|
24
|
+
const placement = (0, _ariakit_react.useStoreState)(store, "placement");
|
|
25
|
+
const effectivePlacement = currentPlacement ?? placement ?? "top";
|
|
26
|
+
const { borderRadius, animationDuration } = require_components_client_Tooltip_UDSTooltipConfigProvider.useTooltipConfig();
|
|
27
|
+
const defaultBorderRadius = borderRadius["default"];
|
|
28
|
+
const arrowRef = (0, react.useRef)(null);
|
|
29
|
+
const { internalRef, shadowFilterId, maxWidthClass, dimensions, shadows, shadowPadding, svgPath, blurStyle, childTransitionStyle, tooltipShift, onPositionUpdate } = require_components_client_Tooltip_useTooltipContent.useTooltipContent({
|
|
30
|
+
open: open ?? false,
|
|
31
|
+
effectivePlacement,
|
|
32
|
+
maxWidth,
|
|
33
|
+
borderRadius: defaultBorderRadius,
|
|
34
|
+
arrowRef,
|
|
35
|
+
animationDuration
|
|
36
|
+
});
|
|
37
|
+
const mergedRef = require_hooks_useForkRef.useForkRef(ref, internalRef);
|
|
38
|
+
const classNames = {
|
|
39
|
+
root: require_styles_styler.getStyles({
|
|
40
|
+
tooltipSizeRoot: "default",
|
|
41
|
+
tooltipVariantRoot: "default",
|
|
42
|
+
className: require_styles_styler.cx(maxWidthClass, "flex", "z-[9999]", className)
|
|
43
|
+
}),
|
|
44
|
+
svg: require_styles_styler.getStyles({
|
|
45
|
+
tooltipSizeSvg: "default",
|
|
46
|
+
tooltipVariantSvg: "default",
|
|
47
|
+
className: require_styles_styler.cx("stroke-1", "uds-bgBlurFillFallback")
|
|
48
|
+
}),
|
|
49
|
+
blur: require_styles_styler.getStyles({
|
|
50
|
+
tooltipVariantBlur: "default",
|
|
51
|
+
position: "absolute",
|
|
52
|
+
width: "full",
|
|
53
|
+
height: "full",
|
|
54
|
+
className: require_styles_styler.cx("uds-bgBlurFallback", "top-0", "left-0", "z-[1]", "transition-opacity", `duration-[${animationDuration}ms]`, "ease-in-out")
|
|
55
|
+
}),
|
|
56
|
+
title: require_styles_styler.getStyles({ tooltipSizeTitle: "default" }),
|
|
57
|
+
body: require_styles_styler.getStyles({ tooltipSizeBody: "default" }),
|
|
58
|
+
endContent: require_styles_styler.getStyles({ tooltipSizeEndContent: "default" }),
|
|
59
|
+
icon: require_styles_styler.getStyles({
|
|
60
|
+
tooltipSizeIcon: "default",
|
|
61
|
+
tooltipVariantIcon: "default"
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_ariakit_react.Tooltip, {
|
|
65
|
+
ref: mergedRef,
|
|
66
|
+
className: classNames.root,
|
|
67
|
+
hideOnHoverOutside: internalContext ? internalContext.hideOnHoverOutside : void 0,
|
|
68
|
+
portal: internalContext ? internalContext.portal : true,
|
|
69
|
+
gutter: 10,
|
|
70
|
+
updatePosition: onPositionUpdate,
|
|
71
|
+
style: tooltipShift.x !== 0 || tooltipShift.y !== 0 ? { transform: `translate(${tooltipShift.x}px, ${tooltipShift.y}px)` } : void 0,
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
74
|
+
className: classNames.blur,
|
|
75
|
+
style: {
|
|
76
|
+
...blurStyle,
|
|
77
|
+
...childTransitionStyle
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
svgPath && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
81
|
+
"aria-hidden": true,
|
|
82
|
+
className: "absolute top-0 left-0 w-full h-full overflow-visible pointer-events-none z-[2]",
|
|
83
|
+
style: childTransitionStyle,
|
|
84
|
+
viewBox: `0 0 ${dimensions.width} ${dimensions.height}`,
|
|
85
|
+
children: [
|
|
86
|
+
shadows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("filter", {
|
|
87
|
+
id: shadowFilterId,
|
|
88
|
+
filterUnits: "userSpaceOnUse",
|
|
89
|
+
x: -(shadowPadding + require_components_client_Tooltip_util.ARROW_HEIGHT),
|
|
90
|
+
y: -(shadowPadding + require_components_client_Tooltip_util.ARROW_HEIGHT),
|
|
91
|
+
width: dimensions.width + 2 * (shadowPadding + require_components_client_Tooltip_util.ARROW_HEIGHT),
|
|
92
|
+
height: dimensions.height + 2 * (shadowPadding + require_components_client_Tooltip_util.ARROW_HEIGHT),
|
|
93
|
+
colorInterpolationFilters: "sRGB",
|
|
94
|
+
children: [
|
|
95
|
+
shadows.map((shadow, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [
|
|
96
|
+
shadow.spread !== 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("feMorphology", {
|
|
97
|
+
in: "SourceAlpha",
|
|
98
|
+
operator: shadow.spread > 0 ? "dilate" : "erode",
|
|
99
|
+
radius: Math.abs(shadow.spread),
|
|
100
|
+
result: `spread${i}`
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feGaussianBlur", {
|
|
103
|
+
in: shadow.spread !== 0 ? `spread${i}` : "SourceAlpha",
|
|
104
|
+
stdDeviation: shadow.blur / 2,
|
|
105
|
+
result: `blurred${i}`
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feOffset", {
|
|
108
|
+
in: `blurred${i}`,
|
|
109
|
+
dx: shadow.x,
|
|
110
|
+
dy: shadow.y,
|
|
111
|
+
result: `offset${i}`
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feFlood", {
|
|
114
|
+
floodColor: shadow.color,
|
|
115
|
+
result: `color${i}`
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feComposite", {
|
|
118
|
+
in: `color${i}`,
|
|
119
|
+
in2: `offset${i}`,
|
|
120
|
+
operator: "in",
|
|
121
|
+
result: `shadow${i}`
|
|
122
|
+
})
|
|
123
|
+
] }, i)),
|
|
124
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feMerge", {
|
|
125
|
+
result: "mergedShadows",
|
|
126
|
+
children: shadows.map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("feMergeNode", { in: `shadow${i}` }, i))
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("feComposite", {
|
|
129
|
+
in: "mergedShadows",
|
|
130
|
+
in2: "SourceAlpha",
|
|
131
|
+
operator: "out"
|
|
132
|
+
})
|
|
133
|
+
]
|
|
134
|
+
}) }),
|
|
135
|
+
shadows.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
136
|
+
d: svgPath,
|
|
137
|
+
fill: "black",
|
|
138
|
+
filter: `url(#${shadowFilterId})`
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
141
|
+
d: svgPath,
|
|
142
|
+
className: classNames.svg
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
147
|
+
position: "relative",
|
|
148
|
+
flexDirection: "column",
|
|
149
|
+
className: "z-[3] gap-[inherit]",
|
|
150
|
+
style: childTransitionStyle,
|
|
151
|
+
id,
|
|
152
|
+
children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
columnGap: "1",
|
|
155
|
+
children: [startTitleIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_IconSlot.IconSlot, {
|
|
156
|
+
iconProps: { variant: "fill" },
|
|
157
|
+
icon: startTitleIcon,
|
|
158
|
+
className: classNames.icon
|
|
159
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
160
|
+
className: classNames.title,
|
|
161
|
+
color: "inherit",
|
|
162
|
+
children: title
|
|
163
|
+
})]
|
|
164
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_Box.Box, {
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
columnGap: "1.5",
|
|
167
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
168
|
+
className: classNames.body,
|
|
169
|
+
color: "inherit",
|
|
170
|
+
children
|
|
171
|
+
}), endContent && !(0, react.isValidElement)(endContent) ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Text.Text, {
|
|
172
|
+
className: classNames.endContent,
|
|
173
|
+
color: "inherit",
|
|
174
|
+
children: endContent
|
|
175
|
+
}) : endContent]
|
|
176
|
+
})]
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipArrow, {
|
|
179
|
+
ref: arrowRef,
|
|
180
|
+
style: { opacity: 0 }
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
TooltipContent.displayName = "TooltipContent";
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
exports.TooltipContent = TooltipContent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipContentProps } from "../../../types/dist/index.cjs";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/TooltipContent.d.ts
|
|
6
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<UniversalTooltipContentProps & react.RefAttributes<HTMLInputElement>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { TooltipContent };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
import { UniversalTooltipContentProps } from "../../../types/dist/index.js";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/client/Tooltip/TooltipContent.d.ts
|
|
6
|
+
declare const TooltipContent: react.ForwardRefExoticComponent<UniversalTooltipContentProps & react.RefAttributes<HTMLInputElement>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { TooltipContent };
|