@oxyhq/bloom 0.50.1 → 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 +5 -3
- package/lib/commonjs/bottom-sheet/index.web.js.map +1 -1
- package/lib/commonjs/context-menu/index.web.js +6 -9
- package/lib/commonjs/context-menu/index.web.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.js +12 -7
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +18 -22
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogHeader.js +61 -12
- package/lib/commonjs/dialog/DialogHeader.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 +5 -8
- package/lib/commonjs/menu/index.web.js.map +1 -1
- package/lib/commonjs/popover/index.web.js +8 -9
- 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 +5 -8
- package/lib/commonjs/select/index.web.js.map +1 -1
- package/lib/commonjs/slider/Slider.js +4 -9
- package/lib/commonjs/slider/Slider.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/switch/Switch.js +4 -8
- package/lib/commonjs/switch/Switch.js.map +1 -1
- 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/tabs/Tabs.js +3 -8
- package/lib/commonjs/tabs/Tabs.js.map +1 -1
- 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 +5 -3
- package/lib/module/bottom-sheet/index.web.js.map +1 -1
- package/lib/module/context-menu/index.web.js +6 -9
- package/lib/module/context-menu/index.web.js.map +1 -1
- package/lib/module/dialog/Dialog.js +12 -7
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +18 -22
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogHeader.js +61 -12
- package/lib/module/dialog/DialogHeader.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 +5 -8
- package/lib/module/menu/index.web.js.map +1 -1
- package/lib/module/popover/index.web.js +8 -9
- 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 +5 -8
- package/lib/module/select/index.web.js.map +1 -1
- package/lib/module/slider/Slider.js +4 -9
- package/lib/module/slider/Slider.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/switch/Switch.js +4 -8
- package/lib/module/switch/Switch.js.map +1 -1
- 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/tabs/Tabs.js +3 -8
- package/lib/module/tabs/Tabs.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogHeader.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/slider/Slider.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/switch/Switch.d.ts.map +1 -1
- 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/tabs/Tabs.d.ts.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogHeader.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/slider/Slider.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/switch/Switch.d.ts.map +1 -1
- 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/tabs/Tabs.d.ts.map +1 -1
- 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 +4 -3
- package/src/context-menu/index.web.tsx +6 -6
- package/src/dialog/Dialog.tsx +7 -4
- package/src/dialog/Dialog.web.tsx +14 -14
- package/src/dialog/DialogHeader.tsx +72 -17
- package/src/index.ts +4 -1
- package/src/index.web.ts +4 -1
- package/src/menu/index.web.tsx +5 -5
- package/src/popover/index.web.tsx +8 -6
- 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 +5 -5
- package/src/slider/Slider.tsx +3 -5
- package/src/styles/web-view-style.ts +21 -0
- package/src/switch/Switch.tsx +4 -5
- 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/tabs/Tabs.tsx +3 -5
- 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 -272
- 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 -263
- 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 -271
- 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,411 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToastRow = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
|
+
var _animations = require("./animations.js");
|
|
11
|
+
var _constants = require("./constants.js");
|
|
12
|
+
var _context = require("./context.js");
|
|
13
|
+
var _positionUtils = require("./position-utils.js");
|
|
14
|
+
var _useAnimatedTarget = require("./use-animated-target.js");
|
|
15
|
+
var _ToastContent = require("./ToastContent.js");
|
|
16
|
+
var _ToastSwipeHandler = require("./ToastSwipeHandler.js");
|
|
17
|
+
var _toastStore = require("./toast-store.js");
|
|
18
|
+
var _useToastPosition = require("./use-toast-position.js");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
|
+
/**
|
|
22
|
+
* Derived from sonner-native v0.26.4 — src/toast.tsx:39-437
|
|
23
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
24
|
+
*
|
|
25
|
+
* The animated shell around a row: stack offset + scale, enter/exit animation,
|
|
26
|
+
* height measurement, swipe wrapper and the imperative wiggle handle. The visual
|
|
27
|
+
* row itself is `ToastContent` (or the consumer's `jsx`).
|
|
28
|
+
*
|
|
29
|
+
* W6 — INVARIANT: THE MEASURED `Animated.View` IS `style`-ONLY, NEVER
|
|
30
|
+
* `className`'d. Under react-native-css on web, `onLayout` never fires for a
|
|
31
|
+
* className'd component, which would strand every row at
|
|
32
|
+
* `ESTIMATED_TOAST_HEIGHT` and pile the stack on top of itself. Measurement runs
|
|
33
|
+
* a three-tier ladder — `getBoundingClientRect()` (RN >= 0.83 refs and RN-Web),
|
|
34
|
+
* then `measureInWindow` (older New Arch), then `onLayout` as the safety net —
|
|
35
|
+
* so no single platform quirk can silently degrade it. A consumer's `toast.custom`
|
|
36
|
+
* JSX is unaffected: the ref sits on this engine wrapper, not on their element.
|
|
37
|
+
*
|
|
38
|
+
* W3 — the animated style READS two shared values and returns only the transform.
|
|
39
|
+
* `position`, `width` and the `top`/`bottom` anchor are static `StyleSheet` entries:
|
|
40
|
+
* upstream writes the anchor conditionally INSIDE the mapper, so the previous
|
|
41
|
+
* anchor is never cleared when `position` changes and the static keys are
|
|
42
|
+
* re-committed every frame. Both shared values are driven imperatively from plain-JS
|
|
43
|
+
* targets (`useAnimatedTarget`), never returned from a mapper.
|
|
44
|
+
*
|
|
45
|
+
* W5 — this row does NOT subscribe to `AppState`. `Toaster` holds one
|
|
46
|
+
* subscription for the whole stack (upstream creates one per row, so N toasts
|
|
47
|
+
* meant N `visibilitychange` listeners).
|
|
48
|
+
*
|
|
49
|
+
* THE EXIT IS ALWAYS A LAYOUT ANIMATION; THE ENTER DEPENDS ON THE PLATFORM.
|
|
50
|
+
* `animations.ts` returns EITHER an `entering` builder (native, and any consumer
|
|
51
|
+
* override) OR an `enterTranslateY` for `rowStyle` below to fade and slide the row
|
|
52
|
+
* in imperatively (web default) — never both. When `enterTranslateY` is
|
|
53
|
+
* `undefined`, `enterProgress` is seeded at 1 and `rowStyle` collapses to the
|
|
54
|
+
* wiggle scale alone, so nothing here competes with `entering`. Both halves of
|
|
55
|
+
* that split are load-bearing and neither may be "simplified" into the other:
|
|
56
|
+
* `animations.ts` documents the web pin that forbids `entering` on web and the
|
|
57
|
+
* native regression that forbids the imperative driver on native.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/** How much a wiggle grows the row, and for how long per half-cycle. */const WIGGLE_SCALE = 1.035;
|
|
61
|
+
const WIGGLE_DURATION = 150;
|
|
62
|
+
const WIGGLE_REPEATS = 4;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Fold the outlet-level `toastOptions` style slots into the per-toast
|
|
66
|
+
* `ToastStyles` shape so the renderer has ONE styles object to apply. Upstream
|
|
67
|
+
* threads all fifteen slots down as separate props; collapsing them here keeps
|
|
68
|
+
* `ToastContent` to a single `styles` prop while honouring the same API. The
|
|
69
|
+
* per-toast value always wins over the outlet's.
|
|
70
|
+
*/
|
|
71
|
+
function mergeToastStyles(toastOptions, perToast, variantStyle) {
|
|
72
|
+
return {
|
|
73
|
+
toastContainer: {
|
|
74
|
+
...toastOptions.toastContainerStyle,
|
|
75
|
+
...perToast?.toastContainer
|
|
76
|
+
},
|
|
77
|
+
toast: {
|
|
78
|
+
...toastOptions.style,
|
|
79
|
+
...variantStyle,
|
|
80
|
+
...perToast?.toast
|
|
81
|
+
},
|
|
82
|
+
toastContent: {
|
|
83
|
+
...toastOptions.toastContentStyle,
|
|
84
|
+
...perToast?.toastContent
|
|
85
|
+
},
|
|
86
|
+
textContainer: {
|
|
87
|
+
...toastOptions.textContainerStyle,
|
|
88
|
+
...perToast?.textContainer
|
|
89
|
+
},
|
|
90
|
+
title: {
|
|
91
|
+
...toastOptions.titleStyle,
|
|
92
|
+
...perToast?.title
|
|
93
|
+
},
|
|
94
|
+
description: {
|
|
95
|
+
...toastOptions.descriptionStyle,
|
|
96
|
+
...perToast?.description
|
|
97
|
+
},
|
|
98
|
+
buttons: {
|
|
99
|
+
...toastOptions.buttonsStyle,
|
|
100
|
+
...perToast?.buttons
|
|
101
|
+
},
|
|
102
|
+
closeButton: {
|
|
103
|
+
...toastOptions.closeButtonStyle,
|
|
104
|
+
...perToast?.closeButton
|
|
105
|
+
},
|
|
106
|
+
closeButtonIcon: {
|
|
107
|
+
...toastOptions.closeButtonIconStyle,
|
|
108
|
+
...perToast?.closeButtonIcon
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const ToastRow = exports.ToastRow = /*#__PURE__*/React.forwardRef(function ToastRow({
|
|
113
|
+
id,
|
|
114
|
+
title,
|
|
115
|
+
jsx,
|
|
116
|
+
description,
|
|
117
|
+
icon,
|
|
118
|
+
duration,
|
|
119
|
+
variant,
|
|
120
|
+
action,
|
|
121
|
+
cancel,
|
|
122
|
+
close,
|
|
123
|
+
onDismiss,
|
|
124
|
+
dismissible = _constants.toastDefaults.dismissible,
|
|
125
|
+
closeButton: closeButtonProp,
|
|
126
|
+
actionButtonStyle,
|
|
127
|
+
actionButtonTextStyle,
|
|
128
|
+
cancelButtonStyle,
|
|
129
|
+
cancelButtonTextStyle,
|
|
130
|
+
style,
|
|
131
|
+
styles: styleOverrides,
|
|
132
|
+
promiseOptions,
|
|
133
|
+
position: positionProp,
|
|
134
|
+
animation,
|
|
135
|
+
unstyled: unstyledProp,
|
|
136
|
+
important,
|
|
137
|
+
richColors: richColorsProp,
|
|
138
|
+
onPress,
|
|
139
|
+
allowFontScaling: allowFontScalingProp,
|
|
140
|
+
maxFontSizeMultiplier: maxFontSizeMultiplierProp,
|
|
141
|
+
backgroundComponent: backgroundComponentProp,
|
|
142
|
+
numberOfToasts,
|
|
143
|
+
index,
|
|
144
|
+
orderedToastIds
|
|
145
|
+
}, ref) {
|
|
146
|
+
const {
|
|
147
|
+
closeButton: closeButtonCtx,
|
|
148
|
+
icons,
|
|
149
|
+
richColors: richColorsCtx,
|
|
150
|
+
allowFontScaling: allowFontScalingCtx,
|
|
151
|
+
maxFontSizeMultiplier: maxFontSizeMultiplierCtx,
|
|
152
|
+
enableStacking,
|
|
153
|
+
gap,
|
|
154
|
+
position: positionCtx,
|
|
155
|
+
visibleToasts,
|
|
156
|
+
unstyled: unstyledCtx,
|
|
157
|
+
toastOptions
|
|
158
|
+
} = (0, _context.useToastContext)();
|
|
159
|
+
const {
|
|
160
|
+
toastHeights,
|
|
161
|
+
isExpanded,
|
|
162
|
+
toggleExpand
|
|
163
|
+
} = (0, _context.useDynamicToastContext)();
|
|
164
|
+
const position = positionProp ?? positionCtx;
|
|
165
|
+
const unstyled = unstyledProp ?? toastOptions.unstyled ?? unstyledCtx;
|
|
166
|
+
const richColors = richColorsProp ?? richColorsCtx;
|
|
167
|
+
const closeButton = closeButtonProp ?? closeButtonCtx;
|
|
168
|
+
const allowFontScaling = allowFontScalingProp ?? allowFontScalingCtx;
|
|
169
|
+
const maxFontSizeMultiplier = maxFontSizeMultiplierProp ?? maxFontSizeMultiplierCtx;
|
|
170
|
+
const backgroundComponent = backgroundComponentProp ?? toastOptions.backgroundComponent;
|
|
171
|
+
const stackGap = gap ?? _constants.toastDefaults.stackGap;
|
|
172
|
+
const mergedStyles = React.useMemo(() => mergeToastStyles(toastOptions, styleOverrides, variant ? toastOptions[variant] : undefined), [toastOptions, styleOverrides, variant]);
|
|
173
|
+
|
|
174
|
+
// For top-center the array is reversed, so the front row is index 0.
|
|
175
|
+
const distanceFromFront = position === 'top-center' ? index : numberOfToasts - 1 - index;
|
|
176
|
+
const isHiddenByLimit = enableStacking && distanceFromFront >= visibleToasts;
|
|
177
|
+
const {
|
|
178
|
+
entering,
|
|
179
|
+
exiting,
|
|
180
|
+
enterTranslateY
|
|
181
|
+
} = (0, _animations.useToastLayoutAnimations)(positionProp, animation, isHiddenByLimit, numberOfToasts);
|
|
182
|
+
const yPosition = (0, _useToastPosition.useToastPosition)({
|
|
183
|
+
index,
|
|
184
|
+
numberOfToasts,
|
|
185
|
+
enableStacking,
|
|
186
|
+
position,
|
|
187
|
+
allToastHeights: toastHeights,
|
|
188
|
+
gap,
|
|
189
|
+
orderedToastIds,
|
|
190
|
+
isExpanded,
|
|
191
|
+
stackGap
|
|
192
|
+
});
|
|
193
|
+
const {
|
|
194
|
+
width: screenWidth
|
|
195
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
196
|
+
const stackScaleX = (0, _useAnimatedTarget.useAnimatedTarget)((0, _positionUtils.calculateStackScaleX)({
|
|
197
|
+
index,
|
|
198
|
+
numberOfToasts,
|
|
199
|
+
enableStacking,
|
|
200
|
+
position,
|
|
201
|
+
isExpanded,
|
|
202
|
+
stackGap,
|
|
203
|
+
screenWidth
|
|
204
|
+
}), {
|
|
205
|
+
duration: _constants.STACKING_ANIMATION_DURATION,
|
|
206
|
+
easing: _animations.easeOutQuartFn
|
|
207
|
+
});
|
|
208
|
+
const stackTransformStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
209
|
+
transform: [{
|
|
210
|
+
translateY: yPosition.value
|
|
211
|
+
}, {
|
|
212
|
+
scaleX: stackScaleX.value
|
|
213
|
+
}]
|
|
214
|
+
}), [yPosition, stackScaleX]);
|
|
215
|
+
|
|
216
|
+
// 0 -> 1 over the enter animation. Seeded at 1 with NO mount-time `withTiming`
|
|
217
|
+
// whenever `enterTranslateY` is undefined — i.e. whenever `entering` is playing
|
|
218
|
+
// the enter instead, or reduced motion is on — leaving this style the identity.
|
|
219
|
+
const enterProgress = (0, _useAnimatedTarget.useAnimatedTarget)(1, {
|
|
220
|
+
duration: _constants.ENTERING_ANIMATION_DURATION,
|
|
221
|
+
easing: _animations.easeOutQuartFn,
|
|
222
|
+
from: enterTranslateY === undefined ? undefined : 0
|
|
223
|
+
});
|
|
224
|
+
const enterDistance = enterTranslateY ?? 0;
|
|
225
|
+
const wiggleScale = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
226
|
+
// ONE mapper for both transforms: two animated styles on the same view would
|
|
227
|
+
// each return a `transform` array and the later one would win outright.
|
|
228
|
+
const rowStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
|
|
229
|
+
opacity: enterProgress.value,
|
|
230
|
+
transform: [{
|
|
231
|
+
translateY: (1 - enterProgress.value) * enterDistance
|
|
232
|
+
}, {
|
|
233
|
+
scale: wiggleScale.value
|
|
234
|
+
}]
|
|
235
|
+
}), [enterProgress, enterDistance, wiggleScale]);
|
|
236
|
+
const wiggle = React.useCallback(() => {
|
|
237
|
+
'worklet';
|
|
238
|
+
|
|
239
|
+
wiggleScale.value = (0, _reactNativeReanimated.withRepeat)((0, _reactNativeReanimated.withTiming)(Math.min(wiggleScale.value * WIGGLE_SCALE, WIGGLE_SCALE), {
|
|
240
|
+
duration: WIGGLE_DURATION
|
|
241
|
+
}), WIGGLE_REPEATS, true);
|
|
242
|
+
}, [wiggleScale]);
|
|
243
|
+
const handleWiggle = React.useCallback(() => {
|
|
244
|
+
// A toast that never auto-closes has no timer to draw attention back to.
|
|
245
|
+
if (duration === Infinity) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (wiggleScale.value !== 1) {
|
|
249
|
+
// Settle back to rest first, otherwise the scale compounds.
|
|
250
|
+
wiggleScale.value = (0, _reactNativeReanimated.withTiming)(1, {
|
|
251
|
+
duration: WIGGLE_DURATION
|
|
252
|
+
}, wiggle);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
wiggle();
|
|
256
|
+
}, [wiggle, wiggleScale, duration]);
|
|
257
|
+
React.useImperativeHandle(ref, () => ({
|
|
258
|
+
wiggle: handleWiggle
|
|
259
|
+
}));
|
|
260
|
+
const measuredRef = React.useRef(null);
|
|
261
|
+
|
|
262
|
+
// Tiers 1 and 2 of the ladder — see the W6 note in the file header.
|
|
263
|
+
React.useLayoutEffect(() => {
|
|
264
|
+
const node = measuredRef.current;
|
|
265
|
+
if (!node) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
if (typeof node.getBoundingClientRect === 'function') {
|
|
269
|
+
_toastStore.toastStore.setToastHeight(id, node.getBoundingClientRect().height);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
let stale = false;
|
|
273
|
+
node.measureInWindow((_x, _y, _width, height) => {
|
|
274
|
+
if (!stale) {
|
|
275
|
+
_toastStore.toastStore.setToastHeight(id, height);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
return () => {
|
|
279
|
+
stale = true;
|
|
280
|
+
};
|
|
281
|
+
}, [id, variant, title, description, jsx]);
|
|
282
|
+
|
|
283
|
+
// Tier 3. Also the only tier that reports a LATER resize (a wrapped line, a
|
|
284
|
+
// font swap) on platforms without a synchronous read.
|
|
285
|
+
const handleLayout = React.useCallback(({
|
|
286
|
+
nativeEvent
|
|
287
|
+
}) => {
|
|
288
|
+
const {
|
|
289
|
+
height
|
|
290
|
+
} = nativeEvent.layout;
|
|
291
|
+
if (height > 0) {
|
|
292
|
+
_toastStore.toastStore.setToastHeight(id, height);
|
|
293
|
+
}
|
|
294
|
+
}, [id]);
|
|
295
|
+
const onRemove = React.useCallback(() => {
|
|
296
|
+
onDismiss(id);
|
|
297
|
+
}, [onDismiss, id]);
|
|
298
|
+
const onSwipeBegin = React.useCallback(() => {
|
|
299
|
+
_toastStore.toastStore.pauseTimer(id);
|
|
300
|
+
}, [id]);
|
|
301
|
+
const onSwipeFinalize = React.useCallback(() => {
|
|
302
|
+
if (!isExpanded) {
|
|
303
|
+
_toastStore.toastStore.resumeTimer(id);
|
|
304
|
+
}
|
|
305
|
+
}, [id, isExpanded]);
|
|
306
|
+
const onSwipePress = React.useCallback(({
|
|
307
|
+
x
|
|
308
|
+
}) => {
|
|
309
|
+
if (enableStacking && numberOfToasts > 1 && position !== 'center') {
|
|
310
|
+
// On Android the RNGH tap wins the race against the nested Pressable,
|
|
311
|
+
// so a press in the close-button strip has to dismiss explicitly.
|
|
312
|
+
if (x > screenWidth - _constants.CLOSE_BUTTON_HIT_AREA) {
|
|
313
|
+
if (isExpanded && closeButton && dismissible) {
|
|
314
|
+
onDismiss(id);
|
|
315
|
+
}
|
|
316
|
+
} else {
|
|
317
|
+
toggleExpand();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
onPress?.();
|
|
321
|
+
}, [enableStacking, numberOfToasts, position, screenWidth, isExpanded, closeButton, dismissible, onDismiss, id, toggleExpand, onPress]);
|
|
322
|
+
|
|
323
|
+
// Front row on top: later rows in the stack sit progressively behind.
|
|
324
|
+
const stackZIndex = position === 'top-center' ? -(index + 1) : -(numberOfToasts - index);
|
|
325
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
326
|
+
style: [styles.anchor, anchorFor(position), {
|
|
327
|
+
zIndex: stackZIndex
|
|
328
|
+
}, stackTransformStyle],
|
|
329
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastSwipeHandler.ToastSwipeHandler, {
|
|
330
|
+
onRemove: onRemove,
|
|
331
|
+
onBegin: onSwipeBegin,
|
|
332
|
+
onFinalize: onSwipeFinalize,
|
|
333
|
+
onPress: onSwipePress
|
|
334
|
+
// A pending promise toast cannot be swiped away mid-flight.
|
|
335
|
+
,
|
|
336
|
+
enabled: !promiseOptions && dismissible,
|
|
337
|
+
style: mergedStyles.toastContainer,
|
|
338
|
+
unstyled: unstyled,
|
|
339
|
+
important: important,
|
|
340
|
+
position: positionProp,
|
|
341
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
342
|
+
style: rowStyle,
|
|
343
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
344
|
+
ref: measuredRef,
|
|
345
|
+
onLayout: handleLayout,
|
|
346
|
+
entering: entering,
|
|
347
|
+
exiting: exiting,
|
|
348
|
+
children: jsx ?? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastContent.ToastContent, {
|
|
349
|
+
id: id,
|
|
350
|
+
title: title,
|
|
351
|
+
description: description,
|
|
352
|
+
variant: variant,
|
|
353
|
+
icon: icon,
|
|
354
|
+
icons: icons,
|
|
355
|
+
action: action,
|
|
356
|
+
cancel: cancel,
|
|
357
|
+
close: close,
|
|
358
|
+
closeButton: closeButton,
|
|
359
|
+
dismissible: dismissible,
|
|
360
|
+
richColors: richColors,
|
|
361
|
+
promiseOptions: promiseOptions,
|
|
362
|
+
styles: mergedStyles,
|
|
363
|
+
style: style,
|
|
364
|
+
unstyled: unstyled,
|
|
365
|
+
onDismiss: onDismiss,
|
|
366
|
+
actionButtonStyle: actionButtonStyle ?? toastOptions.actionButtonStyle,
|
|
367
|
+
actionButtonTextStyle: actionButtonTextStyle ?? toastOptions.actionButtonTextStyle,
|
|
368
|
+
cancelButtonStyle: cancelButtonStyle ?? toastOptions.cancelButtonStyle,
|
|
369
|
+
cancelButtonTextStyle: cancelButtonTextStyle ?? toastOptions.cancelButtonTextStyle,
|
|
370
|
+
allowFontScaling: allowFontScaling,
|
|
371
|
+
maxFontSizeMultiplier: maxFontSizeMultiplier,
|
|
372
|
+
backgroundComponent: backgroundComponent
|
|
373
|
+
})
|
|
374
|
+
})
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
const styles = _reactNative.StyleSheet.create({
|
|
380
|
+
anchor: {
|
|
381
|
+
position: 'absolute',
|
|
382
|
+
width: '100%'
|
|
383
|
+
},
|
|
384
|
+
anchorTop: {
|
|
385
|
+
top: 0
|
|
386
|
+
},
|
|
387
|
+
anchorBottom: {
|
|
388
|
+
bottom: 0
|
|
389
|
+
},
|
|
390
|
+
/**
|
|
391
|
+
* The container is full-bleed for every position, so the vertical midpoint lives
|
|
392
|
+
* on the ROW rather than on the container. `calculateToastPosition` then shifts
|
|
393
|
+
* the front row up by half its height to sit ON the line rather than below it —
|
|
394
|
+
* see its `centerShift`.
|
|
395
|
+
*/
|
|
396
|
+
anchorCenter: {
|
|
397
|
+
top: '50%'
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
/** Which edge of the (full-bleed, padded) container the row hangs from. */
|
|
402
|
+
function anchorFor(position) {
|
|
403
|
+
if (position === 'bottom-center') {
|
|
404
|
+
return styles.anchorBottom;
|
|
405
|
+
}
|
|
406
|
+
if (position === 'center') {
|
|
407
|
+
return styles.anchorCenter;
|
|
408
|
+
}
|
|
409
|
+
return styles.anchorTop;
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=ToastRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_animations","_constants","_context","_positionUtils","_useAnimatedTarget","_ToastContent","_ToastSwipeHandler","_toastStore","_useToastPosition","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","WIGGLE_SCALE","WIGGLE_DURATION","WIGGLE_REPEATS","mergeToastStyles","toastOptions","perToast","variantStyle","toastContainer","toastContainerStyle","toast","style","toastContent","toastContentStyle","textContainer","textContainerStyle","title","titleStyle","description","descriptionStyle","buttons","buttonsStyle","closeButton","closeButtonStyle","closeButtonIcon","closeButtonIconStyle","ToastRow","exports","forwardRef","id","jsx","icon","duration","variant","action","cancel","close","onDismiss","dismissible","toastDefaults","closeButtonProp","actionButtonStyle","actionButtonTextStyle","cancelButtonStyle","cancelButtonTextStyle","styles","styleOverrides","promiseOptions","position","positionProp","animation","unstyled","unstyledProp","important","richColors","richColorsProp","onPress","allowFontScaling","allowFontScalingProp","maxFontSizeMultiplier","maxFontSizeMultiplierProp","backgroundComponent","backgroundComponentProp","numberOfToasts","index","orderedToastIds","ref","closeButtonCtx","icons","richColorsCtx","allowFontScalingCtx","maxFontSizeMultiplierCtx","enableStacking","gap","positionCtx","visibleToasts","unstyledCtx","useToastContext","toastHeights","isExpanded","toggleExpand","useDynamicToastContext","stackGap","mergedStyles","useMemo","undefined","distanceFromFront","isHiddenByLimit","entering","exiting","enterTranslateY","useToastLayoutAnimations","yPosition","useToastPosition","allToastHeights","width","screenWidth","useWindowDimensions","stackScaleX","useAnimatedTarget","calculateStackScaleX","STACKING_ANIMATION_DURATION","easing","easeOutQuartFn","stackTransformStyle","useAnimatedStyle","transform","translateY","value","scaleX","enterProgress","ENTERING_ANIMATION_DURATION","from","enterDistance","wiggleScale","useSharedValue","rowStyle","opacity","scale","wiggle","useCallback","withRepeat","withTiming","Math","min","handleWiggle","Infinity","useImperativeHandle","measuredRef","useRef","useLayoutEffect","node","current","getBoundingClientRect","toastStore","setToastHeight","height","stale","measureInWindow","_x","_y","_width","handleLayout","nativeEvent","layout","onRemove","onSwipeBegin","pauseTimer","onSwipeFinalize","resumeTimer","onSwipePress","x","CLOSE_BUTTON_HIT_AREA","stackZIndex","View","anchor","anchorFor","zIndex","children","ToastSwipeHandler","onBegin","onFinalize","enabled","onLayout","ToastContent","StyleSheet","create","anchorTop","top","anchorBottom","bottom","anchorCenter"],"sourceRoot":"../../../src","sources":["toast/ToastRow.tsx"],"mappings":";;;;;;AAsCA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAOA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AU;IACpB+C,KAAK,EAAE;EACT,CAAC;EACDwE,SAAS,EAAE;IAAEC,GAAG,EAAE;EAAE,CAAC;EACrBC,YAAY,EAAE;IAAEC,MAAM,EAAE;EAAE,CAAC;EAC3B;AACF;AACA;AACA;AACA;AACA;EACEC,YAAY,EAAE;IAAEH,GAAG,EAAE;EAAM;AAC7B,CAAC,CAAC;;AAEF;AACA,SAASZ,SAASA,CAAC5G,QAAuB,EAAE;EAC1C,IAAIA,QAAQ,KAAK,eAAe,EAAE;IAChC,OAAOH,MAAM,CAAC4H,YAAY;EAC5B;EACA,IAAIzH,QAAQ,KAAK,QAAQ,EAAE;IACzB,OAAOH,MAAM,CAAC8H,YAAY;EAC5B;EACA,OAAO9H,MAAM,CAAC0H,SAAS;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToastSwipeHandler = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
11
|
+
var _animations = require("./animations.js");
|
|
12
|
+
var _context = require("./context.js");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
/**
|
|
16
|
+
* Derived from sonner-native v0.26.4 — src/gestures.tsx
|
|
17
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
18
|
+
*
|
|
19
|
+
* W2 — the animated style reads `translate`, `direction`, `position`,
|
|
20
|
+
* `windowWidth` and `isAndroid`; ALL of them are in the dependency array. On web
|
|
21
|
+
* without the worklets babel plugin reanimated re-runs the mapper on its deps
|
|
22
|
+
* rather than on auto-tracked reads, so a missing dep freezes the swipe transform
|
|
23
|
+
* at its first frame (upstream omits `position` and `isAndroid`, so a toast that
|
|
24
|
+
* changes position mid-life swipes the wrong way).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Fraction of the screen a horizontal swipe must cross to dismiss. */
|
|
28
|
+
const HORIZONTAL_DISMISS_FRACTION = 0.25;
|
|
29
|
+
/** Below this the gesture reads as a tap, so the row springs back. */
|
|
30
|
+
const TAP_SLOP = 16;
|
|
31
|
+
/** Vertical travel that fades a row fully out. */
|
|
32
|
+
const VERTICAL_FADE_DISTANCE = 60;
|
|
33
|
+
const SPRING_BACK_EASING_BOUNCINESS = 0.8;
|
|
34
|
+
const WRONG_DIRECTION_SPRING_DURATION = 400;
|
|
35
|
+
const ToastSwipeHandler = ({
|
|
36
|
+
children,
|
|
37
|
+
onRemove,
|
|
38
|
+
style,
|
|
39
|
+
onBegin,
|
|
40
|
+
onFinalize,
|
|
41
|
+
enabled,
|
|
42
|
+
unstyled,
|
|
43
|
+
important,
|
|
44
|
+
position: positionProps,
|
|
45
|
+
onPress
|
|
46
|
+
}) => {
|
|
47
|
+
const {
|
|
48
|
+
width: windowWidth
|
|
49
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
50
|
+
const translate = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
51
|
+
const {
|
|
52
|
+
swipeToDismissDirection: direction,
|
|
53
|
+
position: positionCtx
|
|
54
|
+
} = (0, _context.useToastContext)();
|
|
55
|
+
const position = positionProps ?? positionCtx;
|
|
56
|
+
const isAndroid = _reactNative.Platform.OS === 'android';
|
|
57
|
+
const pan = _reactNativeGestureHandler.Gesture.Pan().onBegin(() => {
|
|
58
|
+
'worklet';
|
|
59
|
+
|
|
60
|
+
if (!enabled) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
(0, _reactNativeReanimated.runOnJS)(onBegin)();
|
|
64
|
+
}).onChange(event => {
|
|
65
|
+
'worklet';
|
|
66
|
+
|
|
67
|
+
if (!enabled) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (direction === 'left' && event.translationX < 0) {
|
|
71
|
+
translate.value = event.translationX;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (direction === 'up') {
|
|
75
|
+
const isBottomPosition = position === 'bottom-center';
|
|
76
|
+
const rawTranslation = event.translationY * (isBottomPosition ? -1 : 1);
|
|
77
|
+
|
|
78
|
+
// Negative is the dismissal direction; dragging the other way meets
|
|
79
|
+
// progressive resistance instead of moving freely.
|
|
80
|
+
if (rawTranslation < 0) {
|
|
81
|
+
translate.value = rawTranslation;
|
|
82
|
+
} else if (rawTranslation > 0) {
|
|
83
|
+
translate.value = elasticResistance(rawTranslation);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}).onFinalize(() => {
|
|
87
|
+
'worklet';
|
|
88
|
+
|
|
89
|
+
if (!enabled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const springBack = duration => {
|
|
93
|
+
'worklet';
|
|
94
|
+
|
|
95
|
+
translate.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
96
|
+
easing: _reactNativeReanimated.Easing.elastic(SPRING_BACK_EASING_BOUNCINESS),
|
|
97
|
+
duration
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const dismiss = () => {
|
|
101
|
+
'worklet';
|
|
102
|
+
|
|
103
|
+
translate.value = (0, _reactNativeReanimated.withTiming)(-windowWidth, {
|
|
104
|
+
easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
|
|
105
|
+
}, isDone => {
|
|
106
|
+
if (isDone) {
|
|
107
|
+
(0, _reactNativeReanimated.runOnJS)(onRemove)();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
if (direction === 'left') {
|
|
112
|
+
if (Math.abs(translate.value) < TAP_SLOP) {
|
|
113
|
+
springBack();
|
|
114
|
+
} else if (translate.value < -windowWidth * HORIZONTAL_DISMISS_FRACTION) {
|
|
115
|
+
dismiss();
|
|
116
|
+
} else {
|
|
117
|
+
springBack();
|
|
118
|
+
}
|
|
119
|
+
} else if (direction === 'up') {
|
|
120
|
+
if (translate.value > 0) {
|
|
121
|
+
// Dragged against the dismissal direction — always settle back.
|
|
122
|
+
springBack(WRONG_DIRECTION_SPRING_DURATION);
|
|
123
|
+
} else if (Math.abs(translate.value) < TAP_SLOP) {
|
|
124
|
+
springBack();
|
|
125
|
+
} else {
|
|
126
|
+
dismiss();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
(0, _reactNativeReanimated.runOnJS)(onFinalize)();
|
|
130
|
+
});
|
|
131
|
+
const tap = _reactNativeGestureHandler.Gesture.Tap().onEnd(event => {
|
|
132
|
+
'worklet';
|
|
133
|
+
|
|
134
|
+
(0, _reactNativeReanimated.runOnJS)(onPress)({
|
|
135
|
+
x: event.x,
|
|
136
|
+
y: event.y
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
140
|
+
const transform = direction === 'left' ? {
|
|
141
|
+
translateX: translate.value
|
|
142
|
+
} : {
|
|
143
|
+
translateY: translate.value * (position === 'bottom-center' ? -1 : 1)
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
transform: [transform],
|
|
147
|
+
// Android composites the fade poorly against the elevation shadow, so the
|
|
148
|
+
// row stays opaque there and relies on the translate alone.
|
|
149
|
+
opacity: isAndroid ? 1 : (0, _reactNativeReanimated.interpolate)(translate.value, [0, direction === 'left' ? -windowWidth : -VERTICAL_FADE_DISTANCE], [1, 0])
|
|
150
|
+
};
|
|
151
|
+
}, [direction, translate, windowWidth, position, isAndroid]);
|
|
152
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
153
|
+
gesture: _reactNativeGestureHandler.Gesture.Race(tap, pan),
|
|
154
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
155
|
+
style: [animatedStyle, unstyled ? undefined : styles.centered, styles.fullWidth, style]
|
|
156
|
+
// W9 — on web `LinearTransition`'s easing degrades to CSS `ease` because
|
|
157
|
+
// a `bezierFn` result carries no easing-name symbol for the CSS mapper.
|
|
158
|
+
// Accepted: the transition still runs, only its curve differs.
|
|
159
|
+
,
|
|
160
|
+
layout: _reactNativeReanimated.LinearTransition.easing(_animations.easeInOutCircFn)
|
|
161
|
+
// https://reactnative.dev/docs/accessibility#aria-live-android
|
|
162
|
+
,
|
|
163
|
+
"aria-live": important ? 'assertive' : 'polite',
|
|
164
|
+
children: children
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
exports.ToastSwipeHandler = ToastSwipeHandler;
|
|
169
|
+
const styles = _reactNative.StyleSheet.create({
|
|
170
|
+
centered: {
|
|
171
|
+
justifyContent: 'center'
|
|
172
|
+
},
|
|
173
|
+
fullWidth: {
|
|
174
|
+
width: '100%'
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Apple-style progressive resistance: the further the drag goes the less the row
|
|
180
|
+
* follows it.
|
|
181
|
+
*/
|
|
182
|
+
function elasticResistance(distance) {
|
|
183
|
+
'worklet';
|
|
184
|
+
|
|
185
|
+
const BASE_RESISTANCE = 0.4;
|
|
186
|
+
const PROGRESSIVE_DAMPENING = 0.02;
|
|
187
|
+
return distance * BASE_RESISTANCE * (1 / (1 + distance * PROGRESSIVE_DAMPENING));
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=ToastSwipeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_reactNativeReanimated","_animations","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","HORIZONTAL_DISMISS_FRACTION","TAP_SLOP","VERTICAL_FADE_DISTANCE","SPRING_BACK_EASING_BOUNCINESS","WRONG_DIRECTION_SPRING_DURATION","ToastSwipeHandler","children","onRemove","style","onBegin","onFinalize","enabled","unstyled","important","position","positionProps","onPress","width","windowWidth","useWindowDimensions","translate","useSharedValue","swipeToDismissDirection","direction","positionCtx","useToastContext","isAndroid","Platform","OS","pan","Gesture","Pan","runOnJS","onChange","event","translationX","value","isBottomPosition","rawTranslation","translationY","elasticResistance","springBack","duration","withTiming","easing","Easing","elastic","dismiss","inOut","ease","isDone","Math","abs","tap","Tap","onEnd","x","y","animatedStyle","useAnimatedStyle","transform","translateX","translateY","opacity","interpolate","jsx","GestureDetector","gesture","Race","View","undefined","styles","centered","fullWidth","layout","LinearTransition","easeInOutCircFn","exports","StyleSheet","create","justifyContent","distance","BASE_RESISTANCE","PROGRESSIVE_DAMPENING"],"sourceRoot":"../../../src","sources":["toast/ToastSwipeHandler.tsx"],"mappings":";;;;;;AAWA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,0BAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAUA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAA4C,IAAAM,WAAA,GAAAN,OAA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