"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { cn } from "@open-mercato/shared/lib/utils";
import { Button } from "@open-mercato/ui/primitives/button";
function SegmentGroup({
  options,
  value,
  onChange,
  size = "sm",
  ariaLabel
}) {
  return /* @__PURE__ */ jsx(
    "div",
    {
      role: "group",
      "aria-label": ariaLabel,
      className: "flex w-full items-stretch overflow-hidden rounded-md border border-border bg-background",
      children: options.map((option, index) => {
        const isActive = option.value === value;
        return /* @__PURE__ */ jsxs(
          Button,
          {
            type: "button",
            variant: "ghost",
            "aria-pressed": isActive,
            onClick: () => onChange(option.value),
            title: option.label,
            "data-state": isActive ? "active" : "inactive",
            className: cn(
              "h-auto min-w-0 flex-1 justify-center gap-1 rounded-none border-0 px-1.5 text-sm font-medium leading-5 shadow-none",
              size === "md" ? "py-2" : "py-1.5",
              index > 0 && "border-l border-border",
              isActive ? "bg-accent-indigo font-semibold text-accent-indigo-foreground hover:bg-accent-indigo hover:text-accent-indigo-foreground dark:hover:bg-accent-indigo" : "bg-background text-muted-foreground hover:bg-muted hover:text-foreground"
            ),
            children: [
              option.icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: cn("shrink-0", isActive ? "opacity-100" : "opacity-70"), children: option.icon }) : null,
              /* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
            ]
          },
          option.value
        );
      })
    }
  );
}
export {
  SegmentGroup
};
//# sourceMappingURL=SegmentGroup.js.map
