@hanzogui/toast 3.0.2 → 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
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@hanzogui/toast",
3
- "version": "3.0.2",
3
+ "version": "7.0.0",
4
4
  "source": "src/index.ts",
5
5
  "files": [
6
6
  "src",
7
7
  "types",
8
- "dist"
8
+ "dist",
9
+ "v2"
9
10
  ],
10
11
  "type": "module",
11
12
  "sideEffects": [
@@ -24,37 +25,46 @@
24
25
  "import": "./dist/esm/index.mjs",
25
26
  "require": "./dist/cjs/index.cjs",
26
27
  "default": "./dist/esm/index.mjs"
28
+ },
29
+ "./v2": {
30
+ "types": "./types/v2.d.ts",
31
+ "react-native": "./dist/esm/v2.native.js",
32
+ "browser": "./dist/esm/v2.mjs",
33
+ "module": "./dist/esm/v2.mjs",
34
+ "import": "./dist/esm/v2.mjs",
35
+ "require": "./dist/cjs/v2.cjs",
36
+ "default": "./dist/esm/v2.mjs"
27
37
  }
28
38
  },
29
39
  "publishConfig": {
30
40
  "access": "public"
31
41
  },
32
42
  "scripts": {
33
- "build": "hanzo-gui-build",
34
- "watch": "hanzo-gui-build --watch",
35
- "clean": "hanzo-gui-build clean",
36
- "clean:build": "hanzo-gui-build clean:build"
43
+ "build": "hanzogui-build",
44
+ "watch": "hanzogui-build --watch",
45
+ "clean": "hanzogui-build clean",
46
+ "clean:build": "hanzogui-build clean:build"
37
47
  },
38
48
  "dependencies": {
39
- "@hanzogui/animate-presence": "3.0.1",
40
- "@hanzogui/collection": "3.0.1",
41
- "@hanzogui/compose-refs": "3.0.1",
42
- "@hanzogui/constants": "3.0.1",
43
- "@hanzogui/core": "3.0.1",
44
- "@hanzogui/create-context": "3.0.1",
45
- "@hanzogui/dismissable": "3.0.1",
46
- "@hanzogui/helpers": "3.0.1",
47
- "@hanzogui/native": "3.0.1",
48
- "@hanzogui/polyfill-dev": "3.0.1",
49
- "@hanzogui/portal": "3.0.1",
50
- "@hanzogui/stacks": "3.0.1",
51
- "@hanzogui/start-transition": "3.0.1",
52
- "@hanzogui/text": "3.0.1",
53
- "@hanzogui/use-controllable-state": "3.0.1",
54
- "@hanzogui/visually-hidden": "3.0.1"
49
+ "@hanzogui/animate-presence": "^7.0.0",
50
+ "@hanzogui/collection": "^7.0.0",
51
+ "@hanzogui/compose-refs": "^7.0.0",
52
+ "@hanzogui/constants": "^7.0.0",
53
+ "@hanzogui/core": "^7.0.0",
54
+ "@hanzogui/create-context": "^7.0.0",
55
+ "@hanzogui/dismissable": "^7.0.0",
56
+ "@hanzogui/helpers": "^7.0.0",
57
+ "@hanzogui/native": "^7.0.0",
58
+ "@hanzogui/polyfill-dev": "^7.0.0",
59
+ "@hanzogui/portal": "^7.0.0",
60
+ "@hanzogui/stacks": "^7.0.0",
61
+ "@hanzogui/start-transition": "^7.0.0",
62
+ "@hanzogui/text": "^7.0.0",
63
+ "@hanzogui/use-controllable-state": "^7.0.0",
64
+ "@hanzogui/visually-hidden": "^7.0.0"
55
65
  },
56
66
  "devDependencies": {
57
- "@hanzogui/build": "3.0.1",
67
+ "@hanzogui/build": "^7.0.0",
58
68
  "react": ">=19",
59
69
  "react-native": "0.83.2"
60
70
  },
@@ -62,5 +72,12 @@
62
72
  "react": ">=19",
63
73
  "react-native": "*"
64
74
  },
65
- "module:jsx": "dist/jsx"
66
- }
75
+ "module:jsx": "dist/jsx",
76
+ "typesVersions": {
77
+ "*": {
78
+ "v2": [
79
+ "./types/v2.d.ts"
80
+ ]
81
+ }
82
+ }
83
+ }
package/src/Toast.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AnimatePresence } from '@hanzogui/animate-presence'
2
- import type { GetProps, NativePlatform, NativeValue, GuiElement } from '@hanzogui/core'
2
+ import type { GetProps, NativePlatform, NativeValue, HanzoguiElement } from '@hanzogui/core'
3
3
  import { styled, useEvent } from '@hanzogui/core'
4
4
  import { composeEventHandlers, withStaticProperties } from '@hanzogui/helpers'
5
5
  import { YStack } from '@hanzogui/stacks'
@@ -35,7 +35,7 @@ const ToastTitle = styled(SizableText, {
35
35
  } as const,
36
36
 
37
37
  defaultVariants: {
38
- unstyled: process.env.HANZO_GUI_HEADLESS === '1',
38
+ unstyled: process.env.HANZOGUI_HEADLESS === '1',
39
39
  },
40
40
  })
41
41
 
@@ -60,7 +60,7 @@ const ToastDescription = styled(SizableText, {
60
60
  } as const,
61
61
 
62
62
  defaultVariants: {
63
- unstyled: process.env.HANZO_GUI_HEADLESS === '1',
63
+ unstyled: process.env.HANZOGUI_HEADLESS === '1',
64
64
  },
65
65
  })
66
66
 
@@ -84,7 +84,7 @@ type ToastActionProps = ScopedProps<
84
84
  }
85
85
  >
86
86
 
87
- const ToastAction = React.forwardRef<GuiElement, ScopedProps<ToastActionProps>>(
87
+ const ToastAction = React.forwardRef<HanzoguiElement, ScopedProps<ToastActionProps>>(
88
88
  function ToastAction(props, forwardedRef) {
89
89
  const { altText, ...actionProps } = props
90
90
  if (!altText) return null
@@ -119,7 +119,7 @@ const ToastCloseFrame = styled(YStack, {
119
119
  type ToastCloseFrameProps = GetProps<typeof ToastCloseFrame>
120
120
  type ToastCloseProps = ScopedProps<ToastCloseFrameProps & {}>
121
121
 
122
- const ToastClose = React.forwardRef<GuiElement, ToastCloseProps>(
122
+ const ToastClose = React.forwardRef<HanzoguiElement, ToastCloseProps>(
123
123
  function ToastClose(props, forwardedRef) {
124
124
  const { scope, ...closeProps } = props
125
125
  const interactiveContext = useToastInteractiveContext(scope)
@@ -1,5 +1,5 @@
1
1
  import { useIsomorphicLayoutEffect } from '@hanzogui/constants'
2
- import type { GetProps, GuiElement } from '@hanzogui/core'
2
+ import type { GetProps, HanzoguiElement } from '@hanzogui/core'
3
3
  import { View, Text, styled, useEvent } from '@hanzogui/core'
4
4
  import { Portal } from '@hanzogui/portal'
5
5
  import { startTransition } from '@hanzogui/start-transition'
@@ -22,7 +22,7 @@ type ToastAnnounceExcludeExtraProps = {
22
22
  type ToastAnnounceExcludeProps = ToastAnnounceExcludeFrameProps &
23
23
  ToastAnnounceExcludeExtraProps
24
24
 
25
- const ToastAnnounceExclude = React.forwardRef<GuiElement, ToastAnnounceExcludeProps>(
25
+ const ToastAnnounceExclude = React.forwardRef<HanzoguiElement, ToastAnnounceExcludeProps>(
26
26
  (props, forwardedRef) => {
27
27
  const { altText, ...announceExcludeProps } = props
28
28