@umituz/react-native-design-system 2.8.44 → 2.8.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "2.8.44",
3
+ "version": "2.8.46",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, and onboarding utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -57,7 +57,7 @@ export const mapPickerResult = (
57
57
  return { canceled: true };
58
58
  }
59
59
 
60
- const assets: MediaAsset[] = result.assets.map((asset) => ({
60
+ const assets: MediaAsset[] = result.assets.map((asset: ImagePicker.ImagePickerAsset) => ({
61
61
  uri: asset.uri,
62
62
  width: asset.width,
63
63
  height: asset.height,
@@ -68,7 +68,7 @@ export {
68
68
  export { OnboardingScreen, type OnboardingScreenProps } from "./presentation/screens/OnboardingScreen";
69
69
  export { OnboardingHeader, type OnboardingHeaderProps } from "./presentation/components/OnboardingHeader";
70
70
  export { OnboardingFooter, type OnboardingFooterProps } from "./presentation/components/OnboardingFooter";
71
- export { OnboardingProvider, type OnboardingProviderProps, useOnboardingProvider } from "./presentation/providers/OnboardingProvider";
71
+ export { OnboardingProvider, type OnboardingProviderProps, type OnboardingTranslations, useOnboardingProvider } from "./presentation/providers/OnboardingProvider";
72
72
  export { BackgroundImageCollage, type CollageLayout, type BackgroundImageCollageProps } from "./presentation/components/BackgroundImageCollage";
73
73
  export type { OnboardingTheme, OnboardingColors } from "./presentation/types/OnboardingTheme";
74
74
 
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import { View, StyleSheet, TouchableOpacity } from "react-native";
3
3
  import { useSafeAreaInsets } from "react-native-safe-area-context";
4
- import { useLocalization } from "@umituz/react-native-localization";
5
4
  import { AtomicText } from "../../../atoms/AtomicText";
6
5
  import { useOnboardingProvider } from "../providers/OnboardingProvider";
7
6
 
@@ -13,8 +12,6 @@ export interface OnboardingFooterProps {
13
12
  showProgressBar?: boolean;
14
13
  showDots?: boolean;
15
14
  showProgressText?: boolean;
16
- nextButtonText?: string;
17
- getStartedButtonText?: string;
18
15
  disabled?: boolean;
19
16
  }
20
17
 
@@ -26,19 +23,14 @@ export const OnboardingFooter = ({
26
23
  showProgressBar = true,
27
24
  showDots = true,
28
25
  showProgressText = true,
29
- nextButtonText,
30
- getStartedButtonText,
31
26
  disabled = false,
32
27
  }: OnboardingFooterProps) => {
33
28
  const insets = useSafeAreaInsets();
34
- const { t } = useLocalization();
35
- const {
36
- theme: { colors },
37
- } = useOnboardingProvider();
29
+ const { theme: { colors }, translations } = useOnboardingProvider();
38
30
 
39
31
  const buttonText = isLastSlide
40
- ? getStartedButtonText || t("onboarding.getStarted")
41
- : nextButtonText || t("general.continue");
32
+ ? translations.getStartedButton
33
+ : translations.nextButton;
42
34
 
43
35
  const progressPercent = ((currentIndex + 1) / totalSlides) * 100;
44
36
 
@@ -95,7 +87,7 @@ export const OnboardingFooter = ({
95
87
  type="labelSmall"
96
88
  style={[styles.progressText, { color: colors.progressTextColor }]}
97
89
  >
98
- {currentIndex + 1} {t("general.of")} {totalSlides}
90
+ {currentIndex + 1} {translations.of} {totalSlides}
99
91
  </AtomicText>
100
92
  )}
101
93
  </View>
@@ -127,8 +127,6 @@ export const OnboardingScreenContent = ({
127
127
  showProgressBar={showProgressBar}
128
128
  showDots={showDots}
129
129
  showProgressText={showProgressText}
130
- nextButtonText={nextButtonText}
131
- getStartedButtonText={getStartedButtonText}
132
130
  disabled={!isAnswerValid}
133
131
  />
134
132
  )}
@@ -8,8 +8,15 @@
8
8
  import React, { createContext, useContext, useMemo } from "react";
9
9
  import type { OnboardingTheme, OnboardingColors } from "../types/OnboardingTheme";
10
10
 
11
+ export interface OnboardingTranslations {
12
+ nextButton: string;
13
+ getStartedButton: string;
14
+ of: string;
15
+ }
16
+
11
17
  interface OnboardingProviderValue {
12
18
  theme: OnboardingTheme;
19
+ translations: OnboardingTranslations;
13
20
  }
14
21
 
15
22
  const OnboardingScope = createContext<OnboardingProviderValue | undefined>(undefined);
@@ -18,12 +25,14 @@ export interface OnboardingProviderProps {
18
25
  children: React.ReactNode;
19
26
  useCustomBackground: boolean;
20
27
  colors: OnboardingColors;
28
+ translations: OnboardingTranslations;
21
29
  }
22
30
 
23
31
  export const OnboardingProvider = ({
24
32
  children,
25
33
  useCustomBackground,
26
34
  colors,
35
+ translations,
27
36
  }: OnboardingProviderProps) => {
28
37
  const value = useMemo(
29
38
  () => ({
@@ -31,8 +40,9 @@ export const OnboardingProvider = ({
31
40
  colors,
32
41
  useCustomBackground,
33
42
  },
43
+ translations,
34
44
  }),
35
- [colors, useCustomBackground]
45
+ [colors, useCustomBackground, translations]
36
46
  );
37
47
 
38
48
  return (
@@ -13,7 +13,7 @@ import { useAppDesignTokens } from "../../../theme/hooks/useAppDesignTokens";
13
13
  import type { OnboardingOptions } from "../../domain/entities/OnboardingOptions";
14
14
  import { useOnboardingScreenState } from "../hooks/useOnboardingScreenState";
15
15
  import { OnboardingScreenContent } from "../components/OnboardingScreenContent";
16
- import { OnboardingProvider } from "../providers/OnboardingProvider";
16
+ import { OnboardingProvider, type OnboardingTranslations } from "../providers/OnboardingProvider";
17
17
  import type { OnboardingColors } from "../types/OnboardingTheme";
18
18
 
19
19
  export interface OnboardingScreenProps extends OnboardingOptions {
@@ -59,6 +59,11 @@ export interface OnboardingScreenProps extends OnboardingOptions {
59
59
  * Theme colors for the onboarding (Optional - will use design tokens if not provided)
60
60
  */
61
61
  themeColors?: OnboardingColors;
62
+
63
+ /**
64
+ * All translations for the onboarding (required)
65
+ */
66
+ translations: OnboardingTranslations;
62
67
  }
63
68
 
64
69
  export const OnboardingScreen = ({
@@ -82,6 +87,7 @@ export const OnboardingScreen = ({
82
87
  useCustomBackground: globalUseCustomBackground = false,
83
88
  themeVariant = "default",
84
89
  themeColors: providedThemeColors,
90
+ translations,
85
91
  }: OnboardingScreenProps) => {
86
92
  if (__DEV__) {
87
93
  console.log("[OnboardingScreen] Rendering with slides:", slides?.length);
@@ -147,7 +153,7 @@ export const OnboardingScreen = ({
147
153
  }
148
154
 
149
155
  return (
150
- <OnboardingProvider useCustomBackground={useCustomBackground} colors={themeColors}>
156
+ <OnboardingProvider useCustomBackground={useCustomBackground} colors={themeColors} translations={translations}>
151
157
  <OnboardingScreenContent
152
158
  containerStyle={[styles.container, containerStyle]}
153
159
  useCustomBackground={useCustomBackground}
@@ -188,7 +188,7 @@ export abstract class BaseRepository<
188
188
  invalidateAll(): Promise<void> {
189
189
  const client = this.getClient();
190
190
  return client.invalidateQueries({
191
- predicate: (query) => {
191
+ predicate: (query: { queryKey: readonly unknown[] }) => {
192
192
  const key = query.queryKey[0] as string;
193
193
  return key === this.resource;
194
194
  },
@@ -66,7 +66,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
66
66
  storage: storageService,
67
67
  key: `${keyPrefix}-cache`,
68
68
  throttleTime,
69
- serialize: (data) => {
69
+ serialize: (data: unknown) => {
70
70
  // Add metadata for cache validation
71
71
  const persistData = {
72
72
  version: busterVersion,
@@ -75,7 +75,7 @@ export function createPersister(options: PersisterFactoryOptions = {}): Persiste
75
75
  };
76
76
  return JSON.stringify(persistData);
77
77
  },
78
- deserialize: (cachedString) => {
78
+ deserialize: (cachedString: string) => {
79
79
  try {
80
80
  const parsed = JSON.parse(cachedString);
81
81
 
@@ -125,9 +125,9 @@ export function createQueryClient(options: QueryClientFactoryOptions = {}): Quer
125
125
  },
126
126
  mutations: {
127
127
  retry: DEFAULT_RETRY.MINIMAL,
128
- onError: (error) => {
128
+ onError: (error: Error) => {
129
129
  if (enableDevLogging) {
130
-
130
+
131
131
  console.error('[TanStack Query] Mutation error:', error);
132
132
  }
133
133
  },
@@ -81,8 +81,10 @@ class DevMonitorClass {
81
81
  if (!this.isEnabled) return;
82
82
 
83
83
  this.queryClient = queryClient;
84
- queryClient.getQueryCache().subscribe((query) => {
85
- this.trackQuery(query as unknown as Query);
84
+ queryClient.getQueryCache().subscribe((event) => {
85
+ if (event.query) {
86
+ this.trackQuery(event.query as Query);
87
+ }
86
88
  });
87
89
 
88
90
  if (this.options.enableLogging) {
@@ -126,10 +128,10 @@ class DevMonitorClass {
126
128
 
127
129
  return {
128
130
  totalQueries: queries.length,
129
- activeQueries: queries.filter((q) => q.observers.length > 0).length,
130
- cachedQueries: queries.filter((q) => q.state.data !== undefined).length,
131
- staleQueries: queries.filter((q) => q.isStale()).length,
132
- inactiveQueries: queries.filter((q) => q.observers.length === 0).length,
131
+ activeQueries: queries.filter((q: Query) => q.observers.length > 0).length,
132
+ cachedQueries: queries.filter((q: Query) => q.state.data !== undefined).length,
133
+ staleQueries: queries.filter((q: Query) => q.isStale()).length,
134
+ inactiveQueries: queries.filter((q: Query) => q.observers.length === 0).length,
133
135
  };
134
136
  }
135
137
 
@@ -63,7 +63,7 @@ export function useCursorPagination<TData>(options: CursorPaginationOptions<TDat
63
63
 
64
64
  const result = useInfiniteQuery({
65
65
  queryKey,
66
- queryFn: ({ pageParam }) => queryFn({ pageParam }),
66
+ queryFn: ({ pageParam }: { pageParam: string | undefined }) => queryFn({ pageParam }),
67
67
  initialPageParam: undefined as string | undefined,
68
68
  getNextPageParam: (lastPage: CursorPaginatedResponse<TData>) =>
69
69
  lastPage.hasMore ? lastPage.nextCursor : undefined,
@@ -72,7 +72,7 @@ export function useCursorPagination<TData>(options: CursorPaginationOptions<TDat
72
72
 
73
73
  const flatData = useMemo(() => {
74
74
  if (!result.data?.pages) return [];
75
- return result.data.pages.flatMap((page) => page.items);
75
+ return result.data.pages.flatMap((page: CursorPaginatedResponse<TData>) => page.items);
76
76
  }, [result.data]);
77
77
 
78
78
  return {
@@ -104,7 +104,7 @@ export function useOffsetPagination<TData>(options: OffsetPaginationOptions<TDat
104
104
 
105
105
  const result = useInfiniteQuery({
106
106
  queryKey,
107
- queryFn: ({ pageParam }) => queryFn({ pageParam }),
107
+ queryFn: ({ pageParam }: { pageParam: OffsetPageParam }) => queryFn({ pageParam }),
108
108
  initialPageParam: { offset: 0, limit },
109
109
  getNextPageParam: (lastPage: OffsetPaginatedResponse<TData>) => {
110
110
  const nextOffset = lastPage.offset + lastPage.limit;
@@ -115,7 +115,7 @@ export function useOffsetPagination<TData>(options: OffsetPaginationOptions<TDat
115
115
 
116
116
  const flatData = useMemo(() => {
117
117
  if (!result.data?.pages) return [];
118
- return result.data.pages.flatMap((page) => page.items);
118
+ return result.data.pages.flatMap((page: OffsetPaginatedResponse<TData>) => page.items);
119
119
  }, [result.data]);
120
120
 
121
121
  const total = result.data?.pages?.[result.data.pages.length - 1]?.total ?? 0;