@adaptabletools/adaptable 12.1.0 → 12.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle.cjs.js +99 -99
- package/package.json +1 -1
- package/publishTimestamp.d.ts +1 -1
- package/publishTimestamp.js +1 -1
- package/src/Utilities/ObjectFactory.d.ts +1 -1
- package/src/Utilities/ObjectFactory.js +11 -11
- package/src/Utilities/Services/MetamodelService.js +2 -1
- package/src/View/AdaptableView.js +2 -2
- package/src/View/Components/Popups/AdaptableToaster.js +7 -7
- package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
- package/src/agGrid/Adaptable.js +2 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/CloseButton.d.ts +9 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/Icons.d.ts +24 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/ProgressBar.d.ts +59 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/Toast.d.ts +3 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/ToastContainer.d.ts +3 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/Transitions.d.ts +6 -0
- package/src/bundle-dependencies/bundles/react-toastify/components/index.d.ts +6 -0
- package/src/bundle-dependencies/bundles/react-toastify/core/eventManager.d.ts +39 -0
- package/src/bundle-dependencies/bundles/react-toastify/core/index.d.ts +2 -0
- package/src/bundle-dependencies/bundles/react-toastify/core/toast.d.ts +41 -0
- package/src/bundle-dependencies/bundles/react-toastify/hooks/index.d.ts +2 -0
- package/src/bundle-dependencies/bundles/react-toastify/hooks/useToast.d.ts +10 -0
- package/src/bundle-dependencies/bundles/react-toastify/hooks/useToastContainer.d.ts +23 -0
- package/src/bundle-dependencies/bundles/react-toastify/index.d.ts +5 -0
- package/src/bundle-dependencies/bundles/react-toastify/index.js +1 -0
- package/src/bundle-dependencies/bundles/react-toastify/inject-style.d.ts +8 -0
- package/src/bundle-dependencies/bundles/react-toastify/types/index.d.ts +269 -0
- package/src/bundle-dependencies/bundles/react-toastify/utils/collapseToast.d.ts +5 -0
- package/src/bundle-dependencies/bundles/react-toastify/utils/constant.d.ts +23 -0
- package/src/bundle-dependencies/bundles/react-toastify/utils/cssTransition.d.ts +43 -0
- package/src/bundle-dependencies/bundles/react-toastify/utils/index.d.ts +5 -0
- package/src/bundle-dependencies/bundles/react-toastify/utils/mapper.d.ts +2 -0
- package/src/bundle-dependencies/bundles/react-toastify/utils/propValidator.d.ts +9 -0
- package/src/components/Toastify/index.d.ts +3 -0
- package/src/components/Toastify/index.js +10 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.2",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 datagrid add-on that sits on top of an underlying grid component and provides all the rich functionality that advanced users expect from their DataGrids and Data Tables",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/publishTimestamp.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default:
|
|
1
|
+
declare const _default: 1658831451551;
|
|
2
2
|
export default _default;
|
package/publishTimestamp.js
CHANGED
|
@@ -27,7 +27,7 @@ import { CellSummmary } from '../PredefinedConfig/Common/CellSummary';
|
|
|
27
27
|
import { ColumnFilter, CustomDisplayFormatterContext, FlashingCellDefinition, GridDataChangedInfo, SystemFilterPredicateId } from '../types';
|
|
28
28
|
import { RowNode } from '@ag-grid-community/all-modules';
|
|
29
29
|
import { AdaptableApi } from '../../types';
|
|
30
|
-
import
|
|
30
|
+
import { ToastOptions } from '../components/Toastify';
|
|
31
31
|
export declare function CreateEmptyCustomSort(): CustomSort;
|
|
32
32
|
export declare function CreateEmptyCalculatedColumn(isFilterable: boolean): CalculatedColumn;
|
|
33
33
|
export declare function CreateEmptyNamedQuery(expression?: string): NamedQuery;
|
|
@@ -4,7 +4,7 @@ exports.ObjectFactory = exports.CreateToastOptions = exports.CreateCustomDisplay
|
|
|
4
4
|
const Enums_1 = require("../PredefinedConfig/Common/Enums");
|
|
5
5
|
const GeneralConstants_1 = require("./Constants/GeneralConstants");
|
|
6
6
|
const Uuid_1 = require("../PredefinedConfig/Uuid");
|
|
7
|
-
const
|
|
7
|
+
const Toastify_1 = require("../components/Toastify");
|
|
8
8
|
function CreateEmptyCustomSort() {
|
|
9
9
|
return { Uuid: Uuid_1.createUuid(), ColumnId: GeneralConstants_1.EMPTY_STRING, SortedValues: [] };
|
|
10
10
|
}
|
|
@@ -393,29 +393,29 @@ exports.CreateToastOptions = CreateToastOptions;
|
|
|
393
393
|
function getToastPosition(position) {
|
|
394
394
|
switch (position) {
|
|
395
395
|
case 'BottomLeft':
|
|
396
|
-
return toast.POSITION.BOTTOM_LEFT;
|
|
396
|
+
return Toastify_1.toast.POSITION.BOTTOM_LEFT;
|
|
397
397
|
case 'BottomCenter':
|
|
398
|
-
return toast.POSITION.BOTTOM_CENTER;
|
|
398
|
+
return Toastify_1.toast.POSITION.BOTTOM_CENTER;
|
|
399
399
|
case 'BottomRight':
|
|
400
|
-
return toast.POSITION.BOTTOM_RIGHT;
|
|
400
|
+
return Toastify_1.toast.POSITION.BOTTOM_RIGHT;
|
|
401
401
|
case 'TopLeft':
|
|
402
|
-
return toast.POSITION.TOP_LEFT;
|
|
402
|
+
return Toastify_1.toast.POSITION.TOP_LEFT;
|
|
403
403
|
case 'TopCenter':
|
|
404
|
-
return toast.POSITION.TOP_CENTER;
|
|
404
|
+
return Toastify_1.toast.POSITION.TOP_CENTER;
|
|
405
405
|
case 'TopRight':
|
|
406
|
-
return toast.POSITION.TOP_RIGHT;
|
|
406
|
+
return Toastify_1.toast.POSITION.TOP_RIGHT;
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
function getToastTransition(transition) {
|
|
410
410
|
switch (transition) {
|
|
411
411
|
case 'Bounce':
|
|
412
|
-
return Bounce;
|
|
412
|
+
return Toastify_1.Bounce;
|
|
413
413
|
case 'Slide':
|
|
414
|
-
return Slide;
|
|
414
|
+
return Toastify_1.Slide;
|
|
415
415
|
case 'Zoom':
|
|
416
|
-
return Zoom;
|
|
416
|
+
return Toastify_1.Zoom;
|
|
417
417
|
case 'Flip':
|
|
418
|
-
return Flip;
|
|
418
|
+
return Toastify_1.Flip;
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
exports.ObjectFactory = {
|
|
@@ -46,7 +46,8 @@ class MetamodelService {
|
|
|
46
46
|
}
|
|
47
47
|
validateOptionsObject(validationErrors, optionsObjectName, optionsObject, optionsObjectMetamodel, optionsObjectDefaultValues) {
|
|
48
48
|
Object.entries(optionsObject).forEach(([optionKey, optionValue]) => {
|
|
49
|
-
|
|
49
|
+
var _a;
|
|
50
|
+
const optionMetamodel = (_a = optionsObjectMetamodel === null || optionsObjectMetamodel === void 0 ? void 0 : optionsObjectMetamodel.properties) === null || _a === void 0 ? void 0 : _a.find((metamodelProperty) => metamodelProperty.name === optionKey);
|
|
50
51
|
if (!optionMetamodel) {
|
|
51
52
|
validationErrors.push(`${optionsObjectName}.${optionKey} (value=${optionValue}) :: unknown/unsupported property, will be ignored`);
|
|
52
53
|
return;
|
|
@@ -15,7 +15,7 @@ const License_1 = require("./License");
|
|
|
15
15
|
const ProgressIndicator_1 = require("../components/ProgressIndicator/ProgressIndicator");
|
|
16
16
|
const WindowPopups_1 = require("./Components/Popups/WindowPopups/WindowPopups");
|
|
17
17
|
const FormPopups_1 = require("./Components/Popups/FormPopups/FormPopups");
|
|
18
|
-
const
|
|
18
|
+
const Toastify_1 = require("../components/Toastify");
|
|
19
19
|
class AdaptableView extends React.Component {
|
|
20
20
|
render() {
|
|
21
21
|
var _a, _b, _c, _d;
|
|
@@ -27,7 +27,7 @@ class AdaptableView extends React.Component {
|
|
|
27
27
|
this.props.PopupState.PromptPopup.ShowPromptPopup && (React.createElement(AdaptablePopupPrompt_1.AdaptablePopupPrompt, { message: this.props.PopupState.PromptPopup.Message, header: this.props.PopupState.PromptPopup.Header, onClose: this.props.onClosePromptPopup, onConfirm: this.props.onConfirmPromptPopup, onConfirmActionCreator: this.props.PopupState.PromptPopup.ConfirmActionCreator, defaultValue: this.props.PopupState.PromptPopup.DefaultValue })),
|
|
28
28
|
React.createElement(AdaptablePopupConfirmation_1.AdaptablePopupConfirmation, { header: this.props.PopupState.ConfirmationPopup.Header, messsage: this.props.PopupState.ConfirmationPopup.Msg, showPopup: this.props.PopupState.ConfirmationPopup.ShowConfirmationPopup, cancelButtonText: this.props.PopupState.ConfirmationPopup.CancelButtonText, confirmButtonText: this.props.PopupState.ConfirmationPopup.ConfirmButtonText, onCancel: this.props.onCancelConfirmationPopup, onConfirm: this.props.onConfirmConfirmationPopup, showInputBox: this.props.PopupState.ConfirmationPopup.ShowInputBox, messageType: this.props.PopupState.ConfirmationPopup.MessageType, api: this.props.AdaptableApi }),
|
|
29
29
|
Boolean(this.props.PopupState.ScreenPopup.ShowScreenPopup) && (React.createElement(AdaptablePopup_1.AdaptablePopup, { componentName: this.props.PopupState.ScreenPopup.ComponentName, componentModule: this.props.PopupState.ScreenPopup.ComponentModule, onHide: this.props.onCloseScreenPopup, api: this.props.AdaptableApi, onClearParams: () => this.props.onClearPopupParams(), moduleParams: this.props.PopupState.ScreenPopup.Params, moduleProps: this.props.PopupState.ScreenPopup.PopupProps })),
|
|
30
|
-
React.createElement(ToastContainer
|
|
30
|
+
React.createElement(Toastify_1.ToastContainer
|
|
31
31
|
// we NEEEEED!!!! this containerId, otherwise, toastify will have memory leaks when the adaptable
|
|
32
32
|
// instance is destroyed and re-created many times
|
|
33
33
|
, {
|
|
@@ -5,13 +5,13 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const ObjectFactory_1 = tslib_1.__importDefault(require("../../../Utilities/ObjectFactory"));
|
|
7
7
|
const AdaptablePopupAlert_1 = require("./AdaptablePopupAlert");
|
|
8
|
-
const
|
|
8
|
+
const Toastify_1 = require("../../../components/Toastify");
|
|
9
9
|
const showToast = (props) => {
|
|
10
10
|
// we're doing this hack and not simply using props.api in order not to have a memory
|
|
11
11
|
// leak where the api is still kept around in memory by the toaster
|
|
12
12
|
let api = props.api;
|
|
13
13
|
const off = api.eventApi.on('AdaptableDestroy', () => {
|
|
14
|
-
toast.dismiss(toastId);
|
|
14
|
+
Toastify_1.toast.dismiss(toastId);
|
|
15
15
|
api = null;
|
|
16
16
|
});
|
|
17
17
|
const adaptableOptions = props.api.internalApi.getAdaptableOptions();
|
|
@@ -27,21 +27,21 @@ const showToast = (props) => {
|
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
const content = (React.createElement(AdaptablePopupAlert_1.AdaptablePopupAlert, { headless: true, adaptableAlert: props.adaptableAlert, onClose: () => {
|
|
30
|
-
toast.dismiss(toastId);
|
|
30
|
+
Toastify_1.toast.dismiss(toastId);
|
|
31
31
|
} }));
|
|
32
32
|
let toastId;
|
|
33
33
|
switch (props.adaptableAlert.alertDefinition.MessageType) {
|
|
34
34
|
case 'Info':
|
|
35
|
-
toastId = toast.info(content, toastProps);
|
|
35
|
+
toastId = Toastify_1.toast.info(content, toastProps);
|
|
36
36
|
break;
|
|
37
37
|
case 'Error':
|
|
38
|
-
toastId = toast.error(content, toastProps);
|
|
38
|
+
toastId = Toastify_1.toast.error(content, toastProps);
|
|
39
39
|
break;
|
|
40
40
|
case 'Success':
|
|
41
|
-
toastId = toast.success(content, toastProps);
|
|
41
|
+
toastId = Toastify_1.toast.success(content, toastProps);
|
|
42
42
|
break;
|
|
43
43
|
case 'Warning':
|
|
44
|
-
toastId = toast.warn(content, toastProps);
|
|
44
|
+
toastId = Toastify_1.toast.warn(content, toastProps);
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
@@ -214,7 +214,7 @@ const ColumnsSection = (props) => {
|
|
|
214
214
|
React.createElement(ColumnLabels_1.ColumnLabels, { flexDirection: "row", showBoth: false, labels: {
|
|
215
215
|
Sortable: 'Sortable',
|
|
216
216
|
Filterable: 'Filterable',
|
|
217
|
-
Aggregatable: '
|
|
217
|
+
Aggregatable: 'Aggregatable',
|
|
218
218
|
Groupable: 'Groupable',
|
|
219
219
|
Moveable: 'Moveable',
|
|
220
220
|
Pivotable: 'Pivotable',
|
package/src/agGrid/Adaptable.js
CHANGED
|
@@ -2528,6 +2528,8 @@ class Adaptable {
|
|
|
2528
2528
|
this.listenerGlobalColumnEventsThatTriggerStateChange = null;
|
|
2529
2529
|
this.listenerGlobalColumnEventsThatTriggerAutoLayoutSave = null;
|
|
2530
2530
|
this.listenerGlobalRowGroupEventsThatTriggerAutoLayoutSave = null;
|
|
2531
|
+
this.throttleFilterOnEditDataChange = null;
|
|
2532
|
+
this.throttleFilterOnTickingDataChange = null;
|
|
2531
2533
|
this.gridOptions.api.__adaptable = null;
|
|
2532
2534
|
this.gridOptions.api.setColumnDefs = GridApi_setColumnDefs;
|
|
2533
2535
|
this.gridOptions.getRowStyle = null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme, TypeOptions } from '../types';
|
|
3
|
+
export interface CloseButtonProps {
|
|
4
|
+
closeToast: (e: React.MouseEvent<HTMLElement>) => void;
|
|
5
|
+
type: TypeOptions;
|
|
6
|
+
ariaLabel?: string;
|
|
7
|
+
theme: Theme;
|
|
8
|
+
}
|
|
9
|
+
export declare function CloseButton({ closeToast, theme, ariaLabel }: CloseButtonProps): JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme, ToastProps, TypeOptions } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Used when providing custom icon
|
|
5
|
+
*/
|
|
6
|
+
export interface IconProps {
|
|
7
|
+
theme: Theme;
|
|
8
|
+
type: TypeOptions;
|
|
9
|
+
}
|
|
10
|
+
export declare type BuiltInIconProps = React.SVGProps<SVGSVGElement> & IconProps;
|
|
11
|
+
declare function Warning(props: BuiltInIconProps): JSX.Element;
|
|
12
|
+
declare function Info(props: BuiltInIconProps): JSX.Element;
|
|
13
|
+
declare function Success(props: BuiltInIconProps): JSX.Element;
|
|
14
|
+
declare function Error(props: BuiltInIconProps): JSX.Element;
|
|
15
|
+
declare function Spinner(): JSX.Element;
|
|
16
|
+
export declare const Icons: {
|
|
17
|
+
info: typeof Info;
|
|
18
|
+
warning: typeof Warning;
|
|
19
|
+
success: typeof Success;
|
|
20
|
+
error: typeof Error;
|
|
21
|
+
spinner: typeof Spinner;
|
|
22
|
+
};
|
|
23
|
+
export declare function getIcon({ theme, type, isLoading, icon }: ToastProps): React.ReactNode;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypeOptions, ToastClassName, Theme } from '../types';
|
|
3
|
+
export interface ProgressBarProps {
|
|
4
|
+
/**
|
|
5
|
+
* The animation delay which determine when to close the toast
|
|
6
|
+
*/
|
|
7
|
+
delay: number;
|
|
8
|
+
/**
|
|
9
|
+
* Whether or not the animation is running or paused
|
|
10
|
+
*/
|
|
11
|
+
isRunning: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Func to close the current toast
|
|
14
|
+
*/
|
|
15
|
+
closeToast: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Optional type : info, success ...
|
|
18
|
+
*/
|
|
19
|
+
type: TypeOptions;
|
|
20
|
+
/**
|
|
21
|
+
* The theme that is currently used
|
|
22
|
+
*/
|
|
23
|
+
theme: Theme;
|
|
24
|
+
/**
|
|
25
|
+
* Hide or not the progress bar
|
|
26
|
+
*/
|
|
27
|
+
hide?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Optionnal className
|
|
30
|
+
*/
|
|
31
|
+
className?: ToastClassName;
|
|
32
|
+
/**
|
|
33
|
+
* Optionnal inline style
|
|
34
|
+
*/
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
/**
|
|
37
|
+
* Tell wether or not controlled progress bar is used
|
|
38
|
+
*/
|
|
39
|
+
controlledProgress?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Controlled progress value
|
|
42
|
+
*/
|
|
43
|
+
progress?: number | string;
|
|
44
|
+
/**
|
|
45
|
+
* Support rtl content
|
|
46
|
+
*/
|
|
47
|
+
rtl?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Tell if the component is visible on screen or not
|
|
50
|
+
*/
|
|
51
|
+
isIn?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function ProgressBar({ delay, isRunning, closeToast, type, hide, className, style: userStyle, controlledProgress, progress, rtl, isIn, theme }: ProgressBarProps): JSX.Element;
|
|
54
|
+
export declare namespace ProgressBar {
|
|
55
|
+
var defaultProps: {
|
|
56
|
+
type: TypeOptions;
|
|
57
|
+
hide: boolean;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const Bounce: ({ children, position, preventExitTransition, done, nodeRef, isIn }: import("..").ToastTransitionProps) => JSX.Element;
|
|
3
|
+
declare const Slide: ({ children, position, preventExitTransition, done, nodeRef, isIn }: import("..").ToastTransitionProps) => JSX.Element;
|
|
4
|
+
declare const Zoom: ({ children, position, preventExitTransition, done, nodeRef, isIn }: import("..").ToastTransitionProps) => JSX.Element;
|
|
5
|
+
declare const Flip: ({ children, position, preventExitTransition, done, nodeRef, isIn }: import("..").ToastTransitionProps) => JSX.Element;
|
|
6
|
+
export { Bounce, Slide, Zoom, Flip };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Id, ToastContent, ClearWaitingQueueParams, NotValidatedToastProps, ToastItem } from '../types';
|
|
3
|
+
import { ContainerInstance } from '../hooks';
|
|
4
|
+
export declare const enum Event {
|
|
5
|
+
Show = 0,
|
|
6
|
+
Clear = 1,
|
|
7
|
+
DidMount = 2,
|
|
8
|
+
WillUnmount = 3,
|
|
9
|
+
Change = 4,
|
|
10
|
+
ClearWaitingQueue = 5
|
|
11
|
+
}
|
|
12
|
+
declare type OnShowCallback = (content: ToastContent, options: NotValidatedToastProps) => void;
|
|
13
|
+
declare type OnClearCallback = (id?: Id) => void;
|
|
14
|
+
declare type OnClearWaitingQueue = (params: ClearWaitingQueueParams) => void;
|
|
15
|
+
declare type OnDidMountCallback = (containerInstance: ContainerInstance) => void;
|
|
16
|
+
declare type OnWillUnmountCallback = OnDidMountCallback;
|
|
17
|
+
export declare type OnChangeCallback = (toast: ToastItem) => void;
|
|
18
|
+
declare type Callback = OnShowCallback | OnClearCallback | OnClearWaitingQueue | OnDidMountCallback | OnWillUnmountCallback | OnChangeCallback;
|
|
19
|
+
declare type TimeoutId = ReturnType<typeof setTimeout>;
|
|
20
|
+
export interface EventManager {
|
|
21
|
+
list: Map<Event, Callback[]>;
|
|
22
|
+
emitQueue: Map<Event, TimeoutId[]>;
|
|
23
|
+
on(event: Event.Show, callback: OnShowCallback): EventManager;
|
|
24
|
+
on(event: Event.Clear, callback: OnClearCallback): EventManager;
|
|
25
|
+
on(event: Event.ClearWaitingQueue, callback: OnClearWaitingQueue): EventManager;
|
|
26
|
+
on(event: Event.DidMount, callback: OnDidMountCallback): EventManager;
|
|
27
|
+
on(event: Event.WillUnmount, callback: OnWillUnmountCallback): EventManager;
|
|
28
|
+
on(event: Event.Change, callback: OnChangeCallback): EventManager;
|
|
29
|
+
off(event: Event, callback?: Callback): EventManager;
|
|
30
|
+
cancelEmit(event: Event): EventManager;
|
|
31
|
+
emit(event: Event.Show, content: React.ReactNode, options: NotValidatedToastProps): void;
|
|
32
|
+
emit(event: Event.Clear, id?: string | number): void;
|
|
33
|
+
emit(event: Event.ClearWaitingQueue, params: ClearWaitingQueueParams): void;
|
|
34
|
+
emit(event: Event.DidMount, containerInstance: ContainerInstance): void;
|
|
35
|
+
emit(event: Event.WillUnmount, containerInstance: ContainerInstance): void;
|
|
36
|
+
emit(event: Event.Change, data: ToastItem): void;
|
|
37
|
+
}
|
|
38
|
+
export declare const eventManager: EventManager;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { OnChangeCallback } from './eventManager';
|
|
2
|
+
import { ToastContent, ToastOptions, Id, UpdateOptions, ClearWaitingQueueParams, TypeOptions } from '../types';
|
|
3
|
+
declare function toast(content: ToastContent, options?: ToastOptions): Id;
|
|
4
|
+
declare namespace toast {
|
|
5
|
+
var loading: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
6
|
+
var promise: typeof handlePromise;
|
|
7
|
+
var success: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
8
|
+
var info: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
9
|
+
var error: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
10
|
+
var warning: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
11
|
+
var warn: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
12
|
+
var dark: (content: ToastContent<unknown>, options?: ToastOptions<{}> | undefined) => Id;
|
|
13
|
+
var dismiss: (id?: Id | undefined) => void;
|
|
14
|
+
var clearWaitingQueue: (params?: ClearWaitingQueueParams) => void;
|
|
15
|
+
var isActive: (id: Id) => boolean;
|
|
16
|
+
var update: (toastId: Id, options?: UpdateOptions<unknown>) => void;
|
|
17
|
+
var done: (id: Id) => void;
|
|
18
|
+
var onChange: (callback: OnChangeCallback) => () => void;
|
|
19
|
+
var POSITION: {
|
|
20
|
+
TOP_LEFT: import("../types").ToastPosition;
|
|
21
|
+
TOP_RIGHT: import("../types").ToastPosition;
|
|
22
|
+
TOP_CENTER: import("../types").ToastPosition;
|
|
23
|
+
BOTTOM_LEFT: import("../types").ToastPosition;
|
|
24
|
+
BOTTOM_RIGHT: import("../types").ToastPosition;
|
|
25
|
+
BOTTOM_CENTER: import("../types").ToastPosition;
|
|
26
|
+
};
|
|
27
|
+
var TYPE: {
|
|
28
|
+
INFO: TypeOptions;
|
|
29
|
+
SUCCESS: TypeOptions;
|
|
30
|
+
WARNING: TypeOptions;
|
|
31
|
+
ERROR: TypeOptions;
|
|
32
|
+
DEFAULT: TypeOptions;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface ToastPromiseParams<T = unknown> {
|
|
36
|
+
pending?: string | UpdateOptions<void>;
|
|
37
|
+
success?: string | UpdateOptions<T>;
|
|
38
|
+
error?: string | UpdateOptions<any>;
|
|
39
|
+
}
|
|
40
|
+
declare function handlePromise<T = unknown>(promise: Promise<T> | (() => Promise<T>), { pending, error, success }: ToastPromiseParams<T>, options?: ToastOptions): Promise<T>;
|
|
41
|
+
export { toast };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DOMAttributes } from 'react';
|
|
2
|
+
import { ToastProps } from '../types';
|
|
3
|
+
export declare function useToast(props: ToastProps): {
|
|
4
|
+
playToast: () => void;
|
|
5
|
+
pauseToast: () => void;
|
|
6
|
+
isRunning: boolean;
|
|
7
|
+
preventExitTransition: boolean;
|
|
8
|
+
toastRef: import("react").RefObject<HTMLDivElement>;
|
|
9
|
+
eventHandlers: DOMAttributes<HTMLElement>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Id, ToastContainerProps, ToastProps, ToastContent, Toast, ToastPosition } from '../types';
|
|
3
|
+
interface QueuedToast {
|
|
4
|
+
toastContent: ToastContent;
|
|
5
|
+
toastProps: ToastProps;
|
|
6
|
+
staleId?: Id;
|
|
7
|
+
}
|
|
8
|
+
export interface ContainerInstance {
|
|
9
|
+
toastKey: number;
|
|
10
|
+
displayedToast: number;
|
|
11
|
+
props: ToastContainerProps;
|
|
12
|
+
containerId?: Id | null;
|
|
13
|
+
isToastActive: (toastId: Id) => boolean;
|
|
14
|
+
getToast: (id: Id) => Toast | null | undefined;
|
|
15
|
+
queue: QueuedToast[];
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function useToastContainer(props: ToastContainerProps): {
|
|
19
|
+
getToastToRender: <T>(cb: (position: ToastPosition, toastList: Toast[]) => T) => T[];
|
|
20
|
+
containerRef: import("react").MutableRefObject<null>;
|
|
21
|
+
isToastActive: (id: Id) => boolean;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useToastContainer, useToast } from './hooks';
|
|
2
|
+
export { cssTransition, collapseToast } from './utils';
|
|
3
|
+
export { ToastContainer, Bounce, Flip, Slide, Zoom, Icons, IconProps, CloseButtonProps } from './components';
|
|
4
|
+
export { toast, ToastPromiseParams } from './core';
|
|
5
|
+
export { TypeOptions, Theme, ToastPosition, ToastContentProps, ToastContent, ToastTransition, ToastClassName, ClearWaitingQueueParams, DraggableDirection, ToastOptions, UpdateOptions, ToastContainerProps, ToastTransitionProps, Id, ToastItem } from './types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Le=Object.defineProperty,Re=Object.defineProperties;var Pe=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var de=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))ce.call(t,n)&&de(e,n,t[n]);if(K)for(var n of K(t))ue.call(t,n)&&de(e,n,t[n]);return e},S=(e,t)=>Re(e,Pe(t));var ne=(e,t)=>{var n={};for(var o in e)ce.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&K)for(var o of K(e))t.indexOf(o)<0&&ue.call(e,o)&&(n[o]=e[o]);return n};var xe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ge=xe((Xe,se)=>{function fe(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=fe(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}function me(){for(var e,t,n=0,o="";n<arguments.length;)(e=arguments[n++])&&(t=fe(e))&&(o&&(o+=" "),o+=t);return o}se.exports=me,se.exports.clsx=me});var f=require("react"),Be=ge();function ye(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var g=ye(f),w=ye(Be);function W(e){return typeof e=="number"&&!isNaN(e)}function G(e){return typeof e=="boolean"}function A(e){return typeof e=="string"}function B(e){return typeof e=="function"}function Z(e){return A(e)||B(e)?e:null}function oe(e){return e===0||e}function De(e,t){return e===!1||W(e)&&e>0?e:t}function ae(e){return f.isValidElement(e)||A(e)||B(e)||W(e)}var Te={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},k={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"};function pe(e,t,n){n===void 0&&(n=300);let{scrollHeight:o,style:c}=e;requestAnimationFrame(()=>{c.minHeight="initial",c.height=o+"px",c.transition="all "+n+"ms",requestAnimationFrame(()=>{c.height="0",c.padding="0",c.margin="0",setTimeout(t,n)})})}function Y(e){let{enter:t,exit:n,appendPosition:o=!1,collapse:c=!0,collapseDuration:i=300}=e;return function(l){let{children:L,position:v,preventExitTransition:E,done:p,nodeRef:I,isIn:b}=l,_=o?t+"--"+v:t,r=o?n+"--"+v:n,d=f.useRef(),C=f.useRef(0);f.useLayoutEffect(()=>{O()},[]),f.useEffect(()=>{b||(E?P():R())},[b]);function O(){let y=I.current;d.current=y.className,y.className+=" "+_,y.addEventListener("animationend",a),y.addEventListener("animationcancel",a)}function a(y){if(y.target!==I.current)return;let u=I.current;u.dispatchEvent(new Event("d")),u.removeEventListener("animationend",a),u.removeEventListener("animationcancel",a),C.current===0&&y.type!=="animationcancel"&&(u.className=d.current)}function R(){C.current=1;let y=I.current;y.className+=" "+r,y.addEventListener("animationend",P)}function P(){let y=I.current;y.removeEventListener("animationend",P),c?pe(y,p,i):p()}return g.default.createElement(g.default.Fragment,null,L)}}function he(e,t){return{content:e.content,containerId:e.props.containerId,id:e.props.toastId,theme:e.props.theme,type:e.props.type,data:e.props.data||{},isLoading:e.props.isLoading,icon:e.props.icon,status:t}}var D={list:new Map,emitQueue:new Map,on(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off(e,t){if(t){let n=this.list.get(e).filter(o=>o!==t);return this.list.set(e,n),this}return this.list.delete(e),this},cancelEmit(e){let t=this.emitQueue.get(e);return t&&(t.forEach(clearTimeout),this.emitQueue.delete(e)),this},emit(e){this.list.has(e)&&this.list.get(e).forEach(t=>{let n=setTimeout(()=>{t(...[].slice.call(arguments,1))},0);this.emitQueue.has(e)||this.emitQueue.set(e,[]),this.emitQueue.get(e).push(n)})}},J=e=>{let c=e,{theme:t,type:n}=c,o=ne(c,["theme","type"]);return g.default.createElement("svg",m({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:t==="colored"?"currentColor":"var(--toastify-icon-color-"+n+")"},o))};function Se(e){return g.default.createElement(J,m({},e),g.default.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function Me(e){return g.default.createElement(J,m({},e),g.default.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function ke(e){return g.default.createElement(J,m({},e),g.default.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function we(e){return g.default.createElement(J,m({},e),g.default.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function Fe(){return g.default.createElement("div",{className:"Toastify__spinner"})}var $={info:Me,warning:Se,success:ke,error:we,spinner:Fe},Ae=e=>e in $;function ze(e){let{theme:t,type:n,isLoading:o,icon:c}=e,i=null,s={theme:t,type:n};return c===!1||(B(c)?i=c(s):f.isValidElement(c)?i=f.cloneElement(c,s):A(c)||W(c)?i=c:o?i=$.spinner():Ae(n)&&(i=$[n](s))),i}function Ee(e){let[,t]=f.useReducer(r=>r+1,0),[n,o]=f.useState([]),c=f.useRef(null),i=f.useRef(new Map).current,s=r=>n.indexOf(r)!==-1,l=f.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:r=>i.get(r)}).current;f.useEffect(()=>(l.containerId=e.containerId,D.cancelEmit(3).on(0,I).on(1,r=>c.current&&v(r)).on(5,L).emit(2,l),()=>{i.clear(),c.current=null,D.off(1),D.emit(3,l)}),[]),f.useEffect(()=>{l.props=e,l.isToastActive=s,l.displayedToast=n.length});function L(r){let{containerId:d}=r,{limit:C}=l.props;C&&(!d||l.containerId===d)&&(l.count-=l.queue.length,l.queue=[])}function v(r){o(d=>oe(r)?d.filter(C=>C!==r):[])}function E(){let{toastContent:r,toastProps:d,staleId:C}=l.queue.shift();b(r,d,C)}function p(r){return!c.current||l.props.enableMultiContainer&&r.containerId!==l.props.containerId||i.has(r.toastId)&&r.updateId==null}function I(r,d){let U=d,{delay:C,staleId:O}=U,a=ne(U,["delay","staleId"]);if(!ae(r)||p(a))return;let{toastId:R,updateId:P,data:y}=a,{props:u}=l,T=()=>v(R),x=P==null;x&&l.count++;let N={toastId:R,updateId:P,data:y,containerId:a.containerId,isLoading:a.isLoading,theme:a.theme||u.theme,icon:a.icon!=null?a.icon:u.icon,isIn:!1,key:a.key||l.toastKey++,type:a.type,closeToast:T,closeButton:a.closeButton,rtl:u.rtl,position:a.position||u.position,transition:a.transition||u.transition,className:Z(a.className||u.toastClassName),bodyClassName:Z(a.bodyClassName||u.bodyClassName),style:a.style||u.toastStyle,bodyStyle:a.bodyStyle||u.bodyStyle,onClick:a.onClick||u.onClick,pauseOnHover:G(a.pauseOnHover)?a.pauseOnHover:u.pauseOnHover,pauseOnFocusLoss:G(a.pauseOnFocusLoss)?a.pauseOnFocusLoss:u.pauseOnFocusLoss,draggable:G(a.draggable)?a.draggable:u.draggable,draggablePercent:a.draggablePercent||u.draggablePercent,draggableDirection:a.draggableDirection||u.draggableDirection,closeOnClick:G(a.closeOnClick)?a.closeOnClick:u.closeOnClick,progressClassName:Z(a.progressClassName||u.progressClassName),progressStyle:a.progressStyle||u.progressStyle,autoClose:a.isLoading?!1:De(a.autoClose,u.autoClose),hideProgressBar:G(a.hideProgressBar)?a.hideProgressBar:u.hideProgressBar,progress:a.progress,role:a.role||u.role,deleteToast(){let Q=he(i.get(R),"removed");i.delete(R),D.emit(4,Q);let F=l.queue.length;if(l.count=oe(R)?l.count-1:l.count-l.displayedToast,l.count<0&&(l.count=0),F>0){let V=oe(R)?1:l.props.limit;if(F===1||V===1)l.displayedToast++,E();else{let z=V>F?F:V;l.displayedToast=z;for(let H=0;H<z;H++)E()}}else t()}};N.iconOut=ze(N),B(a.onOpen)&&(N.onOpen=a.onOpen),B(a.onClose)&&(N.onClose=a.onClose),N.closeButton=u.closeButton,a.closeButton===!1||ae(a.closeButton)?N.closeButton=a.closeButton:a.closeButton===!0&&(N.closeButton=ae(u.closeButton)?u.closeButton:!0);let M=r;f.isValidElement(r)&&!A(r.type)?M=f.cloneElement(r,{closeToast:T,toastProps:N,data:y}):B(r)&&(M=r({closeToast:T,toastProps:N,data:y})),u.limit&&u.limit>0&&l.count>u.limit&&x?l.queue.push({toastContent:M,toastProps:N,staleId:O}):W(C)?setTimeout(()=>{b(M,N,O)},C):b(M,N,O)}function b(r,d,C){let{toastId:O}=d;C&&i.delete(C);let a={content:r,props:d};i.set(O,a),o(R=>[...R,O].filter(P=>P!==C)),D.emit(4,he(a,a.props.updateId==null?"added":"updated"))}function _(r){let d=new Map,C=Array.from(i.values());return e.newestOnTop&&C.reverse(),C.forEach(O=>{let{position:a}=O.props;d.has(a)||d.set(a,[]),d.get(a).push(O)}),Array.from(d,O=>r(O[0],O[1]))}return{getToastToRender:_,containerRef:c,isToastActive:s}}function ve(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function Ce(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function be(e){let[t,n]=f.useState(!1),[o,c]=f.useState(!1),i=f.useRef(null),s=f.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,l=f.useRef(e),{autoClose:L,pauseOnHover:v,closeToast:E,onClick:p,closeOnClick:I}=e;f.useEffect(()=>{l.current=e}),f.useEffect(()=>(i.current&&i.current.addEventListener("d",r,{once:!0}),B(e.onOpen)&&e.onOpen(f.isValidElement(e.children)&&e.children.props),()=>{let T=l.current;B(T.onClose)&&T.onClose(f.isValidElement(T.children)&&T.children.props)}),[]),f.useEffect(()=>(e.pauseOnFocusLoss&&C(),()=>{e.pauseOnFocusLoss&&O()}),[e.pauseOnFocusLoss]);function b(T){if(e.draggable){a();let x=i.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=x.getBoundingClientRect(),x.style.transition="",s.x=ve(T.nativeEvent),s.y=Ce(T.nativeEvent),e.draggableDirection==="x"?(s.start=s.x,s.removalDistance=x.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=x.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent/100))}}function _(){if(s.boundingRect){let{top:T,bottom:x,left:N,right:M}=s.boundingRect;e.pauseOnHover&&s.x>=N&&s.x<=M&&s.y>=T&&s.y<=x?d():r()}}function r(){n(!0)}function d(){n(!1)}function C(){document.hasFocus()||d(),window.addEventListener("focus",r),window.addEventListener("blur",d)}function O(){window.removeEventListener("focus",r),window.removeEventListener("blur",d)}function a(){s.didMove=!1,document.addEventListener("mousemove",P),document.addEventListener("mouseup",y),document.addEventListener("touchmove",P),document.addEventListener("touchend",y)}function R(){document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",y),document.removeEventListener("touchmove",P),document.removeEventListener("touchend",y)}function P(T){let x=i.current;s.canDrag&&x&&(s.didMove=!0,t&&d(),s.x=ve(T),s.y=Ce(T),e.draggableDirection==="x"?s.delta=s.x-s.start:s.delta=s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),x.style.transform="translate"+e.draggableDirection+"("+s.delta+"px)",x.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function y(){R();let T=i.current;if(s.canDrag&&s.didMove&&T){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance){c(!0),e.closeToast();return}T.style.transition="transform 0.2s, opacity 0.2s",T.style.transform="translate"+e.draggableDirection+"(0)",T.style.opacity="1"}}let u={onMouseDown:b,onTouchStart:b,onMouseUp:_,onTouchEnd:_};return L&&v&&(u.onMouseEnter=d,u.onMouseLeave=r),I&&(u.onClick=T=>{p&&p(T),s.canCloseOnClick&&E()}),{playToast:r,pauseToast:d,isRunning:t,preventExitTransition:o,toastRef:i,eventHandlers:u}}function _e(e){let{closeToast:t,theme:n,ariaLabel:o="close"}=e;return g.default.createElement("button",{className:"Toastify__close-button Toastify__close-button--"+n,type:"button",onClick:c=>{c.stopPropagation(),t(c)},"aria-label":o},g.default.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},g.default.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function Ie(e){let{delay:t,isRunning:n,closeToast:o,type:c,hide:i,className:s,style:l,controlledProgress:L,progress:v,rtl:E,isIn:p,theme:I}=e,b=S(m({},l),{animationDuration:t+"ms",animationPlayState:n?"running":"paused",opacity:i?0:1});L&&(b.transform="scaleX("+v+")");let _=w.default("Toastify__progress-bar",L?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--"+I,"Toastify__progress-bar--"+c,{["Toastify__progress-bar--rtl"]:E}),r=B(s)?s({rtl:E,type:c,defaultClassName:_}):w.default(_,s),d={[L&&v>=1?"onTransitionEnd":"onAnimationEnd"]:L&&v<1?null:()=>{p&&o()}};return g.default.createElement("div",m({role:"progressbar","aria-hidden":i?"true":"false","aria-label":"notification timer",className:r,style:b},d))}Ie.defaultProps={type:k.DEFAULT,hide:!1};var He=e=>{let{isRunning:t,preventExitTransition:n,toastRef:o,eventHandlers:c}=be(e),{closeButton:i,children:s,autoClose:l,onClick:L,type:v,hideProgressBar:E,closeToast:p,transition:I,position:b,className:_,style:r,bodyClassName:d,bodyStyle:C,progressClassName:O,progressStyle:a,updateId:R,role:P,progress:y,rtl:u,toastId:T,deleteToast:x,isIn:N,isLoading:M,iconOut:U,theme:Q}=e,F=w.default("Toastify__toast","Toastify__toast-theme--"+Q,"Toastify__toast--"+v,{["Toastify__toast--rtl"]:u}),V=B(_)?_({rtl:u,position:b,type:v,defaultClassName:F}):w.default(F,_),z=!!y,H={closeToast:p,type:v,theme:Q},j=null;return i===!1||(B(i)?j=i(H):g.default.isValidElement(i)?j=g.default.cloneElement(i,H):j=_e(H)),g.default.createElement(I,{isIn:N,done:x,position:b,preventExitTransition:n,nodeRef:o},g.default.createElement("div",S(m({id:T,onClick:L,className:V},c),{style:r,ref:o}),g.default.createElement("div",S(m({},N&&{role:P}),{className:B(d)?d({type:v}):w.default("Toastify__toast-body",d),style:C}),U!=null&&g.default.createElement("div",{className:w.default("Toastify__toast-icon",{["Toastify--animate-icon Toastify__zoom-enter"]:!M})},U),g.default.createElement("div",null,s)),j,(l||z)&&g.default.createElement(Ie,S(m({},R&&!z?{key:"pb-"+R}:{}),{rtl:u,theme:Q,delay:l,isRunning:t,isIn:N,closeToast:p,hide:E,type:v,style:a,className:O,controlledProgress:z,progress:y}))))},Oe=Y({enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0}),qe=Y({enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0}),Ue=Y({enter:"Toastify--animate Toastify__zoom-enter",exit:"Toastify--animate Toastify__zoom-exit"}),Qe=Y({enter:"Toastify--animate Toastify__flip-enter",exit:"Toastify--animate Toastify__flip-exit"}),ie=f.forwardRef((e,t)=>{let{getToastToRender:n,containerRef:o,isToastActive:c}=Ee(e),{className:i,style:s,rtl:l,containerId:L}=e;function v(E){let p=w.default("Toastify__toast-container","Toastify__toast-container--"+E,{["Toastify__toast-container--rtl"]:l});return B(i)?i({position:E,rtl:l,defaultClassName:p}):w.default(p,Z(i))}return f.useEffect(()=>{t&&(t.current=o.current)},[]),g.default.createElement("div",{ref:o,className:"Toastify",id:L},n((E,p)=>{let I=p.length?m({},s):S(m({},s),{pointerEvents:"none"});return g.default.createElement("div",{className:v(E),style:I,key:"container-"+E},p.map((b,_)=>{let{content:r,props:d}=b;return g.default.createElement(He,S(m({},d),{isIn:c(d.toastId),style:S(m({},d.style),{"--nth":_+1,"--len":p.length}),key:"toast-"+d.key}),r)}))}))});ie.displayName="ToastContainer";ie.defaultProps={position:Te.TOP_RIGHT,transition:Oe,rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:_e,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};var q=new Map,re,le=[];function Ve(e,t){let{containerId:n}=t,o=q.get(n||re);return o?o.getToast(e):null}function Ne(){return Math.random().toString(36).substring(2,9)}function We(e){return e&&(A(e.toastId)||W(e.toastId))?e.toastId:Ne()}function X(e,t){return q.size>0?D.emit(0,e,t):le.push({content:e,options:t}),t.toastId}function ee(e,t){return S(m({},t),{type:t&&t.type||e,toastId:We(t)})}function te(e){return(t,n)=>X(t,ee(e,n))}function h(e,t){return X(e,ee(k.DEFAULT,t))}h.loading=(e,t)=>X(e,ee(k.DEFAULT,m({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},t)));function Ge(e,t,n){let{pending:o,error:c,success:i}=t,s;o&&(s=A(o)?h.loading(o,n):h.loading(o.render,m(m({},n),o)));let l={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null,delay:100},L=(E,p,I)=>{if(p==null){h.dismiss(s);return}let b=S(m(m({type:E},l),n),{data:I}),_=A(p)?{render:p}:p;return s?h.update(s,m(m({},b),_)):h(_.render,m(m({},b),_)),I},v=B(e)?e():e;return v.then(E=>L("success",i,E)).catch(E=>L("error",c,E)),v}h.promise=Ge;h.success=te(k.SUCCESS);h.info=te(k.INFO);h.error=te(k.ERROR);h.warning=te(k.WARNING);h.warn=h.warning;h.dark=(e,t)=>X(e,ee(k.DEFAULT,m({theme:"dark"},t)));h.dismiss=e=>D.emit(1,e);h.clearWaitingQueue=function(e){return e===void 0&&(e={}),D.emit(5,e)};h.isActive=e=>{let t=!1;return q.forEach(n=>{n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t};h.update=function(e,t){t===void 0&&(t={}),setTimeout(()=>{let n=Ve(e,t);if(n){let{props:o,content:c}=n,i=S(m(m({},o),t),{toastId:t.toastId||e,updateId:Ne()});i.toastId!==e&&(i.staleId=e);let s=i.render||c;delete i.render,X(s,i)}},0)};h.done=e=>{h.update(e,{progress:1})};h.onChange=e=>(D.on(4,e),()=>{D.off(4,e)});h.POSITION=Te;h.TYPE=k;D.on(2,e=>{re=e.containerId||e,q.set(re,e),le.forEach(t=>{D.emit(0,t.content,t.options)}),le=[]}).on(3,e=>{q.delete(e.containerId||e),q.size===0&&D.off(0).off(1).off(5)});exports.Bounce=Oe;exports.Flip=Qe;exports.Icons=$;exports.Slide=qe;exports.ToastContainer=ie;exports.Zoom=Ue;exports.collapseToast=pe;exports.cssTransition=Y;exports.toast=h;exports.useToast=be;exports.useToastContainer=Ee;
|