@hanzogui/toast 3.0.2 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) 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 +81 -75
  5. package/dist/cjs/ToastAnnounce.native.js +86 -80
  6. package/dist/cjs/ToastAnnounce.native.js.map +1 -1
  7. package/dist/cjs/ToastComposable.cjs +933 -0
  8. package/dist/cjs/ToastComposable.native.js +1025 -0
  9. package/dist/cjs/ToastComposable.native.js.map +1 -0
  10. package/dist/cjs/ToastImperative.cjs +99 -80
  11. package/dist/cjs/ToastImperative.native.js +104 -96
  12. package/dist/cjs/ToastImperative.native.js.map +1 -1
  13. package/dist/cjs/ToastImpl.cjs +303 -241
  14. package/dist/cjs/ToastImpl.native.js +311 -273
  15. package/dist/cjs/ToastImpl.native.js.map +1 -1
  16. package/dist/cjs/ToastItemFrame.cjs +143 -0
  17. package/dist/cjs/ToastItemFrame.native.js +148 -0
  18. package/dist/cjs/ToastItemFrame.native.js.map +1 -0
  19. package/dist/cjs/ToastPortal.cjs +23 -18
  20. package/dist/cjs/ToastPortal.native.js +27 -22
  21. package/dist/cjs/ToastPortal.native.js.map +1 -1
  22. package/dist/cjs/ToastProvider.cjs +103 -99
  23. package/dist/cjs/ToastProvider.native.js +108 -106
  24. package/dist/cjs/ToastProvider.native.js.map +1 -1
  25. package/dist/cjs/ToastState.cjs +311 -0
  26. package/dist/cjs/ToastState.native.js +324 -0
  27. package/dist/cjs/ToastState.native.js.map +1 -0
  28. package/dist/cjs/ToastViewport.cjs +276 -235
  29. package/dist/cjs/ToastViewport.native.js +302 -274
  30. package/dist/cjs/ToastViewport.native.js.map +1 -1
  31. package/dist/cjs/Toaster.cjs +87 -0
  32. package/dist/cjs/Toaster.native.js +91 -0
  33. package/dist/cjs/Toaster.native.js.map +1 -0
  34. package/dist/cjs/constants.cjs +14 -12
  35. package/dist/cjs/constants.native.js +14 -12
  36. package/dist/cjs/constants.native.js.map +1 -1
  37. package/dist/cjs/createNativeToast.cjs +43 -35
  38. package/dist/cjs/createNativeToast.native.js +42 -30
  39. package/dist/cjs/createNativeToast.native.js.map +1 -1
  40. package/dist/cjs/dispatchNativeToast.cjs +47 -0
  41. package/dist/cjs/dispatchNativeToast.native.js +52 -0
  42. package/dist/cjs/dispatchNativeToast.native.js.map +1 -0
  43. package/dist/cjs/index.cjs +7 -5
  44. package/dist/cjs/index.native.js +7 -5
  45. package/dist/cjs/index.native.js.map +1 -1
  46. package/dist/cjs/types.cjs +7 -5
  47. package/dist/cjs/types.native.js +7 -5
  48. package/dist/cjs/types.native.js.map +1 -1
  49. package/dist/cjs/useAnimatedDragGesture.cjs +214 -0
  50. package/dist/cjs/useAnimatedDragGesture.native.js +224 -0
  51. package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -0
  52. package/dist/cjs/useReducedMotion.cjs +74 -0
  53. package/dist/cjs/useReducedMotion.native.js +83 -0
  54. package/dist/cjs/useReducedMotion.native.js.map +1 -0
  55. package/dist/cjs/useToastAnimations.cjs +294 -0
  56. package/dist/cjs/useToastAnimations.native.js +304 -0
  57. package/dist/cjs/useToastAnimations.native.js.map +1 -0
  58. package/dist/cjs/v2.cjs +36 -0
  59. package/dist/cjs/v2.native.js +39 -0
  60. package/dist/cjs/v2.native.js.map +1 -0
  61. package/dist/esm/Toast.mjs +112 -106
  62. package/dist/esm/Toast.mjs.map +1 -1
  63. package/dist/esm/Toast.native.js +112 -107
  64. package/dist/esm/Toast.native.js.map +1 -1
  65. package/dist/esm/ToastAnnounce.mjs +46 -42
  66. package/dist/esm/ToastAnnounce.mjs.map +1 -1
  67. package/dist/esm/ToastAnnounce.native.js +52 -48
  68. package/dist/esm/ToastAnnounce.native.js.map +1 -1
  69. package/dist/esm/ToastComposable.mjs +895 -0
  70. package/dist/esm/ToastComposable.mjs.map +1 -0
  71. package/dist/esm/ToastComposable.native.js +984 -0
  72. package/dist/esm/ToastComposable.native.js.map +1 -0
  73. package/dist/esm/ToastImperative.mjs +71 -54
  74. package/dist/esm/ToastImperative.mjs.map +1 -1
  75. package/dist/esm/ToastImperative.native.js +76 -70
  76. package/dist/esm/ToastImperative.native.js.map +1 -1
  77. package/dist/esm/ToastImpl.mjs +261 -201
  78. package/dist/esm/ToastImpl.mjs.map +1 -1
  79. package/dist/esm/ToastImpl.native.js +270 -234
  80. package/dist/esm/ToastImpl.native.js.map +1 -1
  81. package/dist/esm/ToastItemFrame.mjs +114 -0
  82. package/dist/esm/ToastItemFrame.mjs.map +1 -0
  83. package/dist/esm/ToastItemFrame.native.js +116 -0
  84. package/dist/esm/ToastItemFrame.native.js.map +1 -0
  85. package/dist/esm/ToastPortal.mjs +8 -5
  86. package/dist/esm/ToastPortal.mjs.map +1 -1
  87. package/dist/esm/ToastPortal.native.js +12 -9
  88. package/dist/esm/ToastPortal.native.js.map +1 -1
  89. package/dist/esm/ToastProvider.mjs +71 -69
  90. package/dist/esm/ToastProvider.mjs.map +1 -1
  91. package/dist/esm/ToastProvider.native.js +77 -77
  92. package/dist/esm/ToastProvider.native.js.map +1 -1
  93. package/dist/esm/ToastState.mjs +285 -0
  94. package/dist/esm/ToastState.mjs.map +1 -0
  95. package/dist/esm/ToastState.native.js +295 -0
  96. package/dist/esm/ToastState.native.js.map +1 -0
  97. package/dist/esm/ToastViewport.mjs +238 -199
  98. package/dist/esm/ToastViewport.mjs.map +1 -1
  99. package/dist/esm/ToastViewport.native.js +265 -239
  100. package/dist/esm/ToastViewport.native.js.map +1 -1
  101. package/dist/esm/Toaster.mjs +51 -0
  102. package/dist/esm/Toaster.mjs.map +1 -0
  103. package/dist/esm/Toaster.native.js +52 -0
  104. package/dist/esm/Toaster.native.js.map +1 -0
  105. package/dist/esm/constants.mjs +2 -2
  106. package/dist/esm/constants.mjs.map +1 -1
  107. package/dist/esm/constants.native.js +2 -2
  108. package/dist/esm/constants.native.js.map +1 -1
  109. package/dist/esm/createNativeToast.mjs +29 -24
  110. package/dist/esm/createNativeToast.mjs.map +1 -1
  111. package/dist/esm/createNativeToast.native.js +27 -18
  112. package/dist/esm/createNativeToast.native.js.map +1 -1
  113. package/dist/esm/dispatchNativeToast.mjs +22 -0
  114. package/dist/esm/dispatchNativeToast.mjs.map +1 -0
  115. package/dist/esm/dispatchNativeToast.native.js +24 -0
  116. package/dist/esm/dispatchNativeToast.native.js.map +1 -0
  117. package/dist/esm/useAnimatedDragGesture.mjs +178 -0
  118. package/dist/esm/useAnimatedDragGesture.mjs.map +1 -0
  119. package/dist/esm/useAnimatedDragGesture.native.js +185 -0
  120. package/dist/esm/useAnimatedDragGesture.native.js.map +1 -0
  121. package/dist/esm/useReducedMotion.mjs +38 -0
  122. package/dist/esm/useReducedMotion.mjs.map +1 -0
  123. package/dist/esm/useReducedMotion.native.js +44 -0
  124. package/dist/esm/useReducedMotion.native.js.map +1 -0
  125. package/dist/esm/useToastAnimations.mjs +258 -0
  126. package/dist/esm/useToastAnimations.mjs.map +1 -0
  127. package/dist/esm/useToastAnimations.native.js +265 -0
  128. package/dist/esm/useToastAnimations.native.js.map +1 -0
  129. package/dist/esm/v2.mjs +6 -0
  130. package/dist/esm/v2.mjs.map +1 -0
  131. package/dist/esm/v2.native.js +6 -0
  132. package/dist/esm/v2.native.js.map +1 -0
  133. package/dist/jsx/Toast.mjs +112 -106
  134. package/dist/jsx/Toast.mjs.map +1 -1
  135. package/dist/jsx/Toast.native.js +149 -142
  136. package/dist/jsx/Toast.native.js.map +1 -1
  137. package/dist/jsx/ToastAnnounce.mjs +46 -42
  138. package/dist/jsx/ToastAnnounce.mjs.map +1 -1
  139. package/dist/jsx/ToastAnnounce.native.js +86 -80
  140. package/dist/jsx/ToastAnnounce.native.js.map +1 -1
  141. package/dist/jsx/ToastComposable.mjs +895 -0
  142. package/dist/jsx/ToastComposable.mjs.map +1 -0
  143. package/dist/jsx/ToastComposable.native.js +1025 -0
  144. package/dist/jsx/ToastComposable.native.js.map +1 -0
  145. package/dist/jsx/ToastImperative.mjs +71 -54
  146. package/dist/jsx/ToastImperative.mjs.map +1 -1
  147. package/dist/jsx/ToastImperative.native.js +104 -96
  148. package/dist/jsx/ToastImperative.native.js.map +1 -1
  149. package/dist/jsx/ToastImpl.mjs +261 -201
  150. package/dist/jsx/ToastImpl.mjs.map +1 -1
  151. package/dist/jsx/ToastImpl.native.js +311 -273
  152. package/dist/jsx/ToastImpl.native.js.map +1 -1
  153. package/dist/jsx/ToastItemFrame.mjs +114 -0
  154. package/dist/jsx/ToastItemFrame.mjs.map +1 -0
  155. package/dist/jsx/ToastItemFrame.native.js +148 -0
  156. package/dist/jsx/ToastItemFrame.native.js.map +1 -0
  157. package/dist/jsx/ToastPortal.mjs +8 -5
  158. package/dist/jsx/ToastPortal.mjs.map +1 -1
  159. package/dist/jsx/ToastPortal.native.js +27 -22
  160. package/dist/jsx/ToastPortal.native.js.map +1 -1
  161. package/dist/jsx/ToastProvider.mjs +71 -69
  162. package/dist/jsx/ToastProvider.mjs.map +1 -1
  163. package/dist/jsx/ToastProvider.native.js +108 -106
  164. package/dist/jsx/ToastProvider.native.js.map +1 -1
  165. package/dist/jsx/ToastState.mjs +285 -0
  166. package/dist/jsx/ToastState.mjs.map +1 -0
  167. package/dist/jsx/ToastState.native.js +324 -0
  168. package/dist/jsx/ToastState.native.js.map +1 -0
  169. package/dist/jsx/ToastViewport.mjs +238 -199
  170. package/dist/jsx/ToastViewport.mjs.map +1 -1
  171. package/dist/jsx/ToastViewport.native.js +302 -274
  172. package/dist/jsx/ToastViewport.native.js.map +1 -1
  173. package/dist/jsx/Toaster.mjs +51 -0
  174. package/dist/jsx/Toaster.mjs.map +1 -0
  175. package/dist/jsx/Toaster.native.js +91 -0
  176. package/dist/jsx/Toaster.native.js.map +1 -0
  177. package/dist/jsx/constants.mjs +2 -2
  178. package/dist/jsx/constants.mjs.map +1 -1
  179. package/dist/jsx/constants.native.js +14 -12
  180. package/dist/jsx/constants.native.js.map +1 -1
  181. package/dist/jsx/createNativeToast.mjs +29 -24
  182. package/dist/jsx/createNativeToast.mjs.map +1 -1
  183. package/dist/jsx/createNativeToast.native.js +42 -30
  184. package/dist/jsx/createNativeToast.native.js.map +1 -1
  185. package/dist/jsx/dispatchNativeToast.mjs +22 -0
  186. package/dist/jsx/dispatchNativeToast.mjs.map +1 -0
  187. package/dist/jsx/dispatchNativeToast.native.js +52 -0
  188. package/dist/jsx/dispatchNativeToast.native.js.map +1 -0
  189. package/dist/jsx/index.native.js +7 -5
  190. package/dist/jsx/types.native.js +7 -5
  191. package/dist/jsx/useAnimatedDragGesture.mjs +178 -0
  192. package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -0
  193. package/dist/jsx/useAnimatedDragGesture.native.js +224 -0
  194. package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -0
  195. package/dist/jsx/useReducedMotion.mjs +38 -0
  196. package/dist/jsx/useReducedMotion.mjs.map +1 -0
  197. package/dist/jsx/useReducedMotion.native.js +83 -0
  198. package/dist/jsx/useReducedMotion.native.js.map +1 -0
  199. package/dist/jsx/useToastAnimations.mjs +258 -0
  200. package/dist/jsx/useToastAnimations.mjs.map +1 -0
  201. package/dist/jsx/useToastAnimations.native.js +304 -0
  202. package/dist/jsx/useToastAnimations.native.js.map +1 -0
  203. package/dist/jsx/v2.mjs +6 -0
  204. package/dist/jsx/v2.mjs.map +1 -0
  205. package/dist/jsx/v2.native.js +39 -0
  206. package/dist/jsx/v2.native.js.map +1 -0
  207. package/package.json +43 -24
  208. package/src/Toast.tsx +2 -2
  209. package/src/ToastComposable.tsx +1380 -0
  210. package/src/ToastImpl.tsx +15 -3
  211. package/src/ToastItemFrame.tsx +136 -0
  212. package/src/ToastPortal.tsx +2 -2
  213. package/src/ToastProvider.tsx +8 -1
  214. package/src/ToastState.ts +398 -0
  215. package/src/ToastViewport.tsx +6 -5
  216. package/src/Toaster.tsx +181 -0
  217. package/src/createNativeToast.native.tsx +4 -0
  218. package/src/createNativeToast.tsx +18 -24
  219. package/src/dispatchNativeToast.ts +43 -0
  220. package/src/useAnimatedDragGesture.native.ts +255 -0
  221. package/src/useAnimatedDragGesture.ts +319 -0
  222. package/src/useReducedMotion.ts +59 -0
  223. package/src/useToastAnimations.ts +377 -0
  224. package/src/v2.ts +31 -0
  225. package/types/Toast.d.ts +34 -34
  226. package/types/Toast.d.ts.map +1 -0
  227. package/types/ToastAnnounce.d.ts +4 -4
  228. package/types/ToastAnnounce.d.ts.map +1 -0
  229. package/types/ToastComposable.d.ts +199 -0
  230. package/types/ToastComposable.d.ts.map +1 -0
  231. package/types/ToastImperative.d.ts +3 -3
  232. package/types/ToastImperative.d.ts.map +1 -0
  233. package/types/ToastImpl.d.ts +11 -11
  234. package/types/ToastImpl.d.ts.map +1 -0
  235. package/types/ToastItemFrame.d.ts +25 -0
  236. package/types/ToastItemFrame.d.ts.map +1 -0
  237. package/types/ToastPortal.d.ts +1 -1
  238. package/types/ToastPortal.d.ts.map +1 -0
  239. package/types/ToastProvider.d.ts +4 -4
  240. package/types/ToastProvider.d.ts.map +1 -0
  241. package/types/ToastState.d.ts +179 -0
  242. package/types/ToastState.d.ts.map +1 -0
  243. package/types/ToastViewport.d.ts +10 -10
  244. package/types/ToastViewport.d.ts.map +1 -0
  245. package/types/Toaster.d.ts +112 -0
  246. package/types/Toaster.d.ts.map +1 -0
  247. package/types/constants.d.ts.map +1 -0
  248. package/types/createNativeToast.d.ts +5 -0
  249. package/types/createNativeToast.d.ts.map +1 -0
  250. package/types/createNativeToast.native.d.ts +1 -0
  251. package/types/createNativeToast.native.d.ts.map +1 -0
  252. package/types/dispatchNativeToast.d.ts +12 -0
  253. package/types/dispatchNativeToast.d.ts.map +1 -0
  254. package/types/index.d.ts.map +1 -0
  255. package/types/types.d.ts.map +1 -0
  256. package/types/useAnimatedDragGesture.d.ts +33 -0
  257. package/types/useAnimatedDragGesture.d.ts.map +1 -0
  258. package/types/useAnimatedDragGesture.native.d.ts +33 -0
  259. package/types/useAnimatedDragGesture.native.d.ts.map +1 -0
  260. package/types/useReducedMotion.d.ts +6 -0
  261. package/types/useReducedMotion.d.ts.map +1 -0
  262. package/types/useToastAnimations.d.ts +50 -0
  263. package/types/useToastAnimations.d.ts.map +1 -0
  264. package/types/v2.d.ts +10 -0
  265. package/types/v2.d.ts.map +1 -0
  266. package/v2/index.cjs +2 -0
  267. package/v2/index.js +2 -0
  268. package/v2/index.native.cjs +2 -0
  269. package/v2/index.native.js +2 -0
  270. package/LICENSE +0 -21
@@ -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_gui_animate_presence = require("@hanzogui/animate-presence"),
43
- import_gui_core = require("@hanzogui/core"),
44
- import_gui_helpers = require("@hanzogui/helpers"),
45
- import_gui_stacks = require("@hanzogui/stacks"),
46
- import_gui_text = require("@hanzogui/text"),
47
- import_gui_use_controllable_state = require("@hanzogui/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_gui_core.styled)(import_gui_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("@hanzogui/animate-presence");
45
+ var import_core = require("@hanzogui/core");
46
+ var import_helpers = require("@hanzogui/helpers");
47
+ var import_stacks = require("@hanzogui/stacks");
48
+ var import_text = require("@hanzogui/text");
49
+ var import_use_controllable_state = require("@hanzogui/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.HANZO_GUI_HEADLESS === "1"
68
66
  }
69
- }),
70
- DESCRIPTION_NAME = "ToastDescription",
71
- ToastDescription = (0, import_gui_core.styled)(import_gui_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.GUI_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.HANZO_GUI_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.GUI_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_gui_core.styled)(import_gui_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_gui_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_gui_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_gui_core.useEvent)(props.onPause),
146
- onResume = (0, import_gui_core.useEvent)(props.onResume),
147
- isHide = currentToast?.hide === !0;
148
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_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_gui_helpers.composeEventHandlers)(props.onSwipeEnd, event => {
160
- setOpen(!1);
161
- })
162
- }) : null
163
- }, id);
164
- }),
165
- Toast2 = (0, import_gui_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_gui_animate_presence = require("@hanzogui/animate-presence"),
46
- import_gui_core = require("@hanzogui/core"),
47
- import_gui_helpers = require("@hanzogui/helpers"),
48
- import_gui_stacks = require("@hanzogui/stacks"),
49
- import_gui_text = require("@hanzogui/text"),
50
- import_gui_use_controllable_state = require("@hanzogui/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_gui_core.styled)(import_gui_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("@hanzogui/animate-presence");
48
+ var import_core = require("@hanzogui/core");
49
+ var import_helpers = require("@hanzogui/helpers");
50
+ var import_stacks = require("@hanzogui/stacks");
51
+ var import_text = require("@hanzogui/text");
52
+ var import_use_controllable_state = require("@hanzogui/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.HANZO_GUI_HEADLESS === "1"
70
68
  }
71
- }),
72
- DESCRIPTION_NAME = "ToastDescription",
73
- ToastDescription = (0, import_gui_core.styled)(import_gui_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.GUI_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.HANZO_GUI_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.GUI_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_gui_core.styled)(import_gui_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_gui_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_gui_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_gui_core.useEvent)(props.onPause),
148
- onResume = (0, import_gui_core.useEvent)(props.onResume),
149
- isHide = currentToast?.hide === !0,
150
- shouldShow = (forceMount || open) && !isHide;
151
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_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_gui_helpers.composeEventHandlers)(props.onSwipeEnd, function (event) {
163
- setOpen(!1);
164
- })
165
- }) : null
166
- }, id);
167
- }),
168
- Toast2 = (0, import_gui_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