@umituz/react-native-design-system 1.0.2 → 1.0.3

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.0.2",
3
+ "version": "1.0.3",
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,37 +1,53 @@
1
1
  /**
2
- * useAppDesignTokens Hook - Design Tokens Access
2
+ * useAppDesignTokens Hook - Theme-Aware Design Tokens
3
3
  *
4
- * ✅ NPM PACKAGE VERSION - Standalone, no theme dependencies
5
- * ✅ Returns static light theme tokens
6
- * ✅ Type-safe design tokens
7
- * ✅ Zero external dependencies
4
+ * ✅ Accepts optional themeMode parameter
5
+ * ✅ Returns tokens for specified theme (light/dark)
6
+ * ✅ Apps control theme, package provides tokens
7
+ * ✅ Single source of truth
8
8
  *
9
- * NOTE: This is the npm package version which returns light theme only.
10
- * For dynamic theme switching, apps should use @domains/theme ThemeProvider.
9
+ * @param themeMode - Optional theme mode ('light' | 'dark'), defaults to 'light'
11
10
  *
12
- * @example
11
+ * @example Basic usage (light theme)
13
12
  * ```typescript
14
13
  * import { useAppDesignTokens } from '@umituz/react-native-design-system';
15
14
  *
16
15
  * const MyComponent = () => {
17
- * const tokens = useAppDesignTokens();
16
+ * const tokens = useAppDesignTokens(); // Uses light theme by default
18
17
  * return (
19
18
  * <View style={{
20
19
  * backgroundColor: tokens.colors.primary,
21
- * padding: tokens.spacing.md,
22
- * borderRadius: tokens.borders.radius.md
20
+ * padding: tokens.spacing.md
23
21
  * }}>
24
22
  * <Text style={tokens.typography.bodyLarge}>Hello!</Text>
25
23
  * </View>
26
24
  * );
27
25
  * };
28
26
  * ```
27
+ *
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
+ * ```
29
46
  */
30
47
 
31
- import { STATIC_DESIGN_TOKENS } from '../tokens/core/TokenFactory';
48
+ import { useMemo } from 'react';
49
+ import { createDesignTokens, type DesignTokens, type ThemeMode } from '../tokens/core/TokenFactory';
32
50
 
33
- export const useAppDesignTokens = () => {
34
- // NPM package version: Always return light theme
35
- // Apps using factory generator will override this with theme-aware version
36
- return STATIC_DESIGN_TOKENS;
51
+ export const useAppDesignTokens = (themeMode: ThemeMode = 'light'): DesignTokens => {
52
+ return useMemo(() => createDesignTokens(themeMode), [themeMode]);
37
53
  };