@umituz/react-native-design-system 1.0.0 → 1.0.2
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,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"version:patch": "npm version patch -m 'chore: release v%s'",
|
|
9
|
+
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
10
|
+
"version:major": "npm version major -m 'chore: release v%s'"
|
|
11
|
+
},
|
|
7
12
|
"keywords": [
|
|
8
13
|
"react-native",
|
|
9
14
|
"design-system",
|
|
@@ -13,19 +18,20 @@
|
|
|
13
18
|
"ddd",
|
|
14
19
|
"domain-driven-design"
|
|
15
20
|
],
|
|
16
|
-
"author": "
|
|
21
|
+
"author": "Ümit UZ <umit@umituz.com>",
|
|
17
22
|
"license": "MIT",
|
|
18
23
|
"repository": {
|
|
19
24
|
"type": "git",
|
|
20
25
|
"url": "https://github.com/umituz/react-native-design-system"
|
|
21
26
|
},
|
|
22
27
|
"peerDependencies": {
|
|
23
|
-
"react": "18.
|
|
24
|
-
"react-native": "0.
|
|
28
|
+
"react": ">=18.2.0",
|
|
29
|
+
"react-native": ">=0.74.0",
|
|
25
30
|
"react-native-paper": "^5.12.5",
|
|
26
31
|
"react-native-reanimated": "~3.10.1",
|
|
27
32
|
"@react-native-community/datetimepicker": "8.0.1",
|
|
28
|
-
"@expo/vector-icons": "^14.0.0"
|
|
33
|
+
"@expo/vector-icons": "^14.0.0",
|
|
34
|
+
"lucide-react-native": "^0.468.0"
|
|
29
35
|
},
|
|
30
36
|
"peerDependenciesMeta": {
|
|
31
37
|
"@react-native-community/datetimepicker": {
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* useAppDesignTokens Hook -
|
|
2
|
+
* useAppDesignTokens Hook - Design Tokens Access
|
|
3
3
|
*
|
|
4
|
-
* ✅
|
|
5
|
-
* ✅
|
|
4
|
+
* ✅ NPM PACKAGE VERSION - Standalone, no theme dependencies
|
|
5
|
+
* ✅ Returns static light theme tokens
|
|
6
6
|
* ✅ Type-safe design tokens
|
|
7
|
-
* ✅
|
|
8
|
-
* ✅ Graceful fallback to light theme
|
|
9
|
-
* ✅ NO CIRCULAR DEPENDENCY - Relative imports break barrel export cycle
|
|
7
|
+
* ✅ Zero external dependencies
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* - Relative import for TokenFactory (not barrel through AppDesignTokens)
|
|
14
|
-
* - NOT exported from AppDesignTokens.ts (only from design-system/index.ts)
|
|
15
|
-
*
|
|
16
|
-
* This architecture prevents cycle:
|
|
17
|
-
* - useAppDesignTokens → useTheme (relative, not through barrel)
|
|
18
|
-
* - theme → design-system (through barrel, but useAppDesignTokens not in token barrel)
|
|
19
|
-
* - No cycle detected!
|
|
20
|
-
*
|
|
21
|
-
* @module useAppDesignTokens
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import { useMemo } from 'react';
|
|
25
|
-
import { useTheme } from '../../../theme/infrastructure/stores/themeStore';
|
|
26
|
-
import { createDesignTokens, STATIC_DESIGN_TOKENS, type ThemeMode } from '../tokens/core/TokenFactory';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 🎯 DYNAMIC DESIGN TOKENS HOOK
|
|
30
|
-
*
|
|
31
|
-
* USE THIS HOOK in all components for theme-aware design tokens!
|
|
32
|
-
*
|
|
33
|
-
* ✅ Colors are DYNAMIC (update when theme changes)
|
|
34
|
-
* ✅ Typography, spacing, etc. are STATIC (performance optimization)
|
|
35
|
-
* ✅ Automatic re-render on theme change
|
|
36
|
-
* ✅ Zero duplication (uses TokenFactory)
|
|
9
|
+
* NOTE: This is the npm package version which returns light theme only.
|
|
10
|
+
* For dynamic theme switching, apps should use @domains/theme ThemeProvider.
|
|
37
11
|
*
|
|
38
12
|
* @example
|
|
39
13
|
* ```typescript
|
|
40
|
-
* import { useAppDesignTokens } from '@
|
|
14
|
+
* import { useAppDesignTokens } from '@umituz/react-native-design-system';
|
|
41
15
|
*
|
|
42
16
|
* const MyComponent = () => {
|
|
43
17
|
* const tokens = useAppDesignTokens();
|
|
@@ -53,26 +27,11 @@ import { createDesignTokens, STATIC_DESIGN_TOKENS, type ThemeMode } from '../tok
|
|
|
53
27
|
* };
|
|
54
28
|
* ```
|
|
55
29
|
*/
|
|
56
|
-
export const useAppDesignTokens = () => {
|
|
57
|
-
// ✅ Hooks must be called unconditionally at the top level
|
|
58
|
-
const { theme, themeMode: mode } = useTheme();
|
|
59
30
|
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
// Validate theme mode
|
|
63
|
-
const themeMode: ThemeMode = mode === 'dark' ? 'dark' : 'light';
|
|
31
|
+
import { STATIC_DESIGN_TOKENS } from '../tokens/core/TokenFactory';
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ✅ Create tokens using TokenFactory (ZERO duplication!)
|
|
72
|
-
return createDesignTokens(themeMode);
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.warn('useAppDesignTokens: Error accessing theme, using fallback:', error);
|
|
75
|
-
return STATIC_DESIGN_TOKENS; // Fallback to light theme
|
|
76
|
-
}
|
|
77
|
-
}, [theme?.colors, mode]); // Re-compute when colors or mode changes
|
|
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;
|
|
78
37
|
};
|
|
@@ -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
|
// =============================================================================
|