UNPKG

@ariakit/react-core

Version:

Ariakit React core

38 lines (35 loc) 938 B
"use client"; import { FocusableContext } from "./SWN3JYXT.js"; import { createElement, createHook, forwardRef } from "./VOQWLFSQ.js"; import { useWrapElement } from "./5GGHRIN3.js"; import { __objRest } from "./3YLGPPWQ.js"; // src/focusable/focusable-container.tsx import { jsx } from "react/jsx-runtime"; var TagName = "div"; var useFocusableContainer = createHook(function useFocusableContainer2(_a) { var _b = _a, { autoFocusOnShow = true } = _b, props = __objRest(_b, ["autoFocusOnShow"]); props = useWrapElement( props, (element) => /* @__PURE__ */ jsx(FocusableContext.Provider, { value: autoFocusOnShow, children: element }), [autoFocusOnShow] ); return props; }); var FocusableContainer = forwardRef(function FocusableContainer2(props) { const htmlProps = useFocusableContainer(props); return createElement(TagName, htmlProps); }); export { useFocusableContainer, FocusableContainer };