@redis-ui/components 41.4.1 → 42.0.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 +330 -0
- package/dist/Button/Button.style.cjs +1 -1
- package/dist/Button/Button.style.js +1 -1
- package/dist/Button/Button.types.cjs +1 -1
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/Button/Button.types.js +1 -1
- package/dist/Button/TextButton/TextButton.cjs +2 -0
- package/dist/Button/TextButton/TextButton.js +2 -0
- package/dist/Button/TextButton/TextButton.style.cjs +9 -3
- package/dist/Button/TextButton/TextButton.style.d.ts +1 -1
- package/dist/Button/TextButton/TextButton.style.js +9 -3
- package/dist/Button/TextButton/TextButton.types.d.ts +2 -0
- package/dist/Button/ToggleButton/ToggleButton.style.cjs +1 -1
- package/dist/Button/ToggleButton/ToggleButton.style.js +1 -1
- package/dist/Chip/Chip.cjs +3 -1
- package/dist/Chip/Chip.d.ts +2 -2
- package/dist/Chip/Chip.js +3 -1
- package/dist/Chip/Chip.types.d.ts +2 -1
- package/dist/Chip/components/CloseButton/CloseButton.cjs +2 -1
- package/dist/Chip/components/CloseButton/CloseButton.d.ts +1 -1
- package/dist/Chip/components/CloseButton/CloseButton.js +2 -1
- package/dist/Chip/components/CloseButton/CloseButton.types.d.ts +1 -1
- package/dist/ChipList/ChipList.cjs +2 -0
- package/dist/ChipList/ChipList.d.ts +1 -1
- package/dist/ChipList/ChipList.js +2 -0
- package/dist/ChipList/ChipList.types.d.ts +1 -0
- package/dist/ChipList/Components/ExtraItem.cjs +8 -7
- package/dist/ChipList/Components/ExtraItem.js +8 -7
- package/dist/Filters/components/MultiSelectFilter/MultiSelectFilter.cjs +2 -2
- package/dist/Filters/components/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/dist/Filters/components/MultiTreeSelectFilter/MultiTreeSelectFilter.cjs +2 -2
- package/dist/Filters/components/MultiTreeSelectFilter/MultiTreeSelectFilter.js +2 -2
- package/dist/FormField/FormField.context.cjs +4 -0
- package/dist/FormField/FormField.context.d.ts +3 -0
- package/dist/FormField/FormField.context.js +4 -0
- package/dist/FormField/components/Nested/Nested.cjs +4 -2
- package/dist/FormField/components/Nested/Nested.js +5 -3
- package/dist/Helpers/css.utils.cjs +8 -0
- package/dist/Helpers/css.utils.js +8 -0
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +6 -2
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +7 -3
- package/dist/Inputs/components/Compose/CommonCompose.cjs +16 -14
- package/dist/Inputs/components/Compose/CommonCompose.js +17 -15
- package/dist/Inputs/components/Context/InputValue.context.cjs +13 -9
- package/dist/Inputs/components/Context/InputValue.context.d.ts +270 -4
- package/dist/Inputs/components/Context/InputValue.context.js +13 -9
- package/dist/Inputs/components/Context/InputValueProvider.cjs +7 -2
- package/dist/Inputs/components/Context/InputValueProvider.js +8 -3
- package/dist/Inputs/components/Context/NumericInputValueProvider.cjs +6 -1
- package/dist/Inputs/components/Context/NumericInputValueProvider.js +7 -2
- package/dist/Inputs/components/InputTag/InputTag.cjs +6 -3
- package/dist/Inputs/components/InputTag/InputTag.js +7 -4
- package/dist/Inputs/components/InputTag/InputTag.style.cjs +1 -1
- package/dist/Inputs/components/InputTag/InputTag.style.js +1 -1
- package/dist/Inputs/components/ResetButton/ResetButton.cjs +7 -4
- package/dist/Inputs/components/ResetButton/ResetButton.js +7 -4
- package/dist/Label/components/Required/Required.cjs +8 -8
- package/dist/Label/components/Required/Required.js +8 -8
- package/dist/Layouts/FlexDivider/FlexDivider.cjs +22 -0
- package/dist/Layouts/FlexDivider/FlexDivider.d.ts +2 -0
- package/dist/Layouts/FlexDivider/FlexDivider.js +22 -0
- package/dist/Layouts/FlexDivider/FlexDivider.style.cjs +46 -0
- package/dist/Layouts/FlexDivider/FlexDivider.style.d.ts +6 -0
- package/dist/Layouts/FlexDivider/FlexDivider.style.js +44 -0
- package/dist/Layouts/FlexDivider/FlexDivider.types.d.ts +15 -0
- package/dist/Layouts/FlexGroup/FlexGroup.cjs +20 -0
- package/dist/Layouts/FlexGroup/FlexGroup.d.ts +2 -0
- package/dist/Layouts/FlexGroup/FlexGroup.js +20 -0
- package/dist/Layouts/FlexGroup/FlexGroup.style.cjs +20 -0
- package/dist/Layouts/FlexGroup/FlexGroup.style.d.ts +9 -0
- package/dist/Layouts/FlexGroup/FlexGroup.style.js +18 -0
- package/dist/Layouts/FlexGroup/FlexGroup.types.d.ts +19 -0
- package/dist/Layouts/FlexItem/FlexItem.cjs +16 -0
- package/dist/Layouts/FlexItem/FlexItem.d.ts +2 -0
- package/dist/Layouts/FlexItem/FlexItem.js +16 -0
- package/dist/Layouts/FlexItem/FlexItem.style.cjs +14 -0
- package/dist/Layouts/FlexItem/FlexItem.style.d.ts +5 -0
- package/dist/Layouts/FlexItem/FlexItem.style.js +12 -0
- package/dist/Layouts/FlexItem/FlexItem.types.d.ts +14 -0
- package/dist/Layouts/FlexSplit/FlexSplit.cjs +10 -0
- package/dist/Layouts/FlexSplit/FlexSplit.d.ts +2 -0
- package/dist/Layouts/FlexSplit/FlexSplit.js +10 -0
- package/dist/Layouts/FlexSplit/FlexSplit.style.cjs +27 -0
- package/dist/Layouts/FlexSplit/FlexSplit.style.d.ts +8 -0
- package/dist/Layouts/FlexSplit/FlexSplit.style.js +25 -0
- package/dist/Layouts/FlexSplit/FlexSplit.types.d.ts +8 -0
- package/dist/Layouts/index.d.ts +8 -0
- package/dist/MidBar/MidBar.cjs +30 -0
- package/dist/MidBar/MidBar.d.ts +22 -0
- package/dist/MidBar/MidBar.js +30 -0
- package/dist/MidBar/MidBar.types.d.ts +6 -0
- package/dist/MidBar/components/Header/Header.cjs +32 -0
- package/dist/MidBar/components/Header/Header.d.ts +15 -0
- package/dist/MidBar/components/Header/Header.js +32 -0
- package/dist/MidBar/components/Header/Header.types.d.ts +13 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.cjs +8 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.d.ts +3 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.js +8 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.style.cjs +31 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.style.d.ts +1 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.style.js +29 -0
- package/dist/MidBar/components/Header/components/Compose/Compose.types.d.ts +2 -0
- package/dist/MidBar/components/Header/components/Group/Group.cjs +12 -0
- package/dist/MidBar/components/Header/components/Group/Group.d.ts +3 -0
- package/dist/MidBar/components/Header/components/Group/Group.js +12 -0
- package/dist/MidBar/components/Header/components/Group/Group.style.cjs +22 -0
- package/dist/MidBar/components/Header/components/Group/Group.style.d.ts +4 -0
- package/dist/MidBar/components/Header/components/Group/Group.style.js +20 -0
- package/dist/MidBar/components/Header/components/Group/Group.types.d.ts +5 -0
- package/dist/MidBar/index.d.ts +2 -0
- package/dist/MoreInfoIcon/MoreInfoIcon.style.cjs +1 -1
- package/dist/MoreInfoIcon/MoreInfoIcon.style.js +1 -1
- package/dist/RadioGroup/RadioGroup.cjs +5 -23
- package/dist/RadioGroup/RadioGroup.d.ts +2 -15
- package/dist/RadioGroup/RadioGroup.js +5 -23
- package/dist/RadioGroup/RadioGroup.types.d.ts +1 -27
- package/dist/RadioGroup/components/Compose/Compose.cjs +23 -12
- package/dist/RadioGroup/components/Compose/Compose.d.ts +1 -1
- package/dist/RadioGroup/components/Compose/Compose.js +23 -12
- package/dist/RadioGroup/components/Compose/Compose.style.cjs +3 -1
- package/dist/RadioGroup/components/Compose/Compose.style.js +3 -1
- package/dist/RadioGroup/components/Item/Item.context.cjs +5 -10
- package/dist/RadioGroup/components/Item/Item.context.d.ts +1 -2
- package/dist/RadioGroup/components/Item/Item.context.js +5 -10
- package/dist/RadioGroup/components/Item/components/Compose/Compose.cjs +1 -1
- package/dist/RadioGroup/components/Item/components/Compose/Compose.js +2 -2
- package/dist/RadioGroup/components/Item/components/Indicator/Indicator.cjs +3 -1
- package/dist/RadioGroup/components/Item/components/Indicator/Indicator.js +3 -1
- package/dist/SearchBar/components/SearchSection/components/Actions/components/ColumnSelector/ColumnSelector.cjs +5 -7
- package/dist/SearchBar/components/SearchSection/components/Actions/components/ColumnSelector/ColumnSelector.js +5 -7
- package/dist/SearchBar/components/SearchSection/components/Actions/components/FiltersToggle/FiltersToggle.cjs +11 -9
- package/dist/SearchBar/components/SearchSection/components/Actions/components/FiltersToggle/FiltersToggle.js +11 -9
- package/dist/Select/components/Context/Context.cjs +6 -4
- package/dist/Select/components/Context/Context.js +7 -5
- package/dist/Select/components/Trigger/components/Compose/Compose.cjs +5 -0
- package/dist/Select/components/Trigger/components/Compose/Compose.js +6 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.cjs +5 -0
- package/dist/Select/components/Trigger/components/Compose/Compose.style.js +5 -0
- package/dist/Stepper/Stepper.context.cjs +5 -10
- package/dist/Stepper/Stepper.context.d.ts +1 -2
- package/dist/Stepper/Stepper.context.js +5 -10
- package/dist/Stepper/Stepper.d.ts +4 -4
- package/dist/Stepper/components/Compose/Compose.cjs +6 -1
- package/dist/Stepper/components/Compose/Compose.d.ts +2 -2
- package/dist/Stepper/components/Compose/Compose.js +7 -2
- package/dist/Stepper/components/Step/Step.context.cjs +5 -10
- package/dist/Stepper/components/Step/Step.context.d.ts +1 -2
- package/dist/Stepper/components/Step/Step.context.js +5 -10
- package/dist/Stepper/components/Step/Step.d.ts +2 -3
- package/dist/Stepper/components/Step/components/Compose/Compose.cjs +1 -3
- package/dist/Stepper/components/Step/components/Compose/Compose.d.ts +1 -1
- package/dist/Stepper/components/Step/components/Compose/Compose.js +2 -4
- package/dist/Stepper/components/Step/components/Compose/Compose.style.cjs +2 -5
- package/dist/Stepper/components/Step/components/Compose/Compose.style.js +4 -7
- package/dist/Stepper/hooks/useStepperFocusing.cjs +31 -0
- package/dist/Stepper/hooks/useStepperFocusing.d.ts +16 -0
- package/dist/Stepper/hooks/useStepperFocusing.js +31 -0
- package/dist/Stepper/hooks/useStepperInteractive.cjs +30 -37
- package/dist/Stepper/hooks/useStepperInteractive.d.ts +2 -3
- package/dist/Stepper/hooks/useStepperInteractive.js +30 -37
- package/dist/ThemeModeSwitch/ThemeModeSwitch.cjs +64 -0
- package/dist/ThemeModeSwitch/ThemeModeSwitch.d.ts +2 -0
- package/dist/ThemeModeSwitch/ThemeModeSwitch.js +64 -0
- package/dist/ThemeModeSwitch/ThemeModeSwitch.style.cjs +38 -0
- package/dist/ThemeModeSwitch/ThemeModeSwitch.style.d.ts +4 -0
- package/dist/ThemeModeSwitch/ThemeModeSwitch.style.js +36 -0
- package/dist/ThemeModeSwitch/ThemeModeSwitch.types.d.ts +7 -0
- package/dist/ThemeModeSwitch/index.d.ts +3 -0
- package/dist/ThemeModeSwitch/useThemeModeSwitch.cjs +37 -0
- package/dist/ThemeModeSwitch/useThemeModeSwitch.d.ts +8 -0
- package/dist/ThemeModeSwitch/useThemeModeSwitch.js +37 -0
- package/dist/Toast/Toaster.cjs +4 -6
- package/dist/Toast/Toaster.d.ts +2 -1
- package/dist/Toast/Toaster.js +4 -6
- package/dist/Toast/Toaster.style.cjs +2 -2
- package/dist/Toast/Toaster.style.d.ts +2 -2
- package/dist/Toast/Toaster.style.js +3 -3
- package/dist/Toast/core/core.d.ts +3 -3
- package/dist/Toast/core/mapping.helpers.cjs +18 -2
- package/dist/Toast/core/mapping.helpers.d.ts +4 -3
- package/dist/Toast/core/mapping.helpers.js +22 -6
- package/dist/Toast/core/mapping.types.d.ts +3 -2
- package/dist/index.cjs +1092 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1139 -48
- package/dist/node_modules/clsx/dist/clsx.cjs +17 -0
- package/dist/node_modules/clsx/dist/clsx.js +17 -0
- package/dist/packages/components/node_modules/react-toastify/dist/react-toastify.esm.cjs +320 -0
- package/dist/packages/components/node_modules/react-toastify/dist/react-toastify.esm.js +318 -0
- package/dist/packages/icons/dist/multicolor/LoaderLarge.cjs +2 -2
- package/dist/packages/icons/dist/multicolor/LoaderLarge.js +2 -2
- package/dist/packages/icons/dist/multicolor/dark/LoaderLarge.cjs +3 -8
- package/dist/packages/icons/dist/multicolor/dark/LoaderLarge.js +3 -8
- package/dist/packages/icons/dist/multicolor/light/LoaderLarge.cjs +3 -8
- package/dist/packages/icons/dist/multicolor/light/LoaderLarge.js +3 -8
- package/package.json +4 -4
- package/dist/node_modules/clsx/dist/clsx.m.cjs +0 -15
- package/dist/node_modules/clsx/dist/clsx.m.js +0 -15
- package/dist/node_modules/react-toastify/dist/react-toastify.esm.cjs +0 -300
- package/dist/node_modules/react-toastify/dist/react-toastify.esm.js +0 -298
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const React = require("react");
|
|
4
|
-
const clsx_m = require("../../clsx/dist/clsx.m.cjs");
|
|
5
|
-
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
6
|
-
const React__default = /* @__PURE__ */ _interopDefault(React);
|
|
7
|
-
const u = (t) => "number" == typeof t && !isNaN(t), d = (t) => "string" == typeof t, p = (t) => "function" == typeof t, m = (t) => d(t) || p(t) ? t : null, f = (t) => React.isValidElement(t) || d(t) || p(t) || u(t);
|
|
8
|
-
function g(t, e, n) {
|
|
9
|
-
void 0 === n && (n = 300);
|
|
10
|
-
const { scrollHeight: o, style: s } = t;
|
|
11
|
-
requestAnimationFrame(() => {
|
|
12
|
-
s.minHeight = "initial", s.height = o + "px", s.transition = `all ${n}ms`, requestAnimationFrame(() => {
|
|
13
|
-
s.height = "0", s.padding = "0", s.margin = "0", setTimeout(e, n);
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function h(e) {
|
|
18
|
-
let { enter: a, exit: r, appendPosition: i = false, collapse: l = true, collapseDuration: c = 300 } = e;
|
|
19
|
-
return function(e2) {
|
|
20
|
-
let { children: u2, position: d2, preventExitTransition: p2, done: m2, nodeRef: f2, isIn: h2 } = e2;
|
|
21
|
-
const y2 = i ? `${a}--${d2}` : a, v2 = i ? `${r}--${d2}` : r, T2 = React.useRef(0);
|
|
22
|
-
return React.useLayoutEffect(() => {
|
|
23
|
-
const t = f2.current, e3 = y2.split(" "), n = (o) => {
|
|
24
|
-
o.target === f2.current && (t.dispatchEvent(new Event("d")), t.removeEventListener("animationend", n), t.removeEventListener("animationcancel", n), 0 === T2.current && "animationcancel" !== o.type && t.classList.remove(...e3));
|
|
25
|
-
};
|
|
26
|
-
t.classList.add(...e3), t.addEventListener("animationend", n), t.addEventListener("animationcancel", n);
|
|
27
|
-
}, []), React.useEffect(() => {
|
|
28
|
-
const t = f2.current, e3 = () => {
|
|
29
|
-
t.removeEventListener("animationend", e3), l ? g(t, m2, c) : m2();
|
|
30
|
-
};
|
|
31
|
-
h2 || (p2 ? e3() : (T2.current = 1, t.className += ` ${v2}`, t.addEventListener("animationend", e3)));
|
|
32
|
-
}, [h2]), React__default.default.createElement(React__default.default.Fragment, null, u2);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function y(t, e) {
|
|
36
|
-
return null != t ? { content: t.content, containerId: t.props.containerId, id: t.props.toastId, theme: t.props.theme, type: t.props.type, data: t.props.data || {}, isLoading: t.props.isLoading, icon: t.props.icon, status: e } : {};
|
|
37
|
-
}
|
|
38
|
-
const v = { list: /* @__PURE__ */ new Map(), emitQueue: /* @__PURE__ */ new Map(), on(t, e) {
|
|
39
|
-
return this.list.has(t) || this.list.set(t, []), this.list.get(t).push(e), this;
|
|
40
|
-
}, off(t, e) {
|
|
41
|
-
if (e) {
|
|
42
|
-
const n = this.list.get(t).filter((t2) => t2 !== e);
|
|
43
|
-
return this.list.set(t, n), this;
|
|
44
|
-
}
|
|
45
|
-
return this.list.delete(t), this;
|
|
46
|
-
}, cancelEmit(t) {
|
|
47
|
-
const e = this.emitQueue.get(t);
|
|
48
|
-
return e && (e.forEach(clearTimeout), this.emitQueue.delete(t)), this;
|
|
49
|
-
}, emit(t) {
|
|
50
|
-
this.list.has(t) && this.list.get(t).forEach((e) => {
|
|
51
|
-
const n = setTimeout(() => {
|
|
52
|
-
e(...[].slice.call(arguments, 1));
|
|
53
|
-
}, 0);
|
|
54
|
-
this.emitQueue.has(t) || this.emitQueue.set(t, []), this.emitQueue.get(t).push(n);
|
|
55
|
-
});
|
|
56
|
-
} }, T = (e) => {
|
|
57
|
-
let { theme: n, type: o, ...s } = e;
|
|
58
|
-
return React__default.default.createElement("svg", { viewBox: "0 0 24 24", width: "100%", height: "100%", fill: "colored" === n ? "currentColor" : `var(--toastify-icon-color-${o})`, ...s });
|
|
59
|
-
}, E = { info: function(e) {
|
|
60
|
-
return React__default.default.createElement(T, { ...e }, React__default.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" }));
|
|
61
|
-
}, warning: function(e) {
|
|
62
|
-
return React__default.default.createElement(T, { ...e }, React__default.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" }));
|
|
63
|
-
}, success: function(e) {
|
|
64
|
-
return React__default.default.createElement(T, { ...e }, React__default.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" }));
|
|
65
|
-
}, error: function(e) {
|
|
66
|
-
return React__default.default.createElement(T, { ...e }, React__default.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" }));
|
|
67
|
-
}, spinner: function() {
|
|
68
|
-
return React__default.default.createElement("div", { className: "Toastify__spinner" });
|
|
69
|
-
} };
|
|
70
|
-
function C(t) {
|
|
71
|
-
const [, o] = React.useReducer((t2) => t2 + 1, 0), [l, c] = React.useState([]), g2 = React.useRef(null), h2 = React.useRef(/* @__PURE__ */ new Map()).current, T2 = (t2) => -1 !== l.indexOf(t2), C2 = React.useRef({ toastKey: 1, displayedToast: 0, count: 0, queue: [], props: t, containerId: null, isToastActive: T2, getToast: (t2) => h2.get(t2) }).current;
|
|
72
|
-
function b2(t2) {
|
|
73
|
-
let { containerId: e } = t2;
|
|
74
|
-
const { limit: n } = C2.props;
|
|
75
|
-
!n || e && C2.containerId !== e || (C2.count -= C2.queue.length, C2.queue = []);
|
|
76
|
-
}
|
|
77
|
-
function I2(t2) {
|
|
78
|
-
c((e) => null == t2 ? [] : e.filter((e2) => e2 !== t2));
|
|
79
|
-
}
|
|
80
|
-
function _2() {
|
|
81
|
-
const { toastContent: t2, toastProps: e, staleId: n } = C2.queue.shift();
|
|
82
|
-
O2(t2, e, n);
|
|
83
|
-
}
|
|
84
|
-
function L2(t2, n) {
|
|
85
|
-
let { delay: s, staleId: r, ...i } = n;
|
|
86
|
-
if (!f(t2) || function(t3) {
|
|
87
|
-
return !g2.current || C2.props.enableMultiContainer && t3.containerId !== C2.props.containerId || h2.has(t3.toastId) && null == t3.updateId;
|
|
88
|
-
}(i)) return;
|
|
89
|
-
const { toastId: l2, updateId: c2, data: T3 } = i, { props: b3 } = C2, L3 = () => I2(l2), N2 = null == c2;
|
|
90
|
-
N2 && C2.count++;
|
|
91
|
-
const M2 = { ...b3, style: b3.toastStyle, key: C2.toastKey++, ...Object.fromEntries(Object.entries(i).filter((t3) => {
|
|
92
|
-
let [e, n2] = t3;
|
|
93
|
-
return null != n2;
|
|
94
|
-
})), toastId: l2, updateId: c2, data: T3, closeToast: L3, isIn: false, className: m(i.className || b3.toastClassName), bodyClassName: m(i.bodyClassName || b3.bodyClassName), progressClassName: m(i.progressClassName || b3.progressClassName), autoClose: !i.isLoading && (R2 = i.autoClose, w = b3.autoClose, false === R2 || u(R2) && R2 > 0 ? R2 : w), deleteToast() {
|
|
95
|
-
const t3 = y(h2.get(l2), "removed");
|
|
96
|
-
h2.delete(l2), v.emit(4, t3);
|
|
97
|
-
const e = C2.queue.length;
|
|
98
|
-
if (C2.count = null == l2 ? C2.count - C2.displayedToast : C2.count - 1, C2.count < 0 && (C2.count = 0), e > 0) {
|
|
99
|
-
const t4 = null == l2 ? C2.props.limit : 1;
|
|
100
|
-
if (1 === e || 1 === t4) C2.displayedToast++, _2();
|
|
101
|
-
else {
|
|
102
|
-
const n2 = t4 > e ? e : t4;
|
|
103
|
-
C2.displayedToast = n2;
|
|
104
|
-
for (let t5 = 0; t5 < n2; t5++) _2();
|
|
105
|
-
}
|
|
106
|
-
} else o();
|
|
107
|
-
} };
|
|
108
|
-
var R2, w;
|
|
109
|
-
M2.iconOut = function(t3) {
|
|
110
|
-
let { theme: n2, type: o2, isLoading: s2, icon: r2 } = t3, i2 = null;
|
|
111
|
-
const l3 = { theme: n2, type: o2 };
|
|
112
|
-
return false === r2 || (p(r2) ? i2 = r2(l3) : React.isValidElement(r2) ? i2 = React.cloneElement(r2, l3) : d(r2) || u(r2) ? i2 = r2 : s2 ? i2 = E.spinner() : ((t4) => t4 in E)(o2) && (i2 = E[o2](l3))), i2;
|
|
113
|
-
}(M2), p(i.onOpen) && (M2.onOpen = i.onOpen), p(i.onClose) && (M2.onClose = i.onClose), M2.closeButton = b3.closeButton, false === i.closeButton || f(i.closeButton) ? M2.closeButton = i.closeButton : true === i.closeButton && (M2.closeButton = !f(b3.closeButton) || b3.closeButton);
|
|
114
|
-
let x = t2;
|
|
115
|
-
React.isValidElement(t2) && !d(t2.type) ? x = React.cloneElement(t2, { closeToast: L3, toastProps: M2, data: T3 }) : p(t2) && (x = t2({ closeToast: L3, toastProps: M2, data: T3 })), b3.limit && b3.limit > 0 && C2.count > b3.limit && N2 ? C2.queue.push({ toastContent: x, toastProps: M2, staleId: r }) : u(s) ? setTimeout(() => {
|
|
116
|
-
O2(x, M2, r);
|
|
117
|
-
}, s) : O2(x, M2, r);
|
|
118
|
-
}
|
|
119
|
-
function O2(t2, e, n) {
|
|
120
|
-
const { toastId: o2 } = e;
|
|
121
|
-
n && h2.delete(n);
|
|
122
|
-
const s = { content: t2, props: e };
|
|
123
|
-
h2.set(o2, s), c((t3) => [...t3, o2].filter((t4) => t4 !== n)), v.emit(4, y(s, null == s.props.updateId ? "added" : "updated"));
|
|
124
|
-
}
|
|
125
|
-
return React.useEffect(() => (C2.containerId = t.containerId, v.cancelEmit(3).on(0, L2).on(1, (t2) => g2.current && I2(t2)).on(5, b2).emit(2, C2), () => {
|
|
126
|
-
h2.clear(), v.emit(3, C2);
|
|
127
|
-
}), []), React.useEffect(() => {
|
|
128
|
-
C2.props = t, C2.isToastActive = T2, C2.displayedToast = l.length;
|
|
129
|
-
}), { getToastToRender: function(e) {
|
|
130
|
-
const n = /* @__PURE__ */ new Map(), o2 = Array.from(h2.values());
|
|
131
|
-
return t.newestOnTop && o2.reverse(), o2.forEach((t2) => {
|
|
132
|
-
const { position: e2 } = t2.props;
|
|
133
|
-
n.has(e2) || n.set(e2, []), n.get(e2).push(t2);
|
|
134
|
-
}), Array.from(n, (t2) => e(t2[0], t2[1]));
|
|
135
|
-
}, containerRef: g2, isToastActive: T2 };
|
|
136
|
-
}
|
|
137
|
-
function b(t) {
|
|
138
|
-
return t.targetTouches && t.targetTouches.length >= 1 ? t.targetTouches[0].clientX : t.clientX;
|
|
139
|
-
}
|
|
140
|
-
function I(t) {
|
|
141
|
-
return t.targetTouches && t.targetTouches.length >= 1 ? t.targetTouches[0].clientY : t.clientY;
|
|
142
|
-
}
|
|
143
|
-
function _(t) {
|
|
144
|
-
const [o, a] = React.useState(false), [r, l] = React.useState(false), c = React.useRef(null), u2 = React.useRef({ start: 0, x: 0, y: 0, delta: 0, removalDistance: 0, canCloseOnClick: true, canDrag: false, boundingRect: null, didMove: false }).current, d2 = React.useRef(t), { autoClose: m2, pauseOnHover: f2, closeToast: g2, onClick: h2, closeOnClick: y2 } = t;
|
|
145
|
-
function v2(e) {
|
|
146
|
-
if (t.draggable) {
|
|
147
|
-
"touchstart" === e.nativeEvent.type && e.nativeEvent.preventDefault(), u2.didMove = false, document.addEventListener("mousemove", _2), document.addEventListener("mouseup", L2), document.addEventListener("touchmove", _2), document.addEventListener("touchend", L2);
|
|
148
|
-
const n = c.current;
|
|
149
|
-
u2.canCloseOnClick = true, u2.canDrag = true, u2.boundingRect = n.getBoundingClientRect(), n.style.transition = "", u2.x = b(e.nativeEvent), u2.y = I(e.nativeEvent), "x" === t.draggableDirection ? (u2.start = u2.x, u2.removalDistance = n.offsetWidth * (t.draggablePercent / 100)) : (u2.start = u2.y, u2.removalDistance = n.offsetHeight * (80 === t.draggablePercent ? 1.5 * t.draggablePercent : t.draggablePercent / 100));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function T2(e) {
|
|
153
|
-
if (u2.boundingRect) {
|
|
154
|
-
const { top: n, bottom: o2, left: s, right: a2 } = u2.boundingRect;
|
|
155
|
-
"touchend" !== e.nativeEvent.type && t.pauseOnHover && u2.x >= s && u2.x <= a2 && u2.y >= n && u2.y <= o2 ? C2() : E2();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function E2() {
|
|
159
|
-
a(true);
|
|
160
|
-
}
|
|
161
|
-
function C2() {
|
|
162
|
-
a(false);
|
|
163
|
-
}
|
|
164
|
-
function _2(e) {
|
|
165
|
-
const n = c.current;
|
|
166
|
-
u2.canDrag && n && (u2.didMove = true, o && C2(), u2.x = b(e), u2.y = I(e), u2.delta = "x" === t.draggableDirection ? u2.x - u2.start : u2.y - u2.start, u2.start !== u2.x && (u2.canCloseOnClick = false), n.style.transform = `translate${t.draggableDirection}(${u2.delta}px)`, n.style.opacity = "" + (1 - Math.abs(u2.delta / u2.removalDistance)));
|
|
167
|
-
}
|
|
168
|
-
function L2() {
|
|
169
|
-
document.removeEventListener("mousemove", _2), document.removeEventListener("mouseup", L2), document.removeEventListener("touchmove", _2), document.removeEventListener("touchend", L2);
|
|
170
|
-
const e = c.current;
|
|
171
|
-
if (u2.canDrag && u2.didMove && e) {
|
|
172
|
-
if (u2.canDrag = false, Math.abs(u2.delta) > u2.removalDistance) return l(true), void t.closeToast();
|
|
173
|
-
e.style.transition = "transform 0.2s, opacity 0.2s", e.style.transform = `translate${t.draggableDirection}(0)`, e.style.opacity = "1";
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
React.useEffect(() => {
|
|
177
|
-
d2.current = t;
|
|
178
|
-
}), React.useEffect(() => (c.current && c.current.addEventListener("d", E2, { once: true }), p(t.onOpen) && t.onOpen(React.isValidElement(t.children) && t.children.props), () => {
|
|
179
|
-
const t2 = d2.current;
|
|
180
|
-
p(t2.onClose) && t2.onClose(React.isValidElement(t2.children) && t2.children.props);
|
|
181
|
-
}), []), React.useEffect(() => (t.pauseOnFocusLoss && (document.hasFocus() || C2(), window.addEventListener("focus", E2), window.addEventListener("blur", C2)), () => {
|
|
182
|
-
t.pauseOnFocusLoss && (window.removeEventListener("focus", E2), window.removeEventListener("blur", C2));
|
|
183
|
-
}), [t.pauseOnFocusLoss]);
|
|
184
|
-
const O2 = { onMouseDown: v2, onTouchStart: v2, onMouseUp: T2, onTouchEnd: T2 };
|
|
185
|
-
return m2 && f2 && (O2.onMouseEnter = C2, O2.onMouseLeave = E2), y2 && (O2.onClick = (t2) => {
|
|
186
|
-
h2 && h2(t2), u2.canCloseOnClick && g2();
|
|
187
|
-
}), { playToast: E2, pauseToast: C2, isRunning: o, preventExitTransition: r, toastRef: c, eventHandlers: O2 };
|
|
188
|
-
}
|
|
189
|
-
function L(e) {
|
|
190
|
-
let { closeToast: n, theme: o, ariaLabel: s = "close" } = e;
|
|
191
|
-
return React__default.default.createElement("button", { className: `Toastify__close-button Toastify__close-button--${o}`, type: "button", onClick: (t) => {
|
|
192
|
-
t.stopPropagation(), n(t);
|
|
193
|
-
}, "aria-label": s }, React__default.default.createElement("svg", { "aria-hidden": "true", viewBox: "0 0 14 16" }, React__default.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" })));
|
|
194
|
-
}
|
|
195
|
-
function O(e) {
|
|
196
|
-
let { delay: n, isRunning: o, closeToast: s, type: a = "default", hide: r, className: i, style: l, controlledProgress: u2, progress: d2, rtl: m2, isIn: f2, theme: g2 } = e;
|
|
197
|
-
const h2 = r || u2 && 0 === d2, y2 = { ...l, animationDuration: `${n}ms`, animationPlayState: o ? "running" : "paused", opacity: h2 ? 0 : 1 };
|
|
198
|
-
u2 && (y2.transform = `scaleX(${d2})`);
|
|
199
|
-
const v2 = clsx_m.clsx("Toastify__progress-bar", u2 ? "Toastify__progress-bar--controlled" : "Toastify__progress-bar--animated", `Toastify__progress-bar-theme--${g2}`, `Toastify__progress-bar--${a}`, { "Toastify__progress-bar--rtl": m2 }), T2 = p(i) ? i({ rtl: m2, type: a, defaultClassName: v2 }) : clsx_m.clsx(v2, i);
|
|
200
|
-
return React__default.default.createElement("div", { role: "progressbar", "aria-hidden": h2 ? "true" : "false", "aria-label": "notification timer", className: T2, style: y2, [u2 && d2 >= 1 ? "onTransitionEnd" : "onAnimationEnd"]: u2 && d2 < 1 ? null : () => {
|
|
201
|
-
f2 && s();
|
|
202
|
-
} });
|
|
203
|
-
}
|
|
204
|
-
const N = (n) => {
|
|
205
|
-
const { isRunning: o, preventExitTransition: s, toastRef: r, eventHandlers: i } = _(n), { closeButton: l, children: u2, autoClose: d2, onClick: m2, type: f2, hideProgressBar: g2, closeToast: h2, transition: y2, position: v2, className: T2, style: E2, bodyClassName: C2, bodyStyle: b2, progressClassName: I2, progressStyle: N2, updateId: M2, role: R2, progress: w, rtl: x, toastId: $, deleteToast: k2, isIn: P2, isLoading: B2, iconOut: D2, closeOnClick: A2, theme: z2 } = n, F2 = clsx_m.clsx("Toastify__toast", `Toastify__toast-theme--${z2}`, `Toastify__toast--${f2}`, { "Toastify__toast--rtl": x }, { "Toastify__toast--close-on-click": A2 }), H2 = p(T2) ? T2({ rtl: x, position: v2, type: f2, defaultClassName: F2 }) : clsx_m.clsx(F2, T2), S2 = !!w || !d2, q2 = { closeToast: h2, type: f2, theme: z2 };
|
|
206
|
-
let Q2 = null;
|
|
207
|
-
return false === l || (Q2 = p(l) ? l(q2) : React.isValidElement(l) ? React.cloneElement(l, q2) : L(q2)), React__default.default.createElement(y2, { isIn: P2, done: k2, position: v2, preventExitTransition: s, nodeRef: r }, React__default.default.createElement("div", { id: $, onClick: m2, className: H2, ...i, style: E2, ref: r }, React__default.default.createElement("div", { ...P2 && { role: R2 }, className: p(C2) ? C2({ type: f2 }) : clsx_m.clsx("Toastify__toast-body", C2), style: b2 }, null != D2 && React__default.default.createElement("div", { className: clsx_m.clsx("Toastify__toast-icon", { "Toastify--animate-icon Toastify__zoom-enter": !B2 }) }, D2), React__default.default.createElement("div", null, u2)), Q2, React__default.default.createElement(O, { ...M2 && !S2 ? { key: `pb-${M2}` } : {}, rtl: x, theme: z2, delay: d2, isRunning: o, isIn: P2, closeToast: h2, hide: g2, type: f2, style: N2, className: I2, controlledProgress: S2, progress: w || 0 })));
|
|
208
|
-
}, M = function(t, e) {
|
|
209
|
-
return void 0 === e && (e = false), { enter: `Toastify--animate Toastify__${t}-enter`, exit: `Toastify--animate Toastify__${t}-exit`, appendPosition: e };
|
|
210
|
-
}, R = h(M("bounce", true));
|
|
211
|
-
h(M("slide", true));
|
|
212
|
-
h(M("zoom"));
|
|
213
|
-
h(M("flip"));
|
|
214
|
-
const k = React.forwardRef((e, n) => {
|
|
215
|
-
const { getToastToRender: o, containerRef: a, isToastActive: r } = C(e), { className: i, style: l, rtl: u2, containerId: d2 } = e;
|
|
216
|
-
function f2(t) {
|
|
217
|
-
const e2 = clsx_m.clsx("Toastify__toast-container", `Toastify__toast-container--${t}`, { "Toastify__toast-container--rtl": u2 });
|
|
218
|
-
return p(i) ? i({ position: t, rtl: u2, defaultClassName: e2 }) : clsx_m.clsx(e2, m(i));
|
|
219
|
-
}
|
|
220
|
-
return React.useEffect(() => {
|
|
221
|
-
n && (n.current = a.current);
|
|
222
|
-
}, []), React__default.default.createElement("div", { ref: a, className: "Toastify", id: d2 }, o((e2, n2) => {
|
|
223
|
-
const o2 = n2.length ? { ...l } : { ...l, pointerEvents: "none" };
|
|
224
|
-
return React__default.default.createElement("div", { className: f2(e2), style: o2, key: `container-${e2}` }, n2.map((e3, o3) => {
|
|
225
|
-
let { content: s, props: a2 } = e3;
|
|
226
|
-
return React__default.default.createElement(N, { ...a2, isIn: r(a2.toastId), style: { ...a2.style, "--nth": o3 + 1, "--len": n2.length }, key: `toast-${a2.key}` }, s);
|
|
227
|
-
}));
|
|
228
|
-
}));
|
|
229
|
-
});
|
|
230
|
-
k.displayName = "ToastContainer", k.defaultProps = { position: "top-right", transition: R, autoClose: 5e3, closeButton: L, pauseOnHover: true, pauseOnFocusLoss: true, closeOnClick: true, draggable: true, draggablePercent: 80, draggableDirection: "x", role: "alert", theme: "light" };
|
|
231
|
-
let P, B = /* @__PURE__ */ new Map(), D = [], A = 1;
|
|
232
|
-
function z() {
|
|
233
|
-
return "" + A++;
|
|
234
|
-
}
|
|
235
|
-
function F(t) {
|
|
236
|
-
return t && (d(t.toastId) || u(t.toastId)) ? t.toastId : z();
|
|
237
|
-
}
|
|
238
|
-
function H(t, e) {
|
|
239
|
-
return B.size > 0 ? v.emit(0, t, e) : D.push({ content: t, options: e }), e.toastId;
|
|
240
|
-
}
|
|
241
|
-
function S(t, e) {
|
|
242
|
-
return { ...e, type: e && e.type || t, toastId: F(e) };
|
|
243
|
-
}
|
|
244
|
-
function q(t) {
|
|
245
|
-
return (e, n) => H(e, S(t, n));
|
|
246
|
-
}
|
|
247
|
-
function Q(t, e) {
|
|
248
|
-
return H(t, S("default", e));
|
|
249
|
-
}
|
|
250
|
-
Q.loading = (t, e) => H(t, S("default", { isLoading: true, autoClose: false, closeOnClick: false, closeButton: false, draggable: false, ...e })), Q.promise = function(t, e, n) {
|
|
251
|
-
let o, { pending: s, error: a, success: r } = e;
|
|
252
|
-
s && (o = d(s) ? Q.loading(s, n) : Q.loading(s.render, { ...n, ...s }));
|
|
253
|
-
const i = { isLoading: null, autoClose: null, closeOnClick: null, closeButton: null, draggable: null }, l = (t2, e2, s2) => {
|
|
254
|
-
if (null == e2) return void Q.dismiss(o);
|
|
255
|
-
const a2 = { type: t2, ...i, ...n, data: s2 }, r2 = d(e2) ? { render: e2 } : e2;
|
|
256
|
-
return o ? Q.update(o, { ...a2, ...r2 }) : Q(r2.render, { ...a2, ...r2 }), s2;
|
|
257
|
-
}, c = p(t) ? t() : t;
|
|
258
|
-
return c.then((t2) => l("success", r, t2)).catch((t2) => l("error", a, t2)), c;
|
|
259
|
-
}, Q.success = q("success"), Q.info = q("info"), Q.error = q("error"), Q.warning = q("warning"), Q.warn = Q.warning, Q.dark = (t, e) => H(t, S("default", { theme: "dark", ...e })), Q.dismiss = (t) => {
|
|
260
|
-
B.size > 0 ? v.emit(1, t) : D = D.filter((e) => null != t && e.options.toastId !== t);
|
|
261
|
-
}, Q.clearWaitingQueue = function(t) {
|
|
262
|
-
return void 0 === t && (t = {}), v.emit(5, t);
|
|
263
|
-
}, Q.isActive = (t) => {
|
|
264
|
-
let e = false;
|
|
265
|
-
return B.forEach((n) => {
|
|
266
|
-
n.isToastActive && n.isToastActive(t) && (e = true);
|
|
267
|
-
}), e;
|
|
268
|
-
}, Q.update = function(t, e) {
|
|
269
|
-
void 0 === e && (e = {}), setTimeout(() => {
|
|
270
|
-
const n = function(t2, e2) {
|
|
271
|
-
let { containerId: n2 } = e2;
|
|
272
|
-
const o = B.get(n2 || P);
|
|
273
|
-
return o && o.getToast(t2);
|
|
274
|
-
}(t, e);
|
|
275
|
-
if (n) {
|
|
276
|
-
const { props: o, content: s } = n, a = { delay: 100, ...o, ...e, toastId: e.toastId || t, updateId: z() };
|
|
277
|
-
a.toastId !== t && (a.staleId = t);
|
|
278
|
-
const r = a.render || s;
|
|
279
|
-
delete a.render, H(r, a);
|
|
280
|
-
}
|
|
281
|
-
}, 0);
|
|
282
|
-
}, Q.done = (t) => {
|
|
283
|
-
Q.update(t, { progress: 1 });
|
|
284
|
-
}, Q.onChange = (t) => (v.on(4, t), () => {
|
|
285
|
-
v.off(4, t);
|
|
286
|
-
}), Q.POSITION = { TOP_LEFT: "top-left", TOP_RIGHT: "top-right", TOP_CENTER: "top-center", BOTTOM_LEFT: "bottom-left", BOTTOM_RIGHT: "bottom-right", BOTTOM_CENTER: "bottom-center" }, Q.TYPE = { INFO: "info", SUCCESS: "success", WARNING: "warning", ERROR: "error", DEFAULT: "default" }, v.on(2, (t) => {
|
|
287
|
-
P = t.containerId || t, B.set(P, t), D.forEach((t2) => {
|
|
288
|
-
v.emit(0, t2.content, t2.options);
|
|
289
|
-
}), D = [];
|
|
290
|
-
}).on(3, (t) => {
|
|
291
|
-
B.delete(t.containerId || t), 0 === B.size && v.off(0).off(1).off(5);
|
|
292
|
-
});
|
|
293
|
-
exports.Bounce = R;
|
|
294
|
-
exports.Icons = E;
|
|
295
|
-
exports.ToastContainer = k;
|
|
296
|
-
exports.collapseToast = g;
|
|
297
|
-
exports.cssTransition = h;
|
|
298
|
-
exports.toast = Q;
|
|
299
|
-
exports.useToast = _;
|
|
300
|
-
exports.useToastContainer = C;
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import React__default, { forwardRef, useEffect, useReducer, useState, useRef, isValidElement, cloneElement, useLayoutEffect } from "react";
|
|
2
|
-
import { clsx } from "../../clsx/dist/clsx.m.js";
|
|
3
|
-
const u = (t) => "number" == typeof t && !isNaN(t), d = (t) => "string" == typeof t, p = (t) => "function" == typeof t, m = (t) => d(t) || p(t) ? t : null, f = (t) => isValidElement(t) || d(t) || p(t) || u(t);
|
|
4
|
-
function g(t, e, n) {
|
|
5
|
-
void 0 === n && (n = 300);
|
|
6
|
-
const { scrollHeight: o, style: s } = t;
|
|
7
|
-
requestAnimationFrame(() => {
|
|
8
|
-
s.minHeight = "initial", s.height = o + "px", s.transition = `all ${n}ms`, requestAnimationFrame(() => {
|
|
9
|
-
s.height = "0", s.padding = "0", s.margin = "0", setTimeout(e, n);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function h(e) {
|
|
14
|
-
let { enter: a, exit: r, appendPosition: i = false, collapse: l = true, collapseDuration: c = 300 } = e;
|
|
15
|
-
return function(e2) {
|
|
16
|
-
let { children: u2, position: d2, preventExitTransition: p2, done: m2, nodeRef: f2, isIn: h2 } = e2;
|
|
17
|
-
const y2 = i ? `${a}--${d2}` : a, v2 = i ? `${r}--${d2}` : r, T2 = useRef(0);
|
|
18
|
-
return useLayoutEffect(() => {
|
|
19
|
-
const t = f2.current, e3 = y2.split(" "), n = (o) => {
|
|
20
|
-
o.target === f2.current && (t.dispatchEvent(new Event("d")), t.removeEventListener("animationend", n), t.removeEventListener("animationcancel", n), 0 === T2.current && "animationcancel" !== o.type && t.classList.remove(...e3));
|
|
21
|
-
};
|
|
22
|
-
t.classList.add(...e3), t.addEventListener("animationend", n), t.addEventListener("animationcancel", n);
|
|
23
|
-
}, []), useEffect(() => {
|
|
24
|
-
const t = f2.current, e3 = () => {
|
|
25
|
-
t.removeEventListener("animationend", e3), l ? g(t, m2, c) : m2();
|
|
26
|
-
};
|
|
27
|
-
h2 || (p2 ? e3() : (T2.current = 1, t.className += ` ${v2}`, t.addEventListener("animationend", e3)));
|
|
28
|
-
}, [h2]), React__default.createElement(React__default.Fragment, null, u2);
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function y(t, e) {
|
|
32
|
-
return null != t ? { content: t.content, containerId: t.props.containerId, id: t.props.toastId, theme: t.props.theme, type: t.props.type, data: t.props.data || {}, isLoading: t.props.isLoading, icon: t.props.icon, status: e } : {};
|
|
33
|
-
}
|
|
34
|
-
const v = { list: /* @__PURE__ */ new Map(), emitQueue: /* @__PURE__ */ new Map(), on(t, e) {
|
|
35
|
-
return this.list.has(t) || this.list.set(t, []), this.list.get(t).push(e), this;
|
|
36
|
-
}, off(t, e) {
|
|
37
|
-
if (e) {
|
|
38
|
-
const n = this.list.get(t).filter((t2) => t2 !== e);
|
|
39
|
-
return this.list.set(t, n), this;
|
|
40
|
-
}
|
|
41
|
-
return this.list.delete(t), this;
|
|
42
|
-
}, cancelEmit(t) {
|
|
43
|
-
const e = this.emitQueue.get(t);
|
|
44
|
-
return e && (e.forEach(clearTimeout), this.emitQueue.delete(t)), this;
|
|
45
|
-
}, emit(t) {
|
|
46
|
-
this.list.has(t) && this.list.get(t).forEach((e) => {
|
|
47
|
-
const n = setTimeout(() => {
|
|
48
|
-
e(...[].slice.call(arguments, 1));
|
|
49
|
-
}, 0);
|
|
50
|
-
this.emitQueue.has(t) || this.emitQueue.set(t, []), this.emitQueue.get(t).push(n);
|
|
51
|
-
});
|
|
52
|
-
} }, T = (e) => {
|
|
53
|
-
let { theme: n, type: o, ...s } = e;
|
|
54
|
-
return React__default.createElement("svg", { viewBox: "0 0 24 24", width: "100%", height: "100%", fill: "colored" === n ? "currentColor" : `var(--toastify-icon-color-${o})`, ...s });
|
|
55
|
-
}, E = { info: function(e) {
|
|
56
|
-
return React__default.createElement(T, { ...e }, React__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" }));
|
|
57
|
-
}, warning: function(e) {
|
|
58
|
-
return React__default.createElement(T, { ...e }, React__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" }));
|
|
59
|
-
}, success: function(e) {
|
|
60
|
-
return React__default.createElement(T, { ...e }, React__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" }));
|
|
61
|
-
}, error: function(e) {
|
|
62
|
-
return React__default.createElement(T, { ...e }, React__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" }));
|
|
63
|
-
}, spinner: function() {
|
|
64
|
-
return React__default.createElement("div", { className: "Toastify__spinner" });
|
|
65
|
-
} };
|
|
66
|
-
function C(t) {
|
|
67
|
-
const [, o] = useReducer((t2) => t2 + 1, 0), [l, c] = useState([]), g2 = useRef(null), h2 = useRef(/* @__PURE__ */ new Map()).current, T2 = (t2) => -1 !== l.indexOf(t2), C2 = useRef({ toastKey: 1, displayedToast: 0, count: 0, queue: [], props: t, containerId: null, isToastActive: T2, getToast: (t2) => h2.get(t2) }).current;
|
|
68
|
-
function b2(t2) {
|
|
69
|
-
let { containerId: e } = t2;
|
|
70
|
-
const { limit: n } = C2.props;
|
|
71
|
-
!n || e && C2.containerId !== e || (C2.count -= C2.queue.length, C2.queue = []);
|
|
72
|
-
}
|
|
73
|
-
function I2(t2) {
|
|
74
|
-
c((e) => null == t2 ? [] : e.filter((e2) => e2 !== t2));
|
|
75
|
-
}
|
|
76
|
-
function _2() {
|
|
77
|
-
const { toastContent: t2, toastProps: e, staleId: n } = C2.queue.shift();
|
|
78
|
-
O2(t2, e, n);
|
|
79
|
-
}
|
|
80
|
-
function L2(t2, n) {
|
|
81
|
-
let { delay: s, staleId: r, ...i } = n;
|
|
82
|
-
if (!f(t2) || function(t3) {
|
|
83
|
-
return !g2.current || C2.props.enableMultiContainer && t3.containerId !== C2.props.containerId || h2.has(t3.toastId) && null == t3.updateId;
|
|
84
|
-
}(i)) return;
|
|
85
|
-
const { toastId: l2, updateId: c2, data: T3 } = i, { props: b3 } = C2, L3 = () => I2(l2), N2 = null == c2;
|
|
86
|
-
N2 && C2.count++;
|
|
87
|
-
const M2 = { ...b3, style: b3.toastStyle, key: C2.toastKey++, ...Object.fromEntries(Object.entries(i).filter((t3) => {
|
|
88
|
-
let [e, n2] = t3;
|
|
89
|
-
return null != n2;
|
|
90
|
-
})), toastId: l2, updateId: c2, data: T3, closeToast: L3, isIn: false, className: m(i.className || b3.toastClassName), bodyClassName: m(i.bodyClassName || b3.bodyClassName), progressClassName: m(i.progressClassName || b3.progressClassName), autoClose: !i.isLoading && (R2 = i.autoClose, w = b3.autoClose, false === R2 || u(R2) && R2 > 0 ? R2 : w), deleteToast() {
|
|
91
|
-
const t3 = y(h2.get(l2), "removed");
|
|
92
|
-
h2.delete(l2), v.emit(4, t3);
|
|
93
|
-
const e = C2.queue.length;
|
|
94
|
-
if (C2.count = null == l2 ? C2.count - C2.displayedToast : C2.count - 1, C2.count < 0 && (C2.count = 0), e > 0) {
|
|
95
|
-
const t4 = null == l2 ? C2.props.limit : 1;
|
|
96
|
-
if (1 === e || 1 === t4) C2.displayedToast++, _2();
|
|
97
|
-
else {
|
|
98
|
-
const n2 = t4 > e ? e : t4;
|
|
99
|
-
C2.displayedToast = n2;
|
|
100
|
-
for (let t5 = 0; t5 < n2; t5++) _2();
|
|
101
|
-
}
|
|
102
|
-
} else o();
|
|
103
|
-
} };
|
|
104
|
-
var R2, w;
|
|
105
|
-
M2.iconOut = function(t3) {
|
|
106
|
-
let { theme: n2, type: o2, isLoading: s2, icon: r2 } = t3, i2 = null;
|
|
107
|
-
const l3 = { theme: n2, type: o2 };
|
|
108
|
-
return false === r2 || (p(r2) ? i2 = r2(l3) : isValidElement(r2) ? i2 = cloneElement(r2, l3) : d(r2) || u(r2) ? i2 = r2 : s2 ? i2 = E.spinner() : ((t4) => t4 in E)(o2) && (i2 = E[o2](l3))), i2;
|
|
109
|
-
}(M2), p(i.onOpen) && (M2.onOpen = i.onOpen), p(i.onClose) && (M2.onClose = i.onClose), M2.closeButton = b3.closeButton, false === i.closeButton || f(i.closeButton) ? M2.closeButton = i.closeButton : true === i.closeButton && (M2.closeButton = !f(b3.closeButton) || b3.closeButton);
|
|
110
|
-
let x = t2;
|
|
111
|
-
isValidElement(t2) && !d(t2.type) ? x = cloneElement(t2, { closeToast: L3, toastProps: M2, data: T3 }) : p(t2) && (x = t2({ closeToast: L3, toastProps: M2, data: T3 })), b3.limit && b3.limit > 0 && C2.count > b3.limit && N2 ? C2.queue.push({ toastContent: x, toastProps: M2, staleId: r }) : u(s) ? setTimeout(() => {
|
|
112
|
-
O2(x, M2, r);
|
|
113
|
-
}, s) : O2(x, M2, r);
|
|
114
|
-
}
|
|
115
|
-
function O2(t2, e, n) {
|
|
116
|
-
const { toastId: o2 } = e;
|
|
117
|
-
n && h2.delete(n);
|
|
118
|
-
const s = { content: t2, props: e };
|
|
119
|
-
h2.set(o2, s), c((t3) => [...t3, o2].filter((t4) => t4 !== n)), v.emit(4, y(s, null == s.props.updateId ? "added" : "updated"));
|
|
120
|
-
}
|
|
121
|
-
return useEffect(() => (C2.containerId = t.containerId, v.cancelEmit(3).on(0, L2).on(1, (t2) => g2.current && I2(t2)).on(5, b2).emit(2, C2), () => {
|
|
122
|
-
h2.clear(), v.emit(3, C2);
|
|
123
|
-
}), []), useEffect(() => {
|
|
124
|
-
C2.props = t, C2.isToastActive = T2, C2.displayedToast = l.length;
|
|
125
|
-
}), { getToastToRender: function(e) {
|
|
126
|
-
const n = /* @__PURE__ */ new Map(), o2 = Array.from(h2.values());
|
|
127
|
-
return t.newestOnTop && o2.reverse(), o2.forEach((t2) => {
|
|
128
|
-
const { position: e2 } = t2.props;
|
|
129
|
-
n.has(e2) || n.set(e2, []), n.get(e2).push(t2);
|
|
130
|
-
}), Array.from(n, (t2) => e(t2[0], t2[1]));
|
|
131
|
-
}, containerRef: g2, isToastActive: T2 };
|
|
132
|
-
}
|
|
133
|
-
function b(t) {
|
|
134
|
-
return t.targetTouches && t.targetTouches.length >= 1 ? t.targetTouches[0].clientX : t.clientX;
|
|
135
|
-
}
|
|
136
|
-
function I(t) {
|
|
137
|
-
return t.targetTouches && t.targetTouches.length >= 1 ? t.targetTouches[0].clientY : t.clientY;
|
|
138
|
-
}
|
|
139
|
-
function _(t) {
|
|
140
|
-
const [o, a] = useState(false), [r, l] = useState(false), c = useRef(null), u2 = useRef({ start: 0, x: 0, y: 0, delta: 0, removalDistance: 0, canCloseOnClick: true, canDrag: false, boundingRect: null, didMove: false }).current, d2 = useRef(t), { autoClose: m2, pauseOnHover: f2, closeToast: g2, onClick: h2, closeOnClick: y2 } = t;
|
|
141
|
-
function v2(e) {
|
|
142
|
-
if (t.draggable) {
|
|
143
|
-
"touchstart" === e.nativeEvent.type && e.nativeEvent.preventDefault(), u2.didMove = false, document.addEventListener("mousemove", _2), document.addEventListener("mouseup", L2), document.addEventListener("touchmove", _2), document.addEventListener("touchend", L2);
|
|
144
|
-
const n = c.current;
|
|
145
|
-
u2.canCloseOnClick = true, u2.canDrag = true, u2.boundingRect = n.getBoundingClientRect(), n.style.transition = "", u2.x = b(e.nativeEvent), u2.y = I(e.nativeEvent), "x" === t.draggableDirection ? (u2.start = u2.x, u2.removalDistance = n.offsetWidth * (t.draggablePercent / 100)) : (u2.start = u2.y, u2.removalDistance = n.offsetHeight * (80 === t.draggablePercent ? 1.5 * t.draggablePercent : t.draggablePercent / 100));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function T2(e) {
|
|
149
|
-
if (u2.boundingRect) {
|
|
150
|
-
const { top: n, bottom: o2, left: s, right: a2 } = u2.boundingRect;
|
|
151
|
-
"touchend" !== e.nativeEvent.type && t.pauseOnHover && u2.x >= s && u2.x <= a2 && u2.y >= n && u2.y <= o2 ? C2() : E2();
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function E2() {
|
|
155
|
-
a(true);
|
|
156
|
-
}
|
|
157
|
-
function C2() {
|
|
158
|
-
a(false);
|
|
159
|
-
}
|
|
160
|
-
function _2(e) {
|
|
161
|
-
const n = c.current;
|
|
162
|
-
u2.canDrag && n && (u2.didMove = true, o && C2(), u2.x = b(e), u2.y = I(e), u2.delta = "x" === t.draggableDirection ? u2.x - u2.start : u2.y - u2.start, u2.start !== u2.x && (u2.canCloseOnClick = false), n.style.transform = `translate${t.draggableDirection}(${u2.delta}px)`, n.style.opacity = "" + (1 - Math.abs(u2.delta / u2.removalDistance)));
|
|
163
|
-
}
|
|
164
|
-
function L2() {
|
|
165
|
-
document.removeEventListener("mousemove", _2), document.removeEventListener("mouseup", L2), document.removeEventListener("touchmove", _2), document.removeEventListener("touchend", L2);
|
|
166
|
-
const e = c.current;
|
|
167
|
-
if (u2.canDrag && u2.didMove && e) {
|
|
168
|
-
if (u2.canDrag = false, Math.abs(u2.delta) > u2.removalDistance) return l(true), void t.closeToast();
|
|
169
|
-
e.style.transition = "transform 0.2s, opacity 0.2s", e.style.transform = `translate${t.draggableDirection}(0)`, e.style.opacity = "1";
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
useEffect(() => {
|
|
173
|
-
d2.current = t;
|
|
174
|
-
}), useEffect(() => (c.current && c.current.addEventListener("d", E2, { once: true }), p(t.onOpen) && t.onOpen(isValidElement(t.children) && t.children.props), () => {
|
|
175
|
-
const t2 = d2.current;
|
|
176
|
-
p(t2.onClose) && t2.onClose(isValidElement(t2.children) && t2.children.props);
|
|
177
|
-
}), []), useEffect(() => (t.pauseOnFocusLoss && (document.hasFocus() || C2(), window.addEventListener("focus", E2), window.addEventListener("blur", C2)), () => {
|
|
178
|
-
t.pauseOnFocusLoss && (window.removeEventListener("focus", E2), window.removeEventListener("blur", C2));
|
|
179
|
-
}), [t.pauseOnFocusLoss]);
|
|
180
|
-
const O2 = { onMouseDown: v2, onTouchStart: v2, onMouseUp: T2, onTouchEnd: T2 };
|
|
181
|
-
return m2 && f2 && (O2.onMouseEnter = C2, O2.onMouseLeave = E2), y2 && (O2.onClick = (t2) => {
|
|
182
|
-
h2 && h2(t2), u2.canCloseOnClick && g2();
|
|
183
|
-
}), { playToast: E2, pauseToast: C2, isRunning: o, preventExitTransition: r, toastRef: c, eventHandlers: O2 };
|
|
184
|
-
}
|
|
185
|
-
function L(e) {
|
|
186
|
-
let { closeToast: n, theme: o, ariaLabel: s = "close" } = e;
|
|
187
|
-
return React__default.createElement("button", { className: `Toastify__close-button Toastify__close-button--${o}`, type: "button", onClick: (t) => {
|
|
188
|
-
t.stopPropagation(), n(t);
|
|
189
|
-
}, "aria-label": s }, React__default.createElement("svg", { "aria-hidden": "true", viewBox: "0 0 14 16" }, React__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" })));
|
|
190
|
-
}
|
|
191
|
-
function O(e) {
|
|
192
|
-
let { delay: n, isRunning: o, closeToast: s, type: a = "default", hide: r, className: i, style: l, controlledProgress: u2, progress: d2, rtl: m2, isIn: f2, theme: g2 } = e;
|
|
193
|
-
const h2 = r || u2 && 0 === d2, y2 = { ...l, animationDuration: `${n}ms`, animationPlayState: o ? "running" : "paused", opacity: h2 ? 0 : 1 };
|
|
194
|
-
u2 && (y2.transform = `scaleX(${d2})`);
|
|
195
|
-
const v2 = clsx("Toastify__progress-bar", u2 ? "Toastify__progress-bar--controlled" : "Toastify__progress-bar--animated", `Toastify__progress-bar-theme--${g2}`, `Toastify__progress-bar--${a}`, { "Toastify__progress-bar--rtl": m2 }), T2 = p(i) ? i({ rtl: m2, type: a, defaultClassName: v2 }) : clsx(v2, i);
|
|
196
|
-
return React__default.createElement("div", { role: "progressbar", "aria-hidden": h2 ? "true" : "false", "aria-label": "notification timer", className: T2, style: y2, [u2 && d2 >= 1 ? "onTransitionEnd" : "onAnimationEnd"]: u2 && d2 < 1 ? null : () => {
|
|
197
|
-
f2 && s();
|
|
198
|
-
} });
|
|
199
|
-
}
|
|
200
|
-
const N = (n) => {
|
|
201
|
-
const { isRunning: o, preventExitTransition: s, toastRef: r, eventHandlers: i } = _(n), { closeButton: l, children: u2, autoClose: d2, onClick: m2, type: f2, hideProgressBar: g2, closeToast: h2, transition: y2, position: v2, className: T2, style: E2, bodyClassName: C2, bodyStyle: b2, progressClassName: I2, progressStyle: N2, updateId: M2, role: R2, progress: w, rtl: x, toastId: $, deleteToast: k2, isIn: P2, isLoading: B2, iconOut: D2, closeOnClick: A2, theme: z2 } = n, F2 = clsx("Toastify__toast", `Toastify__toast-theme--${z2}`, `Toastify__toast--${f2}`, { "Toastify__toast--rtl": x }, { "Toastify__toast--close-on-click": A2 }), H2 = p(T2) ? T2({ rtl: x, position: v2, type: f2, defaultClassName: F2 }) : clsx(F2, T2), S2 = !!w || !d2, q2 = { closeToast: h2, type: f2, theme: z2 };
|
|
202
|
-
let Q2 = null;
|
|
203
|
-
return false === l || (Q2 = p(l) ? l(q2) : isValidElement(l) ? cloneElement(l, q2) : L(q2)), React__default.createElement(y2, { isIn: P2, done: k2, position: v2, preventExitTransition: s, nodeRef: r }, React__default.createElement("div", { id: $, onClick: m2, className: H2, ...i, style: E2, ref: r }, React__default.createElement("div", { ...P2 && { role: R2 }, className: p(C2) ? C2({ type: f2 }) : clsx("Toastify__toast-body", C2), style: b2 }, null != D2 && React__default.createElement("div", { className: clsx("Toastify__toast-icon", { "Toastify--animate-icon Toastify__zoom-enter": !B2 }) }, D2), React__default.createElement("div", null, u2)), Q2, React__default.createElement(O, { ...M2 && !S2 ? { key: `pb-${M2}` } : {}, rtl: x, theme: z2, delay: d2, isRunning: o, isIn: P2, closeToast: h2, hide: g2, type: f2, style: N2, className: I2, controlledProgress: S2, progress: w || 0 })));
|
|
204
|
-
}, M = function(t, e) {
|
|
205
|
-
return void 0 === e && (e = false), { enter: `Toastify--animate Toastify__${t}-enter`, exit: `Toastify--animate Toastify__${t}-exit`, appendPosition: e };
|
|
206
|
-
}, R = h(M("bounce", true));
|
|
207
|
-
h(M("slide", true));
|
|
208
|
-
h(M("zoom"));
|
|
209
|
-
h(M("flip"));
|
|
210
|
-
const k = forwardRef((e, n) => {
|
|
211
|
-
const { getToastToRender: o, containerRef: a, isToastActive: r } = C(e), { className: i, style: l, rtl: u2, containerId: d2 } = e;
|
|
212
|
-
function f2(t) {
|
|
213
|
-
const e2 = clsx("Toastify__toast-container", `Toastify__toast-container--${t}`, { "Toastify__toast-container--rtl": u2 });
|
|
214
|
-
return p(i) ? i({ position: t, rtl: u2, defaultClassName: e2 }) : clsx(e2, m(i));
|
|
215
|
-
}
|
|
216
|
-
return useEffect(() => {
|
|
217
|
-
n && (n.current = a.current);
|
|
218
|
-
}, []), React__default.createElement("div", { ref: a, className: "Toastify", id: d2 }, o((e2, n2) => {
|
|
219
|
-
const o2 = n2.length ? { ...l } : { ...l, pointerEvents: "none" };
|
|
220
|
-
return React__default.createElement("div", { className: f2(e2), style: o2, key: `container-${e2}` }, n2.map((e3, o3) => {
|
|
221
|
-
let { content: s, props: a2 } = e3;
|
|
222
|
-
return React__default.createElement(N, { ...a2, isIn: r(a2.toastId), style: { ...a2.style, "--nth": o3 + 1, "--len": n2.length }, key: `toast-${a2.key}` }, s);
|
|
223
|
-
}));
|
|
224
|
-
}));
|
|
225
|
-
});
|
|
226
|
-
k.displayName = "ToastContainer", k.defaultProps = { position: "top-right", transition: R, autoClose: 5e3, closeButton: L, pauseOnHover: true, pauseOnFocusLoss: true, closeOnClick: true, draggable: true, draggablePercent: 80, draggableDirection: "x", role: "alert", theme: "light" };
|
|
227
|
-
let P, B = /* @__PURE__ */ new Map(), D = [], A = 1;
|
|
228
|
-
function z() {
|
|
229
|
-
return "" + A++;
|
|
230
|
-
}
|
|
231
|
-
function F(t) {
|
|
232
|
-
return t && (d(t.toastId) || u(t.toastId)) ? t.toastId : z();
|
|
233
|
-
}
|
|
234
|
-
function H(t, e) {
|
|
235
|
-
return B.size > 0 ? v.emit(0, t, e) : D.push({ content: t, options: e }), e.toastId;
|
|
236
|
-
}
|
|
237
|
-
function S(t, e) {
|
|
238
|
-
return { ...e, type: e && e.type || t, toastId: F(e) };
|
|
239
|
-
}
|
|
240
|
-
function q(t) {
|
|
241
|
-
return (e, n) => H(e, S(t, n));
|
|
242
|
-
}
|
|
243
|
-
function Q(t, e) {
|
|
244
|
-
return H(t, S("default", e));
|
|
245
|
-
}
|
|
246
|
-
Q.loading = (t, e) => H(t, S("default", { isLoading: true, autoClose: false, closeOnClick: false, closeButton: false, draggable: false, ...e })), Q.promise = function(t, e, n) {
|
|
247
|
-
let o, { pending: s, error: a, success: r } = e;
|
|
248
|
-
s && (o = d(s) ? Q.loading(s, n) : Q.loading(s.render, { ...n, ...s }));
|
|
249
|
-
const i = { isLoading: null, autoClose: null, closeOnClick: null, closeButton: null, draggable: null }, l = (t2, e2, s2) => {
|
|
250
|
-
if (null == e2) return void Q.dismiss(o);
|
|
251
|
-
const a2 = { type: t2, ...i, ...n, data: s2 }, r2 = d(e2) ? { render: e2 } : e2;
|
|
252
|
-
return o ? Q.update(o, { ...a2, ...r2 }) : Q(r2.render, { ...a2, ...r2 }), s2;
|
|
253
|
-
}, c = p(t) ? t() : t;
|
|
254
|
-
return c.then((t2) => l("success", r, t2)).catch((t2) => l("error", a, t2)), c;
|
|
255
|
-
}, Q.success = q("success"), Q.info = q("info"), Q.error = q("error"), Q.warning = q("warning"), Q.warn = Q.warning, Q.dark = (t, e) => H(t, S("default", { theme: "dark", ...e })), Q.dismiss = (t) => {
|
|
256
|
-
B.size > 0 ? v.emit(1, t) : D = D.filter((e) => null != t && e.options.toastId !== t);
|
|
257
|
-
}, Q.clearWaitingQueue = function(t) {
|
|
258
|
-
return void 0 === t && (t = {}), v.emit(5, t);
|
|
259
|
-
}, Q.isActive = (t) => {
|
|
260
|
-
let e = false;
|
|
261
|
-
return B.forEach((n) => {
|
|
262
|
-
n.isToastActive && n.isToastActive(t) && (e = true);
|
|
263
|
-
}), e;
|
|
264
|
-
}, Q.update = function(t, e) {
|
|
265
|
-
void 0 === e && (e = {}), setTimeout(() => {
|
|
266
|
-
const n = function(t2, e2) {
|
|
267
|
-
let { containerId: n2 } = e2;
|
|
268
|
-
const o = B.get(n2 || P);
|
|
269
|
-
return o && o.getToast(t2);
|
|
270
|
-
}(t, e);
|
|
271
|
-
if (n) {
|
|
272
|
-
const { props: o, content: s } = n, a = { delay: 100, ...o, ...e, toastId: e.toastId || t, updateId: z() };
|
|
273
|
-
a.toastId !== t && (a.staleId = t);
|
|
274
|
-
const r = a.render || s;
|
|
275
|
-
delete a.render, H(r, a);
|
|
276
|
-
}
|
|
277
|
-
}, 0);
|
|
278
|
-
}, Q.done = (t) => {
|
|
279
|
-
Q.update(t, { progress: 1 });
|
|
280
|
-
}, Q.onChange = (t) => (v.on(4, t), () => {
|
|
281
|
-
v.off(4, t);
|
|
282
|
-
}), Q.POSITION = { TOP_LEFT: "top-left", TOP_RIGHT: "top-right", TOP_CENTER: "top-center", BOTTOM_LEFT: "bottom-left", BOTTOM_RIGHT: "bottom-right", BOTTOM_CENTER: "bottom-center" }, Q.TYPE = { INFO: "info", SUCCESS: "success", WARNING: "warning", ERROR: "error", DEFAULT: "default" }, v.on(2, (t) => {
|
|
283
|
-
P = t.containerId || t, B.set(P, t), D.forEach((t2) => {
|
|
284
|
-
v.emit(0, t2.content, t2.options);
|
|
285
|
-
}), D = [];
|
|
286
|
-
}).on(3, (t) => {
|
|
287
|
-
B.delete(t.containerId || t), 0 === B.size && v.off(0).off(1).off(5);
|
|
288
|
-
});
|
|
289
|
-
export {
|
|
290
|
-
R as Bounce,
|
|
291
|
-
E as Icons,
|
|
292
|
-
k as ToastContainer,
|
|
293
|
-
g as collapseToast,
|
|
294
|
-
h as cssTransition,
|
|
295
|
-
Q as toast,
|
|
296
|
-
_ as useToast,
|
|
297
|
-
C as useToastContainer
|
|
298
|
-
};
|