UNPKG

@ariakit/react-core

Version:

Ariakit React core

44 lines (42 loc) 1.14 kB
"use client"; import { CollectionScopedContextProvider, useCollectionProviderContext } from "../__chunks/5CPL3B7G.js"; import { createElement, createHook, forwardRef } from "../__chunks/VOQWLFSQ.js"; import { useWrapElement } from "../__chunks/5GGHRIN3.js"; import "../__chunks/SK3NAZA3.js"; import { __objRest } from "../__chunks/3YLGPPWQ.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(_a) { var _b = _a, { store } = _b, props = __objRest(_b, ["store"]); 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 };