@tamagui/v2-toast 2.0.0-rc.4 → 2.0.0-rc.40

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 (248) hide show
  1. package/dist/cjs/Toast.cjs +149 -141
  2. package/dist/cjs/Toast.native.js +149 -142
  3. package/dist/cjs/Toast.native.js.map +1 -1
  4. package/dist/cjs/ToastAnnounce.cjs +78 -72
  5. package/dist/cjs/ToastAnnounce.native.js +85 -79
  6. package/dist/cjs/ToastAnnounce.native.js.map +1 -1
  7. package/dist/cjs/ToastImperative.cjs +99 -80
  8. package/dist/cjs/ToastImperative.native.js +104 -96
  9. package/dist/cjs/ToastImperative.native.js.map +1 -1
  10. package/dist/cjs/ToastImpl.cjs +330 -241
  11. package/dist/cjs/ToastImpl.native.js +342 -274
  12. package/dist/cjs/ToastImpl.native.js.map +1 -1
  13. package/dist/cjs/ToastItem.cjs +489 -423
  14. package/dist/cjs/ToastItem.native.js +542 -500
  15. package/dist/cjs/ToastItem.native.js.map +1 -1
  16. package/dist/cjs/ToastPortal.cjs +23 -18
  17. package/dist/cjs/ToastPortal.native.js +27 -22
  18. package/dist/cjs/ToastPortal.native.js.map +1 -1
  19. package/dist/cjs/ToastProvider.cjs +102 -98
  20. package/dist/cjs/ToastProvider.native.js +108 -106
  21. package/dist/cjs/ToastProvider.native.js.map +1 -1
  22. package/dist/cjs/ToastState.cjs +218 -155
  23. package/dist/cjs/ToastState.native.js +270 -203
  24. package/dist/cjs/ToastState.native.js.map +1 -1
  25. package/dist/cjs/ToastViewport.cjs +274 -233
  26. package/dist/cjs/ToastViewport.native.js +300 -273
  27. package/dist/cjs/ToastViewport.native.js.map +1 -1
  28. package/dist/cjs/Toaster.cjs +243 -184
  29. package/dist/cjs/Toaster.native.js +275 -237
  30. package/dist/cjs/Toaster.native.js.map +1 -1
  31. package/dist/cjs/constants.cjs +14 -12
  32. package/dist/cjs/constants.native.js +14 -12
  33. package/dist/cjs/constants.native.js.map +1 -1
  34. package/dist/cjs/createNativeToast.cjs +47 -29
  35. package/dist/cjs/createNativeToast.native.js +36 -27
  36. package/dist/cjs/createNativeToast.native.js.map +1 -1
  37. package/dist/cjs/index.cjs +14 -12
  38. package/dist/cjs/index.native.js +14 -12
  39. package/dist/cjs/index.native.js.map +1 -1
  40. package/dist/cjs/types.cjs +7 -5
  41. package/dist/cjs/types.native.js +7 -5
  42. package/dist/cjs/types.native.js.map +1 -1
  43. package/dist/cjs/useDragGesture.cjs +135 -98
  44. package/dist/cjs/useDragGesture.native.js +147 -110
  45. package/dist/cjs/useDragGesture.native.js.map +1 -1
  46. package/dist/esm/Toast.mjs +112 -106
  47. package/dist/esm/Toast.mjs.map +1 -1
  48. package/dist/esm/Toast.native.js +112 -107
  49. package/dist/esm/Toast.native.js.map +1 -1
  50. package/dist/esm/ToastAnnounce.mjs +46 -42
  51. package/dist/esm/ToastAnnounce.mjs.map +1 -1
  52. package/dist/esm/ToastAnnounce.native.js +52 -48
  53. package/dist/esm/ToastAnnounce.native.js.map +1 -1
  54. package/dist/esm/ToastImperative.mjs +71 -54
  55. package/dist/esm/ToastImperative.mjs.map +1 -1
  56. package/dist/esm/ToastImperative.native.js +76 -70
  57. package/dist/esm/ToastImperative.native.js.map +1 -1
  58. package/dist/esm/ToastImpl.mjs +290 -203
  59. package/dist/esm/ToastImpl.mjs.map +1 -1
  60. package/dist/esm/ToastImpl.native.js +302 -236
  61. package/dist/esm/ToastImpl.native.js.map +1 -1
  62. package/dist/esm/ToastItem.mjs +457 -393
  63. package/dist/esm/ToastItem.mjs.map +1 -1
  64. package/dist/esm/ToastItem.native.js +510 -470
  65. package/dist/esm/ToastItem.native.js.map +1 -1
  66. package/dist/esm/ToastPortal.mjs +7 -4
  67. package/dist/esm/ToastPortal.mjs.map +1 -1
  68. package/dist/esm/ToastPortal.native.js +11 -8
  69. package/dist/esm/ToastPortal.native.js.map +1 -1
  70. package/dist/esm/ToastProvider.mjs +71 -69
  71. package/dist/esm/ToastProvider.mjs.map +1 -1
  72. package/dist/esm/ToastProvider.native.js +77 -77
  73. package/dist/esm/ToastProvider.native.js.map +1 -1
  74. package/dist/esm/ToastState.mjs +205 -144
  75. package/dist/esm/ToastState.mjs.map +1 -1
  76. package/dist/esm/ToastState.native.js +258 -193
  77. package/dist/esm/ToastState.native.js.map +1 -1
  78. package/dist/esm/ToastViewport.mjs +238 -199
  79. package/dist/esm/ToastViewport.mjs.map +1 -1
  80. package/dist/esm/ToastViewport.native.js +264 -239
  81. package/dist/esm/ToastViewport.native.js.map +1 -1
  82. package/dist/esm/Toaster.mjs +211 -154
  83. package/dist/esm/Toaster.mjs.map +1 -1
  84. package/dist/esm/Toaster.native.js +243 -207
  85. package/dist/esm/Toaster.native.js.map +1 -1
  86. package/dist/esm/constants.mjs +2 -2
  87. package/dist/esm/constants.mjs.map +1 -1
  88. package/dist/esm/constants.native.js +2 -2
  89. package/dist/esm/constants.native.js.map +1 -1
  90. package/dist/esm/createNativeToast.mjs +35 -19
  91. package/dist/esm/createNativeToast.mjs.map +1 -1
  92. package/dist/esm/createNativeToast.native.js +24 -17
  93. package/dist/esm/createNativeToast.native.js.map +1 -1
  94. package/dist/esm/index.js +3 -6
  95. package/dist/esm/index.js.map +1 -6
  96. package/dist/esm/useDragGesture.mjs +111 -76
  97. package/dist/esm/useDragGesture.mjs.map +1 -1
  98. package/dist/esm/useDragGesture.native.js +121 -86
  99. package/dist/esm/useDragGesture.native.js.map +1 -1
  100. package/dist/jsx/Toast.mjs +112 -106
  101. package/dist/jsx/Toast.mjs.map +1 -1
  102. package/dist/jsx/Toast.native.js +149 -142
  103. package/dist/jsx/Toast.native.js.map +1 -1
  104. package/dist/jsx/ToastAnnounce.mjs +46 -42
  105. package/dist/jsx/ToastAnnounce.mjs.map +1 -1
  106. package/dist/jsx/ToastAnnounce.native.js +85 -79
  107. package/dist/jsx/ToastAnnounce.native.js.map +1 -1
  108. package/dist/jsx/ToastImperative.mjs +71 -54
  109. package/dist/jsx/ToastImperative.mjs.map +1 -1
  110. package/dist/jsx/ToastImperative.native.js +104 -96
  111. package/dist/jsx/ToastImperative.native.js.map +1 -1
  112. package/dist/jsx/ToastImpl.mjs +290 -203
  113. package/dist/jsx/ToastImpl.mjs.map +1 -1
  114. package/dist/jsx/ToastImpl.native.js +342 -274
  115. package/dist/jsx/ToastImpl.native.js.map +1 -1
  116. package/dist/jsx/ToastItem.mjs +457 -393
  117. package/dist/jsx/ToastItem.mjs.map +1 -1
  118. package/dist/jsx/ToastItem.native.js +542 -500
  119. package/dist/jsx/ToastItem.native.js.map +1 -1
  120. package/dist/jsx/ToastPortal.mjs +7 -4
  121. package/dist/jsx/ToastPortal.mjs.map +1 -1
  122. package/dist/jsx/ToastPortal.native.js +27 -22
  123. package/dist/jsx/ToastPortal.native.js.map +1 -1
  124. package/dist/jsx/ToastProvider.mjs +71 -69
  125. package/dist/jsx/ToastProvider.mjs.map +1 -1
  126. package/dist/jsx/ToastProvider.native.js +108 -106
  127. package/dist/jsx/ToastProvider.native.js.map +1 -1
  128. package/dist/jsx/ToastState.mjs +205 -144
  129. package/dist/jsx/ToastState.mjs.map +1 -1
  130. package/dist/jsx/ToastState.native.js +270 -203
  131. package/dist/jsx/ToastState.native.js.map +1 -1
  132. package/dist/jsx/ToastViewport.mjs +238 -199
  133. package/dist/jsx/ToastViewport.mjs.map +1 -1
  134. package/dist/jsx/ToastViewport.native.js +300 -273
  135. package/dist/jsx/ToastViewport.native.js.map +1 -1
  136. package/dist/jsx/Toaster.mjs +211 -154
  137. package/dist/jsx/Toaster.mjs.map +1 -1
  138. package/dist/jsx/Toaster.native.js +275 -237
  139. package/dist/jsx/Toaster.native.js.map +1 -1
  140. package/dist/jsx/constants.mjs +2 -2
  141. package/dist/jsx/constants.mjs.map +1 -1
  142. package/dist/jsx/constants.native.js +14 -12
  143. package/dist/jsx/constants.native.js.map +1 -1
  144. package/dist/jsx/createNativeToast.mjs +35 -19
  145. package/dist/jsx/createNativeToast.mjs.map +1 -1
  146. package/dist/jsx/createNativeToast.native.js +36 -27
  147. package/dist/jsx/createNativeToast.native.js.map +1 -1
  148. package/dist/jsx/index.js +3 -6
  149. package/dist/jsx/index.js.map +1 -6
  150. package/dist/jsx/index.native.js +14 -12
  151. package/dist/jsx/types.native.js +7 -5
  152. package/dist/jsx/useDragGesture.mjs +111 -76
  153. package/dist/jsx/useDragGesture.mjs.map +1 -1
  154. package/dist/jsx/useDragGesture.native.js +147 -110
  155. package/dist/jsx/useDragGesture.native.js.map +1 -1
  156. package/package.json +22 -31
  157. package/src/ToastImpl.tsx +1 -1
  158. package/src/Toaster.tsx +1 -1
  159. package/src/createNativeToast.native.tsx +12 -5
  160. package/types/ToastImpl.d.ts +1 -1
  161. package/types/ToastImpl.d.ts.map +1 -1
  162. package/types/createNativeToast.native.d.ts.map +1 -1
  163. package/dist/cjs/Toast.js +0 -119
  164. package/dist/cjs/Toast.js.map +0 -6
  165. package/dist/cjs/ToastAnnounce.js +0 -72
  166. package/dist/cjs/ToastAnnounce.js.map +0 -6
  167. package/dist/cjs/ToastImperative.js +0 -71
  168. package/dist/cjs/ToastImperative.js.map +0 -6
  169. package/dist/cjs/ToastImpl.js +0 -227
  170. package/dist/cjs/ToastImpl.js.map +0 -6
  171. package/dist/cjs/ToastItem.js +0 -356
  172. package/dist/cjs/ToastItem.js.map +0 -6
  173. package/dist/cjs/ToastPortal.js +0 -26
  174. package/dist/cjs/ToastPortal.js.map +0 -6
  175. package/dist/cjs/ToastProvider.js +0 -105
  176. package/dist/cjs/ToastProvider.js.map +0 -6
  177. package/dist/cjs/ToastState.js +0 -160
  178. package/dist/cjs/ToastState.js.map +0 -6
  179. package/dist/cjs/ToastViewport.js +0 -263
  180. package/dist/cjs/ToastViewport.js.map +0 -6
  181. package/dist/cjs/Toaster.js +0 -177
  182. package/dist/cjs/Toaster.js.map +0 -6
  183. package/dist/cjs/constants.js +0 -22
  184. package/dist/cjs/constants.js.map +0 -6
  185. package/dist/cjs/createNativeToast.js +0 -44
  186. package/dist/cjs/createNativeToast.js.map +0 -6
  187. package/dist/cjs/index.js +0 -22
  188. package/dist/cjs/index.js.map +0 -6
  189. package/dist/cjs/types.js +0 -14
  190. package/dist/cjs/types.js.map +0 -6
  191. package/dist/cjs/useDragGesture.js +0 -100
  192. package/dist/cjs/useDragGesture.js.map +0 -6
  193. package/dist/esm/Toast.js +0 -107
  194. package/dist/esm/Toast.js.map +0 -6
  195. package/dist/esm/ToastAnnounce.js +0 -55
  196. package/dist/esm/ToastAnnounce.js.map +0 -6
  197. package/dist/esm/ToastImperative.js +0 -50
  198. package/dist/esm/ToastImperative.js.map +0 -6
  199. package/dist/esm/ToastImpl.js +0 -225
  200. package/dist/esm/ToastImpl.js.map +0 -6
  201. package/dist/esm/ToastItem.js +0 -339
  202. package/dist/esm/ToastItem.js.map +0 -6
  203. package/dist/esm/ToastPortal.js +0 -13
  204. package/dist/esm/ToastPortal.js.map +0 -6
  205. package/dist/esm/ToastProvider.js +0 -87
  206. package/dist/esm/ToastProvider.js.map +0 -6
  207. package/dist/esm/ToastState.js +0 -144
  208. package/dist/esm/ToastState.js.map +0 -6
  209. package/dist/esm/ToastViewport.js +0 -250
  210. package/dist/esm/ToastViewport.js.map +0 -6
  211. package/dist/esm/Toaster.js +0 -160
  212. package/dist/esm/Toaster.js.map +0 -6
  213. package/dist/esm/constants.js +0 -6
  214. package/dist/esm/constants.js.map +0 -6
  215. package/dist/esm/createNativeToast.js +0 -28
  216. package/dist/esm/createNativeToast.js.map +0 -6
  217. package/dist/esm/types.js +0 -1
  218. package/dist/esm/types.js.map +0 -6
  219. package/dist/esm/useDragGesture.js +0 -76
  220. package/dist/esm/useDragGesture.js.map +0 -6
  221. package/dist/jsx/Toast.js +0 -107
  222. package/dist/jsx/Toast.js.map +0 -6
  223. package/dist/jsx/ToastAnnounce.js +0 -55
  224. package/dist/jsx/ToastAnnounce.js.map +0 -6
  225. package/dist/jsx/ToastImperative.js +0 -50
  226. package/dist/jsx/ToastImperative.js.map +0 -6
  227. package/dist/jsx/ToastImpl.js +0 -225
  228. package/dist/jsx/ToastImpl.js.map +0 -6
  229. package/dist/jsx/ToastItem.js +0 -339
  230. package/dist/jsx/ToastItem.js.map +0 -6
  231. package/dist/jsx/ToastPortal.js +0 -13
  232. package/dist/jsx/ToastPortal.js.map +0 -6
  233. package/dist/jsx/ToastProvider.js +0 -87
  234. package/dist/jsx/ToastProvider.js.map +0 -6
  235. package/dist/jsx/ToastState.js +0 -144
  236. package/dist/jsx/ToastState.js.map +0 -6
  237. package/dist/jsx/ToastViewport.js +0 -250
  238. package/dist/jsx/ToastViewport.js.map +0 -6
  239. package/dist/jsx/Toaster.js +0 -160
  240. package/dist/jsx/Toaster.js.map +0 -6
  241. package/dist/jsx/constants.js +0 -6
  242. package/dist/jsx/constants.js.map +0 -6
  243. package/dist/jsx/createNativeToast.js +0 -28
  244. package/dist/jsx/createNativeToast.js.map +0 -6
  245. package/dist/jsx/types.js +0 -1
  246. package/dist/jsx/types.js.map +0 -6
  247. package/dist/jsx/useDragGesture.js +0 -76
  248. package/dist/jsx/useDragGesture.js.map +0 -6
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var Toast_exports = {};
33
35
  __export(Toast_exports, {
34
36
  Toast: () => Toast2,
@@ -39,132 +41,138 @@ __export(Toast_exports, {
39
41
  useToastState: () => import_ToastImperative.useToastState
40
42
  });
41
43
  module.exports = __toCommonJS(Toast_exports);
42
- var import_animate_presence = require("@tamagui/animate-presence"),
43
- import_core = require("@tamagui/core"),
44
- import_helpers = require("@tamagui/helpers"),
45
- import_stacks = require("@tamagui/stacks"),
46
- import_text = require("@tamagui/text"),
47
- import_use_controllable_state = require("@tamagui/use-controllable-state"),
48
- React = __toESM(require("react"), 1),
49
- import_ToastAnnounce = require("./ToastAnnounce.cjs"),
50
- import_ToastImperative = require("./ToastImperative.cjs"),
51
- import_ToastImpl = require("./ToastImpl.cjs"),
52
- import_ToastProvider = require("./ToastProvider.cjs"),
53
- import_ToastViewport = require("./ToastViewport.cjs"),
54
- import_jsx_runtime = require("react/jsx-runtime");
55
- const TITLE_NAME = "ToastTitle",
56
- ToastTitle = (0, import_core.styled)(import_text.SizableText, {
57
- name: TITLE_NAME,
58
- variants: {
59
- unstyled: {
60
- false: {
61
- color: "$color",
62
- size: "$4"
63
- }
44
+ var import_animate_presence = require("@tamagui/animate-presence");
45
+ var import_core = require("@tamagui/core");
46
+ var import_helpers = require("@tamagui/helpers");
47
+ var import_stacks = require("@tamagui/stacks");
48
+ var import_text = require("@tamagui/text");
49
+ var import_use_controllable_state = require("@tamagui/use-controllable-state");
50
+ var React = __toESM(require("react"), 1);
51
+ var import_ToastAnnounce = require("./ToastAnnounce.cjs");
52
+ var import_ToastImperative = require("./ToastImperative.cjs");
53
+ var import_ToastImpl = require("./ToastImpl.cjs");
54
+ var import_ToastProvider = require("./ToastProvider.cjs");
55
+ var import_ToastViewport = require("./ToastViewport.cjs");
56
+ var import_jsx_runtime = require("react/jsx-runtime");
57
+ const TITLE_NAME = "ToastTitle";
58
+ const ToastTitle = (0, import_core.styled)(import_text.SizableText, {
59
+ name: TITLE_NAME,
60
+ variants: {
61
+ unstyled: {
62
+ false: {
63
+ color: "$color",
64
+ size: "$4"
64
65
  }
65
- },
66
- defaultVariants: {
67
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
68
66
  }
69
- }),
70
- DESCRIPTION_NAME = "ToastDescription",
71
- ToastDescription = (0, import_core.styled)(import_text.SizableText, {
72
- name: DESCRIPTION_NAME,
73
- variants: {
74
- unstyled: {
75
- false: {
76
- color: "$color11",
77
- size: "$1"
78
- }
67
+ },
68
+ defaultVariants: {
69
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
70
+ }
71
+ });
72
+ const DESCRIPTION_NAME = "ToastDescription";
73
+ const ToastDescription = (0, import_core.styled)(import_text.SizableText, {
74
+ name: DESCRIPTION_NAME,
75
+ variants: {
76
+ unstyled: {
77
+ false: {
78
+ color: "$color11",
79
+ size: "$1"
79
80
  }
80
- },
81
- defaultVariants: {
82
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
83
81
  }
84
- }),
85
- ACTION_NAME = "ToastAction",
86
- ToastAction = React.forwardRef(function (props, forwardedRef) {
87
- const {
88
- altText,
89
- ...actionProps
90
- } = props;
91
- return altText ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
92
- altText,
93
- asChild: !0,
94
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastClose, {
95
- ...actionProps,
96
- ref: forwardedRef
97
- })
98
- }) : null;
82
+ },
83
+ defaultVariants: {
84
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
85
+ }
86
+ });
87
+ const ACTION_NAME = "ToastAction";
88
+ const ToastAction = React.forwardRef(function ToastAction2(props, forwardedRef) {
89
+ const {
90
+ altText,
91
+ ...actionProps
92
+ } = props;
93
+ if (!altText) return null;
94
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
95
+ altText,
96
+ asChild: true,
97
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastClose, {
98
+ ...actionProps,
99
+ ref: forwardedRef
100
+ })
99
101
  });
102
+ });
100
103
  ToastAction.propTypes = {
101
104
  altText(props) {
102
- return props.altText ? null : new Error(`Missing prop \`altText\` expected on \`${ACTION_NAME}\``);
105
+ if (!props.altText) {
106
+ return new Error(`Missing prop \`altText\` expected on \`${ACTION_NAME}\``);
107
+ }
108
+ return null;
103
109
  }
104
110
  };
105
- const CLOSE_NAME = "ToastClose",
106
- ToastCloseFrame = (0, import_core.styled)(import_stacks.YStack, {
107
- name: CLOSE_NAME,
108
- render: "button"
109
- }),
110
- ToastClose = React.forwardRef(function (props, forwardedRef) {
111
- const {
112
- scope,
113
- ...closeProps
114
- } = props,
115
- interactiveContext = (0, import_ToastImpl.useToastInteractiveContext)(scope);
116
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
117
- asChild: !0,
118
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastCloseFrame, {
119
- "aria-label": "Close",
120
- ...closeProps,
121
- ref: forwardedRef,
122
- onPress: (0, import_helpers.composeEventHandlers)(props.onPress, interactiveContext.onClose)
111
+ const CLOSE_NAME = "ToastClose";
112
+ const ToastCloseFrame = (0, import_core.styled)(import_stacks.YStack, {
113
+ name: CLOSE_NAME,
114
+ render: "button"
115
+ });
116
+ const ToastClose = React.forwardRef(function ToastClose2(props, forwardedRef) {
117
+ const {
118
+ scope,
119
+ ...closeProps
120
+ } = props;
121
+ const interactiveContext = (0, import_ToastImpl.useToastInteractiveContext)(scope);
122
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
123
+ asChild: true,
124
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastCloseFrame, {
125
+ "aria-label": "Close",
126
+ ...closeProps,
127
+ ref: forwardedRef,
128
+ onPress: (0, import_helpers.composeEventHandlers)(props.onPress, interactiveContext.onClose)
129
+ })
130
+ });
131
+ });
132
+ const ToastComponent = import_ToastImpl.ToastImplFrame.styleable(function Toast(props, forwardedRef) {
133
+ const {
134
+ forceMount,
135
+ open: openProp,
136
+ defaultOpen,
137
+ onOpenChange,
138
+ ...toastProps
139
+ } = props;
140
+ const [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
141
+ prop: openProp,
142
+ defaultProp: defaultOpen ?? true,
143
+ onChange: onOpenChange,
144
+ strategy: "most-recent-wins"
145
+ });
146
+ const currentToast = (0, import_ToastImperative.useToastState)();
147
+ const {
148
+ hide
149
+ } = (0, import_ToastImperative.useToastController)();
150
+ const id = React.useId();
151
+ const onPause = (0, import_core.useEvent)(props.onPause);
152
+ const onResume = (0, import_core.useEvent)(props.onResume);
153
+ const isHide = currentToast?.hide === true;
154
+ const shouldShow = (forceMount || open) && !isHide;
155
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
156
+ children: shouldShow ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastImpl.ToastImpl, {
157
+ id,
158
+ open,
159
+ ...toastProps,
160
+ ref: forwardedRef,
161
+ onClose: () => {
162
+ setOpen(false);
163
+ hide();
164
+ },
165
+ onPause,
166
+ onResume,
167
+ onSwipeEnd: (0, import_helpers.composeEventHandlers)(props.onSwipeEnd, event => {
168
+ setOpen(false);
123
169
  })
124
- });
125
- }),
126
- ToastComponent = import_ToastImpl.ToastImplFrame.styleable(function (props, forwardedRef) {
127
- const {
128
- forceMount,
129
- open: openProp,
130
- defaultOpen,
131
- onOpenChange,
132
- ...toastProps
133
- } = props,
134
- [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
135
- prop: openProp,
136
- defaultProp: defaultOpen ?? !0,
137
- onChange: onOpenChange,
138
- strategy: "most-recent-wins"
139
- }),
140
- currentToast = (0, import_ToastImperative.useToastState)(),
141
- {
142
- hide
143
- } = (0, import_ToastImperative.useToastController)(),
144
- id = React.useId(),
145
- onPause = (0, import_core.useEvent)(props.onPause),
146
- onResume = (0, import_core.useEvent)(props.onResume),
147
- isHide = currentToast?.hide === !0;
148
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
149
- children: (forceMount || open) && !isHide ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastImpl.ToastImpl, {
150
- id,
151
- open,
152
- ...toastProps,
153
- ref: forwardedRef,
154
- onClose: () => {
155
- setOpen(!1), hide();
156
- },
157
- onPause,
158
- onResume,
159
- onSwipeEnd: (0, import_helpers.composeEventHandlers)(props.onSwipeEnd, event => {
160
- setOpen(!1);
161
- })
162
- }) : null
163
- }, id);
164
- }),
165
- Toast2 = (0, import_helpers.withStaticProperties)(ToastComponent, {
166
- Title: ToastTitle,
167
- Description: ToastDescription,
168
- Action: ToastAction,
169
- Close: ToastClose
170
- });
170
+ }) : null
171
+ }, id);
172
+ });
173
+ const Toast2 = (0, import_helpers.withStaticProperties)(ToastComponent, {
174
+ Title: ToastTitle,
175
+ Description: ToastDescription,
176
+ Action: ToastAction,
177
+ Close: ToastClose
178
+ });
@@ -4,33 +4,35 @@ var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: !0
13
- });
14
- },
15
- __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
18
  get: () => from[key],
18
19
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
20
  });
20
- return to;
21
- };
21
+ }
22
+ return to;
23
+ };
22
24
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: !0
30
- }) : target, mod)),
31
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: !0
33
- }), mod);
25
+ // If the importer is in node compatibility mode or this is not an ESM
26
+ // file that has been converted to a CommonJS file using a Babel-
27
+ // compatible transform (i.e. "__esModule" has not been set), then set
28
+ // "default" to the CommonJS "module.exports" for node compatibility.
29
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
+ value: true
35
+ }), mod);
34
36
  var Toast_exports = {};
35
37
  __export(Toast_exports, {
36
38
  Toast: () => Toast2,
@@ -41,134 +43,139 @@ __export(Toast_exports, {
41
43
  useToastState: () => import_ToastImperative.useToastState
42
44
  });
43
45
  module.exports = __toCommonJS(Toast_exports);
44
- var import_jsx_runtime = require("react/jsx-runtime"),
45
- import_animate_presence = require("@tamagui/animate-presence"),
46
- import_core = require("@tamagui/core"),
47
- import_helpers = require("@tamagui/helpers"),
48
- import_stacks = require("@tamagui/stacks"),
49
- import_text = require("@tamagui/text"),
50
- import_use_controllable_state = require("@tamagui/use-controllable-state"),
51
- React = __toESM(require("react"), 1),
52
- import_ToastAnnounce = require("./ToastAnnounce.native.js"),
53
- import_ToastImperative = require("./ToastImperative.native.js"),
54
- import_ToastImpl = require("./ToastImpl.native.js"),
55
- import_ToastProvider = require("./ToastProvider.native.js"),
56
- import_ToastViewport = require("./ToastViewport.native.js"),
57
- TITLE_NAME = "ToastTitle",
58
- ToastTitle = (0, import_core.styled)(import_text.SizableText, {
59
- name: TITLE_NAME,
60
- variants: {
61
- unstyled: {
62
- false: {
63
- color: "$color",
64
- size: "$4"
65
- }
46
+ var import_jsx_runtime = require("react/jsx-runtime");
47
+ var import_animate_presence = require("@tamagui/animate-presence");
48
+ var import_core = require("@tamagui/core");
49
+ var import_helpers = require("@tamagui/helpers");
50
+ var import_stacks = require("@tamagui/stacks");
51
+ var import_text = require("@tamagui/text");
52
+ var import_use_controllable_state = require("@tamagui/use-controllable-state");
53
+ var React = __toESM(require("react"), 1);
54
+ var import_ToastAnnounce = require("./ToastAnnounce.native.js");
55
+ var import_ToastImperative = require("./ToastImperative.native.js");
56
+ var import_ToastImpl = require("./ToastImpl.native.js");
57
+ var import_ToastProvider = require("./ToastProvider.native.js");
58
+ var import_ToastViewport = require("./ToastViewport.native.js");
59
+ var TITLE_NAME = "ToastTitle";
60
+ var ToastTitle = (0, import_core.styled)(import_text.SizableText, {
61
+ name: TITLE_NAME,
62
+ variants: {
63
+ unstyled: {
64
+ false: {
65
+ color: "$color",
66
+ size: "$4"
66
67
  }
67
- },
68
- defaultVariants: {
69
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
70
68
  }
71
- }),
72
- DESCRIPTION_NAME = "ToastDescription",
73
- ToastDescription = (0, import_core.styled)(import_text.SizableText, {
74
- name: DESCRIPTION_NAME,
75
- variants: {
76
- unstyled: {
77
- false: {
78
- color: "$color11",
79
- size: "$1"
80
- }
69
+ },
70
+ defaultVariants: {
71
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
72
+ }
73
+ });
74
+ var DESCRIPTION_NAME = "ToastDescription";
75
+ var ToastDescription = (0, import_core.styled)(import_text.SizableText, {
76
+ name: DESCRIPTION_NAME,
77
+ variants: {
78
+ unstyled: {
79
+ false: {
80
+ color: "$color11",
81
+ size: "$1"
81
82
  }
82
- },
83
- defaultVariants: {
84
- unstyled: process.env.TAMAGUI_HEADLESS === "1"
85
83
  }
86
- }),
87
- ACTION_NAME = "ToastAction",
88
- ToastAction = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
89
- var {
90
- altText,
91
- ...actionProps
92
- } = props;
93
- return altText ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
94
- altText,
95
- asChild: !0,
96
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastClose, {
97
- ...actionProps,
98
- ref: forwardedRef
99
- })
100
- }) : null;
84
+ },
85
+ defaultVariants: {
86
+ unstyled: process.env.TAMAGUI_HEADLESS === "1"
87
+ }
88
+ });
89
+ var ACTION_NAME = "ToastAction";
90
+ var ToastAction = /* @__PURE__ */React.forwardRef(function ToastAction2(props, forwardedRef) {
91
+ var {
92
+ altText,
93
+ ...actionProps
94
+ } = props;
95
+ if (!altText) return null;
96
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
97
+ altText,
98
+ asChild: true,
99
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastClose, {
100
+ ...actionProps,
101
+ ref: forwardedRef
102
+ })
101
103
  });
104
+ });
102
105
  ToastAction.propTypes = {
103
106
  altText(props) {
104
- return props.altText ? null : new Error(`Missing prop \`altText\` expected on \`${ACTION_NAME}\``);
107
+ if (!props.altText) {
108
+ return new Error(`Missing prop \`altText\` expected on \`${ACTION_NAME}\``);
109
+ }
110
+ return null;
105
111
  }
106
112
  };
107
- var CLOSE_NAME = "ToastClose",
108
- ToastCloseFrame = (0, import_core.styled)(import_stacks.YStack, {
109
- name: CLOSE_NAME,
110
- render: "button"
111
- }),
112
- ToastClose = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
113
- var {
114
- scope,
115
- ...closeProps
116
- } = props,
117
- interactiveContext = (0, import_ToastImpl.useToastInteractiveContext)(scope);
118
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
119
- asChild: !0,
120
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastCloseFrame, {
121
- "aria-label": "Close",
122
- ...closeProps,
123
- ref: forwardedRef,
124
- onPress: (0, import_helpers.composeEventHandlers)(props.onPress, interactiveContext.onClose)
125
- })
126
- });
127
- }),
128
- ToastComponent = import_ToastImpl.ToastImplFrame.styleable(function (props, forwardedRef) {
129
- var {
130
- forceMount,
131
- open: openProp,
132
- defaultOpen,
133
- onOpenChange,
134
- ...toastProps
135
- } = props,
136
- [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
137
- prop: openProp,
138
- defaultProp: defaultOpen ?? !0,
139
- onChange: onOpenChange,
140
- strategy: "most-recent-wins"
141
- }),
142
- currentToast = (0, import_ToastImperative.useToastState)(),
143
- {
144
- hide
145
- } = (0, import_ToastImperative.useToastController)(),
146
- id = React.useId(),
147
- onPause = (0, import_core.useEvent)(props.onPause),
148
- onResume = (0, import_core.useEvent)(props.onResume),
149
- isHide = currentToast?.hide === !0,
150
- shouldShow = (forceMount || open) && !isHide;
151
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
152
- children: shouldShow ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastImpl.ToastImpl, {
153
- id,
154
- open,
155
- ...toastProps,
156
- ref: forwardedRef,
157
- onClose: function () {
158
- setOpen(!1), hide();
159
- },
160
- onPause,
161
- onResume,
162
- onSwipeEnd: (0, import_helpers.composeEventHandlers)(props.onSwipeEnd, function (event) {
163
- setOpen(!1);
164
- })
165
- }) : null
166
- }, id);
167
- }),
168
- Toast2 = (0, import_helpers.withStaticProperties)(ToastComponent, {
169
- Title: ToastTitle,
170
- Description: ToastDescription,
171
- Action: ToastAction,
172
- Close: ToastClose
113
+ var CLOSE_NAME = "ToastClose";
114
+ var ToastCloseFrame = (0, import_core.styled)(import_stacks.YStack, {
115
+ name: CLOSE_NAME,
116
+ render: "button"
117
+ });
118
+ var ToastClose = /* @__PURE__ */React.forwardRef(function ToastClose2(props, forwardedRef) {
119
+ var {
120
+ scope,
121
+ ...closeProps
122
+ } = props;
123
+ var interactiveContext = (0, import_ToastImpl.useToastInteractiveContext)(scope);
124
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounceExclude, {
125
+ asChild: true,
126
+ children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastCloseFrame, {
127
+ "aria-label": "Close",
128
+ ...closeProps,
129
+ ref: forwardedRef,
130
+ onPress: (0, import_helpers.composeEventHandlers)(props.onPress, interactiveContext.onClose)
131
+ })
173
132
  });
133
+ });
134
+ var ToastComponent = import_ToastImpl.ToastImplFrame.styleable(function Toast(props, forwardedRef) {
135
+ var {
136
+ forceMount,
137
+ open: openProp,
138
+ defaultOpen,
139
+ onOpenChange,
140
+ ...toastProps
141
+ } = props;
142
+ var [open, setOpen] = (0, import_use_controllable_state.useControllableState)({
143
+ prop: openProp,
144
+ defaultProp: defaultOpen !== null && defaultOpen !== void 0 ? defaultOpen : true,
145
+ onChange: onOpenChange,
146
+ strategy: "most-recent-wins"
147
+ });
148
+ var currentToast = (0, import_ToastImperative.useToastState)();
149
+ var {
150
+ hide
151
+ } = (0, import_ToastImperative.useToastController)();
152
+ var id = React.useId();
153
+ var onPause = (0, import_core.useEvent)(props.onPause);
154
+ var onResume = (0, import_core.useEvent)(props.onResume);
155
+ var isHide = (currentToast === null || currentToast === void 0 ? void 0 : currentToast.hide) === true;
156
+ var shouldShow = (forceMount || open) && !isHide;
157
+ return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, {
158
+ children: shouldShow ? /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastImpl.ToastImpl, {
159
+ id,
160
+ open,
161
+ ...toastProps,
162
+ ref: forwardedRef,
163
+ onClose: function () {
164
+ setOpen(false);
165
+ hide();
166
+ },
167
+ onPause,
168
+ onResume,
169
+ onSwipeEnd: (0, import_helpers.composeEventHandlers)(props.onSwipeEnd, function (event) {
170
+ setOpen(false);
171
+ })
172
+ }) : null
173
+ }, id);
174
+ });
175
+ var Toast2 = (0, import_helpers.withStaticProperties)(ToastComponent, {
176
+ Title: ToastTitle,
177
+ Description: ToastDescription,
178
+ Action: ToastAction,
179
+ Close: ToastClose
180
+ });
174
181
  //# sourceMappingURL=Toast.native.js.map