@ark-ui/react 5.38.0 → 5.38.1

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.
@@ -3,11 +3,20 @@ let react = require("react");
3
3
  function composeRefs(...refs) {
4
4
  return (node) => {
5
5
  const cleanUps = [];
6
+ let hasCustomCleanUp = false;
6
7
  for (const ref of refs) if (typeof ref === "function") {
7
8
  const cb = ref(node);
8
- if (typeof cb === "function") cleanUps.push(cb);
9
- } else if (ref) ref.current = node;
10
- if (cleanUps.length) return () => {
9
+ if (typeof cb === "function") {
10
+ hasCustomCleanUp = true;
11
+ cleanUps.push(cb);
12
+ } else cleanUps.push(() => ref(null));
13
+ } else if (ref) {
14
+ ref.current = node;
15
+ cleanUps.push(() => {
16
+ ref.current = null;
17
+ });
18
+ }
19
+ if (hasCustomCleanUp) return () => {
11
20
  for (const cleanUp of cleanUps) cleanUp();
12
21
  };
13
22
  };
@@ -3,11 +3,20 @@ import { useCallback } from "react";
3
3
  function composeRefs(...refs) {
4
4
  return (node) => {
5
5
  const cleanUps = [];
6
+ let hasCustomCleanUp = false;
6
7
  for (const ref of refs) if (typeof ref === "function") {
7
8
  const cb = ref(node);
8
- if (typeof cb === "function") cleanUps.push(cb);
9
- } else if (ref) ref.current = node;
10
- if (cleanUps.length) return () => {
9
+ if (typeof cb === "function") {
10
+ hasCustomCleanUp = true;
11
+ cleanUps.push(cb);
12
+ } else cleanUps.push(() => ref(null));
13
+ } else if (ref) {
14
+ ref.current = node;
15
+ cleanUps.push(() => {
16
+ ref.current = null;
17
+ });
18
+ }
19
+ if (hasCustomCleanUp) return () => {
11
20
  for (const cleanUp of cleanUps) cleanUp();
12
21
  };
13
22
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ark-ui/react",
3
3
  "type": "module",
4
- "version": "5.38.0",
4
+ "version": "5.38.1",
5
5
  "description": "A collection of unstyled, accessible UI components for React, utilizing state machines for seamless interaction.",
6
6
  "keywords": [
7
7
  "accordion",
@@ -223,7 +223,7 @@
223
223
  "@storybook/react-vite": "10.5.3",
224
224
  "@tanstack/react-virtual": "3.14.8",
225
225
  "@testing-library/dom": "10.4.1",
226
- "@testing-library/jest-dom": "6.9.1",
226
+ "@testing-library/jest-dom": "7.0.0",
227
227
  "@testing-library/react": "16.3.2",
228
228
  "@testing-library/user-event": "14.6.1",
229
229
  "@types/jsdom": "28.0.3",