@oxyhq/bloom 0.50.2 → 0.51.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.
- package/NOTICE +89 -0
- package/README.md +12 -7
- package/lib/commonjs/avatar-group/AvatarGroup.web.js +2 -1
- package/lib/commonjs/avatar-group/AvatarGroup.web.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.web.js +2 -1
- package/lib/commonjs/bottom-sheet/index.web.js.map +1 -1
- package/lib/commonjs/context-menu/index.web.js +3 -2
- package/lib/commonjs/context-menu/index.web.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +4 -3
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/index.js +90 -83
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +116 -109
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/menu/index.web.js +2 -1
- package/lib/commonjs/menu/index.web.js.map +1 -1
- package/lib/commonjs/popover/index.web.js +3 -2
- package/lib/commonjs/popover/index.web.js.map +1 -1
- package/lib/commonjs/portal/index.js +4 -1
- package/lib/commonjs/portal/index.js.map +1 -1
- package/lib/commonjs/progressive-blur/index.js +79 -0
- package/lib/commonjs/progressive-blur/index.js.map +1 -0
- package/lib/commonjs/progressive-blur/index.web.js +67 -0
- package/lib/commonjs/progressive-blur/index.web.js.map +1 -0
- package/lib/commonjs/progressive-blur/shared.js +66 -0
- package/lib/commonjs/progressive-blur/shared.js.map +1 -0
- package/lib/commonjs/progressive-blur/types.js +6 -0
- package/lib/commonjs/progressive-blur/types.js.map +1 -0
- package/lib/commonjs/select/index.web.js +2 -1
- package/lib/commonjs/select/index.web.js.map +1 -1
- package/lib/commonjs/styles/web-view-style.js +26 -0
- package/lib/commonjs/styles/web-view-style.js.map +1 -0
- package/lib/commonjs/tab-bar/TabBarBase.js +415 -0
- package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -0
- package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js +83 -0
- package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js.map +1 -0
- package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js +119 -0
- package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
- package/lib/commonjs/tab-bar/expo-router/index.js +26 -0
- package/lib/commonjs/tab-bar/expo-router/index.js.map +1 -0
- package/lib/commonjs/tab-bar/glyph.js +43 -0
- package/lib/commonjs/tab-bar/glyph.js.map +1 -0
- package/lib/commonjs/tab-bar/glyph.native.js +55 -0
- package/lib/commonjs/tab-bar/glyph.native.js.map +1 -0
- package/lib/commonjs/tab-bar/index.js +65 -0
- package/lib/commonjs/tab-bar/index.js.map +1 -0
- package/lib/commonjs/tab-bar/index.web.js +67 -0
- package/lib/commonjs/tab-bar/index.web.js.map +1 -0
- package/lib/commonjs/tab-bar/minimize-context.js +127 -0
- package/lib/commonjs/tab-bar/minimize-context.js.map +1 -0
- package/lib/commonjs/tab-bar/shared.js +139 -0
- package/lib/commonjs/tab-bar/shared.js.map +1 -0
- package/lib/commonjs/tab-bar/surface.js +50 -0
- package/lib/commonjs/tab-bar/surface.js.map +1 -0
- package/lib/commonjs/tab-bar/surface.native.js +56 -0
- package/lib/commonjs/tab-bar/surface.native.js.map +1 -0
- package/lib/commonjs/tab-bar/surface.web.js +59 -0
- package/lib/commonjs/tab-bar/surface.web.js.map +1 -0
- package/lib/commonjs/tab-bar/types.js +6 -0
- package/lib/commonjs/tab-bar/types.js.map +1 -0
- package/lib/commonjs/toast/Positioner.js +117 -0
- package/lib/commonjs/toast/Positioner.js.map +1 -0
- package/lib/commonjs/toast/ToastContent.js +301 -0
- package/lib/commonjs/toast/ToastContent.js.map +1 -0
- package/lib/commonjs/toast/ToastHost.js +69 -0
- package/lib/commonjs/toast/ToastHost.js.map +1 -0
- package/lib/commonjs/toast/ToastHost.native.js +44 -0
- package/lib/commonjs/toast/ToastHost.native.js.map +1 -0
- package/lib/commonjs/toast/ToastIcon.js +57 -0
- package/lib/commonjs/toast/ToastIcon.js.map +1 -0
- package/lib/commonjs/toast/ToastRow.js +411 -0
- package/lib/commonjs/toast/ToastRow.js.map +1 -0
- package/lib/commonjs/toast/ToastSwipeHandler.js +189 -0
- package/lib/commonjs/toast/ToastSwipeHandler.js.map +1 -0
- package/lib/commonjs/toast/Toaster.js +205 -0
- package/lib/commonjs/toast/Toaster.js.map +1 -0
- package/lib/commonjs/toast/animations.js +274 -0
- package/lib/commonjs/toast/animations.js.map +1 -0
- package/lib/commonjs/toast/constants.js +56 -0
- package/lib/commonjs/toast/constants.js.map +1 -0
- package/lib/commonjs/toast/context.js +42 -0
- package/lib/commonjs/toast/context.js.map +1 -0
- package/lib/commonjs/toast/index.js +32 -126
- package/lib/commonjs/toast/index.js.map +1 -1
- package/lib/commonjs/toast/position-utils.js +115 -0
- package/lib/commonjs/toast/position-utils.js.map +1 -0
- package/lib/commonjs/toast/positioner-utils.js +141 -0
- package/lib/commonjs/toast/positioner-utils.js.map +1 -0
- package/lib/commonjs/toast/toast-comparator.js +28 -0
- package/lib/commonjs/toast/toast-comparator.js.map +1 -0
- package/lib/commonjs/toast/toast-fns.js +90 -0
- package/lib/commonjs/toast/toast-fns.js.map +1 -0
- package/lib/commonjs/toast/toast-store.js +352 -0
- package/lib/commonjs/toast/toast-store.js.map +1 -0
- package/lib/commonjs/toast/toast-timers.js +110 -0
- package/lib/commonjs/toast/toast-timers.js.map +1 -0
- package/lib/commonjs/toast/types.js +42 -0
- package/lib/commonjs/toast/types.js.map +1 -1
- package/lib/commonjs/toast/use-animated-target.js +57 -0
- package/lib/commonjs/toast/use-animated-target.js.map +1 -0
- package/lib/commonjs/toast/use-app-state.js +76 -0
- package/lib/commonjs/toast/use-app-state.js.map +1 -0
- package/lib/commonjs/toast/use-toast-colors.js +114 -0
- package/lib/commonjs/toast/use-toast-colors.js.map +1 -0
- package/lib/commonjs/toast/use-toast-position.js +40 -0
- package/lib/commonjs/toast/use-toast-position.js.map +1 -0
- package/lib/commonjs/tooltip/index.web.js +2 -1
- package/lib/commonjs/tooltip/index.web.js.map +1 -1
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
- package/lib/module/avatar-group/AvatarGroup.web.js +2 -1
- package/lib/module/avatar-group/AvatarGroup.web.js.map +1 -1
- package/lib/module/bottom-sheet/index.web.js +2 -1
- package/lib/module/bottom-sheet/index.web.js.map +1 -1
- package/lib/module/context-menu/index.web.js +3 -2
- package/lib/module/context-menu/index.web.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +4 -3
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/menu/index.web.js +2 -1
- package/lib/module/menu/index.web.js.map +1 -1
- package/lib/module/popover/index.web.js +3 -2
- package/lib/module/popover/index.web.js.map +1 -1
- package/lib/module/portal/index.js +4 -1
- package/lib/module/portal/index.js.map +1 -1
- package/lib/module/progressive-blur/index.js +74 -0
- package/lib/module/progressive-blur/index.js.map +1 -0
- package/lib/module/progressive-blur/index.web.js +62 -0
- package/lib/module/progressive-blur/index.web.js.map +1 -0
- package/lib/module/progressive-blur/shared.js +60 -0
- package/lib/module/progressive-blur/shared.js.map +1 -0
- package/lib/module/progressive-blur/types.js +4 -0
- package/lib/module/progressive-blur/types.js.map +1 -0
- package/lib/module/select/index.web.js +2 -1
- package/lib/module/select/index.web.js.map +1 -1
- package/lib/module/styles/web-view-style.js +22 -0
- package/lib/module/styles/web-view-style.js.map +1 -0
- package/lib/module/tab-bar/TabBarBase.js +408 -0
- package/lib/module/tab-bar/TabBarBase.js.map +1 -0
- package/lib/module/tab-bar/expo-router/RouterTabBar.js +78 -0
- package/lib/module/tab-bar/expo-router/RouterTabBar.js.map +1 -0
- package/lib/module/tab-bar/expo-router/fading-tab-screen.js +113 -0
- package/lib/module/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
- package/lib/module/tab-bar/expo-router/index.js +15 -0
- package/lib/module/tab-bar/expo-router/index.js.map +1 -0
- package/lib/module/tab-bar/glyph.js +38 -0
- package/lib/module/tab-bar/glyph.js.map +1 -0
- package/lib/module/tab-bar/glyph.native.js +50 -0
- package/lib/module/tab-bar/glyph.native.js.map +1 -0
- package/lib/module/tab-bar/index.js +24 -0
- package/lib/module/tab-bar/index.js.map +1 -0
- package/lib/module/tab-bar/index.web.js +26 -0
- package/lib/module/tab-bar/index.web.js.map +1 -0
- package/lib/module/tab-bar/minimize-context.js +118 -0
- package/lib/module/tab-bar/minimize-context.js.map +1 -0
- package/lib/module/tab-bar/shared.js +132 -0
- package/lib/module/tab-bar/shared.js.map +1 -0
- package/lib/module/tab-bar/surface.js +44 -0
- package/lib/module/tab-bar/surface.js.map +1 -0
- package/lib/module/tab-bar/surface.native.js +50 -0
- package/lib/module/tab-bar/surface.native.js.map +1 -0
- package/lib/module/tab-bar/surface.web.js +53 -0
- package/lib/module/tab-bar/surface.web.js.map +1 -0
- package/lib/module/tab-bar/types.js +4 -0
- package/lib/module/tab-bar/types.js.map +1 -0
- package/lib/module/toast/Positioner.js +110 -0
- package/lib/module/toast/Positioner.js.map +1 -0
- package/lib/module/toast/ToastContent.js +295 -0
- package/lib/module/toast/ToastContent.js.map +1 -0
- package/lib/module/toast/ToastHost.js +63 -0
- package/lib/module/toast/ToastHost.js.map +1 -0
- package/lib/module/toast/ToastHost.native.js +38 -0
- package/lib/module/toast/ToastHost.native.js.map +1 -0
- package/lib/module/toast/ToastIcon.js +52 -0
- package/lib/module/toast/ToastIcon.js.map +1 -0
- package/lib/module/toast/ToastRow.js +407 -0
- package/lib/module/toast/ToastRow.js.map +1 -0
- package/lib/module/toast/ToastSwipeHandler.js +182 -0
- package/lib/module/toast/ToastSwipeHandler.js.map +1 -0
- package/lib/module/toast/Toaster.js +198 -0
- package/lib/module/toast/Toaster.js.map +1 -0
- package/lib/module/toast/animations.js +261 -0
- package/lib/module/toast/animations.js.map +1 -0
- package/lib/module/toast/constants.js +52 -0
- package/lib/module/toast/constants.js.map +1 -0
- package/lib/module/toast/context.js +34 -0
- package/lib/module/toast/context.js.map +1 -0
- package/lib/module/toast/index.js +27 -103
- package/lib/module/toast/index.js.map +1 -1
- package/lib/module/toast/position-utils.js +107 -0
- package/lib/module/toast/position-utils.js.map +1 -0
- package/lib/module/toast/positioner-utils.js +134 -0
- package/lib/module/toast/positioner-utils.js.map +1 -0
- package/lib/module/toast/toast-comparator.js +22 -0
- package/lib/module/toast/toast-comparator.js.map +1 -0
- package/lib/module/toast/toast-fns.js +85 -0
- package/lib/module/toast/toast-fns.js.map +1 -0
- package/lib/module/toast/toast-store.js +346 -0
- package/lib/module/toast/toast-store.js.map +1 -0
- package/lib/module/toast/toast-timers.js +104 -0
- package/lib/module/toast/toast-timers.js.map +1 -0
- package/lib/module/toast/types.js +38 -0
- package/lib/module/toast/types.js.map +1 -1
- package/lib/module/toast/use-animated-target.js +52 -0
- package/lib/module/toast/use-animated-target.js.map +1 -0
- package/lib/module/toast/use-app-state.js +70 -0
- package/lib/module/toast/use-app-state.js.map +1 -0
- package/lib/module/toast/use-toast-colors.js +109 -0
- package/lib/module/toast/use-toast-colors.js.map +1 -0
- package/lib/module/toast/use-toast-position.js +35 -0
- package/lib/module/toast/use-toast-position.js.map +1 -0
- package/lib/module/tooltip/index.web.js +2 -1
- package/lib/module/tooltip/index.web.js.map +1 -1
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
- package/lib/typescript/commonjs/avatar-group/AvatarGroup.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +2 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/portal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/progressive-blur/index.d.ts +23 -0
- package/lib/typescript/commonjs/progressive-blur/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/progressive-blur/index.web.d.ts +30 -0
- package/lib/typescript/commonjs/progressive-blur/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/progressive-blur/shared.d.ts +35 -0
- package/lib/typescript/commonjs/progressive-blur/shared.d.ts.map +1 -0
- package/lib/typescript/commonjs/progressive-blur/types.d.ts +21 -0
- package/lib/typescript/commonjs/progressive-blur/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/web-view-style.d.ts +21 -0
- package/lib/typescript/commonjs/styles/web-view-style.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts +36 -0
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts +14 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/glyph.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/glyph.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/index.d.ts +12 -0
- package/lib/typescript/commonjs/tab-bar/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/index.web.d.ts +12 -0
- package/lib/typescript/commonjs/tab-bar/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts +51 -0
- package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/shared.d.ts +93 -0
- package/lib/typescript/commonjs/tab-bar/shared.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/surface.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/surface.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/surface.native.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/surface.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/surface.web.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/surface.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/types.d.ts +85 -0
- package/lib/typescript/commonjs/tab-bar/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/Positioner.d.ts +21 -0
- package/lib/typescript/commonjs/toast/Positioner.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastContent.d.ts +14 -0
- package/lib/typescript/commonjs/toast/ToastContent.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastHost.d.ts +6 -0
- package/lib/typescript/commonjs/toast/ToastHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastHost.native.d.ts +6 -0
- package/lib/typescript/commonjs/toast/ToastHost.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastIcon.d.ts +9 -0
- package/lib/typescript/commonjs/toast/ToastIcon.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastRow.d.ts +80 -0
- package/lib/typescript/commonjs/toast/ToastRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts +30 -0
- package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/Toaster.d.ts +19 -0
- package/lib/typescript/commonjs/toast/Toaster.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/animations.d.ts +62 -0
- package/lib/typescript/commonjs/toast/animations.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/constants.d.ts +39 -0
- package/lib/typescript/commonjs/toast/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/context.d.ts +19 -0
- package/lib/typescript/commonjs/toast/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/index.d.ts +23 -76
- package/lib/typescript/commonjs/toast/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/position-utils.d.ts +30 -0
- package/lib/typescript/commonjs/toast/position-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/positioner-utils.d.ts +72 -0
- package/lib/typescript/commonjs/toast/positioner-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-comparator.d.ts +12 -0
- package/lib/typescript/commonjs/toast/toast-comparator.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-fns.d.ts +3 -0
- package/lib/typescript/commonjs/toast/toast-fns.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-store.d.ts +52 -0
- package/lib/typescript/commonjs/toast/toast-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-timers.d.ts +24 -0
- package/lib/typescript/commonjs/toast/toast-timers.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/types.d.ts +222 -5
- package/lib/typescript/commonjs/toast/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/use-animated-target.d.ts +7 -0
- package/lib/typescript/commonjs/toast/use-animated-target.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-app-state.d.ts +18 -0
- package/lib/typescript/commonjs/toast/use-app-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-toast-colors.d.ts +22 -0
- package/lib/typescript/commonjs/toast/use-toast-colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-toast-position.d.ts +37 -0
- package/lib/typescript/commonjs/toast/use-toast-position.d.ts.map +1 -0
- package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
- package/lib/typescript/module/avatar-group/AvatarGroup.web.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.web.d.ts.map +1 -1
- package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +2 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/module/portal/index.d.ts.map +1 -1
- package/lib/typescript/module/progressive-blur/index.d.ts +23 -0
- package/lib/typescript/module/progressive-blur/index.d.ts.map +1 -0
- package/lib/typescript/module/progressive-blur/index.web.d.ts +30 -0
- package/lib/typescript/module/progressive-blur/index.web.d.ts.map +1 -0
- package/lib/typescript/module/progressive-blur/shared.d.ts +35 -0
- package/lib/typescript/module/progressive-blur/shared.d.ts.map +1 -0
- package/lib/typescript/module/progressive-blur/types.d.ts +21 -0
- package/lib/typescript/module/progressive-blur/types.d.ts.map +1 -0
- package/lib/typescript/module/select/index.web.d.ts.map +1 -1
- package/lib/typescript/module/styles/web-view-style.d.ts +21 -0
- package/lib/typescript/module/styles/web-view-style.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts +36 -0
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
- package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
- package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/expo-router/index.d.ts +14 -0
- package/lib/typescript/module/tab-bar/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/glyph.d.ts +6 -0
- package/lib/typescript/module/tab-bar/glyph.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/glyph.native.d.ts +6 -0
- package/lib/typescript/module/tab-bar/glyph.native.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/index.d.ts +12 -0
- package/lib/typescript/module/tab-bar/index.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/index.web.d.ts +12 -0
- package/lib/typescript/module/tab-bar/index.web.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/minimize-context.d.ts +51 -0
- package/lib/typescript/module/tab-bar/minimize-context.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/shared.d.ts +93 -0
- package/lib/typescript/module/tab-bar/shared.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/surface.d.ts +6 -0
- package/lib/typescript/module/tab-bar/surface.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/surface.native.d.ts +6 -0
- package/lib/typescript/module/tab-bar/surface.native.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/surface.web.d.ts +6 -0
- package/lib/typescript/module/tab-bar/surface.web.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/types.d.ts +85 -0
- package/lib/typescript/module/tab-bar/types.d.ts.map +1 -0
- package/lib/typescript/module/toast/Positioner.d.ts +21 -0
- package/lib/typescript/module/toast/Positioner.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastContent.d.ts +14 -0
- package/lib/typescript/module/toast/ToastContent.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastHost.d.ts +6 -0
- package/lib/typescript/module/toast/ToastHost.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastHost.native.d.ts +6 -0
- package/lib/typescript/module/toast/ToastHost.native.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastIcon.d.ts +9 -0
- package/lib/typescript/module/toast/ToastIcon.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastRow.d.ts +80 -0
- package/lib/typescript/module/toast/ToastRow.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastSwipeHandler.d.ts +30 -0
- package/lib/typescript/module/toast/ToastSwipeHandler.d.ts.map +1 -0
- package/lib/typescript/module/toast/Toaster.d.ts +19 -0
- package/lib/typescript/module/toast/Toaster.d.ts.map +1 -0
- package/lib/typescript/module/toast/animations.d.ts +62 -0
- package/lib/typescript/module/toast/animations.d.ts.map +1 -0
- package/lib/typescript/module/toast/constants.d.ts +39 -0
- package/lib/typescript/module/toast/constants.d.ts.map +1 -0
- package/lib/typescript/module/toast/context.d.ts +19 -0
- package/lib/typescript/module/toast/context.d.ts.map +1 -0
- package/lib/typescript/module/toast/index.d.ts +23 -76
- package/lib/typescript/module/toast/index.d.ts.map +1 -1
- package/lib/typescript/module/toast/position-utils.d.ts +30 -0
- package/lib/typescript/module/toast/position-utils.d.ts.map +1 -0
- package/lib/typescript/module/toast/positioner-utils.d.ts +72 -0
- package/lib/typescript/module/toast/positioner-utils.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-comparator.d.ts +12 -0
- package/lib/typescript/module/toast/toast-comparator.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-fns.d.ts +3 -0
- package/lib/typescript/module/toast/toast-fns.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-store.d.ts +52 -0
- package/lib/typescript/module/toast/toast-store.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-timers.d.ts +24 -0
- package/lib/typescript/module/toast/toast-timers.d.ts.map +1 -0
- package/lib/typescript/module/toast/types.d.ts +222 -5
- package/lib/typescript/module/toast/types.d.ts.map +1 -1
- package/lib/typescript/module/toast/use-animated-target.d.ts +7 -0
- package/lib/typescript/module/toast/use-animated-target.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-app-state.d.ts +18 -0
- package/lib/typescript/module/toast/use-app-state.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-toast-colors.d.ts +22 -0
- package/lib/typescript/module/toast/use-toast-colors.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-toast-position.d.ts +37 -0
- package/lib/typescript/module/toast/use-toast-position.d.ts.map +1 -0
- package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
- package/package.json +63 -25
- package/src/__tests__/TabBar.test.tsx +342 -0
- package/src/__tests__/TabBarReanimatedDeps.test.ts +130 -0
- package/src/__tests__/TabBarWebFork.test.ts +197 -0
- package/src/__tests__/ToastContent.test.tsx +192 -0
- package/src/__tests__/ToastHostWebFork.test.ts +155 -0
- package/src/__tests__/Toaster.test.tsx +527 -0
- package/src/__tests__/animated-style-deps.test.ts +156 -0
- package/src/__tests__/toast-animations.test.ts +98 -0
- package/src/__tests__/toast-comparator.test.ts +131 -0
- package/src/__tests__/toast-enter-driver.test.ts +147 -0
- package/src/__tests__/toast-fns.test.ts +240 -0
- package/src/__tests__/toast-position-utils.test.ts +259 -0
- package/src/__tests__/toast-positioner-utils.test.ts +214 -0
- package/src/__tests__/toast-store.test.ts +622 -0
- package/src/__tests__/toast-timers.test.ts +163 -0
- package/src/__tests__/use-animated-target.test.tsx +60 -0
- package/src/__tests__/use-app-state.test.tsx +127 -0
- package/src/__tests__/use-toast-colors.test.tsx +189 -0
- package/src/__tests__/web-position-fixed.test.ts +70 -0
- package/src/avatar-group/AvatarGroup.web.tsx +2 -1
- package/src/bottom-sheet/index.web.tsx +3 -2
- package/src/context-menu/index.web.tsx +3 -2
- package/src/dialog/Dialog.web.tsx +4 -3
- package/src/index.ts +4 -1
- package/src/index.web.ts +4 -1
- package/src/menu/index.web.tsx +2 -1
- package/src/popover/index.web.tsx +3 -2
- package/src/portal/index.tsx +4 -1
- package/src/progressive-blur/index.tsx +78 -0
- package/src/progressive-blur/index.web.tsx +65 -0
- package/src/progressive-blur/shared.ts +81 -0
- package/src/progressive-blur/types.ts +21 -0
- package/src/select/index.web.tsx +2 -1
- package/src/styles/web-view-style.ts +21 -0
- package/src/tab-bar/TabBar.stories.tsx +217 -0
- package/src/tab-bar/TabBarBase.tsx +517 -0
- package/src/tab-bar/expo-router/RouterTabBar.tsx +80 -0
- package/src/tab-bar/expo-router/fading-tab-screen.tsx +109 -0
- package/src/tab-bar/expo-router/index.ts +13 -0
- package/src/tab-bar/glyph.native.tsx +46 -0
- package/src/tab-bar/glyph.tsx +31 -0
- package/src/tab-bar/index.ts +32 -0
- package/src/tab-bar/index.web.tsx +34 -0
- package/src/tab-bar/minimize-context.tsx +117 -0
- package/src/tab-bar/shared.ts +159 -0
- package/src/tab-bar/surface.native.tsx +60 -0
- package/src/tab-bar/surface.tsx +47 -0
- package/src/tab-bar/surface.web.tsx +56 -0
- package/src/tab-bar/types.ts +88 -0
- package/src/toast/Positioner.tsx +121 -0
- package/src/toast/Toast.stories.tsx +292 -65
- package/src/toast/ToastContent.tsx +405 -0
- package/src/toast/ToastHost.native.tsx +31 -0
- package/src/toast/ToastHost.tsx +67 -0
- package/src/toast/ToastIcon.tsx +55 -0
- package/src/toast/ToastRow.tsx +485 -0
- package/src/toast/ToastSwipeHandler.tsx +222 -0
- package/src/toast/Toaster.tsx +259 -0
- package/src/toast/animations.ts +313 -0
- package/src/toast/constants.ts +76 -0
- package/src/toast/context.tsx +44 -0
- package/src/toast/index.tsx +47 -123
- package/src/toast/position-utils.ts +149 -0
- package/src/toast/positioner-utils.ts +142 -0
- package/src/toast/toast-comparator.ts +41 -0
- package/src/toast/toast-fns.ts +104 -0
- package/src/toast/toast-store.ts +432 -0
- package/src/toast/toast-timers.ts +124 -0
- package/src/toast/types.ts +301 -5
- package/src/toast/use-animated-target.ts +61 -0
- package/src/toast/use-app-state.ts +77 -0
- package/src/toast/use-toast-colors.ts +133 -0
- package/src/toast/use-toast-position.ts +46 -0
- package/src/tooltip/index.web.tsx +2 -1
- package/src/zoomable-image-gallery/ZoomableImageGallery.stories.tsx +134 -0
- package/src/zoomable-image-gallery/ZoomableImageGallery.tsx +50 -27
- package/lib/commonjs/toast/Toast.js +0 -267
- package/lib/commonjs/toast/Toast.js.map +0 -1
- package/lib/commonjs/toast/const.js +0 -8
- package/lib/commonjs/toast/const.js.map +0 -1
- package/lib/commonjs/toast/index.web.js +0 -114
- package/lib/commonjs/toast/index.web.js.map +0 -1
- package/lib/commonjs/toast/sonner/index.js +0 -9
- package/lib/commonjs/toast/sonner/index.js.map +0 -1
- package/lib/commonjs/toast/sonner/index.web.js +0 -9
- package/lib/commonjs/toast/sonner/index.web.js.map +0 -1
- package/lib/module/toast/Toast.js +0 -258
- package/lib/module/toast/Toast.js.map +0 -1
- package/lib/module/toast/const.js +0 -4
- package/lib/module/toast/const.js.map +0 -1
- package/lib/module/toast/index.web.js +0 -74
- package/lib/module/toast/index.web.js.map +0 -1
- package/lib/module/toast/sonner/index.js +0 -5
- package/lib/module/toast/sonner/index.js.map +0 -1
- package/lib/module/toast/sonner/index.web.js +0 -5
- package/lib/module/toast/sonner/index.web.js.map +0 -1
- package/lib/typescript/commonjs/toast/Toast.d.ts +0 -23
- package/lib/typescript/commonjs/toast/Toast.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/const.d.ts +0 -2
- package/lib/typescript/commonjs/toast/const.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/index.web.d.ts +0 -29
- package/lib/typescript/commonjs/toast/index.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/sonner/index.d.ts +0 -2
- package/lib/typescript/commonjs/toast/sonner/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/sonner/index.web.d.ts +0 -2
- package/lib/typescript/commonjs/toast/sonner/index.web.d.ts.map +0 -1
- package/lib/typescript/module/toast/Toast.d.ts +0 -23
- package/lib/typescript/module/toast/Toast.d.ts.map +0 -1
- package/lib/typescript/module/toast/const.d.ts +0 -2
- package/lib/typescript/module/toast/const.d.ts.map +0 -1
- package/lib/typescript/module/toast/index.web.d.ts +0 -29
- package/lib/typescript/module/toast/index.web.d.ts.map +0 -1
- package/lib/typescript/module/toast/sonner/index.d.ts +0 -2
- package/lib/typescript/module/toast/sonner/index.d.ts.map +0 -1
- package/lib/typescript/module/toast/sonner/index.web.d.ts +0 -2
- package/lib/typescript/module/toast/sonner/index.web.d.ts.map +0 -1
- package/src/toast/Toast.tsx +0 -269
- package/src/toast/const.ts +0 -1
- package/src/toast/index.web.tsx +0 -101
- package/src/toast/sonner/index.ts +0 -3
- package/src/toast/sonner/index.web.ts +0 -3
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_CACHED_ANIMATIONS,
|
|
3
|
+
getToastEnterAnimation,
|
|
4
|
+
getToastExitAnimation,
|
|
5
|
+
toastAnimationCacheSize,
|
|
6
|
+
} from '../toast/animations';
|
|
7
|
+
import type { ToastPosition } from '../toast/types';
|
|
8
|
+
|
|
9
|
+
const POSITIONS: ToastPosition[] = ['top-center', 'bottom-center', 'center'];
|
|
10
|
+
|
|
11
|
+
describe('toast layout animations', () => {
|
|
12
|
+
it('returns the same instance for the same enter shape', () => {
|
|
13
|
+
const first = getToastEnterAnimation('bottom-center');
|
|
14
|
+
expect(getToastEnterAnimation('bottom-center')).toBe(first);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('returns a different enter instance per position', () => {
|
|
18
|
+
const instances = POSITIONS.map((position) =>
|
|
19
|
+
getToastEnterAnimation(position),
|
|
20
|
+
);
|
|
21
|
+
expect(new Set(instances).size).toBe(POSITIONS.length);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns a different exit instance per position', () => {
|
|
25
|
+
const instances = POSITIONS.map((position) =>
|
|
26
|
+
getToastExitAnimation({
|
|
27
|
+
position,
|
|
28
|
+
isHiddenByLimit: false,
|
|
29
|
+
isSingle: true,
|
|
30
|
+
stackGap: 8,
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
expect(new Set(instances).size).toBe(POSITIONS.length);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('returns the same instance for the same exit shape', () => {
|
|
37
|
+
const shape = {
|
|
38
|
+
position: 'bottom-center' as const,
|
|
39
|
+
isHiddenByLimit: false,
|
|
40
|
+
isSingle: true,
|
|
41
|
+
stackGap: 8,
|
|
42
|
+
};
|
|
43
|
+
expect(getToastExitAnimation(shape)).toBe(getToastExitAnimation(shape));
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it.each([
|
|
47
|
+
['isHiddenByLimit', { isHiddenByLimit: true }],
|
|
48
|
+
['isSingle', { isSingle: false }],
|
|
49
|
+
['stackGap', { stackGap: 12 }],
|
|
50
|
+
['position', { position: 'top-center' as const }],
|
|
51
|
+
])('keys the exit cache on %s', (_label, override) => {
|
|
52
|
+
const base = {
|
|
53
|
+
position: 'bottom-center' as const,
|
|
54
|
+
isHiddenByLimit: false,
|
|
55
|
+
isSingle: true,
|
|
56
|
+
stackGap: 8,
|
|
57
|
+
};
|
|
58
|
+
expect(getToastExitAnimation({ ...base, ...override })).not.toBe(
|
|
59
|
+
getToastExitAnimation(base),
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('gives each cached instance its own definition object', () => {
|
|
64
|
+
// `Keyframe.parseDefinitions()` mutates the definitions it was built with
|
|
65
|
+
// (rewriting `from`/`to` into `0`/`100`), so two instances sharing one object
|
|
66
|
+
// would make the second throw. Distinct instances must not alias.
|
|
67
|
+
const first = getToastEnterAnimation('top-center');
|
|
68
|
+
const second = getToastEnterAnimation('bottom-center');
|
|
69
|
+
expect(first).not.toBe(second);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('never grows past MAX_CACHED_ANIMATIONS, however many gaps are used', () => {
|
|
73
|
+
for (let stackGap = 0; stackGap < MAX_CACHED_ANIMATIONS * 4; stackGap++) {
|
|
74
|
+
getToastExitAnimation({
|
|
75
|
+
position: 'bottom-center',
|
|
76
|
+
isHiddenByLimit: false,
|
|
77
|
+
isSingle: false,
|
|
78
|
+
stackGap,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
expect(toastAnimationCacheSize()).toBeLessThanOrEqual(
|
|
82
|
+
MAX_CACHED_ANIMATIONS,
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('still serves a shape that was evicted, by rebuilding it', () => {
|
|
87
|
+
const rebuilt = getToastExitAnimation({
|
|
88
|
+
position: 'bottom-center',
|
|
89
|
+
isHiddenByLimit: false,
|
|
90
|
+
isSingle: false,
|
|
91
|
+
stackGap: 0,
|
|
92
|
+
});
|
|
93
|
+
expect(rebuilt).toBeDefined();
|
|
94
|
+
expect(toastAnimationCacheSize()).toBeLessThanOrEqual(
|
|
95
|
+
MAX_CACHED_ANIMATIONS,
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { areToastsEqual } from '../toast/toast-comparator';
|
|
4
|
+
import { isToastAction, type ToastProps } from '../toast/types';
|
|
5
|
+
|
|
6
|
+
const baseToast = (overrides: Partial<ToastProps> = {}): ToastProps => ({
|
|
7
|
+
id: 'a',
|
|
8
|
+
index: 0,
|
|
9
|
+
title: 'Saved',
|
|
10
|
+
numberOfToasts: 1,
|
|
11
|
+
orderedToastIds: ['a'],
|
|
12
|
+
...overrides,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('areToastsEqual', () => {
|
|
16
|
+
it('treats two structurally identical toasts as equal', () => {
|
|
17
|
+
expect(areToastsEqual(baseToast(), baseToast())).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it.each<[string, Partial<ToastProps>]>([
|
|
21
|
+
['id', { id: 'b' }],
|
|
22
|
+
['title', { title: 'Changed' }],
|
|
23
|
+
['variant', { variant: 'error' }],
|
|
24
|
+
['description', { description: 'details' }],
|
|
25
|
+
['closeButton', { closeButton: true }],
|
|
26
|
+
['invert', { invert: true }],
|
|
27
|
+
['position', { position: 'top-center' }],
|
|
28
|
+
['dismissible', { dismissible: false }],
|
|
29
|
+
['duration', { duration: 10 }],
|
|
30
|
+
['important', { important: true }],
|
|
31
|
+
['richColors', { richColors: true }],
|
|
32
|
+
['style', { style: { opacity: 0.5 } }],
|
|
33
|
+
['styles', { styles: { title: { fontSize: 9 } } }],
|
|
34
|
+
])('reports a change of %s', (_field, overrides) => {
|
|
35
|
+
expect(areToastsEqual(baseToast(), baseToast(overrides))).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('compares icon and jsx by reference', () => {
|
|
39
|
+
const icon = React.createElement('Icon');
|
|
40
|
+
expect(
|
|
41
|
+
areToastsEqual(baseToast({ icon }), baseToast({ icon })),
|
|
42
|
+
).toBe(true);
|
|
43
|
+
expect(
|
|
44
|
+
areToastsEqual(
|
|
45
|
+
baseToast({ icon }),
|
|
46
|
+
baseToast({ icon: React.createElement('Icon') }),
|
|
47
|
+
),
|
|
48
|
+
).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('compares promiseOptions by reference', () => {
|
|
52
|
+
const promiseOptions = {
|
|
53
|
+
promise: Promise.resolve('ok'),
|
|
54
|
+
loading: 'Saving…',
|
|
55
|
+
error: 'Failed',
|
|
56
|
+
};
|
|
57
|
+
expect(
|
|
58
|
+
areToastsEqual(baseToast({ promiseOptions }), baseToast({ promiseOptions })),
|
|
59
|
+
).toBe(true);
|
|
60
|
+
expect(
|
|
61
|
+
areToastsEqual(
|
|
62
|
+
baseToast({ promiseOptions }),
|
|
63
|
+
baseToast({
|
|
64
|
+
promiseOptions: { ...promiseOptions },
|
|
65
|
+
}),
|
|
66
|
+
),
|
|
67
|
+
).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('compares actions by label, so a fresh onClick closure is not a change', () => {
|
|
71
|
+
expect(
|
|
72
|
+
areToastsEqual(
|
|
73
|
+
baseToast({ action: { label: 'Undo', onClick: () => {} } }),
|
|
74
|
+
baseToast({ action: { label: 'Undo', onClick: () => {} } }),
|
|
75
|
+
),
|
|
76
|
+
).toBe(true);
|
|
77
|
+
|
|
78
|
+
expect(
|
|
79
|
+
areToastsEqual(
|
|
80
|
+
baseToast({ action: { label: 'Undo', onClick: () => {} } }),
|
|
81
|
+
baseToast({ action: { label: 'Retry', onClick: () => {} } }),
|
|
82
|
+
),
|
|
83
|
+
).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('compares a rendered action node by reference', () => {
|
|
87
|
+
const action = React.createElement('Button');
|
|
88
|
+
expect(areToastsEqual(baseToast({ action }), baseToast({ action }))).toBe(
|
|
89
|
+
true,
|
|
90
|
+
);
|
|
91
|
+
expect(
|
|
92
|
+
areToastsEqual(
|
|
93
|
+
baseToast({ action }),
|
|
94
|
+
baseToast({ action: React.createElement('Button') }),
|
|
95
|
+
),
|
|
96
|
+
).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('applies the same rules to cancel', () => {
|
|
100
|
+
expect(
|
|
101
|
+
areToastsEqual(
|
|
102
|
+
baseToast({ cancel: { label: 'Dismiss', onClick: () => {} } }),
|
|
103
|
+
baseToast({ cancel: { label: 'Dismiss', onClick: () => {} } }),
|
|
104
|
+
),
|
|
105
|
+
).toBe(true);
|
|
106
|
+
expect(
|
|
107
|
+
areToastsEqual(
|
|
108
|
+
baseToast({ cancel: { label: 'Dismiss', onClick: () => {} } }),
|
|
109
|
+
baseToast({ cancel: { label: 'Close', onClick: () => {} } }),
|
|
110
|
+
),
|
|
111
|
+
).toBe(false);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('isToastAction', () => {
|
|
116
|
+
it('accepts a label + onClick pair', () => {
|
|
117
|
+
expect(isToastAction({ label: 'Undo', onClick: () => {} })).toBe(true);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it.each<[string, unknown]>([
|
|
121
|
+
['undefined', undefined],
|
|
122
|
+
['null', null],
|
|
123
|
+
['a string', 'Undo'],
|
|
124
|
+
['a React element', React.createElement('Button')],
|
|
125
|
+
['a partial action', { label: 'Undo' }],
|
|
126
|
+
['a non-string label', { label: 7, onClick: () => {} }],
|
|
127
|
+
['a non-function onClick', { label: 'Undo', onClick: 'nope' }],
|
|
128
|
+
])('rejects %s', (_label, value) => {
|
|
129
|
+
expect(isToastAction(value as React.ReactNode)).toBe(false);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toast engine has exactly ONE platform switch — `TOAST_ENTER_DRIVER`, which
|
|
3
|
+
* mechanism plays the DEFAULT enter animation. Both halves are load-bearing, and
|
|
4
|
+
* each one broke the other platform when it was applied universally:
|
|
5
|
+
*
|
|
6
|
+
* web — a `Keyframe` on `entering` is frozen in place by reanimated's web
|
|
7
|
+
* layout-animation cleanup `duration * 5` later, so a second toast
|
|
8
|
+
* lands on top of the first.
|
|
9
|
+
* native — driving the enter imperatively stopped a `bottom-center` toast from
|
|
10
|
+
* painting at all.
|
|
11
|
+
*
|
|
12
|
+
* The invariant these tests protect: EXACTLY ONE of `entering` / `enterTranslateY`
|
|
13
|
+
* is ever set. Both would play the enter twice. Neither would leave the row with no
|
|
14
|
+
* enter animation and, on the imperative path, parked at `opacity: 0` one full
|
|
15
|
+
* `enterTranslateY` from its slot — which is exactly how the native regression
|
|
16
|
+
* presented.
|
|
17
|
+
*/
|
|
18
|
+
import { FadeIn } from 'react-native-reanimated';
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
TOAST_ENTER_DRIVER,
|
|
22
|
+
resolveToastEnterAnimation,
|
|
23
|
+
type ToastEnterDriver,
|
|
24
|
+
} from '../toast/animations';
|
|
25
|
+
import type { ToastPosition } from '../toast/types';
|
|
26
|
+
|
|
27
|
+
interface RNMock {
|
|
28
|
+
Platform: { OS: 'ios' | 'android' | 'web' | 'windows' | 'macos' };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const POSITIONS: ToastPosition[] = ['bottom-center', 'top-center', 'center'];
|
|
32
|
+
const DRIVERS: ToastEnterDriver[] = ['imperative', 'layoutAnimation'];
|
|
33
|
+
|
|
34
|
+
/** Re-evaluate the module against a given `Platform.OS`. */
|
|
35
|
+
const driverFor = (os: RNMock['Platform']['OS']): ToastEnterDriver => {
|
|
36
|
+
let driver: ToastEnterDriver | undefined;
|
|
37
|
+
jest.isolateModules(() => {
|
|
38
|
+
(require('react-native') as RNMock).Platform.OS = os;
|
|
39
|
+
driver = (require('../toast/animations') as { TOAST_ENTER_DRIVER: ToastEnterDriver })
|
|
40
|
+
.TOAST_ENTER_DRIVER;
|
|
41
|
+
});
|
|
42
|
+
if (!driver) {
|
|
43
|
+
throw new Error('module did not evaluate');
|
|
44
|
+
}
|
|
45
|
+
return driver;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
describe('TOAST_ENTER_DRIVER', () => {
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
(require('react-native') as RNMock).Platform.OS = 'ios';
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('is imperative on web only', () => {
|
|
54
|
+
expect(driverFor('web')).toBe('imperative');
|
|
55
|
+
expect(driverFor('ios')).toBe('layoutAnimation');
|
|
56
|
+
expect(driverFor('android')).toBe('layoutAnimation');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('is a real value under the suite’s own platform', () => {
|
|
60
|
+
expect(DRIVERS).toContain(TOAST_ENTER_DRIVER);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
describe('resolveToastEnterAnimation', () => {
|
|
65
|
+
it.each(DRIVERS)(
|
|
66
|
+
'sets exactly one of entering / enterTranslateY (%s), at every position',
|
|
67
|
+
(driver) => {
|
|
68
|
+
for (const position of POSITIONS) {
|
|
69
|
+
const resolved = resolveToastEnterAnimation({
|
|
70
|
+
position,
|
|
71
|
+
enterOverride: undefined,
|
|
72
|
+
driver,
|
|
73
|
+
});
|
|
74
|
+
const set = [resolved.entering, resolved.enterTranslateY].filter(
|
|
75
|
+
(value) => value !== undefined,
|
|
76
|
+
);
|
|
77
|
+
expect({ driver, position, count: set.length }).toEqual({
|
|
78
|
+
driver,
|
|
79
|
+
position,
|
|
80
|
+
count: 1,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
it('drives the default enter imperatively, never through `entering`, on the imperative driver', () => {
|
|
87
|
+
const resolved = resolveToastEnterAnimation({
|
|
88
|
+
position: 'bottom-center',
|
|
89
|
+
enterOverride: undefined,
|
|
90
|
+
driver: 'imperative',
|
|
91
|
+
});
|
|
92
|
+
expect(resolved.entering).toBeUndefined();
|
|
93
|
+
expect(resolved.enterTranslateY).toBe(50);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('travels the other way at top-center', () => {
|
|
97
|
+
expect(
|
|
98
|
+
resolveToastEnterAnimation({
|
|
99
|
+
position: 'top-center',
|
|
100
|
+
enterOverride: undefined,
|
|
101
|
+
driver: 'imperative',
|
|
102
|
+
}).enterTranslateY,
|
|
103
|
+
).toBe(-20);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('drives the default enter through `entering`, never imperatively, on the layout driver', () => {
|
|
107
|
+
const resolved = resolveToastEnterAnimation({
|
|
108
|
+
position: 'bottom-center',
|
|
109
|
+
enterOverride: undefined,
|
|
110
|
+
driver: 'layoutAnimation',
|
|
111
|
+
});
|
|
112
|
+
expect(resolved.entering).toBeDefined();
|
|
113
|
+
expect(resolved.enterTranslateY).toBeUndefined();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it.each(DRIVERS)(
|
|
117
|
+
'hands a consumer override to `entering` and drives nothing imperatively (%s)',
|
|
118
|
+
(driver) => {
|
|
119
|
+
const resolved = resolveToastEnterAnimation({
|
|
120
|
+
position: 'bottom-center',
|
|
121
|
+
enterOverride: FadeIn,
|
|
122
|
+
driver,
|
|
123
|
+
});
|
|
124
|
+
expect(resolved.entering).toBe(FadeIn);
|
|
125
|
+
expect(resolved.enterTranslateY).toBeUndefined();
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
it.each(DRIVERS)(
|
|
130
|
+
"treats 'default' as no override at all (%s)",
|
|
131
|
+
(driver) => {
|
|
132
|
+
expect(
|
|
133
|
+
resolveToastEnterAnimation({
|
|
134
|
+
position: 'bottom-center',
|
|
135
|
+
enterOverride: 'default',
|
|
136
|
+
driver,
|
|
137
|
+
}),
|
|
138
|
+
).toEqual(
|
|
139
|
+
resolveToastEnterAnimation({
|
|
140
|
+
position: 'bottom-center',
|
|
141
|
+
enterOverride: undefined,
|
|
142
|
+
driver,
|
|
143
|
+
}),
|
|
144
|
+
);
|
|
145
|
+
},
|
|
146
|
+
);
|
|
147
|
+
});
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { toast } from '../toast/toast-fns';
|
|
4
|
+
import { toastStore } from '../toast/toast-store';
|
|
5
|
+
import type { ToastProps, ToastType, ToastVariant } from '../toast/types';
|
|
6
|
+
|
|
7
|
+
const stored = (id: string | number): ToastProps => {
|
|
8
|
+
const toastProps = toastStore.getSnapshot().toastsById.get(id);
|
|
9
|
+
if (!toastProps) {
|
|
10
|
+
throw new Error(`No toast in the store for id ${String(id)}`);
|
|
11
|
+
}
|
|
12
|
+
return toastProps;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const flushMicrotasks = async () => {
|
|
16
|
+
await Promise.resolve();
|
|
17
|
+
await Promise.resolve();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('toast()', () => {
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
jest.useFakeTimers();
|
|
23
|
+
toastStore.setConfig({});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
toastStore.dismissToast(undefined);
|
|
28
|
+
jest.runOnlyPendingTimers();
|
|
29
|
+
jest.useRealTimers();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('content routing', () => {
|
|
33
|
+
it('treats a string as the title', () => {
|
|
34
|
+
const id = toast('Saved');
|
|
35
|
+
expect(stored(id)).toMatchObject({ title: 'Saved' });
|
|
36
|
+
expect(stored(id).jsx).toBeUndefined();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('treats a React element as jsx with an empty title', () => {
|
|
40
|
+
const element = React.createElement('Row', null, 'custom');
|
|
41
|
+
const id = toast(element);
|
|
42
|
+
expect(stored(id).title).toBe('');
|
|
43
|
+
expect(stored(id).jsx).toBe(element);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it.each([
|
|
47
|
+
['a number', 42, 'number'],
|
|
48
|
+
['a boolean', true, 'boolean'],
|
|
49
|
+
['null', null, 'object'],
|
|
50
|
+
['undefined', undefined, 'undefined'],
|
|
51
|
+
['an array', ['a', 'b'], 'object'],
|
|
52
|
+
])('throws for %s', (_label, content, typeName) => {
|
|
53
|
+
expect(() => toast(content as React.ReactNode)).toThrow(
|
|
54
|
+
`Toast can be a string or a React element, got ${typeName}`,
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('type → variant', () => {
|
|
60
|
+
it.each<[ToastType, ToastVariant | undefined]>([
|
|
61
|
+
['default', undefined],
|
|
62
|
+
['success', 'success'],
|
|
63
|
+
['error', 'error'],
|
|
64
|
+
['warning', 'warning'],
|
|
65
|
+
['info', 'info'],
|
|
66
|
+
['loading', 'loading'],
|
|
67
|
+
])('maps type %s to variant %s', (type, variant) => {
|
|
68
|
+
const id = toast('x', { type });
|
|
69
|
+
expect(stored(id).variant).toBe(variant);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('leaves the variant absent when no type is given', () => {
|
|
73
|
+
expect(stored(toast('x')).variant).toBeUndefined();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('never leaks the public `type` key into the stored toast', () => {
|
|
77
|
+
const id = toast('x', { type: 'success' });
|
|
78
|
+
expect('type' in stored(id)).toBe(false);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('variant shorthands', () => {
|
|
83
|
+
const shorthands = {
|
|
84
|
+
success: toast.success,
|
|
85
|
+
error: toast.error,
|
|
86
|
+
warning: toast.warning,
|
|
87
|
+
info: toast.info,
|
|
88
|
+
loading: toast.loading,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
it.each<[keyof typeof shorthands, ToastVariant]>([
|
|
92
|
+
['success', 'success'],
|
|
93
|
+
['error', 'error'],
|
|
94
|
+
['warning', 'warning'],
|
|
95
|
+
['info', 'info'],
|
|
96
|
+
['loading', 'loading'],
|
|
97
|
+
])('toast.%s sets variant %s', (method, variant) => {
|
|
98
|
+
const id = shorthands[method]('x');
|
|
99
|
+
expect(stored(id).variant).toBe(variant);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('forwards the remaining options', () => {
|
|
103
|
+
const onDismiss = jest.fn();
|
|
104
|
+
const id = toast.success('x', { duration: 1234, onDismiss, id: 'mine' });
|
|
105
|
+
expect(stored(id)).toMatchObject({
|
|
106
|
+
id: 'mine',
|
|
107
|
+
duration: 1234,
|
|
108
|
+
variant: 'success',
|
|
109
|
+
});
|
|
110
|
+
expect(stored(id).onDismiss).toBe(onDismiss);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
describe('toast.custom', () => {
|
|
115
|
+
it('stores the element as jsx with no variant', () => {
|
|
116
|
+
const element = React.createElement('Row', null, 'custom');
|
|
117
|
+
const id = toast.custom(element);
|
|
118
|
+
expect(stored(id)).toMatchObject({ title: '', jsx: element });
|
|
119
|
+
expect(stored(id).variant).toBeUndefined();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('keeps action and description available to the renderer', () => {
|
|
123
|
+
const onClick = jest.fn();
|
|
124
|
+
const id = toast.custom(React.createElement('Row'), {
|
|
125
|
+
description: 'details',
|
|
126
|
+
action: { label: 'Undo', onClick },
|
|
127
|
+
});
|
|
128
|
+
expect(stored(id)).toMatchObject({
|
|
129
|
+
description: 'details',
|
|
130
|
+
action: { label: 'Undo', onClick },
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('toast.promise', () => {
|
|
136
|
+
it('shows the loading title first, then the formatted success title', async () => {
|
|
137
|
+
const id = toast.promise(Promise.resolve({ name: 'Nate' }), {
|
|
138
|
+
loading: 'Saving…',
|
|
139
|
+
success: (result) => `Saved ${result.name}`,
|
|
140
|
+
error: 'Failed',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
expect(stored(id)).toMatchObject({
|
|
144
|
+
title: 'Saving…',
|
|
145
|
+
variant: 'loading',
|
|
146
|
+
});
|
|
147
|
+
expect(stored(id).promiseOptions).toBeDefined();
|
|
148
|
+
|
|
149
|
+
await flushMicrotasks();
|
|
150
|
+
|
|
151
|
+
expect(stored(id)).toMatchObject({
|
|
152
|
+
title: 'Saved Nate',
|
|
153
|
+
variant: 'success',
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('formats the rejection through the error callback', async () => {
|
|
158
|
+
const id = toast.promise(Promise.reject(new Error('offline')), {
|
|
159
|
+
loading: 'Saving…',
|
|
160
|
+
success: () => 'Saved',
|
|
161
|
+
error: (error) =>
|
|
162
|
+
`Failed: ${error instanceof Error ? error.message : 'unknown'}`,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
await flushMicrotasks();
|
|
166
|
+
|
|
167
|
+
expect(stored(id)).toMatchObject({
|
|
168
|
+
title: 'Failed: offline',
|
|
169
|
+
variant: 'error',
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('forwards the remaining options and the loading styles', async () => {
|
|
174
|
+
const loadingStyles = { title: { fontSize: 11 } };
|
|
175
|
+
const id = toast.promise(Promise.resolve('ok'), {
|
|
176
|
+
id: 'job',
|
|
177
|
+
duration: 2500,
|
|
178
|
+
loading: 'Saving…',
|
|
179
|
+
success: (result) => result,
|
|
180
|
+
error: 'Failed',
|
|
181
|
+
styles: { loading: loadingStyles },
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(id).toBe('job');
|
|
185
|
+
expect(stored(id)).toMatchObject({ duration: 2500 });
|
|
186
|
+
expect(stored(id).styles).toBe(loadingStyles);
|
|
187
|
+
|
|
188
|
+
await flushMicrotasks();
|
|
189
|
+
expect(stored(id).title).toBe('ok');
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
describe('return values', () => {
|
|
194
|
+
it('hands back the store id from every method', () => {
|
|
195
|
+
expect(toast('a')).toBe(1);
|
|
196
|
+
expect(toast.success('b')).toBe(2);
|
|
197
|
+
expect(toast.error('c')).toBe(3);
|
|
198
|
+
expect(toast.warning('d')).toBe(4);
|
|
199
|
+
expect(toast.info('e')).toBe(5);
|
|
200
|
+
expect(toast.loading('f')).toBe(6);
|
|
201
|
+
expect(toast.custom(React.createElement('Row'))).toBe(7);
|
|
202
|
+
expect(
|
|
203
|
+
toast.promise(Promise.resolve('x'), {
|
|
204
|
+
loading: 'l',
|
|
205
|
+
success: (r) => r,
|
|
206
|
+
error: 'e',
|
|
207
|
+
}),
|
|
208
|
+
).toBe(8);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it('respects a caller-supplied id', () => {
|
|
212
|
+
expect(toast('a', { id: 'mine' })).toBe('mine');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('dismiss returns the id it dismissed, and nothing for dismiss-all', () => {
|
|
216
|
+
const id = toast('a');
|
|
217
|
+
expect(toast.dismiss(id)).toBe(id);
|
|
218
|
+
toast('b');
|
|
219
|
+
expect(toast.dismiss()).toBeUndefined();
|
|
220
|
+
expect(toastStore.getSnapshot().toasts).toHaveLength(0);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('wiggle returns nothing', () => {
|
|
224
|
+
const id = toast('a');
|
|
225
|
+
expect(toast.wiggle(id)).toBeUndefined();
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('updates an existing toast in place when the same id is reused', () => {
|
|
230
|
+
toast('pending', { id: 'job' });
|
|
231
|
+
toast.success('done', { id: 'job' });
|
|
232
|
+
|
|
233
|
+
const state = toastStore.getSnapshot();
|
|
234
|
+
expect(state.toasts).toHaveLength(1);
|
|
235
|
+
expect(state.toasts[0]).toMatchObject({
|
|
236
|
+
title: 'done',
|
|
237
|
+
variant: 'success',
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
});
|