// packages/block-editor/src/components/inserter-listbox/item.js
import { Button, Composite } from "@wordpress/components";
import { forwardRef } from "@wordpress/element";
import { jsx } from "react/jsx-runtime";
function InserterListboxItem({ isFirst, as: Component, children, ...props }, ref) {
  return /* @__PURE__ */ jsx(
    Composite.Item,
    {
      ref,
      role: "option",
      accessibleWhenDisabled: true,
      ...props,
      render: (htmlProps) => {
        const propsWithTabIndex = {
          ...htmlProps,
          tabIndex: isFirst ? 0 : htmlProps.tabIndex
        };
        if (Component) {
          return /* @__PURE__ */ jsx(Component, { ...propsWithTabIndex, children });
        }
        if (typeof children === "function") {
          return children(propsWithTabIndex);
        }
        return /* @__PURE__ */ jsx(Button, { __next40pxDefaultSize: true, ...propsWithTabIndex, children });
      }
    }
  );
}
var item_default = forwardRef(InserterListboxItem);
export {
  item_default as default
};
//# sourceMappingURL=item.js.map
