UNPKG

@logilab/cwelements

Version:

Library of reusable React components for building web application with cubicweb

67 lines (66 loc) 2.07 kB
import * as React from 'react'; import { providers } from '@logilab/cwclientlibjs'; /** * The parameters for the component used to activate/deactivate a relation to another entity */ export interface EntityRelationsSelectorProps { /** * The related entity */ entity: providers.Entity; /** * Whether the entity is related to the reference one */ isRelated: boolean; /** * The CSS class name(s) for the component */ className: string; /** * Handles the event for adding/removing the entity from the relation * @param entity The related entity * @param isRelated Whether the entity is now related to the reference one */ onToggle: (entity: providers.Entity, isRelated: boolean) => void; } /** * The parameters for the component used to activate/deactivate a relation to another entity */ export interface DefaultEntityRelationsSelectorProps extends EntityRelationsSelectorProps { /** * The size of the widget */ size: number; /** * The primary color to use for the widget */ colorRelated: string; /** * The default color to use for the widget */ colorUnrelated: string; } /** * The default props for the component used to activate/deactivate a relation to another entity */ export declare const DEFAULT_ENTITY_RELATIONS_SELECTOR_DEFAULT_PROPS: { className: string; size: number; colorUnrelated: string; colorRelated: string; }; /** * The default component used to activate/deactivate a relation to another entity */ export declare class DefaultEntityRelationsSelector extends React.Component<DefaultEntityRelationsSelectorProps, {}> { static defaultProps: { className: string; size: number; colorUnrelated: string; colorRelated: string; }; constructor(props: Readonly<DefaultEntityRelationsSelectorProps>); componentDidUpdate(prevProps: DefaultEntityRelationsSelectorProps, prevState: {}, snapshot: any): void; onClickToggle(): void; render(): JSX.Element; }