@umituz/react-native-design-system 2.5.13 → 2.5.15
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 +1 -1
- package/src/atoms/EmptyState.tsx +121 -0
- package/src/atoms/index.ts +4 -0
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.15",
|
|
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",
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EmptyState - Universal Empty State Component
|
|
3
|
+
*
|
|
4
|
+
* Displays when no data is available
|
|
5
|
+
*
|
|
6
|
+
* Atomic Design Level: ATOM
|
|
7
|
+
* Purpose: Empty state indication across all apps
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { View, StyleSheet, TouchableOpacity, ViewStyle } from 'react-native';
|
|
12
|
+
import { AtomicIcon } from './AtomicIcon';
|
|
13
|
+
import { AtomicText } from './AtomicText';
|
|
14
|
+
import { useAppDesignTokens, STATIC_TOKENS } from '../theme';
|
|
15
|
+
|
|
16
|
+
export interface EmptyStateProps {
|
|
17
|
+
icon?: string;
|
|
18
|
+
title: string;
|
|
19
|
+
subtitle?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
actionLabel?: string;
|
|
22
|
+
onAction?: () => void;
|
|
23
|
+
illustration?: React.ReactNode;
|
|
24
|
+
style?: ViewStyle;
|
|
25
|
+
testID?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const EmptyState: React.FC<EmptyStateProps> = ({
|
|
29
|
+
icon = 'inbox',
|
|
30
|
+
title,
|
|
31
|
+
subtitle,
|
|
32
|
+
description,
|
|
33
|
+
actionLabel,
|
|
34
|
+
onAction,
|
|
35
|
+
illustration,
|
|
36
|
+
style,
|
|
37
|
+
testID,
|
|
38
|
+
}) => {
|
|
39
|
+
const tokens = useAppDesignTokens();
|
|
40
|
+
const displayDescription = description || subtitle;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View style={[styles.container, style]} testID={testID}>
|
|
44
|
+
{illustration ? (
|
|
45
|
+
illustration
|
|
46
|
+
) : (
|
|
47
|
+
<View
|
|
48
|
+
style={[
|
|
49
|
+
styles.iconContainer,
|
|
50
|
+
{ backgroundColor: tokens.colors.surface },
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
53
|
+
<AtomicIcon name={icon} size="xxl" color="secondary" />
|
|
54
|
+
</View>
|
|
55
|
+
)}
|
|
56
|
+
|
|
57
|
+
<AtomicText
|
|
58
|
+
type="headlineSmall"
|
|
59
|
+
color="primary"
|
|
60
|
+
style={[styles.title, { textAlign: 'center' }]}
|
|
61
|
+
>
|
|
62
|
+
{title}
|
|
63
|
+
</AtomicText>
|
|
64
|
+
|
|
65
|
+
{displayDescription && (
|
|
66
|
+
<AtomicText
|
|
67
|
+
type="bodyMedium"
|
|
68
|
+
color="secondary"
|
|
69
|
+
style={[styles.description, { textAlign: 'center' }]}
|
|
70
|
+
>
|
|
71
|
+
{displayDescription}
|
|
72
|
+
</AtomicText>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
{actionLabel && onAction && (
|
|
76
|
+
<TouchableOpacity
|
|
77
|
+
style={[
|
|
78
|
+
styles.actionButton,
|
|
79
|
+
{ backgroundColor: tokens.colors.primary },
|
|
80
|
+
]}
|
|
81
|
+
onPress={onAction}
|
|
82
|
+
activeOpacity={0.8}
|
|
83
|
+
>
|
|
84
|
+
<AtomicText type="labelLarge" color="onPrimary">
|
|
85
|
+
{actionLabel}
|
|
86
|
+
</AtomicText>
|
|
87
|
+
</TouchableOpacity>
|
|
88
|
+
)}
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const styles = StyleSheet.create({
|
|
94
|
+
container: {
|
|
95
|
+
flex: 1,
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
justifyContent: 'center',
|
|
98
|
+
padding: STATIC_TOKENS.spacing.xl,
|
|
99
|
+
},
|
|
100
|
+
iconContainer: {
|
|
101
|
+
width: 120,
|
|
102
|
+
height: 120,
|
|
103
|
+
borderRadius: 60,
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
justifyContent: 'center',
|
|
106
|
+
marginBottom: STATIC_TOKENS.spacing.lg,
|
|
107
|
+
},
|
|
108
|
+
title: {
|
|
109
|
+
marginBottom: STATIC_TOKENS.spacing.sm,
|
|
110
|
+
},
|
|
111
|
+
description: {
|
|
112
|
+
marginBottom: STATIC_TOKENS.spacing.lg,
|
|
113
|
+
maxWidth: 280,
|
|
114
|
+
},
|
|
115
|
+
actionButton: {
|
|
116
|
+
paddingHorizontal: STATIC_TOKENS.spacing.lg,
|
|
117
|
+
paddingVertical: STATIC_TOKENS.spacing.md,
|
|
118
|
+
borderRadius: STATIC_TOKENS.borders.radius.md,
|
|
119
|
+
marginTop: STATIC_TOKENS.spacing.sm,
|
|
120
|
+
},
|
|
121
|
+
});
|
package/src/atoms/index.ts
CHANGED
|
@@ -91,7 +91,11 @@ export {
|
|
|
91
91
|
// Spinner
|
|
92
92
|
export {
|
|
93
93
|
AtomicSpinner,
|
|
94
|
+
AtomicSpinner as LoadingSpinner,
|
|
94
95
|
type AtomicSpinnerProps,
|
|
95
96
|
type SpinnerSize,
|
|
96
97
|
type SpinnerColor,
|
|
97
98
|
} from './AtomicSpinner';
|
|
99
|
+
|
|
100
|
+
// Empty State
|
|
101
|
+
export { EmptyState, type EmptyStateProps } from './EmptyState';
|
package/src/index.ts
CHANGED
|
@@ -189,6 +189,8 @@ export {
|
|
|
189
189
|
AtomicSkeleton,
|
|
190
190
|
AtomicBadge,
|
|
191
191
|
AtomicSpinner,
|
|
192
|
+
LoadingSpinner,
|
|
193
|
+
EmptyState,
|
|
192
194
|
type IconName,
|
|
193
195
|
type IconSize,
|
|
194
196
|
type IconColor,
|
|
@@ -224,6 +226,7 @@ export {
|
|
|
224
226
|
type AtomicSpinnerProps,
|
|
225
227
|
type SpinnerSize,
|
|
226
228
|
type SpinnerColor,
|
|
229
|
+
type EmptyStateProps,
|
|
227
230
|
} from './atoms';
|
|
228
231
|
|
|
229
232
|
// =============================================================================
|