@yahoo/uds 3.116.0-beta.2 → 3.116.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.
Files changed (187) hide show
  1. package/dist/automated-config/dist/generated/autoVariants.cjs +0 -10
  2. package/dist/automated-config/dist/generated/autoVariants.d.cts +0 -10
  3. package/dist/automated-config/dist/generated/autoVariants.d.ts +0 -10
  4. package/dist/automated-config/dist/generated/autoVariants.js +0 -10
  5. package/dist/automated-config/dist/generated/generatedConfigs.cjs +0 -1842
  6. package/dist/automated-config/dist/generated/generatedConfigs.d.cts +1 -194
  7. package/dist/automated-config/dist/generated/generatedConfigs.d.ts +1 -194
  8. package/dist/automated-config/dist/generated/generatedConfigs.js +1 -1842
  9. package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +0 -78
  10. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +1 -2
  11. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +1 -2
  12. package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +0 -78
  13. package/dist/cli/commands/sync.cjs +0 -6
  14. package/dist/cli/commands/sync.js +0 -6
  15. package/dist/components/client/Toast/Toast.cjs +3 -3
  16. package/dist/components/client/Toast/Toast.d.cts +1 -1
  17. package/dist/components/client/Toast/Toast.d.ts +1 -1
  18. package/dist/components/client/Toast/Toast.js +3 -3
  19. package/dist/components/client/Toast/UDSToastConfigProvider.d.cts +5 -5
  20. package/dist/components/client/Toast/UDSToastConfigProvider.d.ts +5 -5
  21. package/dist/components/client/Toast/index.d.cts +1 -1
  22. package/dist/components/client/Toast/index.d.ts +1 -1
  23. package/dist/components/client/Tooltip/Tooltip.cjs +6 -6
  24. package/dist/components/client/Tooltip/Tooltip.d.cts +1 -1
  25. package/dist/components/client/Tooltip/Tooltip.d.ts +1 -1
  26. package/dist/components/client/Tooltip/Tooltip.js +6 -6
  27. package/dist/components/client/Tooltip/TooltipContent.cjs +119 -55
  28. package/dist/components/client/Tooltip/TooltipContent.js +120 -56
  29. package/dist/components/client/Tooltip/tooltipContext.cjs +1 -0
  30. package/dist/components/client/Tooltip/tooltipContext.d.cts +2 -1
  31. package/dist/components/client/Tooltip/tooltipContext.d.ts +2 -1
  32. package/dist/components/client/Tooltip/tooltipContext.js +1 -0
  33. package/dist/{hooks/useSvgFloatingContent.cjs → components/client/Tooltip/useTooltipContent.cjs} +48 -81
  34. package/dist/components/client/Tooltip/useTooltipContent.d.cts +66 -0
  35. package/dist/components/client/Tooltip/useTooltipContent.d.ts +66 -0
  36. package/dist/{hooks/useSvgFloatingContent.js → components/client/Tooltip/useTooltipContent.js} +43 -76
  37. package/dist/components/client/Tooltip/util.cjs +248 -0
  38. package/dist/{utils/svgFloatingContentUtils.d.cts → components/client/Tooltip/util.d.cts} +62 -25
  39. package/dist/{utils/svgFloatingContentUtils.d.ts → components/client/Tooltip/util.d.ts} +62 -25
  40. package/dist/components/client/Tooltip/util.js +240 -0
  41. package/dist/components/client/index.cjs +0 -8
  42. package/dist/components/client/index.d.cts +5 -10
  43. package/dist/components/client/index.d.ts +5 -10
  44. package/dist/components/client/index.js +1 -5
  45. package/dist/components/client/providers/UDSConfigProvider.cjs +2 -6
  46. package/dist/components/client/providers/UDSConfigProvider.d.cts +1 -2
  47. package/dist/components/client/providers/UDSConfigProvider.d.ts +1 -2
  48. package/dist/components/client/providers/UDSConfigProvider.js +2 -6
  49. package/dist/components/experimental/client/{ExperimentalPopover.cjs → Popover.cjs} +1 -10
  50. package/dist/components/experimental/client/Popover.d.cts +29 -0
  51. package/dist/components/experimental/client/Popover.d.ts +29 -0
  52. package/dist/components/experimental/client/{ExperimentalPopover.js → Popover.js} +1 -10
  53. package/dist/components/experimental/client/index.cjs +10 -10
  54. package/dist/components/experimental/client/index.d.cts +2 -2
  55. package/dist/components/experimental/client/index.d.ts +2 -2
  56. package/dist/components/experimental/client/index.js +1 -1
  57. package/dist/components/experimental/index.cjs +19 -19
  58. package/dist/components/experimental/index.d.cts +2 -2
  59. package/dist/components/experimental/index.d.ts +2 -2
  60. package/dist/components/experimental/index.js +1 -1
  61. package/dist/components/index.cjs +0 -12
  62. package/dist/components/index.d.cts +5 -9
  63. package/dist/components/index.d.ts +5 -9
  64. package/dist/components/index.js +1 -9
  65. package/dist/config/dist/index.cjs +1 -79
  66. package/dist/config/dist/index.js +1 -79
  67. package/dist/index.cjs +10 -21
  68. package/dist/index.d.cts +10 -15
  69. package/dist/index.d.ts +10 -15
  70. package/dist/index.js +11 -16
  71. package/dist/runtime/index.cjs +0 -2
  72. package/dist/runtime/index.d.cts +2 -3
  73. package/dist/runtime/index.d.ts +2 -3
  74. package/dist/runtime/index.js +1 -2
  75. package/dist/runtime/udsConfig.cjs +1 -3
  76. package/dist/runtime/udsConfig.d.cts +1 -3
  77. package/dist/runtime/udsConfig.d.ts +1 -3
  78. package/dist/runtime/udsConfig.js +1 -3
  79. package/dist/styles/styler.d.cts +96 -106
  80. package/dist/styles/styler.d.ts +96 -106
  81. package/dist/styles/variants.d.cts +0 -30
  82. package/dist/styles/variants.d.ts +0 -30
  83. package/dist/tailwind/dist/commands/css.helpers.cjs +6 -2
  84. package/dist/tailwind/dist/commands/css.helpers.js +6 -2
  85. package/dist/tailwind/dist/commands/generateComponentData.cjs +2 -0
  86. package/dist/tailwind/dist/commands/generateComponentData.js +3 -1
  87. package/dist/tailwind/dist/commands/generatePurgeCSSData.cjs +3 -8
  88. package/dist/tailwind/dist/commands/generatePurgeCSSData.js +3 -8
  89. package/dist/tailwind/dist/commands/purge.cjs +2 -2
  90. package/dist/tailwind/dist/commands/purge.js +2 -2
  91. package/dist/tailwind/dist/css/generate.cjs +6 -4
  92. package/dist/tailwind/dist/css/generate.helpers.cjs +4 -1
  93. package/dist/tailwind/dist/css/generate.helpers.js +4 -1
  94. package/dist/tailwind/dist/css/generate.js +7 -5
  95. package/dist/tailwind/dist/css/nodeUtils.cjs +30 -2
  96. package/dist/tailwind/dist/css/nodeUtils.js +30 -3
  97. package/dist/tailwind/dist/css/runner.cjs +52 -19
  98. package/dist/tailwind/dist/css/runner.helpers.cjs +2 -2
  99. package/dist/tailwind/dist/css/runner.helpers.js +2 -2
  100. package/dist/tailwind/dist/css/runner.js +53 -20
  101. package/dist/tailwind/dist/css/theme.d.cts +2 -2
  102. package/dist/tailwind/dist/css/theme.d.ts +2 -2
  103. package/dist/tailwind/dist/purger/legacy/purgeCSS.cjs +19 -8
  104. package/dist/tailwind/dist/purger/legacy/purgeCSS.js +19 -8
  105. package/dist/tailwind/dist/purger/optimized/purge.cjs +2 -1
  106. package/dist/tailwind/dist/purger/optimized/purge.js +2 -1
  107. package/dist/tailwind/dist/purger/optimized/purgeFromCode.cjs +22 -2
  108. package/dist/tailwind/dist/purger/optimized/purgeFromCode.js +22 -2
  109. package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.cjs +5 -4
  110. package/dist/tailwind/dist/purger/optimized/utils/componentAnalyzer.js +5 -4
  111. package/dist/tailwind/dist/purger/optimized/utils/files.cjs +12 -10
  112. package/dist/tailwind/dist/purger/optimized/utils/files.js +12 -9
  113. package/dist/tailwind/dist/tailwind/plugins/components.cjs +0 -1
  114. package/dist/tailwind/dist/tailwind/plugins/components.js +1 -2
  115. package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.cjs +294 -10
  116. package/dist/tailwind/dist/tailwind/plugins/getTailwindAsUdsColors.js +294 -9
  117. package/dist/tailwind/dist/utils/entryPoints.cjs +63 -0
  118. package/dist/tailwind/dist/utils/entryPoints.js +55 -0
  119. package/dist/tokens/automation/configs/index.cjs +0 -1
  120. package/dist/tokens/automation/configs/index.d.cts +2 -2
  121. package/dist/tokens/automation/configs/index.d.ts +2 -2
  122. package/dist/tokens/automation/configs/index.js +2 -2
  123. package/dist/tokens/automation/index.cjs +0 -1
  124. package/dist/tokens/automation/index.d.cts +2 -2
  125. package/dist/tokens/automation/index.d.ts +2 -2
  126. package/dist/tokens/automation/index.js +2 -2
  127. package/dist/tokens/index.cjs +1 -2
  128. package/dist/tokens/index.d.cts +3 -3
  129. package/dist/tokens/index.d.ts +3 -3
  130. package/dist/tokens/index.js +3 -3
  131. package/dist/tokens/types.d.cts +2 -2
  132. package/dist/tokens/types.d.ts +2 -2
  133. package/dist/types/dist/index.d.cts +1 -51
  134. package/dist/types/dist/index.d.ts +1 -51
  135. package/dist/uds/generated/componentData.cjs +887 -1029
  136. package/dist/uds/generated/componentData.js +840 -952
  137. package/dist/uds/generated/tailwindPurge.cjs +221 -247
  138. package/dist/uds/generated/tailwindPurge.js +221 -247
  139. package/dist/uds/package.cjs +1 -1
  140. package/dist/uds/package.js +1 -1
  141. package/generated/componentData.json +1195 -1337
  142. package/generated/tailwindPurge.ts +5 -4604
  143. package/package.json +2 -2
  144. package/dist/components/SvgFloatingOverlay.cjs +0 -122
  145. package/dist/components/SvgFloatingOverlay.d.cts +0 -42
  146. package/dist/components/SvgFloatingOverlay.d.ts +0 -42
  147. package/dist/components/SvgFloatingOverlay.js +0 -120
  148. package/dist/components/client/Popover/Popover.cjs +0 -96
  149. package/dist/components/client/Popover/Popover.d.cts +0 -55
  150. package/dist/components/client/Popover/Popover.d.ts +0 -55
  151. package/dist/components/client/Popover/Popover.js +0 -94
  152. package/dist/components/client/Popover/PopoverContent.cjs +0 -171
  153. package/dist/components/client/Popover/PopoverContent.d.cts +0 -26
  154. package/dist/components/client/Popover/PopoverContent.d.ts +0 -26
  155. package/dist/components/client/Popover/PopoverContent.js +0 -169
  156. package/dist/components/client/Popover/PopoverContext.cjs +0 -11
  157. package/dist/components/client/Popover/PopoverContext.d.cts +0 -21
  158. package/dist/components/client/Popover/PopoverContext.d.ts +0 -21
  159. package/dist/components/client/Popover/PopoverContext.js +0 -9
  160. package/dist/components/client/Popover/PopoverTrigger.cjs +0 -26
  161. package/dist/components/client/Popover/PopoverTrigger.d.cts +0 -14
  162. package/dist/components/client/Popover/PopoverTrigger.d.ts +0 -14
  163. package/dist/components/client/Popover/PopoverTrigger.js +0 -24
  164. package/dist/components/client/Popover/UDSPopoverConfigProvider.cjs +0 -40
  165. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.cts +0 -28
  166. package/dist/components/client/Popover/UDSPopoverConfigProvider.d.ts +0 -28
  167. package/dist/components/client/Popover/UDSPopoverConfigProvider.js +0 -37
  168. package/dist/components/client/Popover/index.cjs +0 -12
  169. package/dist/components/client/Popover/index.d.cts +0 -7
  170. package/dist/components/client/Popover/index.d.ts +0 -7
  171. package/dist/components/client/Popover/index.js +0 -8
  172. package/dist/components/experimental/client/ExperimentalPopover.d.cts +0 -40
  173. package/dist/components/experimental/client/ExperimentalPopover.d.ts +0 -40
  174. package/dist/hooks/useSvgFloatingContent.d.cts +0 -74
  175. package/dist/hooks/useSvgFloatingContent.d.ts +0 -74
  176. package/dist/runtime/popoverConfig.cjs +0 -41
  177. package/dist/runtime/popoverConfig.d.cts +0 -24
  178. package/dist/runtime/popoverConfig.d.ts +0 -24
  179. package/dist/runtime/popoverConfig.js +0 -40
  180. package/dist/tailwind/dist/.prettierrc.cjs +0 -13
  181. package/dist/tailwind/dist/.prettierrc.js +0 -12
  182. package/dist/utils/parseShadow.cjs +0 -120
  183. package/dist/utils/parseShadow.d.cts +0 -33
  184. package/dist/utils/parseShadow.d.ts +0 -33
  185. package/dist/utils/parseShadow.js +0 -118
  186. package/dist/utils/svgFloatingContentUtils.cjs +0 -121
  187. package/dist/utils/svgFloatingContentUtils.js +0 -117
@@ -4,19 +4,16 @@ import { cx, getStyles } from "../../../styles/styler.js";
4
4
  import { Box } from "../../Box.js";
5
5
  import { Text } from "../../Text.js";
6
6
  import { IconSlot } from "../../IconSlot.js";
7
- import { useForkRef } from "../../../hooks/useForkRef.js";
8
- import { useSvgFloatingContent } from "../../../hooks/useSvgFloatingContent.js";
9
- import { SvgFloatingOverlay } from "../../SvgFloatingOverlay.js";
10
7
  import { useTooltipConfig } from "./UDSTooltipConfigProvider.js";
11
8
  import { TooltipInternalContext } from "./tooltipContext.js";
12
- import { forwardRef, isValidElement, useContext, useMemo, useRef } from "react";
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
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
14
  import { Tooltip, TooltipArrow, useStoreState, useTooltipContext } from "@ariakit/react";
15
15
 
16
16
  //#region src/components/client/Tooltip/TooltipContent.tsx
17
- const ARROW_HEIGHT = 8;
18
- const ARROW_WIDTH = 12;
19
- const ARROW_TIP_RADIUS_FRACTION = .5;
20
17
  const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth, startTitleIcon, title, endContent, className, id }, ref) {
21
18
  const store = useTooltipContext();
22
19
  const open = useStoreState(store, "open");
@@ -27,30 +24,25 @@ const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth,
27
24
  const { borderRadius, animationDuration } = useTooltipConfig();
28
25
  const defaultBorderRadius = borderRadius["default"];
29
26
  const arrowRef = useRef(null);
30
- const { internalRef, shift, onPositionUpdate, ...svgFloatingContentProps } = useSvgFloatingContent({
27
+ const { internalRef, shadowFilterId, maxWidthClass, dimensions, shadows, shadowPadding, svgPath, blurStyle, childTransitionStyle, tooltipShift, onPositionUpdate } = useTooltipContent({
31
28
  open: open ?? false,
32
29
  effectivePlacement,
30
+ maxWidth,
33
31
  borderRadius: defaultBorderRadius,
34
32
  arrowRef,
35
- animationDuration,
36
- arrowWidth: ARROW_WIDTH,
37
- arrowHeight: ARROW_HEIGHT,
38
- arrowTipRadiusFraction: ARROW_TIP_RADIUS_FRACTION
33
+ animationDuration
39
34
  });
40
35
  const mergedRef = useForkRef(ref, internalRef);
41
36
  const classNames = {
42
37
  root: getStyles({
43
38
  tooltipSizeRoot: "default",
44
39
  tooltipVariantRoot: "default",
45
- className: cx(useMemo(() => {
46
- if (maxWidth !== void 0) return typeof maxWidth === "number" ? `max-w-[${maxWidth}px]` : `max-w-[${maxWidth}]`;
47
- return "max-w-lg";
48
- }, [maxWidth]), "flex", "z-[9999]", className)
40
+ className: cx(maxWidthClass, "flex", "z-[9999]", className)
49
41
  }),
50
42
  svg: getStyles({
51
43
  tooltipSizeSvg: "default",
52
44
  tooltipVariantSvg: "default",
53
- className: cx("uds-bgBlurFillFallback")
45
+ className: cx("stroke-1", "uds-bgBlurFillFallback")
54
46
  }),
55
47
  blur: getStyles({
56
48
  tooltipVariantBlur: "default",
@@ -70,50 +62,122 @@ const TooltipContent = forwardRef(function TooltipContent({ children, maxWidth,
70
62
  return /* @__PURE__ */ jsxs(Tooltip, {
71
63
  ref: mergedRef,
72
64
  className: classNames.root,
73
- hideOnHoverOutside: internalContext?.isControlled ? false : void 0,
74
- hideOnInteractOutside: internalContext?.isControlled ? false : void 0,
65
+ hideOnHoverOutside: internalContext ? internalContext.hideOnHoverOutside : void 0,
75
66
  portal: internalContext ? internalContext.portal : true,
76
67
  gutter: 10,
77
68
  updatePosition: onPositionUpdate,
78
- style: shift.x !== 0 || shift.y !== 0 ? { transform: `translate(${shift.x}px, ${shift.y}px)` } : void 0,
79
- children: [/* @__PURE__ */ jsxs(SvgFloatingOverlay, {
80
- blurClassName: classNames.blur,
81
- svgClassNames: { base: classNames.svg },
82
- arrowHeight: ARROW_HEIGHT,
83
- contentWrapperSlotProps: {
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",
84
146
  flexDirection: "column",
85
- id
86
- },
87
- ...svgFloatingContentProps,
88
- children: [title && /* @__PURE__ */ jsxs(Box, {
89
- alignItems: "center",
90
- columnGap: "1",
91
- children: [startTitleIcon && /* @__PURE__ */ jsx(IconSlot, {
92
- iconProps: { variant: "fill" },
93
- icon: startTitleIcon,
94
- className: classNames.icon
95
- }), /* @__PURE__ */ jsx(Text, {
96
- className: classNames.title,
97
- color: "inherit",
98
- children: title
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]
99
174
  })]
100
- }), /* @__PURE__ */ jsxs(Box, {
101
- alignItems: "center",
102
- columnGap: "1.5",
103
- children: [/* @__PURE__ */ jsx(Text, {
104
- className: classNames.body,
105
- color: "inherit",
106
- children
107
- }), endContent && !isValidElement(endContent) ? /* @__PURE__ */ jsx(Text, {
108
- className: classNames.endContent,
109
- color: "inherit",
110
- children: endContent
111
- }) : endContent]
112
- })]
113
- }), /* @__PURE__ */ jsx(TooltipArrow, {
114
- ref: arrowRef,
115
- style: { opacity: 0 }
116
- })]
175
+ }),
176
+ /* @__PURE__ */ jsx(TooltipArrow, {
177
+ ref: arrowRef,
178
+ style: { opacity: 0 }
179
+ })
180
+ ]
117
181
  });
118
182
  });
119
183
  TooltipContent.displayName = "TooltipContent";
@@ -5,6 +5,7 @@ const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
5
5
  let react = require("react");
6
6
 
7
7
  //#region src/components/client/Tooltip/tooltipContext.tsx
8
+ /** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
8
9
  const TooltipInternalContext = (0, react.createContext)(null);
9
10
 
10
11
  //#endregion
@@ -3,9 +3,10 @@ import * as react from "react";
3
3
 
4
4
  //#region src/components/client/Tooltip/tooltipContext.d.ts
5
5
  interface TooltipInternalContextType {
6
+ hideOnHoverOutside: boolean;
6
7
  portal: boolean;
7
- isControlled: boolean;
8
8
  }
9
+ /** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
9
10
  declare const TooltipInternalContext: react.Context<TooltipInternalContextType | null>;
10
11
  //#endregion
11
12
  export { TooltipInternalContext };
@@ -3,9 +3,10 @@ import * as react from "react";
3
3
 
4
4
  //#region src/components/client/Tooltip/tooltipContext.d.ts
5
5
  interface TooltipInternalContextType {
6
+ hideOnHoverOutside: boolean;
6
7
  portal: boolean;
7
- isControlled: boolean;
8
8
  }
9
+ /** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
9
10
  declare const TooltipInternalContext: react.Context<TooltipInternalContextType | null>;
10
11
  //#endregion
11
12
  export { TooltipInternalContext };
@@ -3,6 +3,7 @@
3
3
  import { createContext } from "react";
4
4
 
5
5
  //#region src/components/client/Tooltip/tooltipContext.tsx
6
+ /** When true, tooltip content should hide when pointer leaves anchor/tooltip. */
6
7
  const TooltipInternalContext = createContext(null);
7
8
 
8
9
  //#endregion
@@ -1,19 +1,23 @@
1
+ "use client";
1
2
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
4
- const require_index = require('../css-tokens/dist/index.cjs');
5
- const require_utils_parseShadow = require('../utils/parseShadow.cjs');
6
- const require_utils_svgFloatingContentUtils = require('../utils/svgFloatingContentUtils.cjs');
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
7
  let react = require("react");
8
8
 
9
- //#region src/hooks/useSvgFloatingContent.ts
10
- function useSvgFloatingContent({ open, effectivePlacement, borderRadius, arrowRef, animationDuration, hideArrow = false, arrowWidth, arrowHeight, arrowTipRadiusFraction }) {
9
+ //#region src/components/client/Tooltip/useTooltipContent.ts
10
+ function useTooltipContent({ open, effectivePlacement, maxWidth, borderRadius, arrowRef, animationDuration }) {
11
11
  const internalRef = (0, react.useRef)(null);
12
12
  const shadowFilterId = (0, react.useId)();
13
13
  const [dimensions, setDimensions] = (0, react.useState)({
14
14
  width: 0,
15
15
  height: 0
16
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]);
17
21
  (0, react.useEffect)(() => {
18
22
  const el = internalRef.current;
19
23
  if (!el) return;
@@ -33,7 +37,7 @@ function useSvgFloatingContent({ open, effectivePlacement, borderRadius, arrowRe
33
37
  const shadowValue = getComputedStyle(internalRef.current).getPropertyValue(`--${require_index.DROP_SHADOW_PREFIX}`);
34
38
  if (shadowValue !== shadowValueRef.current) {
35
39
  shadowValueRef.current = shadowValue;
36
- setShadows(require_utils_parseShadow.parseShadow(shadowValue));
40
+ setShadows(require_components_client_Tooltip_util.parseShadow(shadowValue));
37
41
  }
38
42
  }, []);
39
43
  const shadowPadding = (0, react.useMemo)(() => {
@@ -47,12 +51,12 @@ function useSvgFloatingContent({ open, effectivePlacement, borderRadius, arrowRe
47
51
  const [arrowCenter, setArrowCenter] = (0, react.useState)(void 0);
48
52
  const computeArrowCenter = (0, react.useCallback)(() => {
49
53
  const arrowEl = arrowRef.current;
50
- const el = internalRef.current;
51
- if (!arrowEl || !el) return;
54
+ const tooltipEl = internalRef.current;
55
+ if (!arrowEl || !tooltipEl) return;
52
56
  const arrowRect = arrowEl.getBoundingClientRect();
53
- const rect = el.getBoundingClientRect();
54
- const side = require_utils_svgFloatingContentUtils.getArrowSide(effectivePlacement);
55
- const raw = side === "top" || side === "bottom" ? arrowRect.left + arrowRect.width / 2 - rect.left : arrowRect.top + arrowRect.height / 2 - rect.top;
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;
56
60
  return Math.round(raw);
57
61
  }, [arrowRef, effectivePlacement]);
58
62
  const onPositionUpdate = (0, react.useCallback)(async ({ updatePosition }) => {
@@ -69,115 +73,81 @@ function useSvgFloatingContent({ open, effectivePlacement, borderRadius, arrowRe
69
73
  });
70
74
  readShadows();
71
75
  }
72
- if (!hideArrow) {
73
- const next = computeArrowCenter();
74
- if (next !== void 0) setArrowCenter((prev) => prev === next ? prev : next);
75
- }
76
- }, [
77
- computeArrowCenter,
78
- readShadows,
79
- hideArrow
80
- ]);
76
+ const next = computeArrowCenter();
77
+ if (next !== void 0) setArrowCenter((prev) => prev === next ? prev : next);
78
+ }, [computeArrowCenter, readShadows]);
81
79
  const svgPath = (0, react.useMemo)(() => {
82
- return dimensions.width > 0 && dimensions.height > 0 ? require_utils_svgFloatingContentUtils.generateSvgFloatingContentPath({
80
+ return dimensions.width > 0 && dimensions.height > 0 ? require_components_client_Tooltip_util.generateTooltipPath({
83
81
  width: dimensions.width,
84
82
  height: dimensions.height,
85
83
  placement: effectivePlacement,
86
84
  borderRadius,
87
- arrowCenter: hideArrow ? void 0 : arrowCenter,
88
- arrowWidth,
89
- arrowHeight,
90
- arrowTipRadiusFraction,
91
- ...hideArrow && {
92
- arrowWidth: 0,
93
- arrowHeight: 0
94
- }
85
+ arrowCenter
95
86
  }) : null;
96
87
  }, [
97
88
  effectivePlacement,
98
89
  dimensions.width,
99
90
  dimensions.height,
100
91
  borderRadius,
101
- arrowCenter,
102
- hideArrow,
103
- arrowWidth,
104
- arrowHeight,
105
- arrowTipRadiusFraction
92
+ arrowCenter
106
93
  ]);
107
94
  const blurClipPath = (0, react.useMemo)(() => {
108
95
  if (dimensions.width <= 0 || dimensions.height <= 0) return null;
109
- if (hideArrow) return require_utils_svgFloatingContentUtils.generateSvgFloatingContentPath({
110
- width: dimensions.width,
111
- height: dimensions.height,
112
- placement: effectivePlacement,
113
- borderRadius,
114
- arrowWidth: 0,
115
- arrowHeight: 0,
116
- arrowTipRadiusFraction
117
- });
118
- const arrowSide = require_utils_svgFloatingContentUtils.getArrowSide(effectivePlacement);
119
- const offsetX = arrowSide === "left" ? arrowHeight : 0;
120
- const offsetY = arrowSide === "top" ? arrowHeight : 0;
121
- return require_utils_svgFloatingContentUtils.generateSvgFloatingContentPath({
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({
122
100
  width: dimensions.width,
123
101
  height: dimensions.height,
124
102
  placement: effectivePlacement,
125
103
  borderRadius,
126
104
  arrowCenter,
127
105
  offsetX,
128
- offsetY,
129
- arrowWidth,
130
- arrowHeight,
131
- arrowTipRadiusFraction
106
+ offsetY
132
107
  });
133
108
  }, [
134
109
  effectivePlacement,
135
110
  dimensions.width,
136
111
  dimensions.height,
137
112
  borderRadius,
138
- arrowCenter,
139
- hideArrow,
140
- arrowHeight,
141
- arrowWidth,
142
- arrowTipRadiusFraction
113
+ arrowCenter
143
114
  ]);
144
115
  const blurStyle = (0, react.useMemo)(() => {
145
116
  const style = { clipPath: blurClipPath ? `path('${blurClipPath}')` : void 0 };
146
- if (!hideArrow) switch (require_utils_svgFloatingContentUtils.getArrowSide(effectivePlacement)) {
117
+ switch (require_components_client_Tooltip_util.getArrowSide(effectivePlacement)) {
147
118
  case "top":
148
- style.height = `calc(100% + ${arrowHeight}px)`;
119
+ style.height = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
149
120
  style.top = "auto";
150
121
  style.bottom = "0";
151
122
  break;
152
123
  case "bottom":
153
- style.height = `calc(100% + ${arrowHeight}px)`;
124
+ style.height = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
154
125
  break;
155
126
  case "left":
156
- style.width = `calc(100% + ${arrowHeight}px)`;
127
+ style.width = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
157
128
  style.left = "auto";
158
129
  style.right = "0";
159
130
  break;
160
131
  case "right":
161
- style.width = `calc(100% + ${arrowHeight}px)`;
132
+ style.width = `calc(100% + ${require_components_client_Tooltip_util.ARROW_HEIGHT}px)`;
162
133
  break;
163
134
  }
164
135
  return style;
165
- }, [
166
- blurClipPath,
167
- effectivePlacement,
168
- hideArrow,
169
- arrowHeight
170
- ]);
136
+ }, [blurClipPath, effectivePlacement]);
171
137
  const [visible, setVisible] = (0, react.useState)(false);
138
+ if ((!open || !svgPath) && visible) setVisible(false);
172
139
  (0, react.useEffect)(() => {
173
- const raf = requestAnimationFrame(() => {
174
- setVisible(open && !!svgPath);
175
- });
176
- return () => cancelAnimationFrame(raf);
140
+ if (open && svgPath) {
141
+ const raf = requestAnimationFrame(() => {
142
+ setVisible(true);
143
+ });
144
+ return () => cancelAnimationFrame(raf);
145
+ }
177
146
  }, [open, svgPath]);
178
147
  return {
179
148
  internalRef,
180
149
  shadowFilterId,
150
+ maxWidthClass,
181
151
  dimensions,
182
152
  shadows,
183
153
  shadowPadding,
@@ -189,31 +159,28 @@ function useSvgFloatingContent({ open, effectivePlacement, borderRadius, arrowRe
189
159
  opacity: visible ? 1 : 0,
190
160
  transition: `opacity ${animationDuration}ms ease-in-out`
191
161
  },
192
- shift: (0, react.useMemo)(() => {
193
- if (hideArrow || arrowCenter === void 0 || dimensions.width <= 0 || dimensions.height <= 0) return {
162
+ tooltipShift: (0, react.useMemo)(() => {
163
+ if (arrowCenter === void 0 || dimensions.width <= 0 || dimensions.height <= 0) return {
194
164
  x: 0,
195
165
  y: 0
196
166
  };
197
- return require_utils_svgFloatingContentUtils.getArrowClampDelta({
167
+ return require_components_client_Tooltip_util.getArrowClampDelta({
198
168
  width: dimensions.width,
199
169
  height: dimensions.height,
200
170
  placement: effectivePlacement,
201
171
  borderRadius,
202
- arrowCenter,
203
- arrowWidth
172
+ arrowCenter
204
173
  });
205
174
  }, [
206
- hideArrow,
207
175
  arrowCenter,
208
176
  dimensions.width,
209
177
  dimensions.height,
210
178
  effectivePlacement,
211
- borderRadius,
212
- arrowWidth
179
+ borderRadius
213
180
  ]),
214
181
  onPositionUpdate
215
182
  };
216
183
  }
217
184
 
218
185
  //#endregion
219
- exports.useSvgFloatingContent = useSvgFloatingContent;
186
+ exports.useTooltipContent = useTooltipContent;
@@ -0,0 +1,66 @@
1
+
2
+ import { ParsedShadow } from "./util.cjs";
3
+ import { CSSProperties, RefObject } from "react";
4
+
5
+ //#region src/components/client/Tooltip/useTooltipContent.d.ts
6
+ interface UseTooltipContentOptions {
7
+ /** Whether the tooltip is currently open. */
8
+ open: boolean;
9
+ /** Resolved placement after Ariakit positioning (e.g. `'top'`, `'bottom-start'`). */
10
+ effectivePlacement: string;
11
+ /** Optional max-width override (number = px, string = CSS value). */
12
+ maxWidth?: number | string;
13
+ /** Border-radius from the tooltip config (px). */
14
+ borderRadius: number;
15
+ /**
16
+ * Ref to the Ariakit `TooltipArrow` element. Its position (set by
17
+ * floating-ui) is read inside the `updatePosition` callback so the
18
+ * SVG arrow always mirrors where floating-ui places the native arrow.
19
+ */
20
+ arrowRef: RefObject<HTMLDivElement | null>;
21
+ /** Animation duration from the tooltip config (ms). */
22
+ animationDuration: number;
23
+ }
24
+ interface UseTooltipContentReturn {
25
+ internalRef: RefObject<HTMLElement | null>;
26
+ shadowFilterId: string;
27
+ maxWidthClass: string;
28
+ dimensions: {
29
+ width: number;
30
+ height: number;
31
+ };
32
+ shadows: ParsedShadow[];
33
+ shadowPadding: number;
34
+ svgPath: string | null;
35
+ blurClipPath: string | null;
36
+ blurStyle: CSSProperties;
37
+ visible: boolean;
38
+ childTransitionStyle: CSSProperties;
39
+ /**
40
+ * Pixel offset to apply as a CSS transform on the tooltip element so that
41
+ * the (clamped) SVG arrow aligns with the trigger center even when the
42
+ * trigger is too small / close to a rounded corner for the arrow to reach.
43
+ */
44
+ tooltipShift: {
45
+ x: number;
46
+ y: number;
47
+ };
48
+ /**
49
+ * Pass as the `updatePosition` prop to the Ariakit `<Tooltip>` component.
50
+ * This hooks into floating-ui's positioning lifecycle so the SVG arrow
51
+ * center is read after every `computePosition`
52
+ */
53
+ onPositionUpdate: (props: {
54
+ updatePosition: () => Promise<void>;
55
+ }) => Promise<void>;
56
+ }
57
+ declare function useTooltipContent({
58
+ open,
59
+ effectivePlacement,
60
+ maxWidth,
61
+ borderRadius,
62
+ arrowRef,
63
+ animationDuration
64
+ }: UseTooltipContentOptions): UseTooltipContentReturn;
65
+ //#endregion
66
+ export { type UseTooltipContentOptions, type UseTooltipContentReturn, useTooltipContent };
@@ -0,0 +1,66 @@
1
+
2
+ import { ParsedShadow } from "./util.js";
3
+ import { CSSProperties, RefObject } from "react";
4
+
5
+ //#region src/components/client/Tooltip/useTooltipContent.d.ts
6
+ interface UseTooltipContentOptions {
7
+ /** Whether the tooltip is currently open. */
8
+ open: boolean;
9
+ /** Resolved placement after Ariakit positioning (e.g. `'top'`, `'bottom-start'`). */
10
+ effectivePlacement: string;
11
+ /** Optional max-width override (number = px, string = CSS value). */
12
+ maxWidth?: number | string;
13
+ /** Border-radius from the tooltip config (px). */
14
+ borderRadius: number;
15
+ /**
16
+ * Ref to the Ariakit `TooltipArrow` element. Its position (set by
17
+ * floating-ui) is read inside the `updatePosition` callback so the
18
+ * SVG arrow always mirrors where floating-ui places the native arrow.
19
+ */
20
+ arrowRef: RefObject<HTMLDivElement | null>;
21
+ /** Animation duration from the tooltip config (ms). */
22
+ animationDuration: number;
23
+ }
24
+ interface UseTooltipContentReturn {
25
+ internalRef: RefObject<HTMLElement | null>;
26
+ shadowFilterId: string;
27
+ maxWidthClass: string;
28
+ dimensions: {
29
+ width: number;
30
+ height: number;
31
+ };
32
+ shadows: ParsedShadow[];
33
+ shadowPadding: number;
34
+ svgPath: string | null;
35
+ blurClipPath: string | null;
36
+ blurStyle: CSSProperties;
37
+ visible: boolean;
38
+ childTransitionStyle: CSSProperties;
39
+ /**
40
+ * Pixel offset to apply as a CSS transform on the tooltip element so that
41
+ * the (clamped) SVG arrow aligns with the trigger center even when the
42
+ * trigger is too small / close to a rounded corner for the arrow to reach.
43
+ */
44
+ tooltipShift: {
45
+ x: number;
46
+ y: number;
47
+ };
48
+ /**
49
+ * Pass as the `updatePosition` prop to the Ariakit `<Tooltip>` component.
50
+ * This hooks into floating-ui's positioning lifecycle so the SVG arrow
51
+ * center is read after every `computePosition`
52
+ */
53
+ onPositionUpdate: (props: {
54
+ updatePosition: () => Promise<void>;
55
+ }) => Promise<void>;
56
+ }
57
+ declare function useTooltipContent({
58
+ open,
59
+ effectivePlacement,
60
+ maxWidth,
61
+ borderRadius,
62
+ arrowRef,
63
+ animationDuration
64
+ }: UseTooltipContentOptions): UseTooltipContentReturn;
65
+ //#endregion
66
+ export { type UseTooltipContentOptions, type UseTooltipContentReturn, useTooltipContent };