@herca/rn-kit 0.1.113 → 0.1.115
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/README.md +66 -0
- package/lib/module/Accordion/Accordion.js +4 -1
- package/lib/module/Accordion/Accordion.js.map +1 -1
- package/lib/module/Accordion/AccordionItem.js +3 -1
- package/lib/module/Accordion/AccordionItem.js.map +1 -1
- package/lib/module/Accordion/README.md +2 -0
- package/lib/module/Alert/Alert.js +3 -1
- package/lib/module/Alert/Alert.js.map +1 -1
- package/lib/module/Alert/README.md +1 -0
- package/lib/module/Avatar/Avatar.js +3 -1
- package/lib/module/Avatar/Avatar.js.map +1 -1
- package/lib/module/Avatar/AvatarGroup.js +3 -1
- package/lib/module/Avatar/AvatarGroup.js.map +1 -1
- package/lib/module/Avatar/README_AVATAR.md +1 -0
- package/lib/module/Avatar/README_AVATARGROUP.md +1 -0
- package/lib/module/Badge/Badge.js +4 -1
- package/lib/module/Badge/Badge.js.map +1 -1
- package/lib/module/Badge/README.md +1 -0
- package/lib/module/BadgeIcon/BadgeIcon.js +3 -1
- package/lib/module/BadgeIcon/BadgeIcon.js.map +1 -1
- package/lib/module/BadgeIcon/README.md +1 -0
- package/lib/module/BottomSheet/BottomSheet.js +17 -8
- package/lib/module/BottomSheet/BottomSheet.js.map +1 -1
- package/lib/module/BottomSheet/README.md +1 -0
- package/lib/module/Button/Button.js +3 -1
- package/lib/module/Button/Button.js.map +1 -1
- package/lib/module/Button/README.md +1 -0
- package/lib/module/Button/type.js.map +1 -1
- package/lib/module/Calendar/Calendar.js +9 -1
- package/lib/module/Calendar/Calendar.js.map +1 -1
- package/lib/module/Calendar/README.md +2 -0
- package/lib/module/CheckBox/CheckBox.js +8 -3
- package/lib/module/CheckBox/CheckBox.js.map +1 -1
- package/lib/module/CheckBox/CheckBoxList.js +7 -2
- package/lib/module/CheckBox/CheckBoxList.js.map +1 -1
- package/lib/module/CheckBox/README_CHECKBOX.md +1 -0
- package/lib/module/CheckBox/README_CHECKBOXLIST.md +1 -0
- package/lib/module/Chip/Chip.js +19 -6
- package/lib/module/Chip/Chip.js.map +1 -1
- package/lib/module/Chip/ChipItem.js +3 -1
- package/lib/module/Chip/ChipItem.js.map +1 -1
- package/lib/module/Chip/README.md +26 -2
- package/lib/module/Chip/README_CHIP_ITEM.md +1 -0
- package/lib/module/CounterButton/CounterButton.js +6 -1
- package/lib/module/CounterButton/CounterButton.js.map +1 -1
- package/lib/module/CounterButton/README.md +1 -0
- package/lib/module/DatePicker/DatePicker.js +13 -1
- package/lib/module/DatePicker/DatePicker.js.map +1 -1
- package/lib/module/DatePicker/MonthPicker.js +35 -2
- package/lib/module/DatePicker/MonthPicker.js.map +1 -1
- package/lib/module/DatePicker/README_DATEPICKER.md +1 -0
- package/lib/module/DatePicker/README_MONTHPICKER.md +2 -0
- package/lib/module/DatePicker/README_TIMEPICKER.md +1 -0
- package/lib/module/DatePicker/README_YEARPICKER.md +2 -0
- package/lib/module/DatePicker/TimePicker.js +8 -1
- package/lib/module/DatePicker/TimePicker.js.map +1 -1
- package/lib/module/DatePicker/YearPicker.js +50 -5
- package/lib/module/DatePicker/YearPicker.js.map +1 -1
- package/lib/module/Drawing/Drawing.js +3 -1
- package/lib/module/Drawing/Drawing.js.map +1 -1
- package/lib/module/Drawing/README.md +1 -0
- package/lib/module/DropDown/DropDown.js +6 -1
- package/lib/module/DropDown/DropDown.js.map +1 -1
- package/lib/module/DropDown/README.md +1 -0
- package/lib/module/FileView/PDF_VIEW_README.md +11 -0
- package/lib/module/FileView/PdfView.js +5 -1
- package/lib/module/FileView/PdfView.js.map +1 -1
- package/lib/module/Icon/Icon.js +14 -2
- package/lib/module/Icon/Icon.js.map +1 -1
- package/lib/module/Icon/README.md +1 -0
- package/lib/module/Input/Input.js +7 -0
- package/lib/module/Input/Input.js.map +1 -1
- package/lib/module/Input/InputDate.js +35 -8
- package/lib/module/Input/InputDate.js.map +1 -1
- package/lib/module/Input/InputFile.js +28 -11
- package/lib/module/Input/InputFile.js.map +1 -1
- package/lib/module/Input/InputMonth.js +126 -1
- package/lib/module/Input/InputMonth.js.map +1 -1
- package/lib/module/Input/InputOtp.js +6 -1
- package/lib/module/Input/InputOtp.js.map +1 -1
- package/lib/module/Input/InputPassword.js +5 -1
- package/lib/module/Input/InputPassword.js.map +1 -1
- package/lib/module/Input/InputSelect.js +21 -2
- package/lib/module/Input/InputSelect.js.map +1 -1
- package/lib/module/Input/InputYear.js +103 -0
- package/lib/module/Input/InputYear.js.map +1 -0
- package/lib/module/Input/README_INPUT.md +1 -0
- package/lib/module/Input/README_INPUT_DATE.md +18 -0
- package/lib/module/Input/README_INPUT_FILE.md +1 -0
- package/lib/module/Input/README_INPUT_MONTH.md +132 -0
- package/lib/module/Input/README_INPUT_OTP.md +1 -0
- package/lib/module/Input/README_INPUT_SELECT.md +1 -0
- package/lib/module/Input/README_INPUT_YEAR.md +115 -0
- package/lib/module/Input/Switch.js +6 -2
- package/lib/module/Input/Switch.js.map +1 -1
- package/lib/module/Input/TextArea.js +5 -0
- package/lib/module/Input/TextArea.js.map +1 -1
- package/lib/module/Input/partials/InputFile/CardTrigger.js +3 -1
- package/lib/module/Input/partials/InputFile/CardTrigger.js.map +1 -1
- package/lib/module/Input/partials/InputFile/CardTriggerSmall.js +5 -2
- package/lib/module/Input/partials/InputFile/CardTriggerSmall.js.map +1 -1
- package/lib/module/Input/partials/InputFile/ItemPreview.js +6 -1
- package/lib/module/Input/partials/InputFile/ItemPreview.js.map +1 -1
- package/lib/module/Input/partials/PickerField.js +114 -0
- package/lib/module/Input/partials/PickerField.js.map +1 -0
- package/lib/module/Label/Label.js +3 -1
- package/lib/module/Label/Label.js.map +1 -1
- package/lib/module/Label/README.md +1 -0
- package/lib/module/LabelForm/LabelForm.js +3 -1
- package/lib/module/LabelForm/LabelForm.js.map +1 -1
- package/lib/module/List/List.js +3 -1
- package/lib/module/List/List.js.map +1 -1
- package/lib/module/List/ListItem.js +3 -1
- package/lib/module/List/ListItem.js.map +1 -1
- package/lib/module/List/README.md +2 -0
- package/lib/module/Loading/Loading.js +3 -1
- package/lib/module/Loading/Loading.js.map +1 -1
- package/lib/module/Modal/Modal.js +8 -2
- package/lib/module/Modal/Modal.js.map +1 -1
- package/lib/module/Modal/README.md +1 -0
- package/lib/module/Provider/RequiredUpdateAppsProvider.js +10 -1
- package/lib/module/Provider/RequiredUpdateAppsProvider.js.map +1 -1
- package/lib/module/RadioButton/README.md +1 -0
- package/lib/module/RadioButton/RadioButton.js +7 -2
- package/lib/module/RadioButton/RadioButton.js.map +1 -1
- package/lib/module/Select/README.md +1 -0
- package/lib/module/Select/README_Select.md +1 -0
- package/lib/module/Select/Select.js +12 -3
- package/lib/module/Select/Select.js.map +1 -1
- package/lib/module/Skeleton/README.md +1 -0
- package/lib/module/Skeleton/Skeleton.js +3 -1
- package/lib/module/Skeleton/Skeleton.js.map +1 -1
- package/lib/module/Spinner/Spinner.js +3 -1
- package/lib/module/Spinner/Spinner.js.map +1 -1
- package/lib/module/Step/README.md +2 -0
- package/lib/module/Step/Step.js +3 -1
- package/lib/module/Step/Step.js.map +1 -1
- package/lib/module/Step/StepItem.js +4 -1
- package/lib/module/Step/StepItem.js.map +1 -1
- package/lib/module/Tab/README.md +1 -0
- package/lib/module/Tab/Tab.js +6 -1
- package/lib/module/Tab/Tab.js.map +1 -1
- package/lib/module/TextEditor/LinkSheet.js +84 -0
- package/lib/module/TextEditor/LinkSheet.js.map +1 -0
- package/lib/module/TextEditor/README.md +52 -2
- package/lib/module/TextEditor/TextEditor.js +77 -458
- package/lib/module/TextEditor/TextEditor.js.map +1 -1
- package/lib/module/TextEditor/Toolbar.js +71 -0
- package/lib/module/TextEditor/Toolbar.js.map +1 -0
- package/lib/module/TextEditor/editorDocument.js +235 -0
- package/lib/module/TextEditor/editorDocument.js.map +1 -0
- package/lib/module/TextEditor/formatState.js +186 -0
- package/lib/module/TextEditor/formatState.js.map +1 -0
- package/lib/module/TextEditor/toolbarButtons.js +81 -0
- package/lib/module/TextEditor/toolbarButtons.js.map +1 -0
- package/lib/module/TextEditor/types.js +2 -0
- package/lib/module/Timeline/README.md +2 -0
- package/lib/module/Timeline/Timeline.js +3 -1
- package/lib/module/Timeline/Timeline.js.map +1 -1
- package/lib/module/Timeline/TimelineItem.js +3 -1
- package/lib/module/Timeline/TimelineItem.js.map +1 -1
- package/lib/module/Toast/README.md +16 -0
- package/lib/module/Toast/Toast.js +6 -1
- package/lib/module/Toast/Toast.js.map +1 -1
- package/lib/module/Typography/README.md +1 -0
- package/lib/module/Typography/Typography.js +3 -1
- package/lib/module/Typography/Typography.js.map +1 -1
- package/lib/module/Ui/Card.js +4 -1
- package/lib/module/Ui/Card.js.map +1 -1
- package/lib/module/Ui/Center.js +3 -1
- package/lib/module/Ui/Center.js.map +1 -1
- package/lib/module/Ui/Col.js +3 -1
- package/lib/module/Ui/Col.js.map +1 -1
- package/lib/module/Ui/Container.js +3 -1
- package/lib/module/Ui/Container.js.map +1 -1
- package/lib/module/Ui/Devider.js +4 -1
- package/lib/module/Ui/Devider.js.map +1 -1
- package/lib/module/Ui/Footer.js +4 -2
- package/lib/module/Ui/Footer.js.map +1 -1
- package/lib/module/Ui/Gap.js +3 -1
- package/lib/module/Ui/Gap.js.map +1 -1
- package/lib/module/Ui/Grid.js +3 -1
- package/lib/module/Ui/Grid.js.map +1 -1
- package/lib/module/Ui/README_CARD.md +1 -0
- package/lib/module/Ui/README_CONTAINER.md +1 -0
- package/lib/module/Ui/README_DEVIDER.md +5 -0
- package/lib/module/Ui/README_FOOTER.md +9 -0
- package/lib/module/Ui/README_VIEWINSETS.md +1 -0
- package/lib/module/function/README_DATE_FORMATTER.md +35 -0
- package/lib/module/function/dateFormatter.js +29 -0
- package/lib/module/function/dateFormatter.js.map +1 -1
- package/lib/module/helpers/getTestID.js +15 -0
- package/lib/module/helpers/getTestID.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/Accordion/Accordion.d.ts +1 -1
- package/lib/typescript/src/Accordion/Accordion.d.ts.map +1 -1
- package/lib/typescript/src/Accordion/AccordionItem.d.ts +1 -1
- package/lib/typescript/src/Accordion/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/src/Accordion/type.d.ts +2 -0
- package/lib/typescript/src/Accordion/type.d.ts.map +1 -1
- package/lib/typescript/src/Alert/Alert.d.ts +1 -0
- package/lib/typescript/src/Alert/Alert.d.ts.map +1 -1
- package/lib/typescript/src/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/Avatar/AvatarGroup.d.ts.map +1 -1
- package/lib/typescript/src/Avatar/type.d.ts +2 -0
- package/lib/typescript/src/Avatar/type.d.ts.map +1 -1
- package/lib/typescript/src/Badge/Badge.d.ts +1 -0
- package/lib/typescript/src/Badge/Badge.d.ts.map +1 -1
- package/lib/typescript/src/BadgeIcon/BadgeIcon.d.ts +1 -0
- package/lib/typescript/src/BadgeIcon/BadgeIcon.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheet/BottomSheet.d.ts +1 -1
- package/lib/typescript/src/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheet/type.d.ts +1 -0
- package/lib/typescript/src/BottomSheet/type.d.ts.map +1 -1
- package/lib/typescript/src/Button/Button.d.ts.map +1 -1
- package/lib/typescript/src/Button/type.d.ts +1 -0
- package/lib/typescript/src/Button/type.d.ts.map +1 -1
- package/lib/typescript/src/Calendar/Calendar.d.ts +1 -1
- package/lib/typescript/src/Calendar/Calendar.d.ts.map +1 -1
- package/lib/typescript/src/Calendar/CalendarPropsType.d.ts +6 -0
- package/lib/typescript/src/Calendar/CalendarPropsType.d.ts.map +1 -1
- package/lib/typescript/src/CheckBox/CheckBox.d.ts +1 -0
- package/lib/typescript/src/CheckBox/CheckBox.d.ts.map +1 -1
- package/lib/typescript/src/CheckBox/CheckBoxList.d.ts +1 -0
- package/lib/typescript/src/CheckBox/CheckBoxList.d.ts.map +1 -1
- package/lib/typescript/src/Chip/Chip.d.ts.map +1 -1
- package/lib/typescript/src/Chip/ChipItem.d.ts +1 -1
- package/lib/typescript/src/Chip/ChipItem.d.ts.map +1 -1
- package/lib/typescript/src/Chip/type.d.ts +2 -0
- package/lib/typescript/src/Chip/type.d.ts.map +1 -1
- package/lib/typescript/src/CounterButton/CounterButton.d.ts +1 -1
- package/lib/typescript/src/CounterButton/CounterButton.d.ts.map +1 -1
- package/lib/typescript/src/CounterButton/type.d.ts +1 -0
- package/lib/typescript/src/CounterButton/type.d.ts.map +1 -1
- package/lib/typescript/src/DatePicker/DatePicker.d.ts +2 -1
- package/lib/typescript/src/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/DatePicker/MonthPicker.d.ts +11 -1
- package/lib/typescript/src/DatePicker/MonthPicker.d.ts.map +1 -1
- package/lib/typescript/src/DatePicker/TimePicker.d.ts +2 -1
- package/lib/typescript/src/DatePicker/TimePicker.d.ts.map +1 -1
- package/lib/typescript/src/DatePicker/YearPicker.d.ts +14 -1
- package/lib/typescript/src/DatePicker/YearPicker.d.ts.map +1 -1
- package/lib/typescript/src/Drawing/Drawing.d.ts +2 -1
- package/lib/typescript/src/Drawing/Drawing.d.ts.map +1 -1
- package/lib/typescript/src/DropDown/DropDown.d.ts +1 -1
- package/lib/typescript/src/DropDown/DropDown.d.ts.map +1 -1
- package/lib/typescript/src/DropDown/type.d.ts +1 -0
- package/lib/typescript/src/DropDown/type.d.ts.map +1 -1
- package/lib/typescript/src/FileView/PdfView.d.ts +2 -1
- package/lib/typescript/src/FileView/PdfView.d.ts.map +1 -1
- package/lib/typescript/src/Icon/Icon.d.ts.map +1 -1
- package/lib/typescript/src/Icon/type.d.ts +1 -0
- package/lib/typescript/src/Icon/type.d.ts.map +1 -1
- package/lib/typescript/src/Input/Input.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputDate.d.ts +6 -2
- package/lib/typescript/src/Input/InputDate.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputFile.d.ts +1 -1
- package/lib/typescript/src/Input/InputFile.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputMonth.d.ts +29 -1
- package/lib/typescript/src/Input/InputMonth.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputOtp.d.ts +1 -0
- package/lib/typescript/src/Input/InputOtp.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputPassword.d.ts +2 -1
- package/lib/typescript/src/Input/InputPassword.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputSelect.d.ts +4 -2
- package/lib/typescript/src/Input/InputSelect.d.ts.map +1 -1
- package/lib/typescript/src/Input/InputYear.d.ts +34 -0
- package/lib/typescript/src/Input/InputYear.d.ts.map +1 -0
- package/lib/typescript/src/Input/Switch.d.ts +2 -1
- package/lib/typescript/src/Input/Switch.d.ts.map +1 -1
- package/lib/typescript/src/Input/TextArea.d.ts +1 -1
- package/lib/typescript/src/Input/TextArea.d.ts.map +1 -1
- package/lib/typescript/src/Input/partials/InputFile/CardTrigger.d.ts +2 -1
- package/lib/typescript/src/Input/partials/InputFile/CardTrigger.d.ts.map +1 -1
- package/lib/typescript/src/Input/partials/InputFile/CardTriggerSmall.d.ts +2 -1
- package/lib/typescript/src/Input/partials/InputFile/CardTriggerSmall.d.ts.map +1 -1
- package/lib/typescript/src/Input/partials/InputFile/ItemPreview.d.ts +2 -1
- package/lib/typescript/src/Input/partials/InputFile/ItemPreview.d.ts.map +1 -1
- package/lib/typescript/src/Input/partials/PickerField.d.ts +25 -0
- package/lib/typescript/src/Input/partials/PickerField.d.ts.map +1 -0
- package/lib/typescript/src/Input/type.d.ts +13 -0
- package/lib/typescript/src/Input/type.d.ts.map +1 -1
- package/lib/typescript/src/Label/Label.d.ts +2 -1
- package/lib/typescript/src/Label/Label.d.ts.map +1 -1
- package/lib/typescript/src/LabelForm/LabelForm.d.ts +2 -1
- package/lib/typescript/src/LabelForm/LabelForm.d.ts.map +1 -1
- package/lib/typescript/src/List/List.d.ts +1 -1
- package/lib/typescript/src/List/List.d.ts.map +1 -1
- package/lib/typescript/src/List/ListItem.d.ts +1 -1
- package/lib/typescript/src/List/ListItem.d.ts.map +1 -1
- package/lib/typescript/src/List/type.d.ts +2 -0
- package/lib/typescript/src/List/type.d.ts.map +1 -1
- package/lib/typescript/src/Loading/Loading.d.ts +1 -0
- package/lib/typescript/src/Loading/Loading.d.ts.map +1 -1
- package/lib/typescript/src/Modal/Modal.d.ts +1 -0
- package/lib/typescript/src/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/src/Provider/RequiredUpdateAppsProvider.d.ts.map +1 -1
- package/lib/typescript/src/RadioButton/RadioButton.d.ts +1 -0
- package/lib/typescript/src/RadioButton/RadioButton.d.ts.map +1 -1
- package/lib/typescript/src/Select/Select.d.ts +1 -1
- package/lib/typescript/src/Select/Select.d.ts.map +1 -1
- package/lib/typescript/src/Select/type.d.ts +1 -0
- package/lib/typescript/src/Select/type.d.ts.map +1 -1
- package/lib/typescript/src/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/typescript/src/Skeleton/type.d.ts +1 -0
- package/lib/typescript/src/Skeleton/type.d.ts.map +1 -1
- package/lib/typescript/src/Spinner/Spinner.d.ts +7 -4
- package/lib/typescript/src/Spinner/Spinner.d.ts.map +1 -1
- package/lib/typescript/src/Step/Step.d.ts +1 -1
- package/lib/typescript/src/Step/Step.d.ts.map +1 -1
- package/lib/typescript/src/Step/StepItem.d.ts +1 -1
- package/lib/typescript/src/Step/StepItem.d.ts.map +1 -1
- package/lib/typescript/src/Step/type.d.ts +2 -0
- package/lib/typescript/src/Step/type.d.ts.map +1 -1
- package/lib/typescript/src/Tab/Tab.d.ts.map +1 -1
- package/lib/typescript/src/Tab/type.d.ts +1 -0
- package/lib/typescript/src/Tab/type.d.ts.map +1 -1
- package/lib/typescript/src/TextEditor/LinkSheet.d.ts +26 -0
- package/lib/typescript/src/TextEditor/LinkSheet.d.ts.map +1 -0
- package/lib/typescript/src/TextEditor/TextEditor.d.ts +2 -19
- package/lib/typescript/src/TextEditor/TextEditor.d.ts.map +1 -1
- package/lib/typescript/src/TextEditor/Toolbar.d.ts +16 -0
- package/lib/typescript/src/TextEditor/Toolbar.d.ts.map +1 -0
- package/lib/typescript/src/TextEditor/editorDocument.d.ts +20 -0
- package/lib/typescript/src/TextEditor/editorDocument.d.ts.map +1 -0
- package/lib/typescript/src/TextEditor/formatState.d.ts +34 -0
- package/lib/typescript/src/TextEditor/formatState.d.ts.map +1 -0
- package/lib/typescript/src/TextEditor/toolbarButtons.d.ts +5 -0
- package/lib/typescript/src/TextEditor/toolbarButtons.d.ts.map +1 -0
- package/lib/typescript/src/TextEditor/types.d.ts +42 -0
- package/lib/typescript/src/TextEditor/types.d.ts.map +1 -1
- package/lib/typescript/src/Timeline/Timeline.d.ts +2 -1
- package/lib/typescript/src/Timeline/Timeline.d.ts.map +1 -1
- package/lib/typescript/src/Timeline/TimelineItem.d.ts +2 -1
- package/lib/typescript/src/Timeline/TimelineItem.d.ts.map +1 -1
- package/lib/typescript/src/Toast/Toast.d.ts +2 -1
- package/lib/typescript/src/Toast/Toast.d.ts.map +1 -1
- package/lib/typescript/src/Typography/Typography.d.ts.map +1 -1
- package/lib/typescript/src/Typography/type.d.ts +1 -0
- package/lib/typescript/src/Typography/type.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Card.d.ts +2 -1
- package/lib/typescript/src/Ui/Card.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Center.d.ts +2 -1
- package/lib/typescript/src/Ui/Center.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Col.d.ts +1 -0
- package/lib/typescript/src/Ui/Col.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Container.d.ts +2 -1
- package/lib/typescript/src/Ui/Container.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Devider.d.ts +3 -1
- package/lib/typescript/src/Ui/Devider.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Footer.d.ts +1 -0
- package/lib/typescript/src/Ui/Footer.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Gap.d.ts +2 -1
- package/lib/typescript/src/Ui/Gap.d.ts.map +1 -1
- package/lib/typescript/src/Ui/Grid.d.ts +1 -0
- package/lib/typescript/src/Ui/Grid.d.ts.map +1 -1
- package/lib/typescript/src/function/dateFormatter.d.ts +11 -0
- package/lib/typescript/src/function/dateFormatter.d.ts.map +1 -1
- package/lib/typescript/src/helpers/getTestID.d.ts +10 -0
- package/lib/typescript/src/helpers/getTestID.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +16 -3
- package/src/Accordion/Accordion.tsx +6 -1
- package/src/Accordion/AccordionItem.tsx +2 -1
- package/src/Accordion/README.md +2 -0
- package/src/Accordion/type.tsx +2 -0
- package/src/Alert/Alert.tsx +3 -0
- package/src/Alert/README.md +1 -0
- package/src/Avatar/Avatar.tsx +2 -0
- package/src/Avatar/AvatarGroup.tsx +2 -1
- package/src/Avatar/README_AVATAR.md +1 -0
- package/src/Avatar/README_AVATARGROUP.md +1 -0
- package/src/Avatar/type.tsx +2 -0
- package/src/Badge/Badge.tsx +4 -0
- package/src/Badge/README.md +1 -0
- package/src/BadgeIcon/BadgeIcon.tsx +3 -0
- package/src/BadgeIcon/README.md +1 -0
- package/src/BottomSheet/BottomSheet.tsx +20 -13
- package/src/BottomSheet/README.md +1 -0
- package/src/BottomSheet/type.tsx +1 -0
- package/src/Button/Button.tsx +2 -0
- package/src/Button/README.md +1 -0
- package/src/Button/type.tsx +1 -0
- package/src/Calendar/Calendar.tsx +8 -1
- package/src/Calendar/CalendarPropsType.tsx +6 -0
- package/src/Calendar/README.md +2 -0
- package/src/CheckBox/CheckBox.tsx +13 -2
- package/src/CheckBox/CheckBoxList.tsx +7 -1
- package/src/CheckBox/README_CHECKBOX.md +1 -0
- package/src/CheckBox/README_CHECKBOXLIST.md +1 -0
- package/src/Chip/Chip.tsx +18 -5
- package/src/Chip/ChipItem.tsx +2 -0
- package/src/Chip/README.md +26 -2
- package/src/Chip/README_CHIP_ITEM.md +1 -0
- package/src/Chip/type.tsx +2 -0
- package/src/CounterButton/CounterButton.tsx +5 -0
- package/src/CounterButton/README.md +1 -0
- package/src/CounterButton/type.tsx +1 -0
- package/src/DatePicker/DatePicker.tsx +21 -5
- package/src/DatePicker/MonthPicker.tsx +40 -1
- package/src/DatePicker/README_DATEPICKER.md +1 -0
- package/src/DatePicker/README_MONTHPICKER.md +2 -0
- package/src/DatePicker/README_TIMEPICKER.md +1 -0
- package/src/DatePicker/README_YEARPICKER.md +2 -0
- package/src/DatePicker/TimePicker.tsx +8 -0
- package/src/DatePicker/YearPicker.tsx +59 -4
- package/src/Drawing/Drawing.tsx +3 -1
- package/src/Drawing/README.md +1 -0
- package/src/DropDown/DropDown.tsx +12 -1
- package/src/DropDown/README.md +1 -0
- package/src/DropDown/type.tsx +1 -0
- package/src/FileView/PDF_VIEW_README.md +11 -0
- package/src/FileView/PdfView.tsx +4 -3
- package/src/Icon/Icon.tsx +10 -2
- package/src/Icon/README.md +1 -0
- package/src/Icon/type.tsx +1 -0
- package/src/Input/Input.tsx +17 -2
- package/src/Input/InputDate.tsx +40 -15
- package/src/Input/InputFile.tsx +27 -14
- package/src/Input/InputMonth.tsx +170 -1
- package/src/Input/InputOtp.tsx +12 -2
- package/src/Input/InputPassword.tsx +6 -1
- package/src/Input/InputSelect.tsx +30 -13
- package/src/Input/InputYear.tsx +134 -0
- package/src/Input/README_INPUT.md +1 -0
- package/src/Input/README_INPUT_DATE.md +18 -0
- package/src/Input/README_INPUT_FILE.md +1 -0
- package/src/Input/README_INPUT_MONTH.md +132 -0
- package/src/Input/README_INPUT_OTP.md +1 -0
- package/src/Input/README_INPUT_SELECT.md +1 -0
- package/src/Input/README_INPUT_YEAR.md +115 -0
- package/src/Input/Switch.tsx +7 -1
- package/src/Input/TextArea.tsx +15 -2
- package/src/Input/partials/InputFile/CardTrigger.tsx +3 -0
- package/src/Input/partials/InputFile/CardTriggerSmall.tsx +4 -1
- package/src/Input/partials/InputFile/ItemPreview.tsx +12 -2
- package/src/Input/partials/PickerField.tsx +125 -0
- package/src/Input/type.tsx +14 -0
- package/src/Label/Label.tsx +3 -0
- package/src/Label/README.md +1 -0
- package/src/LabelForm/LabelForm.tsx +3 -1
- package/src/List/List.tsx +2 -2
- package/src/List/ListItem.tsx +2 -0
- package/src/List/README.md +2 -0
- package/src/List/type.tsx +2 -0
- package/src/Loading/Loading.tsx +3 -1
- package/src/Modal/Modal.tsx +15 -3
- package/src/Modal/README.md +1 -0
- package/src/Provider/RequiredUpdateAppsProvider.tsx +10 -1
- package/src/RadioButton/README.md +1 -0
- package/src/RadioButton/RadioButton.tsx +12 -2
- package/src/Select/README.md +1 -0
- package/src/Select/README_Select.md +1 -0
- package/src/Select/Select.tsx +13 -3
- package/src/Select/type.tsx +1 -0
- package/src/Skeleton/README.md +1 -0
- package/src/Skeleton/Skeleton.tsx +2 -0
- package/src/Skeleton/type.ts +1 -0
- package/src/Spinner/Spinner.tsx +15 -2
- package/src/Step/README.md +2 -0
- package/src/Step/Step.tsx +2 -2
- package/src/Step/StepItem.tsx +7 -2
- package/src/Step/type.tsx +2 -0
- package/src/Tab/README.md +1 -0
- package/src/Tab/Tab.tsx +12 -2
- package/src/Tab/type.tsx +1 -0
- package/src/TextEditor/LinkSheet.tsx +100 -0
- package/src/TextEditor/README.md +52 -2
- package/src/TextEditor/TextEditor.tsx +92 -500
- package/src/TextEditor/Toolbar.tsx +104 -0
- package/src/TextEditor/editorDocument.ts +246 -0
- package/src/TextEditor/formatState.ts +186 -0
- package/src/TextEditor/toolbarButtons.ts +41 -0
- package/src/TextEditor/types.tsx +63 -0
- package/src/Timeline/README.md +2 -0
- package/src/Timeline/Timeline.tsx +7 -2
- package/src/Timeline/TimelineItem.tsx +3 -1
- package/src/Toast/README.md +16 -0
- package/src/Toast/Toast.tsx +13 -2
- package/src/Typography/README.md +1 -0
- package/src/Typography/Typography.tsx +6 -1
- package/src/Typography/type.tsx +1 -0
- package/src/Ui/Card.tsx +4 -0
- package/src/Ui/Center.tsx +7 -2
- package/src/Ui/Col.tsx +7 -2
- package/src/Ui/Container.tsx +7 -2
- package/src/Ui/Devider.tsx +2 -2
- package/src/Ui/Footer.tsx +6 -3
- package/src/Ui/Gap.tsx +8 -2
- package/src/Ui/Grid.tsx +3 -2
- package/src/Ui/README_CARD.md +1 -0
- package/src/Ui/README_CONTAINER.md +1 -0
- package/src/Ui/README_DEVIDER.md +5 -0
- package/src/Ui/README_FOOTER.md +9 -0
- package/src/Ui/README_VIEWINSETS.md +1 -0
- package/src/function/README_DATE_FORMATTER.md +35 -0
- package/src/function/dateFormatter.ts +40 -0
- package/src/helpers/getTestID.ts +15 -0
- package/src/index.tsx +6 -0
- package/lib/module/Button/tests/Button.test.js +0 -70
- package/lib/module/Button/tests/Button.test.js.map +0 -1
- package/lib/typescript/src/Button/tests/Button.test.d.ts +0 -2
- package/lib/typescript/src/Button/tests/Button.test.d.ts.map +0 -1
- package/src/Button/tests/Button.test.tsx +0 -49
|
@@ -11,62 +11,30 @@ import {
|
|
|
11
11
|
Keyboard,
|
|
12
12
|
KeyboardAvoidingView,
|
|
13
13
|
Platform,
|
|
14
|
-
ScrollView,
|
|
15
14
|
StyleSheet,
|
|
16
15
|
TextInput,
|
|
17
|
-
TouchableOpacity,
|
|
18
16
|
View,
|
|
19
17
|
type KeyboardEvent,
|
|
20
18
|
} from 'react-native';
|
|
21
19
|
import { WebView } from 'react-native-webview';
|
|
22
|
-
import BottomSheet from '../BottomSheet/BottomSheet';
|
|
23
|
-
import Button from '../Button/Button';
|
|
24
20
|
import Color from '../Color/Color';
|
|
25
|
-
import Icon, { type IconNameProps } from '../Icon';
|
|
26
|
-
import Input from '../Input/Input';
|
|
27
21
|
import LabelForm from '../LabelForm/LabelForm';
|
|
28
22
|
import Typography from '../Typography/Typography';
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
inputLabelLinkText?: string;
|
|
45
|
-
inputLinkTextPlacholder?: string;
|
|
46
|
-
inputLabelLinkUrl?: string;
|
|
47
|
-
inputLinkUrlPlacholder?: string;
|
|
48
|
-
saveLinkButtonText?: string;
|
|
49
|
-
cancelLinkButtonText?: string;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
type TextCommand =
|
|
53
|
-
| 'bold'
|
|
54
|
-
| 'italic'
|
|
55
|
-
| 'underline'
|
|
56
|
-
| 'strikeThrough'
|
|
57
|
-
| 'link'
|
|
58
|
-
| 'insertUnorderedList'
|
|
59
|
-
| 'insertOrderedList'
|
|
60
|
-
| 'justifyLeft'
|
|
61
|
-
| 'justifyCenter'
|
|
62
|
-
| 'justifyRight';
|
|
63
|
-
|
|
64
|
-
interface ToolbarButton {
|
|
65
|
-
command: TextCommand;
|
|
66
|
-
icon: IconNameProps;
|
|
67
|
-
label: string;
|
|
68
|
-
isSpecial?: boolean;
|
|
69
|
-
}
|
|
23
|
+
import { buildEditorDocument } from './editorDocument';
|
|
24
|
+
import LinkSheet from './LinkSheet';
|
|
25
|
+
import Toolbar from './Toolbar';
|
|
26
|
+
import {
|
|
27
|
+
BLOCK_COMMANDS,
|
|
28
|
+
TOGGLE_COMMANDS,
|
|
29
|
+
TOOLBAR_BUTTONS,
|
|
30
|
+
} from './toolbarButtons';
|
|
31
|
+
import type {
|
|
32
|
+
ExtendedTextEditorType,
|
|
33
|
+
TextCommand,
|
|
34
|
+
TextEditorRef,
|
|
35
|
+
} from './types';
|
|
36
|
+
|
|
37
|
+
export type { TextEditorRef };
|
|
70
38
|
|
|
71
39
|
const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
72
40
|
(
|
|
@@ -87,17 +55,26 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
87
55
|
inputLabelLinkUrl = 'Link URL',
|
|
88
56
|
saveLinkButtonText = 'Simpan',
|
|
89
57
|
cancelLinkButtonText = 'Batal',
|
|
58
|
+
showToolbar = true,
|
|
59
|
+
testID,
|
|
90
60
|
},
|
|
91
61
|
ref
|
|
92
62
|
) => {
|
|
93
|
-
const [
|
|
63
|
+
const [keyboardVisible, setKeyboardVisible] = useState<boolean>(false);
|
|
64
|
+
// Whether the caret is in THIS editor. The keyboard is global, so without
|
|
65
|
+
// this every mounted editor would paint a toolbar the moment any field
|
|
66
|
+
// anywhere opened it -- see the toolbar gate at the bottom of the render.
|
|
67
|
+
const [isFocused, setIsFocused] = useState<boolean>(false);
|
|
94
68
|
const [activeFormats, setActiveFormats] = useState<Set<string>>(new Set());
|
|
95
69
|
const [characterCount, setCharacterCount] = useState(0);
|
|
96
70
|
const [showLinkModal, setShowLinkModal] = useState(false);
|
|
97
71
|
const [linkText, setLinkText] = useState('');
|
|
98
72
|
const [linkUrl, setLinkUrl] = useState('');
|
|
99
73
|
const [isEditingLink, setIsEditingLink] = useState(false);
|
|
100
|
-
|
|
74
|
+
// WebView is declared as `class WebView<P = undefined>` whose props are
|
|
75
|
+
// `WebViewProps & P`; the default `P = undefined` collapses props to `never`
|
|
76
|
+
// under React 19 types, so pin `P` to `object` to recover `WebViewProps`.
|
|
77
|
+
const webviewRef = useRef<WebView<object>>(null);
|
|
101
78
|
const inputUrlRef = useRef<TextInput>(null);
|
|
102
79
|
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
103
80
|
|
|
@@ -116,306 +93,45 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
116
93
|
setContent: (html: string) => {
|
|
117
94
|
const escapedHtml = html.replace(/`/g, '\\`').replace(/\$/g, '\\$');
|
|
118
95
|
webviewRef.current?.injectJavaScript(`
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
96
|
+
(function () {
|
|
97
|
+
const target = document.getElementById('editor');
|
|
98
|
+
target.innerHTML = \`${escapedHtml}\`;
|
|
99
|
+
if (target.textContent.trim()) {
|
|
100
|
+
target.classList.remove('placeholder');
|
|
101
|
+
}
|
|
102
|
+
})();
|
|
124
103
|
true;
|
|
125
104
|
`);
|
|
126
105
|
},
|
|
127
106
|
clearContent: () => {
|
|
128
107
|
webviewRef.current?.injectJavaScript(`
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
108
|
+
(function () {
|
|
109
|
+
const target = document.getElementById('editor');
|
|
110
|
+
target.innerHTML = '';
|
|
111
|
+
target.classList.add('placeholder');
|
|
112
|
+
window.ReactNativeWebView.postMessage('');
|
|
113
|
+
})();
|
|
133
114
|
true;
|
|
134
115
|
`);
|
|
135
116
|
},
|
|
136
117
|
}));
|
|
137
118
|
|
|
138
|
-
const htmlEditor =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*::before,
|
|
145
|
-
*::after {
|
|
146
|
-
box-sizing: border-box;
|
|
147
|
-
}
|
|
148
|
-
html, body {
|
|
149
|
-
margin: 0;
|
|
150
|
-
padding: 0;
|
|
151
|
-
width: 99.9%;
|
|
152
|
-
height: 100%;
|
|
153
|
-
overflow-x: hidden;
|
|
154
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
155
|
-
}
|
|
156
|
-
#editor {
|
|
157
|
-
height: 100%;
|
|
158
|
-
width: 100%;
|
|
159
|
-
max-width: 100%;
|
|
160
|
-
font-size: 14px;
|
|
161
|
-
line-height: 1.5;
|
|
162
|
-
border-radius: 6px;
|
|
163
|
-
outline: none;
|
|
164
|
-
transition: border 0.2s;
|
|
165
|
-
overflow-wrap: break-word;
|
|
166
|
-
font-weight: 400;
|
|
167
|
-
word-wrap: break-word;
|
|
168
|
-
word-break: break-word;
|
|
169
|
-
color: #333;
|
|
170
|
-
}
|
|
171
|
-
#editor.placeholder:empty:before {
|
|
172
|
-
content: '${placeholder}';
|
|
173
|
-
color: ${Color.gray[400]};
|
|
174
|
-
font-style: italic;
|
|
175
|
-
}
|
|
176
|
-
#editor:focus {
|
|
177
|
-
outline: none;
|
|
178
|
-
}
|
|
179
|
-
/* Style untuk list */
|
|
180
|
-
#editor ul, #editor ol {
|
|
181
|
-
margin: 8px 0;
|
|
182
|
-
padding-left: 24px;
|
|
183
|
-
}
|
|
184
|
-
#editor li {
|
|
185
|
-
margin: 4px 0;
|
|
186
|
-
}
|
|
187
|
-
/* Style untuk heading */
|
|
188
|
-
#editor h1 { font-size: 24px; font-weight: bold; margin: 12px 0; }
|
|
189
|
-
#editor h2 { font-size: 20px; font-weight: bold; margin: 10px 0; }
|
|
190
|
-
#editor h3 { font-size: 16px; font-weight: bold; margin: 8px 0; }
|
|
191
|
-
/* Style untuk link */
|
|
192
|
-
#editor a {
|
|
193
|
-
color: #3b82f6;
|
|
194
|
-
text-decoration: underline;
|
|
195
|
-
cursor: pointer;
|
|
196
|
-
}
|
|
197
|
-
#editor a:hover {
|
|
198
|
-
color: #2563eb;
|
|
199
|
-
}
|
|
200
|
-
</style>
|
|
201
|
-
</head>
|
|
202
|
-
<body>
|
|
203
|
-
<div id="editor" contenteditable="true" class="placeholder">${initialValue}</div>
|
|
204
|
-
<script>
|
|
205
|
-
const editor = document.getElementById("editor");
|
|
206
|
-
|
|
207
|
-
// Handle placeholder
|
|
208
|
-
if (editor.textContent.trim()) {
|
|
209
|
-
editor.classList.remove('placeholder');
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// Kirim initial character count saat load
|
|
213
|
-
setTimeout(() => {
|
|
214
|
-
const charCount = editor.textContent.trim().length;
|
|
215
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
216
|
-
type: 'initialCount',
|
|
217
|
-
characterCount: charCount
|
|
218
|
-
}));
|
|
219
|
-
}, 100);
|
|
220
|
-
|
|
221
|
-
editor.addEventListener("input", () => {
|
|
222
|
-
if (editor.textContent.trim()) {
|
|
223
|
-
editor.classList.remove('placeholder');
|
|
224
|
-
} else {
|
|
225
|
-
editor.classList.add('placeholder');
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Kirim HTML dan character count
|
|
229
|
-
const charCount = editor.textContent.trim().length;
|
|
230
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
231
|
-
type: 'content',
|
|
232
|
-
html: editor.innerHTML,
|
|
233
|
-
characterCount: charCount
|
|
234
|
-
}));
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
editor.addEventListener("focus", () => {
|
|
238
|
-
editor.classList.add("focused");
|
|
239
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'focus' }));
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
editor.addEventListener("blur", () => {
|
|
243
|
-
editor.classList.remove("focused");
|
|
244
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'blur' }));
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
// Update active formats
|
|
248
|
-
editor.addEventListener("mouseup", updateFormats);
|
|
249
|
-
editor.addEventListener("keyup", updateFormats);
|
|
250
|
-
editor.addEventListener("click", updateFormats);
|
|
251
|
-
|
|
252
|
-
function updateFormats() {
|
|
253
|
-
const formats = [];
|
|
254
|
-
if (document.queryCommandState('bold')) formats.push('bold');
|
|
255
|
-
if (document.queryCommandState('italic')) formats.push('italic');
|
|
256
|
-
if (document.queryCommandState('underline')) formats.push('underline');
|
|
257
|
-
if (document.queryCommandState('strikeThrough')) formats.push('strikeThrough');
|
|
258
|
-
|
|
259
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
260
|
-
type: 'formats',
|
|
261
|
-
formats: formats
|
|
262
|
-
}));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
function getSelectedLinkInfo() {
|
|
266
|
-
const selection = window.getSelection();
|
|
267
|
-
if (!selection || selection.rangeCount === 0) {
|
|
268
|
-
return { text: '', url: '' };
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const range = selection.getRangeAt(0);
|
|
272
|
-
let linkElement = null;
|
|
273
|
-
|
|
274
|
-
// Check if selection contains or is within a link
|
|
275
|
-
if (range.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
276
|
-
linkElement = range.startContainer.querySelector('a');
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Check parent nodes for link
|
|
280
|
-
let node = range.startContainer;
|
|
281
|
-
while (node && node !== editor) {
|
|
282
|
-
if (node.nodeName === 'A') {
|
|
283
|
-
linkElement = node;
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
node = node.parentNode;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// Check if any node in selection is a link
|
|
290
|
-
if (!linkElement && range.commonAncestorContainer) {
|
|
291
|
-
const container = range.commonAncestorContainer;
|
|
292
|
-
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
293
|
-
linkElement = container.querySelector('a');
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (linkElement) {
|
|
298
|
-
return {
|
|
299
|
-
text: linkElement.textContent || '',
|
|
300
|
-
url: linkElement.href || '',
|
|
301
|
-
isExisting: true
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
return {
|
|
306
|
-
text: selection.toString(),
|
|
307
|
-
url: '',
|
|
308
|
-
isExisting: false
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
const handleMessage = (command) => {
|
|
313
|
-
if (command === 'getContent') {
|
|
314
|
-
window.ReactNativeWebView.postMessage(editor.innerHTML);
|
|
315
|
-
} else if (command === 'getSelectedText') {
|
|
316
|
-
const linkInfo = getSelectedLinkInfo();
|
|
317
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
318
|
-
type: 'selectedText',
|
|
319
|
-
text: linkInfo.text,
|
|
320
|
-
url: linkInfo.url,
|
|
321
|
-
isExisting: linkInfo.isExisting
|
|
322
|
-
}));
|
|
323
|
-
} else if (command.startsWith('insertLink:')) {
|
|
324
|
-
const linkData = command.replace('insertLink:', '');
|
|
325
|
-
const { text, url, isExisting } = JSON.parse(linkData);
|
|
326
|
-
editor.focus();
|
|
327
|
-
const selection = window.getSelection();
|
|
328
|
-
|
|
329
|
-
if (selection && selection.rangeCount > 0) {
|
|
330
|
-
const range = selection.getRangeAt(0);
|
|
331
|
-
|
|
332
|
-
// If editing existing link, find and update it
|
|
333
|
-
if (isExisting) {
|
|
334
|
-
let linkElement = null;
|
|
335
|
-
let node = range.startContainer;
|
|
336
|
-
|
|
337
|
-
while (node && node !== editor) {
|
|
338
|
-
if (node.nodeName === 'A') {
|
|
339
|
-
linkElement = node;
|
|
340
|
-
break;
|
|
341
|
-
}
|
|
342
|
-
node = node.parentNode;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
if (!linkElement && range.commonAncestorContainer.nodeType === Node.ELEMENT_NODE) {
|
|
346
|
-
linkElement = range.commonAncestorContainer.querySelector('a');
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
if (linkElement) {
|
|
350
|
-
linkElement.href = url;
|
|
351
|
-
linkElement.textContent = text;
|
|
352
|
-
// Move cursor after link
|
|
353
|
-
range.setStartAfter(linkElement);
|
|
354
|
-
range.collapse(true);
|
|
355
|
-
selection.removeAllRanges();
|
|
356
|
-
selection.addRange(range);
|
|
357
|
-
|
|
358
|
-
// Update content dan character count
|
|
359
|
-
const charCount = editor.textContent.trim().length;
|
|
360
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
361
|
-
type: 'content',
|
|
362
|
-
html: editor.innerHTML,
|
|
363
|
-
characterCount: charCount
|
|
364
|
-
}));
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// Create new link
|
|
370
|
-
const link = document.createElement('a');
|
|
371
|
-
link.href = url;
|
|
372
|
-
link.textContent = text;
|
|
373
|
-
link.target = '_blank';
|
|
374
|
-
range.deleteContents();
|
|
375
|
-
range.insertNode(link);
|
|
376
|
-
// Add space after link
|
|
377
|
-
const space = document.createTextNode(' ');
|
|
378
|
-
link.parentNode.insertBefore(space, link.nextSibling);
|
|
379
|
-
// Move cursor after space
|
|
380
|
-
range.setStartAfter(space);
|
|
381
|
-
range.collapse(true);
|
|
382
|
-
selection.removeAllRanges();
|
|
383
|
-
selection.addRange(range);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// Update content dan character count
|
|
387
|
-
const charCount = editor.textContent.trim().length;
|
|
388
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
389
|
-
type: 'content',
|
|
390
|
-
html: editor.innerHTML,
|
|
391
|
-
characterCount: charCount
|
|
392
|
-
}));
|
|
393
|
-
} else {
|
|
394
|
-
editor.focus();
|
|
395
|
-
document.execCommand(command, false, null);
|
|
396
|
-
updateFormats();
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
// untuk Android
|
|
401
|
-
document.addEventListener("message", (event) => {
|
|
402
|
-
handleMessage(event.data);
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
// untuk iOS
|
|
406
|
-
window.addEventListener("message", (event) => {
|
|
407
|
-
handleMessage(event.data);
|
|
408
|
-
});
|
|
409
|
-
</script>
|
|
410
|
-
</body>
|
|
411
|
-
</html>
|
|
412
|
-
`;
|
|
119
|
+
const htmlEditor = buildEditorDocument({
|
|
120
|
+
placeholder,
|
|
121
|
+
initialValue,
|
|
122
|
+
toggleCommands: TOGGLE_COMMANDS,
|
|
123
|
+
blockCommands: BLOCK_COMMANDS,
|
|
124
|
+
});
|
|
413
125
|
|
|
414
126
|
const formatText = (command: string) => {
|
|
415
127
|
if (webviewRef.current) {
|
|
416
128
|
if (Platform.OS === 'ios') {
|
|
129
|
+
// updateFormats() matters as much as the command itself: without it
|
|
130
|
+
// iOS applied the format but left the button unlit until the editor
|
|
131
|
+
// was touched again. Android gets this for free via handleMessage.
|
|
417
132
|
webviewRef.current.injectJavaScript(`
|
|
418
|
-
|
|
133
|
+
rnkitRunCommand(${JSON.stringify(command)});
|
|
134
|
+
updateFormats();
|
|
419
135
|
true; //di ios harus biar berfunsi boldnya
|
|
420
136
|
`);
|
|
421
137
|
} else {
|
|
@@ -455,71 +171,10 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
455
171
|
if (webviewRef.current) {
|
|
456
172
|
if (Platform.OS === 'ios') {
|
|
457
173
|
webviewRef.current.injectJavaScript(`
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (selection && selection.rangeCount > 0) {
|
|
464
|
-
const range = selection.getRangeAt(0);
|
|
465
|
-
|
|
466
|
-
if (linkData.isExisting) {
|
|
467
|
-
let linkElement = null;
|
|
468
|
-
let node = range.startContainer;
|
|
469
|
-
|
|
470
|
-
while (node && node !== editor) {
|
|
471
|
-
if (node.nodeName === 'A') {
|
|
472
|
-
linkElement = node;
|
|
473
|
-
break;
|
|
474
|
-
}
|
|
475
|
-
node = node.parentNode;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
if (!linkElement && range.commonAncestorContainer.nodeType === 1) {
|
|
479
|
-
linkElement = range.commonAncestorContainer.querySelector('a');
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
if (linkElement) {
|
|
483
|
-
linkElement.href = linkData.url;
|
|
484
|
-
linkElement.textContent = linkData.text;
|
|
485
|
-
range.setStartAfter(linkElement);
|
|
486
|
-
range.collapse(true);
|
|
487
|
-
selection.removeAllRanges();
|
|
488
|
-
selection.addRange(range);
|
|
489
|
-
|
|
490
|
-
const charCount = editor.textContent.trim().length;
|
|
491
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
492
|
-
type: 'content',
|
|
493
|
-
html: editor.innerHTML,
|
|
494
|
-
characterCount: charCount
|
|
495
|
-
}));
|
|
496
|
-
true;
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const link = document.createElement('a');
|
|
502
|
-
link.href = linkData.url;
|
|
503
|
-
link.textContent = linkData.text;
|
|
504
|
-
link.target = '_blank';
|
|
505
|
-
range.deleteContents();
|
|
506
|
-
range.insertNode(link);
|
|
507
|
-
const space = document.createTextNode(' ');
|
|
508
|
-
link.parentNode.insertBefore(space, link.nextSibling);
|
|
509
|
-
range.setStartAfter(space);
|
|
510
|
-
range.collapse(true);
|
|
511
|
-
selection.removeAllRanges();
|
|
512
|
-
selection.addRange(range);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
const charCount = editor.textContent.trim().length;
|
|
516
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
517
|
-
type: 'content',
|
|
518
|
-
html: editor.innerHTML,
|
|
519
|
-
characterCount: charCount
|
|
520
|
-
}));
|
|
521
|
-
true;
|
|
522
|
-
`);
|
|
174
|
+
rnkitInsertLink(${linkData});
|
|
175
|
+
updateFormats();
|
|
176
|
+
true;
|
|
177
|
+
`);
|
|
523
178
|
} else {
|
|
524
179
|
webviewRef.current.postMessage('insertLink:' + linkData);
|
|
525
180
|
}
|
|
@@ -551,10 +206,12 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
551
206
|
});
|
|
552
207
|
} else if (parsed.type === 'focus') {
|
|
553
208
|
requestAnimationFrame(() => {
|
|
209
|
+
setIsFocused(true);
|
|
554
210
|
onFocus?.();
|
|
555
211
|
});
|
|
556
212
|
} else if (parsed.type === 'blur') {
|
|
557
213
|
requestAnimationFrame(() => {
|
|
214
|
+
setIsFocused(false);
|
|
558
215
|
onBlur?.();
|
|
559
216
|
});
|
|
560
217
|
} else if (parsed.type === 'selectedText') {
|
|
@@ -582,12 +239,12 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
582
239
|
const showSub = Keyboard.addListener(
|
|
583
240
|
'keyboardDidShow',
|
|
584
241
|
(e: KeyboardEvent) => {
|
|
585
|
-
|
|
242
|
+
setKeyboardVisible(true);
|
|
586
243
|
setKeyboardHeight(e.endCoordinates.height);
|
|
587
244
|
}
|
|
588
245
|
);
|
|
589
246
|
const hideSub = Keyboard.addListener('keyboardDidHide', () => {
|
|
590
|
-
|
|
247
|
+
setKeyboardVisible(false);
|
|
591
248
|
setKeyboardHeight(0);
|
|
592
249
|
});
|
|
593
250
|
|
|
@@ -597,33 +254,25 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
597
254
|
};
|
|
598
255
|
}, []);
|
|
599
256
|
|
|
600
|
-
const isFormatActive = (
|
|
257
|
+
const isFormatActive = (command: TextCommand) => activeFormats.has(command);
|
|
601
258
|
|
|
602
|
-
const
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
icon: 'list-un-ordered',
|
|
611
|
-
label: 'Bullet',
|
|
612
|
-
},
|
|
613
|
-
{ command: 'insertOrderedList', icon: 'list-ordered', label: 'Number' },
|
|
614
|
-
{ command: 'justifyLeft', icon: 'align-left', label: 'Left' },
|
|
615
|
-
{ command: 'justifyCenter', icon: 'align-center', label: 'Center' },
|
|
616
|
-
{ command: 'justifyRight', icon: 'align-right', label: 'Right' },
|
|
617
|
-
];
|
|
259
|
+
const handleToolbarPress = (command: TextCommand) => {
|
|
260
|
+
const button = TOOLBAR_BUTTONS.find((item) => item.command === command);
|
|
261
|
+
if (button?.isSpecial) {
|
|
262
|
+
openLinkModal();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
formatText(command);
|
|
266
|
+
};
|
|
618
267
|
|
|
619
268
|
return (
|
|
620
|
-
<View style={styles.container}>
|
|
269
|
+
<View testID={testID} style={styles.container}>
|
|
621
270
|
{label ? <LabelForm title={label} /> : null}
|
|
622
271
|
<KeyboardAvoidingView
|
|
623
272
|
style={[styles.editorWrapper, { minHeight: height, height: height }]}
|
|
624
273
|
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
625
274
|
>
|
|
626
|
-
<WebView
|
|
275
|
+
<WebView<object>
|
|
627
276
|
ref={webviewRef}
|
|
628
277
|
originWhitelist={['*']}
|
|
629
278
|
source={{ html: htmlEditor }}
|
|
@@ -666,88 +315,31 @@ const TextEditor = forwardRef<TextEditorRef, ExtendedTextEditorType>(
|
|
|
666
315
|
) : null}
|
|
667
316
|
|
|
668
317
|
{/* Link Modal */}
|
|
669
|
-
<
|
|
318
|
+
<LinkSheet
|
|
319
|
+
ref={inputUrlRef}
|
|
670
320
|
isOpen={showLinkModal}
|
|
321
|
+
text={linkText}
|
|
322
|
+
url={linkUrl}
|
|
323
|
+
onChangeText={setLinkText}
|
|
324
|
+
onChangeUrl={setLinkUrl}
|
|
325
|
+
onCancel={closeLinkModal}
|
|
326
|
+
onSave={insertLink}
|
|
671
327
|
onClose={() => setShowLinkModal(false)}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
placeholder={inputLinkUrlPlacholder}
|
|
688
|
-
autoCapitalize="none"
|
|
689
|
-
/>
|
|
690
|
-
</View>
|
|
691
|
-
<View style={styles.modalActions}>
|
|
692
|
-
<View style={styles.flex1}>
|
|
693
|
-
<Button
|
|
694
|
-
title={cancelLinkButtonText}
|
|
695
|
-
color="primary"
|
|
696
|
-
onPress={closeLinkModal}
|
|
697
|
-
variant="outline"
|
|
698
|
-
/>
|
|
699
|
-
</View>
|
|
700
|
-
<View style={styles.flex1}>
|
|
701
|
-
<Button
|
|
702
|
-
title={saveLinkButtonText}
|
|
703
|
-
color="primary"
|
|
704
|
-
onPress={insertLink}
|
|
705
|
-
/>
|
|
706
|
-
</View>
|
|
707
|
-
</View>
|
|
708
|
-
</BottomSheet>
|
|
709
|
-
|
|
710
|
-
{showToolbar && (
|
|
711
|
-
<Footer
|
|
712
|
-
style={[
|
|
713
|
-
styles.toolbar,
|
|
714
|
-
{
|
|
715
|
-
bottom:
|
|
716
|
-
Platform.OS === 'android' && Platform.Version < 35
|
|
717
|
-
? keyboardHeight - keyboardHeight
|
|
718
|
-
: keyboardHeight,
|
|
719
|
-
},
|
|
720
|
-
]}
|
|
721
|
-
>
|
|
722
|
-
<ScrollView
|
|
723
|
-
horizontal
|
|
724
|
-
showsHorizontalScrollIndicator={false}
|
|
725
|
-
contentContainerStyle={styles.toolbarContent}
|
|
726
|
-
>
|
|
727
|
-
{toolbarButtons.map((button) => (
|
|
728
|
-
<TouchableOpacity
|
|
729
|
-
key={button.command}
|
|
730
|
-
onPress={() =>
|
|
731
|
-
button.isSpecial
|
|
732
|
-
? openLinkModal()
|
|
733
|
-
: formatText(button.command)
|
|
734
|
-
}
|
|
735
|
-
style={[
|
|
736
|
-
styles.toolButton,
|
|
737
|
-
isFormatActive(button.command) && styles.toolButtonActive,
|
|
738
|
-
]}
|
|
739
|
-
>
|
|
740
|
-
<Icon
|
|
741
|
-
name={button.icon}
|
|
742
|
-
size={20}
|
|
743
|
-
color={
|
|
744
|
-
isFormatActive(button.command) ? '#fff' : Color.gray[900]
|
|
745
|
-
}
|
|
746
|
-
/>
|
|
747
|
-
</TouchableOpacity>
|
|
748
|
-
))}
|
|
749
|
-
</ScrollView>
|
|
750
|
-
</Footer>
|
|
328
|
+
labelText={inputLabelLinkText}
|
|
329
|
+
labelUrl={inputLabelLinkUrl}
|
|
330
|
+
placeholderText={inputLinkTextPlacholder}
|
|
331
|
+
placeholderUrl={inputLinkUrlPlacholder}
|
|
332
|
+
saveText={saveLinkButtonText}
|
|
333
|
+
cancelText={cancelLinkButtonText}
|
|
334
|
+
/>
|
|
335
|
+
|
|
336
|
+
{showToolbar && keyboardVisible && isFocused && (
|
|
337
|
+
<Toolbar
|
|
338
|
+
keyboardHeight={keyboardHeight}
|
|
339
|
+
isActive={isFormatActive}
|
|
340
|
+
onPress={handleToolbarPress}
|
|
341
|
+
testID={testID}
|
|
342
|
+
/>
|
|
751
343
|
)}
|
|
752
344
|
</View>
|
|
753
345
|
);
|