@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
74 lines (73 loc) • 1.94 kB
TypeScript
import { ReactNode } from 'react';
import { IBasicUser } from '../../models';
import { TranslateFuncType } from '../../util/models';
export type IOrgOption = {
value: string;
label: string;
description?: string;
icon: ReactNode;
};
export type IPermissionLevel = {
value: string;
label: string;
description?: string;
};
export type IMenuAction = {
label: string;
onClick: () => void;
};
export type IShareConfig = {
user?: IShareUser;
/**
* Extra options to include in the dropdown menu.
*
* @default []
*/
extraActions?: ReadonlyArray<IMenuAction>;
/**
* If true, the permission level can be edited via a drop-down menu
*
* @default false
*/
editable: boolean;
/**
* The available permission levels that can be selected.
*/
permissionLevels?: ReadonlyArray<IPermissionLevel>;
/**
* The currently selected permission level
*/
permissionLevel?: string;
/**
* Callback function triggered when the permission level is changed.
*/
onPermissionChange: (permission: string) => void;
/**
* The organizations the current user belongs to
*/
orgOptions?: ReadonlyArray<IOrgOption>;
/**
* The current selected user org
*/
selectedOrg?: string;
/**
* Callback function triggered when the organization selection changed.
*/
onOrgChange?: (org: string) => void;
};
export type IShareUser = IBasicUser & {
backgroundColor?: string;
textColor?: string;
disabled?: boolean;
permissionLevels?: ReadonlyArray<IPermissionLevel>;
permissionLevel?: string;
permissionEditable?: boolean;
organization?: string;
isMe?: boolean;
isOwner?: boolean;
};
export declare enum PermissionType {
readOnly = "readOnly",
readWrite = "readWrite"
}
export declare const defaultLevels: (t: TranslateFuncType) => IPermissionLevel[];