"use client";
import * as React from "react";
import { useRenderElement } from "../../utils/useRenderElement.js";
import { ComboboxGroupContext } from "./ComboboxGroupContext.js";
import { GroupCollectionProvider } from "../collection/GroupCollectionContext.js";
import { jsx } from "react/jsx-runtime";
const ComboboxGroup = /* @__PURE__ */ React.forwardRef(function ComboboxGroup2(componentProps, forwardedRef) {
  const {
    render,
    className,
    items,
    ...elementProps
  } = componentProps;
  const [labelId, setLabelId] = React.useState();
  const contextValue = React.useMemo(() => ({
    labelId,
    setLabelId,
    items
  }), [labelId, setLabelId, items]);
  const element = useRenderElement("div", componentProps, {
    ref: forwardedRef,
    props: [{
      role: "group",
      "aria-labelledby": labelId
    }, elementProps]
  });
  const wrappedElement = /* @__PURE__ */ jsx(ComboboxGroupContext.Provider, {
    value: contextValue,
    children: element
  });
  if (items) {
    return /* @__PURE__ */ jsx(GroupCollectionProvider, {
      items,
      children: wrappedElement
    });
  }
  return wrappedElement;
});
if (process.env.NODE_ENV !== "production") ComboboxGroup.displayName = "ComboboxGroup";
export {
  ComboboxGroup
};
//# sourceMappingURL=ComboboxGroup.js.map
