@trackunit/react-components 2.1.57 → 2.1.59
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 +3 -3
- package/index.esm.js +3 -3
- package/package.json +6 -6
- package/src/components/Popover/PopoverContent.d.ts +14 -1
package/index.cjs.js
CHANGED
|
@@ -607,10 +607,10 @@ const cvaPopoverTitleText = cssClassVarianceUtilities.cvaMerge(["flex-1", "text-
|
|
|
607
607
|
* @param {PopoverContentProps} props - The props for the PopoverContent component
|
|
608
608
|
* @returns {ReactElement} The popover content element
|
|
609
609
|
*/
|
|
610
|
-
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, ref: propRef, ...props }) {
|
|
610
|
+
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, ref: propRef, ...props }) {
|
|
611
611
|
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
612
612
|
const ref = react$1.useMergeRefs([context.refs.setFloating, propRef]);
|
|
613
|
-
return (jsxRuntime.jsx(Portal, { id: portalId, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus:
|
|
613
|
+
return (jsxRuntime.jsx(Portal, { id: portalId, children: context.isOpen === true ? (jsxRuntime.jsx(react$1.FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: returnFocus, 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: {
|
|
614
614
|
position: context.strategy,
|
|
615
615
|
top: context.y,
|
|
616
616
|
left: context.x,
|
|
@@ -1310,7 +1310,7 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
|
|
|
1310
1310
|
const wrappedChildren = react.useMemo(() => {
|
|
1311
1311
|
return jsxRuntime.jsx(reactSlot.Slot, { children: children });
|
|
1312
1312
|
}, [children]);
|
|
1313
|
-
return (jsxRuntime.jsxs(Popover, { activation: { click: false, hover: { delayed, interactable } }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, 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) }), isMounted ? (jsxRuntime.jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsxRuntime.jsx(PopoverContent, { 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 })] }) }) })) : null] }));
|
|
1313
|
+
return (jsxRuntime.jsxs(Popover, { activation: { click: false, hover: { delayed, interactable } }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, 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) }), isMounted ? (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 })] }) }) })) : null] }));
|
|
1314
1314
|
};
|
|
1315
1315
|
|
|
1316
1316
|
/**
|
package/index.esm.js
CHANGED
|
@@ -605,10 +605,10 @@ const cvaPopoverTitleText = cvaMerge(["flex-1", "text-neutral-500"]);
|
|
|
605
605
|
* @param {PopoverContentProps} props - The props for the PopoverContent component
|
|
606
606
|
* @returns {ReactElement} The popover content element
|
|
607
607
|
*/
|
|
608
|
-
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, ref: propRef, ...props }) {
|
|
608
|
+
const PopoverContent = function PopoverContent({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus = true, ref: propRef, ...props }) {
|
|
609
609
|
const { context: floatingContext, customProps, ...context } = usePopoverContext();
|
|
610
610
|
const ref = useMergeRefs$1([context.refs.setFloating, propRef]);
|
|
611
|
-
return (jsx(Portal, { id: portalId, children: context.isOpen === true ? (jsx(FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus:
|
|
611
|
+
return (jsx(Portal, { id: portalId, children: context.isOpen === true ? (jsx(FloatingFocusManager, { closeOnFocusOut: false, context: floatingContext, guards: true, initialFocus: initialFocus, modal: context.isModal, order: ["reference", "content"], returnFocus: returnFocus, 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: {
|
|
612
612
|
position: context.strategy,
|
|
613
613
|
top: context.y,
|
|
614
614
|
left: context.x,
|
|
@@ -1308,7 +1308,7 @@ const Tooltip = ({ children, "data-testid": dataTestId, disabled = false, label,
|
|
|
1308
1308
|
const wrappedChildren = useMemo(() => {
|
|
1309
1309
|
return jsx(Slot, { children: children });
|
|
1310
1310
|
}, [children]);
|
|
1311
|
-
return (jsxs(Popover, { activation: { click: false, hover: { delayed, interactable } }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, 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) }), isMounted ? (jsx("div", { ref: refs.setFloating, style: floatingStyles, children: jsx(PopoverContent, { 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 })] }) }) })) : null] }));
|
|
1311
|
+
return (jsxs(Popover, { activation: { click: false, hover: { delayed, interactable } }, className: cvaTooltipPopover(), "data-testid": dataTestId, id: id, onOpenStateChange: setIsOpen, placement: placement === "auto" ? "bottom" : placement, 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) }), isMounted ? (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 })] }) }) })) : null] }));
|
|
1312
1312
|
};
|
|
1313
1313
|
|
|
1314
1314
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.59",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"migrations": "./migrations.json",
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
"@floating-ui/react": "^0.26.25",
|
|
15
15
|
"string-ts": "^2.0.0",
|
|
16
16
|
"tailwind-merge": "^2.0.0",
|
|
17
|
-
"@trackunit/ui-design-tokens": "1.13.
|
|
18
|
-
"@trackunit/css-class-variance-utilities": "1.13.
|
|
19
|
-
"@trackunit/shared-utils": "1.15.
|
|
20
|
-
"@trackunit/ui-icons": "1.13.
|
|
17
|
+
"@trackunit/ui-design-tokens": "1.13.55",
|
|
18
|
+
"@trackunit/css-class-variance-utilities": "1.13.56",
|
|
19
|
+
"@trackunit/shared-utils": "1.15.57",
|
|
20
|
+
"@trackunit/ui-icons": "1.13.57",
|
|
21
21
|
"es-toolkit": "^1.39.10",
|
|
22
22
|
"@tanstack/react-virtual": "3.13.12",
|
|
23
23
|
"dequal": "^2.0.3",
|
|
24
24
|
"fflate": "^0.8.2",
|
|
25
25
|
"superjson": "^2.2.6",
|
|
26
26
|
"zod": "^3.25.76",
|
|
27
|
-
"@trackunit/i18n-library-translation": "2.0.
|
|
27
|
+
"@trackunit/i18n-library-translation": "2.0.58"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "^19.0.0",
|
|
@@ -43,6 +43,19 @@ export interface PopoverContentProps extends Omit<HTMLProps<HTMLDivElement>, "ch
|
|
|
43
43
|
* dialog-like menus or pickers) instead of leaving focus on the trigger.
|
|
44
44
|
*/
|
|
45
45
|
initialFocus?: number | MutableRefObject<HTMLElement | null>;
|
|
46
|
+
/**
|
|
47
|
+
* Controls whether focus is returned to the previously focused element when the popover closes.
|
|
48
|
+
*
|
|
49
|
+
* Floating UI tracks the most recently focused tabbable element **across the whole app** (not
|
|
50
|
+
* just this popover instance) as the return target, so disabling this is the only reliable way
|
|
51
|
+
* to guarantee a popover never affects focus on close.
|
|
52
|
+
*
|
|
53
|
+
* Set to `false` for non-modal, non-interactive overlays (like `Tooltip`) that should never
|
|
54
|
+
* manage focus in either direction.
|
|
55
|
+
*
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
returnFocus?: boolean;
|
|
46
59
|
/**
|
|
47
60
|
* A ref for the component
|
|
48
61
|
*/
|
|
@@ -83,4 +96,4 @@ export interface PopoverContentProps extends Omit<HTMLProps<HTMLDivElement>, "ch
|
|
|
83
96
|
* @param {PopoverContentProps} props - The props for the PopoverContent component
|
|
84
97
|
* @returns {ReactElement} The popover content element
|
|
85
98
|
*/
|
|
86
|
-
export declare const PopoverContent: ({ className, "data-testid": dataTestId, children, portalId, initialFocus, ref: propRef, ...props }: PopoverContentProps) => ReactElement;
|
|
99
|
+
export declare const PopoverContent: ({ className, "data-testid": dataTestId, children, portalId, initialFocus, returnFocus, ref: propRef, ...props }: PopoverContentProps) => ReactElement;
|