import { type ObjRef } from "@gooddata/sdk-model"; import { type IAccessibilityConfigBase } from "../../typings/accessibility.js"; import { type GranteeAvatarKind } from "../UiGranteeAvatar/UiGranteeAvatar.js"; import { type IUiLabelsChecklistItem } from "../UiLabelsChecklist/UiLabelsChecklist.js"; import { type PermissionMenuLevel } from "../UiPermissionMenu/UiPermissionMenu.js"; /** * One pickable user or group entry. * * @internal */ export interface IUiGranteeAsyncOption { /** Stable identifier — used as the React key and as the value passed to `onSelect`. */ id: string; /** Backend ref of the user/group, carried through selection so the consumer can * write the grant against the exact ref (preserves Uri-vs-Id; `id` is a lossy * serialization). */ ref: ObjRef; /** Avatar variant. */ kind: GranteeAvatarKind; /** Display name shown on the row. */ name: string; /** Optional email subline (users only). */ email?: string; } /** * A previously-picked grantee with its current permission level. * * @internal */ export interface IUiPickedGrantee extends IUiGranteeAsyncOption { /** Permission level chosen for this grantee. Drives the row's permission menu trigger label. */ permissionLevel: PermissionMenuLevel; /** * Label scope chosen for this grantee, as ids of the picker's `labels`. * `undefined` means every label — the untouched default, so a consumer that * offers no label picker never has to populate it. */ labelIds?: ReadonlyArray; } /** * Result returned by the consumer's loader: separate `groups` and `users` arrays * so the dropdown can render the two sections independently. Either may be empty. * * @internal */ export interface IUiGranteeAsyncOptions { groups: IUiGranteeAsyncOption[]; users: IUiGranteeAsyncOption[]; } /** * @internal */ export interface IUiGranteeAsyncPickerProps { /** * Loader called whenever the (debounced) search query changes. The empty * string is passed on mount to populate the initial dropdown. Pagination * is intentionally not exposed at this layer — the loader returns the * full search result and the consumer caps backend results elsewhere. */ loadOptions: (search: string) => Promise; /** * Grantees already picked. Rendered below the search input as `UiGranteeRow`s * with a `UiPermissionMenu` trigger and a Remove action. Also filtered out * of the dropdown so the user cannot pick the same grantee twice. */ selectedGrantees?: ReadonlyArray; /** Fires when the user picks an option from the dropdown. */ onSelect: (option: IUiGranteeAsyncOption) => void; /** Fires when the user changes the permission level on a picked row. */ onPermissionChange?: (grantee: IUiPickedGrantee, next: PermissionMenuLevel) => void; /** * Levels each picked grantee's menu renders disabled — the caller cannot grant a * level they do not hold themselves. See {@link UiPermissionMenu}. */ disabledLevels?: ReadonlyArray; /** Tooltip shown on those disabled levels. */ disabledTooltip?: string; /** Fires when the user picks Remove access in the row's permission menu. */ onRemove?: (grantee: IUiPickedGrantee) => void; /** * Labels the picked grantees can be scoped to. Adds a Label access drill-in to each * row's permission menu, unless the only labels are primary ones, so a scope can be * narrowed before the grantee is granted anything. The row renders `grantee.labelIds`, which the consumer * owns. Requires `onLabelsChange`: without somewhere to put the pick, the drill-in * stays hidden rather than offering an Apply that discards it. */ labels?: ReadonlyArray; /** * Accessible name of the search input, which has no visible label of its own — the * surrounding dialog's title names it, so pass that title here. Defaults to the * add-grantee dialog title. */ accessibilityConfig?: Pick; /** Fires with the applied label scope of a picked row. Enables `labels`. */ onLabelsChange?: (grantee: IUiPickedGrantee, selectedLabelIds: string[]) => void; /** Test id forwarded to the root element. */ dataTestId?: string; } /** * Sectioned async grantee picker — specialization of `UiAutocomplete` for the * share/access-control domain. Renders a search input with a dropdown split * into `Groups` and `Users` sections, and a list of picked grantees below * (each as a `UiGranteeRow` with a `UiPermissionMenu` trigger). The * permission menu carries the Remove action; consumers wire it via `onRemove`. * * @internal */ export declare function UiGranteeAsyncPicker({ loadOptions, selectedGrantees, onSelect, onPermissionChange, disabledLevels, disabledTooltip, onRemove, labels, onLabelsChange, accessibilityConfig, dataTestId, }: IUiGranteeAsyncPickerProps): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=UiGranteeAsyncPicker.d.ts.map