@adaptabletools/adaptable 12.1.0-canary.2 → 12.1.1

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.
Files changed (64) hide show
  1. package/bundle.cjs.js +99 -99
  2. package/package.json +1 -1
  3. package/publishTimestamp.d.ts +1 -1
  4. package/publishTimestamp.js +1 -1
  5. package/src/AdaptableOptions/SearchOptions.d.ts +1 -1
  6. package/src/Api/ConfigApi.d.ts +1 -2
  7. package/src/Api/EventApi.d.ts +45 -8
  8. package/src/Api/Events/AdaptableSearchState.d.ts +22 -0
  9. package/src/Api/Events/AdaptableSearchState.js +2 -0
  10. package/src/Api/Events/FilterApplied.d.ts +11 -0
  11. package/src/Api/Events/FilterApplied.js +2 -0
  12. package/src/Api/Events/GridSorted.d.ts +25 -0
  13. package/src/Api/Events/GridSorted.js +2 -0
  14. package/src/Api/Events/QueryRun.d.ts +14 -0
  15. package/src/Api/Events/QueryRun.js +2 -0
  16. package/src/Api/Events/SearchChanged.d.ts +3 -47
  17. package/src/Api/FilterApi.d.ts +4 -0
  18. package/src/Api/GridApi.d.ts +5 -0
  19. package/src/Api/Implementation/ConfigApiImpl.d.ts +1 -2
  20. package/src/Api/Implementation/FilterApiImpl.d.ts +1 -0
  21. package/src/Api/Implementation/FilterApiImpl.js +9 -0
  22. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  23. package/src/Api/Implementation/GridApiImpl.js +11 -0
  24. package/src/Api/Implementation/QueryApiImpl.d.ts +1 -0
  25. package/src/Api/Implementation/QueryApiImpl.js +14 -0
  26. package/src/Api/QueryApi.d.ts +4 -0
  27. package/src/Redux/Store/AdaptableStore.js +7 -2
  28. package/src/Utilities/ObjectFactory.d.ts +1 -1
  29. package/src/Utilities/ObjectFactory.js +11 -11
  30. package/src/View/AdaptableView.js +2 -2
  31. package/src/View/Components/Popups/AdaptableToaster.js +7 -7
  32. package/src/View/Query/QueryViewPanel.d.ts +1 -1
  33. package/src/View/Query/QueryViewPanel.js +2 -2
  34. package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
  35. package/src/bundle-dependencies/bundles/react-toastify/components/CloseButton.d.ts +9 -0
  36. package/src/bundle-dependencies/bundles/react-toastify/components/Icons.d.ts +24 -0
  37. package/src/bundle-dependencies/bundles/react-toastify/components/ProgressBar.d.ts +59 -0
  38. package/src/bundle-dependencies/bundles/react-toastify/components/Toast.d.ts +3 -0
  39. package/src/bundle-dependencies/bundles/react-toastify/components/ToastContainer.d.ts +3 -0
  40. package/src/bundle-dependencies/bundles/react-toastify/components/Transitions.d.ts +6 -0
  41. package/src/bundle-dependencies/bundles/react-toastify/components/index.d.ts +6 -0
  42. package/src/bundle-dependencies/bundles/react-toastify/core/eventManager.d.ts +39 -0
  43. package/src/bundle-dependencies/bundles/react-toastify/core/index.d.ts +2 -0
  44. package/src/bundle-dependencies/bundles/react-toastify/core/toast.d.ts +41 -0
  45. package/src/bundle-dependencies/bundles/react-toastify/hooks/index.d.ts +2 -0
  46. package/src/bundle-dependencies/bundles/react-toastify/hooks/useToast.d.ts +10 -0
  47. package/src/bundle-dependencies/bundles/react-toastify/hooks/useToastContainer.d.ts +23 -0
  48. package/src/bundle-dependencies/bundles/react-toastify/index.d.ts +5 -0
  49. package/src/bundle-dependencies/bundles/react-toastify/index.js +1 -0
  50. package/src/bundle-dependencies/bundles/react-toastify/inject-style.d.ts +8 -0
  51. package/src/bundle-dependencies/bundles/react-toastify/types/index.d.ts +269 -0
  52. package/src/bundle-dependencies/bundles/react-toastify/utils/collapseToast.d.ts +5 -0
  53. package/src/bundle-dependencies/bundles/react-toastify/utils/constant.d.ts +23 -0
  54. package/src/bundle-dependencies/bundles/react-toastify/utils/cssTransition.d.ts +43 -0
  55. package/src/bundle-dependencies/bundles/react-toastify/utils/index.d.ts +5 -0
  56. package/src/bundle-dependencies/bundles/react-toastify/utils/mapper.d.ts +2 -0
  57. package/src/bundle-dependencies/bundles/react-toastify/utils/propValidator.d.ts +9 -0
  58. package/src/components/Toastify/index.d.ts +3 -0
  59. package/src/components/Toastify/index.js +10 -0
  60. package/src/metamodel/adaptable.metamodel.d.ts +34 -13
  61. package/src/metamodel/adaptable.metamodel.js +1 -1
  62. package/src/types.d.ts +5 -1
  63. package/version.d.ts +1 -1
  64. package/version.js +1 -1
@@ -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,3 @@
1
+ import React from 'react';
2
+ import { ToastProps } from '../types';
3
+ export declare const Toast: React.FC<ToastProps>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { ToastContainerProps } from '../types';
3
+ export declare const ToastContainer: React.ForwardRefExoticComponent<ToastContainerProps & React.RefAttributes<HTMLDivElement>>;
@@ -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,6 @@
1
+ export * from './CloseButton';
2
+ export * from './ProgressBar';
3
+ export * from './ToastContainer';
4
+ export * from './Transitions';
5
+ export * from './Toast';
6
+ export * from './Icons';
@@ -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,2 @@
1
+ export * from './eventManager';
2
+ export * from './toast';
@@ -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,2 @@
1
+ export * from './useToastContainer';
2
+ export * from './useToast';
@@ -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;
@@ -0,0 +1,8 @@
1
+
2
+ /**
3
+ * Inject the style in case you cannot import the css file
4
+ * Call it once in your app
5
+ */
6
+ export declare function injectStyle(): void;
7
+
8
+
@@ -0,0 +1,269 @@
1
+ import React from 'react';
2
+ import { CloseButtonProps, IconProps } from '../components';
3
+ declare type Nullable<T> = {
4
+ [P in keyof T]: T[P] | null;
5
+ };
6
+ export declare type TypeOptions = 'info' | 'success' | 'warning' | 'error' | 'default';
7
+ export declare type Theme = 'light' | 'dark' | 'colored';
8
+ export declare type ToastPosition = 'top-right' | 'top-center' | 'top-left' | 'bottom-right' | 'bottom-center' | 'bottom-left';
9
+ export interface ToastContentProps<Data = {}> {
10
+ closeToast?: () => void;
11
+ toastProps: ToastProps;
12
+ data?: Data;
13
+ }
14
+ export declare type ToastContent<T = unknown> = React.ReactNode | ((props: ToastContentProps<T>) => React.ReactNode);
15
+ export declare type Id = number | string;
16
+ export declare type ToastTransition = React.FC<ToastTransitionProps> | React.ComponentClass<ToastTransitionProps>;
17
+ /**
18
+ * ClassName for the elements - can take a function to build a classname or a raw string that is cx'ed to defaults
19
+ */
20
+ export declare type ToastClassName = ((context?: {
21
+ type?: TypeOptions;
22
+ defaultClassName?: string;
23
+ position?: ToastPosition;
24
+ rtl?: boolean;
25
+ }) => string) | string;
26
+ export interface ClearWaitingQueueParams {
27
+ containerId?: Id;
28
+ }
29
+ export declare type DraggableDirection = 'x' | 'y';
30
+ interface CommonOptions {
31
+ /**
32
+ * Pause the timer when the mouse hover the toast.
33
+ * `Default: true`
34
+ */
35
+ pauseOnHover?: boolean;
36
+ /**
37
+ * Pause the toast when the window loses focus.
38
+ * `Default: true`
39
+ */
40
+ pauseOnFocusLoss?: boolean;
41
+ /**
42
+ * Remove the toast when clicked.
43
+ * `Default: true`
44
+ */
45
+ closeOnClick?: boolean;
46
+ /**
47
+ * Set the delay in ms to close the toast automatically.
48
+ * Use `false` to prevent the toast from closing.
49
+ * `Default: 5000`
50
+ */
51
+ autoClose?: number | false;
52
+ /**
53
+ * Set the default position to use.
54
+ * `One of: 'top-right', 'top-center', 'top-left', 'bottom-right', 'bottom-center', 'bottom-left'`
55
+ * `Default: 'top-right'`
56
+ */
57
+ position?: ToastPosition;
58
+ /**
59
+ * Pass a custom close button.
60
+ * To remove the close button pass `false`
61
+ */
62
+ closeButton?: boolean | ((props: CloseButtonProps) => React.ReactNode) | React.ReactElement<CloseButtonProps>;
63
+ /**
64
+ * An optional css class to set for the progress bar.
65
+ */
66
+ progressClassName?: ToastClassName;
67
+ /**
68
+ * An optional style to set for the progress bar.
69
+ */
70
+ progressStyle?: React.CSSProperties;
71
+ /**
72
+ * An optional css class to set for the toast content.
73
+ */
74
+ bodyClassName?: ToastClassName;
75
+ /**
76
+ * An optional inline style to apply for the toast content.
77
+ */
78
+ bodyStyle?: React.CSSProperties;
79
+ /**
80
+ * Hide or show the progress bar.
81
+ * `Default: false`
82
+ */
83
+ hideProgressBar?: boolean;
84
+ /**
85
+ * Pass a custom transition built with react-transition-group.
86
+ */
87
+ transition?: ToastTransition;
88
+ /**
89
+ * Allow toast to be draggable
90
+ * `Default: true`
91
+ */
92
+ draggable?: boolean;
93
+ /**
94
+ * The percentage of the toast's width it takes for a drag to dismiss a toast
95
+ * `Default: 80`
96
+ */
97
+ draggablePercent?: number;
98
+ /**
99
+ * Specify in which direction should you swipe to dismiss the toast
100
+ * `Default: "x"`
101
+ */
102
+ draggableDirection?: DraggableDirection;
103
+ /**
104
+ * Define the ARIA role for the toast
105
+ * `Default: alert`
106
+ * https://www.w3.org/WAI/PF/aria/roles
107
+ */
108
+ role?: string;
109
+ /**
110
+ * Set id to handle multiple container
111
+ */
112
+ containerId?: Id;
113
+ /**
114
+ * Fired when clicking inside toaster
115
+ */
116
+ onClick?: (event: React.MouseEvent) => void;
117
+ /**
118
+ * Support right to left display.
119
+ * `Default: false`
120
+ */
121
+ rtl?: boolean;
122
+ /**
123
+ * Used to display a custom icon. Set it to `false` to prevent
124
+ * the icons from being displayed
125
+ */
126
+ icon?: boolean | ((props: IconProps) => React.ReactNode) | React.ReactElement<IconProps> | string | number | React.ReactNode;
127
+ /**
128
+ * Theme to use.
129
+ * `One of: 'light', 'dark', 'colored'`
130
+ * `Default: 'light'`
131
+ */
132
+ theme?: Theme;
133
+ }
134
+ export interface ToastOptions<Data = {}> extends CommonOptions {
135
+ /**
136
+ * An optional css class to set.
137
+ */
138
+ className?: ToastClassName;
139
+ /**
140
+ * Called when toast is mounted.
141
+ */
142
+ onOpen?: <T = {}>(props: T) => void;
143
+ /**
144
+ * Called when toast is unmounted.
145
+ */
146
+ onClose?: <T = {}>(props: T) => void;
147
+ /**
148
+ * An optional inline style to apply.
149
+ */
150
+ style?: React.CSSProperties;
151
+ /**
152
+ * Set the toast type.
153
+ * `One of: 'info', 'success', 'warning', 'error', 'default'`
154
+ */
155
+ type?: TypeOptions;
156
+ /**
157
+ * Set a custom `toastId`
158
+ */
159
+ toastId?: Id;
160
+ /**
161
+ * Used during update
162
+ */
163
+ updateId?: Id;
164
+ /**
165
+ * Set the percentage for the controlled progress bar. `Value must be between 0 and 1.`
166
+ */
167
+ progress?: number | string;
168
+ /**
169
+ * Add a delay in ms before the toast appear.
170
+ */
171
+ delay?: number;
172
+ isLoading?: boolean;
173
+ data?: Data;
174
+ }
175
+ export interface UpdateOptions<T = unknown> extends Nullable<ToastOptions<T>> {
176
+ /**
177
+ * Used to update a toast.
178
+ * Pass any valid ReactNode(string, number, component)
179
+ */
180
+ render?: ToastContent<T>;
181
+ }
182
+ export interface ToastContainerProps extends CommonOptions {
183
+ /**
184
+ * An optional css class to set.
185
+ */
186
+ className?: ToastClassName;
187
+ /**
188
+ * Whether or not to display the newest toast on top.
189
+ * `Default: false`
190
+ */
191
+ newestOnTop?: boolean;
192
+ /**
193
+ * An optional inline style to apply.
194
+ */
195
+ style?: React.CSSProperties;
196
+ /**
197
+ * An optional inline style to apply for the toast.
198
+ */
199
+ toastStyle?: React.CSSProperties;
200
+ /**
201
+ * An optional css class for the toast.
202
+ */
203
+ toastClassName?: ToastClassName;
204
+ /**
205
+ * Show the toast only if it includes containerId and it's the same as containerId
206
+ * `Default: false`
207
+ */
208
+ enableMultiContainer?: boolean;
209
+ /**
210
+ * Limit the number of toast displayed at the same time
211
+ */
212
+ limit?: number;
213
+ }
214
+ export interface ToastTransitionProps {
215
+ isIn: boolean;
216
+ done: () => void;
217
+ position: ToastPosition | string;
218
+ preventExitTransition: boolean;
219
+ nodeRef: React.RefObject<HTMLElement>;
220
+ children?: React.ReactNode;
221
+ }
222
+ /**
223
+ * @INTERNAL
224
+ */
225
+ export interface ToastProps extends ToastOptions {
226
+ isIn: boolean;
227
+ staleId?: Id;
228
+ toastId: Id;
229
+ key: Id;
230
+ transition: ToastTransition;
231
+ closeToast: () => void;
232
+ position: ToastPosition;
233
+ children?: ToastContent;
234
+ draggablePercent: number;
235
+ draggableDirection?: DraggableDirection;
236
+ progressClassName?: ToastClassName;
237
+ className?: ToastClassName;
238
+ bodyClassName?: ToastClassName;
239
+ deleteToast: () => void;
240
+ theme: Theme;
241
+ type: TypeOptions;
242
+ iconOut?: React.ReactNode;
243
+ }
244
+ /**
245
+ * @INTERNAL
246
+ */
247
+ export interface NotValidatedToastProps extends Partial<ToastProps> {
248
+ toastId: Id;
249
+ }
250
+ /**
251
+ * @INTERNAL
252
+ */
253
+ export interface Toast {
254
+ content: ToastContent;
255
+ props: ToastProps;
256
+ }
257
+ export declare type ToastItemStatus = 'added' | 'removed' | 'updated';
258
+ export interface ToastItem<Data = {}> {
259
+ content: React.ReactNode;
260
+ id: Id;
261
+ theme?: Theme;
262
+ type?: TypeOptions;
263
+ isLoading?: boolean;
264
+ containerId?: Id;
265
+ data: Data;
266
+ icon?: React.ReactNode | false;
267
+ status: ToastItemStatus;
268
+ }
269
+ export {};
@@ -0,0 +1,5 @@
1
+ import { Default } from './constant';
2
+ /**
3
+ * Used to collapse toast after exit animation
4
+ */
5
+ export declare function collapseToast(node: HTMLElement, done: () => void, duration?: Default): void;
@@ -0,0 +1,23 @@
1
+ import { ToastPosition, TypeOptions } from '../types';
2
+ declare type KeyOfPosition = 'TOP_LEFT' | 'TOP_RIGHT' | 'TOP_CENTER' | 'BOTTOM_LEFT' | 'BOTTOM_RIGHT' | 'BOTTOM_CENTER';
3
+ declare type KeyOfType = 'INFO' | 'SUCCESS' | 'WARNING' | 'ERROR' | 'DEFAULT';
4
+ export declare const POSITION: {
5
+ [key in KeyOfPosition]: ToastPosition;
6
+ };
7
+ export declare const TYPE: {
8
+ [key in KeyOfType]: TypeOptions;
9
+ };
10
+ export declare const enum Default {
11
+ COLLAPSE_DURATION = 300,
12
+ DEBOUNCE_DURATION = 50,
13
+ CSS_NAMESPACE = "Toastify",
14
+ DRAGGABLE_PERCENT = 80
15
+ }
16
+ export declare const enum Direction {
17
+ X = "x",
18
+ Y = "y"
19
+ }
20
+ export declare const enum SyntheticEvent {
21
+ ENTRANCE_ANIMATION_END = "d"
22
+ }
23
+ export {};
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ import { ToastTransitionProps } from '../types';
3
+ export interface CSSTransitionProps {
4
+ /**
5
+ * Css class to apply when toast enter
6
+ */
7
+ enter: string;
8
+ /**
9
+ * Css class to apply when toast leave
10
+ */
11
+ exit: string;
12
+ /**
13
+ * Append current toast position to the classname.
14
+ * If multiple classes are provided, only the last one will get the position
15
+ * For instance `myclass--top-center`...
16
+ * `Default: false`
17
+ */
18
+ appendPosition?: boolean;
19
+ /**
20
+ * Collapse toast smoothly when exit animation end
21
+ * `Default: true`
22
+ */
23
+ collapse?: boolean;
24
+ /**
25
+ * Collapse transition duration
26
+ * `Default: 300`
27
+ */
28
+ collapseDuration?: number;
29
+ }
30
+ /**
31
+ * Css animation that just work.
32
+ * You could use animate.css for instance
33
+ *
34
+ *
35
+ * ```
36
+ * cssTransition({
37
+ * enter: "animate__animated animate__bounceIn",
38
+ * exit: "animate__animated animate__bounceOut"
39
+ * })
40
+ * ```
41
+ *
42
+ */
43
+ export declare function cssTransition({ enter, exit, appendPosition, collapse, collapseDuration }: CSSTransitionProps): ({ children, position, preventExitTransition, done, nodeRef, isIn }: ToastTransitionProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ export * from './propValidator';
2
+ export * from './constant';
3
+ export * from './cssTransition';
4
+ export * from './collapseToast';
5
+ export * from './mapper';
@@ -0,0 +1,2 @@
1
+ import { Toast, ToastItem, ToastItemStatus } from '../types';
2
+ export declare function toToastItem(toast: Toast, status: ToastItemStatus): ToastItem;
@@ -0,0 +1,9 @@
1
+ import { Id } from '../types';
2
+ export declare function isNum(v: any): v is Number;
3
+ export declare function isBool(v: any): v is Boolean;
4
+ export declare function isStr(v: any): v is String;
5
+ export declare function isFn(v: any): v is Function;
6
+ export declare function parseClassName(v: any): any;
7
+ export declare function isToastIdValid(toastId?: Id): true | Id | undefined;
8
+ export declare function getAutoCloseDelay(toastAutoClose?: false | number, containerAutoClose?: false | number): number | false | undefined;
9
+ export declare function canBeRendered<T>(content: T): boolean;
@@ -0,0 +1,3 @@
1
+ export { toast, ToastContainer, Slide, Zoom, Bounce, Flip, } from '../../bundle-dependencies/bundles/react-toastify';
2
+ import { ToastOptions } from '../../bundle-dependencies/bundles/react-toastify';
3
+ export type { ToastOptions };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Flip = exports.Bounce = exports.Zoom = exports.Slide = exports.ToastContainer = exports.toast = void 0;
4
+ var react_toastify_1 = require("../../bundle-dependencies/bundles/react-toastify");
5
+ Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return react_toastify_1.toast; } });
6
+ Object.defineProperty(exports, "ToastContainer", { enumerable: true, get: function () { return react_toastify_1.ToastContainer; } });
7
+ Object.defineProperty(exports, "Slide", { enumerable: true, get: function () { return react_toastify_1.Slide; } });
8
+ Object.defineProperty(exports, "Zoom", { enumerable: true, get: function () { return react_toastify_1.Zoom; } });
9
+ Object.defineProperty(exports, "Bounce", { enumerable: true, get: function () { return react_toastify_1.Bounce; } });
10
+ Object.defineProperty(exports, "Flip", { enumerable: true, get: function () { return react_toastify_1.Flip; } });