react-native-bread 0.1.0 → 0.1.2

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.
Files changed (69) hide show
  1. package/README.md +102 -84
  2. package/lib/commonjs/icons/CloseIcon.js +1 -22
  3. package/lib/commonjs/icons/GreenCheck.js +1 -27
  4. package/lib/commonjs/icons/InfoIcon.js +1 -24
  5. package/lib/commonjs/icons/RedX.js +1 -27
  6. package/lib/commonjs/icons/index.js +1 -34
  7. package/lib/commonjs/index.js +1 -59
  8. package/lib/commonjs/toast-api.js +1 -127
  9. package/lib/commonjs/toast-provider.js +1 -71
  10. package/lib/commonjs/toast-store.js +1 -278
  11. package/lib/commonjs/toast.js +1 -445
  12. package/lib/commonjs/types.js +1 -6
  13. package/lib/module/icons/CloseIcon.js +1 -16
  14. package/lib/module/icons/GreenCheck.js +1 -21
  15. package/lib/module/icons/InfoIcon.js +1 -18
  16. package/lib/module/icons/RedX.js +1 -21
  17. package/lib/module/icons/index.js +1 -7
  18. package/lib/module/index.js +1 -14
  19. package/lib/module/toast-api.js +1 -124
  20. package/lib/module/toast-provider.js +1 -67
  21. package/lib/module/toast-store.js +1 -274
  22. package/lib/module/toast.js +1 -439
  23. package/lib/module/types.js +1 -4
  24. package/lib/typescript/toast-provider.d.ts +13 -12
  25. package/package.json +7 -6
  26. package/lib/commonjs/icons/CloseIcon.js.map +0 -1
  27. package/lib/commonjs/icons/GreenCheck.js.map +0 -1
  28. package/lib/commonjs/icons/InfoIcon.js.map +0 -1
  29. package/lib/commonjs/icons/RedX.js.map +0 -1
  30. package/lib/commonjs/icons/index.js.map +0 -1
  31. package/lib/commonjs/index.js.map +0 -1
  32. package/lib/commonjs/toast-api.js.map +0 -1
  33. package/lib/commonjs/toast-provider.js.map +0 -1
  34. package/lib/commonjs/toast-store.js.map +0 -1
  35. package/lib/commonjs/toast.js.map +0 -1
  36. package/lib/commonjs/types.js.map +0 -1
  37. package/lib/module/icons/CloseIcon.js.map +0 -1
  38. package/lib/module/icons/GreenCheck.js.map +0 -1
  39. package/lib/module/icons/InfoIcon.js.map +0 -1
  40. package/lib/module/icons/RedX.js.map +0 -1
  41. package/lib/module/icons/index.js.map +0 -1
  42. package/lib/module/index.js.map +0 -1
  43. package/lib/module/toast-api.js.map +0 -1
  44. package/lib/module/toast-provider.js.map +0 -1
  45. package/lib/module/toast-store.js.map +0 -1
  46. package/lib/module/toast.js.map +0 -1
  47. package/lib/module/types.js.map +0 -1
  48. package/lib/typescript/icons/CloseIcon.d.ts.map +0 -1
  49. package/lib/typescript/icons/GreenCheck.d.ts.map +0 -1
  50. package/lib/typescript/icons/InfoIcon.d.ts.map +0 -1
  51. package/lib/typescript/icons/RedX.d.ts.map +0 -1
  52. package/lib/typescript/icons/index.d.ts.map +0 -1
  53. package/lib/typescript/index.d.ts.map +0 -1
  54. package/lib/typescript/toast-api.d.ts.map +0 -1
  55. package/lib/typescript/toast-provider.d.ts.map +0 -1
  56. package/lib/typescript/toast-store.d.ts.map +0 -1
  57. package/lib/typescript/toast.d.ts.map +0 -1
  58. package/lib/typescript/types.d.ts.map +0 -1
  59. package/src/icons/CloseIcon.tsx +0 -10
  60. package/src/icons/GreenCheck.tsx +0 -16
  61. package/src/icons/InfoIcon.tsx +0 -12
  62. package/src/icons/RedX.tsx +0 -16
  63. package/src/icons/index.ts +0 -4
  64. package/src/index.ts +0 -26
  65. package/src/toast-api.ts +0 -213
  66. package/src/toast-provider.tsx +0 -81
  67. package/src/toast-store.ts +0 -270
  68. package/src/toast.tsx +0 -417
  69. package/src/types.ts +0 -121
package/src/types.ts DELETED
@@ -1,121 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { TextStyle, ViewStyle } from "react-native";
3
-
4
- export type ToastType = "success" | "error" | "info" | "loading";
5
-
6
- export type ToastPosition = "top" | "bottom";
7
-
8
- export interface ToastTypeColors {
9
- /** Accent color used for title text and icons */
10
- accent: string;
11
- /** Background color of the toast */
12
- background: string;
13
- }
14
-
15
- /** Props passed to custom icon render functions */
16
- export interface IconProps {
17
- /** The accent color from the theme for this toast type */
18
- color: string;
19
- /** Default icon size */
20
- size: number;
21
- }
22
-
23
- /** Custom icon render function */
24
- export type IconRenderFn = (props: IconProps) => ReactNode;
25
-
26
- export interface ToastTheme {
27
- /** Position of toasts on screen */
28
- position: ToastPosition;
29
- /** Extra offset from safe area edge (in addition to safe area insets) */
30
- offset: number;
31
- /** Whether to show multiple toasts stacked (default: true). When false, only one toast shows at a time. */
32
- stacking: boolean;
33
- /** Maximum number of toasts visible at once when stacking is enabled (default: 3) */
34
- maxStack: number;
35
- /** Whether toasts can be dismissed via swipe gesture (default: true) */
36
- dismissible: boolean;
37
- /** Whether to show the close button on toasts (default: true). Loading toasts never show close button. */
38
- showCloseButton: boolean;
39
- /** Colors for each toast type */
40
- colors: Record<ToastType, ToastTypeColors>;
41
- /** Custom icons for each toast type */
42
- icons: Partial<Record<ToastType, IconRenderFn>>;
43
- /** Style overrides for the toast container */
44
- toastStyle: ViewStyle;
45
- /** Style overrides for the title text */
46
- titleStyle: TextStyle;
47
- /** Style overrides for the description text */
48
- descriptionStyle: TextStyle;
49
- /** Default duration in ms for toasts (default: 4000) */
50
- defaultDuration: number;
51
- }
52
-
53
- /** Per-toast options for customizing individual toasts */
54
- export interface ToastOptions {
55
- /** Description text */
56
- description?: string;
57
- /** Duration in ms (overrides default) */
58
- duration?: number;
59
- /** Custom icon (ReactNode or render function) */
60
- icon?: ReactNode | IconRenderFn;
61
- /** Style overrides for this toast's container */
62
- style?: ViewStyle;
63
- /** Style overrides for this toast's title */
64
- titleStyle?: TextStyle;
65
- /** Style overrides for this toast's description */
66
- descriptionStyle?: TextStyle;
67
- /** Whether this toast can be dismissed via swipe (overrides config) */
68
- dismissible?: boolean;
69
- /** Whether to show the close button on this toast (overrides config) */
70
- showCloseButton?: boolean;
71
- }
72
-
73
- /** Configuration options for customizing toast behavior and appearance. All properties are optional. */
74
- export type ToastConfig = {
75
- [K in keyof ToastTheme]?: K extends "colors"
76
- ? Partial<Record<ToastType, Partial<ToastTypeColors>>>
77
- : K extends "icons"
78
- ? Partial<Record<ToastType, IconRenderFn>>
79
- : ToastTheme[K];
80
- };
81
-
82
- export interface Toast {
83
- id: string;
84
- title: string;
85
- description?: string;
86
- type: ToastType;
87
- duration: number;
88
- createdAt: number;
89
- isExiting?: boolean;
90
- /** Per-toast style/icon overrides */
91
- options?: ToastOptions;
92
- }
93
-
94
- export interface ToastState {
95
- /** Visible toasts (index 0 = front/newest) */
96
- visibleToasts: Toast[];
97
- }
98
-
99
- // --- Promise helper types ---
100
- export type MessageInput =
101
- | string
102
- | {
103
- title: string;
104
- description?: string;
105
- /** Override duration (ms) after promise settles */
106
- duration?: number;
107
- };
108
-
109
- export type ErrorMessageInput = MessageInput | ((error: Error) => MessageInput);
110
-
111
- export interface PromiseMessages {
112
- loading: MessageInput;
113
- success: MessageInput;
114
- error: ErrorMessageInput;
115
- }
116
-
117
- export interface PromiseResult<T> {
118
- data?: T;
119
- error?: Error;
120
- success: boolean;
121
- }