@herca/rn-kit 0.1.0
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/LICENSE +20 -0
- package/README.md +33 -0
- package/RnKit.podspec +21 -0
- package/android/build.gradle +83 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/herca/rnkit/RnKitModule.kt +23 -0
- package/android/src/main/java/com/herca/rnkit/RnKitPackage.kt +33 -0
- package/ios/RnKit.h +5 -0
- package/ios/RnKit.mm +18 -0
- package/lib/module/Accordion/Accordion.js +33 -0
- package/lib/module/Accordion/Accordion.js.map +1 -0
- package/lib/module/Accordion/AccordionItem.js +13 -0
- package/lib/module/Accordion/AccordionItem.js.map +1 -0
- package/lib/module/Accordion/README.md +48 -0
- package/lib/module/Accordion/type.js +4 -0
- package/lib/module/Accordion/type.js.map +1 -0
- package/lib/module/Alert/Alert.js +121 -0
- package/lib/module/Alert/Alert.js.map +1 -0
- package/lib/module/Alert/README.md +68 -0
- package/lib/module/Avatar/Avatar.js +56 -0
- package/lib/module/Avatar/Avatar.js.map +1 -0
- package/lib/module/Avatar/AvatarGroup.js +118 -0
- package/lib/module/Avatar/AvatarGroup.js.map +1 -0
- package/lib/module/Avatar/README_AVATAR.md +57 -0
- package/lib/module/Avatar/README_AVATARGROUP.md +58 -0
- package/lib/module/Avatar/type.js +4 -0
- package/lib/module/Avatar/type.js.map +1 -0
- package/lib/module/Badge/Badge.js +119 -0
- package/lib/module/Badge/Badge.js.map +1 -0
- package/lib/module/Badge/README.md +64 -0
- package/lib/module/Badge/type.js +2 -0
- package/lib/module/Badge/type.js.map +1 -0
- package/lib/module/BottomSheet/BottomSheet.js +211 -0
- package/lib/module/BottomSheet/BottomSheet.js.map +1 -0
- package/lib/module/BottomSheet/README.md +64 -0
- package/lib/module/BottomSheet/type.js +2 -0
- package/lib/module/BottomSheet/type.js.map +1 -0
- package/lib/module/Button/Button.js +138 -0
- package/lib/module/Button/Button.js.map +1 -0
- package/lib/module/Button/README.md +94 -0
- package/lib/module/Button/type.js +262 -0
- package/lib/module/Button/type.js.map +1 -0
- package/lib/module/Calendar/Calendar.js +356 -0
- package/lib/module/Calendar/Calendar.js.map +1 -0
- package/lib/module/Calendar/CalendarPropsType.js +4 -0
- package/lib/module/Calendar/CalendarPropsType.js.map +1 -0
- package/lib/module/Calendar/README.md +73 -0
- package/lib/module/CheckBox/CheckBox.js +67 -0
- package/lib/module/CheckBox/CheckBox.js.map +1 -0
- package/lib/module/CheckBox/CheckBoxList.js +41 -0
- package/lib/module/CheckBox/CheckBoxList.js.map +1 -0
- package/lib/module/CheckBox/README_CHECKBOX.md +46 -0
- package/lib/module/CheckBox/README_CHECKBOXLIST.md +41 -0
- package/lib/module/Chip/Chip.js +109 -0
- package/lib/module/Chip/Chip.js.map +1 -0
- package/lib/module/Chip/ChipItem.js +89 -0
- package/lib/module/Chip/ChipItem.js.map +1 -0
- package/lib/module/Chip/README.md +89 -0
- package/lib/module/Chip/type.js +94 -0
- package/lib/module/Chip/type.js.map +1 -0
- package/lib/module/Color/Color.js +126 -0
- package/lib/module/Color/Color.js.map +1 -0
- package/lib/module/Color/README.md +54 -0
- package/lib/module/Color/type.js +2 -0
- package/lib/module/Color/type.js.map +1 -0
- package/lib/module/DatePicker/DatePicker.js +69 -0
- package/lib/module/DatePicker/DatePicker.js.map +1 -0
- package/lib/module/DatePicker/MonthPicker.js +179 -0
- package/lib/module/DatePicker/MonthPicker.js.map +1 -0
- package/lib/module/DatePicker/README.md +51 -0
- package/lib/module/DatePicker/TimePicker.js +200 -0
- package/lib/module/DatePicker/TimePicker.js.map +1 -0
- package/lib/module/DatePicker/YearPicker.js +217 -0
- package/lib/module/DatePicker/YearPicker.js.map +1 -0
- package/lib/module/DatePicker/helpers.js +33 -0
- package/lib/module/DatePicker/helpers.js.map +1 -0
- package/lib/module/Drawing/Drawing.js +26 -0
- package/lib/module/Drawing/Drawing.js.map +1 -0
- package/lib/module/DropDown/DropDown.js +107 -0
- package/lib/module/DropDown/DropDown.js.map +1 -0
- package/lib/module/DropDown/type.js +4 -0
- package/lib/module/DropDown/type.js.map +1 -0
- package/lib/module/FileView/Image.js +8 -0
- package/lib/module/FileView/Image.js.map +1 -0
- package/lib/module/FileView/PdfView.js +37 -0
- package/lib/module/FileView/PdfView.js.map +1 -0
- package/lib/module/Icon/Icon.js +74 -0
- package/lib/module/Icon/Icon.js.map +1 -0
- package/lib/module/Icon/icons/AirPlane.js +22 -0
- package/lib/module/Icon/icons/AirPlane.js.map +1 -0
- package/lib/module/Icon/icons/ArrowBackAlt.js +22 -0
- package/lib/module/Icon/icons/ArrowBackAlt.js.map +1 -0
- package/lib/module/Icon/icons/ArrowDown.js +22 -0
- package/lib/module/Icon/icons/ArrowDown.js.map +1 -0
- package/lib/module/Icon/icons/ArrowForwardAlt.js +22 -0
- package/lib/module/Icon/icons/ArrowForwardAlt.js.map +1 -0
- package/lib/module/Icon/icons/ArrowLeft.js +22 -0
- package/lib/module/Icon/icons/ArrowLeft.js.map +1 -0
- package/lib/module/Icon/icons/ArrowRight.js +22 -0
- package/lib/module/Icon/icons/ArrowRight.js.map +1 -0
- package/lib/module/Icon/icons/ArrowUp.js +22 -0
- package/lib/module/Icon/icons/ArrowUp.js.map +1 -0
- package/lib/module/Icon/icons/Calendar.js +22 -0
- package/lib/module/Icon/icons/Calendar.js.map +1 -0
- package/lib/module/Icon/icons/Camera.js +22 -0
- package/lib/module/Icon/icons/Camera.js.map +1 -0
- package/lib/module/Icon/icons/Check.js +22 -0
- package/lib/module/Icon/icons/Check.js.map +1 -0
- package/lib/module/Icon/icons/Document.js +22 -0
- package/lib/module/Icon/icons/Document.js.map +1 -0
- package/lib/module/Icon/icons/Download.js +22 -0
- package/lib/module/Icon/icons/Download.js.map +1 -0
- package/lib/module/Icon/icons/ExlmationMark.js +22 -0
- package/lib/module/Icon/icons/ExlmationMark.js.map +1 -0
- package/lib/module/Icon/icons/Eye.js +22 -0
- package/lib/module/Icon/icons/Eye.js.map +1 -0
- package/lib/module/Icon/icons/EyeOpen.js +22 -0
- package/lib/module/Icon/icons/EyeOpen.js.map +1 -0
- package/lib/module/Icon/icons/Filter.js +22 -0
- package/lib/module/Icon/icons/Filter.js.map +1 -0
- package/lib/module/Icon/icons/Home.js +8 -0
- package/lib/module/Icon/icons/Home.js.map +1 -0
- package/lib/module/Icon/icons/Image.js +22 -0
- package/lib/module/Icon/icons/Image.js.map +1 -0
- package/lib/module/Icon/icons/Pdf.js +22 -0
- package/lib/module/Icon/icons/Pdf.js.map +1 -0
- package/lib/module/Icon/icons/RadioButton.js +34 -0
- package/lib/module/Icon/icons/RadioButton.js.map +1 -0
- package/lib/module/Icon/icons/Search.js +22 -0
- package/lib/module/Icon/icons/Search.js.map +1 -0
- package/lib/module/Icon/icons/StickyNote.js +22 -0
- package/lib/module/Icon/icons/StickyNote.js.map +1 -0
- package/lib/module/Icon/icons/Times.js +22 -0
- package/lib/module/Icon/icons/Times.js.map +1 -0
- package/lib/module/Icon/icons/User.js +22 -0
- package/lib/module/Icon/icons/User.js.map +1 -0
- package/lib/module/Icon/icons/XCircle.js +22 -0
- package/lib/module/Icon/icons/XCircle.js.map +1 -0
- package/lib/module/Icon/index.js +6 -0
- package/lib/module/Icon/index.js.map +1 -0
- package/lib/module/Icon/type.js +4 -0
- package/lib/module/Icon/type.js.map +1 -0
- package/lib/module/Input/Input.js +125 -0
- package/lib/module/Input/Input.js.map +1 -0
- package/lib/module/Input/Input.md +51 -0
- package/lib/module/Input/InputFile.js +319 -0
- package/lib/module/Input/InputFile.js.map +1 -0
- package/lib/module/Input/InputMonth.js +4 -0
- package/lib/module/Input/InputMonth.js.map +1 -0
- package/lib/module/Input/InputNumber.js +2 -0
- package/lib/module/Input/InputNumber.js.map +1 -0
- package/lib/module/Input/InputOtp.js +74 -0
- package/lib/module/Input/InputOtp.js.map +1 -0
- package/lib/module/Input/InputPassword.js +18 -0
- package/lib/module/Input/InputPassword.js.map +1 -0
- package/lib/module/Input/InputSelect.js +8 -0
- package/lib/module/Input/InputSelect.js.map +1 -0
- package/lib/module/Input/Switch.js +91 -0
- package/lib/module/Input/Switch.js.map +1 -0
- package/lib/module/Input/TextArea.js +61 -0
- package/lib/module/Input/TextArea.js.map +1 -0
- package/lib/module/Input/assets/Ilustrasi.svg +14 -0
- package/lib/module/Input/assets/input-file.png +0 -0
- package/lib/module/Input/type.js +4 -0
- package/lib/module/Input/type.js.map +1 -0
- package/lib/module/Label/Label.js +87 -0
- package/lib/module/Label/Label.js.map +1 -0
- package/lib/module/LabelForm/LabelForm.js +17 -0
- package/lib/module/LabelForm/LabelForm.js.map +1 -0
- package/lib/module/List/List.js +31 -0
- package/lib/module/List/List.js.map +1 -0
- package/lib/module/List/ListItem.js +31 -0
- package/lib/module/List/ListItem.js.map +1 -0
- package/lib/module/List/type.js +4 -0
- package/lib/module/List/type.js.map +1 -0
- package/lib/module/Loading/Loading.js +50 -0
- package/lib/module/Loading/Loading.js.map +1 -0
- package/lib/module/Modal/Modal.js +149 -0
- package/lib/module/Modal/Modal.js.map +1 -0
- package/lib/module/NativeRnKit.js +5 -0
- package/lib/module/NativeRnKit.js.map +1 -0
- package/lib/module/Provider/FooterProvider.js +25 -0
- package/lib/module/Provider/FooterProvider.js.map +1 -0
- package/lib/module/Provider/LayoutWithFooter.js +34 -0
- package/lib/module/Provider/LayoutWithFooter.js.map +1 -0
- package/lib/module/Provider/Provider.js +43 -0
- package/lib/module/Provider/Provider.js.map +1 -0
- package/lib/module/Provider/RequiredUpdateAppsProvider.js +60 -0
- package/lib/module/Provider/RequiredUpdateAppsProvider.js.map +1 -0
- package/lib/module/Provider/type.js +2 -0
- package/lib/module/Provider/type.js.map +1 -0
- package/lib/module/RadioButton/README.md +43 -0
- package/lib/module/RadioButton/RadioButton.js +97 -0
- package/lib/module/RadioButton/RadioButton.js.map +1 -0
- package/lib/module/Select/README.md +78 -0
- package/lib/module/Select/README_Select.md +78 -0
- package/lib/module/Select/Select.js +101 -0
- package/lib/module/Select/Select.js.map +1 -0
- package/lib/module/Select/type.js +4 -0
- package/lib/module/Select/type.js.map +1 -0
- package/lib/module/Step/Step.js +83 -0
- package/lib/module/Step/Step.js.map +1 -0
- package/lib/module/Step/StepItem.js +78 -0
- package/lib/module/Step/StepItem.js.map +1 -0
- package/lib/module/Step/type.js +4 -0
- package/lib/module/Step/type.js.map +1 -0
- package/lib/module/SwitchButton/SwitchButton.js +8 -0
- package/lib/module/SwitchButton/SwitchButton.js.map +1 -0
- package/lib/module/TextArea/TextArea.js +2 -0
- package/lib/module/TextArea/TextArea.js.map +1 -0
- package/lib/module/Theme/Theme.js +31 -0
- package/lib/module/Theme/Theme.js.map +1 -0
- package/lib/module/Timeline/Timeline.js +12 -0
- package/lib/module/Timeline/Timeline.js.map +1 -0
- package/lib/module/Timeline/TimelineItem.js +66 -0
- package/lib/module/Timeline/TimelineItem.js.map +1 -0
- package/lib/module/Toast/Toast.js +143 -0
- package/lib/module/Toast/Toast.js.map +1 -0
- package/lib/module/Toast/ToastContext.js +40 -0
- package/lib/module/Toast/ToastContext.js.map +1 -0
- package/lib/module/Typography/README.md +71 -0
- package/lib/module/Typography/Typography.js +39 -0
- package/lib/module/Typography/Typography.js.map +1 -0
- package/lib/module/Typography/type.js +33 -0
- package/lib/module/Typography/type.js.map +1 -0
- package/lib/module/Ui/Card.js +50 -0
- package/lib/module/Ui/Card.js.map +1 -0
- package/lib/module/Ui/Center.js +21 -0
- package/lib/module/Ui/Center.js.map +1 -0
- package/lib/module/Ui/Col.js +20 -0
- package/lib/module/Ui/Col.js.map +1 -0
- package/lib/module/Ui/Container.js +20 -0
- package/lib/module/Ui/Container.js.map +1 -0
- package/lib/module/Ui/Devider.js +18 -0
- package/lib/module/Ui/Devider.js.map +1 -0
- package/lib/module/Ui/Footer.js +36 -0
- package/lib/module/Ui/Footer.js.map +1 -0
- package/lib/module/Ui/Gap.js +13 -0
- package/lib/module/Ui/Gap.js.map +1 -0
- package/lib/module/Ui/Grid.js +31 -0
- package/lib/module/Ui/Grid.js.map +1 -0
- package/lib/module/index.js +61 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Accordion/Accordion.d.ts +3 -0
- package/lib/typescript/src/Accordion/Accordion.d.ts.map +1 -0
- package/lib/typescript/src/Accordion/AccordionItem.d.ts +3 -0
- package/lib/typescript/src/Accordion/AccordionItem.d.ts.map +1 -0
- package/lib/typescript/src/Accordion/type.d.ts +17 -0
- package/lib/typescript/src/Accordion/type.d.ts.map +1 -0
- package/lib/typescript/src/Alert/Alert.d.ts +16 -0
- package/lib/typescript/src/Alert/Alert.d.ts.map +1 -0
- package/lib/typescript/src/Avatar/Avatar.d.ts +5 -0
- package/lib/typescript/src/Avatar/Avatar.d.ts.map +1 -0
- package/lib/typescript/src/Avatar/AvatarGroup.d.ts +4 -0
- package/lib/typescript/src/Avatar/AvatarGroup.d.ts.map +1 -0
- package/lib/typescript/src/Avatar/type.d.ts +16 -0
- package/lib/typescript/src/Avatar/type.d.ts.map +1 -0
- package/lib/typescript/src/Badge/Badge.d.ts +14 -0
- package/lib/typescript/src/Badge/Badge.d.ts.map +1 -0
- package/lib/typescript/src/Badge/type.d.ts +1 -0
- package/lib/typescript/src/Badge/type.d.ts.map +1 -0
- package/lib/typescript/src/BottomSheet/BottomSheet.d.ts +3 -0
- package/lib/typescript/src/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/typescript/src/BottomSheet/type.d.ts +15 -0
- package/lib/typescript/src/BottomSheet/type.d.ts.map +1 -0
- package/lib/typescript/src/Button/Button.d.ts +5 -0
- package/lib/typescript/src/Button/Button.d.ts.map +1 -0
- package/lib/typescript/src/Button/type.d.ts +49 -0
- package/lib/typescript/src/Button/type.d.ts.map +1 -0
- package/lib/typescript/src/Calendar/Calendar.d.ts +4 -0
- package/lib/typescript/src/Calendar/Calendar.d.ts.map +1 -0
- package/lib/typescript/src/Calendar/CalendarPropsType.d.ts +52 -0
- package/lib/typescript/src/Calendar/CalendarPropsType.d.ts.map +1 -0
- package/lib/typescript/src/CheckBox/CheckBox.d.ts +11 -0
- package/lib/typescript/src/CheckBox/CheckBox.d.ts.map +1 -0
- package/lib/typescript/src/CheckBox/CheckBoxList.d.ts +14 -0
- package/lib/typescript/src/CheckBox/CheckBoxList.d.ts.map +1 -0
- package/lib/typescript/src/Chip/Chip.d.ts +5 -0
- package/lib/typescript/src/Chip/Chip.d.ts.map +1 -0
- package/lib/typescript/src/Chip/ChipItem.d.ts +3 -0
- package/lib/typescript/src/Chip/ChipItem.d.ts.map +1 -0
- package/lib/typescript/src/Chip/type.d.ts +50 -0
- package/lib/typescript/src/Chip/type.d.ts.map +1 -0
- package/lib/typescript/src/Color/Color.d.ts +122 -0
- package/lib/typescript/src/Color/Color.d.ts.map +1 -0
- package/lib/typescript/src/Color/type.d.ts +2 -0
- package/lib/typescript/src/Color/type.d.ts.map +1 -0
- package/lib/typescript/src/DatePicker/DatePicker.d.ts +10 -0
- package/lib/typescript/src/DatePicker/DatePicker.d.ts.map +1 -0
- package/lib/typescript/src/DatePicker/MonthPicker.d.ts +13 -0
- package/lib/typescript/src/DatePicker/MonthPicker.d.ts.map +1 -0
- package/lib/typescript/src/DatePicker/TimePicker.d.ts +11 -0
- package/lib/typescript/src/DatePicker/TimePicker.d.ts.map +1 -0
- package/lib/typescript/src/DatePicker/YearPicker.d.ts +13 -0
- package/lib/typescript/src/DatePicker/YearPicker.d.ts.map +1 -0
- package/lib/typescript/src/DatePicker/helpers.d.ts +21 -0
- package/lib/typescript/src/DatePicker/helpers.d.ts.map +1 -0
- package/lib/typescript/src/Drawing/Drawing.d.ts +2 -0
- package/lib/typescript/src/Drawing/Drawing.d.ts.map +1 -0
- package/lib/typescript/src/DropDown/DropDown.d.ts +4 -0
- package/lib/typescript/src/DropDown/DropDown.d.ts.map +1 -0
- package/lib/typescript/src/DropDown/type.d.ts +9 -0
- package/lib/typescript/src/DropDown/type.d.ts.map +1 -0
- package/lib/typescript/src/FileView/Image.d.ts +2 -0
- package/lib/typescript/src/FileView/Image.d.ts.map +1 -0
- package/lib/typescript/src/FileView/PdfView.d.ts +5 -0
- package/lib/typescript/src/FileView/PdfView.d.ts.map +1 -0
- package/lib/typescript/src/Icon/Icon.d.ts +5 -0
- package/lib/typescript/src/Icon/Icon.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/AirPlane.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/AirPlane.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ArrowBackAlt.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ArrowBackAlt.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ArrowDown.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ArrowDown.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ArrowForwardAlt.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ArrowForwardAlt.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ArrowLeft.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ArrowLeft.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ArrowRight.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ArrowRight.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ArrowUp.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ArrowUp.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Calendar.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Calendar.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Camera.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Camera.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Check.d.ts +6 -0
- package/lib/typescript/src/Icon/icons/Check.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Document.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Document.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Download.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Download.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/ExlmationMark.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/ExlmationMark.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Eye.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Eye.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/EyeOpen.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/EyeOpen.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Filter.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Filter.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Home.d.ts +2 -0
- package/lib/typescript/src/Icon/icons/Home.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Image.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Image.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Pdf.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Pdf.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/RadioButton.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/RadioButton.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Search.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Search.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/StickyNote.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/StickyNote.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/Times.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/Times.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/User.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/User.d.ts.map +1 -0
- package/lib/typescript/src/Icon/icons/XCircle.d.ts +9 -0
- package/lib/typescript/src/Icon/icons/XCircle.d.ts.map +1 -0
- package/lib/typescript/src/Icon/index.d.ts +5 -0
- package/lib/typescript/src/Icon/index.d.ts.map +1 -0
- package/lib/typescript/src/Icon/type.d.ts +9 -0
- package/lib/typescript/src/Icon/type.d.ts.map +1 -0
- package/lib/typescript/src/Input/Input.d.ts +5 -0
- package/lib/typescript/src/Input/Input.d.ts.map +1 -0
- package/lib/typescript/src/Input/InputFile.d.ts +11 -0
- package/lib/typescript/src/Input/InputFile.d.ts.map +1 -0
- package/lib/typescript/src/Input/InputMonth.d.ts +2 -0
- package/lib/typescript/src/Input/InputMonth.d.ts.map +1 -0
- package/lib/typescript/src/Input/InputNumber.d.ts +1 -0
- package/lib/typescript/src/Input/InputNumber.d.ts.map +1 -0
- package/lib/typescript/src/Input/InputOtp.d.ts +11 -0
- package/lib/typescript/src/Input/InputOtp.d.ts.map +1 -0
- package/lib/typescript/src/Input/InputPassword.d.ts +15 -0
- package/lib/typescript/src/Input/InputPassword.d.ts.map +1 -0
- package/lib/typescript/src/Input/InputSelect.d.ts +2 -0
- package/lib/typescript/src/Input/InputSelect.d.ts.map +1 -0
- package/lib/typescript/src/Input/Switch.d.ts +12 -0
- package/lib/typescript/src/Input/Switch.d.ts.map +1 -0
- package/lib/typescript/src/Input/TextArea.d.ts +3 -0
- package/lib/typescript/src/Input/TextArea.d.ts.map +1 -0
- package/lib/typescript/src/Input/type.d.ts +18 -0
- package/lib/typescript/src/Input/type.d.ts.map +1 -0
- package/lib/typescript/src/Label/Label.d.ts +12 -0
- package/lib/typescript/src/Label/Label.d.ts.map +1 -0
- package/lib/typescript/src/LabelForm/LabelForm.d.ts +4 -0
- package/lib/typescript/src/LabelForm/LabelForm.d.ts.map +1 -0
- package/lib/typescript/src/List/List.d.ts +3 -0
- package/lib/typescript/src/List/List.d.ts.map +1 -0
- package/lib/typescript/src/List/ListItem.d.ts +3 -0
- package/lib/typescript/src/List/ListItem.d.ts.map +1 -0
- package/lib/typescript/src/List/type.d.ts +14 -0
- package/lib/typescript/src/List/type.d.ts.map +1 -0
- package/lib/typescript/src/Loading/Loading.d.ts +10 -0
- package/lib/typescript/src/Loading/Loading.d.ts.map +1 -0
- package/lib/typescript/src/Modal/Modal.d.ts +18 -0
- package/lib/typescript/src/Modal/Modal.d.ts.map +1 -0
- package/lib/typescript/src/NativeRnKit.d.ts +7 -0
- package/lib/typescript/src/NativeRnKit.d.ts.map +1 -0
- package/lib/typescript/src/Provider/FooterProvider.d.ts +11 -0
- package/lib/typescript/src/Provider/FooterProvider.d.ts.map +1 -0
- package/lib/typescript/src/Provider/LayoutWithFooter.d.ts +5 -0
- package/lib/typescript/src/Provider/LayoutWithFooter.d.ts.map +1 -0
- package/lib/typescript/src/Provider/Provider.d.ts +15 -0
- package/lib/typescript/src/Provider/Provider.d.ts.map +1 -0
- package/lib/typescript/src/Provider/RequiredUpdateAppsProvider.d.ts +3 -0
- package/lib/typescript/src/Provider/RequiredUpdateAppsProvider.d.ts.map +1 -0
- package/lib/typescript/src/Provider/type.d.ts +7 -0
- package/lib/typescript/src/Provider/type.d.ts.map +1 -0
- package/lib/typescript/src/RadioButton/RadioButton.d.ts +15 -0
- package/lib/typescript/src/RadioButton/RadioButton.d.ts.map +1 -0
- package/lib/typescript/src/Select/Select.d.ts +3 -0
- package/lib/typescript/src/Select/Select.d.ts.map +1 -0
- package/lib/typescript/src/Select/type.d.ts +24 -0
- package/lib/typescript/src/Select/type.d.ts.map +1 -0
- package/lib/typescript/src/Step/Step.d.ts +4 -0
- package/lib/typescript/src/Step/Step.d.ts.map +1 -0
- package/lib/typescript/src/Step/StepItem.d.ts +4 -0
- package/lib/typescript/src/Step/StepItem.d.ts.map +1 -0
- package/lib/typescript/src/Step/type.d.ts +18 -0
- package/lib/typescript/src/Step/type.d.ts.map +1 -0
- package/lib/typescript/src/SwitchButton/SwitchButton.d.ts +2 -0
- package/lib/typescript/src/SwitchButton/SwitchButton.d.ts.map +1 -0
- package/lib/typescript/src/TextArea/TextArea.d.ts +1 -0
- package/lib/typescript/src/TextArea/TextArea.d.ts.map +1 -0
- package/lib/typescript/src/Theme/Theme.d.ts +29 -0
- package/lib/typescript/src/Theme/Theme.d.ts.map +1 -0
- package/lib/typescript/src/Timeline/Timeline.d.ts +6 -0
- package/lib/typescript/src/Timeline/Timeline.d.ts.map +1 -0
- package/lib/typescript/src/Timeline/TimelineItem.d.ts +15 -0
- package/lib/typescript/src/Timeline/TimelineItem.d.ts.map +1 -0
- package/lib/typescript/src/Toast/Toast.d.ts +14 -0
- package/lib/typescript/src/Toast/Toast.d.ts.map +1 -0
- package/lib/typescript/src/Toast/ToastContext.d.ts +17 -0
- package/lib/typescript/src/Toast/ToastContext.d.ts.map +1 -0
- package/lib/typescript/src/Typography/Typography.d.ts +5 -0
- package/lib/typescript/src/Typography/Typography.d.ts.map +1 -0
- package/lib/typescript/src/Typography/type.d.ts +19 -0
- package/lib/typescript/src/Typography/type.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Card.d.ts +11 -0
- package/lib/typescript/src/Ui/Card.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Center.d.ts +9 -0
- package/lib/typescript/src/Ui/Center.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Col.d.ts +10 -0
- package/lib/typescript/src/Ui/Col.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Container.d.ts +2 -0
- package/lib/typescript/src/Ui/Container.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Devider.d.ts +3 -0
- package/lib/typescript/src/Ui/Devider.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Footer.d.ts +9 -0
- package/lib/typescript/src/Ui/Footer.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Gap.d.ts +6 -0
- package/lib/typescript/src/Ui/Gap.d.ts.map +1 -0
- package/lib/typescript/src/Ui/Grid.d.ts +9 -0
- package/lib/typescript/src/Ui/Grid.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +59 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +172 -0
- package/src/Accordion/Accordion.tsx +38 -0
- package/src/Accordion/AccordionItem.tsx +9 -0
- package/src/Accordion/README.md +48 -0
- package/src/Accordion/type.tsx +19 -0
- package/src/Alert/Alert.tsx +141 -0
- package/src/Alert/README.md +68 -0
- package/src/Avatar/Avatar.tsx +68 -0
- package/src/Avatar/AvatarGroup.tsx +135 -0
- package/src/Avatar/README_AVATAR.md +57 -0
- package/src/Avatar/README_AVATARGROUP.md +58 -0
- package/src/Avatar/type.tsx +17 -0
- package/src/Badge/Badge.tsx +135 -0
- package/src/Badge/README.md +64 -0
- package/src/Badge/type.tsx +0 -0
- package/src/BottomSheet/BottomSheet.tsx +259 -0
- package/src/BottomSheet/README.md +64 -0
- package/src/BottomSheet/type.tsx +15 -0
- package/src/Button/Button.tsx +195 -0
- package/src/Button/README.md +94 -0
- package/src/Button/type.tsx +329 -0
- package/src/Calendar/Calendar.tsx +382 -0
- package/src/Calendar/CalendarPropsType.tsx +60 -0
- package/src/Calendar/README.md +73 -0
- package/src/CheckBox/CheckBox.tsx +80 -0
- package/src/CheckBox/CheckBoxList.tsx +64 -0
- package/src/CheckBox/README_CHECKBOX.md +46 -0
- package/src/CheckBox/README_CHECKBOXLIST.md +41 -0
- package/src/Chip/Chip.tsx +134 -0
- package/src/Chip/ChipItem.tsx +124 -0
- package/src/Chip/README.md +89 -0
- package/src/Chip/type.tsx +152 -0
- package/src/Color/Color.tsx +133 -0
- package/src/Color/README.md +54 -0
- package/src/Color/type.tsx +9 -0
- package/src/DatePicker/DatePicker.tsx +78 -0
- package/src/DatePicker/MonthPicker.tsx +204 -0
- package/src/DatePicker/README.md +51 -0
- package/src/DatePicker/TimePicker.tsx +234 -0
- package/src/DatePicker/YearPicker.tsx +238 -0
- package/src/DatePicker/helpers.tsx +53 -0
- package/src/Drawing/Drawing.tsx +23 -0
- package/src/DropDown/DropDown.tsx +136 -0
- package/src/DropDown/type.tsx +9 -0
- package/src/FileView/Image.tsx +5 -0
- package/src/FileView/PdfView.tsx +33 -0
- package/src/Icon/Icon.tsx +76 -0
- package/src/Icon/icons/AirPlane.tsx +19 -0
- package/src/Icon/icons/ArrowBackAlt.tsx +23 -0
- package/src/Icon/icons/ArrowDown.tsx +19 -0
- package/src/Icon/icons/ArrowForwardAlt.tsx +23 -0
- package/src/Icon/icons/ArrowLeft.tsx +19 -0
- package/src/Icon/icons/ArrowRight.tsx +19 -0
- package/src/Icon/icons/ArrowUp.tsx +19 -0
- package/src/Icon/icons/Calendar.tsx +19 -0
- package/src/Icon/icons/Camera.tsx +19 -0
- package/src/Icon/icons/Check.tsx +15 -0
- package/src/Icon/icons/Document.tsx +19 -0
- package/src/Icon/icons/Download.tsx +19 -0
- package/src/Icon/icons/ExlmationMark.tsx +23 -0
- package/src/Icon/icons/Eye.tsx +19 -0
- package/src/Icon/icons/EyeOpen.tsx +19 -0
- package/src/Icon/icons/Filter.tsx +19 -0
- package/src/Icon/icons/Home.tsx +5 -0
- package/src/Icon/icons/Image.tsx +19 -0
- package/src/Icon/icons/Pdf.tsx +19 -0
- package/src/Icon/icons/RadioButton.tsx +22 -0
- package/src/Icon/icons/Search.tsx +19 -0
- package/src/Icon/icons/StickyNote.tsx +19 -0
- package/src/Icon/icons/Times.tsx +19 -0
- package/src/Icon/icons/User.tsx +19 -0
- package/src/Icon/icons/XCircle.tsx +19 -0
- package/src/Icon/index.tsx +5 -0
- package/src/Icon/type.tsx +37 -0
- package/src/Input/Input.md +51 -0
- package/src/Input/Input.tsx +134 -0
- package/src/Input/InputFile.tsx +320 -0
- package/src/Input/InputMonth.tsx +1 -0
- package/src/Input/InputNumber.tsx +0 -0
- package/src/Input/InputOtp.tsx +96 -0
- package/src/Input/InputPassword.tsx +31 -0
- package/src/Input/InputSelect.tsx +5 -0
- package/src/Input/Switch.tsx +111 -0
- package/src/Input/TextArea.tsx +67 -0
- package/src/Input/assets/Ilustrasi.svg +14 -0
- package/src/Input/assets/input-file.png +0 -0
- package/src/Input/type.tsx +19 -0
- package/src/Label/Label.tsx +119 -0
- package/src/LabelForm/LabelForm.tsx +12 -0
- package/src/List/List.tsx +31 -0
- package/src/List/ListItem.tsx +34 -0
- package/src/List/type.tsx +14 -0
- package/src/Loading/Loading.tsx +56 -0
- package/src/Modal/Modal.tsx +179 -0
- package/src/NativeRnKit.ts +8 -0
- package/src/Provider/FooterProvider.tsx +26 -0
- package/src/Provider/LayoutWithFooter.tsx +27 -0
- package/src/Provider/Provider.tsx +53 -0
- package/src/Provider/RequiredUpdateAppsProvider.tsx +58 -0
- package/src/Provider/type.tsx +6 -0
- package/src/RadioButton/README.md +43 -0
- package/src/RadioButton/RadioButton.tsx +119 -0
- package/src/Select/README.md +78 -0
- package/src/Select/README_Select.md +78 -0
- package/src/Select/Select.tsx +115 -0
- package/src/Select/type.tsx +30 -0
- package/src/Step/Step.tsx +92 -0
- package/src/Step/StepItem.tsx +86 -0
- package/src/Step/type.tsx +18 -0
- package/src/SwitchButton/SwitchButton.tsx +5 -0
- package/src/TextArea/TextArea.tsx +0 -0
- package/src/Theme/Theme.tsx +28 -0
- package/src/Timeline/Timeline.tsx +9 -0
- package/src/Timeline/TimelineItem.tsx +63 -0
- package/src/Toast/Toast.tsx +179 -0
- package/src/Toast/ToastContext.tsx +51 -0
- package/src/Typography/README.md +71 -0
- package/src/Typography/Typography.tsx +44 -0
- package/src/Typography/type.tsx +60 -0
- package/src/Ui/Card.tsx +70 -0
- package/src/Ui/Center.tsx +20 -0
- package/src/Ui/Col.tsx +17 -0
- package/src/Ui/Container.tsx +12 -0
- package/src/Ui/Devider.tsx +15 -0
- package/src/Ui/Footer.tsx +37 -0
- package/src/Ui/Gap.tsx +8 -0
- package/src/Ui/Grid.tsx +36 -0
- package/src/index.tsx +68 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { View, StyleSheet, TouchableOpacity, Pressable } from 'react-native';
|
|
3
|
+
import Color from '../Color/Color';
|
|
4
|
+
import type {
|
|
5
|
+
CalendarTypes,
|
|
6
|
+
DayNameTuple,
|
|
7
|
+
MarkedDate,
|
|
8
|
+
WeekDay,
|
|
9
|
+
} from './CalendarPropsType';
|
|
10
|
+
import Icon from '../Icon';
|
|
11
|
+
import Typography from '../Typography/Typography';
|
|
12
|
+
import Dropdown from '../DropDown/DropDown';
|
|
13
|
+
import {
|
|
14
|
+
generateMonthOptions,
|
|
15
|
+
generateYearOptions,
|
|
16
|
+
} from '../DatePicker/helpers';
|
|
17
|
+
|
|
18
|
+
const DAYS: DayNameTuple = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
19
|
+
|
|
20
|
+
const DEFAULT_SELECTED_BACKGROUND_COLOR = Color.primary[1000];
|
|
21
|
+
const DEFAULT_SELECTED_TEXT_COLOR = Color.base.white100;
|
|
22
|
+
const DEFAULT_DISABLED_BACKGROUND_COLOR = Color.base.white100;
|
|
23
|
+
const DEFAULT_DISABLED_TEXT_COLOR = Color.gray[400];
|
|
24
|
+
|
|
25
|
+
const Calendar = ({
|
|
26
|
+
markedDates = {},
|
|
27
|
+
disabledDays,
|
|
28
|
+
minDate = null,
|
|
29
|
+
maxDate = null,
|
|
30
|
+
mode = 'single',
|
|
31
|
+
onChange,
|
|
32
|
+
selectedBackgroundColor = DEFAULT_SELECTED_BACKGROUND_COLOR,
|
|
33
|
+
selectedTextColor = DEFAULT_SELECTED_TEXT_COLOR,
|
|
34
|
+
disabledBackgroundColor = DEFAULT_DISABLED_BACKGROUND_COLOR,
|
|
35
|
+
disabledTextColor = DEFAULT_DISABLED_TEXT_COLOR,
|
|
36
|
+
dayName = DAYS,
|
|
37
|
+
}: CalendarTypes) => {
|
|
38
|
+
const [currentDate, setCurrentDate] = useState(new Date());
|
|
39
|
+
const [startDate, setStartDate] = useState<Date | null>(null);
|
|
40
|
+
const [endDate, setEndDate] = useState<Date | null>(null);
|
|
41
|
+
|
|
42
|
+
const getDaysInMonth = (month: number, year: number) =>
|
|
43
|
+
new Date(year, month + 1, 0).getDate();
|
|
44
|
+
|
|
45
|
+
const formatDateKey = (date: Date) => {
|
|
46
|
+
const year = date.getFullYear();
|
|
47
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
48
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
49
|
+
return `${year}-${month}-${day}`;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const generateCalendarMatrix = () => {
|
|
53
|
+
const matrix = [];
|
|
54
|
+
const year = currentDate.getFullYear();
|
|
55
|
+
const month = currentDate.getMonth();
|
|
56
|
+
const firstDay = new Date(year, month, 1).getDay();
|
|
57
|
+
const maxDays = getDaysInMonth(month, year);
|
|
58
|
+
const prevMonth = month === 0 ? 11 : month - 1;
|
|
59
|
+
const prevYear = month === 0 ? year - 1 : year;
|
|
60
|
+
const prevMonthDays = getDaysInMonth(prevMonth, prevYear);
|
|
61
|
+
|
|
62
|
+
let row = [];
|
|
63
|
+
|
|
64
|
+
// prev month
|
|
65
|
+
for (let i = 0; i < firstDay; i++) {
|
|
66
|
+
const day = prevMonthDays - firstDay + i + 1;
|
|
67
|
+
row.push({
|
|
68
|
+
date: new Date(prevYear, prevMonth, day),
|
|
69
|
+
from: 'prev',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// current month
|
|
74
|
+
for (let day = 1; day <= maxDays; day++) {
|
|
75
|
+
row.push({
|
|
76
|
+
date: new Date(year, month, day),
|
|
77
|
+
from: 'current',
|
|
78
|
+
});
|
|
79
|
+
if (row.length === 7) {
|
|
80
|
+
matrix.push(row);
|
|
81
|
+
row = [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// next month
|
|
86
|
+
let nextDay = 1;
|
|
87
|
+
const nextMonth = month === 11 ? 0 : month + 1;
|
|
88
|
+
const nextYear = month === 11 ? year + 1 : year;
|
|
89
|
+
if (row.length > 0) {
|
|
90
|
+
while (row.length < 7) {
|
|
91
|
+
row.push({
|
|
92
|
+
date: new Date(nextYear, nextMonth, nextDay),
|
|
93
|
+
from: 'next',
|
|
94
|
+
});
|
|
95
|
+
nextDay++;
|
|
96
|
+
}
|
|
97
|
+
matrix.push(row);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return matrix;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const normalizeDate = (date: Date) => {
|
|
104
|
+
const d = new Date(date);
|
|
105
|
+
d.setHours(0, 0, 0, 0);
|
|
106
|
+
return d;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const goToNextMonth = () => {
|
|
110
|
+
const newDate = new Date(currentDate);
|
|
111
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
112
|
+
setCurrentDate(newDate);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const goToPrevMonth = () => {
|
|
116
|
+
const newDate = new Date(currentDate);
|
|
117
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
118
|
+
setCurrentDate(newDate);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const handleOnSelectYearDropdown = (value: string | number) => {
|
|
122
|
+
const newDate = new Date(currentDate);
|
|
123
|
+
newDate.setFullYear(Number(value));
|
|
124
|
+
setCurrentDate(newDate);
|
|
125
|
+
};
|
|
126
|
+
const handleOnSelectMonthDropdown = (value: string | number) => {
|
|
127
|
+
const newDate = new Date(currentDate);
|
|
128
|
+
newDate.setMonth(value as number);
|
|
129
|
+
setCurrentDate(newDate);
|
|
130
|
+
};
|
|
131
|
+
const isWeekDay = (day: number): day is WeekDay => day >= 0 && day <= 6;
|
|
132
|
+
|
|
133
|
+
const isDisabledDate = (date: Date) => {
|
|
134
|
+
const dayOfWeek = date.getDay();
|
|
135
|
+
if (isWeekDay(dayOfWeek) && disabledDays?.[dayOfWeek]) return true;
|
|
136
|
+
if (minDate && date < minDate) return true;
|
|
137
|
+
if (maxDate && date > maxDate) return true;
|
|
138
|
+
return false;
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const isSameDate = (a: Date | null, b: Date) =>
|
|
142
|
+
!!a && a.getTime() === b.getTime();
|
|
143
|
+
|
|
144
|
+
const isDateInRange = (date: Date) =>
|
|
145
|
+
startDate && endDate && date >= startDate && date <= endDate;
|
|
146
|
+
|
|
147
|
+
const isMarkDisableDate = (mark: MarkedDate | undefined) => !!mark?.disabled;
|
|
148
|
+
|
|
149
|
+
const setBackgroundDay = (date: Date, keyWeek: WeekDay) => {
|
|
150
|
+
const key = formatDateKey(date);
|
|
151
|
+
const mark = markedDates[key];
|
|
152
|
+
const inRange = isDateInRange(date);
|
|
153
|
+
const isStart = isSameDate(startDate, date);
|
|
154
|
+
const isEnd = isSameDate(endDate, date);
|
|
155
|
+
if (disabledDays && disabledDays[keyWeek]) {
|
|
156
|
+
return typeof disabledDays[keyWeek] === 'object' &&
|
|
157
|
+
disabledDays[keyWeek].hasOwnProperty('backgroundColor')
|
|
158
|
+
? disabledDays[keyWeek].backgroundColor!
|
|
159
|
+
: disabledBackgroundColor;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (isDisabledDate(date)) return disabledBackgroundColor;
|
|
163
|
+
if (
|
|
164
|
+
(mode === 'single' && isStart) ||
|
|
165
|
+
(mode === 'range' && (isStart || isEnd))
|
|
166
|
+
) {
|
|
167
|
+
return selectedBackgroundColor;
|
|
168
|
+
}
|
|
169
|
+
if (mark?.selected) return mark.backgroundColor || selectedBackgroundColor;
|
|
170
|
+
if (inRange) return Color.primary[50];
|
|
171
|
+
return 'white';
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const setTextColor = (date: Date, keyWeek: WeekDay) => {
|
|
175
|
+
const key = formatDateKey(date);
|
|
176
|
+
const mark = markedDates[key];
|
|
177
|
+
const isStart = isSameDate(startDate, date);
|
|
178
|
+
const isEnd = isSameDate(endDate, date);
|
|
179
|
+
|
|
180
|
+
if (disabledDays && disabledDays[keyWeek]) {
|
|
181
|
+
return typeof disabledDays[keyWeek] === 'object' &&
|
|
182
|
+
disabledDays[keyWeek].hasOwnProperty('textColor')
|
|
183
|
+
? disabledDays[keyWeek].textColor!
|
|
184
|
+
: disabledTextColor;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (isDisabledDate(date)) return disabledTextColor;
|
|
188
|
+
if (
|
|
189
|
+
(mode === 'single' && isStart) ||
|
|
190
|
+
(mode === 'range' && (isStart || isEnd))
|
|
191
|
+
) {
|
|
192
|
+
return selectedTextColor;
|
|
193
|
+
}
|
|
194
|
+
if (mark?.selected) return mark?.textColor || selectedTextColor;
|
|
195
|
+
return Color.gray[600];
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const handlePressDay = (date: Date) => {
|
|
199
|
+
const selected = normalizeDate(date);
|
|
200
|
+
if (mode === 'single') {
|
|
201
|
+
setStartDate(selected);
|
|
202
|
+
setEndDate(null);
|
|
203
|
+
onChange?.({ date: selected });
|
|
204
|
+
} else {
|
|
205
|
+
if (!startDate || (startDate && endDate)) {
|
|
206
|
+
setStartDate(selected);
|
|
207
|
+
setEndDate(null);
|
|
208
|
+
onChange?.({ startDate: selected, endDate: null });
|
|
209
|
+
} else if (selected >= startDate) {
|
|
210
|
+
setEndDate(selected);
|
|
211
|
+
onChange?.({ startDate, endDate: selected });
|
|
212
|
+
} else {
|
|
213
|
+
setStartDate(selected);
|
|
214
|
+
setEndDate(null);
|
|
215
|
+
onChange?.({ startDate: selected, endDate: null });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const calendarMatrix = generateCalendarMatrix();
|
|
221
|
+
const year = currentDate.getFullYear();
|
|
222
|
+
|
|
223
|
+
return (
|
|
224
|
+
<View style={styles.container}>
|
|
225
|
+
<View style={styles.header}>
|
|
226
|
+
<TouchableOpacity style={styles.buttonNav} onPress={goToPrevMonth}>
|
|
227
|
+
<Icon name="ArrowLeft" color={Color.base.white100} size={10} />
|
|
228
|
+
</TouchableOpacity>
|
|
229
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
|
|
230
|
+
<Dropdown
|
|
231
|
+
options={generateMonthOptions()}
|
|
232
|
+
onSelect={handleOnSelectMonthDropdown}
|
|
233
|
+
renderButton={
|
|
234
|
+
<View style={styles.containerDropDown}>
|
|
235
|
+
<Icon name="ArrowDown" size={10} />
|
|
236
|
+
<Typography
|
|
237
|
+
variant="t1"
|
|
238
|
+
weight="semibold"
|
|
239
|
+
color={Color.gray[900]}
|
|
240
|
+
>
|
|
241
|
+
{currentDate.toLocaleString('default', { month: 'long' })}
|
|
242
|
+
</Typography>
|
|
243
|
+
</View>
|
|
244
|
+
}
|
|
245
|
+
maxHeight={300}
|
|
246
|
+
/>
|
|
247
|
+
|
|
248
|
+
<Dropdown
|
|
249
|
+
options={generateYearOptions(2010, 2050, 0, 50)}
|
|
250
|
+
onSelect={handleOnSelectYearDropdown}
|
|
251
|
+
renderButton={
|
|
252
|
+
<View style={styles.containerDropDown}>
|
|
253
|
+
<Typography
|
|
254
|
+
variant="t1"
|
|
255
|
+
weight="semibold"
|
|
256
|
+
color={Color.gray[900]}
|
|
257
|
+
>
|
|
258
|
+
{year}
|
|
259
|
+
</Typography>
|
|
260
|
+
<Icon name="ArrowDown" size={10} />
|
|
261
|
+
</View>
|
|
262
|
+
}
|
|
263
|
+
maxHeight={200}
|
|
264
|
+
/>
|
|
265
|
+
</View>
|
|
266
|
+
<TouchableOpacity style={styles.buttonNav} onPress={goToNextMonth}>
|
|
267
|
+
<Icon name="ArrowRight" color={Color.base.white100} size={10} />
|
|
268
|
+
</TouchableOpacity>
|
|
269
|
+
</View>
|
|
270
|
+
|
|
271
|
+
<View style={styles.weekRow}>
|
|
272
|
+
{dayName.map((day, index) => (
|
|
273
|
+
<Typography
|
|
274
|
+
key={index}
|
|
275
|
+
weight="medium"
|
|
276
|
+
variant="t2"
|
|
277
|
+
center
|
|
278
|
+
color={Color.gray[600]}
|
|
279
|
+
style={{ width: 32, textAlign: 'center' }}
|
|
280
|
+
>
|
|
281
|
+
{day}
|
|
282
|
+
</Typography>
|
|
283
|
+
))}
|
|
284
|
+
</View>
|
|
285
|
+
|
|
286
|
+
{calendarMatrix.map((week, rowIndex) => (
|
|
287
|
+
<View key={rowIndex} style={styles.weekRow}>
|
|
288
|
+
{week.map((cell, colIndex) => {
|
|
289
|
+
const date = cell.date;
|
|
290
|
+
const day = date.getDate();
|
|
291
|
+
const key = formatDateKey(date);
|
|
292
|
+
const mark = markedDates[key];
|
|
293
|
+
|
|
294
|
+
const disabled = isMarkDisableDate(mark) || isDisabledDate(date);
|
|
295
|
+
const backgroundColor = setBackgroundDay(date, colIndex as WeekDay);
|
|
296
|
+
const textColor = setTextColor(date, colIndex as WeekDay);
|
|
297
|
+
return (
|
|
298
|
+
<Pressable
|
|
299
|
+
disabled={disabled}
|
|
300
|
+
key={key}
|
|
301
|
+
onPress={() => handlePressDay(date)}
|
|
302
|
+
>
|
|
303
|
+
<View style={[styles.dayCell, { backgroundColor }]}>
|
|
304
|
+
<Typography variant="t2" weight="medium" color={textColor}>
|
|
305
|
+
{day}
|
|
306
|
+
</Typography>
|
|
307
|
+
</View>
|
|
308
|
+
<View style={styles.baseDot}>
|
|
309
|
+
{mark?.dots && Array.isArray(mark.dots) && (
|
|
310
|
+
<View style={styles.dotsContainer}>
|
|
311
|
+
{mark.dots.map((dot: string, index: number) => {
|
|
312
|
+
const dotColor = (mark.selected && dot) || dot || 'red';
|
|
313
|
+
return (
|
|
314
|
+
<View
|
|
315
|
+
key={index}
|
|
316
|
+
style={[styles.dot, { backgroundColor: dotColor }]}
|
|
317
|
+
/>
|
|
318
|
+
);
|
|
319
|
+
})}
|
|
320
|
+
</View>
|
|
321
|
+
)}
|
|
322
|
+
</View>
|
|
323
|
+
</Pressable>
|
|
324
|
+
);
|
|
325
|
+
})}
|
|
326
|
+
</View>
|
|
327
|
+
))}
|
|
328
|
+
</View>
|
|
329
|
+
);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
const styles = StyleSheet.create({
|
|
333
|
+
container: {},
|
|
334
|
+
header: {
|
|
335
|
+
flexDirection: 'row',
|
|
336
|
+
justifyContent: 'space-between',
|
|
337
|
+
alignItems: 'center',
|
|
338
|
+
marginBottom: 10,
|
|
339
|
+
height: 56,
|
|
340
|
+
gap: 8,
|
|
341
|
+
},
|
|
342
|
+
weekRow: {
|
|
343
|
+
flexDirection: 'row',
|
|
344
|
+
justifyContent: 'space-between',
|
|
345
|
+
marginBottom: 4,
|
|
346
|
+
},
|
|
347
|
+
dayCell: {
|
|
348
|
+
alignItems: 'center',
|
|
349
|
+
justifyContent: 'center',
|
|
350
|
+
height: 32,
|
|
351
|
+
width: 32,
|
|
352
|
+
borderRadius: 50,
|
|
353
|
+
margin: 1,
|
|
354
|
+
},
|
|
355
|
+
buttonNav: {
|
|
356
|
+
backgroundColor: Color.gray[500],
|
|
357
|
+
borderRadius: 8,
|
|
358
|
+
padding: 8,
|
|
359
|
+
},
|
|
360
|
+
baseDot: {
|
|
361
|
+
height: 10,
|
|
362
|
+
marginBottom: 5,
|
|
363
|
+
},
|
|
364
|
+
dotsContainer: {
|
|
365
|
+
flexDirection: 'row',
|
|
366
|
+
justifyContent: 'center',
|
|
367
|
+
marginTop: 2,
|
|
368
|
+
},
|
|
369
|
+
dot: {
|
|
370
|
+
width: 6,
|
|
371
|
+
height: 6,
|
|
372
|
+
borderRadius: 3,
|
|
373
|
+
marginHorizontal: 1,
|
|
374
|
+
},
|
|
375
|
+
containerDropDown: {
|
|
376
|
+
flexDirection: 'row',
|
|
377
|
+
gap: 8,
|
|
378
|
+
alignItems: 'center',
|
|
379
|
+
},
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
export default Calendar;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type CalendarMatrix = number[][];
|
|
4
|
+
|
|
5
|
+
export type DisabledDayStyle = {
|
|
6
|
+
backgroundColor?: string | undefined;
|
|
7
|
+
textColor?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
11
|
+
|
|
12
|
+
export type DateProps = Date | undefined | null;
|
|
13
|
+
|
|
14
|
+
export type DateRangeProps = {
|
|
15
|
+
startDate?: DateProps;
|
|
16
|
+
endDate?: DateProps;
|
|
17
|
+
date?: DateProps;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type CalendarDisabledProp = {
|
|
21
|
+
backgroundColor?: string | undefined;
|
|
22
|
+
textColor?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type MarkedDate = {
|
|
26
|
+
selected?: boolean;
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
textColor?: string;
|
|
29
|
+
disabled?: CalendarDisabledProp | boolean;
|
|
30
|
+
dots?: string[];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type DayNameTuple = [
|
|
34
|
+
string,
|
|
35
|
+
string,
|
|
36
|
+
string,
|
|
37
|
+
string,
|
|
38
|
+
string,
|
|
39
|
+
string,
|
|
40
|
+
string,
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
export interface CalendarTypes {
|
|
44
|
+
mode?: 'single' | 'range';
|
|
45
|
+
markedDates?: {
|
|
46
|
+
[date: string]: MarkedDate;
|
|
47
|
+
};
|
|
48
|
+
minDate?: Date | null;
|
|
49
|
+
maxDate?: Date | null;
|
|
50
|
+
onPress?: (event: GestureResponderEvent) => void;
|
|
51
|
+
onChange?: (value: DateRangeProps) => void;
|
|
52
|
+
selectedBackgroundColor?: string;
|
|
53
|
+
selectedTextColor?: string;
|
|
54
|
+
disabledBackgroundColor?: string;
|
|
55
|
+
disabledTextColor?: string;
|
|
56
|
+
disabledDays?: {
|
|
57
|
+
[day in WeekDay]?: boolean | DisabledDayStyle;
|
|
58
|
+
};
|
|
59
|
+
dayName?: DayNameTuple;
|
|
60
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# 📆 Komponen Kalender Kustom (React Native)
|
|
2
|
+
|
|
3
|
+
Komponen kalender ini dibuat menggunakan React Native dan memungkinkan pengguna untuk memilih tanggal tunggal maupun rentang tanggal, serta mendukung fitur penandaan dan pembatasan tanggal.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Fitur Utama
|
|
8
|
+
|
|
9
|
+
- Tampilan kalender bulanan
|
|
10
|
+
- Pilihan mode: tanggal tunggal (`single`) atau rentang tanggal (`range`)
|
|
11
|
+
- Menandai tanggal dengan warna atau indikator
|
|
12
|
+
- Menonaktifkan tanggal tertentu atau hari-hari tertentu (misalnya hanya aktif Senin–Jumat)
|
|
13
|
+
- Navigasi antar bulan
|
|
14
|
+
- Batas minimum dan maksimum tanggal yang bisa dipilih
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🧩 Props (Properti)
|
|
19
|
+
|
|
20
|
+
| Prop | Tipe Data | Nilai Contoh / Opsi | Keterangan |
|
|
21
|
+
| ------------------------- | -------------------------------------- | ----------------------------------------------------- | --------------------------------------------------------- |
|
|
22
|
+
| `mode` | `'single'` \| `'range'` | `'single'` (default), `'range'` | Menentukan apakah memilih 1 tanggal atau rentang tanggal |
|
|
23
|
+
| `markedDates` | `object` | `{ '2025-06-10': { marked: true, dotColor: 'red' } }` | Untuk menandai tanggal tertentu |
|
|
24
|
+
| `disabledDates` | `string[]` | `['2025-06-10', '2025-06-11']` | Tanggal yang tidak bisa dipilih |
|
|
25
|
+
| `disabledDays` | `{ [key: number]: boolean }` | `{ 0: true, 6: true }` | Menonaktifkan hari dalam seminggu (0 = Minggu, 6 = Sabtu) |
|
|
26
|
+
| `minDate` | `Date` | `new Date(2025, 5, 1)` | Tanggal paling awal yang bisa dipilih |
|
|
27
|
+
| `maxDate` | `Date` | `new Date(2025, 5, 30)` | Tanggal paling akhir yang bisa dipilih |
|
|
28
|
+
| `onChange` | `(date: Date \| [Date, Date]) => void` | — | Fungsi callback saat tanggal dipilih |
|
|
29
|
+
| `selectedBackgroundColor` | `string` (CSS color) | `'#0f62fe'` | Warna latar belakang tanggal yang dipilih |
|
|
30
|
+
| `selectedTextColor` | `string` (CSS color) | `'#ffffff'` | Warna teks pada tanggal yang dipilih |
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 📦 Instalasi
|
|
36
|
+
|
|
37
|
+
Komponen ini bersifat kustom dan belum tersedia sebagai package npm. Salin file `Calendar.tsx` ke dalam proyek React Native-mu.
|
|
38
|
+
|
|
39
|
+
### Kebutuhan:
|
|
40
|
+
- React Native
|
|
41
|
+
- TypeScript (opsional, tapi direkomendasikan)
|
|
42
|
+
- `dayjs` sebagai pengganti `moment.js` jika diperlukan
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 🧠 Contoh Penggunaan
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import React from 'react';
|
|
50
|
+
import Calendar from './Calendar';
|
|
51
|
+
|
|
52
|
+
export default function App() {
|
|
53
|
+
const handleDateChange = (date: Date | [Date, Date]) => {
|
|
54
|
+
console.log('Tanggal dipilih:', date);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Calendar
|
|
59
|
+
mode="range"
|
|
60
|
+
markedDates={{
|
|
61
|
+
'2025-06-10': { selected: true },
|
|
62
|
+
'2025-06-11': { marked: true, dotColor: 'red' },
|
|
63
|
+
}}
|
|
64
|
+
disabledDates={['2025-06-15']}
|
|
65
|
+
disabledDays={{ 0: true, 6: true }} // Nonaktifkan Minggu dan Sabtu
|
|
66
|
+
minDate={new Date(2025, 5, 1)} // 1 Juni 2025
|
|
67
|
+
maxDate={new Date(2025, 5, 30)} // 30 Juni 2025
|
|
68
|
+
onChange={handleDateChange}
|
|
69
|
+
selectedBackgroundColor="#0f62fe"
|
|
70
|
+
selectedTextColor="#fff"
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Pressable, View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import { Color, Icon } from '@herca/rn-kit'; // Pastikan Icon sudah tersedia
|
|
4
|
+
|
|
5
|
+
interface CheckBoxProps {
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
onChange?: (checked: boolean) => void;
|
|
8
|
+
label?: string | React.ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
renderLabel?: () => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const CheckBox: React.FC<CheckBoxProps> = ({
|
|
14
|
+
checked = false,
|
|
15
|
+
onChange,
|
|
16
|
+
label,
|
|
17
|
+
disabled = false,
|
|
18
|
+
renderLabel,
|
|
19
|
+
}) => {
|
|
20
|
+
const [value, setValue] = useState<boolean>(false);
|
|
21
|
+
|
|
22
|
+
const handlePress = () => {
|
|
23
|
+
const newValue = !value;
|
|
24
|
+
setValue(newValue);
|
|
25
|
+
onChange?.(newValue);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
setValue(checked);
|
|
30
|
+
}, [checked]);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Pressable
|
|
34
|
+
onPress={() => !disabled && handlePress()}
|
|
35
|
+
style={styles.container}
|
|
36
|
+
>
|
|
37
|
+
<View
|
|
38
|
+
style={[
|
|
39
|
+
styles.checkBox,
|
|
40
|
+
value && styles.checked,
|
|
41
|
+
disabled && styles.disabled,
|
|
42
|
+
]}
|
|
43
|
+
>
|
|
44
|
+
{value && <Icon name="Check" size={14} color={Color.base.white100} />}
|
|
45
|
+
</View>
|
|
46
|
+
{label && <Text style={styles.label}>{label}</Text>}
|
|
47
|
+
{renderLabel?.()}
|
|
48
|
+
</Pressable>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const styles = StyleSheet.create({
|
|
53
|
+
container: {
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
},
|
|
57
|
+
checkBox: {
|
|
58
|
+
width: 20,
|
|
59
|
+
height: 20,
|
|
60
|
+
borderWidth: 2,
|
|
61
|
+
borderColor: Color.gray[500],
|
|
62
|
+
justifyContent: 'center',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
borderRadius: 4,
|
|
65
|
+
marginRight: 8,
|
|
66
|
+
},
|
|
67
|
+
checked: {
|
|
68
|
+
backgroundColor: Color.primary[1000],
|
|
69
|
+
borderColor: Color.primary[1000],
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
opacity: 0.5,
|
|
73
|
+
},
|
|
74
|
+
label: {
|
|
75
|
+
fontSize: 14,
|
|
76
|
+
color: '#333',
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export default CheckBox;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import { Typography, Color, CheckBox } from '@herca/rn-kit';
|
|
4
|
+
|
|
5
|
+
interface CheckBoxListItem {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface CheckBoxListProps {
|
|
11
|
+
items: CheckBoxListItem[];
|
|
12
|
+
selectedValues: string[];
|
|
13
|
+
onChange: (selected: string[]) => void;
|
|
14
|
+
direction?: 'vertical' | 'horizontal';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const CheckBoxList: React.FC<CheckBoxListProps> = ({
|
|
18
|
+
items,
|
|
19
|
+
selectedValues,
|
|
20
|
+
onChange,
|
|
21
|
+
direction = 'vertical',
|
|
22
|
+
}) => {
|
|
23
|
+
const toggleValue = (value: string) => {
|
|
24
|
+
const newSelected = selectedValues.includes(value)
|
|
25
|
+
? selectedValues.filter((v) => v !== value)
|
|
26
|
+
: [...selectedValues, value];
|
|
27
|
+
|
|
28
|
+
onChange(newSelected);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<View
|
|
33
|
+
style={[
|
|
34
|
+
styles.container,
|
|
35
|
+
direction === 'horizontal' && styles.horizontal,
|
|
36
|
+
]}
|
|
37
|
+
>
|
|
38
|
+
{items.map((item) => (
|
|
39
|
+
<CheckBox
|
|
40
|
+
key={item.value}
|
|
41
|
+
checked={selectedValues.includes(item.value)}
|
|
42
|
+
onChange={() => toggleValue(item.value)}
|
|
43
|
+
renderLabel={() => (
|
|
44
|
+
<Typography variant="t2" weight="medium" color={Color.gray[800]}>
|
|
45
|
+
{item.label}
|
|
46
|
+
</Typography>
|
|
47
|
+
)}
|
|
48
|
+
/>
|
|
49
|
+
))}
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const styles = StyleSheet.create({
|
|
55
|
+
container: {
|
|
56
|
+
gap: 12,
|
|
57
|
+
},
|
|
58
|
+
horizontal: {
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
flexWrap: 'wrap',
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export default CheckBoxList;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 📦 Komponen CheckBox
|
|
2
|
+
|
|
3
|
+
Komponen `CheckBox` digunakan untuk menampilkan input kotak centang (checkbox) interaktif dalam aplikasi React Native Anda.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✅ Fitur Utama
|
|
8
|
+
|
|
9
|
+
- Centang dan hilangkan centang (toggle)
|
|
10
|
+
- Dukungan label teks atau komponen kustom
|
|
11
|
+
- Dapat dinonaktifkan (`disabled`)
|
|
12
|
+
- Dukungan ikon (dengan komponen `Icon`)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🚀 Cara Penggunaan
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import React, { useState } from 'react';
|
|
20
|
+
import { View } from 'react-native';
|
|
21
|
+
import CheckBox from './CheckBox';
|
|
22
|
+
|
|
23
|
+
export default function App() {
|
|
24
|
+
const [isChecked, setIsChecked] = useState(false);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View>
|
|
28
|
+
<CheckBox
|
|
29
|
+
checked={isChecked}
|
|
30
|
+
onChange={setIsChecked}
|
|
31
|
+
label="Saya menyetujui syarat dan ketentuan"
|
|
32
|
+
/>
|
|
33
|
+
</View>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
##⚙️ Props
|
|
39
|
+
|
|
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 \\ | React.ReactNode\` | Label teks atau komponen yang ditampilkan di samping checkbox. |
|
|
45
|
+
| `disabled` | `boolean` | Jika `true`, checkbox tidak bisa ditekan. Default: `false`. | |
|
|
46
|
+
| `renderLabel` | `() => React.ReactNode` | Alternatif render untuk label kustom selain `label`. | |
|