matrix-react-sdk
Version:
SDK for matrix.org using React
39 lines (38 loc) • 1.26 kB
TypeScript
import { JSX, PropsWithChildren } from "react";
/**
* Display in a fieldset, the power level of the users and allow to change them.
* The apply button is disabled until the power level of an user is changed.
* If there is no user to display, the children is displayed instead.
*/
interface PowerLevelSelectorProps {
/**
* The power levels of the users
* The key is the user id and the value is the power level
*/
userLevels: Record<string, number>;
/**
* Whether the user can change the power levels of other users
*/
canChangeLevels: boolean;
/**
* The current user power level
*/
currentUserLevel: number;
/**
* The callback when the apply button is clicked
* @param value - new power level for the user
* @param userId - the user id
*/
onClick: (value: number, userId: string) => void;
/**
* Filter the users to display
* @param user
*/
filter: (user: string) => boolean;
/**
* The title of the fieldset
*/
title: string;
}
export declare function PowerLevelSelector({ userLevels, canChangeLevels, currentUserLevel, onClick, filter, title, children, }: PropsWithChildren<PowerLevelSelectorProps>): JSX.Element | null;
export {};