react-native-bread 0.1.0
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/README.md +148 -0
- package/lib/commonjs/icons/CloseIcon.js +22 -0
- package/lib/commonjs/icons/CloseIcon.js.map +1 -0
- package/lib/commonjs/icons/GreenCheck.js +27 -0
- package/lib/commonjs/icons/GreenCheck.js.map +1 -0
- package/lib/commonjs/icons/InfoIcon.js +24 -0
- package/lib/commonjs/icons/InfoIcon.js.map +1 -0
- package/lib/commonjs/icons/RedX.js +27 -0
- package/lib/commonjs/icons/RedX.js.map +1 -0
- package/lib/commonjs/icons/index.js +34 -0
- package/lib/commonjs/icons/index.js.map +1 -0
- package/lib/commonjs/index.js +59 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/toast-api.js +127 -0
- package/lib/commonjs/toast-api.js.map +1 -0
- package/lib/commonjs/toast-provider.js +71 -0
- package/lib/commonjs/toast-provider.js.map +1 -0
- package/lib/commonjs/toast-store.js +278 -0
- package/lib/commonjs/toast-store.js.map +1 -0
- package/lib/commonjs/toast.js +445 -0
- package/lib/commonjs/toast.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/icons/CloseIcon.js +16 -0
- package/lib/module/icons/CloseIcon.js.map +1 -0
- package/lib/module/icons/GreenCheck.js +21 -0
- package/lib/module/icons/GreenCheck.js.map +1 -0
- package/lib/module/icons/InfoIcon.js +18 -0
- package/lib/module/icons/InfoIcon.js.map +1 -0
- package/lib/module/icons/RedX.js +21 -0
- package/lib/module/icons/RedX.js.map +1 -0
- package/lib/module/icons/index.js +7 -0
- package/lib/module/icons/index.js.map +1 -0
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/toast-api.js +124 -0
- package/lib/module/toast-api.js.map +1 -0
- package/lib/module/toast-provider.js +67 -0
- package/lib/module/toast-provider.js.map +1 -0
- package/lib/module/toast-store.js +274 -0
- package/lib/module/toast-store.js.map +1 -0
- package/lib/module/toast.js +439 -0
- package/lib/module/toast.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/icons/CloseIcon.d.ts +3 -0
- package/lib/typescript/icons/CloseIcon.d.ts.map +1 -0
- package/lib/typescript/icons/GreenCheck.d.ts +3 -0
- package/lib/typescript/icons/GreenCheck.d.ts.map +1 -0
- package/lib/typescript/icons/InfoIcon.d.ts +3 -0
- package/lib/typescript/icons/InfoIcon.d.ts.map +1 -0
- package/lib/typescript/icons/RedX.d.ts +3 -0
- package/lib/typescript/icons/RedX.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +5 -0
- package/lib/typescript/icons/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/toast-api.d.ts +109 -0
- package/lib/typescript/toast-api.d.ts.map +1 -0
- package/lib/typescript/toast-provider.d.ts +52 -0
- package/lib/typescript/toast-provider.d.ts.map +1 -0
- package/lib/typescript/toast-store.d.ts +26 -0
- package/lib/typescript/toast-store.d.ts.map +1 -0
- package/lib/typescript/toast.d.ts +2 -0
- package/lib/typescript/toast.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +101 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +87 -0
- package/src/icons/CloseIcon.tsx +10 -0
- package/src/icons/GreenCheck.tsx +16 -0
- package/src/icons/InfoIcon.tsx +12 -0
- package/src/icons/RedX.tsx +16 -0
- package/src/icons/index.ts +4 -0
- package/src/index.ts +26 -0
- package/src/toast-api.ts +213 -0
- package/src/toast-provider.tsx +81 -0
- package/src/toast-store.ts +270 -0
- package/src/toast.tsx +417 -0
- package/src/types.ts +121 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { toastStore } from "./toast-store.js";
|
|
4
|
+
|
|
5
|
+
/** Second parameter can be a string (description) or options object */
|
|
6
|
+
|
|
7
|
+
const _toast = (title, description, type, duration) => {
|
|
8
|
+
toastStore.show(title, description, type, duration);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Helper to parse the second argument which can be string or options */
|
|
12
|
+
const parseDescriptionOrOptions = arg => {
|
|
13
|
+
if (!arg) return {};
|
|
14
|
+
if (typeof arg === "string") return {
|
|
15
|
+
description: arg
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
description: arg.description,
|
|
19
|
+
duration: arg.duration,
|
|
20
|
+
options: arg
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const parseMessage = input => typeof input === "string" ? {
|
|
24
|
+
title: input
|
|
25
|
+
} : input;
|
|
26
|
+
const parseErrorMessage = (input, error) => {
|
|
27
|
+
if (typeof input === "function") {
|
|
28
|
+
return parseMessage(input(error));
|
|
29
|
+
}
|
|
30
|
+
return parseMessage(input);
|
|
31
|
+
};
|
|
32
|
+
const promiseToast = async (promise, messages) => {
|
|
33
|
+
const loadingCfg = parseMessage(messages.loading);
|
|
34
|
+
|
|
35
|
+
// Very long duration so it stays visible until we resolve/reject
|
|
36
|
+
const toastId = toastStore.show(loadingCfg.title, loadingCfg.description, "loading", loadingCfg.duration ?? 60 * 60 * 1000);
|
|
37
|
+
try {
|
|
38
|
+
const result = await promise;
|
|
39
|
+
const successCfg = parseMessage(messages.success);
|
|
40
|
+
toastStore.updateToast(toastId, {
|
|
41
|
+
title: successCfg.title,
|
|
42
|
+
description: successCfg.description,
|
|
43
|
+
type: "success",
|
|
44
|
+
duration: successCfg.duration ?? 4000
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
data: result,
|
|
48
|
+
success: true
|
|
49
|
+
};
|
|
50
|
+
} catch (err) {
|
|
51
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
52
|
+
const errorCfg = parseErrorMessage(messages.error, error);
|
|
53
|
+
toastStore.updateToast(toastId, {
|
|
54
|
+
title: errorCfg.title,
|
|
55
|
+
description: errorCfg.description,
|
|
56
|
+
type: "error",
|
|
57
|
+
duration: errorCfg.duration ?? 4000
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
error,
|
|
61
|
+
success: false
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
// Build the toast API
|
|
66
|
+
const toastFn = _toast;
|
|
67
|
+
toastFn.success = (title, descriptionOrOptions, duration) => {
|
|
68
|
+
const {
|
|
69
|
+
description,
|
|
70
|
+
duration: optDuration,
|
|
71
|
+
options
|
|
72
|
+
} = parseDescriptionOrOptions(descriptionOrOptions);
|
|
73
|
+
toastStore.show(title, description, "success", duration ?? optDuration, options);
|
|
74
|
+
};
|
|
75
|
+
toastFn.error = (title, descriptionOrOptions, duration) => {
|
|
76
|
+
const {
|
|
77
|
+
description,
|
|
78
|
+
duration: optDuration,
|
|
79
|
+
options
|
|
80
|
+
} = parseDescriptionOrOptions(descriptionOrOptions);
|
|
81
|
+
toastStore.show(title, description, "error", duration ?? optDuration, options);
|
|
82
|
+
};
|
|
83
|
+
toastFn.info = (title, descriptionOrOptions, duration) => {
|
|
84
|
+
const {
|
|
85
|
+
description,
|
|
86
|
+
duration: optDuration,
|
|
87
|
+
options
|
|
88
|
+
} = parseDescriptionOrOptions(descriptionOrOptions);
|
|
89
|
+
toastStore.show(title, description, "info", duration ?? optDuration, options);
|
|
90
|
+
};
|
|
91
|
+
toastFn.promise = promiseToast;
|
|
92
|
+
toastFn.dismiss = id => {
|
|
93
|
+
toastStore.hide(id);
|
|
94
|
+
};
|
|
95
|
+
toastFn.dismissAll = () => {
|
|
96
|
+
toastStore.hideAll();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Toast API for showing notifications.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import { toast } from 'react-native-bread';
|
|
105
|
+
*
|
|
106
|
+
* // Basic toasts
|
|
107
|
+
* toast.success("Saved!", "Your changes have been saved");
|
|
108
|
+
* toast.error("Error", "Something went wrong");
|
|
109
|
+
* toast.info("Tip", "Swipe up to dismiss");
|
|
110
|
+
*
|
|
111
|
+
* // Promise toast (loading → success/error)
|
|
112
|
+
* toast.promise(apiCall(), {
|
|
113
|
+
* loading: { title: "Loading..." },
|
|
114
|
+
* success: { title: "Done!" },
|
|
115
|
+
* error: (err) => ({ title: "Failed", description: err.message }),
|
|
116
|
+
* });
|
|
117
|
+
*
|
|
118
|
+
* // Dismiss toasts
|
|
119
|
+
* toast.dismiss(id);
|
|
120
|
+
* toast.dismissAll();
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export const toast = toastFn;
|
|
124
|
+
//# sourceMappingURL=toast-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toastStore","_toast","title","description","type","duration","show","parseDescriptionOrOptions","arg","options","parseMessage","input","parseErrorMessage","error","promiseToast","promise","messages","loadingCfg","loading","toastId","result","successCfg","success","updateToast","data","err","Error","String","errorCfg","toastFn","descriptionOrOptions","optDuration","info","dismiss","id","hide","dismissAll","hideAll","toast"],"sourceRoot":"../../src","sources":["toast-api.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,kBAAe;;AAU1C;;AAGA,MAAMC,MAAM,GAAGA,CAACC,KAAa,EAAEC,WAAoB,EAAEC,IAAgB,EAAEC,QAAiB,KAAK;EAC3FL,UAAU,CAACM,IAAI,CAACJ,KAAK,EAAEC,WAAW,EAAEC,IAAI,EAAEC,QAAQ,CAAC;AACrD,CAAC;;AAED;AACA,MAAME,yBAAyB,GAC7BC,GAA0B,IAC8C;EACxE,IAAI,CAACA,GAAG,EAAE,OAAO,CAAC,CAAC;EACnB,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAO;IAAEL,WAAW,EAAEK;EAAI,CAAC;EACxD,OAAO;IACLL,WAAW,EAAEK,GAAG,CAACL,WAAW;IAC5BE,QAAQ,EAAE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AQ,EAAE0B,WAAW;IAAEtB;EAAQ,CAAC,GAAGF,yBAAyB,CAACuB,oBAAoB,CAAC;EACvG9B,UAAU,CAACM,IAAI,CAACJ,KAAK,EAAEC,WAAW,EAAE,MAAM,EAAEE,QAAQ,IAAI0B,WAAW,EAAEtB,OAAO,CAAC;AAC/E,CAAC;AAEDoB,OAAO,CAACd,OAAO,GAAGD,YAAY;AAE9Be,OAAO,CAACI,OAAO,GAAIC,EAAU,IAAK;EAChClC,UAAU,CAACmC,IAAI,CAACD,EAAE,CAAC;AACrB,CAAC;AAEDL,OAAO,CAACO,UAAU,GAAG,MAAM;EACzBpC,UAAU,CAACqC,OAAO,CAAC,CAAC;AACtB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,KAAK,GAAGT,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { StyleSheet, View } from "react-native";
|
|
5
|
+
import { ToastContainer } from "./toast.js";
|
|
6
|
+
import { toastStore } from "./toast-store.js";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
/**
|
|
9
|
+
* Toast provider component that enables toast notifications in your app.
|
|
10
|
+
* Wrap your root component with `<BreadLoaf>` to start showing toasts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* import { BreadLoaf } from 'react-native-bread';
|
|
15
|
+
*
|
|
16
|
+
* // Basic usage
|
|
17
|
+
* <BreadLoaf>
|
|
18
|
+
* <App />
|
|
19
|
+
* </BreadLoaf>
|
|
20
|
+
*
|
|
21
|
+
* // With configuration
|
|
22
|
+
* <BreadLoaf
|
|
23
|
+
* config={{
|
|
24
|
+
* position: 'bottom',
|
|
25
|
+
* stacking: false,
|
|
26
|
+
* defaultDuration: 5000,
|
|
27
|
+
* colors: {
|
|
28
|
+
* success: { accent: '#22c55e', background: '#f0fdf4' },
|
|
29
|
+
* error: { accent: '#ef4444', background: '#fef2f2' },
|
|
30
|
+
* },
|
|
31
|
+
* toastStyle: { borderRadius: 12 },
|
|
32
|
+
* }}
|
|
33
|
+
* >
|
|
34
|
+
* <App />
|
|
35
|
+
* </BreadLoaf>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function BreadLoaf({
|
|
39
|
+
children,
|
|
40
|
+
config
|
|
41
|
+
}) {
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
toastStore.setConfig(config);
|
|
44
|
+
return () => {
|
|
45
|
+
// Reset to defaults when this provider unmounts
|
|
46
|
+
toastStore.setConfig(undefined);
|
|
47
|
+
};
|
|
48
|
+
}, [config]);
|
|
49
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
50
|
+
style: styles.root,
|
|
51
|
+
children: [children, /*#__PURE__*/_jsx(View, {
|
|
52
|
+
style: styles.portalContainer,
|
|
53
|
+
pointerEvents: "box-none",
|
|
54
|
+
children: /*#__PURE__*/_jsx(ToastContainer, {})
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
root: {
|
|
60
|
+
flex: 1
|
|
61
|
+
},
|
|
62
|
+
portalContainer: {
|
|
63
|
+
...StyleSheet.absoluteFillObject,
|
|
64
|
+
zIndex: 9999
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=toast-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","StyleSheet","View","ToastContainer","toastStore","jsx","_jsx","jsxs","_jsxs","BreadLoaf","children","config","setConfig","undefined","style","styles","root","portalContainer","pointerEvents","create","flex","absoluteFillObject","zIndex"],"sourceRoot":"../../src","sources":["toast-provider.tsx"],"mappings":";;AAAA,SAAyBA,SAAS,QAAQ,OAAO;AACjD,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,cAAc,QAAQ,YAAS;AACxC,SAASC,UAAU,QAAQ,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAqB3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAC;EAAEC,QAAQ;EAAEC;AAAuB,CAAC,EAAE;EAC9DX,SAAS,CAAC,MAAM;IACdI,UAAU,CAACQ,SAAS,CAACD,MAAM,CAAC;IAC5B,OAAO,MAAM;MACX;MACAP,UAAU,CAACQ,SAAS,CAACC,SAAS,CAAC;IACjC,CAAC;EACH,CAAC,EAAE,CAACF,MAAM,CAAC,CAAC;EACZ,oBACEH,KAAA,CAACN,IAAI;IAACY,KAAK,EAAEC,MAAM,CAACC,IAAK;IAAAN,QAAA,GACtBA,QAAQ,eACTJ,IAAA,CAACJ,IAAI;MAACY,KAAK,EAAEC,MAAM,CAACE,eAAgB;MAACC,aAAa,EAAC,UAAU;MAAAR,QAAA,eAC3DJ,IAAA,CAACH,cAAc,IAAE;IAAC,CACd,CAAC;EAAA,CACH,CAAC;AAEX;AAEA,MAAMY,MAAM,GAAGd,UAAU,CAACkB,MAAM,CAAC;EAC/BH,IAAI,EAAE;IACJI,IAAI,EAAE;EACR,CAAC;EACDH,eAAe,EAAE;IACf,GAAGhB,UAAU,CAACoB,kBAAkB;IAChCC,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const EXIT_DURATION = 350;
|
|
4
|
+
|
|
5
|
+
/** Default theme values */
|
|
6
|
+
const DEFAULT_THEME = {
|
|
7
|
+
position: "top",
|
|
8
|
+
offset: 0,
|
|
9
|
+
stacking: true,
|
|
10
|
+
maxStack: 3,
|
|
11
|
+
dismissible: true,
|
|
12
|
+
showCloseButton: true,
|
|
13
|
+
colors: {
|
|
14
|
+
success: {
|
|
15
|
+
accent: "#28B770",
|
|
16
|
+
background: "#FFFFFF"
|
|
17
|
+
},
|
|
18
|
+
error: {
|
|
19
|
+
accent: "#F05964",
|
|
20
|
+
background: "#FFFFFF"
|
|
21
|
+
},
|
|
22
|
+
info: {
|
|
23
|
+
accent: "#EDBE43",
|
|
24
|
+
background: "#FFFFFF"
|
|
25
|
+
},
|
|
26
|
+
loading: {
|
|
27
|
+
accent: "#232323",
|
|
28
|
+
background: "#FFFFFF"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
icons: {},
|
|
32
|
+
toastStyle: {},
|
|
33
|
+
titleStyle: {},
|
|
34
|
+
descriptionStyle: {},
|
|
35
|
+
defaultDuration: 4000
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Deep merge user config with defaults */
|
|
39
|
+
function mergeConfig(config) {
|
|
40
|
+
if (!config) return DEFAULT_THEME;
|
|
41
|
+
const mergedColors = {
|
|
42
|
+
...DEFAULT_THEME.colors
|
|
43
|
+
};
|
|
44
|
+
if (config.colors) {
|
|
45
|
+
for (const type of Object.keys(config.colors)) {
|
|
46
|
+
const userColors = config.colors[type];
|
|
47
|
+
if (userColors) {
|
|
48
|
+
mergedColors[type] = {
|
|
49
|
+
...DEFAULT_THEME.colors[type],
|
|
50
|
+
...userColors
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
position: config.position ?? DEFAULT_THEME.position,
|
|
57
|
+
offset: config.offset ?? DEFAULT_THEME.offset,
|
|
58
|
+
stacking: config.stacking ?? DEFAULT_THEME.stacking,
|
|
59
|
+
maxStack: config.maxStack ?? DEFAULT_THEME.maxStack,
|
|
60
|
+
dismissible: config.dismissible ?? DEFAULT_THEME.dismissible,
|
|
61
|
+
showCloseButton: config.showCloseButton ?? DEFAULT_THEME.showCloseButton,
|
|
62
|
+
colors: mergedColors,
|
|
63
|
+
icons: {
|
|
64
|
+
...DEFAULT_THEME.icons,
|
|
65
|
+
...config.icons
|
|
66
|
+
},
|
|
67
|
+
toastStyle: {
|
|
68
|
+
...DEFAULT_THEME.toastStyle,
|
|
69
|
+
...config.toastStyle
|
|
70
|
+
},
|
|
71
|
+
titleStyle: {
|
|
72
|
+
...DEFAULT_THEME.titleStyle,
|
|
73
|
+
...config.titleStyle
|
|
74
|
+
},
|
|
75
|
+
descriptionStyle: {
|
|
76
|
+
...DEFAULT_THEME.descriptionStyle,
|
|
77
|
+
...config.descriptionStyle
|
|
78
|
+
},
|
|
79
|
+
defaultDuration: config.defaultDuration ?? DEFAULT_THEME.defaultDuration
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
class ToastStore {
|
|
83
|
+
state = {
|
|
84
|
+
visibleToasts: []
|
|
85
|
+
};
|
|
86
|
+
theme = DEFAULT_THEME;
|
|
87
|
+
listeners = new Set();
|
|
88
|
+
toastIdCounter = 0;
|
|
89
|
+
timeouts = new Map();
|
|
90
|
+
subscribe = listener => {
|
|
91
|
+
this.listeners.add(listener);
|
|
92
|
+
return () => {
|
|
93
|
+
this.listeners.delete(listener);
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
emit() {
|
|
97
|
+
for (const listener of this.listeners) {
|
|
98
|
+
listener(this.state);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
setState(partial) {
|
|
102
|
+
this.state = {
|
|
103
|
+
...this.state,
|
|
104
|
+
...partial
|
|
105
|
+
};
|
|
106
|
+
this.emit();
|
|
107
|
+
}
|
|
108
|
+
getState = () => this.state;
|
|
109
|
+
getTheme = () => this.theme;
|
|
110
|
+
setConfig = config => {
|
|
111
|
+
this.theme = mergeConfig(config);
|
|
112
|
+
};
|
|
113
|
+
show = (title, description, type = "success", duration, options) => {
|
|
114
|
+
const actualDuration = duration ?? options?.duration ?? this.theme.defaultDuration;
|
|
115
|
+
const maxToasts = this.theme.stacking ? this.theme.maxStack : 1;
|
|
116
|
+
const id = `toast-${++this.toastIdCounter}`;
|
|
117
|
+
const newToast = {
|
|
118
|
+
id,
|
|
119
|
+
title,
|
|
120
|
+
description: description ?? options?.description,
|
|
121
|
+
type,
|
|
122
|
+
duration: actualDuration,
|
|
123
|
+
createdAt: Date.now(),
|
|
124
|
+
isExiting: false,
|
|
125
|
+
options
|
|
126
|
+
};
|
|
127
|
+
const {
|
|
128
|
+
visibleToasts
|
|
129
|
+
} = this.state;
|
|
130
|
+
|
|
131
|
+
// Get only non-exiting toasts for count
|
|
132
|
+
const activeToasts = visibleToasts.filter(t => !t.isExiting);
|
|
133
|
+
if (activeToasts.length >= maxToasts) {
|
|
134
|
+
const toastsToRemove = activeToasts.slice(maxToasts - 1);
|
|
135
|
+
for (const toast of toastsToRemove) {
|
|
136
|
+
// Clear auto-dismiss timeout
|
|
137
|
+
const timeout = this.timeouts.get(toast.id);
|
|
138
|
+
if (timeout) {
|
|
139
|
+
clearTimeout(timeout);
|
|
140
|
+
this.timeouts.delete(toast.id);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const removeIds = new Set(toastsToRemove.map(t => t.id));
|
|
144
|
+
if (this.theme.stacking) {
|
|
145
|
+
// When stacking is ON: remove old toasts from state immediately (no animation for stack overflow)
|
|
146
|
+
this.setState({
|
|
147
|
+
visibleToasts: visibleToasts.filter(t => !removeIds.has(t.id))
|
|
148
|
+
});
|
|
149
|
+
} else {
|
|
150
|
+
// When stacking is OFF: animate out the old toast, wait, then show new one
|
|
151
|
+
this.setState({
|
|
152
|
+
visibleToasts: visibleToasts.map(t => removeIds.has(t.id) ? {
|
|
153
|
+
...t,
|
|
154
|
+
isExiting: true
|
|
155
|
+
} : t)
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Delay showing the new toast until the old one has animated out
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
for (const toast of toastsToRemove) {
|
|
161
|
+
this.removeToast(toast.id);
|
|
162
|
+
}
|
|
163
|
+
this.addToast(newToast, actualDuration);
|
|
164
|
+
}, EXIT_DURATION - 220);
|
|
165
|
+
return id;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Add new toast immediately (stacking ON or no existing toasts)
|
|
170
|
+
this.addToast(newToast, actualDuration);
|
|
171
|
+
return id;
|
|
172
|
+
};
|
|
173
|
+
addToast(toast, duration) {
|
|
174
|
+
this.setState({
|
|
175
|
+
visibleToasts: [toast, ...this.state.visibleToasts.filter(t => !t.isExiting)]
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Schedule auto-dismiss with duration multiplier based on position
|
|
179
|
+
this.scheduleTimeout(toast.id, duration, 0);
|
|
180
|
+
|
|
181
|
+
// Reschedule timeouts for other toasts based on their new positions
|
|
182
|
+
this.rescheduleAllTimeouts();
|
|
183
|
+
}
|
|
184
|
+
scheduleTimeout(id, baseDuration, index) {
|
|
185
|
+
const existingTimeout = this.timeouts.get(id);
|
|
186
|
+
if (existingTimeout) {
|
|
187
|
+
clearTimeout(existingTimeout);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Duration multiplier: index 0 = 1x, index 1 = 2x, index 2 = 3x
|
|
191
|
+
const duration = baseDuration * (index + 1);
|
|
192
|
+
const timeout = setTimeout(() => {
|
|
193
|
+
this.hide(id);
|
|
194
|
+
}, duration);
|
|
195
|
+
this.timeouts.set(id, timeout);
|
|
196
|
+
}
|
|
197
|
+
rescheduleAllTimeouts() {
|
|
198
|
+
const {
|
|
199
|
+
visibleToasts
|
|
200
|
+
} = this.state;
|
|
201
|
+
visibleToasts.forEach((toast, index) => {
|
|
202
|
+
// Skip if already exiting or index 0 (just scheduled)
|
|
203
|
+
if (toast.isExiting || index === 0) return;
|
|
204
|
+
this.scheduleTimeout(toast.id, toast.duration, index);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
hide = id => {
|
|
208
|
+
const {
|
|
209
|
+
visibleToasts
|
|
210
|
+
} = this.state;
|
|
211
|
+
const toast = visibleToasts.find(t => t.id === id);
|
|
212
|
+
if (!toast || toast.isExiting) return;
|
|
213
|
+
|
|
214
|
+
// Clear the auto-dismiss timeout
|
|
215
|
+
const timeout = this.timeouts.get(id);
|
|
216
|
+
if (timeout) {
|
|
217
|
+
clearTimeout(timeout);
|
|
218
|
+
this.timeouts.delete(id);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Mark as exiting (triggers exit animation in component)
|
|
222
|
+
this.setState({
|
|
223
|
+
visibleToasts: visibleToasts.map(t => t.id === id ? {
|
|
224
|
+
...t,
|
|
225
|
+
isExiting: true
|
|
226
|
+
} : t)
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// After exit animation, actually remove the toast
|
|
230
|
+
setTimeout(() => {
|
|
231
|
+
this.removeToast(id);
|
|
232
|
+
}, EXIT_DURATION);
|
|
233
|
+
};
|
|
234
|
+
removeToast(id) {
|
|
235
|
+
const timeout = this.timeouts.get(id);
|
|
236
|
+
if (timeout) {
|
|
237
|
+
clearTimeout(timeout);
|
|
238
|
+
this.timeouts.delete(id);
|
|
239
|
+
}
|
|
240
|
+
this.setState({
|
|
241
|
+
visibleToasts: this.state.visibleToasts.filter(t => t.id !== id)
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
// Reschedule remaining toasts with updated positions
|
|
245
|
+
this.rescheduleAllTimeouts();
|
|
246
|
+
}
|
|
247
|
+
updateToast = (id, data) => {
|
|
248
|
+
const {
|
|
249
|
+
visibleToasts
|
|
250
|
+
} = this.state;
|
|
251
|
+
const index = visibleToasts.findIndex(t => t.id === id);
|
|
252
|
+
if (index === -1) return;
|
|
253
|
+
this.setState({
|
|
254
|
+
visibleToasts: visibleToasts.map(t => t.id === id ? {
|
|
255
|
+
...t,
|
|
256
|
+
...data
|
|
257
|
+
} : t)
|
|
258
|
+
});
|
|
259
|
+
if (data.duration !== undefined) {
|
|
260
|
+
this.scheduleTimeout(id, data.duration, index);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
hideAll = () => {
|
|
264
|
+
for (const timeout of this.timeouts.values()) {
|
|
265
|
+
clearTimeout(timeout);
|
|
266
|
+
}
|
|
267
|
+
this.timeouts.clear();
|
|
268
|
+
this.setState({
|
|
269
|
+
visibleToasts: []
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
export const toastStore = new ToastStore();
|
|
274
|
+
//# sourceMappingURL=toast-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["EXIT_DURATION","DEFAULT_THEME","position","offset","stacking","maxStack","dismissible","showCloseButton","colors","success","accent","background","error","info","loading","icons","toastStyle","titleStyle","descriptionStyle","defaultDuration","mergeConfig","config","mergedColors","type","Object","keys","userColors","ToastStore","state","visibleToasts","theme","listeners","Set","toastIdCounter","timeouts","Map","subscribe","listener","add","delete","emit","setState","partial","getState","getTheme","setConfig","show","title","description","duration","options","actualDuration","maxToasts","id","newToast","createdAt","Date","now","isExiting","activeToasts","filter","t","length","toastsToRemove","slice","toast","timeout","get","clearTimeout","removeIds","map","has","setTimeout","removeToast","addToast","scheduleTimeout","rescheduleAllTimeouts","baseDuration","index","existingTimeout","hide","set","forEach","find","updateToast","data","findIndex","undefined","hideAll","values","clear","toastStore"],"sourceRoot":"../../src","sources":["toast-store.ts"],"mappings":";;AAIA,MAAMA,aAAa,GAAG,GAAG;;AAEzB;AACA,MAAMC,aAAyB,GAAG;EAChCC,QAAQ,EAAE,KAAK;EACfC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,IAAI;EACdC,QAAQ,EAAE,CAAC;EACXC,WAAW,EAAE,IAAI;EACjBC,eAAe,EAAE,IAAI;EACrBC,MAAM,EAAE;IACNC,OAAO,EAAE;MAAE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