@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
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
4
|
-
import { Alert, Dimensions, Keyboard, KeyboardAvoidingView, Platform,
|
|
4
|
+
import { Alert, Dimensions, Keyboard, KeyboardAvoidingView, Platform, StyleSheet, View } from 'react-native';
|
|
5
5
|
import { WebView } from 'react-native-webview';
|
|
6
|
-
import BottomSheet from "../BottomSheet/BottomSheet.js";
|
|
7
|
-
import Button from "../Button/Button.js";
|
|
8
6
|
import Color from "../Color/Color.js";
|
|
9
|
-
import Icon from "../Icon/index.js";
|
|
10
|
-
import Input from "../Input/Input.js";
|
|
11
7
|
import LabelForm from "../LabelForm/LabelForm.js";
|
|
12
8
|
import Typography from "../Typography/Typography.js";
|
|
13
|
-
import
|
|
9
|
+
import { buildEditorDocument } from "./editorDocument.js";
|
|
10
|
+
import LinkSheet from "./LinkSheet.js";
|
|
11
|
+
import Toolbar from "./Toolbar.js";
|
|
12
|
+
import { BLOCK_COMMANDS, TOGGLE_COMMANDS, TOOLBAR_BUTTONS } from "./toolbarButtons.js";
|
|
14
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
14
|
const TextEditor = /*#__PURE__*/forwardRef(({
|
|
16
15
|
label,
|
|
@@ -28,15 +27,24 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
28
27
|
inputLabelLinkText = 'Teks Link',
|
|
29
28
|
inputLabelLinkUrl = 'Link URL',
|
|
30
29
|
saveLinkButtonText = 'Simpan',
|
|
31
|
-
cancelLinkButtonText = 'Batal'
|
|
30
|
+
cancelLinkButtonText = 'Batal',
|
|
31
|
+
showToolbar = true,
|
|
32
|
+
testID
|
|
32
33
|
}, ref) => {
|
|
33
|
-
const [
|
|
34
|
+
const [keyboardVisible, setKeyboardVisible] = useState(false);
|
|
35
|
+
// Whether the caret is in THIS editor. The keyboard is global, so without
|
|
36
|
+
// this every mounted editor would paint a toolbar the moment any field
|
|
37
|
+
// anywhere opened it -- see the toolbar gate at the bottom of the render.
|
|
38
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
34
39
|
const [activeFormats, setActiveFormats] = useState(new Set());
|
|
35
40
|
const [characterCount, setCharacterCount] = useState(0);
|
|
36
41
|
const [showLinkModal, setShowLinkModal] = useState(false);
|
|
37
42
|
const [linkText, setLinkText] = useState('');
|
|
38
43
|
const [linkUrl, setLinkUrl] = useState('');
|
|
39
44
|
const [isEditingLink, setIsEditingLink] = useState(false);
|
|
45
|
+
// WebView is declared as `class WebView<P = undefined>` whose props are
|
|
46
|
+
// `WebViewProps & P`; the default `P = undefined` collapses props to `never`
|
|
47
|
+
// under React 19 types, so pin `P` to `object` to recover `WebViewProps`.
|
|
40
48
|
const webviewRef = useRef(null);
|
|
41
49
|
const inputUrlRef = useRef(null);
|
|
42
50
|
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
@@ -54,304 +62,43 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
54
62
|
setContent: html => {
|
|
55
63
|
const escapedHtml = html.replace(/`/g, '\\`').replace(/\$/g, '\\$');
|
|
56
64
|
webviewRef.current?.injectJavaScript(`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
(function () {
|
|
66
|
+
const target = document.getElementById('editor');
|
|
67
|
+
target.innerHTML = \`${escapedHtml}\`;
|
|
68
|
+
if (target.textContent.trim()) {
|
|
69
|
+
target.classList.remove('placeholder');
|
|
70
|
+
}
|
|
71
|
+
})();
|
|
62
72
|
true;
|
|
63
73
|
`);
|
|
64
74
|
},
|
|
65
75
|
clearContent: () => {
|
|
66
76
|
webviewRef.current?.injectJavaScript(`
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
(function () {
|
|
78
|
+
const target = document.getElementById('editor');
|
|
79
|
+
target.innerHTML = '';
|
|
80
|
+
target.classList.add('placeholder');
|
|
81
|
+
window.ReactNativeWebView.postMessage('');
|
|
82
|
+
})();
|
|
71
83
|
true;
|
|
72
84
|
`);
|
|
73
85
|
}
|
|
74
86
|
}));
|
|
75
|
-
const htmlEditor =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
*::before,
|
|
82
|
-
*::after {
|
|
83
|
-
box-sizing: border-box;
|
|
84
|
-
}
|
|
85
|
-
html, body {
|
|
86
|
-
margin: 0;
|
|
87
|
-
padding: 0;
|
|
88
|
-
width: 99.9%;
|
|
89
|
-
height: 100%;
|
|
90
|
-
overflow-x: hidden;
|
|
91
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
92
|
-
}
|
|
93
|
-
#editor {
|
|
94
|
-
height: 100%;
|
|
95
|
-
width: 100%;
|
|
96
|
-
max-width: 100%;
|
|
97
|
-
font-size: 14px;
|
|
98
|
-
line-height: 1.5;
|
|
99
|
-
border-radius: 6px;
|
|
100
|
-
outline: none;
|
|
101
|
-
transition: border 0.2s;
|
|
102
|
-
overflow-wrap: break-word;
|
|
103
|
-
font-weight: 400;
|
|
104
|
-
word-wrap: break-word;
|
|
105
|
-
word-break: break-word;
|
|
106
|
-
color: #333;
|
|
107
|
-
}
|
|
108
|
-
#editor.placeholder:empty:before {
|
|
109
|
-
content: '${placeholder}';
|
|
110
|
-
color: ${Color.gray[400]};
|
|
111
|
-
font-style: italic;
|
|
112
|
-
}
|
|
113
|
-
#editor:focus {
|
|
114
|
-
outline: none;
|
|
115
|
-
}
|
|
116
|
-
/* Style untuk list */
|
|
117
|
-
#editor ul, #editor ol {
|
|
118
|
-
margin: 8px 0;
|
|
119
|
-
padding-left: 24px;
|
|
120
|
-
}
|
|
121
|
-
#editor li {
|
|
122
|
-
margin: 4px 0;
|
|
123
|
-
}
|
|
124
|
-
/* Style untuk heading */
|
|
125
|
-
#editor h1 { font-size: 24px; font-weight: bold; margin: 12px 0; }
|
|
126
|
-
#editor h2 { font-size: 20px; font-weight: bold; margin: 10px 0; }
|
|
127
|
-
#editor h3 { font-size: 16px; font-weight: bold; margin: 8px 0; }
|
|
128
|
-
/* Style untuk link */
|
|
129
|
-
#editor a {
|
|
130
|
-
color: #3b82f6;
|
|
131
|
-
text-decoration: underline;
|
|
132
|
-
cursor: pointer;
|
|
133
|
-
}
|
|
134
|
-
#editor a:hover {
|
|
135
|
-
color: #2563eb;
|
|
136
|
-
}
|
|
137
|
-
</style>
|
|
138
|
-
</head>
|
|
139
|
-
<body>
|
|
140
|
-
<div id="editor" contenteditable="true" class="placeholder">${initialValue}</div>
|
|
141
|
-
<script>
|
|
142
|
-
const editor = document.getElementById("editor");
|
|
143
|
-
|
|
144
|
-
// Handle placeholder
|
|
145
|
-
if (editor.textContent.trim()) {
|
|
146
|
-
editor.classList.remove('placeholder');
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Kirim initial character count saat load
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
const charCount = editor.textContent.trim().length;
|
|
152
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
153
|
-
type: 'initialCount',
|
|
154
|
-
characterCount: charCount
|
|
155
|
-
}));
|
|
156
|
-
}, 100);
|
|
157
|
-
|
|
158
|
-
editor.addEventListener("input", () => {
|
|
159
|
-
if (editor.textContent.trim()) {
|
|
160
|
-
editor.classList.remove('placeholder');
|
|
161
|
-
} else {
|
|
162
|
-
editor.classList.add('placeholder');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Kirim HTML dan character count
|
|
166
|
-
const charCount = editor.textContent.trim().length;
|
|
167
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
168
|
-
type: 'content',
|
|
169
|
-
html: editor.innerHTML,
|
|
170
|
-
characterCount: charCount
|
|
171
|
-
}));
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
editor.addEventListener("focus", () => {
|
|
175
|
-
editor.classList.add("focused");
|
|
176
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'focus' }));
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
editor.addEventListener("blur", () => {
|
|
180
|
-
editor.classList.remove("focused");
|
|
181
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'blur' }));
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// Update active formats
|
|
185
|
-
editor.addEventListener("mouseup", updateFormats);
|
|
186
|
-
editor.addEventListener("keyup", updateFormats);
|
|
187
|
-
editor.addEventListener("click", updateFormats);
|
|
188
|
-
|
|
189
|
-
function updateFormats() {
|
|
190
|
-
const formats = [];
|
|
191
|
-
if (document.queryCommandState('bold')) formats.push('bold');
|
|
192
|
-
if (document.queryCommandState('italic')) formats.push('italic');
|
|
193
|
-
if (document.queryCommandState('underline')) formats.push('underline');
|
|
194
|
-
if (document.queryCommandState('strikeThrough')) formats.push('strikeThrough');
|
|
195
|
-
|
|
196
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
197
|
-
type: 'formats',
|
|
198
|
-
formats: formats
|
|
199
|
-
}));
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function getSelectedLinkInfo() {
|
|
203
|
-
const selection = window.getSelection();
|
|
204
|
-
if (!selection || selection.rangeCount === 0) {
|
|
205
|
-
return { text: '', url: '' };
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const range = selection.getRangeAt(0);
|
|
209
|
-
let linkElement = null;
|
|
210
|
-
|
|
211
|
-
// Check if selection contains or is within a link
|
|
212
|
-
if (range.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
213
|
-
linkElement = range.startContainer.querySelector('a');
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Check parent nodes for link
|
|
217
|
-
let node = range.startContainer;
|
|
218
|
-
while (node && node !== editor) {
|
|
219
|
-
if (node.nodeName === 'A') {
|
|
220
|
-
linkElement = node;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
node = node.parentNode;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Check if any node in selection is a link
|
|
227
|
-
if (!linkElement && range.commonAncestorContainer) {
|
|
228
|
-
const container = range.commonAncestorContainer;
|
|
229
|
-
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
230
|
-
linkElement = container.querySelector('a');
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (linkElement) {
|
|
235
|
-
return {
|
|
236
|
-
text: linkElement.textContent || '',
|
|
237
|
-
url: linkElement.href || '',
|
|
238
|
-
isExisting: true
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return {
|
|
243
|
-
text: selection.toString(),
|
|
244
|
-
url: '',
|
|
245
|
-
isExisting: false
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const handleMessage = (command) => {
|
|
250
|
-
if (command === 'getContent') {
|
|
251
|
-
window.ReactNativeWebView.postMessage(editor.innerHTML);
|
|
252
|
-
} else if (command === 'getSelectedText') {
|
|
253
|
-
const linkInfo = getSelectedLinkInfo();
|
|
254
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
255
|
-
type: 'selectedText',
|
|
256
|
-
text: linkInfo.text,
|
|
257
|
-
url: linkInfo.url,
|
|
258
|
-
isExisting: linkInfo.isExisting
|
|
259
|
-
}));
|
|
260
|
-
} else if (command.startsWith('insertLink:')) {
|
|
261
|
-
const linkData = command.replace('insertLink:', '');
|
|
262
|
-
const { text, url, isExisting } = JSON.parse(linkData);
|
|
263
|
-
editor.focus();
|
|
264
|
-
const selection = window.getSelection();
|
|
265
|
-
|
|
266
|
-
if (selection && selection.rangeCount > 0) {
|
|
267
|
-
const range = selection.getRangeAt(0);
|
|
268
|
-
|
|
269
|
-
// If editing existing link, find and update it
|
|
270
|
-
if (isExisting) {
|
|
271
|
-
let linkElement = null;
|
|
272
|
-
let node = range.startContainer;
|
|
273
|
-
|
|
274
|
-
while (node && node !== editor) {
|
|
275
|
-
if (node.nodeName === 'A') {
|
|
276
|
-
linkElement = node;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
node = node.parentNode;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (!linkElement && range.commonAncestorContainer.nodeType === Node.ELEMENT_NODE) {
|
|
283
|
-
linkElement = range.commonAncestorContainer.querySelector('a');
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if (linkElement) {
|
|
287
|
-
linkElement.href = url;
|
|
288
|
-
linkElement.textContent = text;
|
|
289
|
-
// Move cursor after link
|
|
290
|
-
range.setStartAfter(linkElement);
|
|
291
|
-
range.collapse(true);
|
|
292
|
-
selection.removeAllRanges();
|
|
293
|
-
selection.addRange(range);
|
|
294
|
-
|
|
295
|
-
// Update content dan character count
|
|
296
|
-
const charCount = editor.textContent.trim().length;
|
|
297
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
298
|
-
type: 'content',
|
|
299
|
-
html: editor.innerHTML,
|
|
300
|
-
characterCount: charCount
|
|
301
|
-
}));
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// Create new link
|
|
307
|
-
const link = document.createElement('a');
|
|
308
|
-
link.href = url;
|
|
309
|
-
link.textContent = text;
|
|
310
|
-
link.target = '_blank';
|
|
311
|
-
range.deleteContents();
|
|
312
|
-
range.insertNode(link);
|
|
313
|
-
// Add space after link
|
|
314
|
-
const space = document.createTextNode(' ');
|
|
315
|
-
link.parentNode.insertBefore(space, link.nextSibling);
|
|
316
|
-
// Move cursor after space
|
|
317
|
-
range.setStartAfter(space);
|
|
318
|
-
range.collapse(true);
|
|
319
|
-
selection.removeAllRanges();
|
|
320
|
-
selection.addRange(range);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Update content dan character count
|
|
324
|
-
const charCount = editor.textContent.trim().length;
|
|
325
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
326
|
-
type: 'content',
|
|
327
|
-
html: editor.innerHTML,
|
|
328
|
-
characterCount: charCount
|
|
329
|
-
}));
|
|
330
|
-
} else {
|
|
331
|
-
editor.focus();
|
|
332
|
-
document.execCommand(command, false, null);
|
|
333
|
-
updateFormats();
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
// untuk Android
|
|
338
|
-
document.addEventListener("message", (event) => {
|
|
339
|
-
handleMessage(event.data);
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
// untuk iOS
|
|
343
|
-
window.addEventListener("message", (event) => {
|
|
344
|
-
handleMessage(event.data);
|
|
345
|
-
});
|
|
346
|
-
</script>
|
|
347
|
-
</body>
|
|
348
|
-
</html>
|
|
349
|
-
`;
|
|
87
|
+
const htmlEditor = buildEditorDocument({
|
|
88
|
+
placeholder,
|
|
89
|
+
initialValue,
|
|
90
|
+
toggleCommands: TOGGLE_COMMANDS,
|
|
91
|
+
blockCommands: BLOCK_COMMANDS
|
|
92
|
+
});
|
|
350
93
|
const formatText = command => {
|
|
351
94
|
if (webviewRef.current) {
|
|
352
95
|
if (Platform.OS === 'ios') {
|
|
96
|
+
// updateFormats() matters as much as the command itself: without it
|
|
97
|
+
// iOS applied the format but left the button unlit until the editor
|
|
98
|
+
// was touched again. Android gets this for free via handleMessage.
|
|
353
99
|
webviewRef.current.injectJavaScript(`
|
|
354
|
-
|
|
100
|
+
rnkitRunCommand(${JSON.stringify(command)});
|
|
101
|
+
updateFormats();
|
|
355
102
|
true; //di ios harus biar berfunsi boldnya
|
|
356
103
|
`);
|
|
357
104
|
} else {
|
|
@@ -385,71 +132,10 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
385
132
|
if (webviewRef.current) {
|
|
386
133
|
if (Platform.OS === 'ios') {
|
|
387
134
|
webviewRef.current.injectJavaScript(`
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (selection && selection.rangeCount > 0) {
|
|
394
|
-
const range = selection.getRangeAt(0);
|
|
395
|
-
|
|
396
|
-
if (linkData.isExisting) {
|
|
397
|
-
let linkElement = null;
|
|
398
|
-
let node = range.startContainer;
|
|
399
|
-
|
|
400
|
-
while (node && node !== editor) {
|
|
401
|
-
if (node.nodeName === 'A') {
|
|
402
|
-
linkElement = node;
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
node = node.parentNode;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
if (!linkElement && range.commonAncestorContainer.nodeType === 1) {
|
|
409
|
-
linkElement = range.commonAncestorContainer.querySelector('a');
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
if (linkElement) {
|
|
413
|
-
linkElement.href = linkData.url;
|
|
414
|
-
linkElement.textContent = linkData.text;
|
|
415
|
-
range.setStartAfter(linkElement);
|
|
416
|
-
range.collapse(true);
|
|
417
|
-
selection.removeAllRanges();
|
|
418
|
-
selection.addRange(range);
|
|
419
|
-
|
|
420
|
-
const charCount = editor.textContent.trim().length;
|
|
421
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
422
|
-
type: 'content',
|
|
423
|
-
html: editor.innerHTML,
|
|
424
|
-
characterCount: charCount
|
|
425
|
-
}));
|
|
426
|
-
true;
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
const link = document.createElement('a');
|
|
432
|
-
link.href = linkData.url;
|
|
433
|
-
link.textContent = linkData.text;
|
|
434
|
-
link.target = '_blank';
|
|
435
|
-
range.deleteContents();
|
|
436
|
-
range.insertNode(link);
|
|
437
|
-
const space = document.createTextNode(' ');
|
|
438
|
-
link.parentNode.insertBefore(space, link.nextSibling);
|
|
439
|
-
range.setStartAfter(space);
|
|
440
|
-
range.collapse(true);
|
|
441
|
-
selection.removeAllRanges();
|
|
442
|
-
selection.addRange(range);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
const charCount = editor.textContent.trim().length;
|
|
446
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
447
|
-
type: 'content',
|
|
448
|
-
html: editor.innerHTML,
|
|
449
|
-
characterCount: charCount
|
|
450
|
-
}));
|
|
451
|
-
true;
|
|
452
|
-
`);
|
|
135
|
+
rnkitInsertLink(${linkData});
|
|
136
|
+
updateFormats();
|
|
137
|
+
true;
|
|
138
|
+
`);
|
|
453
139
|
} else {
|
|
454
140
|
webviewRef.current.postMessage('insertLink:' + linkData);
|
|
455
141
|
}
|
|
@@ -475,10 +161,12 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
475
161
|
});
|
|
476
162
|
} else if (parsed.type === 'focus') {
|
|
477
163
|
requestAnimationFrame(() => {
|
|
164
|
+
setIsFocused(true);
|
|
478
165
|
onFocus?.();
|
|
479
166
|
});
|
|
480
167
|
} else if (parsed.type === 'blur') {
|
|
481
168
|
requestAnimationFrame(() => {
|
|
169
|
+
setIsFocused(false);
|
|
482
170
|
onBlur?.();
|
|
483
171
|
});
|
|
484
172
|
} else if (parsed.type === 'selectedText') {
|
|
@@ -503,11 +191,11 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
503
191
|
};
|
|
504
192
|
useEffect(() => {
|
|
505
193
|
const showSub = Keyboard.addListener('keyboardDidShow', e => {
|
|
506
|
-
|
|
194
|
+
setKeyboardVisible(true);
|
|
507
195
|
setKeyboardHeight(e.endCoordinates.height);
|
|
508
196
|
});
|
|
509
197
|
const hideSub = Keyboard.addListener('keyboardDidHide', () => {
|
|
510
|
-
|
|
198
|
+
setKeyboardVisible(false);
|
|
511
199
|
setKeyboardHeight(0);
|
|
512
200
|
});
|
|
513
201
|
return () => {
|
|
@@ -515,50 +203,17 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
515
203
|
hideSub.remove();
|
|
516
204
|
};
|
|
517
205
|
}, []);
|
|
518
|
-
const isFormatActive =
|
|
519
|
-
const
|
|
520
|
-
command
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
}, {
|
|
528
|
-
command: 'underline',
|
|
529
|
-
icon: 'UnderLine',
|
|
530
|
-
label: 'Underline'
|
|
531
|
-
}, {
|
|
532
|
-
command: 'strikeThrough',
|
|
533
|
-
icon: 'strike-through',
|
|
534
|
-
label: 'Strike'
|
|
535
|
-
}, {
|
|
536
|
-
command: 'link',
|
|
537
|
-
icon: 'Link',
|
|
538
|
-
label: 'Link',
|
|
539
|
-
isSpecial: true
|
|
540
|
-
}, {
|
|
541
|
-
command: 'insertUnorderedList',
|
|
542
|
-
icon: 'list-un-ordered',
|
|
543
|
-
label: 'Bullet'
|
|
544
|
-
}, {
|
|
545
|
-
command: 'insertOrderedList',
|
|
546
|
-
icon: 'list-ordered',
|
|
547
|
-
label: 'Number'
|
|
548
|
-
}, {
|
|
549
|
-
command: 'justifyLeft',
|
|
550
|
-
icon: 'align-left',
|
|
551
|
-
label: 'Left'
|
|
552
|
-
}, {
|
|
553
|
-
command: 'justifyCenter',
|
|
554
|
-
icon: 'align-center',
|
|
555
|
-
label: 'Center'
|
|
556
|
-
}, {
|
|
557
|
-
command: 'justifyRight',
|
|
558
|
-
icon: 'align-right',
|
|
559
|
-
label: 'Right'
|
|
560
|
-
}];
|
|
206
|
+
const isFormatActive = command => activeFormats.has(command);
|
|
207
|
+
const handleToolbarPress = command => {
|
|
208
|
+
const button = TOOLBAR_BUTTONS.find(item => item.command === command);
|
|
209
|
+
if (button?.isSpecial) {
|
|
210
|
+
openLinkModal();
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
formatText(command);
|
|
214
|
+
};
|
|
561
215
|
return /*#__PURE__*/_jsxs(View, {
|
|
216
|
+
testID: testID,
|
|
562
217
|
style: styles.container,
|
|
563
218
|
children: [label ? /*#__PURE__*/_jsx(LabelForm, {
|
|
564
219
|
title: label
|
|
@@ -596,63 +251,27 @@ const TextEditor = /*#__PURE__*/forwardRef(({
|
|
|
596
251
|
weight: "medium",
|
|
597
252
|
children: [characterCount, "/", maxLength]
|
|
598
253
|
})]
|
|
599
|
-
}) : null, /*#__PURE__*/
|
|
254
|
+
}) : null, /*#__PURE__*/_jsx(LinkSheet, {
|
|
255
|
+
ref: inputUrlRef,
|
|
600
256
|
isOpen: showLinkModal,
|
|
257
|
+
text: linkText,
|
|
258
|
+
url: linkUrl,
|
|
259
|
+
onChangeText: setLinkText,
|
|
260
|
+
onChangeUrl: setLinkUrl,
|
|
261
|
+
onCancel: closeLinkModal,
|
|
262
|
+
onSave: insertLink,
|
|
601
263
|
onClose: () => setShowLinkModal(false),
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
label: inputLabelLinkUrl,
|
|
614
|
-
value: linkUrl,
|
|
615
|
-
onChangeText: setLinkUrl,
|
|
616
|
-
placeholder: inputLinkUrlPlacholder,
|
|
617
|
-
autoCapitalize: "none"
|
|
618
|
-
})]
|
|
619
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
620
|
-
style: styles.modalActions,
|
|
621
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
622
|
-
style: styles.flex1,
|
|
623
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
624
|
-
title: cancelLinkButtonText,
|
|
625
|
-
color: "primary",
|
|
626
|
-
onPress: closeLinkModal,
|
|
627
|
-
variant: "outline"
|
|
628
|
-
})
|
|
629
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
630
|
-
style: styles.flex1,
|
|
631
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
632
|
-
title: saveLinkButtonText,
|
|
633
|
-
color: "primary",
|
|
634
|
-
onPress: insertLink
|
|
635
|
-
})
|
|
636
|
-
})]
|
|
637
|
-
})]
|
|
638
|
-
}), showToolbar && /*#__PURE__*/_jsx(Footer, {
|
|
639
|
-
style: [styles.toolbar, {
|
|
640
|
-
bottom: Platform.OS === 'android' && Platform.Version < 35 ? keyboardHeight - keyboardHeight : keyboardHeight
|
|
641
|
-
}],
|
|
642
|
-
children: /*#__PURE__*/_jsx(ScrollView, {
|
|
643
|
-
horizontal: true,
|
|
644
|
-
showsHorizontalScrollIndicator: false,
|
|
645
|
-
contentContainerStyle: styles.toolbarContent,
|
|
646
|
-
children: toolbarButtons.map(button => /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
647
|
-
onPress: () => button.isSpecial ? openLinkModal() : formatText(button.command),
|
|
648
|
-
style: [styles.toolButton, isFormatActive(button.command) && styles.toolButtonActive],
|
|
649
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
650
|
-
name: button.icon,
|
|
651
|
-
size: 20,
|
|
652
|
-
color: isFormatActive(button.command) ? '#fff' : Color.gray[900]
|
|
653
|
-
})
|
|
654
|
-
}, button.command))
|
|
655
|
-
})
|
|
264
|
+
labelText: inputLabelLinkText,
|
|
265
|
+
labelUrl: inputLabelLinkUrl,
|
|
266
|
+
placeholderText: inputLinkTextPlacholder,
|
|
267
|
+
placeholderUrl: inputLinkUrlPlacholder,
|
|
268
|
+
saveText: saveLinkButtonText,
|
|
269
|
+
cancelText: cancelLinkButtonText
|
|
270
|
+
}), showToolbar && keyboardVisible && isFocused && /*#__PURE__*/_jsx(Toolbar, {
|
|
271
|
+
keyboardHeight: keyboardHeight,
|
|
272
|
+
isActive: isFormatActive,
|
|
273
|
+
onPress: handleToolbarPress,
|
|
274
|
+
testID: testID
|
|
656
275
|
})]
|
|
657
276
|
});
|
|
658
277
|
});
|