@uxf/core-react 12.7.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -382,6 +382,9 @@ const buttonProps = useClickableProps<Props>({
382
382
 
383
383
  Allow to scroll element by dragging mouse.
384
384
 
385
+ The click that ends a drag is swallowed, so releasing the mouse over a tab or a link inside the element does not
386
+ activate it, and the native drag of links and images is turned off. Clicks from the keyboard are never swallowed.
387
+
385
388
  ```tsx
386
389
  import { useMouseDragToScroll } from "@uxf/core-react/hooks/use-mouse-drag-to-scroll";
387
390
 
@@ -429,6 +432,27 @@ useEffect(() => {
429
432
 
430
433
  ---
431
434
 
435
+ ### useComposedRefs
436
+
437
+ Puts several refs on one element. The composed ref keeps its identity until one of the refs changes, so React
438
+ does not detach and re-attach it on every render.
439
+
440
+ ```tsx
441
+ import { useComposedRefs } from "@uxf/core-react/hooks/use-composed-refs";
442
+
443
+ function Field(props: FieldProps & RefAttributes<HTMLInputElement>) {
444
+ const innerRef = useRef<HTMLInputElement>(null);
445
+ const ref = useComposedRefs(innerRef, props.ref);
446
+
447
+ return <input ref={ref} />;
448
+ }
449
+ ```
450
+
451
+ `composeRefs` from `@uxf/core-react/utils/compose-refs` does the same without the memoisation. It makes a new
452
+ callback on every call, so use it only outside a component.
453
+
454
+ ---
455
+
432
456
  ### usePrevious
433
457
 
434
458
  Returns previous value of given variable.
@@ -0,0 +1,6 @@
1
+ import { Ref, RefCallback } from "react";
2
+ /**
3
+ * `composeRefs` memoised on the refs themselves. A new callback on every render makes React detach and
4
+ * attach every composed ref on every commit, which re-runs a React 19 cleanup ref each time.
5
+ */
6
+ export declare function useComposedRefs<T>(...refs: (Ref<T> | undefined)[]): RefCallback<T>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useComposedRefs = useComposedRefs;
4
+ const react_1 = require("react");
5
+ const compose_refs_1 = require("../utils/compose-refs");
6
+ /**
7
+ * `composeRefs` memoised on the refs themselves. A new callback on every render makes React detach and
8
+ * attach every composed ref on every commit, which re-runs a React 19 cleanup ref each time.
9
+ */
10
+ function useComposedRefs(...refs) {
11
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- the refs are the dependencies
12
+ return (0, react_1.useMemo)(() => (0, compose_refs_1.composeRefs)(...refs), refs);
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const react_1 = require("@testing-library/react");
37
+ const react_2 = __importStar(require("react"));
38
+ const use_composed_refs_1 = require("./use-composed-refs");
39
+ function Probe(props) {
40
+ const ref = (0, use_composed_refs_1.useComposedRefs)(props.outerRef, props.innerRef);
41
+ return react_2.default.createElement("span", { ref: ref }, props.label);
42
+ }
43
+ test("keeps the same composed ref across re-renders, so a cleanup ref attaches once", () => {
44
+ var _a;
45
+ const calls = [];
46
+ const cleanupRef = (node) => {
47
+ calls.push(node ? "attach" : "null");
48
+ return () => {
49
+ calls.push("cleanup");
50
+ };
51
+ };
52
+ const objectRef = (0, react_2.createRef)();
53
+ const view = (0, react_1.render)(react_2.default.createElement(Probe, { innerRef: objectRef, label: "a", outerRef: cleanupRef }));
54
+ view.rerender(react_2.default.createElement(Probe, { innerRef: objectRef, label: "b", outerRef: cleanupRef }));
55
+ expect((_a = objectRef.current) === null || _a === void 0 ? void 0 : _a.textContent).toBe("b");
56
+ view.unmount();
57
+ expect(calls).toEqual(["attach", "cleanup"]);
58
+ expect(objectRef.current).toBeNull();
59
+ });
@@ -4,7 +4,7 @@ exports.useFocusReturn = useFocusReturn;
4
4
  const react_1 = require("react");
5
5
  const use_on_update_1 = require("./use-on-update");
6
6
  function useFocusReturn(opened, transitionDuration = 0, shouldReturnFocus = true) {
7
- const lastActiveElement = (0, react_1.useRef)();
7
+ const lastActiveElement = (0, react_1.useRef)(undefined);
8
8
  const returnFocus = () => {
9
9
  const node = lastActiveElement.current;
10
10
  if (node && "focus" in node && typeof node.focus === "function") {
@@ -86,9 +86,9 @@ function createAriaHider(containerNode, selector = "body > :not(script)") {
86
86
  };
87
87
  }
88
88
  function useFocusTrap(active = true) {
89
- const ref = (0, react_1.useRef)();
90
- const restoreAria = (0, react_1.useRef)();
91
- const timer = (0, react_1.useRef)();
89
+ const ref = (0, react_1.useRef)(null);
90
+ const restoreAria = (0, react_1.useRef)(undefined);
91
+ const timer = (0, react_1.useRef)(undefined);
92
92
  const setRef = (0, react_1.useCallback)((node) => {
93
93
  if (!active) {
94
94
  ref.current = null;
@@ -1 +1 @@
1
- export declare function useLatest<T>(current: T): import("react").MutableRefObject<T>;
1
+ export declare function useLatest<T>(current: T): import("react").RefObject<T>;
@@ -1,2 +1,9 @@
1
1
  import { CSSProperties, RefObject } from "react";
2
+ /**
3
+ * Scrolls the element while the mouse is dragged over it with the primary button.
4
+ *
5
+ * The click that ends a drag is swallowed, so releasing the mouse over a tab or a link does not activate it, and the
6
+ * browser's native drag of links and images is turned off, which would otherwise take over instead of scrolling.
7
+ * Clicks from the keyboard (Enter, Space) are never swallowed.
8
+ */
2
9
  export declare function useMouseDragToScroll<T extends HTMLElement>(containerRef: RefObject<T | null>): CSSProperties | undefined;
@@ -2,6 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useMouseDragToScroll = useMouseDragToScroll;
4
4
  const react_1 = require("react");
5
+ // Further than this from where the mouse was pressed is a drag, not a click.
6
+ const DRAG_THRESHOLD_PX = 5;
7
+ /**
8
+ * Scrolls the element while the mouse is dragged over it with the primary button.
9
+ *
10
+ * The click that ends a drag is swallowed, so releasing the mouse over a tab or a link does not activate it, and the
11
+ * browser's native drag of links and images is turned off, which would otherwise take over instead of scrolling.
12
+ * Clicks from the keyboard (Enter, Space) are never swallowed.
13
+ */
5
14
  function useMouseDragToScroll(containerRef) {
6
15
  const position = (0, react_1.useRef)({ left: 0, top: 0, x: 0, y: 0 });
7
16
  const [style, setStyle] = (0, react_1.useState)();
@@ -10,28 +19,62 @@ function useMouseDragToScroll(containerRef) {
10
19
  if (!node) {
11
20
  return;
12
21
  }
22
+ const controller = new AbortController();
23
+ // The document listeners live for one drag, from pressing the mouse to releasing it.
24
+ let dragController;
25
+ let hasDragged = false;
26
+ let isClickSwallowed = false;
27
+ let swallowTimeout;
13
28
  const mouseMoveHandler = (e) => {
14
29
  const dx = e.clientX - position.current.x;
15
30
  const dy = e.clientY - position.current.y;
31
+ if (Math.abs(dx) > DRAG_THRESHOLD_PX || Math.abs(dy) > DRAG_THRESHOLD_PX) {
32
+ hasDragged = true;
33
+ }
16
34
  node.scrollLeft = position.current.left - dx;
17
35
  node.scrollTop = position.current.top - dy;
18
36
  };
19
37
  const mouseUpHandler = () => {
20
38
  setStyle((prev) => ({ ...prev, cursor: "grab", userSelect: "unset" }));
21
- document.removeEventListener("mousemove", mouseMoveHandler);
22
- document.removeEventListener("mouseup", mouseUpHandler);
39
+ dragController === null || dragController === void 0 ? void 0 : dragController.abort();
40
+ if (hasDragged) {
41
+ // Browsers dispatch the click that ends a drag right after `mouseup`, in the same task, so only that
42
+ // click is swallowed. Whatever comes later, a click from the keyboard included, goes through. Telling
43
+ // a keyboard click apart by the event does not work: Firefox gives Enter on a link `detail` 1, Safari
44
+ // gives it the last mouse position as `clientX`.
45
+ isClickSwallowed = true;
46
+ swallowTimeout = setTimeout(() => {
47
+ isClickSwallowed = false;
48
+ });
49
+ }
23
50
  };
24
51
  const mouseDownHandler = (e) => {
52
+ if (e.button !== 0) {
53
+ return;
54
+ }
55
+ hasDragged = false;
25
56
  position.current = { left: node.scrollLeft, top: node.scrollTop, x: e.clientX, y: e.clientY };
26
57
  setStyle((prev) => ({ ...prev, cursor: "grabbing", userSelect: "none" }));
27
- document.addEventListener("mousemove", mouseMoveHandler);
28
- document.addEventListener("mouseup", mouseUpHandler);
58
+ dragController === null || dragController === void 0 ? void 0 : dragController.abort();
59
+ dragController = new AbortController();
60
+ document.addEventListener("mousemove", mouseMoveHandler, { signal: dragController.signal });
61
+ document.addEventListener("mouseup", mouseUpHandler, { signal: dragController.signal });
29
62
  };
30
- node.addEventListener("mousedown", mouseDownHandler);
63
+ const clickHandler = (e) => {
64
+ if (isClickSwallowed) {
65
+ isClickSwallowed = false;
66
+ e.preventDefault();
67
+ e.stopPropagation();
68
+ }
69
+ };
70
+ node.addEventListener("mousedown", mouseDownHandler, { signal: controller.signal });
71
+ // Capture phase, so the click is stopped before the tab's or the link's own handler sees it.
72
+ node.addEventListener("click", clickHandler, { capture: true, signal: controller.signal });
73
+ node.addEventListener("dragstart", (e) => e.preventDefault(), { signal: controller.signal });
31
74
  return () => {
32
- node.removeEventListener("mousedown", mouseDownHandler);
33
- document.removeEventListener("mousedown", mouseMoveHandler);
34
- document.removeEventListener("mousedown", mouseUpHandler);
75
+ controller.abort();
76
+ dragController === null || dragController === void 0 ? void 0 : dragController.abort();
77
+ clearTimeout(swallowTimeout);
35
78
  };
36
79
  }, [containerRef]);
37
80
  return style;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const react_1 = require("@testing-library/react");
37
+ const react_2 = __importStar(require("react"));
38
+ const use_mouse_drag_to_scroll_1 = require("./use-mouse-drag-to-scroll");
39
+ function Row(props) {
40
+ const ref = (0, react_2.useRef)(null);
41
+ const style = (0, use_mouse_drag_to_scroll_1.useMouseDragToScroll)(ref);
42
+ return (react_2.default.createElement("div", { "data-testid": "row", ref: ref, style: style },
43
+ react_2.default.createElement("button", { onClick: props.onClick, type: "button" }, "Tab")));
44
+ }
45
+ function setup() {
46
+ const onClick = jest.fn();
47
+ const view = (0, react_1.render)(react_2.default.createElement(Row, { onClick: onClick }));
48
+ return { onClick, row: react_1.screen.getByTestId("row"), tab: react_1.screen.getByRole("button"), view };
49
+ }
50
+ // jsdom does not lay anything out, so its `scrollLeft` stays 0 whatever the hook sets.
51
+ function spyOnScrollLeft(element) {
52
+ const setScrollLeft = jest.fn();
53
+ Object.defineProperty(element, "scrollLeft", { configurable: true, get: () => 0, set: setScrollLeft });
54
+ return setScrollLeft;
55
+ }
56
+ /**
57
+ * A browser dispatches `mouseup` and the click it causes in one task, so `click()` follows `release()` synchronously,
58
+ * as it does in the browser. Anything a person does later (pressing Enter, clicking again) comes after `later()`.
59
+ */
60
+ function press(target, x) {
61
+ react_1.fireEvent.mouseDown(target, { button: 0, clientX: x, clientY: 0 });
62
+ }
63
+ function moveTo(x) {
64
+ react_1.fireEvent.mouseMove(document, { clientX: x, clientY: 0 });
65
+ }
66
+ function release(x) {
67
+ react_1.fireEvent.mouseUp(document, { clientX: x, clientY: 0 });
68
+ }
69
+ function click(target, x) {
70
+ react_1.fireEvent.click(target, { clientX: x, detail: 1 });
71
+ }
72
+ function later() {
73
+ jest.runAllTimers();
74
+ }
75
+ beforeEach(() => {
76
+ jest.useFakeTimers();
77
+ });
78
+ afterEach(() => {
79
+ jest.useRealTimers();
80
+ });
81
+ describe("useMouseDragToScroll", () => {
82
+ it("lets a click without a drag through", () => {
83
+ const { onClick, tab } = setup();
84
+ press(tab, 100);
85
+ moveTo(103);
86
+ release(103);
87
+ click(tab, 103);
88
+ expect(onClick).toHaveBeenCalledTimes(1);
89
+ });
90
+ it("swallows the click that ends a drag", () => {
91
+ const { onClick, tab } = setup();
92
+ press(tab, 100);
93
+ moveTo(40);
94
+ release(40);
95
+ click(tab, 40);
96
+ expect(onClick).not.toHaveBeenCalled();
97
+ });
98
+ it("swallows the click when the mouse was dragged away and back", () => {
99
+ const { onClick, tab } = setup();
100
+ press(tab, 100);
101
+ moveTo(20);
102
+ moveTo(100);
103
+ release(100);
104
+ click(tab, 100);
105
+ expect(onClick).not.toHaveBeenCalled();
106
+ });
107
+ it("never swallows a click from the keyboard after a drag", () => {
108
+ const { onClick, tab } = setup();
109
+ press(tab, 100);
110
+ moveTo(40);
111
+ release(40);
112
+ later();
113
+ // Firefox reports Enter on a link with `detail` 1, so the event itself cannot tell it apart from a mouse click.
114
+ click(tab, 0);
115
+ expect(onClick).toHaveBeenCalledTimes(1);
116
+ });
117
+ it("lets the next click through after a drag released outside the element", () => {
118
+ const { onClick, tab } = setup();
119
+ press(tab, 100);
120
+ moveTo(400);
121
+ release(400);
122
+ later();
123
+ press(tab, 40);
124
+ release(40);
125
+ click(tab, 40);
126
+ expect(onClick).toHaveBeenCalledTimes(1);
127
+ });
128
+ it("lets the click through on a child that does not let the press bubble", () => {
129
+ const { onClick, tab } = setup();
130
+ press(tab, 100);
131
+ moveTo(40);
132
+ release(40);
133
+ later();
134
+ tab.addEventListener("mousedown", (e) => e.stopPropagation());
135
+ press(tab, 40);
136
+ release(40);
137
+ click(tab, 40);
138
+ expect(onClick).toHaveBeenCalledTimes(1);
139
+ });
140
+ it("does not drag with other than the primary button", () => {
141
+ const { row, tab } = setup();
142
+ react_1.fireEvent.mouseDown(tab, { button: 2, clientX: 100, clientY: 0 });
143
+ expect(row.style.cursor).toBe("");
144
+ });
145
+ it("turns off the native drag of links and images", () => {
146
+ const { tab } = setup();
147
+ expect(react_1.fireEvent.dragStart(tab)).toBe(false);
148
+ });
149
+ it("scrolls the element by the distance dragged", () => {
150
+ const { row, tab } = setup();
151
+ const setScrollLeft = spyOnScrollLeft(row);
152
+ press(tab, 100);
153
+ moveTo(40);
154
+ expect(setScrollLeft).toHaveBeenLastCalledWith(60);
155
+ });
156
+ it("stops scrolling once the mouse is released", () => {
157
+ const { row, tab } = setup();
158
+ const setScrollLeft = spyOnScrollLeft(row);
159
+ press(tab, 100);
160
+ moveTo(40);
161
+ release(40);
162
+ setScrollLeft.mockClear();
163
+ moveTo(0);
164
+ expect(setScrollLeft).not.toHaveBeenCalled();
165
+ });
166
+ it("stops listening on the document when unmounted during a drag", () => {
167
+ const { row, tab, view } = setup();
168
+ const setScrollLeft = spyOnScrollLeft(row);
169
+ press(tab, 100);
170
+ view.unmount();
171
+ moveTo(40);
172
+ expect(setScrollLeft).not.toHaveBeenCalled();
173
+ });
174
+ });
@@ -1 +1 @@
1
- export declare function usePrevious<T>(current: T): import("react").MutableRefObject<T>;
1
+ export declare function usePrevious<T>(current: T): import("react").RefObject<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/core-react",
3
- "version": "12.7.0",
3
+ "version": "13.0.0",
4
4
  "description": "UXF Core",
5
5
  "author": "UX Fans s.r.o",
6
6
  "license": "MIT",
@@ -12,15 +12,15 @@
12
12
  "typecheck": "tsc --noEmit"
13
13
  },
14
14
  "peerDependencies": {
15
- "@uxf/core": "12.7.0",
16
- "react": ">=18.2.0",
17
- "react-dom": ">=18.2.0"
15
+ "@uxf/core": "13.0.0",
16
+ "react": "^19.3.0",
17
+ "react-dom": "^19.3.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@types/react": "18.3.31",
21
- "@types/react-dom": "18.3.7",
22
- "@uxf/core": "12.7.0",
23
- "react": "18.3.1",
24
- "react-dom": "18.3.1"
20
+ "@types/react": "19.3.0",
21
+ "@types/react-dom": "19.3.0",
22
+ "@uxf/core": "13.0.0",
23
+ "react": "19.3.0",
24
+ "react-dom": "19.3.0"
25
25
  }
26
26
  }
@@ -1,2 +1,6 @@
1
1
  import { Ref, RefCallback } from "react";
2
+ /**
3
+ * Returns a cleanup, so React 19 detaches by calling it instead of passing `null`: each ref's own
4
+ * cleanup runs, and only refs without one get `null`.
5
+ */
2
6
  export declare function composeRefs<T>(...refs: (Ref<T> | undefined)[]): RefCallback<T>;
@@ -1,15 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.composeRefs = composeRefs;
4
+ function attachRef(ref, value) {
5
+ if (!ref) {
6
+ return () => undefined;
7
+ }
8
+ if (typeof ref === "function") {
9
+ const cleanup = ref(value);
10
+ return typeof cleanup === "function" ? cleanup : () => ref(null);
11
+ }
12
+ ref.current = value;
13
+ return () => {
14
+ ref.current = null;
15
+ };
16
+ }
17
+ /**
18
+ * Returns a cleanup, so React 19 detaches by calling it instead of passing `null`: each ref's own
19
+ * cleanup runs, and only refs without one get `null`.
20
+ */
4
21
  function composeRefs(...refs) {
5
- return (value) => refs.forEach((ref) => {
6
- if (!ref) {
7
- return;
8
- }
9
- if (typeof ref === "function") {
10
- ref(value);
11
- return;
12
- }
13
- ref.current = value;
14
- });
22
+ return (value) => {
23
+ const cleanups = refs.map((ref) => attachRef(ref, value));
24
+ return () => cleanups.forEach((cleanup) => cleanup());
25
+ };
15
26
  }
@@ -39,3 +39,22 @@ describe("composeRefs", () => {
39
39
  expect(refObject2.current).toBe("test-value");
40
40
  });
41
41
  });
42
+ describe("composeRefs cleanup (React 19 ref semantics)", () => {
43
+ it("returns a cleanup that runs each callback ref's own cleanup instead of calling it with null", () => {
44
+ const cleanup = jest.fn();
45
+ const refCallback = jest.fn(() => cleanup);
46
+ const detach = (0, compose_refs_1.composeRefs)(refCallback)("node");
47
+ expect(typeof detach).toBe("function");
48
+ detach();
49
+ expect(cleanup).toHaveBeenCalledTimes(1);
50
+ expect(refCallback).not.toHaveBeenCalledWith(null);
51
+ });
52
+ it("calls a callback ref without a cleanup with null, and resets an object ref, on detach", () => {
53
+ const refCallback = jest.fn();
54
+ const refObject = { current: null };
55
+ const detach = (0, compose_refs_1.composeRefs)(refCallback, refObject)("node");
56
+ detach();
57
+ expect(refCallback).toHaveBeenLastCalledWith(null);
58
+ expect(refObject.current).toBeNull();
59
+ });
60
+ });