@hanzogui/toast 2.0.0-rc.41-hanzoai.3
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/dist/cjs/Toast.cjs +178 -0
- package/dist/cjs/Toast.native.js +181 -0
- package/dist/cjs/Toast.native.js.map +1 -0
- package/dist/cjs/ToastAnnounce.cjs +103 -0
- package/dist/cjs/ToastAnnounce.native.js +111 -0
- package/dist/cjs/ToastAnnounce.native.js.map +1 -0
- package/dist/cjs/ToastComposable.cjs +933 -0
- package/dist/cjs/ToastComposable.native.js +1025 -0
- package/dist/cjs/ToastComposable.native.js.map +1 -0
- package/dist/cjs/ToastImperative.cjs +119 -0
- package/dist/cjs/ToastImperative.native.js +130 -0
- package/dist/cjs/ToastImperative.native.js.map +1 -0
- package/dist/cjs/ToastImpl.cjs +354 -0
- package/dist/cjs/ToastImpl.native.js +364 -0
- package/dist/cjs/ToastImpl.native.js.map +1 -0
- package/dist/cjs/ToastItemFrame.cjs +143 -0
- package/dist/cjs/ToastItemFrame.native.js +148 -0
- package/dist/cjs/ToastItemFrame.native.js.map +1 -0
- package/dist/cjs/ToastPortal.cjs +49 -0
- package/dist/cjs/ToastPortal.native.js +52 -0
- package/dist/cjs/ToastPortal.native.js.map +1 -0
- package/dist/cjs/ToastProvider.cjs +150 -0
- package/dist/cjs/ToastProvider.native.js +161 -0
- package/dist/cjs/ToastProvider.native.js.map +1 -0
- package/dist/cjs/ToastState.cjs +311 -0
- package/dist/cjs/ToastState.native.js +324 -0
- package/dist/cjs/ToastState.native.js.map +1 -0
- package/dist/cjs/ToastViewport.cjs +319 -0
- package/dist/cjs/ToastViewport.native.js +343 -0
- package/dist/cjs/ToastViewport.native.js.map +1 -0
- package/dist/cjs/Toaster.cjs +87 -0
- package/dist/cjs/Toaster.native.js +91 -0
- package/dist/cjs/Toaster.native.js.map +1 -0
- package/dist/cjs/constants.cjs +30 -0
- package/dist/cjs/constants.native.js +33 -0
- package/dist/cjs/constants.native.js.map +1 -0
- package/dist/cjs/createNativeToast.cjs +59 -0
- package/dist/cjs/createNativeToast.native.js +60 -0
- package/dist/cjs/createNativeToast.native.js.map +1 -0
- package/dist/cjs/dispatchNativeToast.cjs +47 -0
- package/dist/cjs/dispatchNativeToast.native.js +52 -0
- package/dist/cjs/dispatchNativeToast.native.js.map +1 -0
- package/dist/cjs/index.cjs +20 -0
- package/dist/cjs/index.native.js +23 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/useAnimatedDragGesture.cjs +214 -0
- package/dist/cjs/useAnimatedDragGesture.native.js +224 -0
- package/dist/cjs/useAnimatedDragGesture.native.js.map +1 -0
- package/dist/cjs/useReducedMotion.cjs +74 -0
- package/dist/cjs/useReducedMotion.native.js +83 -0
- package/dist/cjs/useReducedMotion.native.js.map +1 -0
- package/dist/cjs/useToastAnimations.cjs +294 -0
- package/dist/cjs/useToastAnimations.native.js +304 -0
- package/dist/cjs/useToastAnimations.native.js.map +1 -0
- package/dist/cjs/v2.cjs +36 -0
- package/dist/cjs/v2.native.js +39 -0
- package/dist/cjs/v2.native.js.map +1 -0
- package/dist/esm/Toast.mjs +137 -0
- package/dist/esm/Toast.mjs.map +1 -0
- package/dist/esm/Toast.native.js +137 -0
- package/dist/esm/Toast.native.js.map +1 -0
- package/dist/esm/ToastAnnounce.mjs +66 -0
- package/dist/esm/ToastAnnounce.mjs.map +1 -0
- package/dist/esm/ToastAnnounce.native.js +71 -0
- package/dist/esm/ToastAnnounce.native.js.map +1 -0
- package/dist/esm/ToastComposable.mjs +895 -0
- package/dist/esm/ToastComposable.mjs.map +1 -0
- package/dist/esm/ToastComposable.native.js +984 -0
- package/dist/esm/ToastComposable.native.js.map +1 -0
- package/dist/esm/ToastImperative.mjs +80 -0
- package/dist/esm/ToastImperative.mjs.map +1 -0
- package/dist/esm/ToastImperative.native.js +88 -0
- package/dist/esm/ToastImperative.native.js.map +1 -0
- package/dist/esm/ToastImpl.mjs +316 -0
- package/dist/esm/ToastImpl.mjs.map +1 -0
- package/dist/esm/ToastImpl.native.js +323 -0
- package/dist/esm/ToastImpl.native.js.map +1 -0
- package/dist/esm/ToastItemFrame.mjs +114 -0
- package/dist/esm/ToastItemFrame.mjs.map +1 -0
- package/dist/esm/ToastItemFrame.native.js +116 -0
- package/dist/esm/ToastItemFrame.native.js.map +1 -0
- package/dist/esm/ToastPortal.mjs +24 -0
- package/dist/esm/ToastPortal.mjs.map +1 -0
- package/dist/esm/ToastPortal.native.js +24 -0
- package/dist/esm/ToastPortal.native.js.map +1 -0
- package/dist/esm/ToastProvider.mjs +110 -0
- package/dist/esm/ToastProvider.mjs.map +1 -0
- package/dist/esm/ToastProvider.native.js +118 -0
- package/dist/esm/ToastProvider.native.js.map +1 -0
- package/dist/esm/ToastState.mjs +285 -0
- package/dist/esm/ToastState.mjs.map +1 -0
- package/dist/esm/ToastState.native.js +295 -0
- package/dist/esm/ToastState.native.js.map +1 -0
- package/dist/esm/ToastViewport.mjs +280 -0
- package/dist/esm/ToastViewport.mjs.map +1 -0
- package/dist/esm/ToastViewport.native.js +301 -0
- package/dist/esm/ToastViewport.native.js.map +1 -0
- package/dist/esm/Toaster.mjs +51 -0
- package/dist/esm/Toaster.mjs.map +1 -0
- package/dist/esm/Toaster.native.js +52 -0
- package/dist/esm/Toaster.native.js.map +1 -0
- package/dist/esm/constants.mjs +4 -0
- package/dist/esm/constants.mjs.map +1 -0
- package/dist/esm/constants.native.js +4 -0
- package/dist/esm/constants.native.js.map +1 -0
- package/dist/esm/createNativeToast.mjs +32 -0
- package/dist/esm/createNativeToast.mjs.map +1 -0
- package/dist/esm/createNativeToast.native.js +30 -0
- package/dist/esm/createNativeToast.native.js.map +1 -0
- package/dist/esm/dispatchNativeToast.mjs +22 -0
- package/dist/esm/dispatchNativeToast.mjs.map +1 -0
- package/dist/esm/dispatchNativeToast.native.js +24 -0
- package/dist/esm/dispatchNativeToast.native.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/esm/useAnimatedDragGesture.mjs +178 -0
- package/dist/esm/useAnimatedDragGesture.mjs.map +1 -0
- package/dist/esm/useAnimatedDragGesture.native.js +185 -0
- package/dist/esm/useAnimatedDragGesture.native.js.map +1 -0
- package/dist/esm/useReducedMotion.mjs +38 -0
- package/dist/esm/useReducedMotion.mjs.map +1 -0
- package/dist/esm/useReducedMotion.native.js +44 -0
- package/dist/esm/useReducedMotion.native.js.map +1 -0
- package/dist/esm/useToastAnimations.mjs +258 -0
- package/dist/esm/useToastAnimations.mjs.map +1 -0
- package/dist/esm/useToastAnimations.native.js +265 -0
- package/dist/esm/useToastAnimations.native.js.map +1 -0
- package/dist/esm/v2.mjs +6 -0
- package/dist/esm/v2.mjs.map +1 -0
- package/dist/esm/v2.native.js +6 -0
- package/dist/esm/v2.native.js.map +1 -0
- package/dist/jsx/Toast.mjs +137 -0
- package/dist/jsx/Toast.mjs.map +1 -0
- package/dist/jsx/Toast.native.js +181 -0
- package/dist/jsx/Toast.native.js.map +1 -0
- package/dist/jsx/ToastAnnounce.mjs +66 -0
- package/dist/jsx/ToastAnnounce.mjs.map +1 -0
- package/dist/jsx/ToastAnnounce.native.js +111 -0
- package/dist/jsx/ToastAnnounce.native.js.map +1 -0
- package/dist/jsx/ToastComposable.mjs +895 -0
- package/dist/jsx/ToastComposable.mjs.map +1 -0
- package/dist/jsx/ToastComposable.native.js +1025 -0
- package/dist/jsx/ToastComposable.native.js.map +1 -0
- package/dist/jsx/ToastImperative.mjs +80 -0
- package/dist/jsx/ToastImperative.mjs.map +1 -0
- package/dist/jsx/ToastImperative.native.js +130 -0
- package/dist/jsx/ToastImperative.native.js.map +1 -0
- package/dist/jsx/ToastImpl.mjs +316 -0
- package/dist/jsx/ToastImpl.mjs.map +1 -0
- package/dist/jsx/ToastImpl.native.js +364 -0
- package/dist/jsx/ToastImpl.native.js.map +1 -0
- package/dist/jsx/ToastItemFrame.mjs +114 -0
- package/dist/jsx/ToastItemFrame.mjs.map +1 -0
- package/dist/jsx/ToastItemFrame.native.js +148 -0
- package/dist/jsx/ToastItemFrame.native.js.map +1 -0
- package/dist/jsx/ToastPortal.mjs +24 -0
- package/dist/jsx/ToastPortal.mjs.map +1 -0
- package/dist/jsx/ToastPortal.native.js +52 -0
- package/dist/jsx/ToastPortal.native.js.map +1 -0
- package/dist/jsx/ToastProvider.mjs +110 -0
- package/dist/jsx/ToastProvider.mjs.map +1 -0
- package/dist/jsx/ToastProvider.native.js +161 -0
- package/dist/jsx/ToastProvider.native.js.map +1 -0
- package/dist/jsx/ToastState.mjs +285 -0
- package/dist/jsx/ToastState.mjs.map +1 -0
- package/dist/jsx/ToastState.native.js +324 -0
- package/dist/jsx/ToastState.native.js.map +1 -0
- package/dist/jsx/ToastViewport.mjs +280 -0
- package/dist/jsx/ToastViewport.mjs.map +1 -0
- package/dist/jsx/ToastViewport.native.js +343 -0
- package/dist/jsx/ToastViewport.native.js.map +1 -0
- package/dist/jsx/Toaster.mjs +51 -0
- package/dist/jsx/Toaster.mjs.map +1 -0
- package/dist/jsx/Toaster.native.js +91 -0
- package/dist/jsx/Toaster.native.js.map +1 -0
- package/dist/jsx/constants.mjs +4 -0
- package/dist/jsx/constants.mjs.map +1 -0
- package/dist/jsx/constants.native.js +33 -0
- package/dist/jsx/constants.native.js.map +1 -0
- package/dist/jsx/createNativeToast.mjs +32 -0
- package/dist/jsx/createNativeToast.mjs.map +1 -0
- package/dist/jsx/createNativeToast.native.js +60 -0
- package/dist/jsx/createNativeToast.native.js.map +1 -0
- package/dist/jsx/dispatchNativeToast.mjs +22 -0
- package/dist/jsx/dispatchNativeToast.mjs.map +1 -0
- package/dist/jsx/dispatchNativeToast.native.js +52 -0
- package/dist/jsx/dispatchNativeToast.native.js.map +1 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +23 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/dist/jsx/types.mjs +2 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/dist/jsx/types.native.js +21 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/dist/jsx/useAnimatedDragGesture.mjs +178 -0
- package/dist/jsx/useAnimatedDragGesture.mjs.map +1 -0
- package/dist/jsx/useAnimatedDragGesture.native.js +224 -0
- package/dist/jsx/useAnimatedDragGesture.native.js.map +1 -0
- package/dist/jsx/useReducedMotion.mjs +38 -0
- package/dist/jsx/useReducedMotion.mjs.map +1 -0
- package/dist/jsx/useReducedMotion.native.js +83 -0
- package/dist/jsx/useReducedMotion.native.js.map +1 -0
- package/dist/jsx/useToastAnimations.mjs +258 -0
- package/dist/jsx/useToastAnimations.mjs.map +1 -0
- package/dist/jsx/useToastAnimations.native.js +304 -0
- package/dist/jsx/useToastAnimations.native.js.map +1 -0
- package/dist/jsx/v2.mjs +6 -0
- package/dist/jsx/v2.mjs.map +1 -0
- package/dist/jsx/v2.native.js +39 -0
- package/dist/jsx/v2.native.js.map +1 -0
- package/package.json +83 -0
- package/src/Toast.tsx +219 -0
- package/src/ToastAnnounce.tsx +103 -0
- package/src/ToastComposable.tsx +1380 -0
- package/src/ToastImperative.tsx +192 -0
- package/src/ToastImpl.tsx +514 -0
- package/src/ToastItemFrame.tsx +136 -0
- package/src/ToastPortal.tsx +19 -0
- package/src/ToastProvider.tsx +204 -0
- package/src/ToastState.ts +398 -0
- package/src/ToastViewport.tsx +430 -0
- package/src/Toaster.tsx +181 -0
- package/src/constants.ts +2 -0
- package/src/createNativeToast.native.tsx +33 -0
- package/src/createNativeToast.tsx +42 -0
- package/src/dispatchNativeToast.ts +43 -0
- package/src/index.ts +3 -0
- package/src/types.ts +71 -0
- package/src/useAnimatedDragGesture.native.ts +255 -0
- package/src/useAnimatedDragGesture.ts +319 -0
- package/src/useReducedMotion.ts +59 -0
- package/src/useToastAnimations.ts +377 -0
- package/src/v2.ts +31 -0
- package/types/Toast.d.ts +84 -0
- package/types/Toast.d.ts.map +1 -0
- package/types/ToastAnnounce.d.ts +18 -0
- package/types/ToastAnnounce.d.ts.map +1 -0
- package/types/ToastComposable.d.ts +199 -0
- package/types/ToastComposable.d.ts.map +1 -0
- package/types/ToastImperative.d.ts +95 -0
- package/types/ToastImperative.d.ts.map +1 -0
- package/types/ToastImpl.d.ts +109 -0
- package/types/ToastImpl.d.ts.map +1 -0
- package/types/ToastItemFrame.d.ts +25 -0
- package/types/ToastItemFrame.d.ts.map +1 -0
- package/types/ToastPortal.d.ts +8 -0
- package/types/ToastPortal.d.ts.map +1 -0
- package/types/ToastProvider.d.ts +92 -0
- package/types/ToastProvider.d.ts.map +1 -0
- package/types/ToastState.d.ts +179 -0
- package/types/ToastState.d.ts.map +1 -0
- package/types/ToastViewport.d.ts +75 -0
- package/types/ToastViewport.d.ts.map +1 -0
- package/types/Toaster.d.ts +112 -0
- package/types/Toaster.d.ts.map +1 -0
- package/types/constants.d.ts +3 -0
- package/types/constants.d.ts.map +1 -0
- package/types/createNativeToast.d.ts +9 -0
- package/types/createNativeToast.d.ts.map +1 -0
- package/types/createNativeToast.native.d.ts +5 -0
- package/types/createNativeToast.native.d.ts.map +1 -0
- package/types/dispatchNativeToast.d.ts +12 -0
- package/types/dispatchNativeToast.d.ts.map +1 -0
- package/types/index.d.ts +4 -0
- package/types/index.d.ts.map +1 -0
- package/types/types.d.ts +61 -0
- package/types/types.d.ts.map +1 -0
- package/types/useAnimatedDragGesture.d.ts +33 -0
- package/types/useAnimatedDragGesture.d.ts.map +1 -0
- package/types/useAnimatedDragGesture.native.d.ts +33 -0
- package/types/useAnimatedDragGesture.native.d.ts.map +1 -0
- package/types/useReducedMotion.d.ts +6 -0
- package/types/useReducedMotion.d.ts.map +1 -0
- package/types/useToastAnimations.d.ts +50 -0
- package/types/useToastAnimations.d.ts.map +1 -0
- package/types/v2.d.ts +10 -0
- package/types/v2.d.ts.map +1 -0
- package/v2/index.cjs +2 -0
- package/v2/index.js +2 -0
- package/v2/index.native.cjs +2 -0
- package/v2/index.native.js +2 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { GetProps, HanzoguiElement } from '@hanzogui/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { SwipeDirection } from './ToastProvider';
|
|
4
|
+
import type { ExternalToast, ToastT } from './ToastState';
|
|
5
|
+
import type { BurntToastOptions } from './types';
|
|
6
|
+
import { ToastItemFrame } from './ToastItemFrame';
|
|
7
|
+
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
8
|
+
interface ToastItemContextValue {
|
|
9
|
+
toast: ToastT;
|
|
10
|
+
handleClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface ToastIcons {
|
|
13
|
+
success?: React.ReactNode;
|
|
14
|
+
error?: React.ReactNode;
|
|
15
|
+
warning?: React.ReactNode;
|
|
16
|
+
info?: React.ReactNode;
|
|
17
|
+
loading?: React.ReactNode;
|
|
18
|
+
close?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export interface ToastRootProps {
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Position of the toasts on screen
|
|
24
|
+
* @default 'bottom-right'
|
|
25
|
+
*/
|
|
26
|
+
position?: ToastPosition;
|
|
27
|
+
/**
|
|
28
|
+
* Default duration for toasts in ms
|
|
29
|
+
* @default 4000
|
|
30
|
+
*/
|
|
31
|
+
duration?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Gap between toasts in pixels
|
|
34
|
+
* @default 14
|
|
35
|
+
*/
|
|
36
|
+
gap?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Number of toasts visible at once
|
|
39
|
+
* @default 4
|
|
40
|
+
*/
|
|
41
|
+
visibleToasts?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Direction toasts can be swiped to dismiss
|
|
44
|
+
* @default 'auto'
|
|
45
|
+
*/
|
|
46
|
+
swipeDirection?: SwipeDirection;
|
|
47
|
+
/**
|
|
48
|
+
* Distance in pixels swipe must pass to dismiss
|
|
49
|
+
* @default 50
|
|
50
|
+
*/
|
|
51
|
+
swipeThreshold?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Fixed toast height in pixels for native stacking calculations.
|
|
54
|
+
* On web, heights are measured dynamically.
|
|
55
|
+
* @default 56
|
|
56
|
+
*/
|
|
57
|
+
toastHeight?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Show close button on toasts
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
closeButton?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* When true, toasts are always expanded (fanned out) instead of stacked.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
expand?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Theme for toasts
|
|
70
|
+
*/
|
|
71
|
+
theme?: 'light' | 'dark' | 'system';
|
|
72
|
+
/**
|
|
73
|
+
* Force reduced motion mode
|
|
74
|
+
*/
|
|
75
|
+
reducedMotion?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* When true, uses burnt native OS toasts on mobile instead of RN views.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
native?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Options for burnt native toasts on mobile
|
|
83
|
+
*/
|
|
84
|
+
burntOptions?: Omit<BurntToastOptions, 'title' | 'message' | 'duration'>;
|
|
85
|
+
/**
|
|
86
|
+
* Options for web Notification API when native is true on web
|
|
87
|
+
*/
|
|
88
|
+
notificationOptions?: NotificationOptions;
|
|
89
|
+
/**
|
|
90
|
+
* Custom icons for toast types
|
|
91
|
+
*/
|
|
92
|
+
icons?: ToastIcons;
|
|
93
|
+
}
|
|
94
|
+
declare const ToastViewportFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
95
|
+
unstyled?: boolean | undefined;
|
|
96
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
97
|
+
export interface ToastViewportProps extends GetProps<typeof ToastViewportFrame> {
|
|
98
|
+
/**
|
|
99
|
+
* Offset from screen edge
|
|
100
|
+
* @default 24
|
|
101
|
+
*/
|
|
102
|
+
offset?: number | {
|
|
103
|
+
top?: number;
|
|
104
|
+
right?: number;
|
|
105
|
+
bottom?: number;
|
|
106
|
+
left?: number;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Hotkey to focus viewport
|
|
110
|
+
*/
|
|
111
|
+
hotkey?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* Aria label
|
|
114
|
+
* @default 'Notifications'
|
|
115
|
+
*/
|
|
116
|
+
label?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Portal to root
|
|
119
|
+
* @default true
|
|
120
|
+
*/
|
|
121
|
+
portalToRoot?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* z-index for the portal container when portalToRoot is true
|
|
124
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
125
|
+
*/
|
|
126
|
+
portalZIndex?: number;
|
|
127
|
+
}
|
|
128
|
+
export interface ToastItemRenderProps {
|
|
129
|
+
toast: ToastT;
|
|
130
|
+
index: number;
|
|
131
|
+
handleClose: () => void;
|
|
132
|
+
}
|
|
133
|
+
export interface ToastListProps {
|
|
134
|
+
/**
|
|
135
|
+
* Custom render function for each toast item
|
|
136
|
+
*/
|
|
137
|
+
renderItem?: (props: ToastItemRenderProps) => React.ReactNode;
|
|
138
|
+
}
|
|
139
|
+
declare function ToastList({ renderItem }: ToastListProps): import("react/jsx-runtime").JSX.Element;
|
|
140
|
+
export interface ToastItemProps extends GetProps<typeof ToastItemFrame> {
|
|
141
|
+
toast: ToastT;
|
|
142
|
+
index: number;
|
|
143
|
+
children: React.ReactNode;
|
|
144
|
+
}
|
|
145
|
+
declare function ToastIcon(props: {
|
|
146
|
+
children?: React.ReactNode;
|
|
147
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
148
|
+
export declare function useToasts(): {
|
|
149
|
+
toasts: ToastT[];
|
|
150
|
+
expanded: boolean;
|
|
151
|
+
position: ToastPosition;
|
|
152
|
+
};
|
|
153
|
+
export declare function useToastItem(): ToastItemContextValue;
|
|
154
|
+
export declare const Toast: React.ForwardRefExoticComponent<ToastRootProps & React.RefAttributes<HanzoguiElement>> & {
|
|
155
|
+
Viewport: import("@hanzogui/core").HanzoguiComponent<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
156
|
+
unstyled?: boolean | undefined;
|
|
157
|
+
}>, keyof ToastViewportProps> & ToastViewportProps, HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & ToastViewportProps, import("@hanzogui/core").StackStyleBase, {
|
|
158
|
+
unstyled?: boolean | undefined;
|
|
159
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
160
|
+
List: typeof ToastList;
|
|
161
|
+
Item: import("@hanzogui/core").HanzoguiComponent<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
162
|
+
unstyled?: boolean | undefined;
|
|
163
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
164
|
+
fullscreen?: boolean | undefined;
|
|
165
|
+
}>, keyof ToastItemProps> & ToastItemProps, HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & ToastItemProps, import("@hanzogui/core").StackStyleBase, {
|
|
166
|
+
unstyled?: boolean | undefined;
|
|
167
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
168
|
+
fullscreen?: boolean | undefined;
|
|
169
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
170
|
+
Title: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiTextElement, import("@hanzogui/core").TextNonStyleProps, import("@hanzogui/core").TextStylePropsBase, {
|
|
171
|
+
unstyled?: boolean | undefined;
|
|
172
|
+
size?: import("@hanzogui/core").FontSizeTokens | undefined;
|
|
173
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
174
|
+
Description: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiTextElement, import("@hanzogui/core").TextNonStyleProps, import("@hanzogui/core").TextStylePropsBase, {
|
|
175
|
+
unstyled?: boolean | undefined;
|
|
176
|
+
size?: import("@hanzogui/core").FontSizeTokens | undefined;
|
|
177
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
178
|
+
Close: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
179
|
+
unstyled?: boolean | undefined;
|
|
180
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
181
|
+
fullscreen?: boolean | undefined;
|
|
182
|
+
}>, HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & void, import("@hanzogui/core").StackStyleBase, {
|
|
183
|
+
unstyled?: boolean | undefined;
|
|
184
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
185
|
+
fullscreen?: boolean | undefined;
|
|
186
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
187
|
+
Action: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
188
|
+
unstyled?: boolean | undefined;
|
|
189
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
190
|
+
fullscreen?: boolean | undefined;
|
|
191
|
+
}>, HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps & void, import("@hanzogui/core").StackStyleBase, {
|
|
192
|
+
unstyled?: boolean | undefined;
|
|
193
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
194
|
+
fullscreen?: boolean | undefined;
|
|
195
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
196
|
+
Icon: typeof ToastIcon;
|
|
197
|
+
};
|
|
198
|
+
export type { ToastT, ExternalToast };
|
|
199
|
+
//# sourceMappingURL=ToastComposable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastComposable.d.ts","sourceRoot":"","sources":["../src/ToastComposable.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAc/D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAA6B,MAAM,cAAc,CAAA;AAEpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAKhD,OAAO,EAIL,cAAc,EAEf,MAAM,kBAAkB,CAAA;AAWzB,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,CAAA;AAiDlB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB;AAgBD,MAAM,WAAW,U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F,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { NativePlatform, NativeValue } from '@hanzogui/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { CreateNativeToastOptions, NativeToastRef } from './types';
|
|
4
|
+
export interface ToastImperativeOptions extends Omit<CreateNativeToastOptions, 'message'> {
|
|
5
|
+
/**
|
|
6
|
+
* Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.
|
|
7
|
+
*/
|
|
8
|
+
native?: NativeValue;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Override this in your application to get custom toast fields.
|
|
12
|
+
*
|
|
13
|
+
* e.g.
|
|
14
|
+
* ```ts
|
|
15
|
+
* declare module '@hanzogui/toast' {
|
|
16
|
+
* interface CustomData {
|
|
17
|
+
* preset: 'error' | 'success'
|
|
18
|
+
* isUrgent: true
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*```
|
|
22
|
+
* You will get auto-completion:
|
|
23
|
+
* ```ts
|
|
24
|
+
* toast.show("Message", { preset: 'error', isUrgent: true })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export interface CustomData {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|
|
30
|
+
type ShowOptions = CreateNativeToastOptions & CustomData & {
|
|
31
|
+
/**
|
|
32
|
+
* Used when need custom data
|
|
33
|
+
*/
|
|
34
|
+
customData?: CustomData;
|
|
35
|
+
/**
|
|
36
|
+
* Overrides the native option on `ToastImperativeProvider`
|
|
37
|
+
*/
|
|
38
|
+
native?: NativeValue;
|
|
39
|
+
/**
|
|
40
|
+
* Which viewport to send this toast to. This is only intended to be used with custom toasts and you should wire it up when creating the toast.
|
|
41
|
+
*/
|
|
42
|
+
viewportName?: string | 'default';
|
|
43
|
+
};
|
|
44
|
+
type ToastData = {
|
|
45
|
+
title: string;
|
|
46
|
+
id: string;
|
|
47
|
+
} & ShowOptions & {
|
|
48
|
+
isHandledNatively: boolean;
|
|
49
|
+
} & CustomData;
|
|
50
|
+
interface ToastContextI {
|
|
51
|
+
nativeToast: NativeToastRef | null;
|
|
52
|
+
/**
|
|
53
|
+
* Call it to show a new toast. If you're using native toasts, you can pass native options using \`burntOptions\` or \`notificationOptions\` depending on the native platform (mobile/web).
|
|
54
|
+
*/
|
|
55
|
+
show: (title: string, options?: ShowOptions) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Call it to hide the currently displayed toast.
|
|
58
|
+
*
|
|
59
|
+
* _NOTE_: does not work on Android native toasts
|
|
60
|
+
*
|
|
61
|
+
* _NOTE_: hides the last toast on web notification toasts
|
|
62
|
+
*/
|
|
63
|
+
hide: () => void;
|
|
64
|
+
options?: ToastImperativeOptions;
|
|
65
|
+
}
|
|
66
|
+
export declare const useToastController: () => ToastContextI;
|
|
67
|
+
export declare const useToastState: () => ToastData | null;
|
|
68
|
+
/** @deprecated use `useToastController` and `useToastState` instead to avoid performance pitfalls */
|
|
69
|
+
export declare const useToast: () => {
|
|
70
|
+
currentToast: ToastData | null;
|
|
71
|
+
nativeToast: NativeToastRef | null;
|
|
72
|
+
/**
|
|
73
|
+
* Call it to show a new toast. If you're using native toasts, you can pass native options using \`burntOptions\` or \`notificationOptions\` depending on the native platform (mobile/web).
|
|
74
|
+
*/
|
|
75
|
+
show: (title: string, options?: ShowOptions) => boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Call it to hide the currently displayed toast.
|
|
78
|
+
*
|
|
79
|
+
* _NOTE_: does not work on Android native toasts
|
|
80
|
+
*
|
|
81
|
+
* _NOTE_: hides the last toast on web notification toasts
|
|
82
|
+
*/
|
|
83
|
+
hide: () => void;
|
|
84
|
+
options?: ToastImperativeOptions;
|
|
85
|
+
};
|
|
86
|
+
interface ToastImperativeProviderProps {
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
/**
|
|
89
|
+
* Used to provide defaults to imperative API. Options can be overwritten when calling `show()`.
|
|
90
|
+
*/
|
|
91
|
+
options: ToastImperativeOptions;
|
|
92
|
+
}
|
|
93
|
+
export declare const ToastImperativeProvider: ({ children, options, }: ToastImperativeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
export type { NativePlatform, NativeValue, ToastImperativeProviderProps };
|
|
95
|
+
//# sourceMappingURL=ToastImperative.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastImperative.d.ts","sourceRoot":"","sources":["../src/ToastImperative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjE,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEvE,MAAM,WAAW,sBAAuB,SAAQ,IAAI,CAClD,wBAAwB,EACxB,SAAS,CACV;IACC;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,KAAK,WAAW,GAAG,wBAAwB,GACzC,UAAU,GAAG;IACX;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAClC,CAAA;AAEH,KAAK,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,GAAG;IAC3D,iBAAiB,EAAE,OAAO,CAAA;CAC3B,GAAG,UAAU,CAAA;AAEhB,UAAU,aAAa;IACrB,WAAW,EAAE,cAAc,GAAG,IAAI,CAAA;IAElC;;OAEG;IACH,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAA;IAEvD;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,IAAI,CAAA;IAEhB,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAKD,eAAO,MAAM,kBAAkB,qBAE9B,CAAA;AAED,eAAO,MAAM,aAAa,wBAEzB,CAAA;AAED,qGAAqG;AACrG,eAAO,MAAM,QAAQ;;iBA/BN,cAAc,GAAG,IAAI;IAElC;;OAEG;UACG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO;IAEvD;;;;;;OAMG;UACG,MAAM,IAAI;cAEN,sBAAsB;CAoBjC,CAAA;AAED,UAAU,4BAA4B;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,OAAO,EAAE,sBAAsB,CAAA;CAChC;AAED,eAAO,MAAM,uBAAuB,GAAI,wBAGrC,4BAA4B,4CAkF9B,CAAA;AAED,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { GetProps, HanzoguiElement } from '@hanzogui/core';
|
|
2
|
+
import type { DismissableProps } from '@hanzogui/dismissable';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
5
|
+
import type { ScopedProps } from './ToastProvider';
|
|
6
|
+
declare const ToastImplFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
7
|
+
unstyled?: boolean | undefined;
|
|
8
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
9
|
+
fullscreen?: boolean | undefined;
|
|
10
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
11
|
+
type ToastProps = Omit<ToastImplProps, keyof ToastImplPrivateProps>;
|
|
12
|
+
type SwipeEvent = GestureResponderEvent;
|
|
13
|
+
declare const useToastInteractiveContext: (scope?: string) => {
|
|
14
|
+
onClose(): void;
|
|
15
|
+
};
|
|
16
|
+
type ToastImplPrivateProps = {
|
|
17
|
+
open?: boolean;
|
|
18
|
+
onClose(): void;
|
|
19
|
+
};
|
|
20
|
+
type ToastImplFrameProps = GetProps<typeof ToastImplFrame>;
|
|
21
|
+
export type ToastExtraProps = {
|
|
22
|
+
/**
|
|
23
|
+
* The controlled open state of the dialog. Must be used in conjunction with `onOpenChange`.
|
|
24
|
+
*/
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The open state of the dialog when it is initially rendered. Use when you do not need to control its open state.
|
|
28
|
+
*/
|
|
29
|
+
defaultOpen?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Event handler called when the open state of the dialog changes.
|
|
32
|
+
*/
|
|
33
|
+
onOpenChange?(open: boolean): void;
|
|
34
|
+
/**
|
|
35
|
+
* Used to force mounting when more control is needed. Useful when
|
|
36
|
+
* controlling animation with React animation libraries.
|
|
37
|
+
*/
|
|
38
|
+
forceMount?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Control the sensitivity of the toast for accessibility purposes.
|
|
41
|
+
* For toasts that are the result of a user action, choose foreground. Toasts generated from background tasks should use background.
|
|
42
|
+
*/
|
|
43
|
+
type?: 'foreground' | 'background';
|
|
44
|
+
/**
|
|
45
|
+
* Time in milliseconds that toast should remain visible for. Overrides value given to `ToastProvider`.
|
|
46
|
+
*/
|
|
47
|
+
duration?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Event handler called when the escape key is down. It can be prevented by calling `event.preventDefault`.
|
|
50
|
+
*/
|
|
51
|
+
onEscapeKeyDown?: DismissableProps['onEscapeKeyDown'];
|
|
52
|
+
/**
|
|
53
|
+
* Event handler called when the dismiss timer is paused.
|
|
54
|
+
* On web, this occurs when the pointer is moved over the viewport, the viewport is focused or when the window is blurred.
|
|
55
|
+
* On mobile, this occurs when the toast is touched.
|
|
56
|
+
*/
|
|
57
|
+
onPause?(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Event handler called when the dismiss timer is resumed.
|
|
60
|
+
* On web, this occurs when the pointer is moved away from the viewport, the viewport is blurred or when the window is focused.
|
|
61
|
+
* On mobile, this occurs when the toast is released.
|
|
62
|
+
*/
|
|
63
|
+
onResume?(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Event handler called when starting a swipe interaction. It can be prevented by calling `event.preventDefault`.
|
|
66
|
+
*/
|
|
67
|
+
onSwipeStart?(event: SwipeEvent): void;
|
|
68
|
+
/**
|
|
69
|
+
* Event handler called during a swipe interaction. It can be prevented by calling `event.preventDefault`.
|
|
70
|
+
*/
|
|
71
|
+
onSwipeMove?(event: SwipeEvent): void;
|
|
72
|
+
/**
|
|
73
|
+
* Event handler called at the cancellation of a swipe interaction. It can be prevented by calling `event.preventDefault`.
|
|
74
|
+
*/
|
|
75
|
+
onSwipeCancel?(event: SwipeEvent): void;
|
|
76
|
+
/**
|
|
77
|
+
* Event handler called at the end of a swipe interaction. It can be prevented by calling `event.preventDefault`.
|
|
78
|
+
*/
|
|
79
|
+
onSwipeEnd?(event: SwipeEvent): void;
|
|
80
|
+
/**
|
|
81
|
+
* The viewport's name to send the toast to. Used when using multiple viewports and want to forward toasts to different ones.
|
|
82
|
+
*
|
|
83
|
+
* @default "default"
|
|
84
|
+
*/
|
|
85
|
+
viewportName?: string;
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
id?: string;
|
|
90
|
+
};
|
|
91
|
+
type ToastImplProps = ScopedProps<ToastImplPrivateProps & ToastImplFrameProps & ToastExtraProps>;
|
|
92
|
+
declare const ToastImpl: React.ForwardRefExoticComponent<Omit<ToastImplPrivateProps & Omit<import("@hanzogui/core").RNHanzoguiViewNonStyleProps, "unstyled" | "elevation" | keyof import("@hanzogui/core").StackStyleBase | "fullscreen"> & import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase> & {
|
|
93
|
+
unstyled?: boolean | undefined;
|
|
94
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
95
|
+
fullscreen?: boolean | undefined;
|
|
96
|
+
} & import("@hanzogui/core").WithShorthands<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase>> & import("@hanzogui/core").WithPseudoProps<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase> & {
|
|
97
|
+
unstyled?: boolean | undefined;
|
|
98
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
99
|
+
fullscreen?: boolean | undefined;
|
|
100
|
+
} & import("@hanzogui/core").WithShorthands<import("@hanzogui/core").WithThemeValues<import("@hanzogui/core").StackStyleBase>>> & import("@hanzogui/core").WithMediaProps<import("@hanzogui/core").WithThemeShorthandsAndPseudos<import("@hanzogui/core").StackStyleBase, {
|
|
101
|
+
unstyled?: boolean | undefined;
|
|
102
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
103
|
+
fullscreen?: boolean | undefined;
|
|
104
|
+
}>> & ToastExtraProps, "scope"> & {
|
|
105
|
+
scope?: import("./ToastProvider").ToastScopes;
|
|
106
|
+
} & React.RefAttributes<HanzoguiElement>>;
|
|
107
|
+
export { ToastImpl, ToastImplFrame, useToastInteractiveContext, type ToastImplProps };
|
|
108
|
+
export type { ToastProps };
|
|
109
|
+
//# sourceMappingURL=ToastImpl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastImpl.d.ts","sourceRoot":"","sources":["../src/ToastImpl.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAU/D,OAAO,KAAK,EAAE,gBAAgB,E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AA;IACrC;;OAEG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACvC;;OAEG;IACH,UAAU,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACpC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,KAAK,cAAc,GAAG,WAAW,CAC/B,qBAAqB,GAAG,mBAAmB,GAAG,eAAe,CAC9D,CAAA;AAED,QAAA,MAAM,SAAS;;;;;;;;;;;;;;yCAuPd,CAAA;AAsGD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,0BAA0B,EAAE,KAAK,cAAc,EAAE,CAAA;AACrF,YAAY,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared visual styled components for toast items.
|
|
3
|
+
* Shared across web and native — imported by ToastComposable.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ToastPositionWrapper: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
6
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
7
|
+
fullscreen?: boolean | undefined;
|
|
8
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
9
|
+
export declare const ToastItemFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
10
|
+
unstyled?: boolean | undefined;
|
|
11
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
12
|
+
fullscreen?: boolean | undefined;
|
|
13
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
14
|
+
export declare const ToastCloseFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
15
|
+
unstyled?: boolean | undefined;
|
|
16
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
17
|
+
fullscreen?: boolean | undefined;
|
|
18
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
19
|
+
export declare const ToastActionFrame: import("@hanzogui/core").HanzoguiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").HanzoguiElement, import("@hanzogui/core").RNHanzoguiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
20
|
+
unstyled?: boolean | undefined;
|
|
21
|
+
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
22
|
+
fullscreen?: boolean | undefined;
|
|
23
|
+
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
24
|
+
export declare const DefaultCloseIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=ToastItemFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastItemFrame.d.ts","sourceRoot":"","sources":["../src/ToastItemFrame.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,eAAO,MAAM,oBAAoB;;;+CAU/B,CAAA;AAOF,eAAO,MAAM,cAAc;;;;+CA8BzB,CAAA;AAMF,eAAO,MAAM,eAAe;;;;+CA4B1B,CAAA;AAMF,eAAO,MAAM,gBAAgB;;;;+CAuB3B,CAAA;AAMF,eAAO,MAAM,gBAAgB,+CAI5B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ToastProviderContextValue } from './ToastProvider';
|
|
3
|
+
export declare function ToastPortal(props: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
zIndex?: number;
|
|
6
|
+
context: ToastProviderContextValue;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=ToastPortal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastPortal.d.ts","sourceRoot":"","sources":["../src/ToastPortal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAA4B,KAAK,yBAAyB,EAAE,MAAM,iBAAiB,CAAA;AAE1F,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,QAAQ,EAAE,SAAS,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,yBAAyB,CAAA;CACnC,2CASA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { NativeValue, HanzoguiElement } from '@hanzogui/core';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import type { ToastImperativeOptions } from './ToastImperative';
|
|
4
|
+
import type { BurntToastOptions } from './types';
|
|
5
|
+
declare const Collection: {
|
|
6
|
+
readonly Provider: React.FC<{
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
} & {
|
|
9
|
+
scope?: any;
|
|
10
|
+
}>;
|
|
11
|
+
readonly Slot: React.ForwardRefExoticComponent<import("@hanzogui/collection").CollectionProps & {
|
|
12
|
+
scope?: any;
|
|
13
|
+
} & React.RefAttributes<HanzoguiElement | undefined>>;
|
|
14
|
+
readonly ItemSlot: React.ForwardRefExoticComponent<{
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
} & {
|
|
17
|
+
scope?: any;
|
|
18
|
+
} & React.RefAttributes<HanzoguiElement | undefined>>;
|
|
19
|
+
}, useCollection: (scope: string) => () => {
|
|
20
|
+
ref: React.RefObject<HanzoguiElement | undefined>;
|
|
21
|
+
}[];
|
|
22
|
+
export type SwipeDirection = 'vertical' | 'up' | 'down' | 'horizontal' | 'left' | 'right' | 'auto';
|
|
23
|
+
export type ToastProviderContextValue = {
|
|
24
|
+
id: string;
|
|
25
|
+
toastScope: string;
|
|
26
|
+
label: string;
|
|
27
|
+
duration: number;
|
|
28
|
+
swipeDirection: SwipeDirection;
|
|
29
|
+
swipeThreshold: number;
|
|
30
|
+
toastCount: number;
|
|
31
|
+
viewports: Record<string, HanzoguiElement | null>;
|
|
32
|
+
onViewportChange(name: string, viewport: HanzoguiElement): void;
|
|
33
|
+
onToastAdd(): void;
|
|
34
|
+
onToastRemove(): void;
|
|
35
|
+
isFocusedToastEscapeKeyDownRef: React.MutableRefObject<boolean>;
|
|
36
|
+
isClosePausedRef: React.MutableRefObject<boolean>;
|
|
37
|
+
options: ToastImperativeOptions;
|
|
38
|
+
};
|
|
39
|
+
export type ToastScopes = string;
|
|
40
|
+
type ScopedProps<P> = Omit<P, 'scope'> & {
|
|
41
|
+
scope?: ToastScopes;
|
|
42
|
+
};
|
|
43
|
+
declare const useToastProviderContext: (scope?: string) => ToastProviderContextValue;
|
|
44
|
+
interface ToastProviderProps {
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* An author-localized label for each toast. Used to help screen reader users
|
|
48
|
+
* associate the interruption with a toast.
|
|
49
|
+
* @defaultValue 'Notification'
|
|
50
|
+
*/
|
|
51
|
+
label?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Time in milliseconds that each toast should remain visible for.
|
|
54
|
+
* @defaultValue 5000
|
|
55
|
+
*/
|
|
56
|
+
duration?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Direction of pointer swipe that should close the toast.
|
|
59
|
+
* @defaultValue 'right'
|
|
60
|
+
*/
|
|
61
|
+
swipeDirection?: SwipeDirection;
|
|
62
|
+
/**
|
|
63
|
+
* Distance in pixels that the swipe must pass before a close is triggered.
|
|
64
|
+
* @defaultValue 50
|
|
65
|
+
*/
|
|
66
|
+
swipeThreshold?: number;
|
|
67
|
+
/**
|
|
68
|
+
* @defaultValue unique generated identifier
|
|
69
|
+
*/
|
|
70
|
+
id?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.
|
|
73
|
+
* Only works with the imperative `useToast` hook.
|
|
74
|
+
*/
|
|
75
|
+
native?: NativeValue;
|
|
76
|
+
/**
|
|
77
|
+
* Options for the burnt package if you're using native toasts on mobile
|
|
78
|
+
*/
|
|
79
|
+
burntOptions?: Omit<BurntToastOptions, 'title' | 'message' | 'duration'>;
|
|
80
|
+
/**
|
|
81
|
+
* Options for the notification API if you're using native toasts on web
|
|
82
|
+
*/
|
|
83
|
+
notificationOptions?: NotificationOptions;
|
|
84
|
+
}
|
|
85
|
+
declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
86
|
+
export declare function ReprogapateToastProvider(props: {
|
|
87
|
+
children: React.ReactNode;
|
|
88
|
+
context: ToastProviderContextValue;
|
|
89
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
90
|
+
export { Collection, ToastProvider, useCollection, useToastProviderContext };
|
|
91
|
+
export type { ScopedProps, ToastProviderProps };
|
|
92
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../src/ToastProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGlE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAQhD,QAAA,MAAO,UAAU;;gBATA,CAAC;;aAClB,CAAC;;;aAEiD,CAAC;;;;;;;GAMhC,aAAa;;GAA8C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