@types/react-alert
Advanced tools
Comparing version 4.0.0 to 5.2.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for react-alert 4.0 | ||
// Type definitions for react-alert 5.2 | ||
// Project: https://github.com/schiehll/react-alert | ||
@@ -11,12 +11,45 @@ // Definitions by: Yue Yang <https://github.com/g1eny0ung> | ||
| 'top left' | ||
| 'top center' | ||
| 'top right' | ||
| 'top center' | ||
| 'middle left' | ||
| 'middle' | ||
| 'middle right' | ||
| 'bottom left' | ||
| 'bottom right' | ||
| 'bottom center'; | ||
| 'bottom center' | ||
| 'bottom right'; | ||
export interface Positions { | ||
TOP_LEFT: 'top left'; | ||
TOP_CENTER: 'top center'; | ||
TOP_RIGHT: 'top right'; | ||
MIDDLE_LEFT: 'middle left'; | ||
MIDDLE: 'middle'; | ||
MIDDLE_RIGHT: 'middle right'; | ||
BOTTOM_LEFT: 'bottom left'; | ||
BOTTOM_CENTER: 'bottom center'; | ||
BOTTOM_RIGHT: 'bottom right'; | ||
} | ||
export const positions: Positions; | ||
export type AlertType = 'info' | 'success' | 'error'; | ||
export interface Types { | ||
INFO: 'info'; | ||
SUCCESS: 'success'; | ||
ERROR: 'error'; | ||
} | ||
export const types: Types; | ||
export type AlertTransition = 'fade' | 'scale'; | ||
export interface ProviderOptions { | ||
export interface Transitions { | ||
FADE: 'fade'; | ||
SCALE: 'scale'; | ||
} | ||
export const transitions: Transitions; | ||
export interface AlertProviderProps extends React.HTMLAttributes<HTMLDivElement> { | ||
/** | ||
@@ -53,15 +86,30 @@ * The margin of each alert | ||
/** | ||
* The z-index of alerts | ||
* The style of the alert container | ||
* | ||
* Default value: 100 | ||
* Default z-index value: 100 | ||
*/ | ||
zIndex?: number; | ||
containerStyle?: React.CSSProperties; | ||
/** | ||
* The alert component for each message | ||
*/ | ||
template: React.ComponentType<AlertComponentPropsWithStyle>; | ||
/** | ||
* Custom context to separate alerts. | ||
*/ | ||
context?: React.Context<AlertManager | undefined>; | ||
} | ||
export class Provider extends React.Component<ProviderOptions & { | ||
template: React.ComponentType | ||
}> {} | ||
export interface AlertComponentProps { | ||
id: string; | ||
message: React.ReactNode; | ||
options: AlertCustomOptionsWithType; | ||
close(): void; | ||
} | ||
export const Alert: React.Consumer<InjectedAlertProp>; | ||
export interface AlertComponentPropsWithStyle extends AlertComponentProps { | ||
style: React.CSSProperties; | ||
} | ||
export class Provider extends React.Component<AlertProviderProps> {} | ||
export interface AlertCustomOptions { | ||
@@ -75,7 +123,7 @@ /** | ||
*/ | ||
onOpen?(): undefined; | ||
onOpen?(): void; | ||
/** | ||
* Callback that will be executed after this alert is removed | ||
*/ | ||
onClose?(): undefined; | ||
onClose?(): void; | ||
} | ||
@@ -87,15 +135,19 @@ | ||
export interface InjectedAlertProp { | ||
export interface AlertManager { | ||
root?: HTMLElement; | ||
alerts: AlertComponentProps[]; | ||
show( | ||
message?: string, | ||
message?: React.ReactNode, | ||
options?: AlertCustomOptionsWithType | ||
): InjectedAlertProp; | ||
remove(alert: InjectedAlertProp): undefined; | ||
success(message?: string, options?: AlertCustomOptions): InjectedAlertProp; | ||
error(message?: string, options?: AlertCustomOptions): InjectedAlertProp; | ||
info(message?: string, options?: AlertCustomOptions): InjectedAlertProp; | ||
): AlertComponentProps; | ||
remove(alert: AlertComponentProps): void; | ||
success(message?: React.ReactNode, options?: AlertCustomOptions): AlertComponentProps; | ||
error(message?: React.ReactNode, options?: AlertCustomOptions): AlertComponentProps; | ||
info(message?: React.ReactNode, options?: AlertCustomOptions): AlertComponentProps; | ||
} | ||
export function withAlert<P extends { alert: InjectedAlertProp }>( | ||
c: React.ComponentType<P> | ||
): React.ComponentType<Pick<P, Exclude<keyof P, 'alert'>>>; | ||
export function withAlert<P extends { alert: AlertManager }>(context?: React.Context<AlertManager | undefined>): | ||
(c: React.ComponentType<P>) => | ||
React.ComponentType<Pick<P, Exclude<keyof P, 'alert'>>>; | ||
export function useAlert(context?: React.Context<AlertManager | undefined>): AlertManager; |
{ | ||
"name": "@types/react-alert", | ||
"version": "4.0.0", | ||
"version": "5.2.0", | ||
"description": "TypeScript definitions for react-alert", | ||
@@ -14,6 +14,7 @@ "license": "MIT", | ||
"main": "", | ||
"types": "", | ||
"types": "index", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/react-alert" | ||
}, | ||
@@ -24,4 +25,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "be21d9a0459e5fdb0b9756452020221ad78c2c89a7abce916e472e208b6caa17", | ||
"typesPublisherContentHash": "1133a596257d282daa2af24f15c59105397a68dc9b0f7d264d60f870d9aa9f23", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -5,3 +5,3 @@ # Installation | ||
# Summary | ||
This package contains type definitions for react-alert (https://github.com/schiehll/react-alert). | ||
This package contains type definitions for react-alert ( https://github.com/schiehll/react-alert ). | ||
@@ -12,4 +12,4 @@ # Details | ||
Additional Details | ||
* Last updated: Mon, 05 Nov 2018 06:15:34 GMT | ||
* Dependencies: react | ||
* Last updated: Wed, 20 Mar 2019 17:54:34 GMT | ||
* Dependencies: @types/react | ||
* Global values: none | ||
@@ -16,0 +16,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6269
130
0