@umituz/react-native-design-system 2.6.97 → 2.6.98
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.6.
|
|
3
|
+
"version": "2.6.98",
|
|
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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
4
|
+
import { AtomicChip } from '../../atoms/chip';
|
|
5
|
+
import { useAppDesignTokens } from '../../theme';
|
|
6
|
+
import type { FilterGroupProps } from './types';
|
|
7
|
+
|
|
8
|
+
export function FilterGroup<T = string>({
|
|
9
|
+
items,
|
|
10
|
+
selectedValue,
|
|
11
|
+
onSelect,
|
|
12
|
+
style,
|
|
13
|
+
contentContainerStyle,
|
|
14
|
+
itemStyle,
|
|
15
|
+
}: FilterGroupProps<T>) {
|
|
16
|
+
const tokens = useAppDesignTokens();
|
|
17
|
+
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
flexGrow: 0,
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
paddingHorizontal: tokens.spacing.md,
|
|
24
|
+
gap: tokens.spacing.sm,
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
},
|
|
27
|
+
item: {
|
|
28
|
+
// Default styles if needed, though AtomicChip handles most
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<ScrollView
|
|
34
|
+
horizontal
|
|
35
|
+
showsHorizontalScrollIndicator={false}
|
|
36
|
+
style={[styles.container, style]}
|
|
37
|
+
contentContainerStyle={[styles.content, contentContainerStyle]}
|
|
38
|
+
>
|
|
39
|
+
{items.map((item) => {
|
|
40
|
+
const isSelected = item.value === selectedValue;
|
|
41
|
+
return (
|
|
42
|
+
<AtomicChip
|
|
43
|
+
key={`${item.value}`}
|
|
44
|
+
variant={isSelected ? 'filled' : 'outlined'}
|
|
45
|
+
color={isSelected ? 'primary' : 'surface'}
|
|
46
|
+
selected={isSelected}
|
|
47
|
+
onPress={() => onSelect(item.value)}
|
|
48
|
+
clickable
|
|
49
|
+
style={[styles.item, itemStyle]}
|
|
50
|
+
testID={item.testID}
|
|
51
|
+
>
|
|
52
|
+
{item.label}
|
|
53
|
+
</AtomicChip>
|
|
54
|
+
);
|
|
55
|
+
})}
|
|
56
|
+
</ScrollView>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
export interface FilterItem<T = string> {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
testID?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface FilterGroupProps<T = string> {
|
|
9
|
+
items: FilterItem<T>[];
|
|
10
|
+
selectedValue: T;
|
|
11
|
+
onSelect: (value: T) => void;
|
|
12
|
+
style?: any;
|
|
13
|
+
contentContainerStyle?: any;
|
|
14
|
+
itemStyle?: any;
|
|
15
|
+
}
|