@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
package/src/toast/index.tsx
CHANGED
|
@@ -1,132 +1,56 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<BaseOuter>{children}</BaseOuter>
|
|
31
|
-
</View>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Direct access to the Sonner API. Use sparingly — `toast()` covers the
|
|
37
|
-
* common case and keeps the surface tied to bloom's themed look.
|
|
38
|
-
*/
|
|
39
|
-
export const api = sonner;
|
|
40
|
-
|
|
41
|
-
function dispatch(
|
|
42
|
-
content: React.ReactNode,
|
|
43
|
-
type: ToastType,
|
|
44
|
-
options: BaseToastOptions = {},
|
|
45
|
-
): void {
|
|
46
|
-
const id = nanoid();
|
|
47
|
-
if (typeof content === 'string') {
|
|
48
|
-
sonner.custom(
|
|
49
|
-
<ToastConfigProvider id={id} type={type}>
|
|
50
|
-
<OuterWrapper>
|
|
51
|
-
<ToastIcon />
|
|
52
|
-
<ToastText>{content}</ToastText>
|
|
53
|
-
</OuterWrapper>
|
|
54
|
-
</ToastConfigProvider>,
|
|
55
|
-
{
|
|
56
|
-
...options,
|
|
57
|
-
id,
|
|
58
|
-
duration: options?.duration ?? DURATION,
|
|
59
|
-
},
|
|
60
|
-
);
|
|
61
|
-
} else if (isValidElement(content)) {
|
|
62
|
-
sonner.custom(
|
|
63
|
-
<ToastConfigProvider id={id} type={type}>
|
|
64
|
-
{content}
|
|
65
|
-
</ToastConfigProvider>,
|
|
66
|
-
{
|
|
67
|
-
...options,
|
|
68
|
-
id,
|
|
69
|
-
duration: options?.duration ?? DURATION,
|
|
70
|
-
},
|
|
71
|
-
);
|
|
72
|
-
} else {
|
|
73
|
-
throw new Error(
|
|
74
|
-
`Toast can be a string or a React element, got ${typeof content}`,
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Toaster } from './Toaster';
|
|
4
|
+
import type { ToasterProps } from './types';
|
|
5
|
+
|
|
6
|
+
export { toast } from './toast-fns';
|
|
7
|
+
export { Toaster } from './Toaster';
|
|
8
|
+
export { toastDefaults } from './constants';
|
|
9
|
+
|
|
10
|
+
export type {
|
|
11
|
+
AutoWiggle,
|
|
12
|
+
PromiseStyles,
|
|
13
|
+
PromiseToastOptions,
|
|
14
|
+
ToastAction,
|
|
15
|
+
ToastAnimation,
|
|
16
|
+
ToastEntryExitAnimation,
|
|
17
|
+
ToasterProps,
|
|
18
|
+
ToastFn,
|
|
19
|
+
ToastHostProps,
|
|
20
|
+
ToastOptions,
|
|
21
|
+
ToastPosition,
|
|
22
|
+
ToastProps,
|
|
23
|
+
ToastRef,
|
|
24
|
+
ToastStyles,
|
|
25
|
+
ToastSwipeDirection,
|
|
26
|
+
ToastTheme,
|
|
27
|
+
ToastType,
|
|
28
|
+
ToastVariant,
|
|
29
|
+
} from './types';
|
|
78
30
|
|
|
79
31
|
/**
|
|
80
|
-
*
|
|
32
|
+
* The toast stack. Mount this ONCE near the app root — `OxyProvider` already
|
|
33
|
+
* does, so most apps never write it themselves.
|
|
81
34
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
35
|
+
* Every default (position, swipe direction, offset, gap, `visibleToasts`,
|
|
36
|
+
* duration, pause-when-hidden) comes from `toastDefaults`, which `Toaster`
|
|
37
|
+
* applies; passing a prop here overrides exactly that one.
|
|
85
38
|
*
|
|
86
|
-
* ```
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* toast.error('Network error', { duration: 5000 });
|
|
90
|
-
* toast.dismiss(id);
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <ToastOutlet />
|
|
41
|
+
* <ToastOutlet position="top-center" visibleToasts={5} />
|
|
91
42
|
* ```
|
|
92
43
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
44
|
+
* On iOS a toast that must appear above a native modal needs the overlay host
|
|
45
|
+
* injected — Bloom does not depend on `react-native-screens` itself:
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* import { FullWindowOverlay } from 'react-native-screens';
|
|
49
|
+
* <ToastOutlet ToasterOverlayWrapper={FullWindowOverlay} />
|
|
50
|
+
* ```
|
|
95
51
|
*/
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
success: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
99
|
-
error: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
100
|
-
warning: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
101
|
-
info: (content: React.ReactNode, options?: Omit<BaseToastOptions, 'type'>) => void;
|
|
102
|
-
dismiss: (id?: string | number) => void;
|
|
52
|
+
export function ToastOutlet(props: ToasterProps) {
|
|
53
|
+
return <Toaster {...props} />;
|
|
103
54
|
}
|
|
104
55
|
|
|
105
|
-
|
|
106
|
-
dispatch(content, options.type ?? 'default', options);
|
|
107
|
-
}) as ToastFn;
|
|
108
|
-
|
|
109
|
-
toastImpl.success = (content, options) => dispatch(content, 'success', options ?? {});
|
|
110
|
-
toastImpl.error = (content, options) => dispatch(content, 'error', options ?? {});
|
|
111
|
-
toastImpl.warning = (content, options) => dispatch(content, 'warning', options ?? {});
|
|
112
|
-
toastImpl.info = (content, options) => dispatch(content, 'info', options ?? {});
|
|
113
|
-
toastImpl.dismiss = (id) => sonner.dismiss(id);
|
|
114
|
-
|
|
115
|
-
export const toast: ToastFn = toastImpl;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Alias of `toast` kept for compatibility with the original 0.4.x surface
|
|
119
|
-
* where `show()` was the documented entry point. New code should prefer
|
|
120
|
-
* `toast()` directly.
|
|
121
|
-
*/
|
|
122
|
-
export const show: ToastFn = toastImpl;
|
|
123
|
-
|
|
124
|
-
/** Re-export the Toast function type so callers can refer to it. */
|
|
125
|
-
export type Toast = ToastFn;
|
|
126
|
-
|
|
127
|
-
const wrapperStyles = StyleSheet.create({
|
|
128
|
-
container: {
|
|
129
|
-
paddingHorizontal: 20,
|
|
130
|
-
width: '100%',
|
|
131
|
-
},
|
|
132
|
-
});
|
|
56
|
+
ToastOutlet.displayName = 'ToastOutlet';
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived from sonner-native v0.26.4 — src/position-utils.ts
|
|
3
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
4
|
+
*
|
|
5
|
+
* PURE geometry, called from plain JS. Upstream runs `calculateToastPosition`
|
|
6
|
+
* inside a Reanimated mapper (hence its `'worklet'` directive); Bloom computes the
|
|
7
|
+
* target in React and drives the shared value imperatively instead, because an
|
|
8
|
+
* animation returned from a mapper never ticks on web — see `use-animated-target.ts`.
|
|
9
|
+
* That also makes every function here directly unit-testable.
|
|
10
|
+
*
|
|
11
|
+
* Upstream's non-null assertions on the ordered id lookups are replaced with real
|
|
12
|
+
* guards: an id can genuinely be missing for a frame while the store's ordering
|
|
13
|
+
* and the rendered rows converge.
|
|
14
|
+
*/
|
|
15
|
+
import { ESTIMATED_TOAST_HEIGHT, MIN_STACK_SCALE_X } from './constants';
|
|
16
|
+
import type { ToastPosition, ToastProps } from './types';
|
|
17
|
+
|
|
18
|
+
export const getOrderedToastIds = (
|
|
19
|
+
toasts: ToastProps[],
|
|
20
|
+
position: ToastPosition,
|
|
21
|
+
enableStacking: boolean,
|
|
22
|
+
): Array<string | number> => {
|
|
23
|
+
if (enableStacking) {
|
|
24
|
+
// Already in rendering order — the Toaster reverses top-center up front.
|
|
25
|
+
return toasts.map((t) => t.id);
|
|
26
|
+
}
|
|
27
|
+
return position === 'top-center'
|
|
28
|
+
? toasts.map((t) => t.id).reverse()
|
|
29
|
+
: toasts.map((t) => t.id);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* How much a buried row is squeezed horizontally, so the stack reads as depth.
|
|
34
|
+
*
|
|
35
|
+
* Scale rather than width: changing the real width would rewrap the text. Returns
|
|
36
|
+
* 1 (no squeeze) for a single row, an expanded stack, stacking turned off, or
|
|
37
|
+
* before the window width is known.
|
|
38
|
+
*/
|
|
39
|
+
export const calculateStackScaleX = ({
|
|
40
|
+
index,
|
|
41
|
+
numberOfToasts,
|
|
42
|
+
enableStacking,
|
|
43
|
+
position,
|
|
44
|
+
isExpanded,
|
|
45
|
+
stackGap,
|
|
46
|
+
screenWidth,
|
|
47
|
+
}: {
|
|
48
|
+
index: number;
|
|
49
|
+
numberOfToasts: number;
|
|
50
|
+
enableStacking: boolean;
|
|
51
|
+
position: ToastPosition;
|
|
52
|
+
isExpanded: boolean;
|
|
53
|
+
stackGap: number;
|
|
54
|
+
screenWidth: number;
|
|
55
|
+
}): number => {
|
|
56
|
+
if (!enableStacking || numberOfToasts <= 1 || isExpanded || screenWidth <= 0) {
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const distanceFromFront =
|
|
61
|
+
position === 'top-center' ? index : numberOfToasts - index - 1;
|
|
62
|
+
const narrowAmount = stackGap * distanceFromFront * 2;
|
|
63
|
+
return Math.max(MIN_STACK_SCALE_X, 1 - narrowAmount / screenWidth);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const heightOf = (
|
|
67
|
+
allToastHeights: Record<string | number, number>,
|
|
68
|
+
id: string | number | undefined,
|
|
69
|
+
): number => {
|
|
70
|
+
if (id === undefined) {
|
|
71
|
+
return ESTIMATED_TOAST_HEIGHT;
|
|
72
|
+
}
|
|
73
|
+
// A measured 0 is not a real height — treat it as "not measured yet".
|
|
74
|
+
return allToastHeights[id] || ESTIMATED_TOAST_HEIGHT;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const calculateToastPosition = ({
|
|
78
|
+
index,
|
|
79
|
+
numberOfToasts,
|
|
80
|
+
enableStacking,
|
|
81
|
+
position,
|
|
82
|
+
allToastHeights,
|
|
83
|
+
gap,
|
|
84
|
+
orderedToastIds,
|
|
85
|
+
isExpanded,
|
|
86
|
+
stackGap,
|
|
87
|
+
}: {
|
|
88
|
+
index: number;
|
|
89
|
+
numberOfToasts: number;
|
|
90
|
+
enableStacking: boolean;
|
|
91
|
+
position: ToastPosition;
|
|
92
|
+
allToastHeights: Record<string | number, number>;
|
|
93
|
+
gap: number;
|
|
94
|
+
orderedToastIds: Array<string | number>;
|
|
95
|
+
isExpanded: boolean;
|
|
96
|
+
stackGap: number;
|
|
97
|
+
}): number => {
|
|
98
|
+
const effectiveEnableStacking = enableStacking && !isExpanded;
|
|
99
|
+
|
|
100
|
+
// Center anchors at top:50% of the screen (top edge of toast = center line).
|
|
101
|
+
// Shift by -frontHeight/2 so the front toast is visually centered on the line.
|
|
102
|
+
const centerShift =
|
|
103
|
+
position === 'center'
|
|
104
|
+
? -(heightOf(allToastHeights, orderedToastIds[numberOfToasts - 1]) / 2)
|
|
105
|
+
: 0;
|
|
106
|
+
|
|
107
|
+
if (effectiveEnableStacking) {
|
|
108
|
+
const currentHeight = heightOf(allToastHeights, orderedToastIds[index]);
|
|
109
|
+
|
|
110
|
+
if (position === 'top-center') {
|
|
111
|
+
const frontHeight = heightOf(allToastHeights, orderedToastIds[0]);
|
|
112
|
+
return frontHeight + index * stackGap - currentHeight;
|
|
113
|
+
}
|
|
114
|
+
// bottom-center and center
|
|
115
|
+
const frontHeight = heightOf(
|
|
116
|
+
allToastHeights,
|
|
117
|
+
orderedToastIds[numberOfToasts - 1],
|
|
118
|
+
);
|
|
119
|
+
const distFromFront = numberOfToasts - 1 - index;
|
|
120
|
+
return (
|
|
121
|
+
centerShift - (frontHeight + distFromFront * stackGap - currentHeight)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const effectiveGap = isExpanded ? stackGap : gap;
|
|
126
|
+
|
|
127
|
+
if (position === 'top-center') {
|
|
128
|
+
let totalOffset = 0;
|
|
129
|
+
for (let i = 0; i < index; i++) {
|
|
130
|
+
const toastId = orderedToastIds[i];
|
|
131
|
+
if (toastId === undefined) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
totalOffset += heightOf(allToastHeights, toastId) + effectiveGap;
|
|
135
|
+
}
|
|
136
|
+
return totalOffset;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// bottom-center and center
|
|
140
|
+
let totalOffset = 0;
|
|
141
|
+
for (let i = numberOfToasts - 1; i > index; i--) {
|
|
142
|
+
const toastId = orderedToastIds[i];
|
|
143
|
+
if (toastId === undefined) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
totalOffset += heightOf(allToastHeights, toastId) + effectiveGap;
|
|
147
|
+
}
|
|
148
|
+
return centerShift - totalOffset;
|
|
149
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived from sonner-native v0.26.4 — src/positioner-utils.ts
|
|
3
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
4
|
+
*
|
|
5
|
+
* Pure geometry for the per-position container: `position: 'absolute'` is correct
|
|
6
|
+
* here because the toast host provides a viewport-sized containing block (see
|
|
7
|
+
* `ToastHost`), which is what keeps this module platform-agnostic.
|
|
8
|
+
*
|
|
9
|
+
* INVARIANT: a row must never be laid out outside its container's box. See
|
|
10
|
+
* `getContainerStyle`.
|
|
11
|
+
*/
|
|
12
|
+
import type { ViewStyle } from 'react-native';
|
|
13
|
+
import { ESTIMATED_TOAST_HEIGHT, OUTSIDE_PRESS_PADDING } from './constants';
|
|
14
|
+
import type { ToastPosition } from './types';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ALL FOUR EDGES ARE PINNED, for every position. `Positioner` then overrides the
|
|
18
|
+
* one anchored edge with `getInsetValues`, so the container still spans the host in
|
|
19
|
+
* the other direction and always has a REAL HEIGHT.
|
|
20
|
+
*
|
|
21
|
+
* That is the whole point. This used to be `{position:'absolute', width:'100%'}`
|
|
22
|
+
* plus an inset of only `{bottom: N}` — and since every row inside is ITSELF
|
|
23
|
+
* `position:'absolute'`, the container had no in-flow content and measured ZERO
|
|
24
|
+
* HEIGHT, so every row was laid out entirely OUTSIDE its parent's box. Measured on
|
|
25
|
+
* web: a bottom-center container was a 0-height line at y=884 with its rows at
|
|
26
|
+
* y=784 and y=838, i.e. at NEGATIVE offsets (`top: -46px`) from a zero-height
|
|
27
|
+
* parent. The DOM does not clip, so web rendered it anyway; Android does not
|
|
28
|
+
* tolerate it, and `bottom-center` — the DEFAULT position — painted nothing at all.
|
|
29
|
+
*
|
|
30
|
+
* Two things that look like they would work here and do NOT:
|
|
31
|
+
* - `justifyContent` cannot place the rows. They are absolutely positioned, so it
|
|
32
|
+
* has no effect on them; the row's own anchor (`top: 0` / `bottom: 0` /
|
|
33
|
+
* `top: '50%'`) does the placing.
|
|
34
|
+
* - PADDING cannot supply the edge offset. In CSS an absolutely positioned child
|
|
35
|
+
* resolves against its ancestor's PADDING BOX, so padding does not inset it —
|
|
36
|
+
* while Yoga DOES inset it. Padding would have moved the rows on native and left
|
|
37
|
+
* them at the screen edge on web. The offset therefore stays an inset on the
|
|
38
|
+
* container itself, which behaves identically on both.
|
|
39
|
+
*/
|
|
40
|
+
export const getContainerStyle = (): ViewStyle => ({
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
top: 0,
|
|
43
|
+
right: 0,
|
|
44
|
+
bottom: 0,
|
|
45
|
+
left: 0,
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
// Enter and exit animations translate a row past the container edge on purpose.
|
|
48
|
+
overflow: 'visible',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* How far the stack sits from its screen edge. A falsy `offset` means "derive from
|
|
53
|
+
* the safe area": `inset + 8`, or 16 when there is no inset.
|
|
54
|
+
*
|
|
55
|
+
* `Positioner` applies this over ONE of `getContainerStyle`'s four pinned edges;
|
|
56
|
+
* `calculateOutsidePressableArea` reads the same numbers as a plain edge distance.
|
|
57
|
+
*/
|
|
58
|
+
export const getInsetValues = ({
|
|
59
|
+
position,
|
|
60
|
+
offset,
|
|
61
|
+
safeAreaInsets,
|
|
62
|
+
}: {
|
|
63
|
+
position: ToastPosition;
|
|
64
|
+
offset?: number;
|
|
65
|
+
safeAreaInsets?: { top: number; bottom: number };
|
|
66
|
+
}): { top?: number; bottom?: number } => {
|
|
67
|
+
const { top = 0, bottom = 0 } = safeAreaInsets || {};
|
|
68
|
+
|
|
69
|
+
if (position === 'bottom-center') {
|
|
70
|
+
if (offset) return { bottom: offset };
|
|
71
|
+
return { bottom: bottom > 0 ? bottom + 8 : 16 };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (position === 'top-center') {
|
|
75
|
+
if (offset) return { top: offset };
|
|
76
|
+
return { top: top > 0 ? top + 8 : 16 };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The area OUTSIDE the toast stack, used to collapse an expanded stack on press.
|
|
84
|
+
* It deliberately stops short of the stack itself so a press on a toast still
|
|
85
|
+
* reaches the toast.
|
|
86
|
+
*/
|
|
87
|
+
export const calculateOutsidePressableArea = ({
|
|
88
|
+
position,
|
|
89
|
+
toastHeights,
|
|
90
|
+
gap,
|
|
91
|
+
visibleToasts,
|
|
92
|
+
insetValues,
|
|
93
|
+
}: {
|
|
94
|
+
position: ToastPosition;
|
|
95
|
+
toastHeights: Record<string | number, number>;
|
|
96
|
+
gap: number;
|
|
97
|
+
visibleToasts: number;
|
|
98
|
+
insetValues: { top?: number; bottom?: number };
|
|
99
|
+
}): ViewStyle => {
|
|
100
|
+
const measuredHeights = Object.values(toastHeights);
|
|
101
|
+
const hasMeasurements = measuredHeights.length > 0;
|
|
102
|
+
|
|
103
|
+
// Upstream counts `min(measured.length, visibleToasts)` rows and only THEN
|
|
104
|
+
// falls back to the estimate — which makes the fallback multiply by zero, so
|
|
105
|
+
// an unmeasured stack reserved nothing and the press area ran underneath it.
|
|
106
|
+
// Reserve a full stack instead: this area is only rendered while the stack is
|
|
107
|
+
// expanded, so over-reserving is the safe direction.
|
|
108
|
+
const rowCount = hasMeasurements
|
|
109
|
+
? Math.min(measuredHeights.length, visibleToasts)
|
|
110
|
+
: visibleToasts;
|
|
111
|
+
|
|
112
|
+
const totalToastHeight = hasMeasurements
|
|
113
|
+
? measuredHeights.slice(0, rowCount).reduce((sum, height) => sum + height, 0)
|
|
114
|
+
: ESTIMATED_TOAST_HEIGHT * rowCount;
|
|
115
|
+
|
|
116
|
+
const gapHeight = gap * Math.max(0, rowCount - 1);
|
|
117
|
+
const stackHeight = totalToastHeight + gapHeight + OUTSIDE_PRESS_PADDING;
|
|
118
|
+
|
|
119
|
+
if (position === 'top-center') {
|
|
120
|
+
const topOffset = (insetValues.top || 40) + stackHeight;
|
|
121
|
+
return {
|
|
122
|
+
position: 'absolute',
|
|
123
|
+
top: topOffset,
|
|
124
|
+
bottom: 0,
|
|
125
|
+
left: 0,
|
|
126
|
+
right: 0,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (position === 'bottom-center') {
|
|
131
|
+
const bottomOffset = (insetValues.bottom || 40) + stackHeight;
|
|
132
|
+
return {
|
|
133
|
+
position: 'absolute',
|
|
134
|
+
top: 0,
|
|
135
|
+
bottom: bottomOffset,
|
|
136
|
+
left: 0,
|
|
137
|
+
right: 0,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return { display: 'none' };
|
|
142
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived from sonner-native v0.26.4 — src/toast-comparator.ts
|
|
3
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
4
|
+
*
|
|
5
|
+
* Drives `autoWiggleOnUpdate: 'toast-change'`: an update-by-id only wiggles the
|
|
6
|
+
* row when something a user can actually see changed. `description` is
|
|
7
|
+
* deliberately typed `string` (not `ReactNode`) so this stays a value compare —
|
|
8
|
+
* a ReactNode would differ on every parent re-render and wiggle forever.
|
|
9
|
+
*/
|
|
10
|
+
import { isToastAction, type ToastProps } from './types';
|
|
11
|
+
|
|
12
|
+
const areActionsEqual = (a: ToastProps['action'], b: ToastProps['action']) => {
|
|
13
|
+
if (isToastAction(a) && isToastAction(b)) {
|
|
14
|
+
return a.label === b.label;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return a === b;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const areToastsEqual = (a: ToastProps, b: ToastProps) => {
|
|
21
|
+
return (
|
|
22
|
+
a.id === b.id &&
|
|
23
|
+
a.title === b.title &&
|
|
24
|
+
a.variant === b.variant &&
|
|
25
|
+
a.description === b.description &&
|
|
26
|
+
a.closeButton === b.closeButton &&
|
|
27
|
+
a.invert === b.invert &&
|
|
28
|
+
a.position === b.position &&
|
|
29
|
+
a.dismissible === b.dismissible &&
|
|
30
|
+
a.icon === b.icon &&
|
|
31
|
+
a.jsx === b.jsx &&
|
|
32
|
+
a.duration === b.duration &&
|
|
33
|
+
a.style === b.style &&
|
|
34
|
+
a.styles === b.styles &&
|
|
35
|
+
a.important === b.important &&
|
|
36
|
+
a.richColors === b.richColors &&
|
|
37
|
+
a.promiseOptions === b.promiseOptions &&
|
|
38
|
+
areActionsEqual(a.action, b.action) &&
|
|
39
|
+
areActionsEqual(a.cancel, b.cancel)
|
|
40
|
+
);
|
|
41
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derived from sonner-native v0.26.4 — src/toast-fns.ts
|
|
3
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
4
|
+
*
|
|
5
|
+
* This module is the ONLY translation layer between the public API and the
|
|
6
|
+
* engine:
|
|
7
|
+
* - the public option `type` becomes the internal `variant` (`'default'` →
|
|
8
|
+
* absent, so an unqualified toast renders neutral);
|
|
9
|
+
* - a `ReactNode` content becomes either `title` (string) or `jsx` (element).
|
|
10
|
+
* Nothing downstream of here knows the word `type`.
|
|
11
|
+
*/
|
|
12
|
+
import { isValidElement, type ReactElement, type ReactNode } from 'react';
|
|
13
|
+
import { toastStore } from './toast-store';
|
|
14
|
+
import type {
|
|
15
|
+
PromiseToastOptions,
|
|
16
|
+
ToastFn,
|
|
17
|
+
ToastOptions,
|
|
18
|
+
ToastType,
|
|
19
|
+
ToastVariant,
|
|
20
|
+
} from './types';
|
|
21
|
+
|
|
22
|
+
const TYPE_TO_VARIANT: Record<ToastType, ToastVariant | undefined> = {
|
|
23
|
+
default: undefined,
|
|
24
|
+
success: 'success',
|
|
25
|
+
error: 'error',
|
|
26
|
+
warning: 'warning',
|
|
27
|
+
info: 'info',
|
|
28
|
+
loading: 'loading',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const resolveContent = (
|
|
32
|
+
content: ReactNode,
|
|
33
|
+
): { title: string; jsx?: ReactNode } => {
|
|
34
|
+
if (typeof content === 'string') {
|
|
35
|
+
return { title: content };
|
|
36
|
+
}
|
|
37
|
+
if (isValidElement(content)) {
|
|
38
|
+
// A custom element owns the whole row, so there is no title to render.
|
|
39
|
+
return { title: '', jsx: content };
|
|
40
|
+
}
|
|
41
|
+
throw new Error(
|
|
42
|
+
`Toast can be a string or a React element, got ${typeof content}`,
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const dispatch = (
|
|
47
|
+
content: ReactNode,
|
|
48
|
+
options: ToastOptions,
|
|
49
|
+
variant?: ToastVariant,
|
|
50
|
+
): string | number => {
|
|
51
|
+
const { type, ...rest } = options;
|
|
52
|
+
return toastStore.addToast({
|
|
53
|
+
...rest,
|
|
54
|
+
...resolveContent(content),
|
|
55
|
+
variant: variant ?? (type === undefined ? undefined : TYPE_TO_VARIANT[type]),
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const toast: ToastFn = Object.assign(
|
|
60
|
+
(content: ReactNode, options: ToastOptions = {}) => dispatch(content, options),
|
|
61
|
+
{
|
|
62
|
+
success: (content: ReactNode, options: Omit<ToastOptions, 'type'> = {}) =>
|
|
63
|
+
dispatch(content, options, 'success'),
|
|
64
|
+
|
|
65
|
+
error: (content: ReactNode, options: Omit<ToastOptions, 'type'> = {}) =>
|
|
66
|
+
dispatch(content, options, 'error'),
|
|
67
|
+
|
|
68
|
+
warning: (content: ReactNode, options: Omit<ToastOptions, 'type'> = {}) =>
|
|
69
|
+
dispatch(content, options, 'warning'),
|
|
70
|
+
|
|
71
|
+
info: (content: ReactNode, options: Omit<ToastOptions, 'type'> = {}) =>
|
|
72
|
+
dispatch(content, options, 'info'),
|
|
73
|
+
|
|
74
|
+
loading: (content: ReactNode, options: Omit<ToastOptions, 'type'> = {}) =>
|
|
75
|
+
dispatch(content, options, 'loading'),
|
|
76
|
+
|
|
77
|
+
custom: (jsx: ReactElement, options: Omit<ToastOptions, 'type'> = {}) =>
|
|
78
|
+
dispatch(jsx, options),
|
|
79
|
+
|
|
80
|
+
promise: <T,>(promise: Promise<T>, options: PromiseToastOptions<T>) => {
|
|
81
|
+
const { loading, success, error, styles, ...rest } = options;
|
|
82
|
+
return toastStore.addToast({
|
|
83
|
+
...rest,
|
|
84
|
+
title: loading,
|
|
85
|
+
variant: 'loading',
|
|
86
|
+
styles: styles?.loading,
|
|
87
|
+
promiseOptions: {
|
|
88
|
+
// Mapping the result to its title here is what keeps `PromiseOptions`
|
|
89
|
+
// non-generic — the store never sees the caller's result type.
|
|
90
|
+
promise: promise.then(success),
|
|
91
|
+
loading,
|
|
92
|
+
error,
|
|
93
|
+
styles,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
dismiss: (id?: string | number) => toastStore.dismissToast(id),
|
|
99
|
+
|
|
100
|
+
wiggle: (id: string | number) => {
|
|
101
|
+
toastStore.wiggleToast(id);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
);
|