"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import { Button } from "../../primitives/button.js";
import { Checkbox } from "../../primitives/checkbox.js";
import { useT } from "@open-mercato/shared/lib/i18n/context";
function ShareForm({ roles, shareRoles, shareSetDefault, onToggleRole, onToggleSetDefault, onApply, onCancel }) {
  const t = useT();
  return /* @__PURE__ */ jsxs("div", { className: "rounded border border-primary/30 bg-primary/5 p-3 space-y-2", children: [
    /* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground uppercase", children: t("ui.perspectives.form.shareWithRoles", "Share with roles") }),
    /* @__PURE__ */ jsx("div", { className: "space-y-1", children: roles.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("ui.perspectives.form.noRolesAvailable", "No roles available") }) : roles.map((role) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
      /* @__PURE__ */ jsx(
        Checkbox,
        {
          checked: shareRoles.includes(role.id),
          onCheckedChange: () => onToggleRole(role.id)
        }
      ),
      /* @__PURE__ */ jsx("span", { children: role.name })
    ] }, role.id)) }),
    /* @__PURE__ */ jsx("div", { className: "border-t mt-2 pt-2", children: /* @__PURE__ */ jsxs("label", { className: "inline-flex items-center gap-2 text-sm", children: [
      /* @__PURE__ */ jsx(
        Checkbox,
        {
          checked: shareSetDefault,
          onCheckedChange: (checked) => onToggleSetDefault(checked === true),
          disabled: shareRoles.length === 0
        }
      ),
      t("ui.perspectives.form.setRoleDefault", "Set as default for selected roles")
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
      /* @__PURE__ */ jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancel, children: t("ui.perspectives.footer.cancel", "Cancel") }),
      /* @__PURE__ */ jsx(
        Button,
        {
          type: "button",
          size: "sm",
          disabled: shareRoles.length === 0,
          onClick: onApply,
          children: t("ui.perspectives.menu.apply", "Apply")
        }
      )
    ] })
  ] });
}
export {
  ShareForm
};
//# sourceMappingURL=ShareForm.js.map
