@umituz/react-native-design-system 1.1.0 → 1.1.1

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": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Universal design system for React Native apps - Domain-Driven Design architecture with Material Design 3 components",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -1,19 +1,17 @@
1
1
  /**
2
2
  * useAppDesignTokens Hook - Theme-Aware Design Tokens
3
3
  *
4
- * ✅ Accepts optional themeMode parameter
5
- * ✅ Returns tokens for specified theme (light/dark)
6
- * ✅ Apps control theme, package provides tokens
4
+ * ✅ Automatically reads theme from global store
5
+ * ✅ No parameters needed - fully automatic!
6
+ * ✅ Returns tokens for current theme (light/dark)
7
7
  * ✅ Single source of truth
8
8
  *
9
- * @param themeMode - Optional theme mode ('light' | 'dark'), defaults to 'light'
10
- *
11
- * @example Basic usage (light theme)
9
+ * @example Usage (fully automatic theme-aware)
12
10
  * ```typescript
13
11
  * import { useAppDesignTokens } from '@umituz/react-native-design-system';
14
12
  *
15
13
  * const MyComponent = () => {
16
- * const tokens = useAppDesignTokens(); // Uses light theme by default
14
+ * const tokens = useAppDesignTokens(); // Automatically uses current theme!
17
15
  * return (
18
16
  * <View style={{
19
17
  * backgroundColor: tokens.colors.primary,
@@ -25,29 +23,18 @@
25
23
  * };
26
24
  * ```
27
25
  *
28
- * @example Theme-aware usage
29
- * ```typescript
30
- * import { useAppDesignTokens } from '@umituz/react-native-design-system';
31
- * import { useTheme } from '@domains/theme';
32
- *
33
- * const MyComponent = () => {
34
- * const { themeMode } = useTheme(); // Get theme from app's theme system
35
- * const tokens = useAppDesignTokens(themeMode); // Pass theme to hook
36
- *
37
- * return (
38
- * <View style={{ backgroundColor: tokens.colors.background }}>
39
- * <Text style={{ color: tokens.colors.textPrimary }}>
40
- * This text color changes with theme!
41
- * </Text>
42
- * </View>
43
- * );
44
- * };
45
- * ```
26
+ * How it works:
27
+ * - Reads themeMode from global store (useDesignSystemTheme)
28
+ * - App's theme store syncs to global store automatically
29
+ * - All components get correct tokens without prop drilling
30
+ * - Change theme once, everything updates!
46
31
  */
47
32
 
48
33
  import { useMemo } from 'react';
49
- import { createDesignTokens, type DesignTokens, type ThemeMode } from '../tokens/core/TokenFactory';
34
+ import { createDesignTokens, type DesignTokens } from '../tokens/core/TokenFactory';
35
+ import { useDesignSystemTheme } from '../../infrastructure/theme/globalThemeStore';
50
36
 
51
- export const useAppDesignTokens = (themeMode: ThemeMode = 'light'): DesignTokens => {
37
+ export const useAppDesignTokens = (): DesignTokens => {
38
+ const { themeMode } = useDesignSystemTheme();
52
39
  return useMemo(() => createDesignTokens(themeMode), [themeMode]);
53
40
  };
@@ -30,8 +30,6 @@ import { View, ScrollView, StyleSheet, ViewStyle } from 'react-native';
30
30
  import { SafeAreaView, Edge } from 'react-native-safe-area-context';
31
31
  import { useAppDesignTokens } from '../hooks/useAppDesignTokens';
32
32
  import { LoadingState } from '../loading/presentation/components/LoadingState';
33
- import { useDesignSystemTheme } from '../../infrastructure/theme/globalThemeStore';
34
- import type { ThemeMode } from '../tokens/core/TokenFactory';
35
33
 
36
34
  export interface ScreenLayoutProps {
37
35
  /**
@@ -114,12 +112,6 @@ export interface ScreenLayoutProps {
114
112
  */
115
113
  keyboardAvoiding?: boolean;
116
114
 
117
- /**
118
- * Theme mode for design tokens
119
- * If not provided, uses global theme from useDesignSystemTheme()
120
- * Apps should sync their theme with the global store instead of passing this prop
121
- */
122
- themeMode?: ThemeMode;
123
115
  }
124
116
 
125
117
  export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
@@ -137,13 +129,9 @@ export const ScreenLayout: React.FC<ScreenLayoutProps> = ({
137
129
  testID,
138
130
  hideScrollIndicator = false,
139
131
  keyboardAvoiding = false,
140
- themeMode,
141
132
  }) => {
142
- // Use global theme if themeMode prop not provided
143
- const { themeMode: globalTheme } = useDesignSystemTheme();
144
- const effectiveTheme = themeMode ?? globalTheme;
145
-
146
- const tokens = useAppDesignTokens(effectiveTheme);
133
+ // Automatically uses current theme from global store
134
+ const tokens = useAppDesignTokens();
147
135
  const styles = useMemo(() => getStyles(tokens), [tokens]);
148
136
 
149
137
  const bgColor = backgroundColor || tokens.colors.backgroundPrimary;