@ark-ui/solid
Version:
A collection of unstyled, accessible UI components for Solid, utilizing state machines for seamless interaction.
24 lines (21 loc) • 429 B
JavaScript
import { createEffect } from 'solid-js';
// src/utils/compose-refs.ts
var isRefFn = (ref) => typeof ref === "function";
var setRefs = (refs, node) => {
for (const ref of refs) {
if (isRefFn(ref)) {
ref(node);
}
}
};
function composeRefs(...refs) {
let node = null;
createEffect(() => {
setRefs(refs, node);
});
return (el) => {
node = el;
setRefs(refs, el);
};
}
export { composeRefs };