@herca/rn-kit 0.1.34 → 0.1.36
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/lib/module/Accordion/Accordion.js +11 -2
- package/lib/module/Accordion/Accordion.js.map +1 -1
- package/lib/module/Accordion/AccordionItem.js +1 -0
- package/lib/module/Accordion/AccordionItem.js.map +1 -1
- package/lib/module/Accordion/README.md +14 -11
- package/lib/module/BadgeIcon/BadgeIcon.js +117 -0
- package/lib/module/BadgeIcon/BadgeIcon.js.map +1 -0
- package/lib/module/BadgeIcon/README.md +77 -0
- package/lib/module/BadgeIcon/type.js +2 -0
- package/lib/module/BadgeIcon/type.js.map +1 -0
- package/lib/module/BottomSheet/BottomSheet.js +1 -1
- package/lib/module/BottomSheet/BottomSheet.js.map +1 -1
- package/lib/module/CheckBox/CheckBox.js +65 -32
- package/lib/module/CheckBox/CheckBox.js.map +1 -1
- package/lib/module/CheckBox/CheckBoxList.js +10 -2
- package/lib/module/CheckBox/CheckBoxList.js.map +1 -1
- package/lib/module/CheckBox/README_CHECKBOX.md +10 -7
- package/lib/module/CheckBox/README_CHECKBOXLIST.md +13 -7
- package/lib/module/CheckBox/type.js +2 -0
- package/lib/module/CheckBox/type.js.map +1 -0
- package/lib/module/Icon/Icon.js +7 -1
- package/lib/module/Icon/Icon.js.map +1 -1
- package/lib/module/Icon/README.md +3 -0
- package/lib/module/Icon/icons/CopyFill.js +25 -0
- package/lib/module/Icon/icons/CopyFill.js.map +1 -0
- package/lib/module/Icon/icons/CopyTextFill.js +22 -0
- package/lib/module/Icon/icons/CopyTextFill.js.map +1 -0
- package/lib/module/Icon/icons/RadioButton.js +0 -1
- package/lib/module/Icon/icons/RadioButton.js.map +1 -1
- package/lib/module/Icon/icons/ShieldFillChecked.js +22 -0
- package/lib/module/Icon/icons/ShieldFillChecked.js.map +1 -0
- package/lib/module/Input/Input.js +19 -23
- package/lib/module/Input/Input.js.map +1 -1
- package/lib/module/Input/README_INPUT.md +17 -15
- package/lib/module/Tab/README.md +1 -0
- package/lib/module/Tab/Tab.js +58 -38
- package/lib/module/Tab/Tab.js.map +1 -1
- package/lib/module/Tab/TabItem.js.map +1 -1
- package/lib/module/Timeline/README.md +5 -5
- package/lib/module/Timeline/TimelineItem.js +4 -1
- package/lib/module/Timeline/TimelineItem.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Accordion/Accordion.d.ts +1 -1
- package/lib/typescript/src/Accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/src/Accordion/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/src/Accordion/type.d.ts +1 -0
- package/lib/typescript/src/Accordion/type.d.ts.map +1 -1
- package/lib/typescript/src/BadgeIcon/BadgeIcon.d.ts +20 -0
- package/lib/typescript/src/BadgeIcon/BadgeIcon.d.ts.map +1 -0
- package/lib/typescript/src/BadgeIcon/type.d.ts +11 -0
- package/lib/typescript/src/BadgeIcon/type.d.ts.map +1 -0
- package/lib/typescript/src/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/src/CheckBox/CheckBox.d.ts +4 -0
- package/lib/typescript/src/CheckBox/CheckBox.d.ts.map +1 -1
- package/lib/typescript/src/CheckBox/CheckBoxList.d.ts +3 -0
- package/lib/typescript/src/CheckBox/CheckBoxList.d.ts.map +1 -1
- package/lib/typescript/src/CheckBox/type.d.ts +2 -0
- package/lib/typescript/src/CheckBox/type.d.ts.map +1 -0
- package/lib/typescript/src/Icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/Icon/icons/CopyFill.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/CopyFill.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/CopyTextFill.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/CopyTextFill.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ShieldFillChecked.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ShieldFillChecked.d.ts.map +1 -0
- package/lib/typescript/src/Icon/type.d.ts +1 -1
- package/lib/typescript/src/Icon/type.d.ts.map +1 -1
- package/lib/typescript/src/Input/Input.d.ts.map +1 -1
- package/lib/typescript/src/Input/type.d.ts +1 -0
- package/lib/typescript/src/Input/type.d.ts.map +1 -1
- package/lib/typescript/src/Tab/Tab.d.ts.map +1 -1
- package/lib/typescript/src/Tab/TabItem.d.ts.map +1 -1
- package/lib/typescript/src/Tab/type.d.ts +2 -1
- package/lib/typescript/src/Tab/type.d.ts.map +1 -1
- package/lib/typescript/src/Timeline/TimelineItem.d.ts +3 -0
- package/lib/typescript/src/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Accordion/Accordion.tsx +15 -3
- package/src/Accordion/AccordionItem.tsx +5 -1
- package/src/Accordion/README.md +14 -11
- package/src/Accordion/type.tsx +1 -0
- package/src/BadgeIcon/BadgeIcon.tsx +126 -0
- package/src/BadgeIcon/README.md +77 -0
- package/src/BadgeIcon/type.tsx +21 -0
- package/src/BottomSheet/BottomSheet.tsx +3 -1
- package/src/CheckBox/CheckBox.tsx +45 -29
- package/src/CheckBox/CheckBoxList.tsx +12 -0
- package/src/CheckBox/README_CHECKBOX.md +10 -7
- package/src/CheckBox/README_CHECKBOXLIST.md +13 -7
- package/src/CheckBox/type.ts +9 -0
- package/src/Icon/Icon.tsx +6 -0
- package/src/Icon/README.md +3 -0
- package/src/Icon/icons/CopyFill.tsx +23 -0
- package/src/Icon/icons/CopyTextFill.tsx +29 -0
- package/src/Icon/icons/RadioButton.tsx +1 -1
- package/src/Icon/icons/ShieldFillChecked.tsx +23 -0
- package/src/Icon/type.tsx +3 -0
- package/src/Input/Input.tsx +17 -25
- package/src/Input/README_INPUT.md +17 -15
- package/src/Input/type.tsx +1 -0
- package/src/Tab/README.md +1 -0
- package/src/Tab/Tab.tsx +68 -44
- package/src/Tab/TabItem.tsx +1 -1
- package/src/Tab/type.tsx +2 -1
- package/src/Timeline/README.md +5 -5
- package/src/Timeline/TimelineItem.tsx +3 -0
- package/src/index.tsx +1 -0
package/src/Tab/Tab.tsx
CHANGED
|
@@ -6,13 +6,18 @@ import React, {
|
|
|
6
6
|
Children,
|
|
7
7
|
isValidElement,
|
|
8
8
|
} from 'react';
|
|
9
|
-
import { View, Pressable, StyleSheet } from 'react-native';
|
|
9
|
+
import { View, Pressable, StyleSheet, ScrollView } from 'react-native';
|
|
10
10
|
import PagerView from 'react-native-pager-view';
|
|
11
11
|
import Color from '../Color/Color';
|
|
12
12
|
import Typography from '../Typography/Typography';
|
|
13
13
|
import type { TabItemProps, TabProps } from './type';
|
|
14
14
|
|
|
15
|
-
const Tab: React.FC<TabProps> = ({
|
|
15
|
+
const Tab: React.FC<TabProps> = ({
|
|
16
|
+
children,
|
|
17
|
+
current = 0,
|
|
18
|
+
onChangeTab,
|
|
19
|
+
renderHeader,
|
|
20
|
+
}) => {
|
|
16
21
|
const items = Children.toArray(children).filter(
|
|
17
22
|
isValidElement
|
|
18
23
|
) as React.ReactElement<TabItemProps>[];
|
|
@@ -44,45 +49,61 @@ const Tab: React.FC<TabProps> = ({ children, current = 0, onChangeTab }) => {
|
|
|
44
49
|
|
|
45
50
|
return (
|
|
46
51
|
<View style={styles.container}>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
const isActive = index === activeIndex;
|
|
51
|
-
return (
|
|
52
|
-
<Pressable
|
|
53
|
-
key={index}
|
|
54
|
-
style={[
|
|
55
|
-
styles.tabButton,
|
|
56
|
-
isActive ? styles.tabActive : styles.tabInactive,
|
|
57
|
-
]}
|
|
58
|
-
onPress={() => handleHeaderPress(index)}
|
|
59
|
-
>
|
|
60
|
-
<Typography
|
|
61
|
-
center
|
|
62
|
-
variant="t2"
|
|
63
|
-
weight="semibold"
|
|
64
|
-
color={isActive ? Color.base.white100 : Color.gray[700]}
|
|
65
|
-
>
|
|
66
|
-
{item.props.name}
|
|
67
|
-
</Typography>
|
|
68
|
-
</Pressable>
|
|
69
|
-
);
|
|
70
|
-
})}
|
|
71
|
-
</View>
|
|
72
|
-
<PagerView
|
|
73
|
-
ref={pagerRef}
|
|
74
|
-
style={styles.pager}
|
|
75
|
-
initialPage={current}
|
|
76
|
-
onPageSelected={(e) => updateActive(e.nativeEvent.position)}
|
|
52
|
+
<ScrollView
|
|
53
|
+
stickyHeaderIndices={[renderHeader ? 1 : 0]} // bikin tabBar sticky
|
|
54
|
+
contentContainerStyle={{ flexGrow: 1 }}
|
|
77
55
|
>
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
56
|
+
{/* Header */}
|
|
57
|
+
{renderHeader ? renderHeader : null}
|
|
58
|
+
|
|
59
|
+
{/* TabBar (sticky + horizontal scroll) */}
|
|
60
|
+
<ScrollView
|
|
61
|
+
horizontal
|
|
62
|
+
showsHorizontalScrollIndicator={false}
|
|
63
|
+
style={styles.tabBarWrapper}
|
|
64
|
+
>
|
|
65
|
+
<View style={styles.tabBar}>
|
|
66
|
+
{items.map((item, index) => {
|
|
67
|
+
const isActive = index === activeIndex;
|
|
68
|
+
return (
|
|
69
|
+
<Pressable
|
|
70
|
+
key={index}
|
|
71
|
+
style={[
|
|
72
|
+
styles.tabButton,
|
|
73
|
+
isActive ? styles.tabActive : styles.tabInactive,
|
|
74
|
+
]}
|
|
75
|
+
onPress={() => handleHeaderPress(index)}
|
|
76
|
+
>
|
|
77
|
+
<Typography
|
|
78
|
+
center
|
|
79
|
+
variant="t2"
|
|
80
|
+
weight="semibold"
|
|
81
|
+
color={isActive ? Color.base.white100 : Color.gray[700]}
|
|
82
|
+
>
|
|
83
|
+
{item.props.name}
|
|
84
|
+
</Typography>
|
|
85
|
+
</Pressable>
|
|
86
|
+
);
|
|
87
|
+
})}
|
|
88
|
+
</View>
|
|
89
|
+
</ScrollView>
|
|
90
|
+
|
|
91
|
+
{/* Konten */}
|
|
92
|
+
<View style={{ flex: 1 }}>
|
|
93
|
+
<PagerView
|
|
94
|
+
ref={pagerRef}
|
|
95
|
+
style={styles.pager}
|
|
96
|
+
initialPage={current}
|
|
97
|
+
onPageSelected={(e) => updateActive(e.nativeEvent.position)}
|
|
98
|
+
>
|
|
99
|
+
{items.map((item, index) => (
|
|
100
|
+
<View key={index} collapsable={false} style={{ flex: 1 }}>
|
|
101
|
+
{item?.props?.children}
|
|
102
|
+
</View>
|
|
103
|
+
))}
|
|
104
|
+
</PagerView>
|
|
105
|
+
</View>
|
|
106
|
+
</ScrollView>
|
|
86
107
|
</View>
|
|
87
108
|
);
|
|
88
109
|
};
|
|
@@ -91,21 +112,24 @@ export default Tab;
|
|
|
91
112
|
|
|
92
113
|
const styles = StyleSheet.create({
|
|
93
114
|
container: { flex: 1 },
|
|
94
|
-
|
|
95
|
-
flexDirection: 'row',
|
|
115
|
+
tabBarWrapper: {
|
|
96
116
|
backgroundColor: Color.gray[100],
|
|
117
|
+
borderRadius: 8,
|
|
118
|
+
},
|
|
119
|
+
tabBar: {
|
|
120
|
+
flexDirection: 'row', // tetap row
|
|
97
121
|
padding: 4,
|
|
98
122
|
borderRadius: 8,
|
|
99
123
|
},
|
|
100
124
|
tabButton: {
|
|
101
|
-
flex: 1,
|
|
102
125
|
borderRadius: 8,
|
|
103
126
|
paddingVertical: 6,
|
|
104
127
|
paddingHorizontal: 16,
|
|
105
128
|
justifyContent: 'center',
|
|
106
129
|
alignItems: 'center',
|
|
130
|
+
marginRight: 8,
|
|
107
131
|
},
|
|
108
132
|
tabActive: { backgroundColor: Color.primary[1000] },
|
|
109
133
|
tabInactive: { backgroundColor: Color.gray[100] },
|
|
110
|
-
pager: { flex: 1,
|
|
134
|
+
pager: { flex: 1, minHeight: 800 },
|
|
111
135
|
});
|
package/src/Tab/TabItem.tsx
CHANGED
package/src/Tab/type.tsx
CHANGED
|
@@ -2,10 +2,11 @@ import React, { type ReactElement } from 'react';
|
|
|
2
2
|
|
|
3
3
|
export interface TabItemProps {
|
|
4
4
|
name: string | number;
|
|
5
|
-
children: React.
|
|
5
|
+
children: React.ReactElement<any>;
|
|
6
6
|
}
|
|
7
7
|
export interface TabProps {
|
|
8
8
|
children: ReactElement<TabItemProps> | ReactElement<TabItemProps>[];
|
|
9
9
|
current?: number;
|
|
10
|
+
renderHeader?: React.ReactElement;
|
|
10
11
|
onChangeTab?: (e: any) => void;
|
|
11
12
|
}
|
package/src/Timeline/README.md
CHANGED
|
@@ -44,11 +44,11 @@ export default function OrderHistory() {
|
|
|
44
44
|
|
|
45
45
|
### TimelineItem
|
|
46
46
|
|
|
47
|
-
| Prop | Type
|
|
48
|
-
| ---------- |
|
|
49
|
-
| `children` | `ReactNode`
|
|
50
|
-
| `color` | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'purple'` | ❌ | `'primary'` | Skema warna titik (`RadioButton`) dan garis vertikal. |
|
|
51
|
-
| `isLast` | `boolean`
|
|
47
|
+
| Prop | Type | Wajib | Default | Deskripsi |
|
|
48
|
+
| ---------- | --------------------------------------------------------------------------------- | ----- | ----------- | ---------------------------------------------------------------- |
|
|
49
|
+
| `children` | `ReactNode` | ✅ | — | Konten untuk node timeline: teks, ikon tambahan, dsb. |
|
|
50
|
+
| `color` | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'purple'\| 'info'\| 'orange'` | ❌ | `'primary'` | Skema warna titik (`RadioButton`) dan garis vertikal. |
|
|
51
|
+
| `isLast` | `boolean` | ❌ | `false` | Menentukan apakah garis garis di kiri itu dimunculkan atau tidak |
|
|
52
52
|
|
|
53
53
|
## ⚙️ Cara Kerja
|
|
54
54
|
|
package/src/index.tsx
CHANGED
|
@@ -86,3 +86,4 @@ export { ToastProvider, useToast } from './Toast/ToastContext';
|
|
|
86
86
|
export { default as Skeleton } from './Skeleton/Skeleton';
|
|
87
87
|
export type { SkeletonProps } from './Skeleton/type';
|
|
88
88
|
export { default as CounterButton } from './CounterButton/CounterButton';
|
|
89
|
+
export { default as BadgeIcon } from './BadgeIcon/BadgeIcon';
|