@herca/rn-kit 0.1.116 → 0.1.118
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/Calendar/Calendar.js +4 -1
- package/lib/module/Calendar/Calendar.js.map +1 -1
- package/lib/module/Calendar/README.md +1 -1
- package/lib/module/CounterButton/CounterButton.js +1 -3
- package/lib/module/CounterButton/CounterButton.js.map +1 -1
- package/lib/module/DatePicker/MonthPicker.js +2 -1
- package/lib/module/DatePicker/MonthPicker.js.map +1 -1
- package/lib/module/DatePicker/README_DATEPICKER.md +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 +10 -7
- package/lib/module/Icon/icons/ClockLeftCircle.js +27 -0
- package/lib/module/Icon/icons/ClockLeftCircle.js.map +1 -0
- package/lib/module/Icon/icons/ClockPlusAlt.js +27 -0
- package/lib/module/Icon/icons/ClockPlusAlt.js.map +1 -0
- package/lib/module/Icon/icons/ExchangeHorizontal.js +22 -0
- package/lib/module/Icon/icons/ExchangeHorizontal.js.map +1 -0
- package/lib/module/Input/InputMonth.js +26 -21
- package/lib/module/Input/InputMonth.js.map +1 -1
- package/lib/module/Input/InputYear.js +23 -18
- package/lib/module/Input/InputYear.js.map +1 -1
- package/lib/module/Input/README_INPUT_MONTH.md +2 -2
- package/lib/module/Input/README_INPUT_YEAR.md +2 -2
- package/lib/module/hooks/useOptionalFocusEffect.js +0 -2
- package/lib/module/hooks/useOptionalFocusEffect.js.map +1 -1
- package/lib/typescript/src/Calendar/Calendar.d.ts +1 -1
- package/lib/typescript/src/Calendar/Calendar.d.ts.map +1 -1
- package/lib/typescript/src/Calendar/CalendarPropsType.d.ts +7 -0
- package/lib/typescript/src/Calendar/CalendarPropsType.d.ts.map +1 -1
- package/lib/typescript/src/CounterButton/CounterButton.d.ts.map +1 -1
- package/lib/typescript/src/DatePicker/MonthPicker.d.ts +2 -1
- package/lib/typescript/src/DatePicker/MonthPicker.d.ts.map +1 -1
- package/lib/typescript/src/Icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/Icon/icons/ClockLeftCircle.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ClockLeftCircle.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ClockPlusAlt.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ClockPlusAlt.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ExchangeHorizontal.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ExchangeHorizontal.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/InputMonth.d.ts +1 -1
- package/lib/typescript/src/Input/InputMonth.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputYear.d.ts +1 -1
- package/lib/typescript/src/Input/InputYear.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOptionalFocusEffect.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/Calendar/Calendar.tsx +13 -1
- package/src/Calendar/CalendarPropsType.tsx +7 -0
- package/src/Calendar/README.md +1 -1
- package/src/CounterButton/CounterButton.tsx +1 -2
- package/src/DatePicker/MonthPicker.tsx +3 -1
- package/src/DatePicker/README_DATEPICKER.md +1 -0
- package/src/Icon/Icon.tsx +6 -0
- package/src/Icon/README.md +10 -7
- package/src/Icon/icons/ClockLeftCircle.tsx +29 -0
- package/src/Icon/icons/ClockPlusAlt.tsx +29 -0
- package/src/Icon/icons/ExchangeHorizontal.tsx +23 -0
- package/src/Icon/type.tsx +4 -1
- package/src/Input/InputMonth.tsx +27 -21
- package/src/Input/InputYear.tsx +25 -18
- package/src/Input/README_INPUT_MONTH.md +2 -2
- package/src/Input/README_INPUT_YEAR.md +2 -2
- package/src/hooks/useOptionalFocusEffect.ts +0 -1
package/src/Input/InputMonth.tsx
CHANGED
|
@@ -70,30 +70,35 @@ const zeroBased = (month: number | null | undefined) =>
|
|
|
70
70
|
? null
|
|
71
71
|
: month - 1;
|
|
72
72
|
|
|
73
|
-
export default function InputMonth({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
export default function InputMonth(props: InputMonthProps) {
|
|
74
|
+
const {
|
|
75
|
+
label,
|
|
76
|
+
placeholder,
|
|
77
|
+
placeholderEnd,
|
|
78
|
+
value,
|
|
79
|
+
valueEnd,
|
|
80
|
+
mode = 'single',
|
|
81
|
+
onSelectClick,
|
|
82
|
+
onPickerClose,
|
|
83
|
+
onChange,
|
|
84
|
+
language,
|
|
85
|
+
hasClear,
|
|
86
|
+
title,
|
|
87
|
+
cancelLabel,
|
|
88
|
+
confirmLabel,
|
|
89
|
+
testID,
|
|
90
|
+
} = props;
|
|
91
|
+
|
|
90
92
|
const [isOpen, setIsOpen] = useState(false);
|
|
91
93
|
const [selected, setSelected] = useState<PickerFieldValue>(EMPTY);
|
|
92
94
|
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
const
|
|
95
|
+
// Presence of the prop decides ownership, not its contents: `value ??`
|
|
96
|
+
// would read a parent's clear as "no prop given" and fall back to the last
|
|
97
|
+
// pick, leaving what was cleared on screen.
|
|
98
|
+
const start = 'value' in props
|
|
99
|
+
? value ?? null
|
|
100
|
+
: mode === 'range' ? selected.startValue : selected.value; // prettier-ignore
|
|
101
|
+
const end = 'valueEnd' in props ? (valueEnd ?? null) : selected.endValue;
|
|
97
102
|
|
|
98
103
|
// What the sheet should open on. Without this the picker only knows about
|
|
99
104
|
// taps it saw itself, so a value coming from a prop -- or a clear -- would
|
|
@@ -161,6 +166,7 @@ export default function InputMonth({
|
|
|
161
166
|
value={pickerValue}
|
|
162
167
|
onClose={handleClose}
|
|
163
168
|
onChange={handleChange}
|
|
169
|
+
{...(language ? { language } : {})}
|
|
164
170
|
{...(title ? { title } : {})}
|
|
165
171
|
{...(cancelLabel ? { cancelLabel } : {})}
|
|
166
172
|
{...(confirmLabel ? { confirmLabel } : {})}
|
package/src/Input/InputYear.tsx
CHANGED
|
@@ -47,27 +47,34 @@ const yearLabel = (year: number | null | undefined) =>
|
|
|
47
47
|
* Year counterpart to InputMonth. There is no `language` prop: a year is
|
|
48
48
|
* digits, and nothing about it changes between locales.
|
|
49
49
|
*/
|
|
50
|
-
export default function InputYear({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
50
|
+
export default function InputYear(props: InputYearProps) {
|
|
51
|
+
const {
|
|
52
|
+
label,
|
|
53
|
+
placeholder,
|
|
54
|
+
placeholderEnd,
|
|
55
|
+
value,
|
|
56
|
+
valueEnd,
|
|
57
|
+
mode = 'single',
|
|
58
|
+
onSelectClick,
|
|
59
|
+
onPickerClose,
|
|
60
|
+
onChange,
|
|
61
|
+
hasClear,
|
|
62
|
+
title,
|
|
63
|
+
cancelLabel,
|
|
64
|
+
confirmLabel,
|
|
65
|
+
testID,
|
|
66
|
+
} = props;
|
|
67
|
+
|
|
66
68
|
const [isOpen, setIsOpen] = useState(false);
|
|
67
69
|
const [selected, setSelected] = useState<PickerFieldValue>(EMPTY);
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
// Presence of the prop decides ownership, not its contents: `value ??`
|
|
72
|
+
// would read a parent's clear as "no prop given" and fall back to the last
|
|
73
|
+
// pick, leaving what was cleared on screen.
|
|
74
|
+
const start = 'value' in props
|
|
75
|
+
? value ?? null
|
|
76
|
+
: mode === 'range' ? selected.startValue : selected.value; // prettier-ignore
|
|
77
|
+
const end = 'valueEnd' in props ? (valueEnd ?? null) : selected.endValue;
|
|
71
78
|
|
|
72
79
|
// What the sheet should open on. Without this the picker only knows about
|
|
73
80
|
// taps it saw itself, so a value coming from a prop -- or a clear -- would
|
|
@@ -60,8 +60,8 @@ const [range, setRange] = useState({ start: undefined, end: undefined });
|
|
|
60
60
|
| `label` | `string` | ❌ | - | Teks label di atas trigger. Kalau kosong, elemen labelnya tidak dirender sama sekali. |
|
|
61
61
|
| `placeholder` | `string` | ✅ | - | Teks trigger saat belum ada nilai. |
|
|
62
62
|
| `placeholderEnd` | `string` | ✅\* | - | Placeholder trigger kedua. Wajib dan hanya berlaku saat `mode="range"`. |
|
|
63
|
-
| `value` | `number` | ❌ | - | Nomor bulan, `1` (Januari) sampai `12` (Desember).
|
|
64
|
-
| `valueEnd` | `number` | ❌ | - | Nomor bulan akhir, `1`–`12`. Hanya berlaku saat `mode="range"`.
|
|
63
|
+
| `value` | `number` | ❌ | - | Nomor bulan, `1` (Januari) sampai `12` (Desember). Begitu prop ini dipasang, ia yang pegang nilai: `undefined` berarti kosong, bukan "pakai pilihan internal". Di luar 1–12 dianggap kosong. |
|
|
64
|
+
| `valueEnd` | `number` | ❌ | - | Nomor bulan akhir, `1`–`12`. Sama aturannya dengan `value`. Hanya berlaku saat `mode="range"`. |
|
|
65
65
|
| `mode` | `'single' \| 'range'` | ❌ | `'single'` | Satu bulan, atau rentang dua bulan. |
|
|
66
66
|
| `language` | `'en' \| 'id'` | ❌ | `'id'` | Bahasa nama bulan yang ditampilkan. |
|
|
67
67
|
| `hasClear` | `boolean` | ❌ | `false` | Menampilkan tombol clear saat ada nilai. |
|
|
@@ -55,8 +55,8 @@ const [year, setYear] = useState<number>();
|
|
|
55
55
|
| `label` | `string` | ❌ | - | Teks label di atas trigger. Kalau kosong, elemen labelnya tidak dirender. |
|
|
56
56
|
| `placeholder` | `string` | ✅ | - | Teks trigger saat belum ada nilai. |
|
|
57
57
|
| `placeholderEnd` | `string` | ✅\* | - | Placeholder trigger kedua. Wajib dan hanya berlaku saat `mode="range"`. |
|
|
58
|
-
| `value` | `number` | ❌ | - | Tahun penuh, mis. `2024`.
|
|
59
|
-
| `valueEnd` | `number` | ❌ | - | Tahun akhir. Hanya berlaku saat `mode="range"`.
|
|
58
|
+
| `value` | `number` | ❌ | - | Tahun penuh, mis. `2024`. Begitu prop ini dipasang, ia yang pegang nilai: `undefined` berarti kosong, bukan "pakai pilihan internal". |
|
|
59
|
+
| `valueEnd` | `number` | ❌ | - | Tahun akhir. Sama aturannya dengan `value`. Hanya berlaku saat `mode="range"`. |
|
|
60
60
|
| `mode` | `'single' \| 'range'` | ❌ | `'single'` | Satu tahun, atau rentang dua tahun. |
|
|
61
61
|
| `hasClear` | `boolean` | ❌ | `false` | Menampilkan tombol clear saat ada nilai. |
|
|
62
62
|
| `onChange` | `(v: PickerFieldValue) => void` | ❌ | - | Dipanggil saat pilihan dikonfirmasi atau dibersihkan. |
|
|
@@ -7,7 +7,6 @@ export function useOptionalFocusEffect(callback: () => void | (() => void)) {
|
|
|
7
7
|
|
|
8
8
|
const effect = useCallback(callback, [callback]);
|
|
9
9
|
|
|
10
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
11
10
|
if (navigation) {
|
|
12
11
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
13
12
|
useFocusEffect(effect);
|