@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.
Files changed (110) hide show
  1. package/lib/module/Accordion/Accordion.js +11 -2
  2. package/lib/module/Accordion/Accordion.js.map +1 -1
  3. package/lib/module/Accordion/AccordionItem.js +1 -0
  4. package/lib/module/Accordion/AccordionItem.js.map +1 -1
  5. package/lib/module/Accordion/README.md +14 -11
  6. package/lib/module/BadgeIcon/BadgeIcon.js +117 -0
  7. package/lib/module/BadgeIcon/BadgeIcon.js.map +1 -0
  8. package/lib/module/BadgeIcon/README.md +77 -0
  9. package/lib/module/BadgeIcon/type.js +2 -0
  10. package/lib/module/BadgeIcon/type.js.map +1 -0
  11. package/lib/module/BottomSheet/BottomSheet.js +1 -1
  12. package/lib/module/BottomSheet/BottomSheet.js.map +1 -1
  13. package/lib/module/CheckBox/CheckBox.js +65 -32
  14. package/lib/module/CheckBox/CheckBox.js.map +1 -1
  15. package/lib/module/CheckBox/CheckBoxList.js +10 -2
  16. package/lib/module/CheckBox/CheckBoxList.js.map +1 -1
  17. package/lib/module/CheckBox/README_CHECKBOX.md +10 -7
  18. package/lib/module/CheckBox/README_CHECKBOXLIST.md +13 -7
  19. package/lib/module/CheckBox/type.js +2 -0
  20. package/lib/module/CheckBox/type.js.map +1 -0
  21. package/lib/module/Icon/Icon.js +7 -1
  22. package/lib/module/Icon/Icon.js.map +1 -1
  23. package/lib/module/Icon/README.md +3 -0
  24. package/lib/module/Icon/icons/CopyFill.js +25 -0
  25. package/lib/module/Icon/icons/CopyFill.js.map +1 -0
  26. package/lib/module/Icon/icons/CopyTextFill.js +22 -0
  27. package/lib/module/Icon/icons/CopyTextFill.js.map +1 -0
  28. package/lib/module/Icon/icons/RadioButton.js +0 -1
  29. package/lib/module/Icon/icons/RadioButton.js.map +1 -1
  30. package/lib/module/Icon/icons/ShieldFillChecked.js +22 -0
  31. package/lib/module/Icon/icons/ShieldFillChecked.js.map +1 -0
  32. package/lib/module/Input/Input.js +19 -23
  33. package/lib/module/Input/Input.js.map +1 -1
  34. package/lib/module/Input/README_INPUT.md +17 -15
  35. package/lib/module/Tab/README.md +1 -0
  36. package/lib/module/Tab/Tab.js +58 -38
  37. package/lib/module/Tab/Tab.js.map +1 -1
  38. package/lib/module/Tab/TabItem.js.map +1 -1
  39. package/lib/module/Timeline/README.md +5 -5
  40. package/lib/module/Timeline/TimelineItem.js +4 -1
  41. package/lib/module/Timeline/TimelineItem.js.map +1 -1
  42. package/lib/module/index.js +1 -0
  43. package/lib/module/index.js.map +1 -1
  44. package/lib/typescript/src/Accordion/Accordion.d.ts +1 -1
  45. package/lib/typescript/src/Accordion/Accordion.d.ts.map +1 -1
  46. package/lib/typescript/src/Accordion/AccordionItem.d.ts.map +1 -1
  47. package/lib/typescript/src/Accordion/type.d.ts +1 -0
  48. package/lib/typescript/src/Accordion/type.d.ts.map +1 -1
  49. package/lib/typescript/src/BadgeIcon/BadgeIcon.d.ts +20 -0
  50. package/lib/typescript/src/BadgeIcon/BadgeIcon.d.ts.map +1 -0
  51. package/lib/typescript/src/BadgeIcon/type.d.ts +11 -0
  52. package/lib/typescript/src/BadgeIcon/type.d.ts.map +1 -0
  53. package/lib/typescript/src/BottomSheet/BottomSheet.d.ts.map +1 -1
  54. package/lib/typescript/src/CheckBox/CheckBox.d.ts +4 -0
  55. package/lib/typescript/src/CheckBox/CheckBox.d.ts.map +1 -1
  56. package/lib/typescript/src/CheckBox/CheckBoxList.d.ts +3 -0
  57. package/lib/typescript/src/CheckBox/CheckBoxList.d.ts.map +1 -1
  58. package/lib/typescript/src/CheckBox/type.d.ts +2 -0
  59. package/lib/typescript/src/CheckBox/type.d.ts.map +1 -0
  60. package/lib/typescript/src/Icon/Icon.d.ts.map +1 -1
  61. package/lib/typescript/src/Icon/icons/CopyFill.d.ts +9 -0
  62. package/lib/typescript/src/Icon/icons/CopyFill.d.ts.map +1 -0
  63. package/lib/typescript/src/Icon/icons/CopyTextFill.d.ts +9 -0
  64. package/lib/typescript/src/Icon/icons/CopyTextFill.d.ts.map +1 -0
  65. package/lib/typescript/src/Icon/icons/ShieldFillChecked.d.ts +9 -0
  66. package/lib/typescript/src/Icon/icons/ShieldFillChecked.d.ts.map +1 -0
  67. package/lib/typescript/src/Icon/type.d.ts +1 -1
  68. package/lib/typescript/src/Icon/type.d.ts.map +1 -1
  69. package/lib/typescript/src/Input/Input.d.ts.map +1 -1
  70. package/lib/typescript/src/Input/type.d.ts +1 -0
  71. package/lib/typescript/src/Input/type.d.ts.map +1 -1
  72. package/lib/typescript/src/Tab/Tab.d.ts.map +1 -1
  73. package/lib/typescript/src/Tab/TabItem.d.ts.map +1 -1
  74. package/lib/typescript/src/Tab/type.d.ts +2 -1
  75. package/lib/typescript/src/Tab/type.d.ts.map +1 -1
  76. package/lib/typescript/src/Timeline/TimelineItem.d.ts +3 -0
  77. package/lib/typescript/src/Timeline/TimelineItem.d.ts.map +1 -1
  78. package/lib/typescript/src/index.d.ts +1 -0
  79. package/lib/typescript/src/index.d.ts.map +1 -1
  80. package/package.json +1 -1
  81. package/src/Accordion/Accordion.tsx +15 -3
  82. package/src/Accordion/AccordionItem.tsx +5 -1
  83. package/src/Accordion/README.md +14 -11
  84. package/src/Accordion/type.tsx +1 -0
  85. package/src/BadgeIcon/BadgeIcon.tsx +126 -0
  86. package/src/BadgeIcon/README.md +77 -0
  87. package/src/BadgeIcon/type.tsx +21 -0
  88. package/src/BottomSheet/BottomSheet.tsx +3 -1
  89. package/src/CheckBox/CheckBox.tsx +45 -29
  90. package/src/CheckBox/CheckBoxList.tsx +12 -0
  91. package/src/CheckBox/README_CHECKBOX.md +10 -7
  92. package/src/CheckBox/README_CHECKBOXLIST.md +13 -7
  93. package/src/CheckBox/type.ts +9 -0
  94. package/src/Icon/Icon.tsx +6 -0
  95. package/src/Icon/README.md +3 -0
  96. package/src/Icon/icons/CopyFill.tsx +23 -0
  97. package/src/Icon/icons/CopyTextFill.tsx +29 -0
  98. package/src/Icon/icons/RadioButton.tsx +1 -1
  99. package/src/Icon/icons/ShieldFillChecked.tsx +23 -0
  100. package/src/Icon/type.tsx +3 -0
  101. package/src/Input/Input.tsx +17 -25
  102. package/src/Input/README_INPUT.md +17 -15
  103. package/src/Input/type.tsx +1 -0
  104. package/src/Tab/README.md +1 -0
  105. package/src/Tab/Tab.tsx +68 -44
  106. package/src/Tab/TabItem.tsx +1 -1
  107. package/src/Tab/type.tsx +2 -1
  108. package/src/Timeline/README.md +5 -5
  109. package/src/Timeline/TimelineItem.tsx +3 -0
  110. 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> = ({ children, current = 0, onChangeTab }) => {
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
- {/* Header */}
48
- <View style={styles.headerContainer}>
49
- {items.map((item, index) => {
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
- {items.map((item, index) => {
79
- return (
80
- <View key={index} collapsable={false} style={{ flex: 1 }}>
81
- {item.props.children}
82
- </View>
83
- );
84
- })}
85
- </PagerView>
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
- headerContainer: {
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, backgroundColor: Color.base.white100 },
134
+ pager: { flex: 1, minHeight: 800 },
111
135
  });
@@ -1,5 +1,5 @@
1
1
  import type { TabItemProps } from './type';
2
2
  import React from 'react';
3
3
 
4
- const TabItem: React.FC<TabItemProps> = (_props: TabItemProps) => null;
4
+ const TabItem: React.FC<TabItemProps> = (_props) => null;
5
5
  export default TabItem;
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.ReactNode;
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
  }
@@ -44,11 +44,11 @@ export default function OrderHistory() {
44
44
 
45
45
  ### TimelineItem
46
46
 
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'` | ❌ | `'primary'` | Skema warna titik (`RadioButton`) dan garis vertikal. |
51
- | `isLast` | `boolean` | ❌ | `false` | Menentukan apakah garis garis di kiri itu dimunculkan atau tidak |
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
 
@@ -9,6 +9,9 @@ const COLOR_MAP = {
9
9
  success: Color.success[500],
10
10
  purple: Color.purple[500],
11
11
  danger: Color.danger[500],
12
+ info: Color.info[500],
13
+ default: Color.gray[700],
14
+ orange: Color.orange[500],
12
15
  };
13
16
  type ColorKey = keyof typeof COLOR_MAP;
14
17
 
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';