@rubixscript/react-native-onboarding 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +383 -383
  3. package/dist/components/NavigationButtons.js +17 -17
  4. package/dist/components/Onboarding.js +16 -16
  5. package/dist/components/Pagination.js +30 -30
  6. package/dist/components/SimpleOnboardingScreen.d.ts +54 -0
  7. package/dist/components/SimpleOnboardingScreen.d.ts.map +1 -0
  8. package/dist/components/SimpleOnboardingScreen.js +184 -0
  9. package/dist/components/index.d.ts +2 -0
  10. package/dist/components/index.d.ts.map +1 -1
  11. package/dist/components/index.js +1 -0
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +2 -0
  15. package/dist/presets/index.d.ts.map +1 -1
  16. package/dist/presets/index.js +24 -27
  17. package/dist/slides/FormSlide.js +37 -37
  18. package/dist/slides/IconSlide.js +24 -24
  19. package/dist/slides/ImageSlide.js +20 -20
  20. package/dist/slides/VideoSlide.js +20 -20
  21. package/dist/themes/index.d.ts.map +1 -1
  22. package/dist/themes/index.js +9 -7
  23. package/package.json +73 -66
  24. package/src/components/NavigationButtons.tsx +198 -198
  25. package/src/components/Onboarding.tsx +337 -337
  26. package/src/components/Pagination.tsx +337 -337
  27. package/src/components/SimpleOnboardingScreen.tsx +266 -0
  28. package/src/components/index.ts +7 -5
  29. package/src/index.ts +69 -65
  30. package/src/presets/index.ts +391 -394
  31. package/src/slides/FormSlide.tsx +314 -314
  32. package/src/slides/IconSlide.tsx +166 -166
  33. package/src/slides/ImageSlide.tsx +132 -132
  34. package/src/slides/VideoSlide.tsx +146 -146
  35. package/src/slides/index.tsx +37 -37
  36. package/src/themes/index.ts +576 -574
  37. package/src/types/index.ts +247 -247
@@ -1,247 +1,247 @@
1
- import { ImageSourcePropType, ViewStyle, TextStyle, ImageStyle, Animated } from 'react-native';
2
-
3
- // ============================================================================
4
- // SLIDE TYPES
5
- // ============================================================================
6
-
7
- export type SlideType = 'image' | 'icon' | 'form' | 'video' | 'custom';
8
-
9
- export interface BaseSlideData {
10
- id: string;
11
- type: SlideType;
12
- title?: string;
13
- description?: string;
14
- backgroundColor?: string;
15
- gradientColors?: string[];
16
- }
17
-
18
- export interface ImageSlideData extends BaseSlideData {
19
- type: 'image';
20
- image: ImageSourcePropType;
21
- imageResizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
22
- imageStyle?: ImageStyle;
23
- overlayIcon?: {
24
- name: string;
25
- size?: number;
26
- color?: string;
27
- };
28
- }
29
-
30
- export interface IconSlideData extends BaseSlideData {
31
- type: 'icon';
32
- icon: {
33
- name: string;
34
- type?: 'ionicons' | 'material' | 'material-community' | 'font-awesome' | 'octicons' | 'feather';
35
- size?: number;
36
- color?: string;
37
- backgroundColor?: string;
38
- backgroundSize?: number;
39
- };
40
- subtitle?: string;
41
- }
42
-
43
- export interface FormFieldConfig {
44
- key: string;
45
- label: string;
46
- placeholder: string;
47
- type: 'text' | 'number' | 'email' | 'password' | 'select' | 'multiselect';
48
- required?: boolean;
49
- options?: Array<{ value: string; label: string; icon?: string }>;
50
- validation?: (value: any) => boolean | string;
51
- multiline?: boolean;
52
- numberOfLines?: number;
53
- }
54
-
55
- export interface FormSlideData extends BaseSlideData {
56
- type: 'form';
57
- fields: FormFieldConfig[];
58
- submitLabel?: string;
59
- onSubmit?: (data: Record<string, any>) => void | Promise<void>;
60
- customFormComponent?: React.ComponentType<FormSlideCustomProps>;
61
- }
62
-
63
- export interface VideoSlideData extends BaseSlideData {
64
- type: 'video';
65
- videoSource: string | { uri: string };
66
- autoPlay?: boolean;
67
- loop?: boolean;
68
- muted?: boolean;
69
- poster?: ImageSourcePropType;
70
- }
71
-
72
- export interface CustomSlideData extends BaseSlideData {
73
- type: 'custom';
74
- component: React.ComponentType<any>;
75
- props?: Record<string, any>;
76
- }
77
-
78
- export type SlideData = ImageSlideData | IconSlideData | FormSlideData | VideoSlideData | CustomSlideData;
79
-
80
- // ============================================================================
81
- // THEME TYPES
82
- // ============================================================================
83
-
84
- export interface OnboardingTheme {
85
- // Colors
86
- colors: {
87
- primary: string;
88
- secondary: string;
89
- background: string;
90
- surface: string;
91
- text: {
92
- primary: string;
93
- secondary: string;
94
- inverse: string;
95
- };
96
- border: string;
97
- overlay?: string;
98
- };
99
-
100
- // Typography
101
- typography: {
102
- title: TextStyle;
103
- description: TextStyle;
104
- button: TextStyle;
105
- label?: TextStyle;
106
- };
107
-
108
- // Spacing
109
- spacing: {
110
- xs: number;
111
- sm: number;
112
- md: number;
113
- lg: number;
114
- xl: number;
115
- xxl: number;
116
- };
117
-
118
- // Border radius
119
- borderRadius: {
120
- sm: number;
121
- md: number;
122
- lg: number;
123
- xl: number;
124
- full: number;
125
- };
126
-
127
- // Shadows
128
- shadows?: {
129
- sm?: ViewStyle;
130
- md?: ViewStyle;
131
- lg?: ViewStyle;
132
- };
133
- }
134
-
135
- // ============================================================================
136
- // NAVIGATION TYPES
137
- // ============================================================================
138
-
139
- export type NavigationStyle = 'dots' | 'progress-bar' | 'steps' | 'numbers' | 'none';
140
-
141
- export interface NavigationConfig {
142
- style: NavigationStyle;
143
- position?: 'top' | 'bottom' | 'floating';
144
- showSkip?: boolean;
145
- showBack?: boolean;
146
- skipLabel?: string;
147
- backLabel?: string;
148
- nextLabel?: string;
149
- doneLabel?: string;
150
- containerStyle?: ViewStyle;
151
- }
152
-
153
- // ============================================================================
154
- // ANIMATION TYPES
155
- // ============================================================================
156
-
157
- export type AnimationType = 'slide' | 'fade' | 'scale' | 'parallax' | 'cube' | 'none';
158
-
159
- export interface AnimationConfig {
160
- type: AnimationType;
161
- duration?: number;
162
- easing?: (t: number) => number;
163
- parallaxFactor?: number;
164
- }
165
-
166
- // ============================================================================
167
- // STORAGE TYPES
168
- // ============================================================================
169
-
170
- export interface StorageConfig {
171
- key: string;
172
- enabled: boolean;
173
- onComplete?: () => void | Promise<void>;
174
- }
175
-
176
- // ============================================================================
177
- // COMPLETE CONFIG
178
- // ============================================================================
179
-
180
- export interface OnboardingConfig {
181
- slides: SlideData[];
182
- theme?: Partial<OnboardingTheme>;
183
- navigation?: Partial<NavigationConfig>;
184
- animation?: Partial<AnimationConfig>;
185
- storage?: Partial<StorageConfig>;
186
- onboardingComplete?: (data?: Record<string, any>) => void | Promise<void>;
187
- onSlideChange?: (index: number) => void;
188
- onSkip?: () => void | Promise<void>;
189
- initialSlide?: number;
190
- swipeEnabled?: boolean;
191
- containerStyle?: ViewStyle;
192
- safeAreaEnabled?: boolean;
193
- }
194
-
195
- // ============================================================================
196
- // COMPONENT PROPS
197
- // ============================================================================
198
-
199
- export interface OnboardingProps extends OnboardingConfig {
200
- visible: boolean;
201
- darkMode?: boolean;
202
- }
203
-
204
- export interface FormSlideCustomProps {
205
- data: FormSlideData;
206
- theme: OnboardingTheme;
207
- onSubmit: (data: Record<string, any>) => void;
208
- isSubmitting?: boolean;
209
- darkMode?: boolean;
210
- }
211
-
212
- export interface PaginationProps {
213
- currentIndex: number;
214
- totalSlides: number;
215
- theme: OnboardingTheme;
216
- config?: NavigationConfig;
217
- style?: ViewStyle;
218
- }
219
-
220
- export interface NavigationButtonProps {
221
- label: string;
222
- onPress: () => void;
223
- theme: OnboardingTheme;
224
- variant?: 'primary' | 'secondary' | 'ghost';
225
- disabled?: boolean;
226
- loading?: boolean;
227
- style?: ViewStyle;
228
- textStyle?: TextStyle;
229
- }
230
-
231
- // ============================================================================
232
- // PRESET TYPES
233
- // ============================================================================
234
-
235
- export type OnboardingPreset = 'onepage' | 'zaprecipe' | 'pomodo' | 'modern' | 'minimal' | 'gradient';
236
-
237
- export interface PresetConfig {
238
- theme: OnboardingTheme;
239
- navigation: NavigationConfig;
240
- animation: AnimationConfig;
241
- defaultSlideStyles: {
242
- image?: ImageStyle;
243
- icon?: ViewStyle;
244
- title?: TextStyle;
245
- description?: TextStyle;
246
- };
247
- }
1
+ import { ImageSourcePropType, ViewStyle, TextStyle, ImageStyle, Animated } from 'react-native';
2
+
3
+ // ============================================================================
4
+ // SLIDE TYPES
5
+ // ============================================================================
6
+
7
+ export type SlideType = 'image' | 'icon' | 'form' | 'video' | 'custom';
8
+
9
+ export interface BaseSlideData {
10
+ id: string;
11
+ type: SlideType;
12
+ title?: string;
13
+ description?: string;
14
+ backgroundColor?: string;
15
+ gradientColors?: string[];
16
+ }
17
+
18
+ export interface ImageSlideData extends BaseSlideData {
19
+ type: 'image';
20
+ image: ImageSourcePropType;
21
+ imageResizeMode?: 'cover' | 'contain' | 'stretch' | 'center';
22
+ imageStyle?: ImageStyle;
23
+ overlayIcon?: {
24
+ name: string;
25
+ size?: number;
26
+ color?: string;
27
+ };
28
+ }
29
+
30
+ export interface IconSlideData extends BaseSlideData {
31
+ type: 'icon';
32
+ icon: {
33
+ name: string;
34
+ type?: 'ionicons' | 'material' | 'material-community' | 'font-awesome' | 'octicons' | 'feather';
35
+ size?: number;
36
+ color?: string;
37
+ backgroundColor?: string;
38
+ backgroundSize?: number;
39
+ };
40
+ subtitle?: string;
41
+ }
42
+
43
+ export interface FormFieldConfig {
44
+ key: string;
45
+ label: string;
46
+ placeholder: string;
47
+ type: 'text' | 'number' | 'email' | 'password' | 'select' | 'multiselect';
48
+ required?: boolean;
49
+ options?: Array<{ value: string; label: string; icon?: string }>;
50
+ validation?: (value: any) => boolean | string;
51
+ multiline?: boolean;
52
+ numberOfLines?: number;
53
+ }
54
+
55
+ export interface FormSlideData extends BaseSlideData {
56
+ type: 'form';
57
+ fields: FormFieldConfig[];
58
+ submitLabel?: string;
59
+ onSubmit?: (data: Record<string, any>) => void | Promise<void>;
60
+ customFormComponent?: React.ComponentType<FormSlideCustomProps>;
61
+ }
62
+
63
+ export interface VideoSlideData extends BaseSlideData {
64
+ type: 'video';
65
+ videoSource: string | { uri: string };
66
+ autoPlay?: boolean;
67
+ loop?: boolean;
68
+ muted?: boolean;
69
+ poster?: ImageSourcePropType;
70
+ }
71
+
72
+ export interface CustomSlideData extends BaseSlideData {
73
+ type: 'custom';
74
+ component: React.ComponentType<any>;
75
+ props?: Record<string, any>;
76
+ }
77
+
78
+ export type SlideData = ImageSlideData | IconSlideData | FormSlideData | VideoSlideData | CustomSlideData;
79
+
80
+ // ============================================================================
81
+ // THEME TYPES
82
+ // ============================================================================
83
+
84
+ export interface OnboardingTheme {
85
+ // Colors
86
+ colors: {
87
+ primary: string;
88
+ secondary: string;
89
+ background: string;
90
+ surface: string;
91
+ text: {
92
+ primary: string;
93
+ secondary: string;
94
+ inverse: string;
95
+ };
96
+ border: string;
97
+ overlay?: string;
98
+ };
99
+
100
+ // Typography
101
+ typography: {
102
+ title: TextStyle;
103
+ description: TextStyle;
104
+ button: TextStyle;
105
+ label?: TextStyle;
106
+ };
107
+
108
+ // Spacing
109
+ spacing: {
110
+ xs: number;
111
+ sm: number;
112
+ md: number;
113
+ lg: number;
114
+ xl: number;
115
+ xxl: number;
116
+ };
117
+
118
+ // Border radius
119
+ borderRadius: {
120
+ sm: number;
121
+ md: number;
122
+ lg: number;
123
+ xl: number;
124
+ full: number;
125
+ };
126
+
127
+ // Shadows
128
+ shadows?: {
129
+ sm?: ViewStyle;
130
+ md?: ViewStyle;
131
+ lg?: ViewStyle;
132
+ };
133
+ }
134
+
135
+ // ============================================================================
136
+ // NAVIGATION TYPES
137
+ // ============================================================================
138
+
139
+ export type NavigationStyle = 'dots' | 'progress-bar' | 'steps' | 'numbers' | 'none';
140
+
141
+ export interface NavigationConfig {
142
+ style: NavigationStyle;
143
+ position?: 'top' | 'bottom' | 'floating';
144
+ showSkip?: boolean;
145
+ showBack?: boolean;
146
+ skipLabel?: string;
147
+ backLabel?: string;
148
+ nextLabel?: string;
149
+ doneLabel?: string;
150
+ containerStyle?: ViewStyle;
151
+ }
152
+
153
+ // ============================================================================
154
+ // ANIMATION TYPES
155
+ // ============================================================================
156
+
157
+ export type AnimationType = 'slide' | 'fade' | 'scale' | 'parallax' | 'cube' | 'none';
158
+
159
+ export interface AnimationConfig {
160
+ type: AnimationType;
161
+ duration?: number;
162
+ easing?: (t: number) => number;
163
+ parallaxFactor?: number;
164
+ }
165
+
166
+ // ============================================================================
167
+ // STORAGE TYPES
168
+ // ============================================================================
169
+
170
+ export interface StorageConfig {
171
+ key: string;
172
+ enabled: boolean;
173
+ onComplete?: () => void | Promise<void>;
174
+ }
175
+
176
+ // ============================================================================
177
+ // COMPLETE CONFIG
178
+ // ============================================================================
179
+
180
+ export interface OnboardingConfig {
181
+ slides: SlideData[];
182
+ theme?: Partial<OnboardingTheme>;
183
+ navigation?: Partial<NavigationConfig>;
184
+ animation?: Partial<AnimationConfig>;
185
+ storage?: Partial<StorageConfig>;
186
+ onboardingComplete?: (data?: Record<string, any>) => void | Promise<void>;
187
+ onSlideChange?: (index: number) => void;
188
+ onSkip?: () => void | Promise<void>;
189
+ initialSlide?: number;
190
+ swipeEnabled?: boolean;
191
+ containerStyle?: ViewStyle;
192
+ safeAreaEnabled?: boolean;
193
+ }
194
+
195
+ // ============================================================================
196
+ // COMPONENT PROPS
197
+ // ============================================================================
198
+
199
+ export interface OnboardingProps extends OnboardingConfig {
200
+ visible: boolean;
201
+ darkMode?: boolean;
202
+ }
203
+
204
+ export interface FormSlideCustomProps {
205
+ data: FormSlideData;
206
+ theme: OnboardingTheme;
207
+ onSubmit: (data: Record<string, any>) => void;
208
+ isSubmitting?: boolean;
209
+ darkMode?: boolean;
210
+ }
211
+
212
+ export interface PaginationProps {
213
+ currentIndex: number;
214
+ totalSlides: number;
215
+ theme: OnboardingTheme;
216
+ config?: NavigationConfig;
217
+ style?: ViewStyle;
218
+ }
219
+
220
+ export interface NavigationButtonProps {
221
+ label: string;
222
+ onPress: () => void;
223
+ theme: OnboardingTheme;
224
+ variant?: 'primary' | 'secondary' | 'ghost';
225
+ disabled?: boolean;
226
+ loading?: boolean;
227
+ style?: ViewStyle;
228
+ textStyle?: TextStyle;
229
+ }
230
+
231
+ // ============================================================================
232
+ // PRESET TYPES
233
+ // ============================================================================
234
+
235
+ export type OnboardingPreset = 'onepage' | 'zaprecipe' | 'pomodo' | 'modern' | 'minimal' | 'gradient';
236
+
237
+ export interface PresetConfig {
238
+ theme: OnboardingTheme;
239
+ navigation: NavigationConfig;
240
+ animation: AnimationConfig;
241
+ defaultSlideStyles: {
242
+ image?: ImageStyle;
243
+ icon?: ViewStyle;
244
+ title?: TextStyle;
245
+ description?: TextStyle;
246
+ };
247
+ }