@umituz/react-native-design-system 1.0.1 → 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.
|
|
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
|
|
2
|
+
* useAppDesignTokens Hook - Theme-Aware Design Tokens
|
|
3
3
|
*
|
|
4
|
-
* ✅
|
|
5
|
-
* ✅ Returns
|
|
6
|
-
* ✅
|
|
7
|
-
* ✅
|
|
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
|
-
*
|
|
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 {
|
|
48
|
+
import { useMemo } from 'react';
|
|
49
|
+
import { createDesignTokens, type DesignTokens, type ThemeMode } from '../tokens/core/TokenFactory';
|
|
32
50
|
|
|
33
|
-
export const useAppDesignTokens = () => {
|
|
34
|
-
|
|
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
|
};
|
|
@@ -41,19 +41,19 @@ export const withAlpha = (hexColor: string, alpha: number): string => {
|
|
|
41
41
|
|
|
42
42
|
export const lightColors = {
|
|
43
43
|
// =============================================================================
|
|
44
|
-
// PRIMARY BRAND COLORS
|
|
44
|
+
// PRIMARY BRAND COLORS
|
|
45
45
|
// =============================================================================
|
|
46
|
-
primary: '
|
|
47
|
-
primaryLight: '
|
|
48
|
-
primaryDark: '
|
|
46
|
+
primary: '#3B82F6',
|
|
47
|
+
primaryLight: '#60A5FA',
|
|
48
|
+
primaryDark: '#2563EB',
|
|
49
49
|
|
|
50
|
-
secondary: '
|
|
51
|
-
secondaryLight: '
|
|
52
|
-
secondaryDark: '
|
|
50
|
+
secondary: '#8B5CF6',
|
|
51
|
+
secondaryLight: '#A78BFA',
|
|
52
|
+
secondaryDark: '#7C3AED',
|
|
53
53
|
|
|
54
|
-
accent: '
|
|
55
|
-
accentLight: '
|
|
56
|
-
accentDark: '
|
|
54
|
+
accent: '#F59E0B',
|
|
55
|
+
accentLight: '#FBBF24',
|
|
56
|
+
accentDark: '#D97706',
|
|
57
57
|
|
|
58
58
|
// =============================================================================
|
|
59
59
|
// MATERIAL DESIGN 3 - ON COLORS (Text on colored backgrounds)
|
|
@@ -129,43 +129,43 @@ export const lightColors = {
|
|
|
129
129
|
gray900: '#18181B',
|
|
130
130
|
|
|
131
131
|
// =============================================================================
|
|
132
|
-
// BACKGROUND COLORS
|
|
132
|
+
// BACKGROUND COLORS
|
|
133
133
|
// =============================================================================
|
|
134
|
-
backgroundPrimary: '
|
|
135
|
-
backgroundSecondary: '
|
|
134
|
+
backgroundPrimary: '#FFFFFF',
|
|
135
|
+
backgroundSecondary: '#F8FAFC',
|
|
136
136
|
|
|
137
|
-
surface: '
|
|
138
|
-
surfaceVariant: '
|
|
139
|
-
surfaceSecondary: '
|
|
137
|
+
surface: '#FFFFFF',
|
|
138
|
+
surfaceVariant: '#F1F5F9',
|
|
139
|
+
surfaceSecondary: '#F1F5F9', // Alias
|
|
140
140
|
surfaceDisabled: '#F4F4F5', // Disabled surface color
|
|
141
141
|
|
|
142
142
|
// =============================================================================
|
|
143
|
-
// TEXT COLORS
|
|
143
|
+
// TEXT COLORS
|
|
144
144
|
// =============================================================================
|
|
145
|
-
textPrimary: '
|
|
146
|
-
textSecondary: '
|
|
147
|
-
textTertiary: '
|
|
148
|
-
textDisabled: '
|
|
149
|
-
textInverse: '
|
|
145
|
+
textPrimary: '#1E293B',
|
|
146
|
+
textSecondary: '#64748B',
|
|
147
|
+
textTertiary: '#94A3B8',
|
|
148
|
+
textDisabled: '#CBD5E1',
|
|
149
|
+
textInverse: '#FFFFFF',
|
|
150
150
|
|
|
151
151
|
// =============================================================================
|
|
152
|
-
// BORDER COLORS
|
|
152
|
+
// BORDER COLORS
|
|
153
153
|
// =============================================================================
|
|
154
|
-
border: '
|
|
155
|
-
borderLight: '
|
|
156
|
-
borderMedium: '
|
|
157
|
-
borderFocus: '
|
|
154
|
+
border: '#E2E8F0',
|
|
155
|
+
borderLight: '#F1F5F9',
|
|
156
|
+
borderMedium: '#CBD5E1',
|
|
157
|
+
borderFocus: '#3B82F6',
|
|
158
158
|
|
|
159
159
|
// =============================================================================
|
|
160
160
|
// COMPONENT-SPECIFIC COLORS
|
|
161
161
|
// =============================================================================
|
|
162
|
-
buttonPrimary: '
|
|
163
|
-
buttonSecondary: '
|
|
162
|
+
buttonPrimary: '#3B82F6',
|
|
163
|
+
buttonSecondary: '#8B5CF6',
|
|
164
164
|
|
|
165
|
-
inputBackground: '
|
|
166
|
-
inputBorder: '
|
|
165
|
+
inputBackground: '#FFFFFF',
|
|
166
|
+
inputBorder: '#E2E8F0',
|
|
167
167
|
|
|
168
|
-
cardBackground: '
|
|
168
|
+
cardBackground: '#FFFFFF',
|
|
169
169
|
|
|
170
170
|
// =============================================================================
|
|
171
171
|
// SPECIAL COLORS
|
|
@@ -204,7 +204,7 @@ export const lightColors = {
|
|
|
204
204
|
// =============================================================================
|
|
205
205
|
// GRADIENTS
|
|
206
206
|
// =============================================================================
|
|
207
|
-
gradient: ['
|
|
207
|
+
gradient: ['#3B82F6', '#8B5CF6'],
|
|
208
208
|
};
|
|
209
209
|
|
|
210
210
|
// =============================================================================
|
|
@@ -215,17 +215,17 @@ export const darkColors = {
|
|
|
215
215
|
// =============================================================================
|
|
216
216
|
// PRIMARY BRAND COLORS (dark mode specific colors)
|
|
217
217
|
// =============================================================================
|
|
218
|
-
primary: '
|
|
219
|
-
primaryLight: '
|
|
220
|
-
primaryDark: '
|
|
218
|
+
primary: '#3B82F6',
|
|
219
|
+
primaryLight: '#60A5FA',
|
|
220
|
+
primaryDark: '#2563EB',
|
|
221
221
|
|
|
222
|
-
secondary: '
|
|
223
|
-
secondaryLight: '
|
|
224
|
-
secondaryDark: '
|
|
222
|
+
secondary: '#8B5CF6',
|
|
223
|
+
secondaryLight: '#A78BFA',
|
|
224
|
+
secondaryDark: '#7C3AED',
|
|
225
225
|
|
|
226
|
-
accent: '
|
|
227
|
-
accentLight: '
|
|
228
|
-
accentDark: '
|
|
226
|
+
accent: '#F59E0B',
|
|
227
|
+
accentLight: '#FBBF24',
|
|
228
|
+
accentDark: '#D97706',
|
|
229
229
|
|
|
230
230
|
// =============================================================================
|
|
231
231
|
// MATERIAL DESIGN 3 - ON COLORS (Same as light mode for type consistency)
|
|
@@ -303,41 +303,41 @@ export const darkColors = {
|
|
|
303
303
|
// =============================================================================
|
|
304
304
|
// BACKGROUND COLORS (dark mode specific colors)
|
|
305
305
|
// =============================================================================
|
|
306
|
-
backgroundPrimary: '
|
|
307
|
-
backgroundSecondary: '
|
|
306
|
+
backgroundPrimary: '#FFFFFF',
|
|
307
|
+
backgroundSecondary: '#F8FAFC',
|
|
308
308
|
|
|
309
|
-
surface: '
|
|
310
|
-
surfaceVariant: '
|
|
311
|
-
surfaceSecondary: '
|
|
309
|
+
surface: '#FFFFFF',
|
|
310
|
+
surfaceVariant: '#F1F5F9',
|
|
311
|
+
surfaceSecondary: '#F1F5F9', // Alias
|
|
312
312
|
surfaceDisabled: '#F4F4F5', // Same as light mode for type consistency
|
|
313
313
|
|
|
314
314
|
// =============================================================================
|
|
315
315
|
// TEXT COLORS (same as light mode for type consistency)
|
|
316
316
|
// =============================================================================
|
|
317
|
-
textPrimary: '
|
|
318
|
-
textSecondary: '
|
|
319
|
-
textTertiary: '
|
|
320
|
-
textDisabled: '
|
|
321
|
-
textInverse: '
|
|
317
|
+
textPrimary: '#1E293B',
|
|
318
|
+
textSecondary: '#64748B',
|
|
319
|
+
textTertiary: '#94A3B8',
|
|
320
|
+
textDisabled: '#CBD5E1',
|
|
321
|
+
textInverse: '#FFFFFF',
|
|
322
322
|
|
|
323
323
|
// =============================================================================
|
|
324
324
|
// BORDER COLORS (same as light mode for type consistency)
|
|
325
325
|
// =============================================================================
|
|
326
|
-
border: '
|
|
327
|
-
borderLight: '
|
|
328
|
-
borderMedium: '
|
|
329
|
-
borderFocus: '
|
|
326
|
+
border: '#E2E8F0',
|
|
327
|
+
borderLight: '#F1F5F9',
|
|
328
|
+
borderMedium: '#CBD5E1',
|
|
329
|
+
borderFocus: '#3B82F6',
|
|
330
330
|
|
|
331
331
|
// =============================================================================
|
|
332
332
|
// COMPONENT-SPECIFIC COLORS (same as light mode for type consistency)
|
|
333
333
|
// =============================================================================
|
|
334
|
-
buttonPrimary: '
|
|
335
|
-
buttonSecondary: '
|
|
334
|
+
buttonPrimary: '#3B82F6',
|
|
335
|
+
buttonSecondary: '#8B5CF6',
|
|
336
336
|
|
|
337
|
-
inputBackground: '
|
|
338
|
-
inputBorder: '
|
|
337
|
+
inputBackground: '#FFFFFF',
|
|
338
|
+
inputBorder: '#E2E8F0',
|
|
339
339
|
|
|
340
|
-
cardBackground: '
|
|
340
|
+
cardBackground: '#FFFFFF',
|
|
341
341
|
|
|
342
342
|
// =============================================================================
|
|
343
343
|
// SPECIAL COLORS
|
|
@@ -378,7 +378,7 @@ export const darkColors = {
|
|
|
378
378
|
// =============================================================================
|
|
379
379
|
// GRADIENTS (Same as light mode for type consistency)
|
|
380
380
|
// =============================================================================
|
|
381
|
-
gradient: ['
|
|
381
|
+
gradient: ['#3B82F6', '#8B5CF6'],
|
|
382
382
|
};
|
|
383
383
|
|
|
384
384
|
// =============================================================================
|