@lowdefy/blocks-native 0.0.0-stage → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +9 -2
- package/dist/actions/AddCalendarEvent/AddCalendarEvent.js +31 -0
- package/dist/actions/AddCalendarEvent/schema.js +55 -0
- package/dist/actions/AddContact/AddContact.js +24 -0
- package/dist/actions/AddContact/schema.js +49 -0
- package/dist/actions/CancelNotification/CancelNotification.js +23 -0
- package/dist/actions/CancelNotification/schema.js +31 -0
- package/dist/actions/DiscardQueuedRequest/DiscardQueuedRequest.js +23 -0
- package/dist/actions/DiscardQueuedRequest/schema.js +31 -0
- package/dist/actions/GetCalendarEvents/GetCalendarEvents.js +32 -0
- package/dist/actions/GetCalendarEvents/schema.js +35 -0
- package/dist/actions/GetRequestQueue/GetRequestQueue.js +24 -0
- package/dist/actions/GetRequestQueue/schema.js +22 -0
- package/dist/actions/Haptic/Haptic.js +38 -0
- package/dist/actions/Haptic/schema.js +37 -0
- package/dist/actions/KeepAwake/KeepAwake.js +23 -0
- package/dist/actions/KeepAwake/schema.js +28 -0
- package/dist/actions/PickContact/PickContact.js +24 -0
- package/dist/actions/PickContact/schema.js +22 -0
- package/dist/actions/PickFile/PickFile.js +32 -0
- package/dist/actions/PickFile/schema.js +58 -0
- package/dist/actions/PickImage/PickImage.js +32 -0
- package/dist/actions/PickImage/schema.js +76 -0
- package/dist/actions/ReadNfc/ReadNfc.js +24 -0
- package/dist/actions/ReadNfc/schema.js +27 -0
- package/dist/actions/RefreshWidgets/RefreshWidgets.js +24 -0
- package/dist/actions/RefreshWidgets/schema.js +22 -0
- package/dist/actions/RequestNotificationPermission/RequestNotificationPermission.js +24 -0
- package/dist/actions/RequestNotificationPermission/schema.js +22 -0
- package/dist/actions/RetryRequestQueue/RetryRequestQueue.js +24 -0
- package/dist/actions/RetryRequestQueue/schema.js +27 -0
- package/dist/actions/ScanCode/ScanCode.js +24 -0
- package/dist/actions/ScanCode/schema.js +54 -0
- package/dist/actions/ScanDocument/ScanDocument.js +32 -0
- package/dist/actions/ScanDocument/schema.js +57 -0
- package/dist/actions/ScheduleNotification/ScheduleNotification.js +27 -0
- package/dist/actions/ScheduleNotification/schema.js +67 -0
- package/dist/actions/SetBadgeCount/SetBadgeCount.js +27 -0
- package/dist/actions/SetBadgeCount/schema.js +31 -0
- package/dist/actions/SetBrightness/SetBrightness.js +24 -0
- package/dist/actions/SetBrightness/schema.js +33 -0
- package/dist/actions/Share/Share.js +50 -0
- package/dist/actions/Share/schema.js +51 -0
- package/dist/actions/Speak/Speak.js +27 -0
- package/dist/actions/Speak/schema.js +44 -0
- package/dist/actions/StartGeofencing/StartGeofencing.js +29 -0
- package/dist/actions/StartGeofencing/schema.js +63 -0
- package/dist/actions/StartLocationTracking/StartLocationTracking.js +29 -0
- package/dist/actions/StartLocationTracking/schema.js +59 -0
- package/dist/actions/StartRecording/StartRecording.js +23 -0
- package/dist/actions/StartRecording/schema.js +32 -0
- package/dist/actions/StopGeofencing/StopGeofencing.js +23 -0
- package/dist/actions/StopGeofencing/schema.js +22 -0
- package/dist/actions/StopLocationTracking/StopLocationTracking.js +23 -0
- package/dist/actions/StopLocationTracking/schema.js +22 -0
- package/dist/actions/StopRecording/StopRecording.js +37 -0
- package/dist/actions/StopRecording/schema.js +46 -0
- package/dist/actions/StopSpeaking/StopSpeaking.js +23 -0
- package/dist/actions/StopSpeaking/schema.js +22 -0
- package/dist/actions/TakePhoto/TakePhoto.js +31 -0
- package/dist/actions/TakePhoto/schema.js +67 -0
- package/dist/actions/WriteNfc/WriteNfc.js +28 -0
- package/dist/actions/WriteNfc/schema.js +61 -0
- package/dist/actions/uploadFiles.js +51 -0
- package/dist/actions.js +47 -0
- package/dist/blocks/ActivityTimeline/ActivityTimeline.js +507 -0
- package/dist/blocks/ActivityTimeline/CommentBody.js +176 -0
- package/dist/blocks/ActivityTimeline/CommentItem.js +302 -0
- package/dist/blocks/ActivityTimeline/EditBox.js +143 -0
- package/dist/blocks/ActivityTimeline/LineText.js +71 -0
- package/dist/blocks/ActivityTimeline/RailIcon.js +41 -0
- package/dist/blocks/ActivityTimeline/RailRow.js +74 -0
- package/dist/blocks/ActivityTimeline/ReactionPicker.js +68 -0
- package/dist/blocks/ActivityTimeline/ReactionPills.js +112 -0
- package/dist/blocks/ActivityTimeline/ThreadCard.js +160 -0
- package/dist/blocks/ActivityTimeline/TimelineMarkdownRenderer.js +48 -0
- package/dist/blocks/ActivityTimeline/buildTimelineRows.js +194 -0
- package/dist/blocks/ActivityTimeline/describeEvent.js +61 -0
- package/dist/blocks/ActivityTimeline/describeGap.js +71 -0
- package/dist/blocks/ActivityTimeline/fillTemplate.js +84 -0
- package/dist/blocks/ActivityTimeline/fillText.js +38 -0
- package/dist/blocks/ActivityTimeline/formatRelativeTime.js +68 -0
- package/dist/blocks/ActivityTimeline/getActor.js +41 -0
- package/dist/blocks/ActivityTimeline/getCommentMenuActions.js +85 -0
- package/dist/blocks/ActivityTimeline/getCommentView.js +72 -0
- package/dist/blocks/ActivityTimeline/getTimelineColors.js +71 -0
- package/dist/blocks/ActivityTimeline/getToneColor.js +49 -0
- package/dist/blocks/ActivityTimeline/getVisibleReplies.js +36 -0
- package/dist/blocks/ActivityTimeline/isThreadShown.js +28 -0
- package/dist/blocks/ActivityTimeline/joinList.js +21 -0
- package/dist/blocks/ActivityTimeline/meta.js +320 -0
- package/dist/blocks/ActivityTimeline/parseTimelineHref.js +43 -0
- package/dist/blocks/ActivityTimeline/selectEventRule.js +69 -0
- package/dist/blocks/ActivityTimeline/summariseEvents.js +51 -0
- package/dist/blocks/ActivityTimeline/toPlainText.js +32 -0
- package/dist/blocks/ActivityTimeline/toTime.js +36 -0
- package/dist/blocks/ActivityTimeline/toTimelineMarkdown.js +57 -0
- package/dist/blocks/ActivityTimeline/toggleReaction.js +74 -0
- package/dist/blocks/ActivityTimeline/useNow.js +24 -0
- package/dist/blocks/AgentChat/AgentChat.js +726 -0
- package/dist/blocks/AgentChat/AssistantMessage.js +243 -0
- package/dist/blocks/AgentChat/ChatComposer.js +401 -0
- package/dist/blocks/AgentChat/ChatError.js +129 -0
- package/dist/blocks/AgentChat/ChatSkeleton.js +97 -0
- package/dist/blocks/AgentChat/ReasoningDisclosure.js +125 -0
- package/dist/blocks/AgentChat/ThinkingIndicator.js +103 -0
- package/dist/blocks/AgentChat/ThreadsSheet.js +347 -0
- package/dist/blocks/AgentChat/ToolApprovalCard.js +190 -0
- package/dist/blocks/AgentChat/ToolCallRow.js +187 -0
- package/dist/blocks/AgentChat/ToolDetail.js +137 -0
- package/dist/blocks/AgentChat/UserMessage.js +84 -0
- package/dist/blocks/AgentChat/WelcomeView.js +100 -0
- package/dist/blocks/AgentChat/createAgentTransport.js +74 -0
- package/dist/blocks/AgentChat/describeToolPart.js +133 -0
- package/dist/blocks/AgentChat/getChatSeed.js +44 -0
- package/dist/blocks/AgentChat/getFirstExchange.js +43 -0
- package/dist/blocks/AgentChat/getMessageSegments.js +73 -0
- package/dist/blocks/AgentChat/getMessageText.js +25 -0
- package/dist/blocks/AgentChat/getPageStateUpdates.js +47 -0
- package/dist/blocks/AgentChat/getProvisionalTitle.js +32 -0
- package/dist/blocks/AgentChat/getReadableRows.js +157 -0
- package/dist/blocks/AgentChat/getThreadEndpoints.js +54 -0
- package/dist/blocks/AgentChat/getToolIcon.js +110 -0
- package/dist/blocks/AgentChat/humanizeToolName.js +30 -0
- package/dist/blocks/AgentChat/messageParts.js +86 -0
- package/dist/blocks/AgentChat/meta.js +530 -0
- package/dist/blocks/AgentChat/mintConversationId.js +29 -0
- package/dist/blocks/AgentChat/replayableMessages.js +62 -0
- package/dist/blocks/AgentChat/showMessageMenu.js +49 -0
- package/dist/blocks/AgentChat/summarizeToolInput.js +36 -0
- package/dist/blocks/AgentChat/summarizeToolOutput.js +49 -0
- package/dist/blocks/AgentChat/useAgentEvents.js +218 -0
- package/dist/blocks/AgentChat/useChatDictation.js +151 -0
- package/dist/blocks/AgentChat/useChatThreads.js +450 -0
- package/dist/blocks/AgentChat/useFollowScroll.js +80 -0
- package/dist/blocks/AgentChat/useThinkingMessage.js +77 -0
- package/dist/blocks/Alert/Alert.js +167 -0
- package/dist/blocks/Alert/meta.js +200 -0
- package/dist/blocks/Avatar/Avatar.js +51 -0
- package/dist/blocks/Avatar/AvatarCircle.js +114 -0
- package/dist/blocks/Avatar/AvatarPhoto.js +68 -0
- package/dist/blocks/Avatar/AvatarStack.js +89 -0
- package/dist/blocks/Avatar/getAvatarColor.js +84 -0
- package/dist/blocks/Avatar/getAvatarImage.js +97 -0
- package/dist/blocks/Avatar/getInitials.js +51 -0
- package/dist/blocks/Avatar/meta.js +57 -0
- package/dist/blocks/Box/Box.js +118 -0
- package/dist/blocks/Box/getRubberBand.js +29 -0
- package/dist/blocks/Box/getSwipeDirection.js +45 -0
- package/dist/blocks/Box/isSwipeGesture.js +41 -0
- package/dist/blocks/Box/meta.js +46 -0
- package/dist/blocks/Box/useSwipeGesture.js +113 -0
- package/dist/blocks/Button/Button.js +136 -0
- package/dist/blocks/Button/getButtonColors.js +216 -0
- package/dist/blocks/Button/meta.js +137 -0
- package/dist/blocks/Card/Card.js +185 -0
- package/dist/blocks/Card/meta.js +203 -0
- package/dist/blocks/ChipSelector/Chip.js +178 -0
- package/dist/blocks/ChipSelector/ChipSelector.js +313 -0
- package/dist/blocks/ChipSelector/EdgeFade.js +68 -0
- package/dist/blocks/ChipSelector/getChipColors.js +88 -0
- package/dist/blocks/ChipSelector/getFadeRanges.js +55 -0
- package/dist/blocks/ChipSelector/getOverscrollSwipe.js +44 -0
- package/dist/blocks/ChipSelector/getScrollTarget.js +41 -0
- package/dist/blocks/ChipSelector/meta.js +156 -0
- package/dist/blocks/Composer/Composer.js +511 -0
- package/dist/blocks/Composer/MentionTextInput.js +91 -0
- package/dist/blocks/Composer/SuggestionList.js +165 -0
- package/dist/blocks/Composer/applyDisplayEdit.js +81 -0
- package/dist/blocks/Composer/convertSpokenMentions.js +234 -0
- package/dist/blocks/Composer/createMentionPattern.js +40 -0
- package/dist/blocks/Composer/findTrigger.js +51 -0
- package/dist/blocks/Composer/getSendState.js +38 -0
- package/dist/blocks/Composer/getSpokenMentionWords.js +35 -0
- package/dist/blocks/Composer/indexSpokenNames.js +50 -0
- package/dist/blocks/Composer/insertLink.js +36 -0
- package/dist/blocks/Composer/insertMention.js +43 -0
- package/dist/blocks/Composer/matchSpokenName.js +88 -0
- package/dist/blocks/Composer/meta.js +212 -0
- package/dist/blocks/Composer/parseMentionValue.js +55 -0
- package/dist/blocks/Composer/placeDictation.js +51 -0
- package/dist/blocks/Composer/rankMentions.js +51 -0
- package/dist/blocks/Composer/replaceRange.js +48 -0
- package/dist/blocks/Composer/segmentText.js +78 -0
- package/dist/blocks/Composer/shiftOffset.js +37 -0
- package/dist/blocks/Composer/snapSelection.js +37 -0
- package/dist/blocks/Composer/useMentionEditor.js +381 -0
- package/dist/blocks/Composer/withPartial.js +50 -0
- package/dist/blocks/DateSelector/DateSelector.js +250 -0
- package/dist/blocks/DateSelector/formatDateValue.js +34 -0
- package/dist/blocks/DateSelector/getDateMenuActions.js +96 -0
- package/dist/blocks/DateSelector/meta.js +109 -0
- package/dist/blocks/DateSelector/toBoundDate.js +40 -0
- package/dist/blocks/DateSelector/toPickerDate.js +31 -0
- package/dist/blocks/DateSelector/toUtcDay.js +25 -0
- package/dist/blocks/Divider/Divider.js +159 -0
- package/dist/blocks/Divider/meta.js +108 -0
- package/dist/blocks/Empty/Empty.js +107 -0
- package/dist/blocks/Empty/meta.js +61 -0
- package/dist/blocks/FileInput/FileInput.js +253 -0
- package/dist/blocks/FileInput/formatFileSize.js +28 -0
- package/dist/blocks/FileInput/getFileSources.js +48 -0
- package/dist/blocks/FileInput/meta.js +123 -0
- package/dist/blocks/Icon/Icon.js +41 -0
- package/dist/blocks/Icon/meta.js +80 -0
- package/dist/blocks/Illustration/Illustration.js +154 -0
- package/dist/blocks/Illustration/IllustrationLayer.js +105 -0
- package/dist/blocks/Illustration/colorNodes.js +72 -0
- package/dist/blocks/Illustration/createIllustrationMotion.js +172 -0
- package/dist/blocks/Illustration/getIllustrationBox.js +54 -0
- package/dist/blocks/Illustration/getIllustrationColors.js +48 -0
- package/dist/blocks/Illustration/getKeyframeRange.js +99 -0
- package/dist/blocks/Illustration/getLayerBounds.js +74 -0
- package/dist/blocks/Illustration/getLayers.js +113 -0
- package/dist/blocks/Illustration/getNodePoints.js +210 -0
- package/dist/blocks/Illustration/meta.js +196 -0
- package/dist/blocks/Illustration/parseIllustration.js +84 -0
- package/dist/blocks/Illustration/toBoundingBoxGradients.js +188 -0
- package/dist/blocks/Illustration/useIllustrationMotion.js +75 -0
- package/dist/blocks/Label/Label.js +111 -0
- package/dist/blocks/Label/getLabelProperties.js +38 -0
- package/dist/blocks/Label/getLabelState.js +59 -0
- package/dist/blocks/List/List.js +159 -0
- package/dist/blocks/List/ListRow.js +74 -0
- package/dist/blocks/List/ListRowContext.js +20 -0
- package/dist/blocks/List/SectionHeader.js +119 -0
- package/dist/blocks/List/getSections.js +161 -0
- package/dist/blocks/List/meta.js +190 -0
- package/dist/blocks/ListItem/ListItem.js +440 -0
- package/dist/blocks/ListItem/ListItemContextMenu.js +58 -0
- package/dist/blocks/ListItem/getListItemParts.js +101 -0
- package/dist/blocks/ListItem/getSfSymbol.js +33 -0
- package/dist/blocks/ListItem/meta.js +284 -0
- package/dist/blocks/Map/Map.js +78 -0
- package/dist/blocks/Map/meta.js +153 -0
- package/dist/blocks/Markdown/ChipWidthContext.js +20 -0
- package/dist/blocks/Markdown/ChipWidthView.js +40 -0
- package/dist/blocks/Markdown/LinkChip.js +151 -0
- package/dist/blocks/Markdown/Markdown.js +70 -0
- package/dist/blocks/Markdown/MarkdownCode.js +67 -0
- package/dist/blocks/Markdown/MarkdownContent.js +119 -0
- package/dist/blocks/Markdown/MarkdownImage.js +77 -0
- package/dist/blocks/Markdown/MarkdownList.js +97 -0
- package/dist/blocks/Markdown/MarkdownListContext.js +22 -0
- package/dist/blocks/Markdown/MarkdownRenderer.js +231 -0
- package/dist/blocks/Markdown/MarkdownTable.js +96 -0
- package/dist/blocks/Markdown/MarkdownTokenizer.js +43 -0
- package/dist/blocks/Markdown/TaskBox.js +58 -0
- package/dist/blocks/Markdown/TaskMark.js +37 -0
- package/dist/blocks/Markdown/getChipMaxWidth.js +33 -0
- package/dist/blocks/Markdown/getLinkChip.js +95 -0
- package/dist/blocks/Markdown/getLinkChipColors.js +51 -0
- package/dist/blocks/Markdown/getListMarker.js +116 -0
- package/dist/blocks/Markdown/getMarkdownStyles.js +206 -0
- package/dist/blocks/Markdown/getNodeText.js +37 -0
- package/dist/blocks/Markdown/layoutLinkChips.js +209 -0
- package/dist/blocks/Markdown/matchLinkChip.js +82 -0
- package/dist/blocks/Markdown/meta.js +56 -0
- package/dist/blocks/Markdown/restyleText.js +40 -0
- package/dist/blocks/Markdown/trimOuterSpace.js +42 -0
- package/dist/blocks/Menu/Menu.js +96 -0
- package/dist/blocks/Menu/getMenuActions.js +66 -0
- package/dist/blocks/Menu/meta.js +159 -0
- package/dist/blocks/MultipleSelector/MultipleSelector.js +290 -0
- package/dist/blocks/MultipleSelector/MultipleSelectorRow.js +71 -0
- package/dist/blocks/MultipleSelector/ValueSummary.js +130 -0
- package/dist/blocks/MultipleSelector/getOptionIndices.js +30 -0
- package/dist/blocks/MultipleSelector/getSessionOptions.js +38 -0
- package/dist/blocks/MultipleSelector/getSummaryCount.js +35 -0
- package/dist/blocks/MultipleSelector/meta.js +284 -0
- package/dist/blocks/MultipleSelector/toggleValue.js +50 -0
- package/dist/blocks/NumberInput/NumberInput.js +251 -0
- package/dist/blocks/NumberInput/StepButton.js +46 -0
- package/dist/blocks/NumberInput/formatNumber.js +35 -0
- package/dist/blocks/NumberInput/getNumberKeyboardType.js +32 -0
- package/dist/blocks/NumberInput/meta.js +123 -0
- package/dist/blocks/NumberInput/normalizeNumber.js +38 -0
- package/dist/blocks/NumberInput/parseNumberText.js +46 -0
- package/dist/blocks/PageDots/PageDots.js +131 -0
- package/dist/blocks/PageDots/meta.js +48 -0
- package/dist/blocks/Paragraph/Paragraph.js +52 -0
- package/dist/blocks/Paragraph/meta.js +295 -0
- package/dist/blocks/QRScanner/QRScanner.js +94 -0
- package/dist/blocks/QRScanner/createScanFilter.js +44 -0
- package/dist/blocks/QRScanner/meta.js +80 -0
- package/dist/blocks/Screen/meta.js +197 -0
- package/dist/blocks/SegmentedControl/SegmentedControl.js +77 -0
- package/dist/blocks/SegmentedControl/meta.js +78 -0
- package/dist/blocks/Selector/NoValueAvatar.js +42 -0
- package/dist/blocks/Selector/PickerOptionRow.js +130 -0
- package/dist/blocks/Selector/PickerRowLeading.js +57 -0
- package/dist/blocks/Selector/PickerSearchField.js +85 -0
- package/dist/blocks/Selector/PickerSheet.js +239 -0
- package/dist/blocks/Selector/Selector.js +122 -0
- package/dist/blocks/Selector/SelectorMenu.js +97 -0
- package/dist/blocks/Selector/SelectorRow.js +86 -0
- package/dist/blocks/Selector/SelectorSheet.js +131 -0
- package/dist/blocks/Selector/getOptionIndex.js +39 -0
- package/dist/blocks/Selector/getOptionLabel.js +32 -0
- package/dist/blocks/Selector/getOptionValue.js +20 -0
- package/dist/blocks/Selector/getPickerSheetDetents.js +45 -0
- package/dist/blocks/Selector/getPickerSheetRows.js +174 -0
- package/dist/blocks/Selector/getPickerSheetScrollIndex.js +35 -0
- package/dist/blocks/Selector/getSelectorMenuActions.js +61 -0
- package/dist/blocks/Selector/meta.js +195 -0
- package/dist/blocks/Selector/normalizeSearchText.js +27 -0
- package/dist/blocks/Selector/setSelectorValue.js +54 -0
- package/dist/blocks/Sheet/Sheet.js +174 -0
- package/dist/blocks/Sheet/getSheetDetents.js +56 -0
- package/dist/blocks/Sheet/meta.js +72 -0
- package/dist/blocks/SignaturePad/SignaturePad.js +182 -0
- package/dist/blocks/SignaturePad/meta.js +74 -0
- package/dist/blocks/SignaturePad/toSignatureValue.js +52 -0
- package/dist/blocks/Skeleton/Skeleton.js +131 -0
- package/dist/blocks/Skeleton/SkeletonCard.js +42 -0
- package/dist/blocks/Skeleton/SkeletonHero.js +72 -0
- package/dist/blocks/Skeleton/SkeletonInsetGroup.js +82 -0
- package/dist/blocks/Skeleton/SkeletonListRow.js +90 -0
- package/dist/blocks/Skeleton/SkeletonParagraph.js +36 -0
- package/dist/blocks/Skeleton/SkeletonRows.js +58 -0
- package/dist/blocks/Skeleton/SkeletonTimeline.js +88 -0
- package/dist/blocks/Skeleton/getBarWidth.js +45 -0
- package/dist/blocks/Skeleton/getParagraphWidths.js +56 -0
- package/dist/blocks/Skeleton/getSectionCounts.js +33 -0
- package/dist/blocks/Skeleton/getSkeletonVariant.js +27 -0
- package/dist/blocks/Skeleton/meta.js +98 -0
- package/dist/blocks/Spinner/Spinner.js +68 -0
- package/dist/blocks/Spinner/meta.js +35 -0
- package/dist/blocks/StatusIcon/StatusGlyph.js +247 -0
- package/dist/blocks/StatusIcon/StatusIcon.js +34 -0
- package/dist/blocks/StatusIcon/StatusMark.js +87 -0
- package/dist/blocks/StatusIcon/getPiePath.js +41 -0
- package/dist/blocks/StatusIcon/getStatusColor.js +61 -0
- package/dist/blocks/StatusIcon/meta.js +38 -0
- package/dist/blocks/StatusIcon/statusLabels.js +33 -0
- package/dist/blocks/Switch/Switch.js +85 -0
- package/dist/blocks/Switch/meta.js +78 -0
- package/dist/blocks/Tabs/Tabs.js +269 -0
- package/dist/blocks/Tabs/meta.js +305 -0
- package/dist/blocks/Tag/TONE_PALETTES.js +34 -0
- package/dist/blocks/Tag/Tag.js +173 -0
- package/dist/blocks/Tag/getTagColors.js +120 -0
- package/dist/blocks/Tag/getTagDotColor.js +32 -0
- package/dist/blocks/Tag/meta.js +131 -0
- package/dist/blocks/TextArea/ComposerSendButton.js +69 -0
- package/dist/blocks/TextArea/TextArea.js +167 -0
- package/dist/blocks/TextArea/meta.js +96 -0
- package/dist/blocks/TextInput/TextInput.js +253 -0
- package/dist/blocks/TextInput/applyReplaceInput.js +30 -0
- package/dist/blocks/TextInput/getKeyboardProps.js +64 -0
- package/dist/blocks/TextInput/getSearchBoxStyle.js +39 -0
- package/dist/blocks/TextInput/meta.js +113 -0
- package/dist/blocks/Title/Title.js +62 -0
- package/dist/blocks/Title/meta.js +355 -0
- package/dist/blocks.js +52 -0
- package/dist/device/getDeviceFeature.js +81 -0
- package/dist/device/playFeedback.js +32 -0
- package/dist/device.js +18 -0
- package/dist/dictation.js +17 -0
- package/dist/htmlToText.js +32 -0
- package/dist/metas.js +53 -0
- package/dist/schemas/avatar.js +40 -0
- package/dist/schemas/icon.js +65 -0
- package/dist/schemas/inputLabel.js +96 -0
- package/dist/schemas/inputProperties.js +92 -0
- package/dist/schemas/linkChips.js +85 -0
- package/dist/schemas/status.js +75 -0
- package/dist/schemas/textStyle.js +33 -0
- package/dist/schemas/tone.js +28 -0
- package/dist/schemas.js +47 -0
- package/dist/shared/ClearButton.js +53 -0
- package/dist/shared/CountText.js +38 -0
- package/dist/shared/MissingFeature.js +43 -0
- package/dist/shared/NativeMenu.js +69 -0
- package/dist/shared/OptionGlyph.js +59 -0
- package/dist/shared/PropertyRow.js +89 -0
- package/dist/shared/SheetCloseButton.js +51 -0
- package/dist/shared/SheetDoneButton.js +44 -0
- package/dist/shared/SwipeContext.js +20 -0
- package/dist/shared/SwipeableRow.js +294 -0
- package/dist/shared/SystemIcon.js +72 -0
- package/dist/shared/dictation/DictationButton.js +77 -0
- package/dist/shared/dictation/DictationWarning.js +89 -0
- package/dist/shared/dictation/LevelMeter.js +57 -0
- package/dist/shared/dictation/ListeningRow.js +100 -0
- package/dist/shared/dictation/PartialSpans.js +50 -0
- package/dist/shared/dictation/checkDictationAvailable.js +65 -0
- package/dist/shared/dictation/claimMic.js +68 -0
- package/dist/shared/dictation/createQueuedRecognizer.js +213 -0
- package/dist/shared/dictation/getDictationLevel.js +30 -0
- package/dist/shared/dictation/getDictationWarning.js +40 -0
- package/dist/shared/dictation/getLevelBars.js +38 -0
- package/dist/shared/dictation/getRecognizer.js +46 -0
- package/dist/shared/dictation/getStartOptions.js +42 -0
- package/dist/shared/dictation/insertAtSelection.js +48 -0
- package/dist/shared/dictation/pickRecognitionLocale.js +37 -0
- package/dist/shared/dictation/useDictation.js +299 -0
- package/dist/shared/getControlSize.js +50 -0
- package/dist/shared/getInputBoxStyle.js +93 -0
- package/dist/shared/getPropertyRowTextStyles.js +40 -0
- package/dist/shared/getSemanticColors.js +96 -0
- package/dist/shared/getToneColor.js +51 -0
- package/dist/shared/iosTextStyles.js +49 -0
- package/dist/shared/useBlockTokens.js +41 -0
- package/dist/skeleton/SkeletonFrameContext.js +21 -0
- package/dist/skeleton/SkeletonLine.js +46 -0
- package/dist/skeleton/SkeletonShape.js +140 -0
- package/dist/skeleton/createShimmerClock.js +57 -0
- package/dist/skeleton/shimmerClock.js +20 -0
- package/dist/skeleton/skeletonText.js +44 -0
- package/dist/skeleton/useShimmer.js +34 -0
- package/dist/types.js +23 -0
- package/dist/typography/TITLE_LEVEL_STYLES.js +24 -0
- package/dist/typography/TypographyText.js +78 -0
- package/dist/typography/getIosTextStyle.js +33 -0
- package/dist/typography/getTextStyle.js +94 -0
- package/dist/useComponentTokens.js +38 -0
- package/package.json +94 -3
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import icon from '../../schemas/icon.js';
|
|
16
|
+
import { disabled, theme } from '../../schemas/inputProperties.js';
|
|
17
|
+
const color = {
|
|
18
|
+
description: "The option's colour: a palette hue (`blue`, `teal`, `amber`, ...), a token name (`colorSuccess`) or a hex colour, drawn as a tile with a white icon and a soft tint when selected; or `{ fg, bg, fgDark, bgDark }`, a mark drawn fg on bg (the icon tile, and the selected chip's fill, border and label), with the dark variants in dark mode.",
|
|
19
|
+
oneOf: [
|
|
20
|
+
{
|
|
21
|
+
type: 'string',
|
|
22
|
+
docs: {
|
|
23
|
+
displayType: 'color'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'object',
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
required: [
|
|
30
|
+
'fg'
|
|
31
|
+
],
|
|
32
|
+
properties: {
|
|
33
|
+
fg: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'The mark colour: the icon, and the selected label and border.',
|
|
36
|
+
docs: {
|
|
37
|
+
displayType: 'color'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
bg: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'The tint behind it: the icon tile, and the selected fill. Defaults to fg at about 15%.',
|
|
43
|
+
docs: {
|
|
44
|
+
displayType: 'color'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
fgDark: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'fg in dark mode. Defaults to fg.',
|
|
50
|
+
docs: {
|
|
51
|
+
displayType: 'color'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
bgDark: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'bg in dark mode. Defaults to a soft tint of the dark fg.',
|
|
57
|
+
docs: {
|
|
58
|
+
displayType: 'color'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
};
|
|
65
|
+
// A mobile-only input: a scrolling strip of chips that picks one option.
|
|
66
|
+
export default {
|
|
67
|
+
category: 'input',
|
|
68
|
+
icons: [],
|
|
69
|
+
valueType: 'string',
|
|
70
|
+
cssKeys: {
|
|
71
|
+
element: 'The chip strip.',
|
|
72
|
+
chip: 'Each chip.',
|
|
73
|
+
label: 'Each chip label.'
|
|
74
|
+
},
|
|
75
|
+
events: {
|
|
76
|
+
onChange: {
|
|
77
|
+
description: 'Trigger actions when a chip is picked.',
|
|
78
|
+
event: {
|
|
79
|
+
value: 'The value of the picked option.'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
onMore: 'Trigger actions when the more chip (`moreChip`) is pressed, for example to open a Sheet of every option.'
|
|
83
|
+
},
|
|
84
|
+
properties: {
|
|
85
|
+
type: 'object',
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
properties: {
|
|
88
|
+
disabled,
|
|
89
|
+
fadeColor: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: "The surface behind the strip, which its edges fade into. Defaults to the grouped background, the screen behind a Screen's headerBottom.",
|
|
92
|
+
docs: {
|
|
93
|
+
displayType: 'color'
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
moreChip: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
additionalProperties: false,
|
|
99
|
+
description: 'A trailing chip after the options, such as "All spaces", that fires `onMore` instead of picking a value.',
|
|
100
|
+
properties: {
|
|
101
|
+
label: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: 'The chip label.'
|
|
104
|
+
},
|
|
105
|
+
icon: {
|
|
106
|
+
...icon,
|
|
107
|
+
description: `Drawn plain before the label. ${icon.description}`
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
options: {
|
|
112
|
+
type: 'array',
|
|
113
|
+
description: 'The chips, in order.',
|
|
114
|
+
items: {
|
|
115
|
+
type: 'object',
|
|
116
|
+
required: [
|
|
117
|
+
'value'
|
|
118
|
+
],
|
|
119
|
+
additionalProperties: false,
|
|
120
|
+
properties: {
|
|
121
|
+
value: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'The value the chip sets.'
|
|
124
|
+
},
|
|
125
|
+
label: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'The chip label. Defaults to the value.'
|
|
128
|
+
},
|
|
129
|
+
icon: {
|
|
130
|
+
...icon,
|
|
131
|
+
description: `Drawn in a rounded-square tile of the option's colour. ${icon.description}`
|
|
132
|
+
},
|
|
133
|
+
color,
|
|
134
|
+
badge: {
|
|
135
|
+
type: [
|
|
136
|
+
'string',
|
|
137
|
+
'number'
|
|
138
|
+
],
|
|
139
|
+
description: 'A count or short text after the label, such as open items.'
|
|
140
|
+
},
|
|
141
|
+
disabled: {
|
|
142
|
+
type: 'boolean',
|
|
143
|
+
default: false,
|
|
144
|
+
description: 'Draw the chip dimmed and ignore presses.'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
theme,
|
|
150
|
+
title: {
|
|
151
|
+
type: 'string',
|
|
152
|
+
description: 'The label screen readers read for the strip. Not drawn.'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
|
+
import { ActivityIndicator, KeyboardAvoidingView, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
17
|
+
import { type } from '@lowdefy/helpers';
|
|
18
|
+
import { useElementRef, useKeyboardWindowOffset } from '@lowdefy/client-native';
|
|
19
|
+
import DictationButton from '../../shared/dictation/DictationButton.js';
|
|
20
|
+
import DictationWarning from '../../shared/dictation/DictationWarning.js';
|
|
21
|
+
import getSendState from './getSendState.js';
|
|
22
|
+
import getSpokenMentionWords from './getSpokenMentionWords.js';
|
|
23
|
+
import getTimelineColors from '../ActivityTimeline/getTimelineColors.js';
|
|
24
|
+
import ListeningRow from '../../shared/dictation/ListeningRow.js';
|
|
25
|
+
import MentionTextInput from './MentionTextInput.js';
|
|
26
|
+
import meta from './meta.js';
|
|
27
|
+
import rankMentions from './rankMentions.js';
|
|
28
|
+
import SuggestionList from './SuggestionList.js';
|
|
29
|
+
import useComponentTokens from '../../useComponentTokens.js';
|
|
30
|
+
import useDictation from '../../shared/dictation/useDictation.js';
|
|
31
|
+
import useMentionEditor from './useMentionEditor.js';
|
|
32
|
+
const LINK_SEARCH_MS = 200;
|
|
33
|
+
const LINE_HEIGHT = 22;
|
|
34
|
+
const FIELD_PADDING = 8;
|
|
35
|
+
const MAX_LINES = 8;
|
|
36
|
+
const DEFAULT_MAX_LENGTH = 4000;
|
|
37
|
+
function ReplyBanner({ colors, Icon, name, onCancel }) {
|
|
38
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
39
|
+
style: styles.banner
|
|
40
|
+
}, /*#__PURE__*/ React.createElement(Icon, {
|
|
41
|
+
properties: {
|
|
42
|
+
name: 'CornerUpLeft',
|
|
43
|
+
size: 14,
|
|
44
|
+
title: ''
|
|
45
|
+
},
|
|
46
|
+
styles: {
|
|
47
|
+
element: {
|
|
48
|
+
color: colors.secondary
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}), /*#__PURE__*/ React.createElement(Text, {
|
|
52
|
+
numberOfLines: 1,
|
|
53
|
+
style: [
|
|
54
|
+
styles.bannerText,
|
|
55
|
+
{
|
|
56
|
+
color: colors.secondary
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}, "Replying to ", /*#__PURE__*/ React.createElement(Text, {
|
|
60
|
+
style: {
|
|
61
|
+
color: colors.label,
|
|
62
|
+
fontWeight: '600'
|
|
63
|
+
}
|
|
64
|
+
}, name)), /*#__PURE__*/ React.createElement(Pressable, {
|
|
65
|
+
accessibilityLabel: "Cancel reply",
|
|
66
|
+
accessibilityRole: "button",
|
|
67
|
+
hitSlop: 10,
|
|
68
|
+
onPress: onCancel,
|
|
69
|
+
style: [
|
|
70
|
+
styles.bannerClose,
|
|
71
|
+
{
|
|
72
|
+
backgroundColor: colors.fillStrong
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}, /*#__PURE__*/ React.createElement(Icon, {
|
|
76
|
+
properties: {
|
|
77
|
+
name: 'X',
|
|
78
|
+
size: 11,
|
|
79
|
+
strokeWidth: 3,
|
|
80
|
+
title: ''
|
|
81
|
+
},
|
|
82
|
+
styles: {
|
|
83
|
+
element: {
|
|
84
|
+
color: colors.secondary
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
})));
|
|
88
|
+
}
|
|
89
|
+
function WarningLine({ colors, Icon, text }) {
|
|
90
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
91
|
+
accessibilityRole: "alert",
|
|
92
|
+
style: styles.banner
|
|
93
|
+
}, /*#__PURE__*/ React.createElement(Icon, {
|
|
94
|
+
properties: {
|
|
95
|
+
name: 'TriangleAlert',
|
|
96
|
+
size: 14,
|
|
97
|
+
title: ''
|
|
98
|
+
},
|
|
99
|
+
styles: {
|
|
100
|
+
element: {
|
|
101
|
+
color: colors.warning
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}), /*#__PURE__*/ React.createElement(Text, {
|
|
105
|
+
style: [
|
|
106
|
+
styles.bannerText,
|
|
107
|
+
{
|
|
108
|
+
color: colors.warningText
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}, text));
|
|
112
|
+
}
|
|
113
|
+
function SendButton({ colors, disabled, Icon, onPress, sending }) {
|
|
114
|
+
return /*#__PURE__*/ React.createElement(Pressable, {
|
|
115
|
+
accessibilityLabel: "Send",
|
|
116
|
+
accessibilityRole: "button",
|
|
117
|
+
accessibilityState: {
|
|
118
|
+
busy: sending,
|
|
119
|
+
disabled
|
|
120
|
+
},
|
|
121
|
+
disabled: disabled,
|
|
122
|
+
hitSlop: 6,
|
|
123
|
+
onPress: onPress,
|
|
124
|
+
style: ({ pressed })=>[
|
|
125
|
+
styles.send,
|
|
126
|
+
{
|
|
127
|
+
backgroundColor: disabled && !sending ? colors.fillStrong : colors.tint
|
|
128
|
+
},
|
|
129
|
+
pressed ? {
|
|
130
|
+
opacity: 0.7
|
|
131
|
+
} : null
|
|
132
|
+
],
|
|
133
|
+
testID: "composer_send"
|
|
134
|
+
}, sending ? /*#__PURE__*/ React.createElement(ActivityIndicator, {
|
|
135
|
+
color: colors.onTint,
|
|
136
|
+
size: "small"
|
|
137
|
+
}) : /*#__PURE__*/ React.createElement(Icon, {
|
|
138
|
+
properties: {
|
|
139
|
+
name: 'ArrowUp',
|
|
140
|
+
size: 18,
|
|
141
|
+
strokeWidth: 2.75,
|
|
142
|
+
title: ''
|
|
143
|
+
},
|
|
144
|
+
styles: {
|
|
145
|
+
element: {
|
|
146
|
+
color: disabled ? colors.tertiary : colors.onTint
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A comment composer, as in GitHub's and Linear's iOS apps: a growing input (one to eight
|
|
153
|
+
* lines) with a round send button, a reply-to banner and a warning line above it. Its value is
|
|
154
|
+
* markdown. Typing @ at a word start opens a picker of the people who see the record; a pick
|
|
155
|
+
* stores a mention token (`[[user:<id>]]` by default) and shows "@Name" in the input. Typing `[[`
|
|
156
|
+
* opens a record picker fed by onLinkSearch and the `links` property, and a pick writes
|
|
157
|
+
* `[[KEY]]`. Spoken addressing, as dictation writes it ("for Sam, can you look"), becomes a
|
|
158
|
+
* mention of that person. The text clears once onSubmit's actions succeed.
|
|
159
|
+
*
|
|
160
|
+
* A mic at the field's trailing edge dictates on the phone (useDictation), with the mention
|
|
161
|
+
* labels as name hints. Words still being heard show grey at the cursor; each final result goes
|
|
162
|
+
* into the text and through the spoken-mention conversion at once.
|
|
163
|
+
*/ function Composer({ blockId, components, loading, methods, properties, styles: blockStyles = {}, value }) {
|
|
164
|
+
const { isDark, tokens } = useComponentTokens(properties.theme);
|
|
165
|
+
const colors = useMemo(()=>getTimelineColors({
|
|
166
|
+
isDark,
|
|
167
|
+
tokens
|
|
168
|
+
}), [
|
|
169
|
+
isDark,
|
|
170
|
+
tokens
|
|
171
|
+
]);
|
|
172
|
+
const { Icon } = components;
|
|
173
|
+
const windowOffset = useKeyboardWindowOffset();
|
|
174
|
+
const maxLength = properties.maxLength ?? DEFAULT_MAX_LENGTH;
|
|
175
|
+
const disabled = loading === true || properties.disabled === true;
|
|
176
|
+
const [sending, setSending] = useState(false);
|
|
177
|
+
const setText = useCallback((next)=>{
|
|
178
|
+
methods.setValue(next);
|
|
179
|
+
methods.triggerEvent({
|
|
180
|
+
name: 'onChange',
|
|
181
|
+
event: {
|
|
182
|
+
value: next
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}, [
|
|
186
|
+
methods
|
|
187
|
+
]);
|
|
188
|
+
const editor = useMentionEditor({
|
|
189
|
+
value,
|
|
190
|
+
onChangeValue: setText,
|
|
191
|
+
people: properties.mentions,
|
|
192
|
+
mentionFormat: properties.mentionFormat,
|
|
193
|
+
spokenWords: getSpokenMentionWords({
|
|
194
|
+
spokenMentions: properties.spokenMentions
|
|
195
|
+
})
|
|
196
|
+
});
|
|
197
|
+
const hints = useMemo(()=>(properties.mentions ?? []).map((person)=>person.label).filter(type.isString), [
|
|
198
|
+
properties.mentions
|
|
199
|
+
]);
|
|
200
|
+
const dictation = useDictation({
|
|
201
|
+
disabled: disabled || properties.dictation === false,
|
|
202
|
+
hints,
|
|
203
|
+
onFinal: (words)=>editor.commitDictation({
|
|
204
|
+
text: words
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
const listening = dictation.status !== 'idle';
|
|
208
|
+
// The editor reads its dictation calls through refs, so the latest render's are always current.
|
|
209
|
+
const editorRef = useRef(editor);
|
|
210
|
+
editorRef.current = editor;
|
|
211
|
+
useEffect(()=>{
|
|
212
|
+
editorRef.current.setPartial(dictation.partial);
|
|
213
|
+
}, [
|
|
214
|
+
dictation.partial
|
|
215
|
+
]);
|
|
216
|
+
useEffect(()=>{
|
|
217
|
+
if (!listening) editorRef.current.endDictation();
|
|
218
|
+
}, [
|
|
219
|
+
listening
|
|
220
|
+
]);
|
|
221
|
+
const clearDictationWarning = dictation.clearWarning;
|
|
222
|
+
useEffect(()=>{
|
|
223
|
+
if (editor.text === '') clearDictationWarning();
|
|
224
|
+
}, [
|
|
225
|
+
editor.text,
|
|
226
|
+
clearDictationWarning
|
|
227
|
+
]);
|
|
228
|
+
const toggleDictation = ()=>{
|
|
229
|
+
if (listening) {
|
|
230
|
+
dictation.stop();
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
editor.startDictation();
|
|
234
|
+
dictation.start();
|
|
235
|
+
};
|
|
236
|
+
const cancelDictation = ()=>{
|
|
237
|
+
dictation.cancel();
|
|
238
|
+
editor.cancelDictation();
|
|
239
|
+
};
|
|
240
|
+
// Typing ends the session; the editor keeps the words it showed as text.
|
|
241
|
+
const onChangeText = (next)=>{
|
|
242
|
+
if (listening) dictation.cancel();
|
|
243
|
+
editor.onChangeText(next);
|
|
244
|
+
};
|
|
245
|
+
const inputRef = useRef(null);
|
|
246
|
+
const registerElement = useElementRef({
|
|
247
|
+
blockId,
|
|
248
|
+
kind: 'input'
|
|
249
|
+
});
|
|
250
|
+
const setInputRef = useCallback((element)=>{
|
|
251
|
+
inputRef.current = element;
|
|
252
|
+
return registerElement(element);
|
|
253
|
+
}, [
|
|
254
|
+
registerElement
|
|
255
|
+
]);
|
|
256
|
+
useEffect(()=>{
|
|
257
|
+
methods.registerMethod('focus', ()=>inputRef.current?.focus());
|
|
258
|
+
}, [
|
|
259
|
+
methods
|
|
260
|
+
]);
|
|
261
|
+
const trigger = editor.trigger;
|
|
262
|
+
const linkQuery = trigger?.kind === 'link' ? trigger.query : null;
|
|
263
|
+
useEffect(()=>{
|
|
264
|
+
if (linkQuery === null) return undefined;
|
|
265
|
+
const timer = setTimeout(()=>{
|
|
266
|
+
methods.triggerEvent({
|
|
267
|
+
name: 'onLinkSearch',
|
|
268
|
+
event: {
|
|
269
|
+
query: linkQuery
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}, LINK_SEARCH_MS);
|
|
273
|
+
return ()=>clearTimeout(timer);
|
|
274
|
+
}, [
|
|
275
|
+
linkQuery,
|
|
276
|
+
methods
|
|
277
|
+
]);
|
|
278
|
+
const people = trigger?.kind === 'mention' && !listening ? rankMentions({
|
|
279
|
+
people: properties.mentions,
|
|
280
|
+
query: trigger.query
|
|
281
|
+
}) : [];
|
|
282
|
+
const links = trigger?.kind === 'link' && !listening ? (properties.links ?? []).slice(0, 8) : [];
|
|
283
|
+
const send = async ()=>{
|
|
284
|
+
if (listening) {
|
|
285
|
+
// Up to 1.5 s for the final words; anything later would land in a sent composer.
|
|
286
|
+
await dictation.finish();
|
|
287
|
+
dictation.cancel();
|
|
288
|
+
}
|
|
289
|
+
dictation.clearWarning();
|
|
290
|
+
const body = editor.finishSpokenMentions();
|
|
291
|
+
if (getSendState({
|
|
292
|
+
value: body,
|
|
293
|
+
sending,
|
|
294
|
+
maxLength
|
|
295
|
+
}).disabled) return;
|
|
296
|
+
setSending(true);
|
|
297
|
+
try {
|
|
298
|
+
const result = await methods.triggerEvent({
|
|
299
|
+
name: 'onSubmit',
|
|
300
|
+
event: {
|
|
301
|
+
body,
|
|
302
|
+
reply_to: properties.replyTo?.id ?? null
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
if (result?.success === true && result.bounced !== true) {
|
|
306
|
+
setText('');
|
|
307
|
+
}
|
|
308
|
+
} finally{
|
|
309
|
+
setSending(false);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
const pendingText = listening && dictation.partial !== '' ? `${editor.text} ${dictation.partial}` : editor.text;
|
|
313
|
+
const sendState = getSendState({
|
|
314
|
+
value: pendingText,
|
|
315
|
+
sending,
|
|
316
|
+
maxLength
|
|
317
|
+
});
|
|
318
|
+
const hasReply = type.isObject(properties.replyTo) && !type.isNone(properties.replyTo.id);
|
|
319
|
+
const hasWarning = type.isString(properties.warning) && properties.warning !== '';
|
|
320
|
+
const bar = /*#__PURE__*/ React.createElement(View, {
|
|
321
|
+
style: [
|
|
322
|
+
styles.bar,
|
|
323
|
+
{
|
|
324
|
+
backgroundColor: colors.cell,
|
|
325
|
+
borderTopColor: colors.separator
|
|
326
|
+
},
|
|
327
|
+
blockStyles.element
|
|
328
|
+
],
|
|
329
|
+
testID: blockId
|
|
330
|
+
}, people.length > 0 || links.length > 0 ? /*#__PURE__*/ React.createElement(SuggestionList, {
|
|
331
|
+
colors: colors,
|
|
332
|
+
Icon: Icon,
|
|
333
|
+
isDark: isDark,
|
|
334
|
+
linkIcons: properties.linkIcons,
|
|
335
|
+
links: links,
|
|
336
|
+
onPickLink: editor.pickLink,
|
|
337
|
+
onPickMention: editor.pickMention,
|
|
338
|
+
people: people,
|
|
339
|
+
imageSource: components.imageSource,
|
|
340
|
+
tokens: tokens
|
|
341
|
+
}) : null, hasReply ? /*#__PURE__*/ React.createElement(ReplyBanner, {
|
|
342
|
+
colors: colors,
|
|
343
|
+
Icon: Icon,
|
|
344
|
+
name: properties.replyTo.name ?? 'comment',
|
|
345
|
+
onCancel: ()=>methods.triggerEvent({
|
|
346
|
+
name: 'onCancelReply'
|
|
347
|
+
})
|
|
348
|
+
}) : null, hasWarning ? /*#__PURE__*/ React.createElement(WarningLine, {
|
|
349
|
+
colors: colors,
|
|
350
|
+
Icon: Icon,
|
|
351
|
+
text: properties.warning
|
|
352
|
+
}) : null, /*#__PURE__*/ React.createElement(DictationWarning, {
|
|
353
|
+
colors: colors,
|
|
354
|
+
components: components,
|
|
355
|
+
testID: `${blockId}_dictation_warning`,
|
|
356
|
+
translate: methods.translate,
|
|
357
|
+
warning: dictation.warning
|
|
358
|
+
}), listening ? /*#__PURE__*/ React.createElement(ListeningRow, {
|
|
359
|
+
colors: colors,
|
|
360
|
+
components: components,
|
|
361
|
+
level: dictation.level,
|
|
362
|
+
onCancel: cancelDictation,
|
|
363
|
+
testID: `${blockId}_listening`,
|
|
364
|
+
translate: methods.translate
|
|
365
|
+
}) : null, /*#__PURE__*/ React.createElement(View, {
|
|
366
|
+
style: styles.inputRow
|
|
367
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
368
|
+
style: [
|
|
369
|
+
styles.field,
|
|
370
|
+
dictation.available ? styles.fieldWithMic : null,
|
|
371
|
+
{
|
|
372
|
+
backgroundColor: colors.nested,
|
|
373
|
+
borderColor: colors.separator
|
|
374
|
+
},
|
|
375
|
+
blockStyles.input
|
|
376
|
+
]
|
|
377
|
+
}, /*#__PURE__*/ React.createElement(MentionTextInput, {
|
|
378
|
+
accessibilityLabel: properties.title ?? properties.placeholder ?? 'Comment',
|
|
379
|
+
autoFocus: properties.autoFocus === true,
|
|
380
|
+
colors: colors,
|
|
381
|
+
editable: !disabled,
|
|
382
|
+
editor: editor,
|
|
383
|
+
inputRef: setInputRef,
|
|
384
|
+
onBlur: ()=>methods.triggerEvent({
|
|
385
|
+
name: 'onBlur'
|
|
386
|
+
}),
|
|
387
|
+
onChangeText: onChangeText,
|
|
388
|
+
onFocus: ()=>methods.triggerEvent({
|
|
389
|
+
name: 'onFocus'
|
|
390
|
+
}),
|
|
391
|
+
placeholder: properties.placeholder ?? 'Add a comment…',
|
|
392
|
+
style: styles.input,
|
|
393
|
+
testID: `${blockId}_input`
|
|
394
|
+
}), dictation.available ? /*#__PURE__*/ React.createElement(View, {
|
|
395
|
+
style: styles.mic
|
|
396
|
+
}, /*#__PURE__*/ React.createElement(DictationButton, {
|
|
397
|
+
colors: colors,
|
|
398
|
+
components: components,
|
|
399
|
+
onPress: toggleDictation,
|
|
400
|
+
status: dictation.status,
|
|
401
|
+
testID: `${blockId}_dictation`,
|
|
402
|
+
translate: methods.translate
|
|
403
|
+
})) : null), /*#__PURE__*/ React.createElement(View, {
|
|
404
|
+
style: styles.sendColumn
|
|
405
|
+
}, sendState.counter ? /*#__PURE__*/ React.createElement(Text, {
|
|
406
|
+
style: [
|
|
407
|
+
styles.counter,
|
|
408
|
+
{
|
|
409
|
+
color: sendState.counter.over ? colors.danger : colors.tertiary
|
|
410
|
+
}
|
|
411
|
+
]
|
|
412
|
+
}, sendState.counter.text) : null, /*#__PURE__*/ React.createElement(SendButton, {
|
|
413
|
+
colors: colors,
|
|
414
|
+
disabled: sendState.disabled || disabled,
|
|
415
|
+
Icon: Icon,
|
|
416
|
+
onPress: send,
|
|
417
|
+
sending: sending
|
|
418
|
+
}))));
|
|
419
|
+
if (properties.sticky === false) {
|
|
420
|
+
return bar;
|
|
421
|
+
}
|
|
422
|
+
// Android apps are edge-to-edge, so the window no longer resizes for the keyboard; padding by
|
|
423
|
+
// the keyboard's overlap keeps the composer above it on both platforms. On Android the overlap
|
|
424
|
+
// also counts the composer's distance from the top of the window, as a page sits below an
|
|
425
|
+
// opaque header (useKeyboardWindowOffset).
|
|
426
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
427
|
+
collapsable: false,
|
|
428
|
+
onLayout: windowOffset.onLayout,
|
|
429
|
+
ref: windowOffset.ref
|
|
430
|
+
}, /*#__PURE__*/ React.createElement(KeyboardAvoidingView, {
|
|
431
|
+
behavior: "padding",
|
|
432
|
+
keyboardVerticalOffset: windowOffset.offset + (properties.keyboardOffset ?? 0)
|
|
433
|
+
}, bar));
|
|
434
|
+
}
|
|
435
|
+
const styles = StyleSheet.create({
|
|
436
|
+
bar: {
|
|
437
|
+
borderTopWidth: StyleSheet.hairlineWidth,
|
|
438
|
+
paddingBottom: 8,
|
|
439
|
+
paddingHorizontal: 12,
|
|
440
|
+
paddingTop: 8
|
|
441
|
+
},
|
|
442
|
+
banner: {
|
|
443
|
+
alignItems: 'center',
|
|
444
|
+
flexDirection: 'row',
|
|
445
|
+
gap: 6,
|
|
446
|
+
marginBottom: 8,
|
|
447
|
+
paddingHorizontal: 4
|
|
448
|
+
},
|
|
449
|
+
bannerText: {
|
|
450
|
+
flex: 1,
|
|
451
|
+
fontSize: 13,
|
|
452
|
+
lineHeight: 18
|
|
453
|
+
},
|
|
454
|
+
bannerClose: {
|
|
455
|
+
alignItems: 'center',
|
|
456
|
+
borderRadius: 10,
|
|
457
|
+
height: 20,
|
|
458
|
+
justifyContent: 'center',
|
|
459
|
+
width: 20
|
|
460
|
+
},
|
|
461
|
+
inputRow: {
|
|
462
|
+
alignItems: 'flex-end',
|
|
463
|
+
flexDirection: 'row',
|
|
464
|
+
gap: 8
|
|
465
|
+
},
|
|
466
|
+
field: {
|
|
467
|
+
alignItems: 'flex-end',
|
|
468
|
+
borderRadius: 19,
|
|
469
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
470
|
+
flex: 1,
|
|
471
|
+
flexDirection: 'row',
|
|
472
|
+
gap: 6,
|
|
473
|
+
paddingHorizontal: 14
|
|
474
|
+
},
|
|
475
|
+
fieldWithMic: {
|
|
476
|
+
paddingRight: 6
|
|
477
|
+
},
|
|
478
|
+
mic: {
|
|
479
|
+
paddingBottom: (LINE_HEIGHT + FIELD_PADDING * 2 - 28) / 2
|
|
480
|
+
},
|
|
481
|
+
input: {
|
|
482
|
+
flex: 1,
|
|
483
|
+
fontSize: 17,
|
|
484
|
+
lineHeight: LINE_HEIGHT,
|
|
485
|
+
maxHeight: LINE_HEIGHT * MAX_LINES + FIELD_PADDING * 2,
|
|
486
|
+
minHeight: LINE_HEIGHT + FIELD_PADDING * 2,
|
|
487
|
+
paddingBottom: FIELD_PADDING,
|
|
488
|
+
paddingHorizontal: 0,
|
|
489
|
+
paddingTop: FIELD_PADDING
|
|
490
|
+
},
|
|
491
|
+
sendColumn: {
|
|
492
|
+
alignItems: 'center',
|
|
493
|
+
gap: 4,
|
|
494
|
+
paddingBottom: 3
|
|
495
|
+
},
|
|
496
|
+
counter: {
|
|
497
|
+
fontSize: 11,
|
|
498
|
+
fontVariant: [
|
|
499
|
+
'tabular-nums'
|
|
500
|
+
]
|
|
501
|
+
},
|
|
502
|
+
send: {
|
|
503
|
+
alignItems: 'center',
|
|
504
|
+
borderRadius: 16,
|
|
505
|
+
height: 32,
|
|
506
|
+
justifyContent: 'center',
|
|
507
|
+
width: 32
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
Composer.meta = meta;
|
|
511
|
+
export default Composer;
|