import { type ReactNode } from "react"; import { type FailedLoad } from "./diff-view.js"; import { type RoleOption, type RoleValue } from "./role-select.js"; export type AccessMemberStatus = "active" | "invited" | "invite_failed" | "suspended"; export interface AccessMember { id: string; name: string; /** Service accounts have none. */ email?: string | null | undefined; initials: string; kind?: "person" | "service" | undefined; isYou?: boolean | undefined; /** * The viewer administers this list from above (an organization owner or * admin on the organization's workspace page), so their own row stays * editable: they set and remove their own access like anyone else's. */ managesOwnAccess?: boolean | undefined; /** Owners are always listed and can't be removed here. */ isOwner?: boolean | undefined; /** A small tag after the name, for example "Only owner". */ tag?: string | undefined; status?: AccessMemberStatus | undefined; /** "Invited · expires in 5 days". Shown only when not active. */ statusLabel?: string | undefined; /** The role in this list's scope. */ role: RoleValue; /** For a legacy custom grant: the role "Reset to role" goes back to. */ resetRole?: R | undefined; /** Why this person's role can't be changed here. */ roleLockedReason?: string | undefined; /** Why this person can't be removed here. Owners and You never can. */ removeLockedReason?: string | undefined; /** Matrix variant: the role per scope id (null is no access). */ grants?: Record> | undefined; } export interface AccessScope { id: string; /** "Platform engineering". */ label: string; } export type AccessListVariant = "inline" | "text" | "matrix"; export interface AccessListProps { members: readonly AccessMember[]; /** From the server's role catalog, least to most access. */ roles: readonly RoleOption[]; variant?: AccessListVariant | undefined; /** Accessible name for the list: "People with access to Platform engineering". */ label: string; /** Matrix columns. */ scopes?: readonly AccessScope[] | undefined; /** Saves a role. Return a promise to show the saving state. */ onRoleChange?: (member: AccessMember, role: R | null, scopeId?: string) => void | Promise; onRemove?: ((member: AccessMember) => void) | undefined; /** * Opens the hand-picked permission editor ("Custom permissions…" in the ⋯ * menu). Optional: most places only offer roles. */ onCustomize?: ((member: AccessMember) => void) | undefined; /** Replaces a legacy custom grant with `member.resetRole`. */ onResetToRole?: ((member: AccessMember) => void | Promise) | undefined; /** Text variant: opens the person sheet. */ onOpen?: ((member: AccessMember) => void) | undefined; onResendInvite?: ((member: AccessMember) => void) | undefined; onRevokeInvite?: ((member: AccessMember) => void) | undefined; /** When set, nothing can be changed and this line says why. */ readOnlyReason?: string | undefined; loading?: boolean | undefined; /** Skeleton rows while loading. Default 4. */ loadingRows?: number | undefined; /** What happened, what to do next, and an optional retry. Replaces the list. */ error?: FailedLoad | undefined; /** Members whose role is being saved elsewhere, shown with a spinner. */ savingIds?: readonly string[] | undefined; /** Shown when only you have access. */ emptyMessage?: ReactNode | undefined; /** "Remove from workspace" or "Remove from organization". */ removeLabel?: string | undefined; /** What the list sits on, so the matrix's sticky column matches. Default "bg". */ canvas?: "bg" | "surface" | undefined; /** Adds "No access" to role choices (matrix, person sheet). */ noAccessLabel?: string | undefined; className?: string | undefined; } /** Service accounts go in their own subgroup, after the people. */ export declare function groupAccessMembers(members: readonly AccessMember[]): { people: AccessMember[]; services: AccessMember[]; }; /** Why a member can't be removed, or null when they can. */ export declare function removeBlockedReason(member: AccessMember): string | null; /** Who has access, with one role each. */ export declare function AccessList(props: AccessListProps): import("react").JSX.Element;