@ariakit/react-core
Version:
Ariakit React core
40 lines (38 loc) • 1.04 kB
JavaScript
"use client";
import {
CollectionScopedContextProvider,
useCollectionProviderContext
} from "../__chunks/45YOMIF3.js";
import {
createElement,
createHook,
forwardRef
} from "../__chunks/ILRXHV7V.js";
import {
useWrapElement
} from "../__chunks/K2XTQB3X.js";
import "../__chunks/YXGXYGQX.js";
// src/collection/collection.tsx
import { removeUndefinedValues } from "@ariakit/core/utils/misc";
import { jsx } from "react/jsx-runtime";
var TagName = "div";
var useCollection = createHook(
function useCollection2({ store, ...props }) {
const context = useCollectionProviderContext();
store = store || context;
props = useWrapElement(
props,
(element) => /* @__PURE__ */ jsx(CollectionScopedContextProvider, { value: store, children: element }),
[store]
);
return removeUndefinedValues(props);
}
);
var Collection = forwardRef(function Collection2(props) {
const htmlProps = useCollection(props);
return createElement(TagName, htmlProps);
});
export {
Collection,
useCollection
};