@cdx-ui/components 0.0.1-beta.79 → 0.0.1-beta.80
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/lib/commonjs/animation/hooks/index.js +17 -0
- package/lib/commonjs/animation/hooks/index.js.map +1 -0
- package/lib/commonjs/animation/hooks/useCombinedAnimationDisabledState.js +50 -0
- package/lib/commonjs/animation/hooks/useCombinedAnimationDisabledState.js.map +1 -0
- package/lib/commonjs/animation/index.js +39 -0
- package/lib/commonjs/animation/index.js.map +1 -0
- package/lib/commonjs/animation/types.js +6 -0
- package/lib/commonjs/animation/types.js.map +1 -0
- package/lib/commonjs/animation/utils.js +223 -0
- package/lib/commonjs/animation/utils.js.map +1 -0
- package/lib/commonjs/components/CLAUDE.md +1 -1
- package/lib/commonjs/components/Card/index.js +45 -17
- package/lib/commonjs/components/Card/index.js.map +1 -1
- package/lib/commonjs/components/Toast/animation.js +329 -0
- package/lib/commonjs/components/Toast/animation.js.map +1 -0
- package/lib/commonjs/components/Toast/hooks.js +66 -0
- package/lib/commonjs/components/Toast/hooks.js.map +1 -0
- package/lib/commonjs/components/Toast/index.js +493 -0
- package/lib/commonjs/components/Toast/index.js.map +1 -0
- package/lib/commonjs/components/Toast/styles.js +141 -0
- package/lib/commonjs/components/Toast/styles.js.map +1 -0
- package/lib/commonjs/components/Toast/types.js +6 -0
- package/lib/commonjs/components/Toast/types.js.map +1 -0
- package/lib/commonjs/components/index.js +12 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +15 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/providers/animation-settings/index.js +31 -0
- package/lib/commonjs/providers/animation-settings/index.js.map +1 -0
- package/lib/commonjs/providers/animation-settings/provider.js +59 -0
- package/lib/commonjs/providers/animation-settings/provider.js.map +1 -0
- package/lib/commonjs/providers/animation-settings/types.js +6 -0
- package/lib/commonjs/providers/animation-settings/types.js.map +1 -0
- package/lib/commonjs/providers/forge-design/index.js +29 -0
- package/lib/commonjs/providers/forge-design/index.js.map +1 -0
- package/lib/commonjs/providers/forge-design/provider.js +71 -0
- package/lib/commonjs/providers/forge-design/provider.js.map +1 -0
- package/lib/commonjs/providers/forge-design/types.js +6 -0
- package/lib/commonjs/providers/forge-design/types.js.map +1 -0
- package/lib/commonjs/providers/text-component/index.js +28 -0
- package/lib/commonjs/providers/text-component/index.js.map +1 -0
- package/lib/commonjs/providers/text-component/provider.js +11 -0
- package/lib/commonjs/providers/text-component/provider.js.map +1 -0
- package/lib/commonjs/providers/text-component/types.js +6 -0
- package/lib/commonjs/providers/text-component/types.js.map +1 -0
- package/lib/commonjs/providers/toast/index.js +33 -0
- package/lib/commonjs/providers/toast/index.js.map +1 -0
- package/lib/commonjs/providers/toast/insets-container.js +160 -0
- package/lib/commonjs/providers/toast/insets-container.js.map +1 -0
- package/lib/commonjs/providers/toast/lifecycle.context.js +36 -0
- package/lib/commonjs/providers/toast/lifecycle.context.js.map +1 -0
- package/lib/commonjs/providers/toast/provider.js +508 -0
- package/lib/commonjs/providers/toast/provider.js.map +1 -0
- package/lib/commonjs/providers/toast/reducer.js +46 -0
- package/lib/commonjs/providers/toast/reducer.js.map +1 -0
- package/lib/commonjs/providers/toast/toast-config.context.js +29 -0
- package/lib/commonjs/providers/toast/toast-config.context.js.map +1 -0
- package/lib/commonjs/providers/toast/toast-item-renderer.js +43 -0
- package/lib/commonjs/providers/toast/toast-item-renderer.js.map +1 -0
- package/lib/commonjs/providers/toast/types.js +6 -0
- package/lib/commonjs/providers/toast/types.js.map +1 -0
- package/lib/module/animation/hooks/index.js +4 -0
- package/lib/module/animation/hooks/index.js.map +1 -0
- package/lib/module/animation/hooks/useCombinedAnimationDisabledState.js +47 -0
- package/lib/module/animation/hooks/useCombinedAnimationDisabledState.js.map +1 -0
- package/lib/module/animation/index.js +6 -0
- package/lib/module/animation/index.js.map +1 -0
- package/lib/module/animation/types.js +4 -0
- package/lib/module/animation/types.js.map +1 -0
- package/lib/module/animation/utils.js +212 -0
- package/lib/module/animation/utils.js.map +1 -0
- package/lib/module/components/CLAUDE.md +1 -1
- package/lib/module/components/Card/index.js +47 -19
- package/lib/module/components/Card/index.js.map +1 -1
- package/lib/module/components/Toast/animation.js +324 -0
- package/lib/module/components/Toast/animation.js.map +1 -0
- package/lib/module/components/Toast/hooks.js +61 -0
- package/lib/module/components/Toast/hooks.js.map +1 -0
- package/lib/module/components/Toast/index.js +487 -0
- package/lib/module/components/Toast/index.js.map +1 -0
- package/lib/module/components/Toast/styles.js +138 -0
- package/lib/module/components/Toast/styles.js.map +1 -0
- package/lib/module/components/Toast/types.js +4 -0
- package/lib/module/components/Toast/types.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/providers/animation-settings/index.js +4 -0
- package/lib/module/providers/animation-settings/index.js.map +1 -0
- package/lib/module/providers/animation-settings/provider.js +52 -0
- package/lib/module/providers/animation-settings/provider.js.map +1 -0
- package/lib/module/providers/animation-settings/types.js +4 -0
- package/lib/module/providers/animation-settings/types.js.map +1 -0
- package/lib/module/providers/forge-design/index.js +5 -0
- package/lib/module/providers/forge-design/index.js.map +1 -0
- package/lib/module/providers/forge-design/provider.js +66 -0
- package/lib/module/providers/forge-design/provider.js.map +1 -0
- package/lib/module/providers/forge-design/types.js +4 -0
- package/lib/module/providers/forge-design/types.js.map +1 -0
- package/lib/module/providers/text-component/index.js +5 -0
- package/lib/module/providers/text-component/index.js.map +1 -0
- package/lib/module/providers/text-component/provider.js +6 -0
- package/lib/module/providers/text-component/provider.js.map +1 -0
- package/lib/module/providers/text-component/types.js +4 -0
- package/lib/module/providers/text-component/types.js.map +1 -0
- package/lib/module/providers/toast/index.js +6 -0
- package/lib/module/providers/toast/index.js.map +1 -0
- package/lib/module/providers/toast/insets-container.js +156 -0
- package/lib/module/providers/toast/insets-container.js.map +1 -0
- package/lib/module/providers/toast/lifecycle.context.js +32 -0
- package/lib/module/providers/toast/lifecycle.context.js.map +1 -0
- package/lib/module/providers/toast/provider.js +503 -0
- package/lib/module/providers/toast/provider.js.map +1 -0
- package/lib/module/providers/toast/reducer.js +42 -0
- package/lib/module/providers/toast/reducer.js.map +1 -0
- package/lib/module/providers/toast/toast-config.context.js +25 -0
- package/lib/module/providers/toast/toast-config.context.js.map +1 -0
- package/lib/module/providers/toast/toast-item-renderer.js +39 -0
- package/lib/module/providers/toast/toast-item-renderer.js.map +1 -0
- package/lib/module/providers/toast/types.js +4 -0
- package/lib/module/providers/toast/types.js.map +1 -0
- package/lib/typescript/animation/hooks/index.d.ts +2 -0
- package/lib/typescript/animation/hooks/index.d.ts.map +1 -0
- package/lib/typescript/animation/hooks/useCombinedAnimationDisabledState.d.ts +22 -0
- package/lib/typescript/animation/hooks/useCombinedAnimationDisabledState.d.ts.map +1 -0
- package/lib/typescript/animation/index.d.ts +4 -0
- package/lib/typescript/animation/index.d.ts.map +1 -0
- package/lib/typescript/animation/types.d.ts +105 -0
- package/lib/typescript/animation/types.d.ts.map +1 -0
- package/lib/typescript/animation/utils.d.ts +120 -0
- package/lib/typescript/animation/utils.d.ts.map +1 -0
- package/lib/typescript/components/Card/index.d.ts +4 -0
- package/lib/typescript/components/Card/index.d.ts.map +1 -1
- package/lib/typescript/components/Toast/animation.d.ts +21 -0
- package/lib/typescript/components/Toast/animation.d.ts.map +1 -0
- package/lib/typescript/components/Toast/hooks.d.ts +17 -0
- package/lib/typescript/components/Toast/hooks.d.ts.map +1 -0
- package/lib/typescript/components/Toast/index.d.ts +28 -0
- package/lib/typescript/components/Toast/index.d.ts.map +1 -0
- package/lib/typescript/components/Toast/styles.d.ts +73 -0
- package/lib/typescript/components/Toast/styles.d.ts.map +1 -0
- package/lib/typescript/components/Toast/types.d.ts +303 -0
- package/lib/typescript/components/Toast/types.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/providers/animation-settings/index.d.ts +3 -0
- package/lib/typescript/providers/animation-settings/index.d.ts.map +1 -0
- package/lib/typescript/providers/animation-settings/provider.d.ts +28 -0
- package/lib/typescript/providers/animation-settings/provider.d.ts.map +1 -0
- package/lib/typescript/providers/animation-settings/types.d.ts +35 -0
- package/lib/typescript/providers/animation-settings/types.d.ts.map +1 -0
- package/lib/typescript/providers/forge-design/index.d.ts +3 -0
- package/lib/typescript/providers/forge-design/index.d.ts.map +1 -0
- package/lib/typescript/providers/forge-design/provider.d.ts +24 -0
- package/lib/typescript/providers/forge-design/provider.d.ts.map +1 -0
- package/lib/typescript/providers/forge-design/types.d.ts +82 -0
- package/lib/typescript/providers/forge-design/types.d.ts.map +1 -0
- package/lib/typescript/providers/text-component/index.d.ts +3 -0
- package/lib/typescript/providers/text-component/index.d.ts.map +1 -0
- package/lib/typescript/providers/text-component/provider.d.ts +7 -0
- package/lib/typescript/providers/text-component/provider.d.ts.map +1 -0
- package/lib/typescript/providers/text-component/types.d.ts +51 -0
- package/lib/typescript/providers/text-component/types.d.ts.map +1 -0
- package/lib/typescript/providers/toast/index.d.ts +5 -0
- package/lib/typescript/providers/toast/index.d.ts.map +1 -0
- package/lib/typescript/providers/toast/insets-container.d.ts +72 -0
- package/lib/typescript/providers/toast/insets-container.d.ts.map +1 -0
- package/lib/typescript/providers/toast/lifecycle.context.d.ts +32 -0
- package/lib/typescript/providers/toast/lifecycle.context.d.ts.map +1 -0
- package/lib/typescript/providers/toast/provider.d.ts +32 -0
- package/lib/typescript/providers/toast/provider.d.ts.map +1 -0
- package/lib/typescript/providers/toast/reducer.d.ts +14 -0
- package/lib/typescript/providers/toast/reducer.d.ts.map +1 -0
- package/lib/typescript/providers/toast/toast-config.context.d.ts +20 -0
- package/lib/typescript/providers/toast/toast-config.context.d.ts.map +1 -0
- package/lib/typescript/providers/toast/toast-item-renderer.d.ts +7 -0
- package/lib/typescript/providers/toast/toast-item-renderer.d.ts.map +1 -0
- package/lib/typescript/providers/toast/types.d.ts +422 -0
- package/lib/typescript/providers/toast/types.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/animation/hooks/index.ts +1 -0
- package/src/animation/hooks/useCombinedAnimationDisabledState.ts +46 -0
- package/src/animation/index.ts +3 -0
- package/src/animation/types.ts +128 -0
- package/src/animation/utils.ts +249 -0
- package/src/components/CLAUDE.md +1 -1
- package/src/components/Card/index.tsx +58 -28
- package/src/components/Toast/animation.ts +387 -0
- package/src/components/Toast/hooks.ts +92 -0
- package/src/components/Toast/index.tsx +520 -0
- package/src/components/Toast/styles.ts +186 -0
- package/src/components/Toast/types.ts +332 -0
- package/src/components/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/providers/animation-settings/index.ts +11 -0
- package/src/providers/animation-settings/provider.tsx +54 -0
- package/src/providers/animation-settings/types.ts +37 -0
- package/src/providers/forge-design/index.ts +2 -0
- package/src/providers/forge-design/provider.tsx +61 -0
- package/src/providers/forge-design/types.ts +84 -0
- package/src/providers/text-component/index.ts +2 -0
- package/src/providers/text-component/provider.tsx +7 -0
- package/src/providers/text-component/types.ts +52 -0
- package/src/providers/toast/index.ts +4 -0
- package/src/providers/toast/insets-container.tsx +230 -0
- package/src/providers/toast/lifecycle.context.tsx +37 -0
- package/src/providers/toast/provider.tsx +567 -0
- package/src/providers/toast/reducer.ts +40 -0
- package/src/providers/toast/toast-config.context.ts +25 -0
- package/src/providers/toast/toast-item-renderer.tsx +40 -0
- package/src/providers/toast/types.ts +431 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ToastInsets } from './types';
|
|
3
|
+
interface InsetsContainerProps {
|
|
4
|
+
/**
|
|
5
|
+
* When true, uses a regular View instead of FullWindowOverlay on iOS.
|
|
6
|
+
* Enables element inspector but toasts won't appear above native modals.
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
disableFullWindowOverlay: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Controls whether VoiceOver treats the overlay window as a modal container.
|
|
12
|
+
* When `false`, VoiceOver can still access elements behind the overlay.
|
|
13
|
+
* When `true`, VoiceOver is restricted to elements inside the overlay.
|
|
14
|
+
* @default false
|
|
15
|
+
* @platform ios
|
|
16
|
+
* @unstable This prop maps directly to the native `accessibilityViewIsModal`
|
|
17
|
+
* on the container view and may change in a future react-native-screens release.
|
|
18
|
+
*/
|
|
19
|
+
unstable_accessibilityContainerViewIsModal?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Optional inset values for all edges
|
|
22
|
+
* If not provided, defaults to platform-specific values:
|
|
23
|
+
* - iOS: safe area insets + 0px (top), + 6px (bottom), + 12px (left/right)
|
|
24
|
+
* - Android: safe area insets + 12px (all edges)
|
|
25
|
+
*/
|
|
26
|
+
insets?: ToastInsets;
|
|
27
|
+
/**
|
|
28
|
+
* Accessible label for the toast notification region on web.
|
|
29
|
+
* @default 'Notifications'
|
|
30
|
+
* @platform web
|
|
31
|
+
*/
|
|
32
|
+
announceLabel?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Custom wrapper function to wrap the toast content
|
|
35
|
+
* Receives children and should return a component that wraps them
|
|
36
|
+
* The wrapper should apply flex: 1 (via className or style) to ensure proper layout
|
|
37
|
+
* Can be any component wrapper - KeyboardAvoidingView, View, or any custom component
|
|
38
|
+
*/
|
|
39
|
+
contentWrapper?: (children: ReactNode) => React.ReactElement;
|
|
40
|
+
/**
|
|
41
|
+
* Pause all auto-dismiss timers (WCAG 2.2.1).
|
|
42
|
+
*/
|
|
43
|
+
pauseAll: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Resume all auto-dismiss timers.
|
|
46
|
+
*/
|
|
47
|
+
resumeAll: () => void;
|
|
48
|
+
/**
|
|
49
|
+
* Hide the front-most toast. Used by the Escape key handler on web.
|
|
50
|
+
*/
|
|
51
|
+
hide: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Children to render inside the container
|
|
54
|
+
*/
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Container component that applies inset padding to position toasts
|
|
59
|
+
* away from screen edges and safe areas
|
|
60
|
+
*
|
|
61
|
+
* Combines custom insets with safe area insets:
|
|
62
|
+
* - If custom inset is provided, it overrides safe area + default padding
|
|
63
|
+
* - If not provided, uses platform-specific defaults:
|
|
64
|
+
* - iOS: safe area inset + 0px for top, + 6px for bottom, + 12px for left/right
|
|
65
|
+
* - Android: safe area inset + 12px for all edges
|
|
66
|
+
*
|
|
67
|
+
* On web, wires pointer/focus/visibility listeners to pause/resume timers
|
|
68
|
+
* per WCAG 2.2.1 (keyboard/pointer/hidden-tab pausing).
|
|
69
|
+
*/
|
|
70
|
+
export declare function InsetsContainer({ insets, announceLabel, contentWrapper, children, disableFullWindowOverlay, unstable_accessibilityContainerViewIsModal, pauseAll, resumeAll, hide, }: Readonly<InsetsContainerProps>): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=insets-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insets-container.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/insets-container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,UAAU,oBAAoB;IAC5B;;;;OAIG;IACH,wBAAwB,EAAE,OAAO,CAAC;IAClC;;;;;;;;OAQG;IACH,0CAA0C,CAAC,EAAE,OAAO,CAAC;IACrD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC;IAC7D;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,aAA+B,EAC/B,cAAc,EACd,QAAQ,EACR,wBAAwB,EACxB,0CAA0C,EAC1C,QAAQ,EACR,SAAS,EACT,IAAI,GACL,EAAE,QAAQ,CAAC,oBAAoB,CAAC,2CAgJhC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal context that exposes the pending-removal lifecycle for web toasts.
|
|
3
|
+
*
|
|
4
|
+
* Web toasts stay mounted after `hide()` is dispatched so the CSS exit
|
|
5
|
+
* transition can play. The toast component reads `pendingRemovalIds` to
|
|
6
|
+
* flip its `data-state="closed"` attribute and calls `remove(id)` when
|
|
7
|
+
* the CSS transition completes (or a safety timeout fires).
|
|
8
|
+
*
|
|
9
|
+
* On native this context is provided but effectively unused — Reanimated's
|
|
10
|
+
* `exiting` layout animation plays before unmount, so nothing lingers.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export interface ToastLifecycleContextValue {
|
|
15
|
+
/** Force-remove a toast from the array once its exit transition has played. */
|
|
16
|
+
remove: (id: string) => void;
|
|
17
|
+
/** IDs of toasts that have been marked closed but are still mounted. */
|
|
18
|
+
pendingRemovalIds: ReadonlySet<string>;
|
|
19
|
+
/** ID of the front-most (last non-pending) toast, or null if none. */
|
|
20
|
+
frontmostId: string | null;
|
|
21
|
+
}
|
|
22
|
+
export declare const ToastLifecycleContext: import("react").Context<ToastLifecycleContextValue | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Access the toast lifecycle context.
|
|
25
|
+
*
|
|
26
|
+
* Returns `null` when the styled Toast is rendered outside a `ToastProvider`
|
|
27
|
+
* (e.g. in isolated unit tests) so callers must handle the null case.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export declare function useToastLifecycle(): ToastLifecycleContextValue | null;
|
|
32
|
+
//# sourceMappingURL=lifecycle.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.context.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/lifecycle.context.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,0BAA0B;IACzC,+EAA+E;IAC/E,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,wEAAwE;IACxE,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,sEAAsE;IACtE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,4DAAyD,CAAC;AAE5F;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,GAAG,IAAI,CAErE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ToastProviderProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Toast provider component
|
|
4
|
+
* Wraps your app to enable toast functionality
|
|
5
|
+
*/
|
|
6
|
+
export declare function ToastProvider({ defaultProps, insets, maxVisibleToasts, contentWrapper, children, disableFullWindowOverlay, unstable_accessibilityContainerViewIsModal, announceLabel, }: Readonly<ToastProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Hook to access toast functionality
|
|
9
|
+
*
|
|
10
|
+
* @returns Object containing toast manager and visibility state
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const { toast, isToastVisible } = useToast();
|
|
15
|
+
*
|
|
16
|
+
* // Show a toast
|
|
17
|
+
* toast.show({ component: <Toast>Hello</Toast> });
|
|
18
|
+
*
|
|
19
|
+
* // Hide a toast
|
|
20
|
+
* toast.hide('my-toast');
|
|
21
|
+
*
|
|
22
|
+
* // Check if any toast is visible
|
|
23
|
+
* if (isToastVisible) {
|
|
24
|
+
* console.log('A toast is currently displayed');
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function useToast(): {
|
|
29
|
+
toast: import("./types").ToastManager;
|
|
30
|
+
isToastVisible: boolean;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/provider.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAIV,kBAAkB,EAInB,MAAM,SAAS,CAAC;AA2FjB;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,YAAY,EACZ,MAAM,EACN,gBAAoB,EACpB,cAAc,EACd,QAAQ,EACR,wBAAgC,EAChC,0CAA0C,EAC1C,aAAa,GACd,EAAE,QAAQ,CAAC,kBAAkB,CAAC,2CAmZ9B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ;;;EAWvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToastAction, ToastItem } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Reducer for managing toast state
|
|
4
|
+
*
|
|
5
|
+
* Removal is a two-phase flow so web can play its CSS exit transition
|
|
6
|
+
* before the DOM node is unmounted:
|
|
7
|
+
* `MARK_CLOSED` → flips `pendingRemoval: true` (node stays mounted).
|
|
8
|
+
* `REMOVE` → filters the toast out of the array (node unmounts).
|
|
9
|
+
*
|
|
10
|
+
* Native dispatches `REMOVE` directly since Reanimated's `exiting`
|
|
11
|
+
* layout animation plays before unmount without a lingering state.
|
|
12
|
+
*/
|
|
13
|
+
export declare function toastReducer(state: ToastItem[], action: ToastAction): ToastItem[];
|
|
14
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,EAAE,CA0BjF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ToastGlobalConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Context for global toast configuration
|
|
4
|
+
* Extracted to separate file to avoid circular dependencies with toast component
|
|
5
|
+
*/
|
|
6
|
+
declare const ToastConfigContext: import("react").Context<ToastGlobalConfig | undefined>;
|
|
7
|
+
/**
|
|
8
|
+
* Hook to access global toast configuration
|
|
9
|
+
*
|
|
10
|
+
* @returns Global toast configuration or undefined if not set
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const globalConfig = useToastConfig();
|
|
15
|
+
* // Use globalConfig.color, globalConfig.placement, etc.
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function useToastConfig(): ToastGlobalConfig | undefined;
|
|
19
|
+
export { ToastConfigContext };
|
|
20
|
+
//# sourceMappingURL=toast-config.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-config.context.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/toast-config.context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;GAGG;AACH,QAAA,MAAM,kBAAkB,wDAA0D,CAAC;AAEnF;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,IAAI,iBAAiB,GAAG,SAAS,CAE9D;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ToastItemRendererProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Memoized toast item component to prevent unnecessary re-renders
|
|
4
|
+
* Only re-renders when the toast item itself changes
|
|
5
|
+
*/
|
|
6
|
+
export declare const ToastItemRenderer: import("react").MemoExoticComponent<({ toastItem, show, hide, index, total, heights, maxVisibleToasts }: ToastItemRendererProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
7
|
+
//# sourceMappingURL=toast-item-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-item-renderer.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/toast-item-renderer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,2GACyC,sBAAsB,gGA+B5F,CAAC"}
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
import type { SharedValue } from 'react-native-reanimated';
|
|
2
|
+
import type { ToastProps } from '../../components/Toast/types';
|
|
3
|
+
/**
|
|
4
|
+
* Global toast configuration
|
|
5
|
+
* These values are used as defaults for all toasts unless overridden locally
|
|
6
|
+
*/
|
|
7
|
+
export interface ToastGlobalConfig extends Pick<ToastProps, 'animation' | 'color' | 'placement' | 'isSwipeable'> {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Insets for spacing from screen edges
|
|
11
|
+
*/
|
|
12
|
+
export interface ToastInsets {
|
|
13
|
+
/**
|
|
14
|
+
* Inset from the top edge in pixels (added to safe area inset)
|
|
15
|
+
* @default Platform-specific: iOS = 0, Android = 12
|
|
16
|
+
*/
|
|
17
|
+
top?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Inset from the bottom edge in pixels (added to safe area inset)
|
|
20
|
+
* @default Platform-specific: iOS = 6, Android = 12
|
|
21
|
+
*/
|
|
22
|
+
bottom?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Inset from the left edge in pixels (added to safe area inset)
|
|
25
|
+
* @default 12
|
|
26
|
+
*/
|
|
27
|
+
left?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Inset from the right edge in pixels (added to safe area inset)
|
|
30
|
+
* @default 12
|
|
31
|
+
*/
|
|
32
|
+
right?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props for the ToastProvider component
|
|
36
|
+
*/
|
|
37
|
+
export interface ToastProviderProps {
|
|
38
|
+
/**
|
|
39
|
+
* When true, uses a regular View instead of FullWindowOverlay on iOS for toasts.
|
|
40
|
+
* Enables React Native element inspector but toasts won't appear above native modals.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
disableFullWindowOverlay?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Controls whether VoiceOver treats the toast overlay window as a modal container.
|
|
46
|
+
* When `false`, VoiceOver can still access elements behind the overlay.
|
|
47
|
+
* When `true`, VoiceOver is restricted to elements inside the overlay.
|
|
48
|
+
* @default false
|
|
49
|
+
* @platform ios
|
|
50
|
+
* @unstable This prop maps directly to the native `accessibilityViewIsModal`
|
|
51
|
+
* on the container view and may change in a future react-native-screens release.
|
|
52
|
+
*/
|
|
53
|
+
unstable_accessibilityContainerViewIsModal?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Global toast configuration
|
|
56
|
+
* These values are used as defaults for all toasts unless overridden locally
|
|
57
|
+
* Local configs have precedence over global config
|
|
58
|
+
*/
|
|
59
|
+
defaultProps?: ToastGlobalConfig;
|
|
60
|
+
/**
|
|
61
|
+
* Insets for spacing from screen edges (added to safe area insets)
|
|
62
|
+
* @default Platform-specific:
|
|
63
|
+
* - iOS: { top: 0, bottom: 6, left: 12, right: 12 }
|
|
64
|
+
* - Android: { top: 12, bottom: 12, left: 12, right: 12 }
|
|
65
|
+
*/
|
|
66
|
+
insets?: ToastInsets;
|
|
67
|
+
/**
|
|
68
|
+
* Maximum number of visible toasts before opacity starts fading
|
|
69
|
+
* Controls when toast items begin to fade out as they move beyond the visible stack
|
|
70
|
+
* @default 3
|
|
71
|
+
*/
|
|
72
|
+
maxVisibleToasts?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Custom wrapper function to wrap the toast content
|
|
75
|
+
* Receives children and should return a component that wraps them
|
|
76
|
+
* The wrapper should apply flex: 1 (via className or style) to ensure proper layout
|
|
77
|
+
* Can be any component wrapper - KeyboardAvoidingView, View, or any custom component
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <ToastProvider
|
|
82
|
+
* contentWrapper={(children) => (
|
|
83
|
+
* <KeyboardAvoidingView
|
|
84
|
+
* behavior="padding"
|
|
85
|
+
* keyboardVerticalOffset={24}
|
|
86
|
+
* className="flex-1"
|
|
87
|
+
* >
|
|
88
|
+
* {children}
|
|
89
|
+
* </KeyboardAvoidingView>
|
|
90
|
+
* )}
|
|
91
|
+
* >
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
contentWrapper?: (children: React.ReactNode) => React.ReactElement;
|
|
95
|
+
/**
|
|
96
|
+
* Accessible label for the toast notification region on web.
|
|
97
|
+
* Screen readers announce this as the landmark name for the ARIA live region
|
|
98
|
+
* that wraps all visible toasts.
|
|
99
|
+
* @default 'Notifications'
|
|
100
|
+
* @platform web
|
|
101
|
+
*/
|
|
102
|
+
announceLabel?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Children to render
|
|
105
|
+
*/
|
|
106
|
+
children?: React.ReactNode;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Props passed to the toast component function
|
|
110
|
+
*/
|
|
111
|
+
export interface ToastComponentProps {
|
|
112
|
+
/**
|
|
113
|
+
* The unique ID of the toast
|
|
114
|
+
*/
|
|
115
|
+
id: string;
|
|
116
|
+
/**
|
|
117
|
+
* The index of the toast in the array (0-based)
|
|
118
|
+
*/
|
|
119
|
+
index: number;
|
|
120
|
+
/**
|
|
121
|
+
* The total number of toasts currently displayed
|
|
122
|
+
*/
|
|
123
|
+
total: SharedValue<number>;
|
|
124
|
+
/**
|
|
125
|
+
* Heights of all toast items, keyed by toast ID
|
|
126
|
+
*/
|
|
127
|
+
heights: SharedValue<Record<string, number>>;
|
|
128
|
+
/**
|
|
129
|
+
* Maximum number of visible toasts before opacity starts fading
|
|
130
|
+
* Controls when toast items begin to fade out as they move beyond the visible stack
|
|
131
|
+
* @default 3
|
|
132
|
+
*/
|
|
133
|
+
maxVisibleToasts?: number;
|
|
134
|
+
/**
|
|
135
|
+
* Show a new toast
|
|
136
|
+
*/
|
|
137
|
+
show: (options: string | ToastShowOptions) => string;
|
|
138
|
+
/**
|
|
139
|
+
* Hide one or more toasts
|
|
140
|
+
* - No argument: hides the last toast in the array
|
|
141
|
+
* - "all": hides all toasts
|
|
142
|
+
* - Single ID: hides that toast
|
|
143
|
+
* - Array of IDs: hides those toasts
|
|
144
|
+
*/
|
|
145
|
+
hide: (ids?: (string & {}) | string[] | 'all') => void;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Configuration for showing a default styled toast (usage pattern 2)
|
|
149
|
+
* Used when component is not provided
|
|
150
|
+
*/
|
|
151
|
+
export interface ToastShowConfig extends Pick<ToastProps, 'color' | 'placement' | 'isSwipeable' | 'animation'> {
|
|
152
|
+
/**
|
|
153
|
+
* Duration in milliseconds before the toast automatically disappears
|
|
154
|
+
* Set to `'persistent'` to prevent auto-hide (toast will remain until manually dismissed)
|
|
155
|
+
* @default 4000
|
|
156
|
+
*/
|
|
157
|
+
duration?: number | 'persistent';
|
|
158
|
+
/**
|
|
159
|
+
* Optional ID for the toast
|
|
160
|
+
* If not provided, one will be generated automatically
|
|
161
|
+
*/
|
|
162
|
+
id?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Label text for the toast
|
|
165
|
+
*/
|
|
166
|
+
label?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Description text for the toast
|
|
169
|
+
*/
|
|
170
|
+
description?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Action button label text
|
|
173
|
+
*/
|
|
174
|
+
actionLabel?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Callback function called when the action button is pressed
|
|
177
|
+
* Receives show and hide functions for programmatic toast control
|
|
178
|
+
*/
|
|
179
|
+
onActionPress?: (helpers: {
|
|
180
|
+
show: (options: string | ToastShowOptions) => string;
|
|
181
|
+
hide: (ids?: (string & {}) | string[] | 'all') => void;
|
|
182
|
+
}) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Forge icon component to display in the toast.
|
|
185
|
+
* Rendered via `Toast.Icon` internally — inherits color-aware coloring automatically.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```tsx
|
|
189
|
+
* import { CheckCircle } from '@cdx-ui/icons';
|
|
190
|
+
* toast.show({ color: 'success', label: 'Done', icon: CheckCircle });
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
icon?: import('@cdx-ui/icons').ForgeIcon;
|
|
194
|
+
/**
|
|
195
|
+
* Callback function called when the toast is shown
|
|
196
|
+
*/
|
|
197
|
+
onShow?: () => void;
|
|
198
|
+
/**
|
|
199
|
+
* Callback function called when the toast is hidden
|
|
200
|
+
*/
|
|
201
|
+
onHide?: () => void;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Options for showing a toast with custom component (usage pattern 3)
|
|
205
|
+
* Used when component is provided
|
|
206
|
+
*/
|
|
207
|
+
export interface ToastShowOptionsWithComponent {
|
|
208
|
+
/**
|
|
209
|
+
* Optional ID for the toast
|
|
210
|
+
* If not provided, one will be generated automatically
|
|
211
|
+
*/
|
|
212
|
+
id?: string;
|
|
213
|
+
/**
|
|
214
|
+
* A function that receives toast props and returns a React element
|
|
215
|
+
*/
|
|
216
|
+
component: (props: ToastComponentProps) => React.ReactElement;
|
|
217
|
+
/**
|
|
218
|
+
* Duration in milliseconds before the toast automatically disappears
|
|
219
|
+
* Set to `'persistent'` to prevent auto-hide (toast will remain until manually dismissed)
|
|
220
|
+
* @default 4000
|
|
221
|
+
*/
|
|
222
|
+
duration?: number | 'persistent';
|
|
223
|
+
/**
|
|
224
|
+
* Callback function called when the toast is shown
|
|
225
|
+
*/
|
|
226
|
+
onShow?: () => void;
|
|
227
|
+
/**
|
|
228
|
+
* Callback function called when the toast is hidden
|
|
229
|
+
*/
|
|
230
|
+
onHide?: () => void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Conditional type for toast show options
|
|
234
|
+
* - If component is provided: only id, component, onShow, onHide are allowed
|
|
235
|
+
* - If component is NOT provided: all config props are available
|
|
236
|
+
*/
|
|
237
|
+
export type ToastShowOptions = ToastShowOptionsWithComponent | (ToastShowConfig & {
|
|
238
|
+
component?: never;
|
|
239
|
+
});
|
|
240
|
+
/**
|
|
241
|
+
* Represents a single toast item in the state
|
|
242
|
+
*/
|
|
243
|
+
export interface ToastItem {
|
|
244
|
+
/**
|
|
245
|
+
* Unique identifier for the toast
|
|
246
|
+
*/
|
|
247
|
+
id: string;
|
|
248
|
+
/**
|
|
249
|
+
* A function that receives toast props and returns a React element
|
|
250
|
+
*/
|
|
251
|
+
component: (props: ToastComponentProps) => React.ReactElement;
|
|
252
|
+
/**
|
|
253
|
+
* Duration in milliseconds before the toast automatically disappears
|
|
254
|
+
* Set to `'persistent'` to prevent auto-hide (toast will remain until manually dismissed)
|
|
255
|
+
* @default 4000
|
|
256
|
+
*/
|
|
257
|
+
duration?: number | 'persistent';
|
|
258
|
+
/**
|
|
259
|
+
* Callback function called when the toast is shown
|
|
260
|
+
*/
|
|
261
|
+
onShow?: () => void;
|
|
262
|
+
/**
|
|
263
|
+
* Callback function called when the toast is hidden
|
|
264
|
+
*/
|
|
265
|
+
onHide?: () => void;
|
|
266
|
+
/**
|
|
267
|
+
* True after `hide()` has been called but before the toast has actually
|
|
268
|
+
* been removed from the array. Used on web to keep the DOM node mounted
|
|
269
|
+
* through its CSS exit transition; on native this remains false because
|
|
270
|
+
* Reanimated `exiting` handles the exit animation before unmount.
|
|
271
|
+
* @internal
|
|
272
|
+
*/
|
|
273
|
+
pendingRemoval?: boolean;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Actions for the toast reducer.
|
|
277
|
+
*
|
|
278
|
+
* Removal happens in two phases so web can play a CSS exit transition
|
|
279
|
+
* before the node is torn down:
|
|
280
|
+
* 1. `MARK_CLOSED` flips `pendingRemoval` on the matching toasts.
|
|
281
|
+
* 2. `REMOVE` actually filters them out of the array.
|
|
282
|
+
*
|
|
283
|
+
* On native, `hide()` dispatches `REMOVE` directly because Reanimated's
|
|
284
|
+
* layout animation plays before unmount without a lingering state.
|
|
285
|
+
*/
|
|
286
|
+
export type ToastAction = {
|
|
287
|
+
type: 'SHOW';
|
|
288
|
+
payload: ToastItem;
|
|
289
|
+
} | {
|
|
290
|
+
type: 'MARK_CLOSED';
|
|
291
|
+
payload: {
|
|
292
|
+
ids: string[];
|
|
293
|
+
};
|
|
294
|
+
} | {
|
|
295
|
+
type: 'REMOVE';
|
|
296
|
+
payload: {
|
|
297
|
+
ids: string[];
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* Toast manager API
|
|
302
|
+
*/
|
|
303
|
+
export interface ToastManager {
|
|
304
|
+
/**
|
|
305
|
+
* Show a toast
|
|
306
|
+
* @param options - Toast configuration options or simple string
|
|
307
|
+
* @returns The ID of the shown toast
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```tsx
|
|
311
|
+
* const toast = useToast();
|
|
312
|
+
*
|
|
313
|
+
* // Simple string (usage pattern 1)
|
|
314
|
+
* toast.show('This is toast');
|
|
315
|
+
*
|
|
316
|
+
* // Config object with default styling (usage pattern 2)
|
|
317
|
+
* toast.show({
|
|
318
|
+
* label: 'Success!',
|
|
319
|
+
* description: 'Your action was completed',
|
|
320
|
+
* color: 'success',
|
|
321
|
+
* actionLabel: 'Undo',
|
|
322
|
+
* onActionPress: ({ show, hide }) => hide(),
|
|
323
|
+
* });
|
|
324
|
+
*
|
|
325
|
+
* // Custom component (usage pattern 3)
|
|
326
|
+
* toast.show({
|
|
327
|
+
* component: (props) => <Toast>Hello</Toast>,
|
|
328
|
+
* });
|
|
329
|
+
*
|
|
330
|
+
* // With custom ID
|
|
331
|
+
* toast.show({ id: 'my-toast', component: (props) => <Toast>Hello</Toast> });
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
show: (options: string | ToastShowOptions) => string;
|
|
335
|
+
/**
|
|
336
|
+
* Hide one or more toasts
|
|
337
|
+
*
|
|
338
|
+
* @param ids - Optional ID(s) of toast(s) to hide
|
|
339
|
+
* - No argument: hides the last toast in the array
|
|
340
|
+
* - "all": hides all toasts
|
|
341
|
+
* - Single ID: hides that toast
|
|
342
|
+
* - Array of IDs: hides those toasts
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```tsx
|
|
346
|
+
* const toast = useToast();
|
|
347
|
+
*
|
|
348
|
+
* toast.hide(); // Hide the last toast
|
|
349
|
+
* toast.hide('all'); // Hide all toasts
|
|
350
|
+
* toast.hide('my-toast'); // Hide specific toast
|
|
351
|
+
* toast.hide(['toast-1', 'toast-2']); // Hide multiple toasts
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
hide: (ids?: (string & {}) | string[] | 'all') => void;
|
|
355
|
+
/**
|
|
356
|
+
* Pause all auto-dismiss timers.
|
|
357
|
+
*
|
|
358
|
+
* On web this is called automatically when the pointer enters the toast
|
|
359
|
+
* region, a toast receives focus, or the browser tab becomes hidden
|
|
360
|
+
* (WCAG 2.2.1 compliance). On native this is a no-op unless called
|
|
361
|
+
* explicitly by a consumer.
|
|
362
|
+
*/
|
|
363
|
+
pauseAll: () => void;
|
|
364
|
+
/**
|
|
365
|
+
* Resume all previously paused auto-dismiss timers.
|
|
366
|
+
*
|
|
367
|
+
* Each timer resumes with only the remaining duration that was left when
|
|
368
|
+
* `pauseAll()` was invoked. On native this is a no-op unless called
|
|
369
|
+
* explicitly by a consumer.
|
|
370
|
+
*/
|
|
371
|
+
resumeAll: () => void;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Props for the ToastItemRenderer component
|
|
375
|
+
*/
|
|
376
|
+
export interface ToastItemRendererProps {
|
|
377
|
+
/**
|
|
378
|
+
* The toast item to render
|
|
379
|
+
*/
|
|
380
|
+
toastItem: ToastItem;
|
|
381
|
+
/**
|
|
382
|
+
* The index of the toast in the array (0-based)
|
|
383
|
+
*/
|
|
384
|
+
index: number;
|
|
385
|
+
/**
|
|
386
|
+
* The total number of toasts currently displayed
|
|
387
|
+
*/
|
|
388
|
+
total: SharedValue<number>;
|
|
389
|
+
/**
|
|
390
|
+
* Heights of all toast items, keyed by toast ID
|
|
391
|
+
*/
|
|
392
|
+
heights: SharedValue<Record<string, number>>;
|
|
393
|
+
/**
|
|
394
|
+
* Maximum number of visible toasts before opacity starts fading
|
|
395
|
+
* Controls when toast items begin to fade out as they move beyond the visible stack
|
|
396
|
+
* @default 3
|
|
397
|
+
*/
|
|
398
|
+
maxVisibleToasts?: number;
|
|
399
|
+
/**
|
|
400
|
+
* Show a new toast
|
|
401
|
+
*/
|
|
402
|
+
show: (options: string | ToastShowOptions) => string;
|
|
403
|
+
/**
|
|
404
|
+
* Hide one or more toasts
|
|
405
|
+
* - No argument: hides the last toast in the array
|
|
406
|
+
* - "all": hides all toasts
|
|
407
|
+
* - Single ID: hides that toast
|
|
408
|
+
* - Array of IDs: hides those toasts
|
|
409
|
+
*/
|
|
410
|
+
hide: (ids?: (string & {}) | string[] | 'all') => void;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Context value for the toast provider
|
|
414
|
+
*/
|
|
415
|
+
export interface ToasterContextValue {
|
|
416
|
+
toast: ToastManager;
|
|
417
|
+
/**
|
|
418
|
+
* Whether any toast is currently visible
|
|
419
|
+
*/
|
|
420
|
+
isToastVisible: boolean;
|
|
421
|
+
}
|
|
422
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/providers/toast/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,UAAU,EACV,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,aAAa,CACpD;CAAG;AAEJ;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;OAQG;IACH,0CAA0C,CAAC,EAAE,OAAO,CAAC;IACrD;;;;OAIG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC;IACnE;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ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AAE,YAAY,CAAC;IACpB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;CACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.80",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
68
68
|
"class-variance-authority": "^0.7.1",
|
|
69
69
|
"uniwind": "1.10.0",
|
|
70
|
-
"@cdx-ui/primitives": "0.0.1-beta.
|
|
71
|
-
"@cdx-ui/icons": "0.0.1-beta.
|
|
72
|
-
"@cdx-ui/utils": "0.0.1-beta.
|
|
70
|
+
"@cdx-ui/primitives": "0.0.1-beta.80",
|
|
71
|
+
"@cdx-ui/icons": "0.0.1-beta.80",
|
|
72
|
+
"@cdx-ui/utils": "0.0.1-beta.80"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@react-navigation/bottom-tabs": "*",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useCombinedAnimationDisabledState';
|