@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.
Files changed (45) hide show
  1. package/dist/esm/Toast.native.js +30 -52
  2. package/dist/esm/Toast.native.js.map +1 -1
  3. package/dist/esm/ToastAnnounce.native.js +15 -39
  4. package/dist/esm/ToastAnnounce.native.js.map +1 -1
  5. package/dist/esm/ToastImperative.native.js +14 -42
  6. package/dist/esm/ToastImperative.native.js.map +2 -2
  7. package/dist/esm/ToastImpl.native.js +52 -61
  8. package/dist/esm/ToastImpl.native.js.map +2 -2
  9. package/dist/esm/ToastPortal.native.js +7 -25
  10. package/dist/esm/ToastPortal.native.js.map +1 -1
  11. package/dist/esm/ToastProvider.native.js +12 -40
  12. package/dist/esm/ToastProvider.native.js.map +1 -1
  13. package/dist/esm/ToastViewport.native.js +38 -59
  14. package/dist/esm/ToastViewport.native.js.map +2 -2
  15. package/dist/esm/constants.native.js +2 -24
  16. package/dist/esm/constants.native.js.map +1 -1
  17. package/dist/esm/createNativeToast.native.js +2 -24
  18. package/dist/esm/createNativeToast.native.js.map +1 -1
  19. package/dist/esm/index.native.js +1 -19
  20. package/dist/esm/index.native.js.map +1 -1
  21. package/dist/esm/types.native.js +0 -14
  22. package/dist/esm/types.native.js.map +2 -2
  23. package/dist/jsx/Toast.native.js +30 -52
  24. package/dist/jsx/Toast.native.js.map +1 -1
  25. package/dist/jsx/ToastAnnounce.native.js +15 -39
  26. package/dist/jsx/ToastAnnounce.native.js.map +1 -1
  27. package/dist/jsx/ToastImperative.native.js +14 -42
  28. package/dist/jsx/ToastImperative.native.js.map +2 -2
  29. package/dist/jsx/ToastImpl.native.js +52 -61
  30. package/dist/jsx/ToastImpl.native.js.map +2 -2
  31. package/dist/jsx/ToastPortal.native.js +7 -25
  32. package/dist/jsx/ToastPortal.native.js.map +1 -1
  33. package/dist/jsx/ToastProvider.native.js +12 -40
  34. package/dist/jsx/ToastProvider.native.js.map +1 -1
  35. package/dist/jsx/ToastViewport.native.js +38 -59
  36. package/dist/jsx/ToastViewport.native.js.map +2 -2
  37. package/dist/jsx/constants.native.js +2 -24
  38. package/dist/jsx/constants.native.js.map +1 -1
  39. package/dist/jsx/createNativeToast.native.js +2 -24
  40. package/dist/jsx/createNativeToast.native.js.map +1 -1
  41. package/dist/jsx/index.native.js +1 -19
  42. package/dist/jsx/index.native.js.map +1 -1
  43. package/dist/jsx/types.native.js +0 -14
  44. package/dist/jsx/types.native.js.map +2 -2
  45. package/package.json +15 -15
@@ -1,38 +1,17 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
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 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 = (0, import_core.styled)(import_text.SizableText, {
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__ */ (0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, { altText, asChild: !0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastClose, { ...actionProps, ref: forwardedRef }) }) : null;
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 = (0, import_core.styled)(import_stacks.ThemeableStack, {
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 = (0, import_ToastImpl.useToastInteractiveContext)(__scopeToast);
83
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, { asChild: !0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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: (0, import_helpers.composeEventHandlers)(props.onPress, interactiveContext.onClose)
68
+ onPress: composeEventHandlers(props.onPress, interactiveContext.onClose)
90
69
  }
91
70
  ) });
92
71
  }
93
72
  );
94
73
  ToastClose.displayName = CLOSE_NAME;
95
- const ToastComponent = import_ToastImpl.ToastImplFrame.styleable(
74
+ const ToastComponent = ToastImplFrame.styleable(
96
75
  (props, forwardedRef) => {
97
- const { forceMount, open: openProp, defaultOpen, onOpenChange, ...toastProps } = props, [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
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 = (0, import_core.useEvent)(props.onPause), onResume = (0, import_core.useEvent)(props.onResume);
103
- return forceMount || open ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
104
- import_ToastImpl.ToastImpl,
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: (0, import_helpers.composeEventHandlers)(props.onSwipeEnd, (event) => {
92
+ onSwipeEnd: composeEventHandlers(props.onSwipeEnd, (event) => {
114
93
  setOpen(!1);
115
94
  })
116
95
  }
117
96
  ) : null;
118
97
  }
119
98
  );
120
- ToastComponent.displayName = import_constants.TOAST_NAME;
121
- const Toast = (0, import_helpers.withStaticProperties)(ToastComponent, {
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
- // Annotate the CommonJS export names for ESM import in node:
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": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAiC,0BACjC,iBAA2D,6BAC3D,gBAA+B,4BAC/B,cAA4B,0BAC5B,gCAAqC,4CACrC,QAAuB,2BAEvB,mBAA2B,wBAC3B,uBAAqC,4BAErC,yBAA4D,8BAE5D,mBAAsE,wBAEtE,uBAA8B,4BAE9B,uBAA8B,4BA8EtB;AAxER,MAAM,aAAa,cAEb,iBAAa,oBAAO,yBAAa;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,uBAAmB,oBAAO,yBAAa;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;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QACL,SAAS,MAAM,QAAQ,EAAK;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
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
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 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__ */ (0, import_jsx_runtime.jsx)(
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 = (0, import_ToastProvider.useToastProviderContext)(__scopeToast), [renderAnnounceText, setRenderAnnounceText] = React.useState(!1), [isAnnounced, setIsAnnounced] = React.useState(!1);
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__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, { asChild: !0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_visually_hidden.VisuallyHidden, { ...announceProps, children: renderAnnounceText && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Text, { children: [
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 = (0, import_core.useEvent)(callback);
58
- (0, import_constants.useIsomorphicLayoutEffect)(() => {
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
- // Annotate the CommonJS export names for ESM import in node:
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": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0C,+BAE1C,cAA8C,0BAC9C,gBAAuB,4BACvB,yBAA+B,qCAC/B,QAAuB,2BAGvB,uBAAwC,4BAiBpC;AAfJ,MAAM,gCAA4B,oBAAO,mBAAO;AAAA,EAC9C,MAAM;AACR,CAAC,GAMK,uBAA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__defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
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 = (0, import_react.useRef)(0), [toast, setToast] = import_react.default.useState(null), [lastNativeToastRef, setLastNativeToastRef] = import_react.default.useState(null), show = import_react.default.useCallback(
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 || import_core.isWeb && isWebNative || !import_core.isWeb && isMobileNative || import_react_native.Platform.OS === "android" && isAndroidNative || import_react_native.Platform.OS === "ios" && isIosNative;
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 = (0, import_createNativeToast.createNativeToast)(title, showOptions ?? {});
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 = import_react.default.useCallback(() => {
30
+ ), hide = React.useCallback(() => {
58
31
  lastNativeToastRef == null || lastNativeToastRef.close(), setToast(null);
59
- }, [setToast, lastNativeToastRef]), contextValue = (0, import_react.useMemo)(() => ({
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__ */ (0, import_jsx_runtime.jsx)(ToastContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToastCurrentContext.Provider, { value: toast, children }) });
38
+ return /* @__PURE__ */ jsx(ToastContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(ToastCurrentContext.Provider, { value: toast, children }) });
66
39
  };
67
- // Annotate the CommonJS export names for ESM import in node:
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": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAsB,0BACtB,eAAkE,2BAClE,sBAAyB,yBAEzB,2BAAkC,gCA6K5B;AAhGN,MAAM,mBAAe,4BAA6B,CAAC,CAAQ,GACrD,0BAAsB,4BAAgC,IAAI,GAEnD,qBAAqB,UACzB,yBAAW,YAAY,GAGnB,gBAAgB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,SAAS,KAAK,IAAI,WAAW,QAEzD,oBACJ,WAAW,MACV,SAAS,eACT,CAAC,SAAS,kBACV,SAAS,OAAO,aAAa,mBAC7B,SAAS,OAAO,SAAS;AAE5B,UAAI,mBAAmB;AACrB,cAAM,oBAAoB,kBAAkB,OAAO,eAAe,CAAC,CAAC;AACpE,QAAI,OAAO,qBAAsB,YAAY,kBAAkB,kBAC7D,sBAAsB,kBAAkB,cAAc;AAAA,MAE1D;AACA,wBAAW,WACX,SAAS;AAAA,QACP,GAAG,2CAAa;AAAA,QAChB,GAAG;AAAA,QACH,eAAc,2CAAa,iBAAgB;AAAA,QAC3C;AAAA,QACA,IAAI,WAAW,QAAQ,SAAS;AAAA,QAChC;AAAA,MACF,CAAC,GACM;AAAA,IACT;AAAA,IACA,CAAC,UAAU,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
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
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 ToastImpl_exports = {};
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
- } = (0, import_core.createStyledContext)({
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 = (0, import_animate_presence.useIsPresent)(), context = (0, import_ToastProvider.useToastProviderContext)(__scopeToast), [node, setNode] = React.useState(null), composedRefs = (0, import_compose_refs.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 = (0, import_core.useEvent)(() => {
79
- isPresent && (import_constants.isWeb && (node != null && node.contains(document.activeElement)) && (viewport == null || viewport.focus()), onClose());
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 (import_constants.isWeb && viewport)
93
- return viewport.addEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.addEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume), () => {
94
- viewport.removeEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.removeEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume);
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(() => import_constants.isWeb && node ? getAnnounceTextContent(node) : null, [node]), isHorizontalSwipe = ["left", "right", "horizontal"].includes(
91
+ const announceTextContent = React.useMemo(() => isWeb && node ? getAnnounceTextContent(node) : null, [node]), isHorizontalSwipe = ["left", "right", "horizontal"].includes(
100
92
  context.swipeDirection
101
- ), { animationDriver } = (0, import_core.useConfiguration)();
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 ?? import_core.Stack, animatedStyles = useAnimatedNumberStyle(animatedNumber, (val) => {
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(() => import_react_native.PanResponder.create({
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
- import_constants.isWeb || handlePause == null || handlePause();
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
- ) || (import_constants.isWeb || handleResume == null || handleResume(), onSwipeCancel == null || onSwipeCancel(e), animatedNumber.setValue(0, { type: "spring" }));
115
+ ) || (isWeb || handleResume == null || handleResume(), onSwipeCancel == null || onSwipeCancel(e), animatedNumber.setValue(0, { type: "spring" }));
124
116
  }
125
- }), [handlePause, handleResume]), themeName = (0, import_core.useThemeName)();
126
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
127
- announceTextContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
- import_ToastAnnounce.ToastAnnounce,
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__ */ (0, import_jsx_runtime.jsx)(import_portal.PortalItem, { hostName: viewportName ?? "default", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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__ */ (0, import_jsx_runtime.jsx)(
145
- import_dismissable.Dismissable,
136
+ children: /* @__PURE__ */ jsx(
137
+ Dismissable,
146
138
  {
147
- onEscapeKeyDown: (0, import_helpers.composeEventHandlers)(onEscapeKeyDown, () => {
139
+ onEscapeKeyDown: composeEventHandlers(onEscapeKeyDown, () => {
148
140
  context.isFocusedToastEscapeKeyDownRef.current || handleClose(), context.isFocusedToastEscapeKeyDownRef.current = !1;
149
141
  }),
150
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { forceClassName: !0, name: themeName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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__ */ (0, import_jsx_runtime.jsx)(import_ToastProvider.Collection.ItemSlot, { __scopeCollection: __scopeToast || import_constants2.TOAST_CONTEXT, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
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
- ...import_constants.isWeb && {
169
- onKeyDown: (0, import_helpers.composeEventHandlers)(
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 \`${import_constants2.TOAST_NAME}\`. Expected \`foreground | background\`.`;
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 (!import_constants.isWeb)
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
- // Annotate the CommonJS export names for ESM import in node:
228
- 0 && (module.exports = {
219
+ export {
229
220
  ToastImpl,
230
221
  ToastImplFrame,
231
222
  useToastInteractiveContext
232
- });
223
+ };
233
224
  //# sourceMappingURL=ToastImpl.js.map