@umituz/react-native-design-system 2.1.1 → 2.1.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": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -105,4 +105,4 @@
|
|
|
105
105
|
"README.md",
|
|
106
106
|
"LICENSE"
|
|
107
107
|
]
|
|
108
|
-
}
|
|
108
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { View, StyleSheet, ViewStyle } from "react-native";
|
|
3
|
+
import { useAppDesignTokens } from "../../theme/hooks/useAppDesignTokens";
|
|
4
|
+
|
|
5
|
+
export interface StepProgressProps {
|
|
6
|
+
currentStep: number;
|
|
7
|
+
totalSteps: number;
|
|
8
|
+
style?: ViewStyle;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const StepProgress: React.FC<StepProgressProps> = ({
|
|
12
|
+
currentStep,
|
|
13
|
+
totalSteps,
|
|
14
|
+
style,
|
|
15
|
+
}) => {
|
|
16
|
+
const tokens = useAppDesignTokens();
|
|
17
|
+
|
|
18
|
+
const styles = useMemo(
|
|
19
|
+
() =>
|
|
20
|
+
StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
flexDirection: "row",
|
|
23
|
+
gap: 8,
|
|
24
|
+
paddingHorizontal: 24,
|
|
25
|
+
paddingVertical: 16,
|
|
26
|
+
},
|
|
27
|
+
step: {
|
|
28
|
+
flex: 1,
|
|
29
|
+
height: 4,
|
|
30
|
+
borderRadius: 2,
|
|
31
|
+
backgroundColor: tokens.colors.border,
|
|
32
|
+
},
|
|
33
|
+
activeStep: {
|
|
34
|
+
backgroundColor: tokens.colors.primary,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
[tokens],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<View style={[styles.container, style]}>
|
|
42
|
+
{Array.from({ length: totalSteps }).map((_, index) => (
|
|
43
|
+
<View
|
|
44
|
+
key={index}
|
|
45
|
+
style={[styles.step, index < currentStep && styles.activeStep]}
|
|
46
|
+
/>
|
|
47
|
+
))}
|
|
48
|
+
</View>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./StepProgress";
|
package/src/molecules/index.ts
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useAppDesignTokens Hook - Theme-Aware Design Tokens
|
|
3
|
-
*
|
|
4
|
-
* ✅ Automatically reads theme from global store
|
|
5
|
-
* ✅ No parameters needed - fully automatic!
|
|
6
|
-
* ✅ Returns tokens for current theme (light/dark)
|
|
7
|
-
* ✅ Single source of truth
|
|
8
|
-
*
|
|
9
|
-
* @example Usage (fully automatic theme-aware)
|
|
10
|
-
* ```typescript
|
|
11
|
-
* import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
|
|
12
|
-
*
|
|
13
|
-
* const MyComponent = () => {
|
|
14
|
-
* const tokens = useAppDesignTokens(); // Automatically uses current theme!
|
|
15
|
-
* return (
|
|
16
|
-
* <View style={{
|
|
17
|
-
* backgroundColor: tokens.colors.primary,
|
|
18
|
-
* padding: tokens.spacing.md
|
|
19
|
-
* }}>
|
|
20
|
-
* <Text style={tokens.typography.bodyLarge}>Hello!</Text>
|
|
21
|
-
* </View>
|
|
22
|
-
* );
|
|
23
|
-
* };
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
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!
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
import { useMemo } from 'react';
|
|
34
|
-
import { createDesignTokens, type DesignTokens } from '../core/TokenFactory';
|
|
35
|
-
import { useDesignSystemTheme } from '../infrastructure/globalThemeStore';
|
|
36
|
-
|
|
37
|
-
export const useAppDesignTokens = (): DesignTokens => {
|
|
38
|
-
const { themeMode, customColors } = useDesignSystemTheme();
|
|
39
|
-
|
|
40
|
-
return useMemo(() => {
|
|
41
|
-
const mode = themeMode === 'dark' ? 'dark' : 'light';
|
|
42
|
-
return createDesignTokens(mode, customColors);
|
|
43
|
-
}, [themeMode, customColors]);
|
|
44
|
-
};
|
|
45
|
-
|