@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# BadgeIcon Component
|
|
2
|
+
|
|
3
|
+
`BadgeIcon` adalah komponen React Native untuk menampilkan **badge** yang dapat berisi **ikon** atau **konten custom** (children). Komponen ini fleksibel dalam ukuran (`size`), warna (`color`), dan varian (`variant`).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ⚙️ Props
|
|
8
|
+
|
|
9
|
+
### **BaseBadgeProps**
|
|
10
|
+
|
|
11
|
+
| Prop | Tipe | Default | Deskripsi |
|
|
12
|
+
| --------- | ------------------------------------ | ----------- | ------------------------------------------------------------------------- |
|
|
13
|
+
| `color` | `Variant` \| `HexColor` | `"default"` | Warna badge. Bisa berupa nama varian yang tersedia atau kode warna HEX. |
|
|
14
|
+
| `size` | `"small"` \| `"medium"` \| `"large"` | `"medium"` | Ukuran badge. Mengatur tinggi, lebar minimum, padding, dan radius border. |
|
|
15
|
+
| `variant` | `Variant` | - | Alias untuk varian warna (tidak digunakan langsung di komponen ini). |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### **IconBadgeProps** (Badge dengan Icon)
|
|
20
|
+
|
|
21
|
+
| Prop | Tipe | Deskripsi |
|
|
22
|
+
| ---------- | --------------- | ----------------------------------------------- |
|
|
23
|
+
| `icon` | `IconNameProps` | Nama ikon yang akan ditampilkan. |
|
|
24
|
+
| `children` | `never` | Tidak boleh ada children jika menggunakan ikon. |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
### **ChildrenBadgeProps** (Badge dengan Konten Custom)
|
|
29
|
+
|
|
30
|
+
| Prop | Tipe | Deskripsi |
|
|
31
|
+
| ---------- | ----------------- | ----------------------------------------------- |
|
|
32
|
+
| `children` | `React.ReactNode` | Konten yang akan ditampilkan di dalam badge. |
|
|
33
|
+
| `icon` | `never` | Tidak boleh ada icon jika menggunakan children. |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 🎨 Varian Warna (`Variant`)
|
|
38
|
+
|
|
39
|
+
| Nama Varian | Background | Font Color |
|
|
40
|
+
| ----------- | ------------------- | --------------------- |
|
|
41
|
+
| `default` | `Color.gray[100]` | `Color.gray[800]` |
|
|
42
|
+
| `primary` | `Color.primary[50]` | `Color.primary[1000]` |
|
|
43
|
+
| `success` | `Color.success[50]` | `Color.success[500]` |
|
|
44
|
+
| `info` | `Color.info[50]` | `Color.info[500]` |
|
|
45
|
+
| `danger` | `Color.danger[50]` | `Color.danger[600]` |
|
|
46
|
+
| `warning` | `Color.warning[50]` | `Color.warning[300]` |
|
|
47
|
+
| `orange` | `Color.orange[50]` | `Color.orange[500]` |
|
|
48
|
+
| `purple` | `Color.purple[50]` | `Color.purple[500]` |
|
|
49
|
+
|
|
50
|
+
> Jika `color` berupa kode HEX, maka background badge akan otomatis diubah menjadi warna transparan (`opacity 0.1`) menggunakan helper `hexToRGBA`.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 📏 Ukuran Badge (`size`)
|
|
55
|
+
|
|
56
|
+
| Ukuran | minHeight | minWidth | Padding | BorderRadius | Icon Size |
|
|
57
|
+
| -------- | --------- | -------- | ------- | ------------ | --------- |
|
|
58
|
+
| `small` | 24 | 24 | 4 | 4 | 16 |
|
|
59
|
+
| `medium` | 32 | 32 | 4 | 4 | 24 |
|
|
60
|
+
| `large` | 40 | 40 | 8 | 4 | 24 |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 💻 Contoh Penggunaan
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<BadgeIcon icon="check" size="small" color="success" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🛠 Catatan Implementasi
|
|
73
|
+
|
|
74
|
+
- Jika `color` adalah varian (`default`, `primary`, dsb.), warna background dan font color akan diambil dari konstanta `COLORS`.
|
|
75
|
+
- Jika `color` adalah kode HEX (`#rrggbb`), maka background akan menggunakan versi transparan dari warna tersebut.
|
|
76
|
+
- Menggunakan helper `hexToRGBA` untuk mengubah HEX menjadi warna RGBA.
|
|
77
|
+
- Komponen `Icon` digunakan untuk menampilkan ikon sesuai ukuran badge.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type Variant =
|
|
2
|
+
| 'default'
|
|
3
|
+
| 'primary'
|
|
4
|
+
| 'info'
|
|
5
|
+
| 'success'
|
|
6
|
+
| 'warning'
|
|
7
|
+
| 'danger'
|
|
8
|
+
| 'orange'
|
|
9
|
+
| 'purple';
|
|
10
|
+
|
|
11
|
+
type Size = 'small' | 'medium' | 'large';
|
|
12
|
+
type HexColor = `#${string}`;
|
|
13
|
+
|
|
14
|
+
export type { HexColor, Size, Variant };
|
|
15
|
+
|
|
16
|
+
export interface IconSizeStyle {
|
|
17
|
+
minHeight: number;
|
|
18
|
+
minWidth: number;
|
|
19
|
+
padding: number;
|
|
20
|
+
borderRadius: number;
|
|
21
|
+
}
|
|
@@ -22,7 +22,9 @@ import type { BottomSheetHeighProps, BottomSheetProops } from './type';
|
|
|
22
22
|
const statusBarHeight =
|
|
23
23
|
Platform.OS === 'android' && Platform.Version < 35
|
|
24
24
|
? (StatusBar.currentHeight ?? 24)
|
|
25
|
-
:
|
|
25
|
+
: Platform.OS === 'android' && Platform.Version >= 35
|
|
26
|
+
? 80
|
|
27
|
+
: 65;
|
|
26
28
|
const screenHeight = Dimensions.get('window').height;
|
|
27
29
|
const actualScreenHeight = screenHeight - statusBarHeight;
|
|
28
30
|
const DEFAULT_PADDING_BOTTOM = 40;
|
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Color, Icon, Typography } from '@herca/rn-kit';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
4
|
+
import type { Variant } from './type';
|
|
4
5
|
// import type { ColorVariantType } from '../Color/type';
|
|
5
6
|
|
|
6
7
|
interface CheckBoxProps {
|
|
7
8
|
checked?: boolean;
|
|
8
9
|
onChange?: (checked: boolean) => void;
|
|
9
10
|
label?: string | React.ReactNode;
|
|
11
|
+
hint?: string;
|
|
10
12
|
disabled?: boolean;
|
|
11
13
|
renderLabel?: () => React.ReactNode;
|
|
12
|
-
|
|
14
|
+
renderHint?: () => React.ReactNode;
|
|
15
|
+
color?: Variant;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// },
|
|
30
|
-
// }
|
|
18
|
+
const COLORS: Record<Variant, { background: string; borderColor: string }> = {
|
|
19
|
+
default: { background: Color.gray[100], borderColor: Color.gray[500] },
|
|
20
|
+
primary: {
|
|
21
|
+
background: Color.primary[1000],
|
|
22
|
+
borderColor: Color.primary[1000],
|
|
23
|
+
},
|
|
24
|
+
success: { background: Color.success[500], borderColor: Color.success[500] },
|
|
25
|
+
info: { background: Color.info[500], borderColor: Color.info[500] },
|
|
26
|
+
danger: { background: Color.danger[500], borderColor: Color.danger[500] },
|
|
27
|
+
warning: { background: Color.warning[500], borderColor: Color.warning[500] },
|
|
28
|
+
orange: { background: Color.orange[500], borderColor: Color.orange[500] },
|
|
29
|
+
purple: { background: Color.purple[500], borderColor: Color.purple[500] },
|
|
30
|
+
};
|
|
31
|
+
|
|
31
32
|
const CheckBox: React.FC<CheckBoxProps> = ({
|
|
32
33
|
checked = false,
|
|
33
34
|
onChange,
|
|
34
35
|
label,
|
|
36
|
+
hint,
|
|
35
37
|
disabled = false,
|
|
36
38
|
renderLabel,
|
|
37
|
-
|
|
39
|
+
renderHint,
|
|
40
|
+
color = 'primary',
|
|
38
41
|
}) => {
|
|
39
42
|
const [value, setValue] = useState<boolean>(false);
|
|
40
|
-
|
|
43
|
+
const { background, borderColor } = COLORS[color];
|
|
41
44
|
|
|
42
45
|
const handlePress = () => {
|
|
43
46
|
const newValue = !value;
|
|
@@ -57,14 +60,31 @@ const CheckBox: React.FC<CheckBoxProps> = ({
|
|
|
57
60
|
<View
|
|
58
61
|
style={[
|
|
59
62
|
styles.checkBox,
|
|
60
|
-
value &&
|
|
63
|
+
value && {
|
|
64
|
+
backgroundColor: background,
|
|
65
|
+
borderColor,
|
|
66
|
+
},
|
|
61
67
|
disabled && styles.disabled,
|
|
62
68
|
]}
|
|
63
69
|
>
|
|
64
70
|
{value && <Icon name="Check" size={14} color={Color.base.white100} />}
|
|
65
71
|
</View>
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
<View>
|
|
73
|
+
{label && (
|
|
74
|
+
<Typography variant="t2" weight="medium" color={Color.gray[900]}>
|
|
75
|
+
{label}
|
|
76
|
+
</Typography>
|
|
77
|
+
)}
|
|
78
|
+
{hint && (
|
|
79
|
+
<Typography variant="t3" weight="medium" color={Color.gray[600]}>
|
|
80
|
+
{hint}
|
|
81
|
+
</Typography>
|
|
82
|
+
)}
|
|
83
|
+
</View>
|
|
84
|
+
<View>
|
|
85
|
+
{renderLabel?.()}
|
|
86
|
+
{renderHint?.()}
|
|
87
|
+
</View>
|
|
68
88
|
</Pressable>
|
|
69
89
|
);
|
|
70
90
|
};
|
|
@@ -91,10 +111,6 @@ const styles = StyleSheet.create({
|
|
|
91
111
|
disabled: {
|
|
92
112
|
opacity: 0.5,
|
|
93
113
|
},
|
|
94
|
-
label: {
|
|
95
|
-
fontSize: 14,
|
|
96
|
-
color: '#333',
|
|
97
|
-
},
|
|
98
114
|
});
|
|
99
115
|
|
|
100
116
|
export default CheckBox;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { Typography, Color, CheckBox } from '@herca/rn-kit';
|
|
4
|
+
import type { Variant } from './type';
|
|
4
5
|
|
|
5
6
|
interface CheckBoxListItem {
|
|
6
7
|
label: string;
|
|
7
8
|
value: string;
|
|
9
|
+
hint?: string;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
interface CheckBoxListProps {
|
|
@@ -12,6 +14,7 @@ interface CheckBoxListProps {
|
|
|
12
14
|
selectedValues: string[];
|
|
13
15
|
onChange: (selected: string[]) => void;
|
|
14
16
|
direction?: 'vertical' | 'horizontal';
|
|
17
|
+
color?: Variant;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
const CheckBoxList: React.FC<CheckBoxListProps> = ({
|
|
@@ -19,6 +22,7 @@ const CheckBoxList: React.FC<CheckBoxListProps> = ({
|
|
|
19
22
|
selectedValues,
|
|
20
23
|
onChange,
|
|
21
24
|
direction = 'vertical',
|
|
25
|
+
color = 'primary',
|
|
22
26
|
}) => {
|
|
23
27
|
const toggleValue = (value: string) => {
|
|
24
28
|
const newSelected = selectedValues.includes(value)
|
|
@@ -39,12 +43,20 @@ const CheckBoxList: React.FC<CheckBoxListProps> = ({
|
|
|
39
43
|
<CheckBox
|
|
40
44
|
key={item.value}
|
|
41
45
|
checked={selectedValues.includes(item.value)}
|
|
46
|
+
color={color}
|
|
42
47
|
onChange={() => toggleValue(item.value)}
|
|
43
48
|
renderLabel={() => (
|
|
44
49
|
<Typography variant="t2" weight="medium" color={Color.gray[800]}>
|
|
45
50
|
{item.label}
|
|
46
51
|
</Typography>
|
|
47
52
|
)}
|
|
53
|
+
renderHint={() =>
|
|
54
|
+
item.hint ? (
|
|
55
|
+
<Typography variant="t3" weight="medium" color={Color.gray[700]}>
|
|
56
|
+
{item.hint}
|
|
57
|
+
</Typography>
|
|
58
|
+
) : undefined
|
|
59
|
+
}
|
|
48
60
|
/>
|
|
49
61
|
))}
|
|
50
62
|
</View>
|
|
@@ -37,10 +37,13 @@ export default function App() {
|
|
|
37
37
|
|
|
38
38
|
##⚙️ Props
|
|
39
39
|
|
|
40
|
-
| Prop | Tipe
|
|
41
|
-
| ------------- |
|
|
42
|
-
| `checked` | `boolean`
|
|
43
|
-
| `onChange` | `(checked: boolean) => void`
|
|
44
|
-
| `label` |
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
40
|
+
| Prop | Tipe | Deskripsi |
|
|
41
|
+
| ------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
42
|
+
| `checked` | `boolean` | Status awal checkbox (centang atau tidak). Default: `false`. |
|
|
43
|
+
| `onChange` | `(checked: boolean) => void` | Fungsi callback saat status checkbox berubah. |
|
|
44
|
+
| `label` | `string ` | Label teks atau komponen yang ditampilkan di samping checkbox. |
|
|
45
|
+
| `hint` | `string ` | Label teks atau komponen yang ditampilkan di samping checkbox dibawah label. |
|
|
46
|
+
| `color` | `primary \| danger \| warning \| orange \| info \| success \| purple ` | warna background jika checkbox di centang |
|
|
47
|
+
| `disabled` | `boolean` | Jika `true`, checkbox tidak bisa ditekan. Default: `false`. |
|
|
48
|
+
| `renderLabel` | `() => React.ReactNode` | Alternatif render untuk label kustom selain `label`. |
|
|
49
|
+
| `renderHint` | `() => React.ReactNode` | Alternatif render untuk hint kustom selain `hint`. |
|
|
@@ -14,6 +14,12 @@ import CheckBoxList from './CheckBoxList';
|
|
|
14
14
|
export default function App() {
|
|
15
15
|
const [selected, setSelected] = useState<string[]>([]);
|
|
16
16
|
|
|
17
|
+
interface CheckBoxListItem {
|
|
18
|
+
label: string;
|
|
19
|
+
value: string;
|
|
20
|
+
hint?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
return (
|
|
18
24
|
<View>
|
|
19
25
|
<CheckBoxList
|
|
@@ -33,10 +39,10 @@ export default function App() {
|
|
|
33
39
|
|
|
34
40
|
## ⚙️ Props
|
|
35
41
|
|
|
36
|
-
| Prop | Tipe
|
|
37
|
-
| ---------------- |
|
|
38
|
-
| `items` | `CheckBoxListItem[]`
|
|
39
|
-
| `selectedValues` | `string[]`
|
|
40
|
-
| `onChange` | `(selected: string[]) => void`
|
|
41
|
-
| `direction` | \`'vertical'
|
|
42
|
-
|
|
42
|
+
| Prop | Tipe | Deskripsi | |
|
|
43
|
+
| ---------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------- |
|
|
44
|
+
| `items` | `CheckBoxListItem[]` | Daftar item yang akan ditampilkan. Setiap item memiliki `label` dan `value`. | |
|
|
45
|
+
| `selectedValues` | `string[]` | Nilai-nilai yang saat ini sedang dipilih. | |
|
|
46
|
+
| `onChange` | `(selected: string[]) => void` | Callback saat nilai pilihan berubah. | |
|
|
47
|
+
| `direction` | \`'vertical' | 'horizontal'\` (opsional) | Arah tampilan checkbox (default: `'vertical'`). |
|
|
48
|
+
| `color` | `primary \| danger \| warning \| orange \| info \| success \| purple ` | warna background jika checkbox di centang | Arah tampilan checkbox (default: `'vertical'`). |
|
package/src/Icon/Icon.tsx
CHANGED
|
@@ -63,6 +63,9 @@ import SettingsSlider from './icons/SettingsSlider';
|
|
|
63
63
|
import RotateSquareFill from './icons/RotateSquareFill';
|
|
64
64
|
import LocationPinFill from './icons/LocationPinFill';
|
|
65
65
|
import DiscountFill from './icons/DiscountFill';
|
|
66
|
+
import CopyFill from './icons/CopyFill';
|
|
67
|
+
import CopyTextFill from './icons/CopyTextFill';
|
|
68
|
+
import ShieldCheckedFill from './icons/ShieldFillChecked';
|
|
66
69
|
|
|
67
70
|
const icons: Record<
|
|
68
71
|
IconNameProps,
|
|
@@ -130,6 +133,9 @@ const icons: Record<
|
|
|
130
133
|
'rotate-square-fill': RotateSquareFill,
|
|
131
134
|
'location-pin-fill': LocationPinFill,
|
|
132
135
|
'discount-fill': DiscountFill,
|
|
136
|
+
'copy-fill': CopyFill,
|
|
137
|
+
'copy-text-fill': CopyTextFill,
|
|
138
|
+
'shield-checked-fill': ShieldCheckedFill,
|
|
133
139
|
};
|
|
134
140
|
|
|
135
141
|
const Icon: React.FC<IconProps> = ({
|
package/src/Icon/README.md
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: object;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const CopyFill: React.FC<Props> = ({ size = 24, color = '#000', style }) => (
|
|
11
|
+
<Svg width={size} height={size} viewBox="0 0 16 16" fill="none" style={style}>
|
|
12
|
+
<Path
|
|
13
|
+
d="M9.03333 13.3364C8.86 13.4098 8.67333 13.4764 8.47333 13.5431L7.42 13.8898C4.77333 14.7431 3.38 14.0298 2.52 11.3831L1.66667 8.74977C0.813332 6.1031 1.52 4.7031 4.16667 3.84977L5.19333 3.50977C5.06667 3.82977 4.96 4.19643 4.86 4.60977L4.20667 7.4031C3.47333 10.5431 4.54667 12.2764 7.68667 13.0231L8.80667 13.2898C8.88 13.3098 8.96 13.3231 9.03333 13.3364Z"
|
|
14
|
+
fill={color}
|
|
15
|
+
/>
|
|
16
|
+
<Path
|
|
17
|
+
d="M11.4467 2.03682L10.3333 1.77682C8.10666 1.25015 6.78 1.68348 6 3.29682C5.8 3.70348 5.64 4.19682 5.50667 4.76348L4.85333 7.55682C4.2 10.3435 5.06 11.7168 7.84 12.3768L8.96 12.6435C9.34666 12.7368 9.70667 12.7968 10.04 12.8235C12.12 13.0235 13.2267 12.0501 13.7867 9.64348L14.44 6.85682C15.0933 4.07015 14.24 2.69015 11.4467 2.03682Z"
|
|
18
|
+
fill={color}
|
|
19
|
+
/>
|
|
20
|
+
</Svg>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default CopyFill;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: object;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const CopyTextFill: React.FC<Props> = ({
|
|
11
|
+
size = 24,
|
|
12
|
+
color = '#000',
|
|
13
|
+
style,
|
|
14
|
+
}) => (
|
|
15
|
+
<Svg
|
|
16
|
+
width={size}
|
|
17
|
+
height={size + 1}
|
|
18
|
+
viewBox="0 0 24 25"
|
|
19
|
+
style={style}
|
|
20
|
+
fill="none"
|
|
21
|
+
>
|
|
22
|
+
<Path
|
|
23
|
+
d="M15.2601 21.1611C14.9161 21.3251 14.5141 21.4471 14.0591 21.5291L7.48907 22.6792C5.29907 23.0692 4.00896 22.1692 3.62896 19.9792L2.08917 11.2292C1.69917 9.03916 2.59912 7.74916 4.78912 7.35916L6.58697 7.04312C6.79197 7.00712 6.97114 7.18615 6.93414 7.39115L5.75811 14.0492C5.22811 17.0792 6.65803 19.1191 9.67803 19.6491C9.67803 19.6491 14.8971 20.5661 15.1661 20.6181C15.4981 20.6781 15.5511 21.0321 15.2601 21.1611ZM21.9131 7.87516L20.3689 16.6291C19.997 18.7371 18.7811 19.6381 16.7361 19.3581C16.6581 19.3471 16.5881 19.3472 16.5071 19.3332L9.94195 18.1751C7.75295 17.7891 6.85209 16.5021 7.23809 14.3131L8.58111 6.69712L8.78204 5.55912C9.16804 3.37012 10.4551 2.46914 12.6441 2.85514L19.21 4.01316C21.398 4.39916 22.2991 5.68716 21.9131 7.87516ZM15.554 14.6651C15.626 14.2571 15.3541 13.8681 14.9461 13.7961L10.8421 13.0721C10.4361 12.9991 10.0452 13.2731 9.97418 13.6801C9.90218 14.0881 10.1741 14.4772 10.5821 14.5492L14.6861 15.2732C14.7301 15.2812 14.7739 15.2842 14.8169 15.2842C15.1739 15.2852 15.49 15.0291 15.554 14.6651ZM18.597 11.8041C18.669 11.3961 18.3971 11.0072 17.9891 10.9352L11.4241 9.77713C11.0201 9.70613 10.627 9.97817 10.556 10.3852C10.484 10.7932 10.7561 11.1821 11.1641 11.2541L17.7291 12.4121C17.7731 12.4201 17.8172 12.4231 17.8602 12.4231C18.2172 12.4231 18.533 12.1671 18.597 11.8041ZM19.2972 8.54215C19.3692 8.13415 19.097 7.74513 18.689 7.67313L12.1241 6.51511C11.7201 6.44311 11.3272 6.71614 11.2562 7.12314C11.1842 7.53114 11.4561 7.92016 11.8641 7.99216L18.429 9.15012C18.473 9.15812 18.5171 9.16117 18.5601 9.16117C18.9171 9.16217 19.2332 8.90615 19.2972 8.54215Z"
|
|
24
|
+
fill={color}
|
|
25
|
+
/>
|
|
26
|
+
</Svg>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export default CopyTextFill;
|
|
@@ -14,7 +14,7 @@ const RadioButton: React.FC<Props> = ({ size = 24, color = '#000', style }) => (
|
|
|
14
14
|
d="M18 3.37V9.84998C18 10.07 17.9799 10.29 17.9299 10.5H13.8799C12.0099 10.5 10.5 12.01 10.5 13.88V17.9301C10.29 17.9801 10.0701 18 9.8501 18H3.37988C1.11988 18 0 16.87 0 14.62V3.37C0 1.12 1.11988 0 3.37988 0H14.6201C16.8801 0 18 1.12 18 3.37ZM12 13.88V17.22C12.09 17.16 12.16 17.09 12.24 17.01L17.01 12.24C17.09 12.16 17.16 12.09 17.22 12H13.8799C12.8399 12 12 12.84 12 13.88Z"
|
|
15
15
|
fill={Color.base.white100}
|
|
16
16
|
/>
|
|
17
|
-
<Circle cx="10" cy="10" r="9.5"
|
|
17
|
+
<Circle cx="10" cy="10" r="9.5" stroke={color} />
|
|
18
18
|
<Circle cx="10" cy="10" r="4" fill={color} />
|
|
19
19
|
</Svg>
|
|
20
20
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
size?: number;
|
|
6
|
+
color?: string;
|
|
7
|
+
style?: object;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ShieldCheckedFill: React.FC<Props> = ({
|
|
11
|
+
size = 24,
|
|
12
|
+
color = '#000',
|
|
13
|
+
style,
|
|
14
|
+
}) => (
|
|
15
|
+
<Svg width={size} height={size} viewBox="0 0 20 20" fill="none" style={style}>
|
|
16
|
+
<Path
|
|
17
|
+
d="M10.0151 1.66602C8.14839 2.59185 6.66667 3.33268 2.5 4.16602C2.5 5.11352 2.5 8.08428 2.5 9.07344C2.5 14.6293 7.2225 17.4068 10 18.3327C12.7775 17.4068 17.5 14.6293 17.5 9.07344C17.5 8.05261 17.5 5.16102 17.5 4.16602C13.3333 3.33268 11.8517 2.59185 10.0151 1.66602ZM12.9517 8.77437L9.61833 12.1077C9.49666 12.2294 9.33664 12.291 9.17664 12.291C9.01663 12.291 8.85661 12.2302 8.73494 12.1077L7.06828 10.441C6.82411 10.1969 6.82411 9.80101 7.06828 9.55684C7.31244 9.31268 7.70831 9.31268 7.95247 9.55684L9.17745 10.7818L12.0691 7.89018C12.3133 7.64601 12.7091 7.64601 12.9533 7.89018C13.1975 8.13434 13.1958 8.53021 12.9517 8.77437Z"
|
|
18
|
+
fill={color}
|
|
19
|
+
/>
|
|
20
|
+
</Svg>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export default ShieldCheckedFill;
|
package/src/Icon/type.tsx
CHANGED
package/src/Input/Input.tsx
CHANGED
|
@@ -20,6 +20,7 @@ const Input: React.FC<InputProps> = ({
|
|
|
20
20
|
onPressIconRight,
|
|
21
21
|
secureTextEntry = false,
|
|
22
22
|
iconRightColor,
|
|
23
|
+
prefix,
|
|
23
24
|
...rest
|
|
24
25
|
}) => {
|
|
25
26
|
const [inputValue, setInputValue] = useState(value || '');
|
|
@@ -49,26 +50,16 @@ const Input: React.FC<InputProps> = ({
|
|
|
49
50
|
]}
|
|
50
51
|
>
|
|
51
52
|
{icon && (
|
|
52
|
-
<TouchableOpacity
|
|
53
|
-
onPress={onPressIconLeft}
|
|
54
|
-
style={styles.iconLeft}
|
|
55
|
-
hitSlop={10}
|
|
56
|
-
>
|
|
53
|
+
<TouchableOpacity onPress={onPressIconLeft} hitSlop={10}>
|
|
57
54
|
<Icon name={icon} size={20} color="#888" />
|
|
58
55
|
</TouchableOpacity>
|
|
59
56
|
)}
|
|
60
57
|
|
|
58
|
+
{prefix && <View style={styles.prefixContainer}>{prefix}</View>}
|
|
59
|
+
|
|
61
60
|
<TextInput
|
|
62
61
|
{...rest}
|
|
63
|
-
style={[
|
|
64
|
-
styles.input,
|
|
65
|
-
icon && { paddingLeft: 40 },
|
|
66
|
-
showRightIcons && { paddingRight: 40 },
|
|
67
|
-
showRightIcons &&
|
|
68
|
-
clearButton &&
|
|
69
|
-
inputValue !== '' && { paddingRight: 65 },
|
|
70
|
-
style,
|
|
71
|
-
]}
|
|
62
|
+
style={[styles.input, style]}
|
|
72
63
|
secureTextEntry={secureTextEntry}
|
|
73
64
|
value={inputValue}
|
|
74
65
|
onChangeText={handleChange}
|
|
@@ -80,7 +71,7 @@ const Input: React.FC<InputProps> = ({
|
|
|
80
71
|
{clearButton && inputValue !== '' && (
|
|
81
72
|
<TouchableOpacity
|
|
82
73
|
onPress={handleClear}
|
|
83
|
-
style={
|
|
74
|
+
style={iconRight && styles.mr8}
|
|
84
75
|
>
|
|
85
76
|
<Icon name="x-circle" size={20} color="#aaa" />
|
|
86
77
|
</TouchableOpacity>
|
|
@@ -118,31 +109,32 @@ const styles = StyleSheet.create({
|
|
|
118
109
|
position: 'relative',
|
|
119
110
|
height: 40,
|
|
120
111
|
borderRadius: 8,
|
|
121
|
-
gap:
|
|
112
|
+
gap: 4,
|
|
113
|
+
paddingHorizontal: 12,
|
|
122
114
|
borderWidth: 1,
|
|
123
115
|
backgroundColor: Color.base.white100,
|
|
124
116
|
justifyContent: 'center',
|
|
117
|
+
flexDirection: 'row',
|
|
118
|
+
alignItems: 'center',
|
|
125
119
|
},
|
|
126
120
|
input: {
|
|
127
121
|
height: 37,
|
|
128
|
-
paddingHorizontal: 12,
|
|
129
122
|
paddingTop: 0,
|
|
130
123
|
paddingBottom: 0,
|
|
131
124
|
fontSize: 16,
|
|
132
125
|
color: '#333',
|
|
133
126
|
flex: 1,
|
|
134
127
|
},
|
|
135
|
-
iconLeft: {
|
|
136
|
-
position: 'absolute',
|
|
137
|
-
left: 12,
|
|
138
|
-
zIndex: 1,
|
|
139
|
-
},
|
|
140
128
|
rightContainer: {
|
|
141
|
-
position: 'absolute',
|
|
142
|
-
right: 12,
|
|
143
129
|
flexDirection: 'row',
|
|
144
130
|
alignItems: 'center',
|
|
145
|
-
|
|
131
|
+
},
|
|
132
|
+
prefixContainer: {
|
|
133
|
+
justifyContent: 'center',
|
|
134
|
+
flexDirection: 'row',
|
|
135
|
+
},
|
|
136
|
+
mr8: {
|
|
137
|
+
marginRight: 8,
|
|
146
138
|
},
|
|
147
139
|
});
|
|
148
140
|
|
|
@@ -6,21 +6,22 @@ Komponen `Input` ini adalah komponen input teks yang dapat dikustomisasi dengan
|
|
|
6
6
|
|
|
7
7
|
## 🔧 Props
|
|
8
8
|
|
|
9
|
-
| Prop
|
|
10
|
-
|
|
11
|
-
| `label`
|
|
12
|
-
| `value`
|
|
13
|
-
| `onChange`
|
|
14
|
-
| `icon`
|
|
15
|
-
| `iconRight`
|
|
16
|
-
| `clearButton`
|
|
17
|
-
| `hasError`
|
|
18
|
-
| `hint`
|
|
19
|
-
| `onPressIconLeft`
|
|
20
|
-
| `onPressIconRight` | `() => void`
|
|
21
|
-
| `secureTextEntry
|
|
22
|
-
| `style`
|
|
23
|
-
|
|
|
9
|
+
| Prop | Tipe | Deskripsi |
|
|
10
|
+
| ------------------ | ------------------------- | --------------------------------------------------------------------- |
|
|
11
|
+
| `label` | `string` | Label yang ditampilkan di atas input |
|
|
12
|
+
| `value` | `string` | Nilai dari input (kontrol dari luar) |
|
|
13
|
+
| `onChange` | `(value: string) => void` | Fungsi yang dipanggil saat nilai berubah |
|
|
14
|
+
| `icon` | `string` | Nama ikon (kiri) dari library `Icon` |
|
|
15
|
+
| `iconRight` | `string` | Nama ikon kanan dari library `Icon` |
|
|
16
|
+
| `clearButton` | `boolean` | Menampilkan tombol `x` untuk menghapus input |
|
|
17
|
+
| `hasError` | `boolean` | Menandai input error, border akan berubah merah |
|
|
18
|
+
| `hint` | `string` | Menampilkan teks kecil di bawah input, bisa untuk error atau petunjuk |
|
|
19
|
+
| `onPressIconLeft` | `() => void` | Fungsi saat ikon kiri diklik |
|
|
20
|
+
| `onPressIconRight` | `() => void` | Fungsi saat ikon kanan diklik |
|
|
21
|
+
| `secureTextEntry` | `boolean` | Jika `true`, menyembunyikan input (untuk password) |
|
|
22
|
+
| `style` | `ViewStyle` | Style tambahan untuk input |
|
|
23
|
+
| `prefix` | `React.ReactNode` | Slot `react node` yang bisa diisi oleh seluruh komponen react |
|
|
24
|
+
| `...rest` | `TextInputProps` | Props lain dari React Native `TextInput` |
|
|
24
25
|
|
|
25
26
|
---
|
|
26
27
|
|
|
@@ -49,3 +50,4 @@ export default function MyForm() {
|
|
|
49
50
|
</View>
|
|
50
51
|
);
|
|
51
52
|
}
|
|
53
|
+
```
|
package/src/Input/type.tsx
CHANGED
package/src/Tab/README.md
CHANGED
|
@@ -94,6 +94,7 @@ Setiap tab dibungkus dalam `ScrollView` vertikal, sehingga bisa discroll ke bawa
|
|
|
94
94
|
| `children` | `React.ReactNode` | Daftar elemen `<TabItem />` |
|
|
95
95
|
| `current?` | `number` | Indeks tab aktif (default: 0) |
|
|
96
96
|
| `onChangeTab?` | `(index: number) => void` | Callback saat tab berpindah |
|
|
97
|
+
| `renderHeader` | `React.ReactElement` | tambahan react element di atas tab |
|
|
97
98
|
|
|
98
99
|
### `TabItemProps`
|
|
99
100
|
|