@tamagui/toast 1.88.21 → 1.88.23
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/esm/Toast.native.js +30 -52
- package/dist/esm/Toast.native.js.map +1 -1
- package/dist/esm/ToastAnnounce.native.js +15 -39
- package/dist/esm/ToastAnnounce.native.js.map +1 -1
- package/dist/esm/ToastImperative.native.js +14 -42
- package/dist/esm/ToastImperative.native.js.map +2 -2
- package/dist/esm/ToastImpl.native.js +52 -61
- package/dist/esm/ToastImpl.native.js.map +2 -2
- package/dist/esm/ToastPortal.native.js +7 -25
- package/dist/esm/ToastPortal.native.js.map +1 -1
- package/dist/esm/ToastProvider.native.js +12 -40
- package/dist/esm/ToastProvider.native.js.map +1 -1
- package/dist/esm/ToastViewport.native.js +38 -59
- package/dist/esm/ToastViewport.native.js.map +2 -2
- package/dist/esm/constants.native.js +2 -24
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/createNativeToast.native.js +2 -24
- package/dist/esm/createNativeToast.native.js.map +1 -1
- package/dist/esm/index.native.js +1 -19
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/types.native.js +0 -14
- package/dist/esm/types.native.js.map +2 -2
- package/dist/jsx/Toast.native.js +30 -52
- package/dist/jsx/Toast.native.js.map +1 -1
- package/dist/jsx/ToastAnnounce.native.js +15 -39
- package/dist/jsx/ToastAnnounce.native.js.map +1 -1
- package/dist/jsx/ToastImperative.native.js +14 -42
- package/dist/jsx/ToastImperative.native.js.map +2 -2
- package/dist/jsx/ToastImpl.native.js +52 -61
- package/dist/jsx/ToastImpl.native.js.map +2 -2
- package/dist/jsx/ToastPortal.native.js +7 -25
- package/dist/jsx/ToastPortal.native.js.map +1 -1
- package/dist/jsx/ToastProvider.native.js +12 -40
- package/dist/jsx/ToastProvider.native.js.map +1 -1
- package/dist/jsx/ToastViewport.native.js +38 -59
- package/dist/jsx/ToastViewport.native.js.map +2 -2
- package/dist/jsx/constants.native.js +2 -24
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/createNativeToast.native.js +2 -24
- package/dist/jsx/createNativeToast.native.js.map +1 -1
- package/dist/jsx/index.native.js +1 -19
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/types.native.js +0 -14
- package/dist/jsx/types.native.js.map +2 -2
- package/package.json +15 -15
package/dist/esm/Toast.native.js
CHANGED
|
@@ -1,38 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
-
mod
|
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
-
var Toast_exports = {};
|
|
25
|
-
__export(Toast_exports, {
|
|
26
|
-
Toast: () => Toast,
|
|
27
|
-
ToastProvider: () => import_ToastProvider.ToastProvider,
|
|
28
|
-
ToastViewport: () => import_ToastViewport.ToastViewport,
|
|
29
|
-
useToast: () => import_ToastImperative.useToast,
|
|
30
|
-
useToastController: () => import_ToastImperative.useToastController,
|
|
31
|
-
useToastState: () => import_ToastImperative.useToastState
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(Toast_exports);
|
|
34
|
-
var import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_constants = require("./constants"), import_ToastAnnounce = require("./ToastAnnounce"), import_ToastImperative = require("./ToastImperative"), import_ToastImpl = require("./ToastImpl"), import_ToastProvider = require("./ToastProvider"), import_ToastViewport = require("./ToastViewport"), import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
const TITLE_NAME = "ToastTitle", ToastTitle = (0, import_core.styled)(import_text.SizableText, {
|
|
1
|
+
import { styled, useEvent } from "@tamagui/core";
|
|
2
|
+
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
3
|
+
import { ThemeableStack } from "@tamagui/stacks";
|
|
4
|
+
import { SizableText } from "@tamagui/text";
|
|
5
|
+
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { TOAST_NAME } from "./constants";
|
|
8
|
+
import { ToastAnnounceExclude } from "./ToastAnnounce";
|
|
9
|
+
import { useToast, useToastController, useToastState } from "./ToastImperative";
|
|
10
|
+
import { ToastImpl, ToastImplFrame, useToastInteractiveContext } from "./ToastImpl";
|
|
11
|
+
import { ToastProvider } from "./ToastProvider";
|
|
12
|
+
import { ToastViewport } from "./ToastViewport";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
const TITLE_NAME = "ToastTitle", ToastTitle = styled(SizableText, {
|
|
36
15
|
name: TITLE_NAME,
|
|
37
16
|
variants: {
|
|
38
17
|
unstyled: {
|
|
@@ -47,7 +26,7 @@ const TITLE_NAME = "ToastTitle", ToastTitle = (0, import_core.styled)(import_tex
|
|
|
47
26
|
}
|
|
48
27
|
});
|
|
49
28
|
ToastTitle.displayName = TITLE_NAME;
|
|
50
|
-
const DESCRIPTION_NAME = "ToastDescription", ToastDescription =
|
|
29
|
+
const DESCRIPTION_NAME = "ToastDescription", ToastDescription = styled(SizableText, {
|
|
51
30
|
name: DESCRIPTION_NAME,
|
|
52
31
|
variants: {
|
|
53
32
|
unstyled: {
|
|
@@ -65,7 +44,7 @@ ToastDescription.displayName = DESCRIPTION_NAME;
|
|
|
65
44
|
const ACTION_NAME = "ToastAction", ToastAction = React.forwardRef(
|
|
66
45
|
(props, forwardedRef) => {
|
|
67
46
|
const { altText, ...actionProps } = props;
|
|
68
|
-
return altText ? /* @__PURE__ */
|
|
47
|
+
return altText ? /* @__PURE__ */ jsx(ToastAnnounceExclude, { altText, asChild: !0, children: /* @__PURE__ */ jsx(ToastClose, { ...actionProps, ref: forwardedRef }) }) : null;
|
|
69
48
|
}
|
|
70
49
|
);
|
|
71
50
|
ToastAction.propTypes = {
|
|
@@ -74,34 +53,34 @@ ToastAction.propTypes = {
|
|
|
74
53
|
}
|
|
75
54
|
};
|
|
76
55
|
ToastAction.displayName = ACTION_NAME;
|
|
77
|
-
const CLOSE_NAME = "ToastClose", ToastCloseFrame =
|
|
56
|
+
const CLOSE_NAME = "ToastClose", ToastCloseFrame = styled(ThemeableStack, {
|
|
78
57
|
name: CLOSE_NAME,
|
|
79
58
|
tag: "button"
|
|
80
59
|
}), ToastClose = React.forwardRef(
|
|
81
60
|
(props, forwardedRef) => {
|
|
82
|
-
const { __scopeToast, ...closeProps } = props, interactiveContext =
|
|
83
|
-
return /* @__PURE__ */
|
|
61
|
+
const { __scopeToast, ...closeProps } = props, interactiveContext = useToastInteractiveContext(__scopeToast);
|
|
62
|
+
return /* @__PURE__ */ jsx(ToastAnnounceExclude, { asChild: !0, children: /* @__PURE__ */ jsx(
|
|
84
63
|
ToastCloseFrame,
|
|
85
64
|
{
|
|
86
65
|
accessibilityLabel: "Dialog Close",
|
|
87
66
|
...closeProps,
|
|
88
67
|
ref: forwardedRef,
|
|
89
|
-
onPress:
|
|
68
|
+
onPress: composeEventHandlers(props.onPress, interactiveContext.onClose)
|
|
90
69
|
}
|
|
91
70
|
) });
|
|
92
71
|
}
|
|
93
72
|
);
|
|
94
73
|
ToastClose.displayName = CLOSE_NAME;
|
|
95
|
-
const ToastComponent =
|
|
74
|
+
const ToastComponent = ToastImplFrame.styleable(
|
|
96
75
|
(props, forwardedRef) => {
|
|
97
|
-
const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props, [open, setOpen] =
|
|
76
|
+
const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props, [open, setOpen] = useControllableState({
|
|
98
77
|
prop: openProp,
|
|
99
78
|
defaultProp: defaultOpen ?? !0,
|
|
100
79
|
onChange: onOpenChange,
|
|
101
80
|
strategy: "most-recent-wins"
|
|
102
|
-
}), id = React.useId(), onPause =
|
|
103
|
-
return forceMount || open ? /* @__PURE__ */
|
|
104
|
-
|
|
81
|
+
}), id = React.useId(), onPause = useEvent(props.onPause), onResume = useEvent(props.onResume);
|
|
82
|
+
return forceMount || open ? /* @__PURE__ */ jsx(
|
|
83
|
+
ToastImpl,
|
|
105
84
|
{
|
|
106
85
|
id,
|
|
107
86
|
open,
|
|
@@ -110,27 +89,26 @@ const ToastComponent = import_ToastImpl.ToastImplFrame.styleable(
|
|
|
110
89
|
onClose: () => setOpen(!1),
|
|
111
90
|
onPause,
|
|
112
91
|
onResume,
|
|
113
|
-
onSwipeEnd:
|
|
92
|
+
onSwipeEnd: composeEventHandlers(props.onSwipeEnd, (event) => {
|
|
114
93
|
setOpen(!1);
|
|
115
94
|
})
|
|
116
95
|
}
|
|
117
96
|
) : null;
|
|
118
97
|
}
|
|
119
98
|
);
|
|
120
|
-
ToastComponent.displayName =
|
|
121
|
-
const Toast =
|
|
99
|
+
ToastComponent.displayName = TOAST_NAME;
|
|
100
|
+
const Toast = withStaticProperties(ToastComponent, {
|
|
122
101
|
Title: ToastTitle,
|
|
123
102
|
Description: ToastDescription,
|
|
124
103
|
Action: ToastAction,
|
|
125
104
|
Close: ToastClose
|
|
126
105
|
});
|
|
127
|
-
|
|
128
|
-
0 && (module.exports = {
|
|
106
|
+
export {
|
|
129
107
|
Toast,
|
|
130
108
|
ToastProvider,
|
|
131
109
|
ToastViewport,
|
|
132
110
|
useToast,
|
|
133
111
|
useToastController,
|
|
134
112
|
useToastState
|
|
135
|
-
}
|
|
113
|
+
};
|
|
136
114
|
//# sourceMappingURL=Toast.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Toast.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AACA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,sBAAsB,4BAA4B;AAC3D,SAAS,sBAAsB;AAC/B,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,YAAY,WAAW;AAEvB,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AAErC,SAAS,UAAU,oBAAoB,qBAAqB;AAE5D,SAAS,WAAW,gBAAgB,kCAAkC;AAEtE,SAAS,qBAAqB;AAE9B,SAAS,qBAAqB;AA8EtB;AAxER,MAAM,aAAa,cAEb,aAAa,OAAO,aAAa;AAAA,EACrC,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC;AAID,WAAW,cAAc;AAMzB,MAAM,mBAAmB,oBAEnB,mBAAmB,OAAO,aAAa;AAAA,EAC3C,MAAM;AAAA,EAEN,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,EAC7C;AACF,CAAC;AAID,iBAAiB,cAAc;AAM/B,MAAM,cAAc,eAYd,cAAc,MAAM;AAAA,EACxB,CAAC,OAAsC,iBAAiB;AAC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;AAAA,QAC5B;AAAA,QACA;AAAA,QACA,YAAY,qBAAqB,MAAM,YAAY,CAAC,UAAU;AAC5D,kBAAQ,EAAK;AAAA,QACf,CAAC;AAAA;AAAA,IACH,IAdsB;AAAA,EAgB1B;AACF;AAEA,eAAe,cAAc;AAE7B,MAAM,QAAQ,qBAAqB,gBAAgB;AAAA,EACjD,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,OAAO;AACT,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,38 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
-
mod
|
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
-
var ToastAnnounce_exports = {};
|
|
25
|
-
__export(ToastAnnounce_exports, {
|
|
26
|
-
ToastAnnounce: () => ToastAnnounce,
|
|
27
|
-
ToastAnnounceExclude: () => ToastAnnounceExclude
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(ToastAnnounce_exports);
|
|
30
|
-
var import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_portal = require("@tamagui/portal"), import_visually_hidden = require("@tamagui/visually-hidden"), React = __toESM(require("react")), import_ToastProvider = require("./ToastProvider"), import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
const ToastAnnounceExcludeFrame = (0, import_core.styled)(import_core.Stack, {
|
|
1
|
+
import { useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
2
|
+
import { Stack, Text, styled, useEvent } from "@tamagui/core";
|
|
3
|
+
import { Portal } from "@tamagui/portal";
|
|
4
|
+
import { VisuallyHidden } from "@tamagui/visually-hidden";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { useToastProviderContext } from "./ToastProvider";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
const ToastAnnounceExcludeFrame = styled(Stack, {
|
|
32
9
|
name: "ToastAnnounceExclude"
|
|
33
10
|
}), ToastAnnounceExclude = React.forwardRef((props, forwardedRef) => {
|
|
34
11
|
const { altText, ...announceExcludeProps } = props;
|
|
35
|
-
return /* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
36
13
|
ToastAnnounceExcludeFrame,
|
|
37
14
|
{
|
|
38
15
|
"data-toast-announce-exclude": "",
|
|
@@ -42,11 +19,11 @@ const ToastAnnounceExcludeFrame = (0, import_core.styled)(import_core.Stack, {
|
|
|
42
19
|
}
|
|
43
20
|
);
|
|
44
21
|
}), ToastAnnounce = (props) => {
|
|
45
|
-
const { __scopeToast, children, ...announceProps } = props, context =
|
|
22
|
+
const { __scopeToast, children, ...announceProps } = props, context = useToastProviderContext(__scopeToast), [renderAnnounceText, setRenderAnnounceText] = React.useState(!1), [isAnnounced, setIsAnnounced] = React.useState(!1);
|
|
46
23
|
return useNextFrame(() => setRenderAnnounceText(!0)), React.useEffect(() => {
|
|
47
24
|
const timer = setTimeout(() => setIsAnnounced(!0), 1e3);
|
|
48
25
|
return () => clearTimeout(timer);
|
|
49
|
-
}, []), isAnnounced ? null : /* @__PURE__ */
|
|
26
|
+
}, []), isAnnounced ? null : /* @__PURE__ */ jsx(Portal, { asChild: !0, children: /* @__PURE__ */ jsx(VisuallyHidden, { ...announceProps, children: renderAnnounceText && /* @__PURE__ */ jsxs(Text, { children: [
|
|
50
27
|
context.label,
|
|
51
28
|
" ",
|
|
52
29
|
children
|
|
@@ -54,8 +31,8 @@ const ToastAnnounceExcludeFrame = (0, import_core.styled)(import_core.Stack, {
|
|
|
54
31
|
};
|
|
55
32
|
function useNextFrame(callback = () => {
|
|
56
33
|
}) {
|
|
57
|
-
const fn =
|
|
58
|
-
|
|
34
|
+
const fn = useEvent(callback);
|
|
35
|
+
useIsomorphicLayoutEffect(() => {
|
|
59
36
|
let raf1 = 0, raf2 = 0;
|
|
60
37
|
return raf1 = requestAnimationFrame(() => {
|
|
61
38
|
raf2 = requestAnimationFrame(fn);
|
|
@@ -64,9 +41,8 @@ function useNextFrame(callback = () => {
|
|
|
64
41
|
};
|
|
65
42
|
}, [fn]);
|
|
66
43
|
}
|
|
67
|
-
|
|
68
|
-
0 && (module.exports = {
|
|
44
|
+
export {
|
|
69
45
|
ToastAnnounce,
|
|
70
46
|
ToastAnnounceExclude
|
|
71
|
-
}
|
|
47
|
+
};
|
|
72
48
|
//# sourceMappingURL=ToastAnnounce.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ToastAnnounce.tsx"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,SAAS,iCAAiC;AAE1C,SAAS,OAAO,MAAM,QAAQ,gBAAgB;AAC9C,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,YAAY,WAAW;AAGvB,SAAS,+BAA+B;AAiB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|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
-
mod
|
|
23
|
-
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
-
var ToastImperative_exports = {};
|
|
25
|
-
__export(ToastImperative_exports, {
|
|
26
|
-
ToastImperativeProvider: () => ToastImperativeProvider,
|
|
27
|
-
useToast: () => useToast,
|
|
28
|
-
useToastController: () => useToastController,
|
|
29
|
-
useToastState: () => useToastState
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(ToastImperative_exports);
|
|
32
|
-
var import_core = require("@tamagui/core"), import_react = __toESM(require("react")), import_react_native = require("react-native"), import_createNativeToast = require("./createNativeToast"), import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
-
const ToastContext = (0, import_react.createContext)({}), ToastCurrentContext = (0, import_react.createContext)(null), useToastController = () => (0, import_react.useContext)(ToastContext), useToastState = () => (0, import_react.useContext)(ToastCurrentContext), useToast = () => ({
|
|
1
|
+
import { isWeb } from "@tamagui/core";
|
|
2
|
+
import React, { createContext, useContext, useMemo, useRef } from "react";
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
import { createNativeToast } from "./createNativeToast";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
const ToastContext = createContext({}), ToastCurrentContext = createContext(null), useToastController = () => useContext(ToastContext), useToastState = () => useContext(ToastCurrentContext), useToast = () => ({
|
|
34
7
|
...useToastController(),
|
|
35
8
|
currentToast: useToastState()
|
|
36
9
|
}), ToastImperativeProvider = ({
|
|
37
10
|
children,
|
|
38
11
|
options
|
|
39
12
|
}) => {
|
|
40
|
-
const counterRef =
|
|
13
|
+
const counterRef = useRef(0), [toast, setToast] = React.useState(null), [lastNativeToastRef, setLastNativeToastRef] = React.useState(null), show = React.useCallback(
|
|
41
14
|
(title, showOptions) => {
|
|
42
|
-
const native = (showOptions == null ? void 0 : showOptions.native) ?? options.native, isWebNative = Array.isArray(native) ? native.includes("web") : native === "web", isMobileNative = Array.isArray(native) ? native.includes("mobile") : native === "mobile", isAndroidNative = isMobileNative || (Array.isArray(native) ? native.includes("android") : native === "android"), isIosNative = isMobileNative || (Array.isArray(native) ? native.includes("ios") : native === "ios"), isHandledNatively = native === !0 ||
|
|
15
|
+
const native = (showOptions == null ? void 0 : showOptions.native) ?? options.native, isWebNative = Array.isArray(native) ? native.includes("web") : native === "web", isMobileNative = Array.isArray(native) ? native.includes("mobile") : native === "mobile", isAndroidNative = isMobileNative || (Array.isArray(native) ? native.includes("android") : native === "android"), isIosNative = isMobileNative || (Array.isArray(native) ? native.includes("ios") : native === "ios"), isHandledNatively = native === !0 || isWeb && isWebNative || !isWeb && isMobileNative || Platform.OS === "android" && isAndroidNative || Platform.OS === "ios" && isIosNative;
|
|
43
16
|
if (isHandledNatively) {
|
|
44
|
-
const nativeToastResult =
|
|
17
|
+
const nativeToastResult = createNativeToast(title, showOptions ?? {});
|
|
45
18
|
typeof nativeToastResult == "object" && nativeToastResult.nativeToastRef && setLastNativeToastRef(nativeToastResult.nativeToastRef);
|
|
46
19
|
}
|
|
47
20
|
return counterRef.current++, setToast({
|
|
@@ -54,21 +27,20 @@ const ToastContext = (0, import_react.createContext)({}), ToastCurrentContext =
|
|
|
54
27
|
}), !0;
|
|
55
28
|
},
|
|
56
29
|
[setToast, options.native]
|
|
57
|
-
), hide =
|
|
30
|
+
), hide = React.useCallback(() => {
|
|
58
31
|
lastNativeToastRef == null || lastNativeToastRef.close(), setToast(null);
|
|
59
|
-
}, [setToast, lastNativeToastRef]), contextValue =
|
|
32
|
+
}, [setToast, lastNativeToastRef]), contextValue = useMemo(() => ({
|
|
60
33
|
show,
|
|
61
34
|
hide,
|
|
62
35
|
nativeToast: lastNativeToastRef,
|
|
63
36
|
options
|
|
64
37
|
}), [show, hide, lastNativeToastRef, JSON.stringify(options || null)]);
|
|
65
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ jsx(ToastContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(ToastCurrentContext.Provider, { value: toast, children }) });
|
|
66
39
|
};
|
|
67
|
-
|
|
68
|
-
0 && (module.exports = {
|
|
40
|
+
export {
|
|
69
41
|
ToastImperativeProvider,
|
|
70
42
|
useToast,
|
|
71
43
|
useToastController,
|
|
72
44
|
useToastState
|
|
73
|
-
}
|
|
45
|
+
};
|
|
74
46
|
//# sourceMappingURL=ToastImperative.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ToastImperative.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": [
|
|
4
|
+
"mappings": "AACA,SAAS,aAAa;AACtB,OAAO,SAAS,eAAe,YAAY,SAAS,cAAc;AAClE,SAAS,gBAAgB;AAEzB,SAAS,yBAAyB;AA6K5B;AAhGN,MAAM,eAAe,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,QAAQ,MAAM;AAAA,EAC3B,GACM,OAAO,MAAM,YAAY,MAAM;AACnC,qDAAoB,SACpB,SAAS,IAAI;AAAA,EACf,GAAG,CAAC,UAAU,kBAAkB,CAAC,GAE3B,eAAe,QAAQ,OACpB;AAAA,IACL;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,EACF,IACC,CAAC,MAAM,MAAM,oBAAoB,KAAK,UAAU,WAAW,IAAI,CAAC,CAAC;AAEpE,SACE,oBAAC,aAAa,UAAb,EAAsB,OAAO,cAC5B,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,OAClC,UACH,GACF;AAEJ;",
|
|
5
|
+
"names": []
|
|
6
6
|
}
|
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
__export(ToastImpl_exports, {
|
|
26
|
-
ToastImpl: () => ToastImpl,
|
|
27
|
-
ToastImplFrame: () => ToastImplFrame,
|
|
28
|
-
useToastInteractiveContext: () => useToastInteractiveContext
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(ToastImpl_exports);
|
|
31
|
-
var import_animate_presence = require("@tamagui/animate-presence"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_dismissable = require("@tamagui/dismissable"), import_helpers = require("@tamagui/helpers"), import_portal = require("@tamagui/portal"), import_stacks = require("@tamagui/stacks"), React = __toESM(require("react")), import_react_native = require("react-native"), import_constants2 = require("./constants"), import_ToastAnnounce = require("./ToastAnnounce"), import_ToastProvider = require("./ToastProvider"), import_ToastViewport = require("./ToastViewport"), import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
1
|
+
import { useIsPresent } from "@tamagui/animate-presence";
|
|
2
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
+
import { isWeb } from "@tamagui/constants";
|
|
4
|
+
import {
|
|
5
|
+
Stack,
|
|
6
|
+
Theme,
|
|
7
|
+
createStyledContext,
|
|
8
|
+
styled,
|
|
9
|
+
useConfiguration,
|
|
10
|
+
useEvent,
|
|
11
|
+
useThemeName
|
|
12
|
+
} from "@tamagui/core";
|
|
13
|
+
import { Dismissable } from "@tamagui/dismissable";
|
|
14
|
+
import { composeEventHandlers } from "@tamagui/helpers";
|
|
15
|
+
import { PortalItem } from "@tamagui/portal";
|
|
16
|
+
import { ThemeableStack } from "@tamagui/stacks";
|
|
17
|
+
import * as React from "react";
|
|
18
|
+
import { PanResponder } from "react-native";
|
|
19
|
+
import { TOAST_CONTEXT, TOAST_NAME } from "./constants";
|
|
20
|
+
import { ToastAnnounce } from "./ToastAnnounce";
|
|
21
|
+
import { Collection, useToastProviderContext } from "./ToastProvider";
|
|
22
|
+
import { VIEWPORT_PAUSE, VIEWPORT_RESUME } from "./ToastViewport";
|
|
23
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
+
const ToastImplFrame = styled(ThemeableStack, {
|
|
33
25
|
name: "ToastImpl",
|
|
34
26
|
focusable: !0,
|
|
35
27
|
variants: {
|
|
@@ -55,7 +47,7 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
55
47
|
}), {
|
|
56
48
|
Provider: ToastInteractiveProvider,
|
|
57
49
|
useStyledContext: useToastInteractiveContext
|
|
58
|
-
} =
|
|
50
|
+
} = createStyledContext({
|
|
59
51
|
onClose() {
|
|
60
52
|
}
|
|
61
53
|
}), ToastImpl = React.forwardRef(
|
|
@@ -75,8 +67,8 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
75
67
|
onSwipeEnd,
|
|
76
68
|
viewportName = "default",
|
|
77
69
|
...toastProps
|
|
78
|
-
} = props, isPresent =
|
|
79
|
-
isPresent && (
|
|
70
|
+
} = props, isPresent = useIsPresent(), context = useToastProviderContext(__scopeToast), [node, setNode] = React.useState(null), composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2)), duration = durationProp || context.duration, closeTimerStartTimeRef = React.useRef(0), closeTimerRemainingTimeRef = React.useRef(duration), closeTimerRef = React.useRef(0), { onToastAdd, onToastRemove } = context, viewport = React.useMemo(() => context.viewports[viewportName], [context.viewports, viewportName]), handleClose = useEvent(() => {
|
|
71
|
+
isPresent && (isWeb && (node != null && node.contains(document.activeElement)) && (viewport == null || viewport.focus()), onClose());
|
|
80
72
|
}), startTimer = React.useCallback(
|
|
81
73
|
(duration2) => {
|
|
82
74
|
!duration2 || duration2 === 1 / 0 || (clearTimeout(closeTimerRef.current), closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime(), closeTimerRef.current = setTimeout(handleClose, duration2));
|
|
@@ -89,27 +81,27 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
89
81
|
closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime, window.clearTimeout(closeTimerRef.current), onPause == null || onPause();
|
|
90
82
|
}, [onPause]);
|
|
91
83
|
React.useEffect(() => {
|
|
92
|
-
if (
|
|
93
|
-
return viewport.addEventListener(
|
|
94
|
-
viewport.removeEventListener(
|
|
84
|
+
if (isWeb && viewport)
|
|
85
|
+
return viewport.addEventListener(VIEWPORT_PAUSE, handlePause), viewport.addEventListener(VIEWPORT_RESUME, handleResume), () => {
|
|
86
|
+
viewport.removeEventListener(VIEWPORT_PAUSE, handlePause), viewport.removeEventListener(VIEWPORT_RESUME, handleResume);
|
|
95
87
|
};
|
|
96
88
|
}, [viewport, duration, onPause, onResume, startTimer]), React.useEffect(() => {
|
|
97
89
|
open && !context.isClosePausedRef.current && startTimer(duration);
|
|
98
90
|
}, [open, duration, context.isClosePausedRef, startTimer]), React.useEffect(() => (onToastAdd(), () => onToastRemove()), [onToastAdd, onToastRemove]);
|
|
99
|
-
const announceTextContent = React.useMemo(() =>
|
|
91
|
+
const announceTextContent = React.useMemo(() => isWeb && node ? getAnnounceTextContent(node) : null, [node]), isHorizontalSwipe = ["left", "right", "horizontal"].includes(
|
|
100
92
|
context.swipeDirection
|
|
101
|
-
), { animationDriver } =
|
|
93
|
+
), { animationDriver } = useConfiguration();
|
|
102
94
|
if (!animationDriver)
|
|
103
95
|
throw new Error("Must set animations in tamagui.config.ts");
|
|
104
|
-
const { useAnimatedNumber, useAnimatedNumberStyle } = animationDriver, animatedNumber = useAnimatedNumber(0), AnimatedView = animationDriver.NumberView ?? animationDriver.View ??
|
|
96
|
+
const { useAnimatedNumber, useAnimatedNumberStyle } = animationDriver, animatedNumber = useAnimatedNumber(0), AnimatedView = animationDriver.NumberView ?? animationDriver.View ?? Stack, animatedStyles = useAnimatedNumberStyle(animatedNumber, (val) => {
|
|
105
97
|
"worklet";
|
|
106
98
|
return {
|
|
107
99
|
transform: [isHorizontalSwipe ? { translateX: val } : { translateY: val }]
|
|
108
100
|
};
|
|
109
|
-
}), panResponder = React.useMemo(() =>
|
|
101
|
+
}), panResponder = React.useMemo(() => PanResponder.create({
|
|
110
102
|
onMoveShouldSetPanResponder: (e, gesture) => shouldGrantGestureMove(context.swipeDirection, gesture) ? (onSwipeStart == null || onSwipeStart(e), !0) : !1,
|
|
111
103
|
onPanResponderGrant: (e) => {
|
|
112
|
-
|
|
104
|
+
isWeb || handlePause == null || handlePause();
|
|
113
105
|
},
|
|
114
106
|
onPanResponderMove: (e, gesture) => {
|
|
115
107
|
const { x, y } = getGestureDistance(context.swipeDirection, gesture), delta = { x, y };
|
|
@@ -120,12 +112,12 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
120
112
|
{ x: dx, y: dy },
|
|
121
113
|
context.swipeDirection,
|
|
122
114
|
context.swipeThreshold
|
|
123
|
-
) || (
|
|
115
|
+
) || (isWeb || handleResume == null || handleResume(), onSwipeCancel == null || onSwipeCancel(e), animatedNumber.setValue(0, { type: "spring" }));
|
|
124
116
|
}
|
|
125
|
-
}), [handlePause, handleResume]), themeName =
|
|
126
|
-
return /* @__PURE__ */
|
|
127
|
-
announceTextContent && /* @__PURE__ */
|
|
128
|
-
|
|
117
|
+
}), [handlePause, handleResume]), themeName = useThemeName();
|
|
118
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
119
|
+
announceTextContent && /* @__PURE__ */ jsx(
|
|
120
|
+
ToastAnnounce,
|
|
129
121
|
{
|
|
130
122
|
__scopeToast,
|
|
131
123
|
role: "status",
|
|
@@ -134,25 +126,25 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
134
126
|
children: announceTextContent
|
|
135
127
|
}
|
|
136
128
|
),
|
|
137
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ jsx(PortalItem, { hostName: viewportName ?? "default", children: /* @__PURE__ */ jsx(
|
|
138
130
|
ToastInteractiveProvider,
|
|
139
131
|
{
|
|
140
132
|
scope: __scopeToast,
|
|
141
133
|
onClose: () => {
|
|
142
134
|
handleClose();
|
|
143
135
|
},
|
|
144
|
-
children: /* @__PURE__ */
|
|
145
|
-
|
|
136
|
+
children: /* @__PURE__ */ jsx(
|
|
137
|
+
Dismissable,
|
|
146
138
|
{
|
|
147
|
-
onEscapeKeyDown:
|
|
139
|
+
onEscapeKeyDown: composeEventHandlers(onEscapeKeyDown, () => {
|
|
148
140
|
context.isFocusedToastEscapeKeyDownRef.current || handleClose(), context.isFocusedToastEscapeKeyDownRef.current = !1;
|
|
149
141
|
}),
|
|
150
|
-
children: /* @__PURE__ */
|
|
142
|
+
children: /* @__PURE__ */ jsx(Theme, { forceClassName: !0, name: themeName, children: /* @__PURE__ */ jsx(
|
|
151
143
|
AnimatedView,
|
|
152
144
|
{
|
|
153
145
|
...panResponder == null ? void 0 : panResponder.panHandlers,
|
|
154
146
|
style: [{ margin: "auto" }, animatedStyles],
|
|
155
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ jsx(Collection.ItemSlot, { __scopeCollection: __scopeToast || TOAST_CONTEXT, children: /* @__PURE__ */ jsx(
|
|
156
148
|
ToastImplFrame,
|
|
157
149
|
{
|
|
158
150
|
role: "status",
|
|
@@ -165,8 +157,8 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
165
157
|
userSelect: "none",
|
|
166
158
|
...toastProps,
|
|
167
159
|
ref: composedRefs,
|
|
168
|
-
...
|
|
169
|
-
onKeyDown:
|
|
160
|
+
...isWeb && {
|
|
161
|
+
onKeyDown: composeEventHandlers(
|
|
170
162
|
props.onKeyDown,
|
|
171
163
|
(event) => {
|
|
172
164
|
event.key === "Escape" && (onEscapeKeyDown == null || onEscapeKeyDown(event), onEscapeKeyDown == null || onEscapeKeyDown(event), event.defaultPrevented || (context.isFocusedToastEscapeKeyDownRef.current = !0, handleClose()));
|
|
@@ -188,7 +180,7 @@ const ToastImplFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
188
180
|
ToastImpl.propTypes = {
|
|
189
181
|
type(props) {
|
|
190
182
|
if (props.type && !["foreground", "background"].includes(props.type)) {
|
|
191
|
-
const error = `Invalid prop \`type\` supplied to \`${
|
|
183
|
+
const error = `Invalid prop \`type\` supplied to \`${TOAST_NAME}\`. Expected \`foreground | background\`.`;
|
|
192
184
|
return new Error(error);
|
|
193
185
|
}
|
|
194
186
|
return null;
|
|
@@ -199,7 +191,7 @@ const isDeltaInDirection = (delta, direction, threshold = 0) => {
|
|
|
199
191
|
return direction === "left" || direction === "right" || direction === "horizontal" ? isDeltaX && deltaX > threshold : !isDeltaX && deltaY > threshold;
|
|
200
192
|
};
|
|
201
193
|
function getAnnounceTextContent(container) {
|
|
202
|
-
if (!
|
|
194
|
+
if (!isWeb)
|
|
203
195
|
return "";
|
|
204
196
|
const textContent = [];
|
|
205
197
|
return Array.from(container.childNodes).forEach((node) => {
|
|
@@ -224,10 +216,9 @@ const GESTURE_GRANT_THRESHOLD = 10, shouldGrantGestureMove = (dir, { dx, dy }) =
|
|
|
224
216
|
y
|
|
225
217
|
};
|
|
226
218
|
};
|
|
227
|
-
|
|
228
|
-
0 && (module.exports = {
|
|
219
|
+
export {
|
|
229
220
|
ToastImpl,
|
|
230
221
|
ToastImplFrame,
|
|
231
222
|
useToastInteractiveContext
|
|
232
|
-
}
|
|
223
|
+
};
|
|
233
224
|
//# sourceMappingURL=ToastImpl.js.map
|