/** * @license * Copyright 2026 Aglyn LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { type ReactNode } from 'react'; /** * A grouped, searchable list of permissions with three states each (AGL-4047): * inherit (the layer below decides), allow, or deny. Drawn by every editor of * a permission map — a custom role, one member's overrides, one collaborator's * per-site toggles — so they look and behave alike. * * Presentation only: the caller decides which keys are offered, how they are * grouped, what a search keeps and what "inherit" resolves to, and hands the * words in. NOT in the `@aglyn/shared-ui-jsx` barrel; subpath-import it * (`@aglyn/shared-ui-jsx/components/permission-choice-list.component`). */ export type PermissionChoiceValue = 'inherit' | 'grant' | 'deny'; /** * A key a site can narrow (AGL-4047) carries a second choice: on a site where * the member's access is narrower than their workspace role, does it follow * that site role (`narrow`) or do they keep it (`keep`)? `inherit`: the layer * below decides. */ export type PermissionNarrowingValue = 'inherit' | 'narrow' | 'keep'; export interface PermissionChoiceItem { key: string; label: string; description?: string; choice: PermissionChoiceValue; /** * The verdict the member ends up with and where it came from * ("Allowed by the Editor role"), shown under the description. */ effective?: { granted: boolean; source: string; }; /** What inherit resolves to here, when there is one answer ("Editor default: allowed"). */ inheritHint?: string; /** A reason the row cannot change, shown as the toggle's tooltip. */ lockedReason?: string; /** * The narrowing choice, for a key a site can narrow; absent, the row has * none. `effective` is the verdict and where it came from ("Follows the * site role · from the Editor role"); `inheritHint` what inherit resolves to. */ narrowing?: { choice: PermissionNarrowingValue; effective?: string; inheritHint?: string; }; } export interface PermissionChoiceSection { id: string; label: string; items: PermissionChoiceItem[]; } export interface PermissionChoiceListProps { sections: readonly PermissionChoiceSection[]; /** Sets one key (or, from a group heading, every key of the group) to a choice. */ onChange: (keys: string[], choice: PermissionChoiceValue) => void; /** The search box; absent hides it. */ search?: string; onSearchChange?: (value: string) => void; disabled?: boolean; /** The words for the three states. */ labels?: Partial>; /** Shown when a search keeps nothing. */ emptyMessage?: ReactNode; /** Offer "set the whole group" on each heading. */ groupActions?: boolean; /** Sets one key's narrowing choice; absent, the narrowing rows are read-only. */ onNarrowingChange?: (key: string, choice: PermissionNarrowingValue) => void; /** The words before the narrowing choice. */ narrowingLabel?: string; } export declare function PermissionChoiceList(props: PermissionChoiceListProps): import("react").JSX.Element; export declare namespace PermissionChoiceList { var displayName: string; } export default PermissionChoiceList;