@hanzogui/toast 3.0.1 → 7.0.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 (167) hide show
  1. package/package.json +42 -25
  2. package/src/Toast.tsx +5 -5
  3. package/src/ToastAnnounce.tsx +2 -2
  4. package/src/ToastComposable.tsx +1380 -0
  5. package/src/ToastImpl.tsx +19 -7
  6. package/src/ToastItemFrame.tsx +136 -0
  7. package/src/ToastPortal.tsx +2 -2
  8. package/src/ToastProvider.tsx +13 -6
  9. package/src/ToastState.ts +398 -0
  10. package/src/ToastViewport.tsx +11 -10
  11. package/src/Toaster.tsx +181 -0
  12. package/src/createNativeToast.native.tsx +4 -0
  13. package/src/createNativeToast.tsx +18 -24
  14. package/src/dispatchNativeToast.ts +43 -0
  15. package/src/useAnimatedDragGesture.native.ts +255 -0
  16. package/src/useAnimatedDragGesture.ts +319 -0
  17. package/src/useReducedMotion.ts +59 -0
  18. package/src/useToastAnimations.ts +377 -0
  19. package/src/v2.ts +31 -0
  20. package/types/Toast.d.ts +36 -36
  21. package/types/ToastAnnounce.d.ts +4 -4
  22. package/types/ToastComposable.d.ts +199 -0
  23. package/types/ToastImperative.d.ts +2 -2
  24. package/types/ToastImpl.d.ts +12 -12
  25. package/types/ToastItemFrame.d.ts +25 -0
  26. package/types/ToastProvider.d.ts +8 -8
  27. package/types/ToastState.d.ts +179 -0
  28. package/types/ToastViewport.d.ts +12 -12
  29. package/types/Toaster.d.ts +112 -0
  30. package/types/createNativeToast.d.ts +5 -0
  31. package/types/createNativeToast.native.d.ts +1 -0
  32. package/types/dispatchNativeToast.d.ts +12 -0
  33. package/types/useAnimatedDragGesture.d.ts +33 -0
  34. package/types/useAnimatedDragGesture.native.d.ts +33 -0
  35. package/types/useReducedMotion.d.ts +6 -0
  36. package/types/useToastAnimations.d.ts +50 -0
  37. package/types/v2.d.ts +10 -0
  38. package/v2/index.cjs +2 -0
  39. package/v2/index.js +2 -0
  40. package/v2/index.native.cjs +2 -0
  41. package/v2/index.native.js +2 -0
  42. package/LICENSE +0 -21
  43. package/dist/cjs/Toast.cjs +0 -170
  44. package/dist/cjs/Toast.native.js +0 -174
  45. package/dist/cjs/Toast.native.js.map +0 -1
  46. package/dist/cjs/ToastAnnounce.cjs +0 -97
  47. package/dist/cjs/ToastAnnounce.native.js +0 -105
  48. package/dist/cjs/ToastAnnounce.native.js.map +0 -1
  49. package/dist/cjs/ToastImperative.cjs +0 -100
  50. package/dist/cjs/ToastImperative.native.js +0 -122
  51. package/dist/cjs/ToastImperative.native.js.map +0 -1
  52. package/dist/cjs/ToastImpl.cjs +0 -292
  53. package/dist/cjs/ToastImpl.native.js +0 -326
  54. package/dist/cjs/ToastImpl.native.js.map +0 -1
  55. package/dist/cjs/ToastPortal.cjs +0 -44
  56. package/dist/cjs/ToastPortal.native.js +0 -47
  57. package/dist/cjs/ToastPortal.native.js.map +0 -1
  58. package/dist/cjs/ToastProvider.cjs +0 -146
  59. package/dist/cjs/ToastProvider.native.js +0 -159
  60. package/dist/cjs/ToastProvider.native.js.map +0 -1
  61. package/dist/cjs/ToastViewport.cjs +0 -278
  62. package/dist/cjs/ToastViewport.native.js +0 -315
  63. package/dist/cjs/ToastViewport.native.js.map +0 -1
  64. package/dist/cjs/constants.cjs +0 -28
  65. package/dist/cjs/constants.native.js +0 -31
  66. package/dist/cjs/constants.native.js.map +0 -1
  67. package/dist/cjs/createNativeToast.cjs +0 -51
  68. package/dist/cjs/createNativeToast.native.js +0 -48
  69. package/dist/cjs/createNativeToast.native.js.map +0 -1
  70. package/dist/cjs/index.cjs +0 -18
  71. package/dist/cjs/index.native.js +0 -21
  72. package/dist/cjs/index.native.js.map +0 -1
  73. package/dist/cjs/types.cjs +0 -16
  74. package/dist/cjs/types.native.js +0 -19
  75. package/dist/cjs/types.native.js.map +0 -1
  76. package/dist/esm/Toast.mjs +0 -131
  77. package/dist/esm/Toast.mjs.map +0 -1
  78. package/dist/esm/Toast.native.js +0 -132
  79. package/dist/esm/Toast.native.js.map +0 -1
  80. package/dist/esm/ToastAnnounce.mjs +0 -62
  81. package/dist/esm/ToastAnnounce.mjs.map +0 -1
  82. package/dist/esm/ToastAnnounce.native.js +0 -67
  83. package/dist/esm/ToastAnnounce.native.js.map +0 -1
  84. package/dist/esm/ToastImperative.mjs +0 -63
  85. package/dist/esm/ToastImperative.mjs.map +0 -1
  86. package/dist/esm/ToastImperative.native.js +0 -82
  87. package/dist/esm/ToastImperative.native.js.map +0 -1
  88. package/dist/esm/ToastImpl.mjs +0 -256
  89. package/dist/esm/ToastImpl.mjs.map +0 -1
  90. package/dist/esm/ToastImpl.native.js +0 -287
  91. package/dist/esm/ToastImpl.native.js.map +0 -1
  92. package/dist/esm/ToastPortal.mjs +0 -21
  93. package/dist/esm/ToastPortal.mjs.map +0 -1
  94. package/dist/esm/ToastPortal.native.js +0 -21
  95. package/dist/esm/ToastPortal.native.js.map +0 -1
  96. package/dist/esm/ToastProvider.mjs +0 -108
  97. package/dist/esm/ToastProvider.mjs.map +0 -1
  98. package/dist/esm/ToastProvider.native.js +0 -118
  99. package/dist/esm/ToastProvider.native.js.map +0 -1
  100. package/dist/esm/ToastViewport.mjs +0 -241
  101. package/dist/esm/ToastViewport.mjs.map +0 -1
  102. package/dist/esm/ToastViewport.native.js +0 -275
  103. package/dist/esm/ToastViewport.native.js.map +0 -1
  104. package/dist/esm/constants.mjs +0 -4
  105. package/dist/esm/constants.mjs.map +0 -1
  106. package/dist/esm/constants.native.js +0 -4
  107. package/dist/esm/constants.native.js.map +0 -1
  108. package/dist/esm/createNativeToast.mjs +0 -27
  109. package/dist/esm/createNativeToast.mjs.map +0 -1
  110. package/dist/esm/createNativeToast.native.js +0 -21
  111. package/dist/esm/createNativeToast.native.js.map +0 -1
  112. package/dist/esm/index.js +0 -2
  113. package/dist/esm/index.js.map +0 -1
  114. package/dist/esm/index.mjs +0 -2
  115. package/dist/esm/index.mjs.map +0 -1
  116. package/dist/esm/index.native.js +0 -2
  117. package/dist/esm/index.native.js.map +0 -1
  118. package/dist/esm/types.mjs +0 -2
  119. package/dist/esm/types.mjs.map +0 -1
  120. package/dist/esm/types.native.js +0 -2
  121. package/dist/esm/types.native.js.map +0 -1
  122. package/dist/jsx/Toast.mjs +0 -131
  123. package/dist/jsx/Toast.mjs.map +0 -1
  124. package/dist/jsx/Toast.native.js +0 -174
  125. package/dist/jsx/Toast.native.js.map +0 -1
  126. package/dist/jsx/ToastAnnounce.mjs +0 -62
  127. package/dist/jsx/ToastAnnounce.mjs.map +0 -1
  128. package/dist/jsx/ToastAnnounce.native.js +0 -105
  129. package/dist/jsx/ToastAnnounce.native.js.map +0 -1
  130. package/dist/jsx/ToastImperative.mjs +0 -63
  131. package/dist/jsx/ToastImperative.mjs.map +0 -1
  132. package/dist/jsx/ToastImperative.native.js +0 -122
  133. package/dist/jsx/ToastImperative.native.js.map +0 -1
  134. package/dist/jsx/ToastImpl.mjs +0 -256
  135. package/dist/jsx/ToastImpl.mjs.map +0 -1
  136. package/dist/jsx/ToastImpl.native.js +0 -326
  137. package/dist/jsx/ToastImpl.native.js.map +0 -1
  138. package/dist/jsx/ToastPortal.mjs +0 -21
  139. package/dist/jsx/ToastPortal.mjs.map +0 -1
  140. package/dist/jsx/ToastPortal.native.js +0 -47
  141. package/dist/jsx/ToastPortal.native.js.map +0 -1
  142. package/dist/jsx/ToastProvider.mjs +0 -108
  143. package/dist/jsx/ToastProvider.mjs.map +0 -1
  144. package/dist/jsx/ToastProvider.native.js +0 -159
  145. package/dist/jsx/ToastProvider.native.js.map +0 -1
  146. package/dist/jsx/ToastViewport.mjs +0 -241
  147. package/dist/jsx/ToastViewport.mjs.map +0 -1
  148. package/dist/jsx/ToastViewport.native.js +0 -315
  149. package/dist/jsx/ToastViewport.native.js.map +0 -1
  150. package/dist/jsx/constants.mjs +0 -4
  151. package/dist/jsx/constants.mjs.map +0 -1
  152. package/dist/jsx/constants.native.js +0 -31
  153. package/dist/jsx/constants.native.js.map +0 -1
  154. package/dist/jsx/createNativeToast.mjs +0 -27
  155. package/dist/jsx/createNativeToast.mjs.map +0 -1
  156. package/dist/jsx/createNativeToast.native.js +0 -48
  157. package/dist/jsx/createNativeToast.native.js.map +0 -1
  158. package/dist/jsx/index.js +0 -2
  159. package/dist/jsx/index.js.map +0 -1
  160. package/dist/jsx/index.mjs +0 -2
  161. package/dist/jsx/index.mjs.map +0 -1
  162. package/dist/jsx/index.native.js +0 -21
  163. package/dist/jsx/index.native.js.map +0 -1
  164. package/dist/jsx/types.mjs +0 -2
  165. package/dist/jsx/types.mjs.map +0 -1
  166. package/dist/jsx/types.native.js +0 -19
  167. package/dist/jsx/types.native.js.map +0 -1
@@ -1,292 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
15
- get: () => from[key],
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- return to;
19
- };
20
- 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);
32
- var ToastImpl_exports = {};
33
- __export(ToastImpl_exports, {
34
- ToastImpl: () => ToastImpl,
35
- ToastImplFrame: () => ToastImplFrame,
36
- useToastInteractiveContext: () => useToastInteractiveContext
37
- });
38
- module.exports = __toCommonJS(ToastImpl_exports);
39
- var import_gui_animate_presence = require("@hanzogui/animate-presence"),
40
- import_gui_compose_refs = require("@hanzogui/compose-refs"),
41
- import_gui_constants = require("@hanzogui/constants"),
42
- import_gui_core = require("@hanzogui/core"),
43
- import_gui_dismissable = require("@hanzogui/dismissable"),
44
- import_gui_helpers = require("@hanzogui/helpers"),
45
- import_gui_portal = require("@hanzogui/portal"),
46
- import_gui_stacks = require("@hanzogui/stacks"),
47
- React = __toESM(require("react"), 1),
48
- import_react_native = require("react-native-web"),
49
- import_constants = require("./constants.cjs"),
50
- import_ToastAnnounce = require("./ToastAnnounce.cjs"),
51
- import_ToastProvider = require("./ToastProvider.cjs"),
52
- import_ToastViewport = require("./ToastViewport.cjs"),
53
- import_jsx_runtime = require("react/jsx-runtime");
54
- const ToastImplFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
55
- name: "ToastImpl",
56
- tabIndex: 0,
57
- variants: {
58
- unstyled: {
59
- false: {
60
- focusStyle: {
61
- outlineStyle: "solid",
62
- outlineWidth: 2,
63
- outlineColor: "$outlineColor"
64
- },
65
- backgroundColor: "$color6",
66
- borderRadius: "$4",
67
- paddingHorizontal: "$4",
68
- paddingVertical: "$3",
69
- marginHorizontal: "auto",
70
- marginVertical: "$1",
71
- elevation: "$3"
72
- }
73
- }
74
- },
75
- defaultVariants: {
76
- unstyled: process.env.HANZO_GUI_HEADLESS === "1"
77
- }
78
- }),
79
- {
80
- Provider: ToastInteractiveProvider,
81
- useStyledContext: useToastInteractiveContext
82
- } = (0, import_gui_core.createStyledContext)({
83
- onClose() {}
84
- }),
85
- ToastImpl = React.forwardRef((props, forwardedRef) => {
86
- const {
87
- scope,
88
- type = "foreground",
89
- duration: durationProp,
90
- open,
91
- onClose,
92
- onEscapeKeyDown,
93
- onPause,
94
- onResume,
95
- onSwipeStart,
96
- onSwipeMove,
97
- onSwipeCancel,
98
- onSwipeEnd,
99
- viewportName = "default",
100
- ...toastProps
101
- } = props,
102
- isPresent = (0, import_gui_animate_presence.useIsPresent)(),
103
- context = (0, import_ToastProvider.useToastProviderContext)(scope),
104
- [node, setNode] = React.useState(null),
105
- composedRefs = (0, import_gui_compose_refs.useComposedRefs)(forwardedRef, setNode),
106
- duration = durationProp || context.duration,
107
- closeTimerStartTimeRef = React.useRef(0),
108
- closeTimerRemainingTimeRef = React.useRef(duration),
109
- closeTimerRef = React.useRef(0),
110
- {
111
- onToastAdd,
112
- onToastRemove
113
- } = context,
114
- viewport = React.useMemo(() => context.viewports[viewportName], [context.viewports, viewportName]),
115
- handleClose = (0, import_gui_core.useEvent)(() => {
116
- isPresent && (import_gui_constants.isWeb && node?.contains(document.activeElement) && viewport?.focus(), onClose());
117
- }),
118
- startTimer = React.useCallback(duration2 => {
119
- !duration2 || duration2 === Number.POSITIVE_INFINITY || (clearTimeout(closeTimerRef.current), closeTimerStartTimeRef.current = (/* @__PURE__ */new Date()).getTime(), closeTimerRef.current = setTimeout(handleClose, duration2));
120
- }, [handleClose]),
121
- handleResume = React.useCallback(() => {
122
- startTimer(closeTimerRemainingTimeRef.current), onResume?.();
123
- }, [onResume, startTimer]),
124
- handlePause = React.useCallback(() => {
125
- const elapsedTime = (/* @__PURE__ */new Date()).getTime() - closeTimerStartTimeRef.current;
126
- closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime, window.clearTimeout(closeTimerRef.current), onPause?.();
127
- }, [onPause]);
128
- React.useEffect(() => {
129
- if (import_gui_constants.isWeb && viewport) return viewport.addEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.addEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume), () => {
130
- viewport.removeEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.removeEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume);
131
- };
132
- }, [viewport, duration, onPause, onResume, startTimer]), React.useEffect(() => {
133
- open && !context.isClosePausedRef.current && startTimer(duration);
134
- }, [open, duration, context.isClosePausedRef, startTimer]), React.useEffect(() => (onToastAdd(), () => onToastRemove()), [onToastAdd, onToastRemove]);
135
- const announceTextContent = React.useMemo(() => import_gui_constants.isWeb && node ? getAnnounceTextContent(node) : null, [node]),
136
- isHorizontalSwipe = ["left", "right", "horizontal"].includes(context.swipeDirection),
137
- {
138
- animationDriver
139
- } = (0, import_gui_core.useConfiguration)();
140
- if (!animationDriver) throw new Error("Must set animations in tamagui.config.ts");
141
- const {
142
- useAnimatedNumber,
143
- useAnimatedNumberStyle
144
- } = animationDriver,
145
- animatedNumber = useAnimatedNumber(0),
146
- AnimatedView = animationDriver.NumberView ?? animationDriver.View ?? import_gui_core.View,
147
- animatedStyles = useAnimatedNumberStyle(animatedNumber, val => {
148
- "worklet";
149
-
150
- return {
151
- transform: [isHorizontalSwipe ? {
152
- translateX: val
153
- } : {
154
- translateY: val
155
- }]
156
- };
157
- }),
158
- panResponder = React.useMemo(() => import_react_native.PanResponder.create({
159
- onMoveShouldSetPanResponder: (e, gesture) => shouldGrantGestureMove(context.swipeDirection, gesture) ? (onSwipeStart?.(e), !0) : !1,
160
- onPanResponderGrant: e => {
161
- import_gui_constants.isWeb || handlePause?.();
162
- },
163
- onPanResponderMove: (e, gesture) => {
164
- const {
165
- x,
166
- y
167
- } = getGestureDistance(context.swipeDirection, gesture),
168
- delta = {
169
- x,
170
- y
171
- };
172
- animatedNumber.setValue(isHorizontalSwipe ? x : y, {
173
- type: "direct"
174
- }), isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold) && onSwipeEnd?.(e), onSwipeMove?.(e);
175
- },
176
- onPanResponderEnd: (e, {
177
- dx,
178
- dy
179
- }) => {
180
- isDeltaInDirection({
181
- x: dx,
182
- y: dy
183
- }, context.swipeDirection, context.swipeThreshold) || (import_gui_constants.isWeb || handleResume?.(), onSwipeCancel?.(e), animatedNumber.setValue(0, {
184
- type: "spring"
185
- }));
186
- }
187
- }), [handlePause, handleResume]),
188
- themeName = (0, import_gui_core.useThemeName)();
189
- return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
190
- children: [announceTextContent && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounce, {
191
- scope,
192
- role: "status",
193
- "aria-live": type === "foreground" ? "assertive" : "polite",
194
- "aria-atomic": !0,
195
- children: announceTextContent
196
- }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_portal.PortalItem, {
197
- hostName: viewportName ?? "default",
198
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastInteractiveProvider, {
199
- scope,
200
- onClose: () => {
201
- handleClose();
202
- },
203
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_dismissable.Dismissable, {
204
- onEscapeKeyDown: (0, import_gui_helpers.composeEventHandlers)(onEscapeKeyDown, () => {
205
- context.isFocusedToastEscapeKeyDownRef.current || handleClose(), context.isFocusedToastEscapeKeyDownRef.current = !1;
206
- }),
207
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_core.Theme, {
208
- contain: !0,
209
- forceClassName: !0,
210
- name: themeName,
211
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AnimatedView, {
212
- ...panResponder?.panHandlers,
213
- style: [{
214
- margin: "auto"
215
- }, animatedStyles],
216
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastProvider.Collection.ItemSlot, {
217
- scope: context.toastScope,
218
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastImplFrame, {
219
- role: "status",
220
- "aria-live": "off",
221
- "aria-atomic": !0,
222
- "data-state": open ? "open" : "closed",
223
- "data-swipe-direction": context.swipeDirection,
224
- pointerEvents: "auto",
225
- "$platform-web": {
226
- touchAction: "none",
227
- userSelect: "none"
228
- },
229
- ...toastProps,
230
- ref: composedRefs,
231
- ...(import_gui_constants.isWeb && {
232
- onKeyDown: (0, import_gui_helpers.composeEventHandlers)(props.onKeyDown, event => {
233
- event.key === "Escape" && (onEscapeKeyDown?.(event), event.defaultPrevented || (context.isFocusedToastEscapeKeyDownRef.current = !0, handleClose()));
234
- })
235
- })
236
- })
237
- })
238
- })
239
- })
240
- })
241
- }, props.id)
242
- })]
243
- });
244
- });
245
- ToastImpl.propTypes = {
246
- type(props) {
247
- if (props.type && !["foreground", "background"].includes(props.type)) {
248
- const error = `Invalid prop \`type\` supplied to \`${import_constants.TOAST_NAME}\`. Expected \`foreground | background\`.`;
249
- return new Error(error);
250
- }
251
- return null;
252
- }
253
- };
254
- const isDeltaInDirection = (delta, direction, threshold = 0) => {
255
- const deltaX = Math.abs(delta.x),
256
- deltaY = Math.abs(delta.y),
257
- isDeltaX = deltaX > deltaY;
258
- return direction === "left" || direction === "right" || direction === "horizontal" ? isDeltaX && deltaX > threshold : !isDeltaX && deltaY > threshold;
259
- };
260
- function getAnnounceTextContent(container) {
261
- if (!import_gui_constants.isWeb) return "";
262
- const textContent = [];
263
- return Array.from(container.childNodes).forEach(node => {
264
- if (node.nodeType === node.TEXT_NODE && node.textContent && textContent.push(node.textContent), isHTMLElement(node)) {
265
- const isHidden = node.ariaHidden || node.hidden || node.style.display === "none",
266
- isExcluded = node.dataset.toastAnnounceExclude === "";
267
- if (!isHidden) if (isExcluded) {
268
- const altText = node.dataset.toastAnnounceAlt;
269
- altText && textContent.push(altText);
270
- } else textContent.push(...getAnnounceTextContent(node));
271
- }
272
- }), textContent;
273
- }
274
- function isHTMLElement(node) {
275
- return node.nodeType === node.ELEMENT_NODE;
276
- }
277
- const GESTURE_GRANT_THRESHOLD = 10,
278
- shouldGrantGestureMove = (dir, {
279
- dx,
280
- dy
281
- }) => (dir === "horizontal" || dir === "left") && dx < -GESTURE_GRANT_THRESHOLD || (dir === "horizontal" || dir === "right") && dx > GESTURE_GRANT_THRESHOLD || (dir === "vertical" || dir === "up") && dy > -GESTURE_GRANT_THRESHOLD || (dir === "vertical" || dir === "down") && dy < GESTURE_GRANT_THRESHOLD,
282
- getGestureDistance = (dir, {
283
- dx,
284
- dy
285
- }) => {
286
- let y = 0,
287
- x = 0;
288
- return dir === "horizontal" ? x = dx : dir === "left" ? x = Math.min(0, dx) : dir === "right" ? x = Math.max(0, dx) : dir === "vertical" ? y = dy : dir === "up" ? y = Math.min(0, dy) : dir === "down" && (y = Math.max(0, dy)), {
289
- x,
290
- y
291
- };
292
- };
@@ -1,326 +0,0 @@
1
- "use strict";
2
-
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf,
8
- __hasOwnProp = Object.prototype.hasOwnProperty;
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, {
17
- get: () => from[key],
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- return to;
21
- };
22
- 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);
34
- var ToastImpl_exports = {};
35
- __export(ToastImpl_exports, {
36
- ToastImpl: () => ToastImpl,
37
- ToastImplFrame: () => ToastImplFrame,
38
- useToastInteractiveContext: () => useToastInteractiveContext
39
- });
40
- module.exports = __toCommonJS(ToastImpl_exports);
41
- var import_jsx_runtime = require("react/jsx-runtime"),
42
- import_gui_animate_presence = require("@hanzogui/animate-presence"),
43
- import_gui_compose_refs = require("@hanzogui/compose-refs"),
44
- import_gui_constants = require("@hanzogui/constants"),
45
- import_gui_core = require("@hanzogui/core"),
46
- import_gui_dismissable = require("@hanzogui/dismissable"),
47
- import_gui_helpers = require("@hanzogui/helpers"),
48
- import_gui_portal = require("@hanzogui/portal"),
49
- import_gui_stacks = require("@hanzogui/stacks"),
50
- React = __toESM(require("react"), 1),
51
- import_react_native = require("react-native"),
52
- import_constants = require("./constants.native.js"),
53
- import_ToastAnnounce = require("./ToastAnnounce.native.js"),
54
- import_ToastProvider = require("./ToastProvider.native.js"),
55
- import_ToastViewport = require("./ToastViewport.native.js"),
56
- ToastImplFrame = (0, import_gui_core.styled)(import_gui_stacks.YStack, {
57
- name: "ToastImpl",
58
- tabIndex: 0,
59
- variants: {
60
- unstyled: {
61
- false: {
62
- focusStyle: {
63
- outlineStyle: "solid",
64
- outlineWidth: 2,
65
- outlineColor: "$outlineColor"
66
- },
67
- backgroundColor: "$color6",
68
- borderRadius: "$4",
69
- paddingHorizontal: "$4",
70
- paddingVertical: "$3",
71
- marginHorizontal: "auto",
72
- marginVertical: "$1",
73
- elevation: "$3"
74
- }
75
- }
76
- },
77
- defaultVariants: {
78
- unstyled: process.env.HANZO_GUI_HEADLESS === "1"
79
- }
80
- }),
81
- {
82
- Provider: ToastInteractiveProvider,
83
- useStyledContext: useToastInteractiveContext
84
- } = (0, import_gui_core.createStyledContext)({
85
- onClose() {}
86
- }),
87
- ToastImpl = /* @__PURE__ */React.forwardRef(function (props, forwardedRef) {
88
- var {
89
- scope,
90
- type = "foreground",
91
- duration: durationProp,
92
- open,
93
- onClose,
94
- onEscapeKeyDown,
95
- onPause,
96
- onResume,
97
- onSwipeStart,
98
- onSwipeMove,
99
- onSwipeCancel,
100
- onSwipeEnd,
101
- viewportName = "default",
102
- ...toastProps
103
- } = props,
104
- isPresent = (0, import_gui_animate_presence.useIsPresent)(),
105
- context = (0, import_ToastProvider.useToastProviderContext)(scope),
106
- [node, setNode] = React.useState(null),
107
- composedRefs = (0, import_gui_compose_refs.useComposedRefs)(forwardedRef, setNode),
108
- duration = durationProp || context.duration,
109
- closeTimerStartTimeRef = React.useRef(0),
110
- closeTimerRemainingTimeRef = React.useRef(duration),
111
- closeTimerRef = React.useRef(0),
112
- {
113
- onToastAdd,
114
- onToastRemove
115
- } = context,
116
- viewport = React.useMemo(function () {
117
- return context.viewports[viewportName];
118
- }, [context.viewports, viewportName]),
119
- handleClose = (0, import_gui_core.useEvent)(function () {
120
- if (isPresent) {
121
- if (import_gui_constants.isWeb) {
122
- var isFocusInToast = node?.contains(document.activeElement);
123
- isFocusInToast && viewport?.focus();
124
- }
125
- onClose();
126
- }
127
- }),
128
- startTimer = React.useCallback(function (duration2) {
129
- !duration2 || duration2 === Number.POSITIVE_INFINITY || (clearTimeout(closeTimerRef.current), closeTimerStartTimeRef.current = (/* @__PURE__ */new Date()).getTime(), closeTimerRef.current = setTimeout(handleClose, duration2));
130
- }, [handleClose]),
131
- handleResume = React.useCallback(function () {
132
- startTimer(closeTimerRemainingTimeRef.current), onResume?.();
133
- }, [onResume, startTimer]),
134
- handlePause = React.useCallback(function () {
135
- var elapsedTime = (/* @__PURE__ */new Date()).getTime() - closeTimerStartTimeRef.current;
136
- closeTimerRemainingTimeRef.current = closeTimerRemainingTimeRef.current - elapsedTime, window.clearTimeout(closeTimerRef.current), onPause?.();
137
- }, [onPause]);
138
- React.useEffect(function () {
139
- if (import_gui_constants.isWeb && viewport) return viewport.addEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.addEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume), function () {
140
- viewport.removeEventListener(import_ToastViewport.VIEWPORT_PAUSE, handlePause), viewport.removeEventListener(import_ToastViewport.VIEWPORT_RESUME, handleResume);
141
- };
142
- }, [viewport, duration, onPause, onResume, startTimer]), React.useEffect(function () {
143
- open && !context.isClosePausedRef.current && startTimer(duration);
144
- }, [open, duration, context.isClosePausedRef, startTimer]), React.useEffect(function () {
145
- return onToastAdd(), function () {
146
- return onToastRemove();
147
- };
148
- }, [onToastAdd, onToastRemove]);
149
- var announceTextContent = React.useMemo(function () {
150
- return import_gui_constants.isWeb && node ? getAnnounceTextContent(node) : null;
151
- }, [node]),
152
- isHorizontalSwipe = ["left", "right", "horizontal"].includes(context.swipeDirection),
153
- {
154
- animationDriver
155
- } = (0, import_gui_core.useConfiguration)();
156
- if (!animationDriver) throw new Error("Must set animations in tamagui.config.ts");
157
- var {
158
- useAnimatedNumber,
159
- useAnimatedNumberStyle
160
- } = animationDriver,
161
- animatedNumber = useAnimatedNumber(0),
162
- _animationDriver_NumberView,
163
- _ref,
164
- AnimatedView = (_ref = (_animationDriver_NumberView = animationDriver.NumberView) !== null && _animationDriver_NumberView !== void 0 ? _animationDriver_NumberView : animationDriver.View) !== null && _ref !== void 0 ? _ref : import_gui_core.View,
165
- animatedStyles = useAnimatedNumberStyle(animatedNumber, function (val) {
166
- "worklet";
167
-
168
- return {
169
- transform: [isHorizontalSwipe ? {
170
- translateX: val
171
- } : {
172
- translateY: val
173
- }]
174
- };
175
- }),
176
- panResponder = React.useMemo(function () {
177
- return import_react_native.PanResponder.create({
178
- onMoveShouldSetPanResponder: function (e, gesture) {
179
- var shouldMove = shouldGrantGestureMove(context.swipeDirection, gesture);
180
- return shouldMove ? (onSwipeStart?.(e), !0) : !1;
181
- },
182
- onPanResponderGrant: function (e) {
183
- import_gui_constants.isWeb || handlePause?.();
184
- },
185
- onPanResponderMove: function (e, gesture) {
186
- var {
187
- x,
188
- y
189
- } = getGestureDistance(context.swipeDirection, gesture),
190
- delta = {
191
- x,
192
- y
193
- };
194
- animatedNumber.setValue(isHorizontalSwipe ? x : y, {
195
- type: "direct"
196
- }), isDeltaInDirection(delta, context.swipeDirection, context.swipeThreshold) && onSwipeEnd?.(e), onSwipeMove?.(e);
197
- },
198
- onPanResponderEnd: function (e, param) {
199
- var {
200
- dx,
201
- dy
202
- } = param;
203
- isDeltaInDirection({
204
- x: dx,
205
- y: dy
206
- }, context.swipeDirection, context.swipeThreshold) || (import_gui_constants.isWeb || handleResume?.(), onSwipeCancel?.(e), animatedNumber.setValue(0, {
207
- type: "spring"
208
- }));
209
- }
210
- });
211
- }, [handlePause, handleResume]),
212
- themeName = (0, import_gui_core.useThemeName)();
213
- return /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
214
- children: [announceTextContent && /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastAnnounce.ToastAnnounce, {
215
- scope,
216
- // toasts are always role=status to avoid stuttering issues with role=alert in SRs
217
- role: "status",
218
- "aria-live": type === "foreground" ? "assertive" : "polite",
219
- "aria-atomic": !0,
220
- children: announceTextContent
221
- }), /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_portal.PortalItem, {
222
- hostName: viewportName ?? "default",
223
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastInteractiveProvider, {
224
- scope,
225
- onClose: function () {
226
- handleClose();
227
- },
228
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_dismissable.Dismissable, {
229
- // asChild
230
- onEscapeKeyDown: (0, import_gui_helpers.composeEventHandlers)(onEscapeKeyDown, function () {
231
- context.isFocusedToastEscapeKeyDownRef.current || handleClose(), context.isFocusedToastEscapeKeyDownRef.current = !1;
232
- }),
233
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_gui_core.Theme, {
234
- contain: !0,
235
- forceClassName: !0,
236
- name: themeName,
237
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(AnimatedView, {
238
- ...panResponder?.panHandlers,
239
- style: [{
240
- margin: "auto"
241
- }, animatedStyles],
242
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_ToastProvider.Collection.ItemSlot, {
243
- scope: context.toastScope,
244
- children: /* @__PURE__ */(0, import_jsx_runtime.jsx)(ToastImplFrame, {
245
- // Ensure toasts are announced as status list or status when focused
246
- role: "status",
247
- "aria-live": "off",
248
- "aria-atomic": !0,
249
- "data-state": open ? "open" : "closed",
250
- "data-swipe-direction": context.swipeDirection,
251
- pointerEvents: "auto",
252
- "$platform-web": {
253
- touchAction: "none",
254
- userSelect: "none"
255
- },
256
- ...toastProps,
257
- ref: composedRefs,
258
- ...(import_gui_constants.isWeb && {
259
- onKeyDown: (0, import_gui_helpers.composeEventHandlers)(props.onKeyDown, function (event) {
260
- event.key === "Escape" && (onEscapeKeyDown?.(event), event.defaultPrevented || (context.isFocusedToastEscapeKeyDownRef.current = !0, handleClose()));
261
- })
262
- })
263
- })
264
- })
265
- })
266
- })
267
- })
268
- }, props.id)
269
- })]
270
- });
271
- });
272
- ToastImpl.propTypes = {
273
- type(props) {
274
- if (props.type && !["foreground", "background"].includes(props.type)) {
275
- var error = `Invalid prop \`type\` supplied to \`${import_constants.TOAST_NAME}\`. Expected \`foreground | background\`.`;
276
- return new Error(error);
277
- }
278
- return null;
279
- }
280
- };
281
- var isDeltaInDirection = function (delta, direction) {
282
- var threshold = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0,
283
- deltaX = Math.abs(delta.x),
284
- deltaY = Math.abs(delta.y),
285
- isDeltaX = deltaX > deltaY;
286
- return direction === "left" || direction === "right" || direction === "horizontal" ? isDeltaX && deltaX > threshold : !isDeltaX && deltaY > threshold;
287
- };
288
- function getAnnounceTextContent(container) {
289
- if (!import_gui_constants.isWeb) return "";
290
- var textContent = [],
291
- childNodes = Array.from(container.childNodes);
292
- return childNodes.forEach(function (node) {
293
- if (node.nodeType === node.TEXT_NODE && node.textContent && textContent.push(node.textContent), isHTMLElement(node)) {
294
- var isHidden = node.ariaHidden || node.hidden || node.style.display === "none",
295
- isExcluded = node.dataset.toastAnnounceExclude === "";
296
- if (!isHidden) if (isExcluded) {
297
- var altText = node.dataset.toastAnnounceAlt;
298
- altText && textContent.push(altText);
299
- } else textContent.push(...getAnnounceTextContent(node));
300
- }
301
- }), textContent;
302
- }
303
- function isHTMLElement(node) {
304
- return node.nodeType === node.ELEMENT_NODE;
305
- }
306
- var GESTURE_GRANT_THRESHOLD = 10,
307
- shouldGrantGestureMove = function (dir, param) {
308
- var {
309
- dx,
310
- dy
311
- } = param;
312
- return (dir === "horizontal" || dir === "left") && dx < -GESTURE_GRANT_THRESHOLD || (dir === "horizontal" || dir === "right") && dx > GESTURE_GRANT_THRESHOLD || (dir === "vertical" || dir === "up") && dy > -GESTURE_GRANT_THRESHOLD || (dir === "vertical" || dir === "down") && dy < GESTURE_GRANT_THRESHOLD;
313
- },
314
- getGestureDistance = function (dir, param) {
315
- var {
316
- dx,
317
- dy
318
- } = param,
319
- y = 0,
320
- x = 0;
321
- return dir === "horizontal" ? x = dx : dir === "left" ? x = Math.min(0, dx) : dir === "right" ? x = Math.max(0, dx) : dir === "vertical" ? y = dy : dir === "up" ? y = Math.min(0, dy) : dir === "down" && (y = Math.max(0, dy)), {
322
- x,
323
- y
324
- };
325
- };
326
- //# sourceMappingURL=ToastImpl.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","ToastImpl_exports","__export","ToastImpl","ToastImplFrame","useToastInteractiveContext","module","exports","import_jsx_runtime","require","import_gui_animate_presence","import_gui_compose_refs","import_gui_constants","import_gui_core","import_gui_dismissable","import_gui_helpers","import_gui_portal","import_gui_stacks","React","__toESM","import_react_native","import_constants","import_ToastAnnounce","import_ToastProvider","import_ToastViewport","styled","YStack","name","tabIndex","variants","unstyled","false","focusStyle","outlineStyle","outlineWidth","outlineColor","backgroundColor","borderRadius","paddingHorizontal","paddingVertical","marginHorizontal","marginVertical","elevation","defaultVariants","process","env","HANZO_GUI_HEADLESS","Provider","ToastInteractiveProvider","useStyledContext","createStyledContext","onClose","forwardRef","props","forwardedRef","scope","type","duration","durationProp","open","onEscapeKeyDown","onPause","onResume","onSwipeStart","onSwipeMove","onSwipeCancel","onSwipeEnd","viewportName","toastProps","isPresent","useIsPresent","context","useToastProviderContext","node","setNode","useState","composedRefs","useComposedRefs","closeTimerStartTimeRef","useRef","closeTimerRemainingTimeRef","closeTimerRef","onToastAdd","onToastRemove","viewport","useMemo","viewports","handleClose","useEvent","isWeb","isFocusInToast","contains","document","activeElement","focus","startTimer","useCallback","duration2","Number","POSITIVE_INFINITY","clearTimeout","current","Date","getTime","setTimeout","handleResume","handlePause","elapsedTime","window","useEffect","addEventListener","VIEWPORT_PAUSE","VIEWPORT_RESUME","removeEventListener","isClosePausedRef","announceTextContent","getAnnounceTextContent","isHorizontalSwipe","includes","swipeDirection","animationDriver","useConfiguration","Error","useAnimatedNumber","useAnimatedNumberStyle","animatedNumber","_animationDriver_NumberView","_ref","AnimatedView","NumberView","View","animatedStyles","val","transform","translateX","translateY","panResponder","PanResponder","create","onMoveShouldSetPanResponder","e","gesture","shouldMove","shouldGrantGestureMove","onPanResponderGrant","onPanResponderMove","x","y","getGestureDistance","delta","setValue","isDeltaInDirection","swipeThreshold","onPanResponderEnd","param","dx","dy","themeName","useThemeName","jsxs","Fragment","children","jsx","ToastAnnounce","role","PortalItem","hostName","Dismissable","composeEventHandlers","isFocusedToastEscapeKeyDownRef","Theme","contain","forceClassName","panHandlers","style","margin","Collection","ItemSlot","toastScope","pointerEvents","touchAction","userSelect","ref","onKeyDown","event","key","defaultPrevented"],"sources":["../../src/ToastImpl.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA;AAAAC,QAAA,CAAAD,iBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA,SA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