@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
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Platform,
|
|
3
|
+
ScrollView,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import Color from '../Color/Color';
|
|
8
|
+
import Icon from '../Icon';
|
|
9
|
+
import Typography from '../Typography/Typography';
|
|
10
|
+
import Footer from '../Ui/Footer';
|
|
11
|
+
import { getTestID } from '../helpers/getTestID';
|
|
12
|
+
import { TOOLBAR_BUTTONS } from './toolbarButtons';
|
|
13
|
+
import type { TextCommand } from './types';
|
|
14
|
+
|
|
15
|
+
interface ToolbarProps {
|
|
16
|
+
keyboardHeight: number;
|
|
17
|
+
isActive: (command: TextCommand) => boolean;
|
|
18
|
+
onPress: (command: TextCommand) => void;
|
|
19
|
+
testID?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The formatting bar that floats above the keyboard.
|
|
24
|
+
*
|
|
25
|
+
* Buttons render an icon, or their `text` when no icon fits -- the headings
|
|
26
|
+
* have no glyph in Icon.
|
|
27
|
+
*/
|
|
28
|
+
export default function Toolbar({
|
|
29
|
+
keyboardHeight,
|
|
30
|
+
isActive,
|
|
31
|
+
onPress,
|
|
32
|
+
testID,
|
|
33
|
+
}: ToolbarProps) {
|
|
34
|
+
return (
|
|
35
|
+
<Footer
|
|
36
|
+
style={[
|
|
37
|
+
styles.toolbar,
|
|
38
|
+
{
|
|
39
|
+
bottom:
|
|
40
|
+
Platform.OS === 'android' && Platform.Version < 35
|
|
41
|
+
? keyboardHeight - keyboardHeight
|
|
42
|
+
: keyboardHeight,
|
|
43
|
+
},
|
|
44
|
+
]}
|
|
45
|
+
>
|
|
46
|
+
<ScrollView
|
|
47
|
+
horizontal
|
|
48
|
+
showsHorizontalScrollIndicator={false}
|
|
49
|
+
contentContainerStyle={styles.content}
|
|
50
|
+
>
|
|
51
|
+
{TOOLBAR_BUTTONS.map((button) => (
|
|
52
|
+
<TouchableOpacity
|
|
53
|
+
key={button.command}
|
|
54
|
+
testID={getTestID(testID, button.command)}
|
|
55
|
+
accessibilityLabel={button.label}
|
|
56
|
+
onPress={() => onPress(button.command)}
|
|
57
|
+
style={[
|
|
58
|
+
styles.button,
|
|
59
|
+
isActive(button.command) && styles.buttonActive,
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
{button.icon ? (
|
|
63
|
+
<Icon
|
|
64
|
+
name={button.icon}
|
|
65
|
+
size={20}
|
|
66
|
+
color={isActive(button.command) ? '#fff' : Color.gray[900]}
|
|
67
|
+
/>
|
|
68
|
+
) : (
|
|
69
|
+
<Typography
|
|
70
|
+
variant="t2"
|
|
71
|
+
weight="semibold"
|
|
72
|
+
color={isActive(button.command) ? '#fff' : Color.gray[900]}
|
|
73
|
+
>
|
|
74
|
+
{button.text}
|
|
75
|
+
</Typography>
|
|
76
|
+
)}
|
|
77
|
+
</TouchableOpacity>
|
|
78
|
+
))}
|
|
79
|
+
</ScrollView>
|
|
80
|
+
</Footer>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const styles = StyleSheet.create({
|
|
85
|
+
toolbar: {
|
|
86
|
+
borderTopWidth: 1,
|
|
87
|
+
borderTopColor: Color.gray[100],
|
|
88
|
+
backgroundColor: Color.base.white100,
|
|
89
|
+
},
|
|
90
|
+
content: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: 4,
|
|
94
|
+
paddingHorizontal: 12,
|
|
95
|
+
paddingVertical: 8,
|
|
96
|
+
},
|
|
97
|
+
button: {
|
|
98
|
+
padding: 8,
|
|
99
|
+
borderRadius: 6,
|
|
100
|
+
},
|
|
101
|
+
buttonActive: {
|
|
102
|
+
backgroundColor: Color.primary[1000],
|
|
103
|
+
},
|
|
104
|
+
});
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import Color from '../Color/Color';
|
|
2
|
+
import {
|
|
3
|
+
buildCommandScript,
|
|
4
|
+
buildFormatStateScript,
|
|
5
|
+
buildLinkScript,
|
|
6
|
+
} from './formatState';
|
|
7
|
+
|
|
8
|
+
interface EditorDocumentOptions {
|
|
9
|
+
placeholder: string;
|
|
10
|
+
initialValue: string;
|
|
11
|
+
/** Commands answered by queryCommandState. */
|
|
12
|
+
toggleCommands: readonly string[];
|
|
13
|
+
/** Block names compared against queryCommandValue('formatBlock'). */
|
|
14
|
+
blockCommands: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Builds the HTML document the editor webview loads.
|
|
19
|
+
*
|
|
20
|
+
* It lives apart from the component because it is the single largest thing in
|
|
21
|
+
* this folder and has nothing to do with React: it is a document plus the
|
|
22
|
+
* scripts that run inside it. The behavioural pieces it embeds
|
|
23
|
+
* (rnkitActiveFormats, rnkitRunCommand) come from formatState.ts, where they
|
|
24
|
+
* are executed against a stubbed DOM in tests.
|
|
25
|
+
*/
|
|
26
|
+
export const buildEditorDocument = ({
|
|
27
|
+
placeholder,
|
|
28
|
+
initialValue,
|
|
29
|
+
toggleCommands,
|
|
30
|
+
blockCommands,
|
|
31
|
+
}: EditorDocumentOptions) => `
|
|
32
|
+
<html>
|
|
33
|
+
<head>
|
|
34
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
35
|
+
<style>
|
|
36
|
+
*,
|
|
37
|
+
*::before,
|
|
38
|
+
*::after {
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
}
|
|
41
|
+
html, body {
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: 0;
|
|
44
|
+
width: 99.9%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
overflow-x: hidden;
|
|
47
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
48
|
+
}
|
|
49
|
+
#editor {
|
|
50
|
+
height: 100%;
|
|
51
|
+
width: 100%;
|
|
52
|
+
max-width: 100%;
|
|
53
|
+
font-size: 14px;
|
|
54
|
+
line-height: 1.5;
|
|
55
|
+
border-radius: 6px;
|
|
56
|
+
outline: none;
|
|
57
|
+
transition: border 0.2s;
|
|
58
|
+
overflow-wrap: break-word;
|
|
59
|
+
font-weight: 400;
|
|
60
|
+
word-wrap: break-word;
|
|
61
|
+
word-break: break-word;
|
|
62
|
+
color: #333;
|
|
63
|
+
}
|
|
64
|
+
#editor.placeholder:empty:before {
|
|
65
|
+
content: '${placeholder}';
|
|
66
|
+
color: ${Color.gray[400]};
|
|
67
|
+
font-style: italic;
|
|
68
|
+
}
|
|
69
|
+
#editor:focus {
|
|
70
|
+
outline: none;
|
|
71
|
+
}
|
|
72
|
+
/* Style untuk list */
|
|
73
|
+
#editor ul, #editor ol {
|
|
74
|
+
margin: 8px 0;
|
|
75
|
+
padding-left: 24px;
|
|
76
|
+
}
|
|
77
|
+
#editor li {
|
|
78
|
+
margin: 4px 0;
|
|
79
|
+
}
|
|
80
|
+
/* Style untuk heading */
|
|
81
|
+
#editor h1 { font-size: 24px; font-weight: bold; margin: 12px 0; }
|
|
82
|
+
#editor h2 { font-size: 20px; font-weight: bold; margin: 10px 0; }
|
|
83
|
+
#editor h3 { font-size: 16px; font-weight: bold; margin: 8px 0; }
|
|
84
|
+
/* Style untuk link */
|
|
85
|
+
#editor a {
|
|
86
|
+
color: #3b82f6;
|
|
87
|
+
text-decoration: underline;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
#editor a:hover {
|
|
91
|
+
color: #2563eb;
|
|
92
|
+
}
|
|
93
|
+
</style>
|
|
94
|
+
</head>
|
|
95
|
+
<body>
|
|
96
|
+
<div id="editor" contenteditable="true" class="placeholder">${initialValue}</div>
|
|
97
|
+
<script>
|
|
98
|
+
const editor = document.getElementById("editor");
|
|
99
|
+
|
|
100
|
+
// Handle placeholder
|
|
101
|
+
if (editor.textContent.trim()) {
|
|
102
|
+
editor.classList.remove('placeholder');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Kirim initial character count saat load
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
const charCount = editor.textContent.trim().length;
|
|
108
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
109
|
+
type: 'initialCount',
|
|
110
|
+
characterCount: charCount
|
|
111
|
+
}));
|
|
112
|
+
}, 100);
|
|
113
|
+
|
|
114
|
+
editor.addEventListener("input", () => {
|
|
115
|
+
if (editor.textContent.trim()) {
|
|
116
|
+
editor.classList.remove('placeholder');
|
|
117
|
+
} else {
|
|
118
|
+
editor.classList.add('placeholder');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Kirim HTML dan character count
|
|
122
|
+
const charCount = editor.textContent.trim().length;
|
|
123
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
124
|
+
type: 'content',
|
|
125
|
+
html: editor.innerHTML,
|
|
126
|
+
characterCount: charCount
|
|
127
|
+
}));
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
editor.addEventListener("focus", () => {
|
|
131
|
+
editor.classList.add("focused");
|
|
132
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'focus' }));
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
editor.addEventListener("blur", () => {
|
|
136
|
+
editor.classList.remove("focused");
|
|
137
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'blur' }));
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
// Update active formats
|
|
141
|
+
editor.addEventListener("mouseup", updateFormats);
|
|
142
|
+
editor.addEventListener("keyup", updateFormats);
|
|
143
|
+
editor.addEventListener("click", updateFormats);
|
|
144
|
+
|
|
145
|
+
// Caret moves that are not a click or keyup -- arrow keys held down,
|
|
146
|
+
// programmatic selection, autocorrect -- only surface here.
|
|
147
|
+
document.addEventListener('selectionchange', function () {
|
|
148
|
+
if (document.activeElement === editor) updateFormats();
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
${buildFormatStateScript(toggleCommands, blockCommands)}
|
|
152
|
+
|
|
153
|
+
${buildCommandScript()}
|
|
154
|
+
|
|
155
|
+
${buildLinkScript()}
|
|
156
|
+
|
|
157
|
+
function updateFormats() {
|
|
158
|
+
var formats = rnkitActiveFormats();
|
|
159
|
+
|
|
160
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
161
|
+
type: 'formats',
|
|
162
|
+
formats: formats
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function getSelectedLinkInfo() {
|
|
167
|
+
const selection = window.getSelection();
|
|
168
|
+
if (!selection || selection.rangeCount === 0) {
|
|
169
|
+
return { text: '', url: '' };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const range = selection.getRangeAt(0);
|
|
173
|
+
let linkElement = null;
|
|
174
|
+
|
|
175
|
+
// Check if selection contains or is within a link
|
|
176
|
+
if (range.startContainer.nodeType === Node.ELEMENT_NODE) {
|
|
177
|
+
linkElement = range.startContainer.querySelector('a');
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Check parent nodes for link
|
|
181
|
+
let node = range.startContainer;
|
|
182
|
+
while (node && node !== editor) {
|
|
183
|
+
if (node.nodeName === 'A') {
|
|
184
|
+
linkElement = node;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
node = node.parentNode;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Check if any node in selection is a link
|
|
191
|
+
if (!linkElement && range.commonAncestorContainer) {
|
|
192
|
+
const container = range.commonAncestorContainer;
|
|
193
|
+
if (container.nodeType === Node.ELEMENT_NODE) {
|
|
194
|
+
linkElement = container.querySelector('a');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (linkElement) {
|
|
199
|
+
return {
|
|
200
|
+
text: linkElement.textContent || '',
|
|
201
|
+
url: linkElement.href || '',
|
|
202
|
+
isExisting: true
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
text: selection.toString(),
|
|
208
|
+
url: '',
|
|
209
|
+
isExisting: false
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const handleMessage = (command) => {
|
|
214
|
+
if (command === 'getContent') {
|
|
215
|
+
window.ReactNativeWebView.postMessage(editor.innerHTML);
|
|
216
|
+
} else if (command === 'getSelectedText') {
|
|
217
|
+
const linkInfo = getSelectedLinkInfo();
|
|
218
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
219
|
+
type: 'selectedText',
|
|
220
|
+
text: linkInfo.text,
|
|
221
|
+
url: linkInfo.url,
|
|
222
|
+
isExisting: linkInfo.isExisting
|
|
223
|
+
}));
|
|
224
|
+
} else if (command.startsWith('insertLink:')) {
|
|
225
|
+
rnkitInsertLink(JSON.parse(command.replace('insertLink:', '')));
|
|
226
|
+
updateFormats();
|
|
227
|
+
} else {
|
|
228
|
+
editor.focus();
|
|
229
|
+
rnkitRunCommand(command);
|
|
230
|
+
updateFormats();
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// untuk Android
|
|
235
|
+
document.addEventListener("message", (event) => {
|
|
236
|
+
handleMessage(event.data);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// untuk iOS
|
|
240
|
+
window.addEventListener("message", (event) => {
|
|
241
|
+
handleMessage(event.data);
|
|
242
|
+
});
|
|
243
|
+
</script>
|
|
244
|
+
</body>
|
|
245
|
+
</html>
|
|
246
|
+
`;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the snippet the editor webview uses to decide which toolbar buttons
|
|
3
|
+
* light up.
|
|
4
|
+
*
|
|
5
|
+
* It lives here rather than inline in the page HTML so it can be executed and
|
|
6
|
+
* asserted on directly -- the link/underline clash it handles is subtle, and
|
|
7
|
+
* buried inside a template literal it was neither visible nor testable.
|
|
8
|
+
*
|
|
9
|
+
* Defines `rnkitActiveFormats()` in the webview scope, returning the list of
|
|
10
|
+
* active commands.
|
|
11
|
+
*
|
|
12
|
+
* @param toggleCommands commands answered by `queryCommandState` (bold, lists,
|
|
13
|
+
* alignment, …)
|
|
14
|
+
* @param blockCommands block names compared against `queryCommandValue`
|
|
15
|
+
* ('formatBlock'), i.e. the headings
|
|
16
|
+
*/
|
|
17
|
+
export const buildFormatStateScript = (
|
|
18
|
+
toggleCommands: readonly string[],
|
|
19
|
+
blockCommands: readonly string[]
|
|
20
|
+
) => `
|
|
21
|
+
function rnkitSelectionAncestor(tagName) {
|
|
22
|
+
var selection = window.getSelection();
|
|
23
|
+
if (!selection || selection.rangeCount === 0) return null;
|
|
24
|
+
|
|
25
|
+
var node = selection.getRangeAt(0).startContainer;
|
|
26
|
+
while (node && node !== editor) {
|
|
27
|
+
if (node.nodeName === tagName) return node;
|
|
28
|
+
node = node.parentNode;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function rnkitActiveFormats() {
|
|
34
|
+
var formats = ${JSON.stringify(toggleCommands)}.filter(function (command) {
|
|
35
|
+
// The stylesheet underlines every <a>, and queryCommandState reports
|
|
36
|
+
// that as an active underline -- indistinguishable from a real <u>. So
|
|
37
|
+
// inside a link, ask the DOM instead; otherwise the button latches on
|
|
38
|
+
// the moment a link is inserted and can never be switched off.
|
|
39
|
+
if (command === 'underline' && rnkitSelectionAncestor('A')) {
|
|
40
|
+
return !!rnkitSelectionAncestor('U');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
return document.queryCommandState(command);
|
|
45
|
+
} catch (error) {
|
|
46
|
+
// Browsers throw for commands they do not implement; treat those as
|
|
47
|
+
// simply not active.
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var block = '';
|
|
53
|
+
try {
|
|
54
|
+
block = String(document.queryCommandValue('formatBlock') || '')
|
|
55
|
+
.toLowerCase();
|
|
56
|
+
} catch (error) {
|
|
57
|
+
block = '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
${JSON.stringify(blockCommands)}.forEach(function (command) {
|
|
61
|
+
if (block === command) formats.push(command);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
return formats;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
/** Block names that `removeFormat` cannot touch, so clearing must undo them. */
|
|
69
|
+
const BLOCK_LEVEL_FORMATS = ['h1', 'h2', 'h3'];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Builds the snippet that runs a toolbar command inside the webview.
|
|
73
|
+
*
|
|
74
|
+
* Defines `rnkitRunCommand(command)`. Both platforms go through it -- iOS by
|
|
75
|
+
* injecting a call, Android by calling it from the message handler -- so the
|
|
76
|
+
* two paths cannot drift apart the way they had before.
|
|
77
|
+
*/
|
|
78
|
+
export const buildCommandScript = () => `
|
|
79
|
+
function rnkitCurrentBlock() {
|
|
80
|
+
try {
|
|
81
|
+
return String(document.queryCommandValue('formatBlock') || '')
|
|
82
|
+
.toLowerCase();
|
|
83
|
+
} catch (error) {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function rnkitRunCommand(command) {
|
|
89
|
+
if (/^h[1-3]$/.test(command)) {
|
|
90
|
+
document.execCommand('formatBlock', false, '<' + command + '>');
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (command === 'removeFormat') {
|
|
95
|
+
document.execCommand('removeFormat', false, '');
|
|
96
|
+
|
|
97
|
+
// removeFormat is defined to strip inline formatting only, so a heading
|
|
98
|
+
// survives it untouched. Drop the block back to a paragraph as well,
|
|
99
|
+
// which is what "clear formatting" means to anyone pressing it.
|
|
100
|
+
if (${JSON.stringify(BLOCK_LEVEL_FORMATS)}.indexOf(rnkitCurrentBlock()) !== -1) {
|
|
101
|
+
document.execCommand('formatBlock', false, '<p>');
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
document.execCommand(command, false, '');
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Builds the snippet that inserts or edits a hyperlink inside the webview.
|
|
112
|
+
*
|
|
113
|
+
* Defines `rnkitInsertLink(linkData)`. Both platforms call it -- iOS by
|
|
114
|
+
* injecting a call, Android from its message handler. It used to exist twice,
|
|
115
|
+
* once per platform, which is exactly how the two drifted apart before.
|
|
116
|
+
*/
|
|
117
|
+
export const buildLinkScript = () => `
|
|
118
|
+
function rnkitFindLinkInRange(range) {
|
|
119
|
+
var node = range.startContainer;
|
|
120
|
+
while (node && node !== editor) {
|
|
121
|
+
if (node.nodeName === 'A') return node;
|
|
122
|
+
node = node.parentNode;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (range.commonAncestorContainer.nodeType === 1) {
|
|
126
|
+
return range.commonAncestorContainer.querySelector('a');
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function rnkitReportContent() {
|
|
132
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
133
|
+
type: 'content',
|
|
134
|
+
html: editor.innerHTML,
|
|
135
|
+
characterCount: editor.textContent.trim().length
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function rnkitInsertLink(linkData) {
|
|
140
|
+
editor.focus();
|
|
141
|
+
|
|
142
|
+
var selection = window.getSelection();
|
|
143
|
+
if (!selection || selection.rangeCount === 0) {
|
|
144
|
+
rnkitReportContent();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
var range = selection.getRangeAt(0);
|
|
149
|
+
|
|
150
|
+
if (linkData.isExisting) {
|
|
151
|
+
var existing = rnkitFindLinkInRange(range);
|
|
152
|
+
if (existing) {
|
|
153
|
+
existing.href = linkData.url;
|
|
154
|
+
existing.textContent = linkData.text;
|
|
155
|
+
range.setStartAfter(existing);
|
|
156
|
+
range.collapse(true);
|
|
157
|
+
selection.removeAllRanges();
|
|
158
|
+
selection.addRange(range);
|
|
159
|
+
rnkitReportContent();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var link = document.createElement('a');
|
|
165
|
+
link.href = linkData.url;
|
|
166
|
+
link.textContent = linkData.text;
|
|
167
|
+
link.target = '_blank';
|
|
168
|
+
range.deleteContents();
|
|
169
|
+
range.insertNode(link);
|
|
170
|
+
|
|
171
|
+
// A trailing space gives the caret somewhere outside the anchor to land,
|
|
172
|
+
// so the next keystroke is not swallowed into the link.
|
|
173
|
+
var space = document.createTextNode(' ');
|
|
174
|
+
if (link.parentNode) {
|
|
175
|
+
link.parentNode.insertBefore(space, link.nextSibling);
|
|
176
|
+
range.setStartAfter(space);
|
|
177
|
+
} else {
|
|
178
|
+
range.setStartAfter(link);
|
|
179
|
+
}
|
|
180
|
+
range.collapse(true);
|
|
181
|
+
selection.removeAllRanges();
|
|
182
|
+
selection.addRange(range);
|
|
183
|
+
|
|
184
|
+
rnkitReportContent();
|
|
185
|
+
}
|
|
186
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ToolbarButton } from './types';
|
|
2
|
+
|
|
3
|
+
// Single source of truth: the toolbar renders from this list, and the webview
|
|
4
|
+
// is asked about exactly these commands. Adding a button therefore cannot
|
|
5
|
+
// leave it without an active state -- the two used to be maintained apart, and
|
|
6
|
+
// five buttons were never queried at all.
|
|
7
|
+
export const TOOLBAR_BUTTONS: ToolbarButton[] = [
|
|
8
|
+
{ command: 'bold', icon: 'Bold', label: 'Bold' },
|
|
9
|
+
{ command: 'italic', icon: 'Italic', label: 'Italic' },
|
|
10
|
+
{ command: 'underline', icon: 'UnderLine', label: 'Underline' },
|
|
11
|
+
{ command: 'strikeThrough', icon: 'strike-through', label: 'Strike' },
|
|
12
|
+
{ command: 'link', icon: 'Link', label: 'Link', isSpecial: true },
|
|
13
|
+
{
|
|
14
|
+
command: 'insertUnorderedList',
|
|
15
|
+
icon: 'list-un-ordered',
|
|
16
|
+
label: 'Bullet',
|
|
17
|
+
},
|
|
18
|
+
{ command: 'insertOrderedList', icon: 'list-ordered', label: 'Number' },
|
|
19
|
+
{ command: 'justifyLeft', icon: 'align-left', label: 'Left' },
|
|
20
|
+
{ command: 'justifyCenter', icon: 'align-center', label: 'Center' },
|
|
21
|
+
{ command: 'justifyRight', icon: 'align-right', label: 'Right' },
|
|
22
|
+
{ command: 'h1', text: 'H1', label: 'Heading 1', kind: 'block' },
|
|
23
|
+
{ command: 'h2', text: 'H2', label: 'Heading 2', kind: 'block' },
|
|
24
|
+
{ command: 'h3', text: 'H3', label: 'Heading 3', kind: 'block' },
|
|
25
|
+
{
|
|
26
|
+
command: 'removeFormat',
|
|
27
|
+
icon: 'ban-outline',
|
|
28
|
+
label: 'Clear format',
|
|
29
|
+
kind: 'action',
|
|
30
|
+
},
|
|
31
|
+
{ command: 'undo', icon: 'ArrowBackAlt', label: 'Undo', kind: 'action' },
|
|
32
|
+
{ command: 'redo', icon: 'ArrowForwardAlt', label: 'Redo', kind: 'action' },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export const TOGGLE_COMMANDS = TOOLBAR_BUTTONS.filter(
|
|
36
|
+
(button) => !button.isSpecial && (button.kind ?? 'toggle') === 'toggle'
|
|
37
|
+
).map((button) => button.command);
|
|
38
|
+
|
|
39
|
+
export const BLOCK_COMMANDS = TOOLBAR_BUTTONS.filter(
|
|
40
|
+
(button) => button.kind === 'block'
|
|
41
|
+
).map((button) => button.command);
|
package/src/TextEditor/types.tsx
CHANGED
|
@@ -1,7 +1,70 @@
|
|
|
1
|
+
import type { IconNameProps } from '../Icon';
|
|
2
|
+
|
|
1
3
|
export interface TextEditorType {
|
|
2
4
|
label?: string;
|
|
3
5
|
hint?: string;
|
|
4
6
|
hasError?: boolean;
|
|
5
7
|
onChange?: (data: string) => void;
|
|
6
8
|
height?: number;
|
|
9
|
+
testID?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TextEditorRef {
|
|
13
|
+
getContent: () => void;
|
|
14
|
+
setContent: (html: string) => void;
|
|
15
|
+
clearContent: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ExtendedTextEditorType extends TextEditorType {
|
|
19
|
+
initialValue?: string;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
maxLength?: number;
|
|
22
|
+
onFocus?: () => void;
|
|
23
|
+
onBlur?: () => void;
|
|
24
|
+
inputLabelLinkText?: string;
|
|
25
|
+
inputLinkTextPlacholder?: string;
|
|
26
|
+
inputLabelLinkUrl?: string;
|
|
27
|
+
inputLinkUrlPlacholder?: string;
|
|
28
|
+
saveLinkButtonText?: string;
|
|
29
|
+
cancelLinkButtonText?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Gates the floating toolbar. When true (default) it appears while this
|
|
32
|
+
* editor holds the caret and the keyboard is open. When false it stays away
|
|
33
|
+
* regardless -- it does not force the toolbar open on its own.
|
|
34
|
+
*/
|
|
35
|
+
showToolbar?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type TextCommand =
|
|
39
|
+
| 'bold'
|
|
40
|
+
| 'italic'
|
|
41
|
+
| 'underline'
|
|
42
|
+
| 'strikeThrough'
|
|
43
|
+
| 'link'
|
|
44
|
+
| 'insertUnorderedList'
|
|
45
|
+
| 'insertOrderedList'
|
|
46
|
+
| 'justifyLeft'
|
|
47
|
+
| 'justifyCenter'
|
|
48
|
+
| 'justifyRight'
|
|
49
|
+
| 'h1'
|
|
50
|
+
| 'h2'
|
|
51
|
+
| 'h3'
|
|
52
|
+
| 'undo'
|
|
53
|
+
| 'redo'
|
|
54
|
+
| 'removeFormat';
|
|
55
|
+
|
|
56
|
+
export interface ToolbarButton {
|
|
57
|
+
command: TextCommand;
|
|
58
|
+
/** Rendered as an icon, or as `text` when no icon fits (the headings). */
|
|
59
|
+
icon?: IconNameProps;
|
|
60
|
+
text?: string;
|
|
61
|
+
label: string;
|
|
62
|
+
/**
|
|
63
|
+
* toggle - on/off, answered by queryCommandState
|
|
64
|
+
* block - a block name compared against queryCommandValue('formatBlock')
|
|
65
|
+
* action - fires and forgets; never lights up
|
|
66
|
+
* special - opens the link sheet instead of running a command
|
|
67
|
+
*/
|
|
68
|
+
kind?: 'toggle' | 'block' | 'action' | 'special';
|
|
69
|
+
isSpecial?: boolean;
|
|
7
70
|
}
|
package/src/Timeline/README.md
CHANGED
|
@@ -41,6 +41,7 @@ export default function OrderHistory() {
|
|
|
41
41
|
| Prop | Type | Wajib | Default | Deskripsi |
|
|
42
42
|
| ---------- | ----------- | ----- | ------- | ---------------------------------- |
|
|
43
43
|
| `children` | `ReactNode` | ✅ | — | Satu atau beberapa `TimelineItem`. |
|
|
44
|
+
| `testID` | `string` | ❌ | — | ID untuk automation testing (Maestro/Detox/Appium). Diterapkan langsung ke elemen akar, tanpa suffix. |
|
|
44
45
|
|
|
45
46
|
### TimelineItem
|
|
46
47
|
|
|
@@ -49,6 +50,7 @@ export default function OrderHistory() {
|
|
|
49
50
|
| `children` | `ReactNode` | ✅ | — | Konten untuk node timeline: teks, ikon tambahan, dsb. |
|
|
50
51
|
| `color` | `'primary' \| 'success' \| 'warning' \| 'danger' \| 'purple'\| 'info'\| 'orange'` | ❌ | `'primary'` | Skema warna titik (`RadioButton`) dan garis vertikal. |
|
|
51
52
|
| `isLast` | `boolean` | ❌ | `false` | Menentukan apakah garis garis di kiri itu dimunculkan atau tidak |
|
|
53
|
+
| `testID` | `string` | ❌ | — | ID untuk automation testing (Maestro/Detox/Appium). Diterapkan langsung ke elemen akar, tanpa suffix. |
|
|
52
54
|
|
|
53
55
|
## ⚙️ Cara Kerja
|
|
54
56
|
|
|
@@ -2,10 +2,15 @@ import { StyleSheet, View } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
interface Timeline {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
+
testID?: string;
|
|
5
6
|
}
|
|
6
7
|
|
|
7
|
-
export default function Timeline({ children }: Timeline) {
|
|
8
|
-
return
|
|
8
|
+
export default function Timeline({ children, testID }: Timeline) {
|
|
9
|
+
return (
|
|
10
|
+
<View testID={testID} style={styles.gap14}>
|
|
11
|
+
{children}
|
|
12
|
+
</View>
|
|
13
|
+
);
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
const styles = StyleSheet.create({
|