@appfunnel-dev/sdk 2.0.0-canary.11 → 2.0.0-canary.12
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/dist/{chunk-RKPRMTSU.cjs → chunk-7HDZVHIT.cjs} +2 -2
- package/dist/chunk-7HDZVHIT.cjs.map +1 -0
- package/dist/{chunk-SXENKZ4U.js → chunk-UAQV22UK.js} +2 -2
- package/dist/chunk-UAQV22UK.js.map +1 -0
- package/dist/index.cjs +330 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +106 -84
- package/dist/index.js.map +1 -1
- package/dist/{manifest-C2mDXWNU.d.cts → manifest-CTt2LlUV.d.cts} +13 -2
- package/dist/{manifest-C2mDXWNU.d.ts → manifest-CTt2LlUV.d.ts} +13 -2
- package/dist/manifest-entry.cjs +20 -20
- package/dist/manifest-entry.d.cts +2 -2
- package/dist/manifest-entry.d.ts +2 -2
- package/dist/manifest-entry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RKPRMTSU.cjs.map +0 -1
- package/dist/chunk-SXENKZ4U.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType, ButtonHTMLAttributes } from 'react';
|
|
3
|
-
import { V as VariableValue, a as VariableConfig, A as Acquisition, O as Offering, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as OfferingInput, P as PageMeta, f as PageContext, G as GroupProgress } from './manifest-
|
|
4
|
-
export { B as BrowserContext, g as BuildContextOptions, C as ClickIdContext, h as CompileInput, i as Condition, j as ConditionOp, k as DeviceContext, E as EdgeCondition, l as ExperimentArm, m as ExperimentResolution, n as FlowPage, o as FunnelLocales, p as FunnelManifest, q as Gate, I as IdentityContext, r as Interval, L as LocaleContext, M as ManifestEdge, s as ManifestPage, t as ManifestValidation, u as Money, v as OsContext, w as
|
|
3
|
+
import { V as VariableValue, a as VariableConfig, A as Acquisition, O as Offering, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as OfferingInput, P as PageMeta, f as PageContext, G as GroupProgress } from './manifest-CTt2LlUV.cjs';
|
|
4
|
+
export { B as BrowserContext, g as BuildContextOptions, C as ClickIdContext, h as CompileInput, i as Condition, j as ConditionOp, k as DeviceContext, E as EdgeCondition, l as ExperimentArm, m as ExperimentResolution, n as FlowPage, o as FunnelLocales, p as FunnelManifest, q as Gate, I as IdentityContext, r as Interval, L as LocaleContext, M as ManifestEdge, s as ManifestPage, t as ManifestValidation, u as Money, v as OsContext, w as PageComponent, x as PageGroup, y as PageType, z as Predicate, H as ResolvedOffering, J as Route, S as SessionContext, K as SystemContext, U as UtmContext, N as assignVariant, Q as bucketingSeed, T as buildAcquisition, W as buildCatalog, X as compileManifest, Y as currencyExponent, Z as defineFunnel, _ as definePage, $ as entryGuard, a0 as evaluateCondition, a1 as evaluateGate, a2 as expectedPathLength, a3 as fnv1a, a4 as formatMoney, a5 as formatOffering, a6 as groupProgress, a7 as hashToUnit, a8 as isRtl, a9 as isVariantKey, aa as nextPage, ab as outgoingKeys, ac as pageMeta, ad as parseSlotKey, ae as pickByWeight, af as resolveExperiments, ag as resolveLocale, ah as resolveOffering, ai as resolveRoute } from './manifest-CTt2LlUV.cjs';
|
|
5
5
|
import { NavSnapshot } from './protocol.cjs';
|
|
6
6
|
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-DBp4bCpC.cjs';
|
|
7
7
|
export { b as Checkout, c as CheckoutCallbacks, d as CheckoutHandle, e as CheckoutProps, f as CheckoutRequest, g as CheckoutResult, h as CheckoutResume, i as CheckoutStatus, F as FailureModalProps, j as FailureRoute, M as MockDriverOptions, O as OnFailedMap, U as Upsell, k as UpsellProps, l as UseCheckoutOptions, m as createMockDriver, n as driverWithEmail, u as useCheckout } from './checkout-DBp4bCpC.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType, ButtonHTMLAttributes } from 'react';
|
|
3
|
-
import { V as VariableValue, a as VariableConfig, A as Acquisition, O as Offering, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as OfferingInput, P as PageMeta, f as PageContext, G as GroupProgress } from './manifest-
|
|
4
|
-
export { B as BrowserContext, g as BuildContextOptions, C as ClickIdContext, h as CompileInput, i as Condition, j as ConditionOp, k as DeviceContext, E as EdgeCondition, l as ExperimentArm, m as ExperimentResolution, n as FlowPage, o as FunnelLocales, p as FunnelManifest, q as Gate, I as IdentityContext, r as Interval, L as LocaleContext, M as ManifestEdge, s as ManifestPage, t as ManifestValidation, u as Money, v as OsContext, w as
|
|
3
|
+
import { V as VariableValue, a as VariableConfig, A as Acquisition, O as Offering, D as Direction, F as FunnelContext, R as RuntimeExperiment, b as FunnelSnapshot, c as FunnelDefinition, d as buildContext, e as OfferingInput, P as PageMeta, f as PageContext, G as GroupProgress } from './manifest-CTt2LlUV.js';
|
|
4
|
+
export { B as BrowserContext, g as BuildContextOptions, C as ClickIdContext, h as CompileInput, i as Condition, j as ConditionOp, k as DeviceContext, E as EdgeCondition, l as ExperimentArm, m as ExperimentResolution, n as FlowPage, o as FunnelLocales, p as FunnelManifest, q as Gate, I as IdentityContext, r as Interval, L as LocaleContext, M as ManifestEdge, s as ManifestPage, t as ManifestValidation, u as Money, v as OsContext, w as PageComponent, x as PageGroup, y as PageType, z as Predicate, H as ResolvedOffering, J as Route, S as SessionContext, K as SystemContext, U as UtmContext, N as assignVariant, Q as bucketingSeed, T as buildAcquisition, W as buildCatalog, X as compileManifest, Y as currencyExponent, Z as defineFunnel, _ as definePage, $ as entryGuard, a0 as evaluateCondition, a1 as evaluateGate, a2 as expectedPathLength, a3 as fnv1a, a4 as formatMoney, a5 as formatOffering, a6 as groupProgress, a7 as hashToUnit, a8 as isRtl, a9 as isVariantKey, aa as nextPage, ab as outgoingKeys, ac as pageMeta, ad as parseSlotKey, ae as pickByWeight, af as resolveExperiments, ag as resolveLocale, ah as resolveOffering, ai as resolveRoute } from './manifest-CTt2LlUV.js';
|
|
5
5
|
import { NavSnapshot } from './protocol.js';
|
|
6
6
|
import { a as CheckoutDriver, C as CheckoutDriverContext } from './checkout-ClaO5IYV.js';
|
|
7
7
|
export { b as Checkout, c as CheckoutCallbacks, d as CheckoutHandle, e as CheckoutProps, f as CheckoutRequest, g as CheckoutResult, h as CheckoutResume, i as CheckoutStatus, F as FailureModalProps, j as FailureRoute, M as MockDriverOptions, O as OnFailedMap, U as Upsell, k as UpsellProps, l as UseCheckoutOptions, m as createMockDriver, n as driverWithEmail, u as useCheckout } from './checkout-ClaO5IYV.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { isRtl, formatOffering, bucketingSeed, resolveExperiments, entryGuard, evaluateGate, expectedPathLength, groupProgress, nextPage, outgoingKeys, buildCatalog, resolveLocale } from './chunk-
|
|
2
|
-
export { assignVariant, bucketingSeed, buildCatalog, compileManifest, currencyExponent, defineFunnel, definePage, entryGuard, evaluateCondition, evaluateGate, expectedPathLength, fnv1a, formatMoney, formatOffering, groupProgress, hashToUnit, isRtl, isVariantKey, nextPage, outgoingKeys, pageMeta, parseSlotKey, pickByWeight, resolveExperiments, resolveLocale, resolveOffering, resolveRoute } from './chunk-
|
|
1
|
+
import { isRtl, formatOffering, bucketingSeed, resolveExperiments, entryGuard, evaluateGate, expectedPathLength, groupProgress, nextPage, outgoingKeys, buildCatalog, resolveLocale } from './chunk-UAQV22UK.js';
|
|
2
|
+
export { assignVariant, bucketingSeed, buildCatalog, compileManifest, currencyExponent, defineFunnel, definePage, entryGuard, evaluateCondition, evaluateGate, expectedPathLength, fnv1a, formatMoney, formatOffering, groupProgress, hashToUnit, isRtl, isVariantKey, nextPage, outgoingKeys, pageMeta, parseSlotKey, pickByWeight, resolveExperiments, resolveLocale, resolveOffering, resolveRoute } from './chunk-UAQV22UK.js';
|
|
3
3
|
import { AF_PROTOCOL } from './chunk-ZZJG4EYL.js';
|
|
4
4
|
import { checkoutError, resolveSurface, isInlineSurface, PROVIDER_PROFILES } from './chunk-OXQBEKZ5.js';
|
|
5
5
|
export { INLINE_SURFACES, PROVIDER_PROFILES, checkoutError, isInlineSurface, isMerchantOfRecord, isOrchestrator, isRenderableSurface, renderableSurfaces, resolveSurface, surfacesFor, validateCheckout, validateUpsell } from './chunk-OXQBEKZ5.js';
|
|
6
6
|
import './chunk-G3PMV62Z.js';
|
|
7
|
-
import
|
|
7
|
+
import * as React2 from 'react';
|
|
8
|
+
import React2__default, { createContext, createElement, useCallback, useContext, useMemo, lazy, useRef, useState, useEffect, useTransition, Suspense, Fragment, isValidElement, cloneElement, useReducer, useSyncExternalStore } from 'react';
|
|
8
9
|
import ReactDOM, { createPortal } from 'react-dom';
|
|
9
10
|
import { jsx } from 'react/jsx-runtime';
|
|
10
11
|
|
|
@@ -703,6 +704,8 @@ async function captureScreenshot(params = {}) {
|
|
|
703
704
|
}
|
|
704
705
|
|
|
705
706
|
// src/flow/flow.tsx
|
|
707
|
+
var Activity2 = React2.Activity ?? React2.unstable_Activity;
|
|
708
|
+
var HIDDEN_CANDIDATE_CAP = 2;
|
|
706
709
|
var NavContext = createContext(null);
|
|
707
710
|
var GroupProgressContext = createContext(null);
|
|
708
711
|
var ExperimentContext = createContext({});
|
|
@@ -872,6 +875,7 @@ function FunnelView({
|
|
|
872
875
|
(key) => startNav(() => setHistory((h) => [...h, toSlot(key)])),
|
|
873
876
|
[toSlot]
|
|
874
877
|
);
|
|
878
|
+
const [loadedComps, setLoadedComps] = useState(() => /* @__PURE__ */ new Map());
|
|
875
879
|
const prefetched = useRef(/* @__PURE__ */ new Set());
|
|
876
880
|
const prefetch = useCallback(
|
|
877
881
|
(key) => {
|
|
@@ -879,7 +883,10 @@ function FunnelView({
|
|
|
879
883
|
const load = loaders.get(target);
|
|
880
884
|
if (!load || prefetched.current.has(target)) return;
|
|
881
885
|
prefetched.current.add(target);
|
|
882
|
-
load().
|
|
886
|
+
load().then((m) => {
|
|
887
|
+
const Comp = typeof m === "function" ? m : m.default;
|
|
888
|
+
setLoadedComps((prev) => prev.has(target) ? prev : new Map(prev).set(target, Comp));
|
|
889
|
+
}).catch(() => prefetched.current.delete(target));
|
|
883
890
|
},
|
|
884
891
|
[loaders, toRenderKey]
|
|
885
892
|
);
|
|
@@ -891,6 +898,15 @@ function FunnelView({
|
|
|
891
898
|
if (prefetchMode !== "auto") return;
|
|
892
899
|
for (const key of nextCandidates) prefetch(key);
|
|
893
900
|
}, [prefetchMode, nextCandidates, prefetch]);
|
|
901
|
+
useEffect(() => {
|
|
902
|
+
if (prefetchMode !== "off") return;
|
|
903
|
+
for (const key of nextCandidates) prefetch(key);
|
|
904
|
+
}, [prefetchMode, nextCandidates, prefetch]);
|
|
905
|
+
const [preMountReady, setPreMountReady] = useState(false);
|
|
906
|
+
useEffect(() => {
|
|
907
|
+
const saveData = typeof navigator !== "undefined" && navigator.connection?.saveData === true;
|
|
908
|
+
if (!saveData) setPreMountReady(true);
|
|
909
|
+
}, []);
|
|
894
910
|
const value = {
|
|
895
911
|
page,
|
|
896
912
|
next,
|
|
@@ -942,7 +958,13 @@ function FunnelView({
|
|
|
942
958
|
const renderKey = toRenderKey(currentKey);
|
|
943
959
|
const Current = components.get(renderKey);
|
|
944
960
|
const pageEl = createElement(Suspense, { fallback: fallback ?? null }, Current ? createElement(Current) : null);
|
|
945
|
-
const
|
|
961
|
+
const visible = layout ? createElement(layout, null, pageEl) : pageEl;
|
|
962
|
+
const hiddenKeys = preMountReady && Activity2 ? nextCandidates.filter((k) => k !== renderKey && (pageByKey.get(k)?.Component !== void 0 || loadedComps.has(k))).slice(0, HIDDEN_CANDIDATE_CAP) : [];
|
|
963
|
+
const hiddenEls = hiddenKeys.map((k) => {
|
|
964
|
+
const C = pageByKey.get(k)?.Component ?? loadedComps.get(k);
|
|
965
|
+
return C ? createElement(Activity2, { key: k, mode: "hidden" }, createElement(C)) : null;
|
|
966
|
+
});
|
|
967
|
+
const content = hiddenEls.length > 0 ? createElement(Fragment, null, visible, ...hiddenEls) : visible;
|
|
946
968
|
return createElement(
|
|
947
969
|
ExperimentContext.Provider,
|
|
948
970
|
{ value: experiments.assignments },
|
|
@@ -1884,64 +1906,64 @@ var getAsset = (type) => {
|
|
|
1884
1906
|
};
|
|
1885
1907
|
var bars = Array(12).fill(0);
|
|
1886
1908
|
var Loader = ({ visible, className }) => {
|
|
1887
|
-
return /* @__PURE__ */
|
|
1909
|
+
return /* @__PURE__ */ React2__default.createElement("div", {
|
|
1888
1910
|
className: [
|
|
1889
1911
|
"sonner-loading-wrapper",
|
|
1890
1912
|
className
|
|
1891
1913
|
].filter(Boolean).join(" "),
|
|
1892
1914
|
"data-visible": visible
|
|
1893
|
-
}, /* @__PURE__ */
|
|
1915
|
+
}, /* @__PURE__ */ React2__default.createElement("div", {
|
|
1894
1916
|
className: "sonner-spinner"
|
|
1895
|
-
}, bars.map((_, i) => /* @__PURE__ */
|
|
1917
|
+
}, bars.map((_, i) => /* @__PURE__ */ React2__default.createElement("div", {
|
|
1896
1918
|
className: "sonner-loading-bar",
|
|
1897
1919
|
key: `spinner-bar-${i}`
|
|
1898
1920
|
}))));
|
|
1899
1921
|
};
|
|
1900
|
-
var SuccessIcon = /* @__PURE__ */
|
|
1922
|
+
var SuccessIcon = /* @__PURE__ */ React2__default.createElement("svg", {
|
|
1901
1923
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1902
1924
|
viewBox: "0 0 20 20",
|
|
1903
1925
|
fill: "currentColor",
|
|
1904
1926
|
height: "20",
|
|
1905
1927
|
width: "20"
|
|
1906
|
-
}, /* @__PURE__ */
|
|
1928
|
+
}, /* @__PURE__ */ React2__default.createElement("path", {
|
|
1907
1929
|
fillRule: "evenodd",
|
|
1908
1930
|
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
1909
1931
|
clipRule: "evenodd"
|
|
1910
1932
|
}));
|
|
1911
|
-
var WarningIcon = /* @__PURE__ */
|
|
1933
|
+
var WarningIcon = /* @__PURE__ */ React2__default.createElement("svg", {
|
|
1912
1934
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1913
1935
|
viewBox: "0 0 24 24",
|
|
1914
1936
|
fill: "currentColor",
|
|
1915
1937
|
height: "20",
|
|
1916
1938
|
width: "20"
|
|
1917
|
-
}, /* @__PURE__ */
|
|
1939
|
+
}, /* @__PURE__ */ React2__default.createElement("path", {
|
|
1918
1940
|
fillRule: "evenodd",
|
|
1919
1941
|
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
1920
1942
|
clipRule: "evenodd"
|
|
1921
1943
|
}));
|
|
1922
|
-
var InfoIcon = /* @__PURE__ */
|
|
1944
|
+
var InfoIcon = /* @__PURE__ */ React2__default.createElement("svg", {
|
|
1923
1945
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1924
1946
|
viewBox: "0 0 20 20",
|
|
1925
1947
|
fill: "currentColor",
|
|
1926
1948
|
height: "20",
|
|
1927
1949
|
width: "20"
|
|
1928
|
-
}, /* @__PURE__ */
|
|
1950
|
+
}, /* @__PURE__ */ React2__default.createElement("path", {
|
|
1929
1951
|
fillRule: "evenodd",
|
|
1930
1952
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
1931
1953
|
clipRule: "evenodd"
|
|
1932
1954
|
}));
|
|
1933
|
-
var ErrorIcon = /* @__PURE__ */
|
|
1955
|
+
var ErrorIcon = /* @__PURE__ */ React2__default.createElement("svg", {
|
|
1934
1956
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1935
1957
|
viewBox: "0 0 20 20",
|
|
1936
1958
|
fill: "currentColor",
|
|
1937
1959
|
height: "20",
|
|
1938
1960
|
width: "20"
|
|
1939
|
-
}, /* @__PURE__ */
|
|
1961
|
+
}, /* @__PURE__ */ React2__default.createElement("path", {
|
|
1940
1962
|
fillRule: "evenodd",
|
|
1941
1963
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
1942
1964
|
clipRule: "evenodd"
|
|
1943
1965
|
}));
|
|
1944
|
-
var CloseIcon = /* @__PURE__ */
|
|
1966
|
+
var CloseIcon = /* @__PURE__ */ React2__default.createElement("svg", {
|
|
1945
1967
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1946
1968
|
width: "12",
|
|
1947
1969
|
height: "12",
|
|
@@ -1951,20 +1973,20 @@ var CloseIcon = /* @__PURE__ */ React.createElement("svg", {
|
|
|
1951
1973
|
strokeWidth: "1.5",
|
|
1952
1974
|
strokeLinecap: "round",
|
|
1953
1975
|
strokeLinejoin: "round"
|
|
1954
|
-
}, /* @__PURE__ */
|
|
1976
|
+
}, /* @__PURE__ */ React2__default.createElement("line", {
|
|
1955
1977
|
x1: "18",
|
|
1956
1978
|
y1: "6",
|
|
1957
1979
|
x2: "6",
|
|
1958
1980
|
y2: "18"
|
|
1959
|
-
}), /* @__PURE__ */
|
|
1981
|
+
}), /* @__PURE__ */ React2__default.createElement("line", {
|
|
1960
1982
|
x1: "6",
|
|
1961
1983
|
y1: "6",
|
|
1962
1984
|
x2: "18",
|
|
1963
1985
|
y2: "18"
|
|
1964
1986
|
}));
|
|
1965
1987
|
var useIsDocumentHidden = () => {
|
|
1966
|
-
const [isDocumentHidden, setIsDocumentHidden] =
|
|
1967
|
-
|
|
1988
|
+
const [isDocumentHidden, setIsDocumentHidden] = React2__default.useState(document.hidden);
|
|
1989
|
+
React2__default.useEffect(() => {
|
|
1968
1990
|
const callback = () => {
|
|
1969
1991
|
setIsDocumentHidden(document.hidden);
|
|
1970
1992
|
};
|
|
@@ -2113,7 +2135,7 @@ var Observer = class {
|
|
|
2113
2135
|
"resolve",
|
|
2114
2136
|
response
|
|
2115
2137
|
];
|
|
2116
|
-
const isReactElementResponse =
|
|
2138
|
+
const isReactElementResponse = React2__default.isValidElement(response);
|
|
2117
2139
|
if (isReactElementResponse) {
|
|
2118
2140
|
shouldDismiss = false;
|
|
2119
2141
|
this.create({
|
|
@@ -2125,7 +2147,7 @@ var Observer = class {
|
|
|
2125
2147
|
shouldDismiss = false;
|
|
2126
2148
|
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
2127
2149
|
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
2128
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2150
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__default.isValidElement(promiseData);
|
|
2129
2151
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2130
2152
|
message: promiseData
|
|
2131
2153
|
};
|
|
@@ -2139,7 +2161,7 @@ var Observer = class {
|
|
|
2139
2161
|
shouldDismiss = false;
|
|
2140
2162
|
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
2141
2163
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2142
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2164
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__default.isValidElement(promiseData);
|
|
2143
2165
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2144
2166
|
message: promiseData
|
|
2145
2167
|
};
|
|
@@ -2153,7 +2175,7 @@ var Observer = class {
|
|
|
2153
2175
|
shouldDismiss = false;
|
|
2154
2176
|
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
2155
2177
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2156
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2178
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__default.isValidElement(promiseData);
|
|
2157
2179
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2158
2180
|
message: promiseData
|
|
2159
2181
|
};
|
|
@@ -2173,7 +2195,7 @@ var Observer = class {
|
|
|
2173
2195
|
shouldDismiss = false;
|
|
2174
2196
|
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
2175
2197
|
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
2176
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2198
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__default.isValidElement(promiseData);
|
|
2177
2199
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2178
2200
|
message: promiseData
|
|
2179
2201
|
};
|
|
@@ -2278,45 +2300,45 @@ function getDefaultSwipeDirections(position) {
|
|
|
2278
2300
|
var Toast = (props) => {
|
|
2279
2301
|
var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
|
|
2280
2302
|
const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
|
|
2281
|
-
const [swipeDirection, setSwipeDirection] =
|
|
2282
|
-
const [swipeOutDirection, setSwipeOutDirection] =
|
|
2283
|
-
const [mounted, setMounted] =
|
|
2284
|
-
const [removed, setRemoved] =
|
|
2285
|
-
const [swiping, setSwiping] =
|
|
2286
|
-
const [swipeOut, setSwipeOut] =
|
|
2287
|
-
const [isSwiped, setIsSwiped] =
|
|
2288
|
-
const [offsetBeforeRemove, setOffsetBeforeRemove] =
|
|
2289
|
-
const [initialHeight, setInitialHeight] =
|
|
2290
|
-
const remainingTime =
|
|
2291
|
-
const dragStartTime =
|
|
2292
|
-
const toastRef =
|
|
2303
|
+
const [swipeDirection, setSwipeDirection] = React2__default.useState(null);
|
|
2304
|
+
const [swipeOutDirection, setSwipeOutDirection] = React2__default.useState(null);
|
|
2305
|
+
const [mounted, setMounted] = React2__default.useState(false);
|
|
2306
|
+
const [removed, setRemoved] = React2__default.useState(false);
|
|
2307
|
+
const [swiping, setSwiping] = React2__default.useState(false);
|
|
2308
|
+
const [swipeOut, setSwipeOut] = React2__default.useState(false);
|
|
2309
|
+
const [isSwiped, setIsSwiped] = React2__default.useState(false);
|
|
2310
|
+
const [offsetBeforeRemove, setOffsetBeforeRemove] = React2__default.useState(0);
|
|
2311
|
+
const [initialHeight, setInitialHeight] = React2__default.useState(0);
|
|
2312
|
+
const remainingTime = React2__default.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
|
|
2313
|
+
const dragStartTime = React2__default.useRef(null);
|
|
2314
|
+
const toastRef = React2__default.useRef(null);
|
|
2293
2315
|
const isFront = index === 0;
|
|
2294
2316
|
const isVisible = index + 1 <= visibleToasts;
|
|
2295
2317
|
const toastType = toast2.type;
|
|
2296
2318
|
const dismissible = toast2.dismissible !== false;
|
|
2297
2319
|
const toastClassname = toast2.className || "";
|
|
2298
2320
|
const toastDescriptionClassname = toast2.descriptionClassName || "";
|
|
2299
|
-
const heightIndex =
|
|
2321
|
+
const heightIndex = React2__default.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
|
|
2300
2322
|
heights,
|
|
2301
2323
|
toast2.id
|
|
2302
2324
|
]);
|
|
2303
|
-
const closeButton =
|
|
2325
|
+
const closeButton = React2__default.useMemo(() => {
|
|
2304
2326
|
var _toast_closeButton;
|
|
2305
2327
|
return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
|
|
2306
2328
|
}, [
|
|
2307
2329
|
toast2.closeButton,
|
|
2308
2330
|
closeButtonFromToaster
|
|
2309
2331
|
]);
|
|
2310
|
-
const duration =
|
|
2332
|
+
const duration = React2__default.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
|
|
2311
2333
|
toast2.duration,
|
|
2312
2334
|
durationFromToaster
|
|
2313
2335
|
]);
|
|
2314
|
-
const closeTimerStartTimeRef =
|
|
2315
|
-
const offset =
|
|
2316
|
-
const lastCloseTimerStartTimeRef =
|
|
2317
|
-
const pointerStartRef =
|
|
2336
|
+
const closeTimerStartTimeRef = React2__default.useRef(0);
|
|
2337
|
+
const offset = React2__default.useRef(0);
|
|
2338
|
+
const lastCloseTimerStartTimeRef = React2__default.useRef(0);
|
|
2339
|
+
const pointerStartRef = React2__default.useRef(null);
|
|
2318
2340
|
const [y, x] = position.split("-");
|
|
2319
|
-
const toastsHeightBefore =
|
|
2341
|
+
const toastsHeightBefore = React2__default.useMemo(() => {
|
|
2320
2342
|
return heights.reduce((prev, curr, reducerIndex) => {
|
|
2321
2343
|
if (reducerIndex >= heightIndex) {
|
|
2322
2344
|
return prev;
|
|
@@ -2330,19 +2352,19 @@ var Toast = (props) => {
|
|
|
2330
2352
|
const isDocumentHidden = useIsDocumentHidden();
|
|
2331
2353
|
const invert = toast2.invert || ToasterInvert;
|
|
2332
2354
|
const disabled = toastType === "loading";
|
|
2333
|
-
offset.current =
|
|
2355
|
+
offset.current = React2__default.useMemo(() => heightIndex * gap + toastsHeightBefore, [
|
|
2334
2356
|
heightIndex,
|
|
2335
2357
|
toastsHeightBefore
|
|
2336
2358
|
]);
|
|
2337
|
-
|
|
2359
|
+
React2__default.useEffect(() => {
|
|
2338
2360
|
remainingTime.current = duration;
|
|
2339
2361
|
}, [
|
|
2340
2362
|
duration
|
|
2341
2363
|
]);
|
|
2342
|
-
|
|
2364
|
+
React2__default.useEffect(() => {
|
|
2343
2365
|
setMounted(true);
|
|
2344
2366
|
}, []);
|
|
2345
|
-
|
|
2367
|
+
React2__default.useEffect(() => {
|
|
2346
2368
|
const toastNode = toastRef.current;
|
|
2347
2369
|
if (toastNode) {
|
|
2348
2370
|
const height = toastNode.getBoundingClientRect().height;
|
|
@@ -2361,7 +2383,7 @@ var Toast = (props) => {
|
|
|
2361
2383
|
setHeights,
|
|
2362
2384
|
toast2.id
|
|
2363
2385
|
]);
|
|
2364
|
-
|
|
2386
|
+
React2__default.useLayoutEffect(() => {
|
|
2365
2387
|
if (!mounted) return;
|
|
2366
2388
|
const toastNode = toastRef.current;
|
|
2367
2389
|
const originalHeight = toastNode.style.height;
|
|
@@ -2397,7 +2419,7 @@ var Toast = (props) => {
|
|
|
2397
2419
|
toast2.action,
|
|
2398
2420
|
toast2.cancel
|
|
2399
2421
|
]);
|
|
2400
|
-
const deleteToast =
|
|
2422
|
+
const deleteToast = React2__default.useCallback(() => {
|
|
2401
2423
|
setRemoved(true);
|
|
2402
2424
|
setOffsetBeforeRemove(offset.current);
|
|
2403
2425
|
setHeights((h) => h.filter((height) => height.toastId !== toast2.id));
|
|
@@ -2410,7 +2432,7 @@ var Toast = (props) => {
|
|
|
2410
2432
|
setHeights,
|
|
2411
2433
|
offset
|
|
2412
2434
|
]);
|
|
2413
|
-
|
|
2435
|
+
React2__default.useEffect(() => {
|
|
2414
2436
|
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
|
|
2415
2437
|
let timeoutId;
|
|
2416
2438
|
const pauseTimer = () => {
|
|
@@ -2442,7 +2464,7 @@ var Toast = (props) => {
|
|
|
2442
2464
|
isDocumentHidden,
|
|
2443
2465
|
deleteToast
|
|
2444
2466
|
]);
|
|
2445
|
-
|
|
2467
|
+
React2__default.useEffect(() => {
|
|
2446
2468
|
if (toast2.delete) {
|
|
2447
2469
|
deleteToast();
|
|
2448
2470
|
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
@@ -2455,19 +2477,19 @@ var Toast = (props) => {
|
|
|
2455
2477
|
var _toast_classNames9;
|
|
2456
2478
|
if (icons == null ? void 0 : icons.loading) {
|
|
2457
2479
|
var _toast_classNames12;
|
|
2458
|
-
return /* @__PURE__ */
|
|
2480
|
+
return /* @__PURE__ */ React2__default.createElement("div", {
|
|
2459
2481
|
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
|
|
2460
2482
|
"data-visible": toastType === "loading"
|
|
2461
2483
|
}, icons.loading);
|
|
2462
2484
|
}
|
|
2463
|
-
return /* @__PURE__ */
|
|
2485
|
+
return /* @__PURE__ */ React2__default.createElement(Loader, {
|
|
2464
2486
|
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
|
|
2465
2487
|
visible: toastType === "loading"
|
|
2466
2488
|
});
|
|
2467
2489
|
}
|
|
2468
2490
|
const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
|
|
2469
2491
|
var _toast_richColors, _icons_close;
|
|
2470
|
-
return /* @__PURE__ */
|
|
2492
|
+
return /* @__PURE__ */ React2__default.createElement("li", {
|
|
2471
2493
|
tabIndex: 0,
|
|
2472
2494
|
ref: toastRef,
|
|
2473
2495
|
className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
|
|
@@ -2592,7 +2614,7 @@ var Toast = (props) => {
|
|
|
2592
2614
|
(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
|
|
2593
2615
|
(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
|
|
2594
2616
|
}
|
|
2595
|
-
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */
|
|
2617
|
+
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React2__default.createElement("button", {
|
|
2596
2618
|
"aria-label": closeButtonAriaLabel,
|
|
2597
2619
|
"data-disabled": disabled,
|
|
2598
2620
|
"data-close-button": true,
|
|
@@ -2602,19 +2624,19 @@ var Toast = (props) => {
|
|
|
2602
2624
|
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
2603
2625
|
},
|
|
2604
2626
|
className: cn(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
|
|
2605
|
-
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */
|
|
2627
|
+
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ React2__default.createElement("div", {
|
|
2606
2628
|
"data-icon": "",
|
|
2607
2629
|
className: cn(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
|
|
2608
|
-
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */
|
|
2630
|
+
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ React2__default.createElement("div", {
|
|
2609
2631
|
"data-content": "",
|
|
2610
2632
|
className: cn(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
|
|
2611
|
-
}, /* @__PURE__ */
|
|
2633
|
+
}, /* @__PURE__ */ React2__default.createElement("div", {
|
|
2612
2634
|
"data-title": "",
|
|
2613
2635
|
className: cn(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
|
|
2614
|
-
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */
|
|
2636
|
+
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ React2__default.createElement("div", {
|
|
2615
2637
|
"data-description": "",
|
|
2616
2638
|
className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
|
|
2617
|
-
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */
|
|
2639
|
+
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ React2__default.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ React2__default.createElement("button", {
|
|
2618
2640
|
"data-button": true,
|
|
2619
2641
|
"data-cancel": true,
|
|
2620
2642
|
style: toast2.cancelButtonStyle || cancelButtonStyle,
|
|
@@ -2625,7 +2647,7 @@ var Toast = (props) => {
|
|
|
2625
2647
|
deleteToast();
|
|
2626
2648
|
},
|
|
2627
2649
|
className: cn(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
|
|
2628
|
-
}, toast2.cancel.label) : null, /* @__PURE__ */
|
|
2650
|
+
}, toast2.cancel.label) : null, /* @__PURE__ */ React2__default.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ React2__default.createElement("button", {
|
|
2629
2651
|
"data-button": true,
|
|
2630
2652
|
"data-action": true,
|
|
2631
2653
|
style: toast2.actionButtonStyle || actionButtonStyle,
|
|
@@ -2687,13 +2709,13 @@ function assignOffset(defaultOffset, mobileOffset) {
|
|
|
2687
2709
|
});
|
|
2688
2710
|
return styles;
|
|
2689
2711
|
}
|
|
2690
|
-
var Toaster = /* @__PURE__ */
|
|
2712
|
+
var Toaster = /* @__PURE__ */ React2__default.forwardRef(function Toaster2(props, ref) {
|
|
2691
2713
|
const { id, invert, position = "bottom-right", hotkey = [
|
|
2692
2714
|
"altKey",
|
|
2693
2715
|
"KeyT"
|
|
2694
2716
|
], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
|
|
2695
|
-
const [toasts, setToasts] =
|
|
2696
|
-
const filteredToasts =
|
|
2717
|
+
const [toasts, setToasts] = React2__default.useState([]);
|
|
2718
|
+
const filteredToasts = React2__default.useMemo(() => {
|
|
2697
2719
|
if (id) {
|
|
2698
2720
|
return toasts.filter((toast2) => toast2.toasterId === id);
|
|
2699
2721
|
}
|
|
@@ -2702,7 +2724,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2702
2724
|
toasts,
|
|
2703
2725
|
id
|
|
2704
2726
|
]);
|
|
2705
|
-
const possiblePositions =
|
|
2727
|
+
const possiblePositions = React2__default.useMemo(() => {
|
|
2706
2728
|
return Array.from(new Set([
|
|
2707
2729
|
position
|
|
2708
2730
|
].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
|
|
@@ -2710,15 +2732,15 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2710
2732
|
filteredToasts,
|
|
2711
2733
|
position
|
|
2712
2734
|
]);
|
|
2713
|
-
const [heights, setHeights] =
|
|
2714
|
-
const [expanded, setExpanded] =
|
|
2715
|
-
const [interacting, setInteracting] =
|
|
2716
|
-
const [actualTheme, setActualTheme] =
|
|
2717
|
-
const listRef =
|
|
2735
|
+
const [heights, setHeights] = React2__default.useState([]);
|
|
2736
|
+
const [expanded, setExpanded] = React2__default.useState(false);
|
|
2737
|
+
const [interacting, setInteracting] = React2__default.useState(false);
|
|
2738
|
+
const [actualTheme, setActualTheme] = React2__default.useState(theme !== "system" ? theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
|
|
2739
|
+
const listRef = React2__default.useRef(null);
|
|
2718
2740
|
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
2719
|
-
const lastFocusedElementRef =
|
|
2720
|
-
const isFocusWithinRef =
|
|
2721
|
-
const removeToast =
|
|
2741
|
+
const lastFocusedElementRef = React2__default.useRef(null);
|
|
2742
|
+
const isFocusWithinRef = React2__default.useRef(false);
|
|
2743
|
+
const removeToast = React2__default.useCallback((toastToRemove) => {
|
|
2722
2744
|
setToasts((toasts2) => {
|
|
2723
2745
|
var _toasts_find;
|
|
2724
2746
|
if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
|
|
@@ -2727,7 +2749,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2727
2749
|
return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
|
|
2728
2750
|
});
|
|
2729
2751
|
}, []);
|
|
2730
|
-
|
|
2752
|
+
React2__default.useEffect(() => {
|
|
2731
2753
|
return ToastState.subscribe((toast2) => {
|
|
2732
2754
|
if (toast2.dismiss) {
|
|
2733
2755
|
requestAnimationFrame(() => {
|
|
@@ -2763,7 +2785,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2763
2785
|
}, [
|
|
2764
2786
|
toasts
|
|
2765
2787
|
]);
|
|
2766
|
-
|
|
2788
|
+
React2__default.useEffect(() => {
|
|
2767
2789
|
if (theme !== "system") {
|
|
2768
2790
|
setActualTheme(theme);
|
|
2769
2791
|
return;
|
|
@@ -2801,14 +2823,14 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2801
2823
|
}, [
|
|
2802
2824
|
theme
|
|
2803
2825
|
]);
|
|
2804
|
-
|
|
2826
|
+
React2__default.useEffect(() => {
|
|
2805
2827
|
if (toasts.length <= 1) {
|
|
2806
2828
|
setExpanded(false);
|
|
2807
2829
|
}
|
|
2808
2830
|
}, [
|
|
2809
2831
|
toasts
|
|
2810
2832
|
]);
|
|
2811
|
-
|
|
2833
|
+
React2__default.useEffect(() => {
|
|
2812
2834
|
const handleKeyDown = (event) => {
|
|
2813
2835
|
var _listRef_current;
|
|
2814
2836
|
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
@@ -2826,7 +2848,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2826
2848
|
}, [
|
|
2827
2849
|
hotkey
|
|
2828
2850
|
]);
|
|
2829
|
-
|
|
2851
|
+
React2__default.useEffect(() => {
|
|
2830
2852
|
if (listRef.current) {
|
|
2831
2853
|
return () => {
|
|
2832
2854
|
if (lastFocusedElementRef.current) {
|
|
@@ -2843,7 +2865,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2843
2865
|
]);
|
|
2844
2866
|
return (
|
|
2845
2867
|
// Remove item from normal navigation flow, only available via hotkey
|
|
2846
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ React2__default.createElement("section", {
|
|
2847
2869
|
ref,
|
|
2848
2870
|
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
2849
2871
|
tabIndex: -1,
|
|
@@ -2855,7 +2877,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2855
2877
|
var _heights_;
|
|
2856
2878
|
const [y, x] = position2.split("-");
|
|
2857
2879
|
if (!filteredToasts.length) return null;
|
|
2858
|
-
return /* @__PURE__ */
|
|
2880
|
+
return /* @__PURE__ */ React2__default.createElement("ol", {
|
|
2859
2881
|
key: position2,
|
|
2860
2882
|
dir: dir === "auto" ? getDocumentDirection() : dir,
|
|
2861
2883
|
tabIndex: -1,
|
|
@@ -2907,7 +2929,7 @@ var Toaster = /* @__PURE__ */ React.forwardRef(function Toaster2(props, ref) {
|
|
|
2907
2929
|
onPointerUp: () => setInteracting(false)
|
|
2908
2930
|
}, filteredToasts.filter((toast2) => !toast2.position && index === 0 || toast2.position === position2).map((toast2, index2) => {
|
|
2909
2931
|
var _toastOptions_duration, _toastOptions_closeButton;
|
|
2910
|
-
return /* @__PURE__ */
|
|
2932
|
+
return /* @__PURE__ */ React2__default.createElement(Toast, {
|
|
2911
2933
|
key: toast2.id,
|
|
2912
2934
|
icons,
|
|
2913
2935
|
index: index2,
|