@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,135 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet } from 'react-native';
|
|
3
|
+
import Color from '../Color/Color';
|
|
4
|
+
import Typography from '../Typography/Typography';
|
|
5
|
+
import type { TypographyVariantProps } from '../Typography/type';
|
|
6
|
+
|
|
7
|
+
type Variant =
|
|
8
|
+
| 'default'
|
|
9
|
+
| 'primary'
|
|
10
|
+
| 'info'
|
|
11
|
+
| 'success'
|
|
12
|
+
| 'warning'
|
|
13
|
+
| 'danger'
|
|
14
|
+
| 'orange'
|
|
15
|
+
| 'purple';
|
|
16
|
+
|
|
17
|
+
type Size = 'small' | 'medium';
|
|
18
|
+
interface BadgeProps {
|
|
19
|
+
value?: string | number | React.ReactNode;
|
|
20
|
+
color: Variant;
|
|
21
|
+
size?: Size;
|
|
22
|
+
variant?: Variant;
|
|
23
|
+
dot?: boolean;
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const COLORS: Record<Variant, { background: string; fontColor: string }> = {
|
|
28
|
+
default: { background: Color.gray[100], fontColor: Color.gray[800] },
|
|
29
|
+
primary: { background: Color.primary[50], fontColor: Color.primary[1000] },
|
|
30
|
+
success: { background: Color.success[50], fontColor: Color.success[500] },
|
|
31
|
+
info: { background: Color.info[50], fontColor: Color.info[500] },
|
|
32
|
+
danger: { background: Color.danger[50], fontColor: Color.danger[600] },
|
|
33
|
+
warning: { background: Color.warning[50], fontColor: Color.warning[300] },
|
|
34
|
+
orange: { background: Color.orange[50], fontColor: Color.orange[500] },
|
|
35
|
+
purple: { background: Color.purple[50], fontColor: Color.purple[500] },
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
interface SizeStyle {
|
|
39
|
+
height: number;
|
|
40
|
+
fontSize: TypographyVariantProps;
|
|
41
|
+
paddingHorizontal: number;
|
|
42
|
+
paddingVertical: number;
|
|
43
|
+
borderRadius: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const SIZE_MAP: Record<Size, SizeStyle> = {
|
|
47
|
+
small: {
|
|
48
|
+
height: 18,
|
|
49
|
+
fontSize: 't3',
|
|
50
|
+
paddingHorizontal: 4,
|
|
51
|
+
paddingVertical: 2,
|
|
52
|
+
borderRadius: 4,
|
|
53
|
+
},
|
|
54
|
+
medium: {
|
|
55
|
+
height: 32,
|
|
56
|
+
fontSize: 't1',
|
|
57
|
+
paddingHorizontal: 10,
|
|
58
|
+
paddingVertical: 4,
|
|
59
|
+
borderRadius: 8,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const Badge: React.FC<BadgeProps> = ({
|
|
63
|
+
value,
|
|
64
|
+
size = 'medium',
|
|
65
|
+
color = 'default',
|
|
66
|
+
dot = false,
|
|
67
|
+
children,
|
|
68
|
+
}) => {
|
|
69
|
+
const safeSize: Size = ['small', 'medium'].includes(size) ? size : 'medium';
|
|
70
|
+
const { background, fontColor } = COLORS[color];
|
|
71
|
+
const { height, paddingHorizontal, paddingVertical, borderRadius } =
|
|
72
|
+
SIZE_MAP[safeSize];
|
|
73
|
+
|
|
74
|
+
if (dot) {
|
|
75
|
+
return (
|
|
76
|
+
<View
|
|
77
|
+
style={[
|
|
78
|
+
styles.dot,
|
|
79
|
+
{
|
|
80
|
+
height: height,
|
|
81
|
+
paddingHorizontal: paddingHorizontal,
|
|
82
|
+
paddingVertical: paddingVertical,
|
|
83
|
+
borderRadius: borderRadius,
|
|
84
|
+
backgroundColor: background,
|
|
85
|
+
},
|
|
86
|
+
]}
|
|
87
|
+
/>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<View
|
|
93
|
+
style={[
|
|
94
|
+
styles.badge,
|
|
95
|
+
{
|
|
96
|
+
height: height,
|
|
97
|
+
borderRadius: 8,
|
|
98
|
+
backgroundColor: background,
|
|
99
|
+
paddingHorizontal: paddingHorizontal,
|
|
100
|
+
paddingVertical: paddingVertical,
|
|
101
|
+
},
|
|
102
|
+
]}
|
|
103
|
+
>
|
|
104
|
+
{children ? (
|
|
105
|
+
children
|
|
106
|
+
) : (
|
|
107
|
+
<Typography
|
|
108
|
+
color={fontColor}
|
|
109
|
+
variant={SIZE_MAP[safeSize].fontSize}
|
|
110
|
+
weight="medium"
|
|
111
|
+
>
|
|
112
|
+
{value}
|
|
113
|
+
</Typography>
|
|
114
|
+
)}
|
|
115
|
+
</View>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const styles = StyleSheet.create({
|
|
120
|
+
badge: {
|
|
121
|
+
justifyContent: 'center',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
alignSelf: 'flex-start',
|
|
124
|
+
flexWrap: 'wrap',
|
|
125
|
+
},
|
|
126
|
+
text: {
|
|
127
|
+
fontWeight: 'bold',
|
|
128
|
+
textAlign: 'center',
|
|
129
|
+
},
|
|
130
|
+
dot: {
|
|
131
|
+
alignSelf: 'flex-start',
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export default Badge;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# 🔖 Badge Component
|
|
2
|
+
|
|
3
|
+
Komponen `Badge` digunakan untuk menampilkan label kecil yang memberikan informasi tambahan seperti status atau notifikasi.
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## ✨ Fitur
|
|
7
|
+
|
|
8
|
+
- Mendukung warna varian seperti success, warning, danger, dll
|
|
9
|
+
- Dua ukuran tersedia: `small` dan `medium`
|
|
10
|
+
- Mode `dot` untuk hanya menampilkan titik status kecil
|
|
11
|
+
- Bisa menggunakan `children` untuk isi kustom atau gunakan `value` sebagai isi teks
|
|
12
|
+
|
|
13
|
+
## 🧱 Props
|
|
14
|
+
|
|
15
|
+
| Prop | Tipe | Default | Deskripsi |
|
|
16
|
+
|------------|--------------------------------------|-------------|------------------------------------------------------------|
|
|
17
|
+
| `value` | `string \\| number \\| ReactNode` | `undefined` | Nilai yang ditampilkan di badge jika `children` tidak ada |
|
|
18
|
+
| `color` | `'default' \\| 'primary' \\| ...` | `'default'` | Warna badge |
|
|
19
|
+
| `size` | `'small'` \\| `'medium'` | `'medium'` | Ukuran badge |
|
|
20
|
+
| `dot` | `boolean` | `false` | Jika `true`, hanya menampilkan titik kecil |
|
|
21
|
+
| `children` | `React.ReactNode` | `undefined` | Jika ada, akan menggantikan `value` sebagai isi badge |
|
|
22
|
+
|
|
23
|
+
## 🎨 Warna yang Tersedia
|
|
24
|
+
|
|
25
|
+
- `default`
|
|
26
|
+
- `primary`
|
|
27
|
+
- `success`
|
|
28
|
+
- `info`
|
|
29
|
+
- `warning`
|
|
30
|
+
- `danger`
|
|
31
|
+
- `orange`
|
|
32
|
+
- `purple`
|
|
33
|
+
|
|
34
|
+
## 📏 Ukuran Badge
|
|
35
|
+
|
|
36
|
+
| Ukuran | Tinggi | Font | PaddingHorizontal | PaddingVertical | BorderRadius |
|
|
37
|
+
|--------|--------|----------|-------------------|------------------|---------------|
|
|
38
|
+
| small | 18 | `t3` | 4 | 2 | 4 |
|
|
39
|
+
| medium | 24 | `t1` | 10 | 4 | 8 |
|
|
40
|
+
|
|
41
|
+
## 📦 Contoh Penggunaan
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import React from 'react';
|
|
45
|
+
import Badge from './Badge'; // sesuaikan path
|
|
46
|
+
|
|
47
|
+
export default function Example() {
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
{/* Badge dengan value */}
|
|
51
|
+
<Badge color="success" value="Aktif" />
|
|
52
|
+
|
|
53
|
+
{/* Badge dengan dot */}
|
|
54
|
+
<Badge color="danger" dot />
|
|
55
|
+
|
|
56
|
+
{/* Badge dengan children */}
|
|
57
|
+
<Badge color="warning">
|
|
58
|
+
<CustomComponent />
|
|
59
|
+
</Badge>
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
```
|
|
File without changes
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
PanResponder,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
Animated,
|
|
8
|
+
Modal,
|
|
9
|
+
KeyboardAvoidingView,
|
|
10
|
+
Keyboard,
|
|
11
|
+
Dimensions,
|
|
12
|
+
SafeAreaView,
|
|
13
|
+
Platform,
|
|
14
|
+
StatusBar,
|
|
15
|
+
type KeyboardEvent,
|
|
16
|
+
} from 'react-native';
|
|
17
|
+
import Container from '../Ui/Container';
|
|
18
|
+
import Typography from '../Typography/Typography';
|
|
19
|
+
import Color from '../Color/Color';
|
|
20
|
+
import type { BottomSheetHeighProps, BottomSheetProops } from './type';
|
|
21
|
+
|
|
22
|
+
const statusBarHeight =
|
|
23
|
+
Platform.OS === 'android' ? (StatusBar.currentHeight ?? 24) : 65;
|
|
24
|
+
const screenHeight = Dimensions.get('window').height;
|
|
25
|
+
const actualScreenHeight = screenHeight - statusBarHeight;
|
|
26
|
+
const DEFAULT_PADDING_BOTTOM = 40;
|
|
27
|
+
export default function BottomSheet({
|
|
28
|
+
isOpen,
|
|
29
|
+
onClose,
|
|
30
|
+
children,
|
|
31
|
+
backdrop = true,
|
|
32
|
+
closable = true,
|
|
33
|
+
onRequestClose,
|
|
34
|
+
buttonClose = false,
|
|
35
|
+
height,
|
|
36
|
+
pullBar,
|
|
37
|
+
footer,
|
|
38
|
+
}: BottomSheetProops) {
|
|
39
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
40
|
+
const [heightFooter, setHeightFooter] = useState(0);
|
|
41
|
+
const [heighContent, setHeighContent] =
|
|
42
|
+
useState<BottomSheetHeighProps>('auto');
|
|
43
|
+
const [maxHeight, setMaxHeight] =
|
|
44
|
+
useState<BottomSheetHeighProps>(actualScreenHeight);
|
|
45
|
+
const translateY = useRef(new Animated.Value(600)).current;
|
|
46
|
+
|
|
47
|
+
const panResponder = useRef(
|
|
48
|
+
PanResponder.create({
|
|
49
|
+
onStartShouldSetPanResponder: () => true,
|
|
50
|
+
onMoveShouldSetPanResponder: () => false,
|
|
51
|
+
onPanResponderMove: (_, gestureState) => {
|
|
52
|
+
if (gestureState.dy > 0) {
|
|
53
|
+
translateY.setValue(gestureState.dy);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
onPanResponderRelease: (_, gestureState) => {
|
|
57
|
+
if (closable && gestureState.dy > 50) {
|
|
58
|
+
handleRequestClose();
|
|
59
|
+
} else {
|
|
60
|
+
resetModalPosition();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
).current;
|
|
65
|
+
|
|
66
|
+
const hideModal = useCallback(() => {
|
|
67
|
+
if (closable) {
|
|
68
|
+
Animated.timing(translateY, {
|
|
69
|
+
toValue: 500,
|
|
70
|
+
duration: 300,
|
|
71
|
+
useNativeDriver: false,
|
|
72
|
+
}).start(() => {
|
|
73
|
+
setIsVisible(false);
|
|
74
|
+
onClose && onClose(false);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}, [closable, translateY, onClose]);
|
|
78
|
+
|
|
79
|
+
const showModal = useCallback(() => {
|
|
80
|
+
setIsVisible(true);
|
|
81
|
+
Animated.spring(translateY, {
|
|
82
|
+
toValue: 0,
|
|
83
|
+
useNativeDriver: false,
|
|
84
|
+
}).start();
|
|
85
|
+
}, [translateY]);
|
|
86
|
+
|
|
87
|
+
const handleRequestClose = (e?: any) => {
|
|
88
|
+
hideModal();
|
|
89
|
+
onRequestClose && onRequestClose(e);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const resetModalPosition = () => {
|
|
93
|
+
Animated.spring(translateY, {
|
|
94
|
+
toValue: 0,
|
|
95
|
+
useNativeDriver: false,
|
|
96
|
+
}).start();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (isOpen) {
|
|
101
|
+
showModal();
|
|
102
|
+
} else {
|
|
103
|
+
hideModal();
|
|
104
|
+
}
|
|
105
|
+
}, [isOpen, showModal, hideModal]);
|
|
106
|
+
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (height) {
|
|
109
|
+
setHeighContent(height);
|
|
110
|
+
}
|
|
111
|
+
}, [height]);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
const keyboardDidShowListener = Keyboard.addListener(
|
|
115
|
+
'keyboardDidShow',
|
|
116
|
+
(e: KeyboardEvent) => {
|
|
117
|
+
const keyboardHeight = e.endCoordinates?.height || 300;
|
|
118
|
+
setMaxHeight(screenHeight - statusBarHeight - keyboardHeight);
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const keyboardDidHideListener = Keyboard.addListener(
|
|
123
|
+
'keyboardDidHide',
|
|
124
|
+
() => {
|
|
125
|
+
setMaxHeight(screenHeight - statusBarHeight);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
return () => {
|
|
130
|
+
keyboardDidShowListener.remove();
|
|
131
|
+
keyboardDidHideListener.remove();
|
|
132
|
+
};
|
|
133
|
+
}, []);
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<Modal
|
|
137
|
+
transparent
|
|
138
|
+
visible={isVisible}
|
|
139
|
+
onRequestClose={handleRequestClose}
|
|
140
|
+
animationType="fade"
|
|
141
|
+
>
|
|
142
|
+
<View style={[styles.modalContainer, backdrop && styles.backdrop]}>
|
|
143
|
+
<TouchableOpacity
|
|
144
|
+
onPress={handleRequestClose}
|
|
145
|
+
activeOpacity={1}
|
|
146
|
+
style={styles.backdropTouchable}
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
<KeyboardAvoidingView
|
|
150
|
+
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
151
|
+
enabled
|
|
152
|
+
style={styles.keyboardAvoiding}
|
|
153
|
+
>
|
|
154
|
+
<Animated.View
|
|
155
|
+
style={[
|
|
156
|
+
styles.bottomSheet,
|
|
157
|
+
{
|
|
158
|
+
transform: [{ translateY }],
|
|
159
|
+
height: heighContent,
|
|
160
|
+
maxHeight: maxHeight,
|
|
161
|
+
paddingBottom: DEFAULT_PADDING_BOTTOM + heightFooter,
|
|
162
|
+
},
|
|
163
|
+
]}
|
|
164
|
+
>
|
|
165
|
+
{buttonClose && (
|
|
166
|
+
<TouchableOpacity
|
|
167
|
+
onPress={handleRequestClose}
|
|
168
|
+
style={styles.closeButton}
|
|
169
|
+
>
|
|
170
|
+
<Typography>x</Typography>
|
|
171
|
+
</TouchableOpacity>
|
|
172
|
+
)}
|
|
173
|
+
{closable && (
|
|
174
|
+
<View
|
|
175
|
+
{...panResponder.panHandlers}
|
|
176
|
+
style={styles.dragIndicatorContainer}
|
|
177
|
+
>
|
|
178
|
+
{pullBar ? pullBar : <View style={styles.dragIndicator} />}
|
|
179
|
+
</View>
|
|
180
|
+
)}
|
|
181
|
+
<SafeAreaView
|
|
182
|
+
style={[
|
|
183
|
+
styles.contentContainer,
|
|
184
|
+
...(footer ? [styles.contentWithFooter] : []),
|
|
185
|
+
]}
|
|
186
|
+
>
|
|
187
|
+
<Container>{children}</Container>
|
|
188
|
+
</SafeAreaView>
|
|
189
|
+
{footer && (
|
|
190
|
+
<SafeAreaView
|
|
191
|
+
onLayout={(event) => {
|
|
192
|
+
const { height } = event.nativeEvent.layout;
|
|
193
|
+
setHeightFooter(height);
|
|
194
|
+
}}
|
|
195
|
+
style={styles.footer}
|
|
196
|
+
>
|
|
197
|
+
<Container>{footer}</Container>
|
|
198
|
+
</SafeAreaView>
|
|
199
|
+
)}
|
|
200
|
+
</Animated.View>
|
|
201
|
+
</KeyboardAvoidingView>
|
|
202
|
+
</View>
|
|
203
|
+
</Modal>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const styles = StyleSheet.create({
|
|
208
|
+
modalContainer: {
|
|
209
|
+
flex: 1,
|
|
210
|
+
justifyContent: 'flex-end',
|
|
211
|
+
},
|
|
212
|
+
backdrop: {
|
|
213
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
214
|
+
},
|
|
215
|
+
backdropTouchable: {
|
|
216
|
+
flex: 1,
|
|
217
|
+
},
|
|
218
|
+
keyboardAvoiding: {
|
|
219
|
+
justifyContent: 'flex-end',
|
|
220
|
+
},
|
|
221
|
+
bottomSheet: {
|
|
222
|
+
backgroundColor: 'white',
|
|
223
|
+
borderTopLeftRadius: 16,
|
|
224
|
+
borderTopRightRadius: 16,
|
|
225
|
+
},
|
|
226
|
+
closeButton: {
|
|
227
|
+
position: 'absolute',
|
|
228
|
+
backgroundColor: 'white',
|
|
229
|
+
paddingVertical: 10,
|
|
230
|
+
paddingHorizontal: 14,
|
|
231
|
+
borderRadius: 50,
|
|
232
|
+
top: -50,
|
|
233
|
+
right: 24,
|
|
234
|
+
zIndex: 10,
|
|
235
|
+
},
|
|
236
|
+
dragIndicatorContainer: {
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
paddingBottom: 20,
|
|
239
|
+
},
|
|
240
|
+
dragIndicator: {
|
|
241
|
+
width: 70,
|
|
242
|
+
height: 5,
|
|
243
|
+
marginTop: 10,
|
|
244
|
+
borderRadius: 2,
|
|
245
|
+
backgroundColor: '#ccc',
|
|
246
|
+
},
|
|
247
|
+
contentContainer: {
|
|
248
|
+
flexGrow: 1,
|
|
249
|
+
},
|
|
250
|
+
contentWithFooter: {},
|
|
251
|
+
footer: {
|
|
252
|
+
backgroundColor: Color.base.white100,
|
|
253
|
+
position: 'absolute',
|
|
254
|
+
bottom: 0,
|
|
255
|
+
left: 0,
|
|
256
|
+
right: 0,
|
|
257
|
+
zIndex: 10,
|
|
258
|
+
},
|
|
259
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ⬆️ BottomSheet Component
|
|
2
|
+
|
|
3
|
+
Komponen `BottomSheet` adalah modal bawah (slide-up) untuk menampilkan konten dinamis, form, konfirmasi, dll, dengan berbagai fitur interaktif seperti gesture drag, keyboard-aware, dan customizable height.
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 📦 Props
|
|
9
|
+
|
|
10
|
+
| Prop | Tipe | Default | Deskripsi |
|
|
11
|
+
|------------------|----------------------------------|-------------|---------------------------------------------------------------------------|
|
|
12
|
+
| `isOpen` | `boolean` | - | Menentukan apakah bottom sheet sedang ditampilkan. |
|
|
13
|
+
| `onClose` | `(isOpen: boolean) => void` | - | Callback saat bottom sheet ditutup. |
|
|
14
|
+
| `children` | `React.ReactNode` | - | Konten utama dari bottom sheet. |
|
|
15
|
+
| `backdrop` | `boolean` | `true` | Menampilkan background semi-transparent. |
|
|
16
|
+
| `closable` | `boolean` | `true` | Menentukan apakah bisa ditutup dengan drag atau klik di luar. |
|
|
17
|
+
| `onRequestClose`| `(e: any) => void` | - | Dipanggil saat permintaan untuk menutup modal. |
|
|
18
|
+
| `buttonClose` | `boolean` | `false` | Menampilkan tombol X untuk menutup modal. |
|
|
19
|
+
| `height` | `number \| string` | `'auto'` | Tinggi dari konten bottom sheet. |
|
|
20
|
+
| `pullBar` | `React.ReactNode` | - | Custom elemen untuk drag indicator. |
|
|
21
|
+
| `footer` | `React.ReactNode` | - | Menambahkan elemen tetap di bawah konten. |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ✨ Fitur Unggulan
|
|
26
|
+
|
|
27
|
+
- Swipe-to-dismiss gesture (drag ke bawah)
|
|
28
|
+
- Keyboard aware (`KeyboardAvoidingView`)
|
|
29
|
+
- Responsif terhadap tampilan iOS dan Android
|
|
30
|
+
- `Animated.spring` untuk transisi yang halus
|
|
31
|
+
- Bisa dikontrol penuh lewat prop `isOpen`
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 📐 Contoh Penggunaan
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import React, { useState } from 'react';
|
|
41
|
+
import { Button, View } from 'react-native';
|
|
42
|
+
import BottomSheet from './BottomSheet';
|
|
43
|
+
|
|
44
|
+
export default function ExampleScreen() {
|
|
45
|
+
const [open, setOpen] = useState(false);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={{ flex: 1 }}>
|
|
49
|
+
<Button title="Buka Bottom Sheet" onPress={() => setOpen(true)} />
|
|
50
|
+
|
|
51
|
+
<BottomSheet
|
|
52
|
+
isOpen={open}
|
|
53
|
+
onClose={() => setOpen(false)}
|
|
54
|
+
label="Contoh Bottom Sheet"
|
|
55
|
+
height="70%"
|
|
56
|
+
buttonClose
|
|
57
|
+
>
|
|
58
|
+
<Text>Ini isi dari bottom sheet</Text>
|
|
59
|
+
</BottomSheet>
|
|
60
|
+
</View>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type BottomSheetHeighProps = `${number}%` | 'auto' | number;
|
|
2
|
+
|
|
3
|
+
export interface BottomSheetProops {
|
|
4
|
+
label?: string;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
onClose?: (isOpen: boolean) => void;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
backdrop?: boolean;
|
|
9
|
+
closable?: boolean;
|
|
10
|
+
onRequestClose?: (e: any) => void;
|
|
11
|
+
buttonClose?: boolean;
|
|
12
|
+
height?: BottomSheetHeighProps;
|
|
13
|
+
pullBar?: React.ReactNode;
|
|
14
|
+
footer?: React.ReactNode;
|
|
15
|
+
}
|