@trackunit/react-components 8.0.5 → 8.0.8

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/index.cjs.js CHANGED
@@ -765,7 +765,83 @@ const useHoverScrollGuard = ({ enabled, hoverEnabled, openSiblingPinned, isOpen,
765
765
  return enabled && isHoverScrollSuppressed;
766
766
  };
767
767
 
768
- const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true };
768
+ /**
769
+ * `useFocus` treats `:focus-visible` as keyboard focus. jsdom reports that for every focus, and a
770
+ * programmatic `focus()` would otherwise open the popover and consume the next Escape. A key press
771
+ * is the signal we keep.
772
+ *
773
+ * One shared listener pair for every popover that opts into focus activation. A per-instance
774
+ * listener would add a capture-phase `keydown` and `pointerdown` handler, plus a timer, for every
775
+ * tooltip on the page.
776
+ */
777
+ let keyboardFocus = false;
778
+ let subscribers = 0;
779
+ let outerFrame = 0;
780
+ let innerFrame = 0;
781
+ const cancelClear = () => {
782
+ if (outerFrame !== 0) {
783
+ cancelAnimationFrame(outerFrame);
784
+ outerFrame = 0;
785
+ }
786
+ if (innerFrame !== 0) {
787
+ cancelAnimationFrame(innerFrame);
788
+ innerFrame = 0;
789
+ }
790
+ };
791
+ const clearKeyboardFocus = () => {
792
+ keyboardFocus = false;
793
+ cancelClear();
794
+ };
795
+ const markKeyboardFocus = (event) => {
796
+ // Escape closes a menu or dialog, which hands focus back to its trigger. That return is not
797
+ // navigation, so it must not open the trigger's tooltip.
798
+ if (event.key === "Escape") {
799
+ clearKeyboardFocus();
800
+ return;
801
+ }
802
+ keyboardFocus = true;
803
+ cancelClear();
804
+ // Tab moves focus in this key's default action, before either frame below. Menu navigation
805
+ // focuses the next item from Floating UI's requestAnimationFrame, which is later than a 0ms
806
+ // timeout, so the flag has to survive that frame. The frame after clears it: a programmatic
807
+ // focus() that was not caused by this key must not open a tooltip or take the next Escape.
808
+ outerFrame = requestAnimationFrame(() => {
809
+ outerFrame = 0;
810
+ innerFrame = requestAnimationFrame(() => {
811
+ keyboardFocus = false;
812
+ innerFrame = 0;
813
+ });
814
+ });
815
+ };
816
+ /**
817
+ * Installs the shared listeners on the first subscriber and removes them when the last one leaves.
818
+ *
819
+ * @returns {() => void} Unsubscribes this caller.
820
+ */
821
+ const subscribeToKeyboardFocus = () => {
822
+ if (subscribers === 0) {
823
+ window.addEventListener("keydown", markKeyboardFocus, true);
824
+ window.addEventListener("pointerdown", clearKeyboardFocus, true);
825
+ }
826
+ subscribers += 1;
827
+ return () => {
828
+ subscribers -= 1;
829
+ if (subscribers === 0) {
830
+ window.removeEventListener("keydown", markKeyboardFocus, true);
831
+ window.removeEventListener("pointerdown", clearKeyboardFocus, true);
832
+ clearKeyboardFocus();
833
+ }
834
+ };
835
+ };
836
+ /**
837
+ * Whether the most recent input was a key press that should count as keyboard focus.
838
+ *
839
+ * @returns {boolean} True until the key's focus change has been handled, including one scheduled for the
840
+ * next frame, or a pointer press or Escape clears it.
841
+ */
842
+ const isKeyboardFocus = () => keyboardFocus;
843
+
844
+ const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true, focus: false };
769
845
  const DEFAULT_DISMISSAL = {
770
846
  enabled: true,
771
847
  outsidePress: true,
@@ -838,7 +914,7 @@ const getNestedVerticalAlignmentAxis = ({ rects }) => {
838
914
  * @param {PopoverProps} options The options for the popover
839
915
  * @returns {UsePopoverType} The data for the popover
840
916
  */
841
- const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", id, className, "data-testid": dataTestId, }) => {
917
+ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", roleEnabled = true, id, className, "data-testid": dataTestId, }) => {
842
918
  const [uncontrolledIsOpen, setUncontrolledIsOpen] = react.useState(initialOpen);
843
919
  const [labelId, setLabelId] = react.useState();
844
920
  const [descriptionId, setDescriptionId] = react.useState();
@@ -949,6 +1025,9 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
949
1025
  placement,
950
1026
  open: isOpen,
951
1027
  onOpenChange: (open, _event, reason) => {
1028
+ if (open && reason === "focus" && !isKeyboardFocus()) {
1029
+ return;
1030
+ }
952
1031
  setUncontrolledIsOpen(open);
953
1032
  onOpenStateChange?.(open);
954
1033
  // Reset to `undefined` on close (regardless of *how* it closed) rather than keeping the close
@@ -979,8 +1058,15 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
979
1058
  }, [isOpen, popoverData.update]);
980
1059
  const popoverContext = popoverData.context;
981
1060
  const resolvedActivation = typeof activation === "function" ? activation(DEFAULT_ACTIVATION) : activation;
1061
+ const focusEnabled = resolvedActivation.focus === true;
1062
+ react.useEffect(() => {
1063
+ if (!focusEnabled) {
1064
+ return;
1065
+ }
1066
+ return subscribeToKeyboardFocus();
1067
+ }, [focusEnabled]);
982
1068
  const resolvedDismissal = typeof dismissal === "function" ? dismissal(DEFAULT_DISMISSAL) : dismissal;
983
- const { outsidePress: configuredOutsidePress, ...restDismissal } = resolvedDismissal;
1069
+ const { outsidePress: configuredOutsidePress, bubbles: configuredBubbles, ...restDismissal } = resolvedDismissal;
984
1070
  const clickInteraction = react$1.useClick(popoverContext, {
985
1071
  enabled: resolvedActivation.click,
986
1072
  keyboardHandlers: resolvedActivation.keyboardHandlers,
@@ -1012,10 +1098,21 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
1012
1098
  }
1013
1099
  return true;
1014
1100
  },
1015
- // Nested in a MenuTree: Escape closes one level at a time (doesn't bubble to ancestors).
1016
- // Outside-press bubbles only when the press is genuinely outside the tree; sibling-row
1017
- // presses are filtered above so they don't collapse the root menu.
1018
- bubbles: isInsideMenuTree ? { escapeKey: false, outsidePress: true } : undefined,
1101
+ // Nested in a MenuTree: Escape closes one level at a time unless the caller opts out.
1102
+ // Tooltips do: a hint must not swallow the Escape that dismisses the menu. Outside-press
1103
+ // bubbles only when the press is genuinely outside the tree; sibling-row presses are filtered
1104
+ // above so they don't collapse the root menu.
1105
+ // Other popovers keep Floating UI's default (Escape does not bubble) unless the caller asks
1106
+ // otherwise.
1107
+ bubbles: isInsideMenuTree
1108
+ ? {
1109
+ escapeKey: false,
1110
+ outsidePress: true,
1111
+ ...(typeof configuredBubbles === "boolean"
1112
+ ? { escapeKey: configuredBubbles, outsidePress: configuredBubbles }
1113
+ : configuredBubbles),
1114
+ }
1115
+ : configuredBubbles,
1019
1116
  });
1020
1117
  const hoverOptions = typeof resolvedActivation.hover === "object" ? resolvedActivation.hover : undefined;
1021
1118
  const hoverEnabled = hoverOptions ? (hoverOptions.active ?? true) : resolvedActivation.hover === true;
@@ -1091,6 +1188,12 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
1091
1188
  popoverContext,
1092
1189
  referenceRef: popoverData.refs.reference,
1093
1190
  });
1191
+ const focusInteraction = react$1.useFocus(popoverContext, {
1192
+ // `visibleOnly` keeps pointer focus from opening the popover. Keyboard focus still matches
1193
+ // `:focus-visible`.
1194
+ enabled: focusEnabled,
1195
+ visibleOnly: true,
1196
+ });
1094
1197
  const hoverInteraction = react$1.useHover(popoverContext, {
1095
1198
  enabled: hoverEnabled && !openSiblingPinned && !isHoverScrollSuppressed,
1096
1199
  delay: isHoverDelayed && !hasOpenSibling ? { open: 400 } : undefined,
@@ -1121,9 +1224,7 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
1121
1224
  ? react$1.safePolygon({ blockPointerEvents: isInsideMenuTree })
1122
1225
  : undefined,
1123
1226
  });
1124
- const focusEnabled = resolvedActivation.focus === true;
1125
- const focusInteraction = react$1.useFocus(popoverContext, { enabled: focusEnabled });
1126
- const roleInteraction = react$1.useRole(popoverContext, { role });
1227
+ const roleInteraction = react$1.useRole(popoverContext, { enabled: roleEnabled, role });
1127
1228
  // Distinguishes a genuine open -> close transition from this node simply mounting closed (the
1128
1229
  // common case: every unrelated sibling elsewhere in the tree mounts with `isOpen === false`).
1129
1230
  // Without this, that initial "closed" render would emit `MENU_TREE_CLOSE_EVENT` regardless, and
@@ -1381,14 +1482,14 @@ const withVisibilityCheck = (sourceRef) => ({
1381
1482
  * @param {PopoverContentProps} props - The props for the PopoverContent component
1382
1483
  * @returns {ReactElement} The popover content element
1383
1484
  */
1384
- const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, ref: propRef, ...props }) {
1485
+ const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, guards = true, ref: propRef, ...props }) {
1385
1486
  const { context: floatingContext, customProps, ...context } = usePopoverContext();
1386
1487
  const ref = react$1.useMergeRefs([context.refs.setFloating, propRef]);
1387
1488
  // Only a ref-based `returnFocus` has a concrete target to check -- the `boolean` case defers to
1388
1489
  // Floating UI's own app-wide "previously focused element" tracking, which isn't exposed here to
1389
1490
  // check against.
1390
1491
  const resolvedReturnFocus = typeof returnFocus === "boolean" ? returnFocus : withVisibilityCheck(returnFocus);
1391
- return (jsxRuntime.jsx(react$1.FloatingPortal, { id: portalId, root: document.body, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards: true, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: resolvedReturnFocus, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
1492
+ return (jsxRuntime.jsx(react$1.FloatingPortal, { id: portalId, preserveTabOrder: guards, root: document.body, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards: guards, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: resolvedReturnFocus, children: jsxRuntime.jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
1392
1493
  position: context.strategy,
1393
1494
  top: context.y,
1394
1495
  left: context.x,
@@ -2102,12 +2203,21 @@ const Text = ({ children, type = "p", size = "medium", align = "left", weight =
2102
2203
  };
2103
2204
  Text.displayName = "Text";
2104
2205
 
2206
+ const cvaTooltipTrigger = cssClassVarianceUtilities.cva({
2207
+ base: ["group", "inline-flex", "cursor-pointer", "border-0", "bg-transparent", "p-0"],
2208
+ });
2105
2209
  const cvaTooltipIcon = cssClassVarianceUtilities.cva({
2106
- base: ["text-neutral-300", "transition", "hover:cursor-pointer", "hover:text-neutral-400"],
2210
+ base: [
2211
+ "text-neutral-300",
2212
+ "transition",
2213
+ "hover:cursor-pointer",
2214
+ "hover:text-neutral-400",
2215
+ "group-focus-visible:text-neutral-400",
2216
+ ],
2107
2217
  variants: {
2108
2218
  color: {
2109
- light: "hover:text-white",
2110
- dark: "hover:text-neutral-400",
2219
+ light: ["hover:text-white", "group-focus-visible:text-white"],
2220
+ dark: ["hover:text-neutral-400", "group-focus-visible:text-neutral-400"],
2111
2221
  },
2112
2222
  defaultVariants: {
2113
2223
  color: "dark",
@@ -2165,7 +2275,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
2165
2275
  return (jsxRuntime.jsx(react$1.FloatingArrow, { className: cvaTooltipPopoverTail({ mode, placement: floatingContext.placement }), context: floatingContext, ref: arrowRef }));
2166
2276
  };
2167
2277
  /**
2168
- * Tooltips display additional information upon hover. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
2278
+ * Tooltips display additional information upon hover, and on keyboard focus with `openOnFocus`. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
2169
2279
  *
2170
2280
  * Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
2171
2281
  *
@@ -2222,8 +2332,11 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
2222
2332
  setIsOpen(false);
2223
2333
  }
2224
2334
  // A label that repeats the trigger's accessible name would be read twice as its description.
2225
- const labelIsTriggerName = react.isValidElement(children) &&
2226
- (children.props.ariaLabel === label || children.props["aria-label"] === label);
2335
+ // The default icon trigger is always named with the label.
2336
+ const labelIsTriggerName = children === undefined ||
2337
+ (react.isValidElement(children) &&
2338
+ (children.props.ariaLabel === label || children.props["aria-label"] === label));
2339
+ const { className: iconClassName, ...restIconProps } = iconProps ?? {};
2227
2340
  const arrowRef = react.useRef(null);
2228
2341
  const { refs, floatingStyles, context } = react$1.useFloating({
2229
2342
  placement: placement === "auto" ? "bottom" : placement,
@@ -2246,7 +2359,8 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
2246
2359
  const wrappedChildren = react.useMemo(() => {
2247
2360
  return jsxRuntime.jsx(reactSlot.Slot, { children: children });
2248
2361
  }, [children]);
2249
- return (jsxRuntime.jsxs(Popover, { activation: { click: false, hover: { delayed, interactable }, focus: openOnFocus }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, role: openOnFocus ? (labelIsTriggerName ? "label" : "tooltip") : undefined, children: [jsxRuntime.jsx(PopoverTrigger, { ...rest, "data-testid": dataTestId ? `${dataTestId}-trigger` : null, ref: mergedRef, style: style, children: children === undefined ? (jsxRuntime.jsx(Icon, { className: cvaTooltipIcon({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps })) : (wrappedChildren) }), tooltipSuppressed || !isMounted ? null : (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { initialFocus: -1, returnFocus: false, children: jsxRuntime.jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, onClick: e => e.stopPropagation(), onDoubleClick: e => e.stopPropagation(), onMouseDown: e => e.stopPropagation(), onPointerDown: e => e.stopPropagation(), children: [jsxRuntime.jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-text` : undefined, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) }))] }));
2362
+ // Escape closes the hint and continues upward, so a menu or the assistant panel still hears it.
2363
+ return (jsxRuntime.jsxs(Popover, { activation: { click: false, hover: { delayed, interactable }, focus: openOnFocus && !tooltipSuppressed }, className: cvaTooltipPopover(), "data-testid": dataTestId, dismissal: { bubbles: { escapeKey: true } }, id: id, isOpen: tooltipSuppressed ? false : isOpen, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, role: openOnFocus ? (labelIsTriggerName ? "label" : "tooltip") : undefined, roleEnabled: !tooltipSuppressed, children: [jsxRuntime.jsx(PopoverTrigger, { ...rest, "data-testid": dataTestId ? `${dataTestId}-trigger` : null, ref: mergedRef, style: style, children: children !== undefined ? (wrappedChildren) : openOnFocus ? (jsxRuntime.jsxs("button", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipTrigger(), disabled: disabled, type: "button", children: [typeof label === "string" ? null : jsxRuntime.jsx("span", { className: "sr-only", children: label }), jsxRuntime.jsx(Icon, { "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...restIconProps, ariaHidden: true, className: cvaTooltipIcon({ className: iconClassName, color: mode }) })] })) : (jsxRuntime.jsx(Icon, { className: cvaTooltipIcon({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps })) }), tooltipSuppressed || !isMounted ? null : (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { guards: !openOnFocus, initialFocus: -1, returnFocus: false, children: jsxRuntime.jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, onClick: e => e.stopPropagation(), onDoubleClick: e => e.stopPropagation(), onMouseDown: e => e.stopPropagation(), onPointerDown: e => e.stopPropagation(), children: [jsxRuntime.jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-text` : undefined, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsxRuntime.jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) }))] }));
2250
2364
  };
2251
2365
 
2252
2366
  /**
package/index.esm.js CHANGED
@@ -12,7 +12,7 @@ import IconSpriteOutline from '@trackunit/ui-icons/icons-sprite-outline.svg';
12
12
  import IconSpriteSolid from '@trackunit/ui-icons/icons-sprite-solid.svg';
13
13
  import { snakeCase, titleCase } from 'string-ts';
14
14
  import { cva } from '@trackunit/css-class-variance-utilities';
15
- import { FloatingTree, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, offset, flip, shift, size, useFloating, autoUpdate, useClick, useDismiss, useHover as useHover$1, safePolygon, useFocus, useRole, useInteractions, FloatingNode, useMergeRefs as useMergeRefs$1, FloatingPortal, FloatingFocusManager, arrow, useTransitionStatus, FloatingArrow, useListNavigation, useTypeahead, FloatingList, useListItem } from '@floating-ui/react';
15
+ import { FloatingTree, useFloatingNodeId, useFloatingParentNodeId, useFloatingTree, offset, flip, shift, size, useFloating, autoUpdate, useClick, useDismiss, useFocus, useHover as useHover$1, safePolygon, useRole, useInteractions, FloatingNode, useMergeRefs as useMergeRefs$1, FloatingPortal, FloatingFocusManager, arrow, useTransitionStatus, FloatingArrow, useListNavigation, useTypeahead, FloatingList, useListItem } from '@floating-ui/react';
16
16
  import { Slot, Slottable } from '@radix-ui/react-slot';
17
17
  import { omit, isEqual } from 'es-toolkit';
18
18
  import { Link, useBlocker } from '@tanstack/react-router';
@@ -764,7 +764,83 @@ const useHoverScrollGuard = ({ enabled, hoverEnabled, openSiblingPinned, isOpen,
764
764
  return enabled && isHoverScrollSuppressed;
765
765
  };
766
766
 
767
- const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true };
767
+ /**
768
+ * `useFocus` treats `:focus-visible` as keyboard focus. jsdom reports that for every focus, and a
769
+ * programmatic `focus()` would otherwise open the popover and consume the next Escape. A key press
770
+ * is the signal we keep.
771
+ *
772
+ * One shared listener pair for every popover that opts into focus activation. A per-instance
773
+ * listener would add a capture-phase `keydown` and `pointerdown` handler, plus a timer, for every
774
+ * tooltip on the page.
775
+ */
776
+ let keyboardFocus = false;
777
+ let subscribers = 0;
778
+ let outerFrame = 0;
779
+ let innerFrame = 0;
780
+ const cancelClear = () => {
781
+ if (outerFrame !== 0) {
782
+ cancelAnimationFrame(outerFrame);
783
+ outerFrame = 0;
784
+ }
785
+ if (innerFrame !== 0) {
786
+ cancelAnimationFrame(innerFrame);
787
+ innerFrame = 0;
788
+ }
789
+ };
790
+ const clearKeyboardFocus = () => {
791
+ keyboardFocus = false;
792
+ cancelClear();
793
+ };
794
+ const markKeyboardFocus = (event) => {
795
+ // Escape closes a menu or dialog, which hands focus back to its trigger. That return is not
796
+ // navigation, so it must not open the trigger's tooltip.
797
+ if (event.key === "Escape") {
798
+ clearKeyboardFocus();
799
+ return;
800
+ }
801
+ keyboardFocus = true;
802
+ cancelClear();
803
+ // Tab moves focus in this key's default action, before either frame below. Menu navigation
804
+ // focuses the next item from Floating UI's requestAnimationFrame, which is later than a 0ms
805
+ // timeout, so the flag has to survive that frame. The frame after clears it: a programmatic
806
+ // focus() that was not caused by this key must not open a tooltip or take the next Escape.
807
+ outerFrame = requestAnimationFrame(() => {
808
+ outerFrame = 0;
809
+ innerFrame = requestAnimationFrame(() => {
810
+ keyboardFocus = false;
811
+ innerFrame = 0;
812
+ });
813
+ });
814
+ };
815
+ /**
816
+ * Installs the shared listeners on the first subscriber and removes them when the last one leaves.
817
+ *
818
+ * @returns {() => void} Unsubscribes this caller.
819
+ */
820
+ const subscribeToKeyboardFocus = () => {
821
+ if (subscribers === 0) {
822
+ window.addEventListener("keydown", markKeyboardFocus, true);
823
+ window.addEventListener("pointerdown", clearKeyboardFocus, true);
824
+ }
825
+ subscribers += 1;
826
+ return () => {
827
+ subscribers -= 1;
828
+ if (subscribers === 0) {
829
+ window.removeEventListener("keydown", markKeyboardFocus, true);
830
+ window.removeEventListener("pointerdown", clearKeyboardFocus, true);
831
+ clearKeyboardFocus();
832
+ }
833
+ };
834
+ };
835
+ /**
836
+ * Whether the most recent input was a key press that should count as keyboard focus.
837
+ *
838
+ * @returns {boolean} True until the key's focus change has been handled, including one scheduled for the
839
+ * next frame, or a pointer press or Escape clears it.
840
+ */
841
+ const isKeyboardFocus = () => keyboardFocus;
842
+
843
+ const DEFAULT_ACTIVATION = { click: true, hover: false, keyboardHandlers: true, focus: false };
768
844
  const DEFAULT_DISMISSAL = {
769
845
  enabled: true,
770
846
  outsidePress: true,
@@ -837,7 +913,7 @@ const getNestedVerticalAlignmentAxis = ({ rects }) => {
837
913
  * @param {PopoverProps} options The options for the popover
838
914
  * @returns {UsePopoverType} The data for the popover
839
915
  */
840
- const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", id, className, "data-testid": dataTestId, }) => {
916
+ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen: controlledIsOpen, activation = DEFAULT_ACTIVATION, dismissal = DEFAULT_DISMISSAL, sizing = DEFAULT_SIZING, onOpenStateChange, role = "dialog", roleEnabled = true, id, className, "data-testid": dataTestId, }) => {
841
917
  const [uncontrolledIsOpen, setUncontrolledIsOpen] = useState(initialOpen);
842
918
  const [labelId, setLabelId] = useState();
843
919
  const [descriptionId, setDescriptionId] = useState();
@@ -948,6 +1024,9 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
948
1024
  placement,
949
1025
  open: isOpen,
950
1026
  onOpenChange: (open, _event, reason) => {
1027
+ if (open && reason === "focus" && !isKeyboardFocus()) {
1028
+ return;
1029
+ }
951
1030
  setUncontrolledIsOpen(open);
952
1031
  onOpenStateChange?.(open);
953
1032
  // Reset to `undefined` on close (regardless of *how* it closed) rather than keeping the close
@@ -978,8 +1057,15 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
978
1057
  }, [isOpen, popoverData.update]);
979
1058
  const popoverContext = popoverData.context;
980
1059
  const resolvedActivation = typeof activation === "function" ? activation(DEFAULT_ACTIVATION) : activation;
1060
+ const focusEnabled = resolvedActivation.focus === true;
1061
+ useEffect(() => {
1062
+ if (!focusEnabled) {
1063
+ return;
1064
+ }
1065
+ return subscribeToKeyboardFocus();
1066
+ }, [focusEnabled]);
981
1067
  const resolvedDismissal = typeof dismissal === "function" ? dismissal(DEFAULT_DISMISSAL) : dismissal;
982
- const { outsidePress: configuredOutsidePress, ...restDismissal } = resolvedDismissal;
1068
+ const { outsidePress: configuredOutsidePress, bubbles: configuredBubbles, ...restDismissal } = resolvedDismissal;
983
1069
  const clickInteraction = useClick(popoverContext, {
984
1070
  enabled: resolvedActivation.click,
985
1071
  keyboardHandlers: resolvedActivation.keyboardHandlers,
@@ -1011,10 +1097,21 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
1011
1097
  }
1012
1098
  return true;
1013
1099
  },
1014
- // Nested in a MenuTree: Escape closes one level at a time (doesn't bubble to ancestors).
1015
- // Outside-press bubbles only when the press is genuinely outside the tree; sibling-row
1016
- // presses are filtered above so they don't collapse the root menu.
1017
- bubbles: isInsideMenuTree ? { escapeKey: false, outsidePress: true } : undefined,
1100
+ // Nested in a MenuTree: Escape closes one level at a time unless the caller opts out.
1101
+ // Tooltips do: a hint must not swallow the Escape that dismisses the menu. Outside-press
1102
+ // bubbles only when the press is genuinely outside the tree; sibling-row presses are filtered
1103
+ // above so they don't collapse the root menu.
1104
+ // Other popovers keep Floating UI's default (Escape does not bubble) unless the caller asks
1105
+ // otherwise.
1106
+ bubbles: isInsideMenuTree
1107
+ ? {
1108
+ escapeKey: false,
1109
+ outsidePress: true,
1110
+ ...(typeof configuredBubbles === "boolean"
1111
+ ? { escapeKey: configuredBubbles, outsidePress: configuredBubbles }
1112
+ : configuredBubbles),
1113
+ }
1114
+ : configuredBubbles,
1018
1115
  });
1019
1116
  const hoverOptions = typeof resolvedActivation.hover === "object" ? resolvedActivation.hover : undefined;
1020
1117
  const hoverEnabled = hoverOptions ? (hoverOptions.active ?? true) : resolvedActivation.hover === true;
@@ -1090,6 +1187,12 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
1090
1187
  popoverContext,
1091
1188
  referenceRef: popoverData.refs.reference,
1092
1189
  });
1190
+ const focusInteraction = useFocus(popoverContext, {
1191
+ // `visibleOnly` keeps pointer focus from opening the popover. Keyboard focus still matches
1192
+ // `:focus-visible`.
1193
+ enabled: focusEnabled,
1194
+ visibleOnly: true,
1195
+ });
1093
1196
  const hoverInteraction = useHover$1(popoverContext, {
1094
1197
  enabled: hoverEnabled && !openSiblingPinned && !isHoverScrollSuppressed,
1095
1198
  delay: isHoverDelayed && !hasOpenSibling ? { open: 400 } : undefined,
@@ -1120,9 +1223,7 @@ const usePopover = ({ initialOpen = false, placement = "bottom", isModal, isOpen
1120
1223
  ? safePolygon({ blockPointerEvents: isInsideMenuTree })
1121
1224
  : undefined,
1122
1225
  });
1123
- const focusEnabled = resolvedActivation.focus === true;
1124
- const focusInteraction = useFocus(popoverContext, { enabled: focusEnabled });
1125
- const roleInteraction = useRole(popoverContext, { role });
1226
+ const roleInteraction = useRole(popoverContext, { enabled: roleEnabled, role });
1126
1227
  // Distinguishes a genuine open -> close transition from this node simply mounting closed (the
1127
1228
  // common case: every unrelated sibling elsewhere in the tree mounts with `isOpen === false`).
1128
1229
  // Without this, that initial "closed" render would emit `MENU_TREE_CLOSE_EVENT` regardless, and
@@ -1380,14 +1481,14 @@ const withVisibilityCheck = (sourceRef) => ({
1380
1481
  * @param {PopoverContentProps} props - The props for the PopoverContent component
1381
1482
  * @returns {ReactElement} The popover content element
1382
1483
  */
1383
- const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, ref: propRef, ...props }) {
1484
+ const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, guards = true, ref: propRef, ...props }) {
1384
1485
  const { context: floatingContext, customProps, ...context } = usePopoverContext();
1385
1486
  const ref = useMergeRefs$1([context.refs.setFloating, propRef]);
1386
1487
  // Only a ref-based `returnFocus` has a concrete target to check -- the `boolean` case defers to
1387
1488
  // Floating UI's own app-wide "previously focused element" tracking, which isn't exposed here to
1388
1489
  // check against.
1389
1490
  const resolvedReturnFocus = typeof returnFocus === "boolean" ? returnFocus : withVisibilityCheck(returnFocus);
1390
- return (jsx(FloatingPortal, { id: portalId, root: document.body, children: context.isOpen === true ? (jsx(FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards: true, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: resolvedReturnFocus, children: jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
1491
+ return (jsx(FloatingPortal, { id: portalId, preserveTabOrder: guards, root: document.body, children: context.isOpen === true ? (jsx(FloatingFocusManager, { closeOnFocusOut: context.closeOnFocusOut, context: floatingContext, guards: guards, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: resolvedReturnFocus, children: jsx("div", { "aria-describedby": context.descriptionId, "aria-labelledby": context.labelId, className: cvaPopoverContainer({ className: className ?? customProps.className }), "data-testid": dataTestId ?? customProps["data-testid"] ?? "popover-content", ref: ref, style: {
1391
1492
  position: context.strategy,
1392
1493
  top: context.y,
1393
1494
  left: context.x,
@@ -2101,12 +2202,21 @@ const Text = ({ children, type = "p", size = "medium", align = "left", weight =
2101
2202
  };
2102
2203
  Text.displayName = "Text";
2103
2204
 
2205
+ const cvaTooltipTrigger = cva({
2206
+ base: ["group", "inline-flex", "cursor-pointer", "border-0", "bg-transparent", "p-0"],
2207
+ });
2104
2208
  const cvaTooltipIcon = cva({
2105
- base: ["text-neutral-300", "transition", "hover:cursor-pointer", "hover:text-neutral-400"],
2209
+ base: [
2210
+ "text-neutral-300",
2211
+ "transition",
2212
+ "hover:cursor-pointer",
2213
+ "hover:text-neutral-400",
2214
+ "group-focus-visible:text-neutral-400",
2215
+ ],
2106
2216
  variants: {
2107
2217
  color: {
2108
- light: "hover:text-white",
2109
- dark: "hover:text-neutral-400",
2218
+ light: ["hover:text-white", "group-focus-visible:text-white"],
2219
+ dark: ["hover:text-neutral-400", "group-focus-visible:text-neutral-400"],
2110
2220
  },
2111
2221
  defaultVariants: {
2112
2222
  color: "dark",
@@ -2164,7 +2274,7 @@ const FloatingArrowContainer = ({ arrowRef, mode = "dark", }) => {
2164
2274
  return (jsx(FloatingArrow, { className: cvaTooltipPopoverTail({ mode, placement: floatingContext.placement }), context: floatingContext, ref: arrowRef }));
2165
2275
  };
2166
2276
  /**
2167
- * Tooltips display additional information upon hover. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
2277
+ * Tooltips display additional information upon hover, and on keyboard focus with `openOnFocus`. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
2168
2278
  *
2169
2279
  * Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
2170
2280
  *
@@ -2221,8 +2331,11 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
2221
2331
  setIsOpen(false);
2222
2332
  }
2223
2333
  // A label that repeats the trigger's accessible name would be read twice as its description.
2224
- const labelIsTriggerName = isValidElement(children) &&
2225
- (children.props.ariaLabel === label || children.props["aria-label"] === label);
2334
+ // The default icon trigger is always named with the label.
2335
+ const labelIsTriggerName = children === undefined ||
2336
+ (isValidElement(children) &&
2337
+ (children.props.ariaLabel === label || children.props["aria-label"] === label));
2338
+ const { className: iconClassName, ...restIconProps } = iconProps ?? {};
2226
2339
  const arrowRef = useRef(null);
2227
2340
  const { refs, floatingStyles, context } = useFloating({
2228
2341
  placement: placement === "auto" ? "bottom" : placement,
@@ -2245,7 +2358,8 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
2245
2358
  const wrappedChildren = useMemo(() => {
2246
2359
  return jsx(Slot, { children: children });
2247
2360
  }, [children]);
2248
- return (jsxs(Popover, { activation: { click: false, hover: { delayed, interactable }, focus: openOnFocus }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, role: openOnFocus ? (labelIsTriggerName ? "label" : "tooltip") : undefined, children: [jsx(PopoverTrigger, { ...rest, "data-testid": dataTestId ? `${dataTestId}-trigger` : null, ref: mergedRef, style: style, children: children === undefined ? (jsx(Icon, { className: cvaTooltipIcon({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps })) : (wrappedChildren) }), tooltipSuppressed || !isMounted ? null : (jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsx(PopoverContent, { initialFocus: -1, returnFocus: false, children: jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, onClick: e => e.stopPropagation(), onDoubleClick: e => e.stopPropagation(), onMouseDown: e => e.stopPropagation(), onPointerDown: e => e.stopPropagation(), children: [jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-text` : undefined, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) }))] }));
2361
+ // Escape closes the hint and continues upward, so a menu or the assistant panel still hears it.
2362
+ return (jsxs(Popover, { activation: { click: false, hover: { delayed, interactable }, focus: openOnFocus && !tooltipSuppressed }, className: cvaTooltipPopover(), "data-testid": dataTestId, dismissal: { bubbles: { escapeKey: true } }, id: id, isOpen: tooltipSuppressed ? false : isOpen, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, role: openOnFocus ? (labelIsTriggerName ? "label" : "tooltip") : undefined, roleEnabled: !tooltipSuppressed, children: [jsx(PopoverTrigger, { ...rest, "data-testid": dataTestId ? `${dataTestId}-trigger` : null, ref: mergedRef, style: style, children: children !== undefined ? (wrappedChildren) : openOnFocus ? (jsxs("button", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipTrigger(), disabled: disabled, type: "button", children: [typeof label === "string" ? null : jsx("span", { className: "sr-only", children: label }), jsx(Icon, { "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...restIconProps, ariaHidden: true, className: cvaTooltipIcon({ className: iconClassName, color: mode }) })] })) : (jsx(Icon, { className: cvaTooltipIcon({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-icon` : undefined, name: "QuestionMarkCircle", size: "small", ...iconProps })) }), tooltipSuppressed || !isMounted ? null : (jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsx(PopoverContent, { guards: !openOnFocus, initialFocus: -1, returnFocus: false, children: jsxs("div", { "aria-label": typeof label === "string" ? label : undefined, className: cvaTooltipPopoverContent({ color: mode }), "data-testid": dataTestId ? `${dataTestId}-content` : undefined, onClick: e => e.stopPropagation(), onDoubleClick: e => e.stopPropagation(), onMouseDown: e => e.stopPropagation(), onPointerDown: e => e.stopPropagation(), children: [jsx(Text, { "data-testid": dataTestId ? `${dataTestId}-text` : undefined, inverted: mode === "dark", size: "small", type: typeof label === "string" ? "p" : "span", children: label }), placement !== "auto" && jsx(FloatingArrowContainer, { arrowRef: arrowRef, mode: mode })] }) }) }))] }));
2249
2363
  };
2250
2364
 
2251
2365
  /**
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@trackunit/react-router-components",
3
- "version": "2.0.16",
3
+ "version": "2.0.20",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "@trackunit/css-class-variance-utilities": "^2.6.61",
11
- "@trackunit/i18n-library-translation": "^2.14.58",
12
- "@trackunit/react-components": "^8.0.5",
13
- "@trackunit/react-drawer": "^3.0.16",
14
- "@trackunit/shared-utils": "^1.22.61",
10
+ "@trackunit/css-class-variance-utilities": "^2.6.62",
11
+ "@trackunit/i18n-library-translation": "^2.14.59",
12
+ "@trackunit/react-components": "^8.0.8",
13
+ "@trackunit/react-drawer": "^3.0.20",
14
+ "@trackunit/shared-utils": "^1.22.62",
15
15
  "dequal": "^2.0.3",
16
16
  "zod": "^3.25.76"
17
17
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "8.0.5",
3
+ "version": "8.0.8",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "migrations": "./migrations.json",
@@ -14,15 +14,15 @@
14
14
  "@floating-ui/react": "^0.26.25",
15
15
  "string-ts": "^2.0.0",
16
16
  "tailwind-merge": "^3.7.0",
17
- "@trackunit/ui-design-tokens": "^1.21.58",
18
- "@trackunit/css-class-variance-utilities": "^2.6.61",
19
- "@trackunit/shared-utils": "^1.22.61",
20
- "@trackunit/ui-icons": "^1.20.58",
17
+ "@trackunit/ui-design-tokens": "^1.21.59",
18
+ "@trackunit/css-class-variance-utilities": "^2.6.62",
19
+ "@trackunit/shared-utils": "^1.22.62",
20
+ "@trackunit/ui-icons": "^1.20.59",
21
21
  "es-toolkit": "^1.52.0",
22
22
  "@tanstack/react-virtual": "^3.14.13",
23
23
  "fflate": "^0.8.3",
24
24
  "zod": "^3.25.76",
25
- "@trackunit/i18n-library-translation": "^2.14.58"
25
+ "@trackunit/i18n-library-translation": "^2.14.59"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "^19.0.0",
@@ -61,6 +61,15 @@ export interface PopoverContentProps extends Omit<HTMLProps<HTMLDivElement>, "ch
61
61
  * @default true
62
62
  */
63
63
  returnFocus?: boolean | MutableRefObject<HTMLElement | null>;
64
+ /**
65
+ * When false, the popover does not render Floating UI focus guards, including
66
+ * the portal's outside tab-order guards. Tooltips that open on focus set this so keyboard focus
67
+ * can move to the next control and the tooltip can close on blur. Menus and
68
+ * dialogs keep the default guards.
69
+ *
70
+ * @default true
71
+ */
72
+ guards?: boolean;
64
73
  /**
65
74
  * A ref for the component
66
75
  */
@@ -101,4 +110,4 @@ export interface PopoverContentProps extends Omit<HTMLProps<HTMLDivElement>, "ch
101
110
  * @param {PopoverContentProps} props - The props for the PopoverContent component
102
111
  * @returns {ReactElement} The popover content element
103
112
  */
104
- export declare const PopoverContent: ({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus, ref: propRef, ...props }: PopoverContentProps) => ReactElement;
113
+ export declare const PopoverContent: ({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus, guards, ref: propRef, ...props }: PopoverContentProps) => ReactElement;
@@ -26,14 +26,15 @@ export type PopoverActivation = {
26
26
  click?: boolean;
27
27
  hover?: boolean | PopoverHoverOptions;
28
28
  /**
29
- * Whether keyboard focus on the trigger opens the floating element. Pointer focus does not.
29
+ * Whether keyboard focus on the trigger, or an element inside it, opens the floating element.
30
+ * Pointer focus does not. Closes again on blur. Escape is handled by dismissal.
30
31
  *
31
32
  * @default false
32
33
  */
33
34
  focus?: boolean;
34
35
  keyboardHandlers?: boolean;
35
36
  };
36
- export type PopoverDismissal = Pick<UseDismissProps, "ancestorScroll" | "enabled" | "outsidePress">;
37
+ export type PopoverDismissal = Pick<UseDismissProps, "ancestorScroll" | "bubbles" | "enabled" | "outsidePress">;
37
38
  export type PopoverPlacement = "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "right-start" | "right-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end";
38
39
  export type Strategy = "absolute" | "fixed";
39
40
  export type HeightSizeLimit = number | "none";
@@ -88,6 +89,13 @@ export interface PopoverProps extends CommonProps {
88
89
  * @default "dialog"
89
90
  */
90
91
  role?: PopoverRole;
92
+ /**
93
+ * When false, the trigger does not expose popup ARIA attributes. Disabled tooltips use this so a
94
+ * trigger that stays mounted does not announce a popup that cannot open.
95
+ *
96
+ * @default true
97
+ */
98
+ roleEnabled?: boolean;
91
99
  /**
92
100
  * The id of the html element
93
101
  */
@@ -6,4 +6,4 @@ import { PopoverProps, UsePopoverType } from "./PopoverTypes";
6
6
  * @param {PopoverProps} options The options for the popover
7
7
  * @returns {UsePopoverType} The data for the popover
8
8
  */
9
- export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: controlledIsOpen, activation, dismissal, sizing, onOpenStateChange, role, id, className, "data-testid": dataTestId, }: PopoverProps) => UsePopoverType;
9
+ export declare const usePopover: ({ initialOpen, placement, isModal, isOpen: controlledIsOpen, activation, dismissal, sizing, onOpenStateChange, role, roleEnabled, id, className, "data-testid": dataTestId, }: PopoverProps) => UsePopoverType;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Installs the shared listeners on the first subscriber and removes them when the last one leaves.
3
+ *
4
+ * @returns {() => void} Unsubscribes this caller.
5
+ */
6
+ export declare const subscribeToKeyboardFocus: () => (() => void);
7
+ /**
8
+ * Whether the most recent input was a key press that should count as keyboard focus.
9
+ *
10
+ * @returns {boolean} True until the key's focus change has been handled, including one scheduled for the
11
+ * next frame, or a pointer press or Escape clears it.
12
+ */
13
+ export declare const isKeyboardFocus: () => boolean;
@@ -64,7 +64,7 @@ export interface TooltipProps extends Omit<CommonProps, "className">, Styleable,
64
64
  "data-state"?: "open" | "closed";
65
65
  }
66
66
  /**
67
- * Tooltips display additional information upon hover. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
67
+ * Tooltips display additional information upon hover, and on keyboard focus with `openOnFocus`. The information included should be contextual, helpful, and nonessential while providing that extra ability to communicate and give clarity to a user.
68
68
  *
69
69
  * Tooltips should be used sparingly and contain succinct, supplementary information, and they should contain read-only text. **❗️Do not include interactive elements in tooltips ** (no links, buttons, etc). Interactive elements in tooltips are inaccessible since tooltips do not receive focus.
70
70
  *
@@ -1,9 +1,15 @@
1
+ export declare const cvaTooltipTrigger: import("cva").CVAComponent<Omit<{
2
+ base: string[];
3
+ }, "defaultVariants"> & {
4
+ variants: unknown;
5
+ defaultVariants: Omit<{}, never>;
6
+ }, unknown>;
1
7
  export declare const cvaTooltipIcon: import("cva").CVAComponent<Omit<{
2
8
  base: string[];
3
9
  variants: {
4
10
  color: {
5
- light: string;
6
- dark: string;
11
+ light: string[];
12
+ dark: string[];
7
13
  };
8
14
  defaultVariants: {
9
15
  color: string;
@@ -12,8 +18,8 @@ export declare const cvaTooltipIcon: import("cva").CVAComponent<Omit<{
12
18
  }, "defaultVariants"> & {
13
19
  variants: {
14
20
  color: {
15
- light: string;
16
- dark: string;
21
+ light: string[];
22
+ dark: string[];
17
23
  };
18
24
  defaultVariants: {
19
25
  color: string;
@@ -22,8 +28,8 @@ export declare const cvaTooltipIcon: import("cva").CVAComponent<Omit<{
22
28
  defaultVariants: Omit<{}, never>;
23
29
  }, {
24
30
  color: {
25
- light: string;
26
- dark: string;
31
+ light: string[];
32
+ dark: string[];
27
33
  };
28
34
  defaultVariants: {
29
35
  color: string;
@@ -8,7 +8,7 @@ var translation = {
8
8
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
9
9
  "horizontalOverflowScroller.scrollRight": "Scroll right",
10
10
  "moreMenu.buttonLabel": "Mehr anzeigen",
11
- "spinner.loading": "Loading"
11
+ "spinner.loading": "Wird geladen"
12
12
  };
13
13
 
14
14
  exports.default = translation;
@@ -6,7 +6,7 @@ var translation = {
6
6
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
7
7
  "horizontalOverflowScroller.scrollRight": "Scroll right",
8
8
  "moreMenu.buttonLabel": "Mehr anzeigen",
9
- "spinner.loading": "Loading"
9
+ "spinner.loading": "Wird geladen"
10
10
  };
11
11
 
12
12
  export { translation as default };
@@ -8,7 +8,7 @@ var translation = {
8
8
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
9
9
  "horizontalOverflowScroller.scrollRight": "Scroll right",
10
10
  "moreMenu.buttonLabel": "Mostrar mais",
11
- "spinner.loading": "Loading"
11
+ "spinner.loading": "A carregar"
12
12
  };
13
13
 
14
14
  exports.default = translation;
@@ -6,7 +6,7 @@ var translation = {
6
6
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
7
7
  "horizontalOverflowScroller.scrollRight": "Scroll right",
8
8
  "moreMenu.buttonLabel": "Mostrar mais",
9
- "spinner.loading": "Loading"
9
+ "spinner.loading": "A carregar"
10
10
  };
11
11
 
12
12
  export { translation as default };
@@ -8,7 +8,7 @@ var translation = {
8
8
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
9
9
  "horizontalOverflowScroller.scrollRight": "Scroll right",
10
10
  "moreMenu.buttonLabel": "Показать больше",
11
- "spinner.loading": "Loading"
11
+ "spinner.loading": "Загрузка"
12
12
  };
13
13
 
14
14
  exports.default = translation;
@@ -6,7 +6,7 @@ var translation = {
6
6
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
7
7
  "horizontalOverflowScroller.scrollRight": "Scroll right",
8
8
  "moreMenu.buttonLabel": "Показать больше",
9
- "spinner.loading": "Loading"
9
+ "spinner.loading": "Загрузка"
10
10
  };
11
11
 
12
12
  export { translation as default };
@@ -8,7 +8,7 @@ var translation = {
8
8
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
9
9
  "horizontalOverflowScroller.scrollRight": "Scroll right",
10
10
  "moreMenu.buttonLabel": "Näytä lisää",
11
- "spinner.loading": "Loading"
11
+ "spinner.loading": "Lataa"
12
12
  };
13
13
 
14
14
  exports.default = translation;
@@ -6,7 +6,7 @@ var translation = {
6
6
  "horizontalOverflowScroller.scrollLeft": "Scroll left",
7
7
  "horizontalOverflowScroller.scrollRight": "Scroll right",
8
8
  "moreMenu.buttonLabel": "Näytä lisää",
9
- "spinner.loading": "Loading"
9
+ "spinner.loading": "Lataa"
10
10
  };
11
11
 
12
12
  export { translation as default };