@umituz/react-native-design-system 2.6.102 → 2.6.104
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/exports/molecules.ts +4 -0
- package/src/molecules/filter-group/FilterGroup.tsx +4 -1
- package/src/molecules/filter-group/types.ts +2 -1
- package/src/molecules/index.ts +2 -0
- package/src/molecules/info-grid/InfoGrid.tsx +102 -0
- package/src/molecules/info-grid/index.ts +3 -0
- package/src/molecules/info-grid/types.ts +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.104",
|
|
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",
|
package/src/exports/molecules.ts
CHANGED
|
@@ -9,6 +9,7 @@ export function FilterGroup<T = string>({
|
|
|
9
9
|
items,
|
|
10
10
|
selectedValue,
|
|
11
11
|
onSelect,
|
|
12
|
+
multiSelect = false,
|
|
12
13
|
style,
|
|
13
14
|
contentContainerStyle,
|
|
14
15
|
itemStyle,
|
|
@@ -37,7 +38,9 @@ export function FilterGroup<T = string>({
|
|
|
37
38
|
contentContainerStyle={[styles.content, contentContainerStyle]}
|
|
38
39
|
>
|
|
39
40
|
{items.map((item) => {
|
|
40
|
-
const isSelected =
|
|
41
|
+
const isSelected = multiSelect
|
|
42
|
+
? Array.isArray(selectedValue) && selectedValue.includes(item.value)
|
|
43
|
+
: item.value === selectedValue;
|
|
41
44
|
return (
|
|
42
45
|
<AtomicChip
|
|
43
46
|
key={`${item.value}`}
|
|
@@ -7,8 +7,9 @@ export interface FilterGroupItem<T = string> {
|
|
|
7
7
|
|
|
8
8
|
export interface FilterGroupProps<T = string> {
|
|
9
9
|
items: FilterGroupItem<T>[];
|
|
10
|
-
selectedValue: T;
|
|
10
|
+
selectedValue: T | T[];
|
|
11
11
|
onSelect: (value: T) => void;
|
|
12
|
+
multiSelect?: boolean;
|
|
12
13
|
style?: any;
|
|
13
14
|
contentContainerStyle?: any;
|
|
14
15
|
itemStyle?: any;
|
package/src/molecules/index.ts
CHANGED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import { AtomicText } from '../../atoms/AtomicText';
|
|
5
|
+
import { AtomicIcon } from '../../atoms/AtomicIcon';
|
|
6
|
+
import { useAppDesignTokens } from '../../theme';
|
|
7
|
+
import type { InfoGridProps, InfoGridItem } from './types';
|
|
8
|
+
|
|
9
|
+
export const InfoGrid: React.FC<InfoGridProps> = ({
|
|
10
|
+
title,
|
|
11
|
+
headerIcon,
|
|
12
|
+
items,
|
|
13
|
+
columns = 2,
|
|
14
|
+
style,
|
|
15
|
+
itemStyle,
|
|
16
|
+
}) => {
|
|
17
|
+
const tokens = useAppDesignTokens();
|
|
18
|
+
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
gap: tokens.spacing.md,
|
|
22
|
+
},
|
|
23
|
+
header: {
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
gap: tokens.spacing.xs,
|
|
27
|
+
},
|
|
28
|
+
headerIcon: {
|
|
29
|
+
width: 28,
|
|
30
|
+
height: 28,
|
|
31
|
+
borderRadius: tokens.borders.radius.sm,
|
|
32
|
+
backgroundColor: `${tokens.colors.primary}20`,
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
},
|
|
36
|
+
headerTitle: {
|
|
37
|
+
...tokens.typography.labelLarge,
|
|
38
|
+
fontWeight: '700',
|
|
39
|
+
color: tokens.colors.primary,
|
|
40
|
+
},
|
|
41
|
+
grid: {
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
flexWrap: 'wrap',
|
|
44
|
+
gap: tokens.spacing.sm,
|
|
45
|
+
},
|
|
46
|
+
item: {
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
gap: tokens.spacing.sm,
|
|
50
|
+
width: `${100 / columns - 2}%`, // Basic percentage calculation
|
|
51
|
+
backgroundColor: tokens.colors.surfaceVariant,
|
|
52
|
+
padding: tokens.spacing.md,
|
|
53
|
+
borderRadius: tokens.borders.radius.md,
|
|
54
|
+
borderWidth: 1,
|
|
55
|
+
borderColor: tokens.colors.outlineVariant,
|
|
56
|
+
},
|
|
57
|
+
iconContainer: {
|
|
58
|
+
width: 32,
|
|
59
|
+
height: 32,
|
|
60
|
+
borderRadius: tokens.borders.radius.sm,
|
|
61
|
+
backgroundColor: `${tokens.colors.primary}20`,
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
},
|
|
65
|
+
itemText: {
|
|
66
|
+
flex: 1,
|
|
67
|
+
...tokens.typography.bodySmall,
|
|
68
|
+
color: tokens.colors.textPrimary,
|
|
69
|
+
fontWeight: '500',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<View style={[styles.container, style]}>
|
|
75
|
+
{(title || headerIcon) && (
|
|
76
|
+
<View style={styles.header}>
|
|
77
|
+
{headerIcon && (
|
|
78
|
+
<View style={styles.headerIcon}>
|
|
79
|
+
<AtomicIcon name={headerIcon} size="xs" color="primary" />
|
|
80
|
+
</View>
|
|
81
|
+
)}
|
|
82
|
+
{title && <AtomicText style={styles.headerTitle}>{title}</AtomicText>}
|
|
83
|
+
</View>
|
|
84
|
+
)}
|
|
85
|
+
|
|
86
|
+
<View style={styles.grid}>
|
|
87
|
+
{items.map((item, index) => (
|
|
88
|
+
<View key={index} style={[styles.item, itemStyle]}>
|
|
89
|
+
{item.icon && (
|
|
90
|
+
<View style={styles.iconContainer}>
|
|
91
|
+
<AtomicIcon name={item.icon} size="xs" color="primary" />
|
|
92
|
+
</View>
|
|
93
|
+
)}
|
|
94
|
+
<AtomicText style={styles.itemText} numberOfLines={2}>
|
|
95
|
+
{item.text}
|
|
96
|
+
</AtomicText>
|
|
97
|
+
</View>
|
|
98
|
+
))}
|
|
99
|
+
</View>
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface InfoGridItem {
|
|
5
|
+
icon?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
testID?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface InfoGridProps {
|
|
11
|
+
title?: string;
|
|
12
|
+
headerIcon?: string;
|
|
13
|
+
items: InfoGridItem[];
|
|
14
|
+
columns?: number;
|
|
15
|
+
style?: StyleProp<ViewStyle>;
|
|
16
|
+
itemStyle?: StyleProp<ViewStyle>;
|
|
17
|
+
}
|