UNPKG

1.55 kBTypeScriptView Raw
1import * as React from 'react';
2import { ExtensionsProps } from '../context';
3import { ErrorLike } from '../errors';
4import { ConfigurationSubject, ConfiguredSubjectOrError, Settings } from '../settings';
5import { ConfiguredExtension } from './extension';
6declare const LOADING: 'loading';
7interface Props<S extends ConfigurationSubject, C extends Settings> extends ExtensionsProps<S, C> {
8 /** The extension that this button adds. */
9 extension: ConfiguredExtension;
10 /** The configuration subject that this button adds the extension for. */
11 subject: ConfiguredSubjectOrError<ConfigurationSubject, Settings>;
12 disabled?: boolean;
13 className?: string;
14 /**
15 * Called to confirm the primary action. If the callback returns false, the action is not
16 * performed.
17 */
18 confirm?: () => boolean;
19 /** Called when the component performs an update that requires the parent component to refresh data. */
20 onUpdate: () => void;
21}
22interface State {
23 /** The operation's status: null when done or not started, 'loading', or an error. */
24 operationResultOrError: typeof LOADING | null | ErrorLike;
25}
26/** An button to add an extension. */
27export declare class ExtensionAddButton<S extends ConfigurationSubject, C extends Settings> extends React.PureComponent<Props<S, C>, State> {
28 state: State;
29 private clicks;
30 private subscriptions;
31 componentDidMount(): void;
32 componentWillUnmount(): void;
33 render(): JSX.Element | null;
34 private onClick;
35 private addExtensionForSubject;
36}
37export {};