UNPKG

@crossed/primitive

Version:

A universal & performant styling library for React Native, Next.js & React

29 lines (28 loc) 901 B
import { jsx } from "react/jsx-runtime"; import { forwardRef } from "react"; import { useContext } from "./context"; import { composeEventHandlers } from "@crossed/core"; import { RovingFocus } from "../utils/RovingFocus"; const createDropdownItem = (Styled) => ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore forwardRef((props, ref) => { const { setOpen } = useContext(); return /* @__PURE__ */ jsx(RovingFocus.Item, { ref, focusable: !props.disabled, children: /* @__PURE__ */ jsx( Styled, { tabIndex: props.disabled ? -1 : 0, "aria-disabled": (props.disabled || false).toString(), role: "menuitem", ...props, onPointerUp: composeEventHandlers(props.onPress, () => { setOpen(false); }) } ) }); }) ); export { createDropdownItem }; //# sourceMappingURL=DropdownItem.js.map