@yahoo/uds 3.177.0 → 3.179.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.
@@ -48333,7 +48333,7 @@ const ToastConfig = {
48333
48333
  }
48334
48334
  };
48335
48335
  const TooltipConfig = {
48336
- description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.",
48336
+ description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.",
48337
48337
  label: "Tooltip",
48338
48338
  variants: {
48339
48339
  size: {
@@ -5300,7 +5300,7 @@ declare const ToastConfig: {
5300
5300
  };
5301
5301
  };
5302
5302
  declare const TooltipConfig: {
5303
- readonly description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.";
5303
+ readonly description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.";
5304
5304
  readonly label: "Tooltip";
5305
5305
  readonly variants: {
5306
5306
  readonly size: {
@@ -5300,7 +5300,7 @@ declare const ToastConfig: {
5300
5300
  };
5301
5301
  };
5302
5302
  declare const TooltipConfig: {
5303
- readonly description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.";
5303
+ readonly description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.";
5304
5304
  readonly label: "Tooltip";
5305
5305
  readonly variants: {
5306
5306
  readonly size: {
@@ -48333,7 +48333,7 @@ const ToastConfig = {
48333
48333
  }
48334
48334
  };
48335
48335
  const TooltipConfig = {
48336
- description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.",
48336
+ description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.",
48337
48337
  label: "Tooltip",
48338
48338
  variants: {
48339
48339
  size: {
@@ -24,7 +24,7 @@ declare function usePopoverConfig(sizeProp?: PopoverSize | undefined, variantPro
24
24
  gap: SpacingAlias;
25
25
  dismissButtonSpacing: SpacingAlias;
26
26
  dismissIconSize: number;
27
- ariaKitPlacement: ("bottom-start" | "bottom-end" | "top-start" | "top-end" | ("bottom" | "left" | "right" | "top") | "left-start" | "right-start" | "left-end" | "right-end") | undefined;
27
+ ariaKitPlacement: ("top-start" | "top-end" | "bottom-start" | "bottom-end" | ("top" | "bottom" | "left" | "right") | "left-start" | "right-start" | "left-end" | "right-end") | undefined;
28
28
  animationDuration: number;
29
29
  };
30
30
  //#endregion
@@ -25,7 +25,7 @@ declare function usePopoverConfig(sizeProp?: PopoverSize | undefined, variantPro
25
25
  gap: SpacingAlias;
26
26
  dismissButtonSpacing: SpacingAlias;
27
27
  dismissIconSize: number;
28
- ariaKitPlacement: ("bottom-start" | "bottom-end" | "top-start" | "top-end" | ("bottom" | "left" | "right" | "top") | "left-start" | "right-start" | "left-end" | "right-end") | undefined;
28
+ ariaKitPlacement: ("top-start" | "top-end" | "bottom-start" | "bottom-end" | ("top" | "bottom" | "left" | "right") | "left-start" | "right-start" | "left-end" | "right-end") | undefined;
29
29
  animationDuration: number;
30
30
  };
31
31
  //#endregion
@@ -12,7 +12,7 @@ let _ariakit_react = require("@ariakit/react");
12
12
  * @componentType Client component
13
13
  *
14
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.
15
+ * Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.
16
16
  *
17
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
18
  *
@@ -8,7 +8,7 @@ type TooltipProps = UniversalTooltipProps;
8
8
  * @componentType Client component
9
9
  *
10
10
  * @description
11
- * Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
11
+ * Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.
12
12
  *
13
13
  * Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
14
14
  *
@@ -9,7 +9,7 @@ type TooltipProps = UniversalTooltipProps;
9
9
  * @componentType Client component
10
10
  *
11
11
  * @description
12
- * Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.
12
+ * Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.
13
13
  *
14
14
  * Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
15
15
  *
@@ -11,7 +11,7 @@ import { TooltipProvider } from "@ariakit/react";
11
11
  * @componentType Client component
12
12
  *
13
13
  * @description
14
- * 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
+ * Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.
15
15
  *
16
16
  * Tooltips are not meant for critical information or required actions. If the user must take action, use a Dialog, Popover, or Inline messaging instead.
17
17
  *
@@ -1,14 +1,74 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  "use client";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const require_components_client_Tooltip_tooltipContext = require("./tooltipContext.cjs");
4
5
  let react = require("react");
5
6
  let react_jsx_runtime = require("react/jsx-runtime");
6
7
  let _ariakit_react = require("@ariakit/react");
7
8
  //#region src/components/client/Tooltip/TooltipTrigger.tsx
9
+ /**
10
+ * Touch devices (mobile browsers and in-app webviews) don't produce real hover
11
+ * or keyboard focus, so Ariakit's anchor never opens the tooltip from a tap.
12
+ * Track the pointer type of the last press and toggle the tooltip when a touch
13
+ * tap results in a click. A tap anywhere outside the trigger or the tooltip
14
+ * closes it again.
15
+ */
16
+ function useTouchToggle() {
17
+ const store = (0, _ariakit_react.useTooltipContext)();
18
+ const isControlled = (0, react.useContext)(require_components_client_Tooltip_tooltipContext.TooltipInternalContext)?.isControlled ?? false;
19
+ const open = (0, _ariakit_react.useStoreState)(store, "open");
20
+ const lastPointerTypeRef = (0, react.useRef)(null);
21
+ const openedByTouchRef = (0, react.useRef)(false);
22
+ (0, react.useEffect)(() => {
23
+ if (!open) {
24
+ openedByTouchRef.current = false;
25
+ return;
26
+ }
27
+ if (!store || isControlled || !openedByTouchRef.current) return;
28
+ const onPointerDownOutside = (event) => {
29
+ const target = event.target;
30
+ const { anchorElement, contentElement } = store.getState();
31
+ if (target && (anchorElement?.contains(target) || contentElement?.contains(target))) return;
32
+ store.hide();
33
+ };
34
+ document.addEventListener("pointerdown", onPointerDownOutside, true);
35
+ return () => document.removeEventListener("pointerdown", onPointerDownOutside, true);
36
+ }, [
37
+ open,
38
+ store,
39
+ isControlled
40
+ ]);
41
+ const onPointerDown = (event) => {
42
+ lastPointerTypeRef.current = event.pointerType;
43
+ if (event.pointerType === "touch" && store) store.setDisclosureElement(event.currentTarget);
44
+ };
45
+ const onClick = (event) => {
46
+ const pointerType = lastPointerTypeRef.current;
47
+ lastPointerTypeRef.current = null;
48
+ if (pointerType !== "touch" || !store || isControlled || event.defaultPrevented) return;
49
+ if (store.getState().open) {
50
+ store.hide();
51
+ return;
52
+ }
53
+ store.setAnchorElement(event.currentTarget);
54
+ store.setDisclosureElement(event.currentTarget);
55
+ openedByTouchRef.current = true;
56
+ store.show();
57
+ };
58
+ return {
59
+ onPointerDown,
60
+ onClick
61
+ };
62
+ }
8
63
  function TooltipTrigger({ children }) {
9
- if ((0, react.isValidElement)(children) && children.type !== react.Fragment) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipAnchor, { render: children });
64
+ const touchProps = useTouchToggle();
65
+ if ((0, react.isValidElement)(children) && children.type !== react.Fragment) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipAnchor, {
66
+ render: children,
67
+ ...touchProps
68
+ });
10
69
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ariakit_react.TooltipAnchor, {
11
70
  className: "inline",
71
+ ...touchProps,
12
72
  children
13
73
  });
14
74
  }
@@ -1,13 +1,73 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  "use client";
3
- import { Fragment, isValidElement } from "react";
3
+ import { TooltipInternalContext } from "./tooltipContext.js";
4
+ import { Fragment, isValidElement, useContext, useEffect, useRef } from "react";
4
5
  import { jsx } from "react/jsx-runtime";
5
- import { TooltipAnchor } from "@ariakit/react";
6
+ import { TooltipAnchor, useStoreState, useTooltipContext } from "@ariakit/react";
6
7
  //#region src/components/client/Tooltip/TooltipTrigger.tsx
8
+ /**
9
+ * Touch devices (mobile browsers and in-app webviews) don't produce real hover
10
+ * or keyboard focus, so Ariakit's anchor never opens the tooltip from a tap.
11
+ * Track the pointer type of the last press and toggle the tooltip when a touch
12
+ * tap results in a click. A tap anywhere outside the trigger or the tooltip
13
+ * closes it again.
14
+ */
15
+ function useTouchToggle() {
16
+ const store = useTooltipContext();
17
+ const isControlled = useContext(TooltipInternalContext)?.isControlled ?? false;
18
+ const open = useStoreState(store, "open");
19
+ const lastPointerTypeRef = useRef(null);
20
+ const openedByTouchRef = useRef(false);
21
+ useEffect(() => {
22
+ if (!open) {
23
+ openedByTouchRef.current = false;
24
+ return;
25
+ }
26
+ if (!store || isControlled || !openedByTouchRef.current) return;
27
+ const onPointerDownOutside = (event) => {
28
+ const target = event.target;
29
+ const { anchorElement, contentElement } = store.getState();
30
+ if (target && (anchorElement?.contains(target) || contentElement?.contains(target))) return;
31
+ store.hide();
32
+ };
33
+ document.addEventListener("pointerdown", onPointerDownOutside, true);
34
+ return () => document.removeEventListener("pointerdown", onPointerDownOutside, true);
35
+ }, [
36
+ open,
37
+ store,
38
+ isControlled
39
+ ]);
40
+ const onPointerDown = (event) => {
41
+ lastPointerTypeRef.current = event.pointerType;
42
+ if (event.pointerType === "touch" && store) store.setDisclosureElement(event.currentTarget);
43
+ };
44
+ const onClick = (event) => {
45
+ const pointerType = lastPointerTypeRef.current;
46
+ lastPointerTypeRef.current = null;
47
+ if (pointerType !== "touch" || !store || isControlled || event.defaultPrevented) return;
48
+ if (store.getState().open) {
49
+ store.hide();
50
+ return;
51
+ }
52
+ store.setAnchorElement(event.currentTarget);
53
+ store.setDisclosureElement(event.currentTarget);
54
+ openedByTouchRef.current = true;
55
+ store.show();
56
+ };
57
+ return {
58
+ onPointerDown,
59
+ onClick
60
+ };
61
+ }
7
62
  function TooltipTrigger({ children }) {
8
- if (isValidElement(children) && children.type !== Fragment) return /* @__PURE__ */ jsx(TooltipAnchor, { render: children });
63
+ const touchProps = useTouchToggle();
64
+ if (isValidElement(children) && children.type !== Fragment) return /* @__PURE__ */ jsx(TooltipAnchor, {
65
+ render: children,
66
+ ...touchProps
67
+ });
9
68
  return /* @__PURE__ */ jsx(TooltipAnchor, {
10
69
  className: "inline",
70
+ ...touchProps,
11
71
  children
12
72
  });
13
73
  }
@@ -48334,7 +48334,7 @@ const ToastConfig = {
48334
48334
  }
48335
48335
  };
48336
48336
  const TooltipConfig = {
48337
- description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.",
48337
+ description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.",
48338
48338
  label: "Tooltip",
48339
48339
  variants: {
48340
48340
  size: {
@@ -48334,7 +48334,7 @@ const ToastConfig = {
48334
48334
  }
48335
48335
  };
48336
48336
  const TooltipConfig = {
48337
- description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or long-press, and should clarify meaning—not introduce new concepts.",
48337
+ description: "Tooltips provide short, contextual help for UI elements. They appear on hover, focus, or tap, and should clarify meaning—not introduce new concepts.",
48338
48338
  label: "Tooltip",
48339
48339
  variants: {
48340
48340
  size: {