@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,440 @@
|
|
|
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, { useContext, useLayoutEffect, useRef } from 'react';
|
|
16
|
+
import { Platform, Pressable, Text, View } from 'react-native';
|
|
17
|
+
import { resolveColor } from '@lowdefy/client-native';
|
|
18
|
+
import { type } from '@lowdefy/helpers';
|
|
19
|
+
import AvatarCircle from '../Avatar/AvatarCircle.js';
|
|
20
|
+
import AvatarStack from '../Avatar/AvatarStack.js';
|
|
21
|
+
import getListItemParts, { GAP, ICON_BOX, ROW_PADDING } from './getListItemParts.js';
|
|
22
|
+
import getSemanticColors from '../../shared/getSemanticColors.js';
|
|
23
|
+
import iosTextStyles from '../../shared/iosTextStyles.js';
|
|
24
|
+
import ListItemContextMenu from './ListItemContextMenu.js';
|
|
25
|
+
import NativeMenu from '../../shared/NativeMenu.js';
|
|
26
|
+
import ListRowContext from '../List/ListRowContext.js';
|
|
27
|
+
import meta from './meta.js';
|
|
28
|
+
import StatusMark from '../StatusIcon/StatusMark.js';
|
|
29
|
+
import SwipeableRow from '../../shared/SwipeableRow.js';
|
|
30
|
+
import SystemIcon from '../../shared/SystemIcon.js';
|
|
31
|
+
import useComponentTokens from '../../useComponentTokens.js';
|
|
32
|
+
const FULL_SWIPE = {
|
|
33
|
+
leading: {
|
|
34
|
+
leading: true
|
|
35
|
+
},
|
|
36
|
+
trailing: {
|
|
37
|
+
trailing: true
|
|
38
|
+
},
|
|
39
|
+
both: {
|
|
40
|
+
leading: true,
|
|
41
|
+
trailing: true
|
|
42
|
+
},
|
|
43
|
+
none: {}
|
|
44
|
+
};
|
|
45
|
+
function Leading({ blockId, colors, components, content, isDark, leading, styles, tokens }) {
|
|
46
|
+
if (!type.isNone(content.leading)) {
|
|
47
|
+
return content.leading();
|
|
48
|
+
}
|
|
49
|
+
if (leading === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
switch(leading.kind){
|
|
53
|
+
case 'status':
|
|
54
|
+
return /*#__PURE__*/ React.createElement(StatusMark, {
|
|
55
|
+
status: leading.status,
|
|
56
|
+
testID: `${blockId}_status`,
|
|
57
|
+
tokens: tokens
|
|
58
|
+
});
|
|
59
|
+
case 'avatar':
|
|
60
|
+
return /*#__PURE__*/ React.createElement(AvatarCircle, {
|
|
61
|
+
avatar: leading.avatar,
|
|
62
|
+
isDark: isDark,
|
|
63
|
+
imageSource: components.imageSource,
|
|
64
|
+
size: leading.size,
|
|
65
|
+
style: styles.avatar,
|
|
66
|
+
testID: `${blockId}_avatar`,
|
|
67
|
+
tokens: tokens
|
|
68
|
+
});
|
|
69
|
+
default:
|
|
70
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
71
|
+
style: {
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
width: ICON_BOX
|
|
74
|
+
}
|
|
75
|
+
}, /*#__PURE__*/ React.createElement(components.Icon, {
|
|
76
|
+
properties: leading.icon,
|
|
77
|
+
styles: {
|
|
78
|
+
element: [
|
|
79
|
+
{
|
|
80
|
+
color: colors.secondaryLabel,
|
|
81
|
+
fontSize: 22
|
|
82
|
+
},
|
|
83
|
+
styles.icon
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
testID: `${blockId}_icon`
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// The trailing parts keep their natural width and the title column takes what is left, shrinking
|
|
91
|
+
// and ending its title with an ellipsis, so a long title never pushes a badge off the row.
|
|
92
|
+
const TITLE_COLUMN = {
|
|
93
|
+
flexBasis: 0,
|
|
94
|
+
flexGrow: 1,
|
|
95
|
+
flexShrink: 1,
|
|
96
|
+
gap: 1,
|
|
97
|
+
minWidth: 0
|
|
98
|
+
};
|
|
99
|
+
const TRAILING = {
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
flexDirection: 'row',
|
|
102
|
+
flexShrink: 0,
|
|
103
|
+
gap: 8
|
|
104
|
+
};
|
|
105
|
+
function Trailing({ blockId, colors, components, content, isDark, styles, tokens, trailing }) {
|
|
106
|
+
const parts = [];
|
|
107
|
+
if (!type.isNone(content.trailing)) {
|
|
108
|
+
parts.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
109
|
+
key: "slot"
|
|
110
|
+
}, content.trailing()));
|
|
111
|
+
}
|
|
112
|
+
trailing.badges.forEach((badge, index)=>{
|
|
113
|
+
const color = type.isString(badge.color) ? resolveColor({
|
|
114
|
+
color: badge.color,
|
|
115
|
+
tokens
|
|
116
|
+
}) : colors.secondaryLabel;
|
|
117
|
+
parts.push(/*#__PURE__*/ React.createElement(View, {
|
|
118
|
+
key: `badge-${index}`,
|
|
119
|
+
style: {
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
flexShrink: 0,
|
|
123
|
+
gap: 3
|
|
124
|
+
},
|
|
125
|
+
testID: `${blockId}_badge_${index}`
|
|
126
|
+
}, type.isNone(badge.icon) ? null : /*#__PURE__*/ React.createElement(components.Icon, {
|
|
127
|
+
properties: badge.icon,
|
|
128
|
+
styles: {
|
|
129
|
+
element: {
|
|
130
|
+
color,
|
|
131
|
+
fontSize: 14
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}), type.isNone(badge.text) ? null : /*#__PURE__*/ React.createElement(Text, {
|
|
135
|
+
style: [
|
|
136
|
+
iosTextStyles.footnote,
|
|
137
|
+
{
|
|
138
|
+
color,
|
|
139
|
+
fontVariant: [
|
|
140
|
+
'tabular-nums'
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}, `${badge.text}`)));
|
|
145
|
+
});
|
|
146
|
+
if (type.isString(trailing.text)) {
|
|
147
|
+
parts.push(/*#__PURE__*/ React.createElement(Text, {
|
|
148
|
+
key: "text",
|
|
149
|
+
numberOfLines: 1,
|
|
150
|
+
style: [
|
|
151
|
+
iosTextStyles.subheadline,
|
|
152
|
+
{
|
|
153
|
+
color: type.isString(trailing.textColor) ? resolveColor({
|
|
154
|
+
color: trailing.textColor,
|
|
155
|
+
tokens
|
|
156
|
+
}) : colors.secondaryLabel,
|
|
157
|
+
fontVariant: [
|
|
158
|
+
'tabular-nums'
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
styles.extra
|
|
162
|
+
]
|
|
163
|
+
}, trailing.text));
|
|
164
|
+
}
|
|
165
|
+
if (!type.isNone(trailing.status)) {
|
|
166
|
+
parts.push(/*#__PURE__*/ React.createElement(StatusMark, {
|
|
167
|
+
key: "status",
|
|
168
|
+
status: trailing.status,
|
|
169
|
+
testID: `${blockId}_trailing_status`,
|
|
170
|
+
tokens: tokens
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
if (!type.isNone(trailing.icon)) {
|
|
174
|
+
parts.push(/*#__PURE__*/ React.createElement(components.Icon, {
|
|
175
|
+
key: "icon",
|
|
176
|
+
properties: trailing.icon,
|
|
177
|
+
styles: {
|
|
178
|
+
element: {
|
|
179
|
+
color: colors.secondaryLabel,
|
|
180
|
+
fontSize: 17
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
testID: `${blockId}_trailing_icon`
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
if (type.isArray(trailing.avatars)) {
|
|
187
|
+
parts.push(/*#__PURE__*/ React.createElement(AvatarStack, {
|
|
188
|
+
avatars: trailing.avatars,
|
|
189
|
+
isDark: isDark,
|
|
190
|
+
key: "avatars",
|
|
191
|
+
max: 3,
|
|
192
|
+
imageSource: components.imageSource,
|
|
193
|
+
size: 20,
|
|
194
|
+
testID: `${blockId}_trailing_avatars`,
|
|
195
|
+
tokens: tokens
|
|
196
|
+
}));
|
|
197
|
+
} else if (type.isObject(trailing.avatar)) {
|
|
198
|
+
parts.push(/*#__PURE__*/ React.createElement(AvatarCircle, {
|
|
199
|
+
avatar: trailing.avatar,
|
|
200
|
+
isDark: isDark,
|
|
201
|
+
key: "avatar",
|
|
202
|
+
imageSource: components.imageSource,
|
|
203
|
+
size: trailing.avatar.size ?? 20,
|
|
204
|
+
testID: `${blockId}_trailing_avatar`,
|
|
205
|
+
tokens: tokens
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
if (parts.length === 0) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
212
|
+
style: TRAILING,
|
|
213
|
+
testID: `${blockId}_trailing`
|
|
214
|
+
}, parts);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* An iOS list row: a leading status glyph, avatar or icon (or `leading` slot), a title of one or
|
|
218
|
+
* two lines and a subtitle of meta, trailing meta text, badges, a glyph or avatars (or `trailing`
|
|
219
|
+
* slot), and a chevron when it has onClick, or the iOS checkmark in the tint colour where the
|
|
220
|
+
* chevron goes with `trailing.check` (a picked row of a multi-select list, which has no chevron).
|
|
221
|
+
* It highlights while pressed, has swipe actions (`onSwipeAction`) and a long-press context menu
|
|
222
|
+
* (`onContextMenu`), and in a List moves the row's separator in to its title.
|
|
223
|
+
*
|
|
224
|
+
* The title is a Headline when the row has a subtitle and Body when it stands alone, as iOS sets
|
|
225
|
+
* a two-line cell and a settings row.
|
|
226
|
+
*/ function ListItem({ blockId, components, content, events, methods, properties, styles }) {
|
|
227
|
+
const { isDark, tokens } = useComponentTokens(properties.theme);
|
|
228
|
+
const colors = getSemanticColors({
|
|
229
|
+
tokens
|
|
230
|
+
});
|
|
231
|
+
const row = useContext(ListRowContext);
|
|
232
|
+
const menuRef = useRef(null);
|
|
233
|
+
const parts = getListItemParts({
|
|
234
|
+
properties
|
|
235
|
+
});
|
|
236
|
+
const hasLeadingSlot = !type.isNone(content.leading);
|
|
237
|
+
useLayoutEffect(()=>{
|
|
238
|
+
if (row !== null && !hasLeadingSlot) {
|
|
239
|
+
row.setSeparatorInset(parts.separatorInset);
|
|
240
|
+
}
|
|
241
|
+
}, [
|
|
242
|
+
row,
|
|
243
|
+
hasLeadingSlot,
|
|
244
|
+
parts.separatorInset
|
|
245
|
+
]);
|
|
246
|
+
const pressable = !type.isNone(events.onClick);
|
|
247
|
+
const disabled = properties.disabled === true;
|
|
248
|
+
const checked = parts.trailing.check;
|
|
249
|
+
const showChevron = properties.chevron ?? (pressable && !checked);
|
|
250
|
+
const title = properties.title ?? '';
|
|
251
|
+
const hasSubtitle = type.isString(parts.subtitle);
|
|
252
|
+
const swipeActions = properties.swipeActions ?? {};
|
|
253
|
+
const leadingActions = swipeActions.leading ?? [];
|
|
254
|
+
const trailingActions = swipeActions.trailing ?? [];
|
|
255
|
+
const menuItems = properties.contextMenu ?? [];
|
|
256
|
+
function fireSwipeAction(action) {
|
|
257
|
+
methods.triggerEvent({
|
|
258
|
+
name: 'onSwipeAction',
|
|
259
|
+
event: {
|
|
260
|
+
id: action.id
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function fireContextMenu(item) {
|
|
265
|
+
methods.triggerEvent({
|
|
266
|
+
name: 'onContextMenu',
|
|
267
|
+
event: {
|
|
268
|
+
id: item.id
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
const accessibilityActions = [
|
|
273
|
+
...[
|
|
274
|
+
...leadingActions,
|
|
275
|
+
...trailingActions
|
|
276
|
+
].map((action)=>({
|
|
277
|
+
name: `swipe:${action.id}`,
|
|
278
|
+
label: action.title ?? action.id
|
|
279
|
+
})),
|
|
280
|
+
...menuItems.map((item)=>({
|
|
281
|
+
name: `menu:${item.id}`,
|
|
282
|
+
label: item.title
|
|
283
|
+
}))
|
|
284
|
+
];
|
|
285
|
+
function onAccessibilityAction(event) {
|
|
286
|
+
const [kind, id] = event.nativeEvent.actionName.split(/:(.*)/s);
|
|
287
|
+
if (kind === 'swipe') {
|
|
288
|
+
fireSwipeAction({
|
|
289
|
+
id
|
|
290
|
+
});
|
|
291
|
+
} else if (kind === 'menu') {
|
|
292
|
+
fireContextMenu({
|
|
293
|
+
id
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
const nativeMenu = menuItems.length > 0 && Platform.OS === 'ios';
|
|
298
|
+
// Android's menu opens from the row's own long press: the row is pressable, so it takes the touch
|
|
299
|
+
// before the menu's trigger could. A disabled row has no menu.
|
|
300
|
+
const androidMenu = menuItems.length > 0 && !nativeMenu && !disabled;
|
|
301
|
+
let item = /*#__PURE__*/ React.createElement(Pressable, {
|
|
302
|
+
accessibilityActions: accessibilityActions.length > 0 ? accessibilityActions : undefined,
|
|
303
|
+
accessibilityLabel: [
|
|
304
|
+
title,
|
|
305
|
+
parts.subtitle
|
|
306
|
+
].filter((text)=>type.isString(text)).join(', '),
|
|
307
|
+
accessibilityRole: pressable ? 'button' : undefined,
|
|
308
|
+
accessibilityState: checked ? {
|
|
309
|
+
selected: true
|
|
310
|
+
} : undefined,
|
|
311
|
+
disabled: disabled,
|
|
312
|
+
onAccessibilityAction: onAccessibilityAction,
|
|
313
|
+
onLongPress: androidMenu ? ()=>menuRef.current?.show() : undefined,
|
|
314
|
+
onPress: pressable ? ()=>methods.triggerEvent({
|
|
315
|
+
name: 'onClick'
|
|
316
|
+
}) : undefined,
|
|
317
|
+
style: ({ pressed })=>[
|
|
318
|
+
{
|
|
319
|
+
alignItems: 'center',
|
|
320
|
+
backgroundColor: pressed && pressable ? colors.cellPressed : 'transparent',
|
|
321
|
+
flexDirection: 'row',
|
|
322
|
+
gap: GAP,
|
|
323
|
+
minHeight: 44,
|
|
324
|
+
opacity: disabled ? 0.4 : 1,
|
|
325
|
+
paddingHorizontal: ROW_PADDING,
|
|
326
|
+
paddingVertical: hasSubtitle ? 10 : 11
|
|
327
|
+
},
|
|
328
|
+
styles.element
|
|
329
|
+
],
|
|
330
|
+
testID: `${blockId}_item`
|
|
331
|
+
}, /*#__PURE__*/ React.createElement(Leading, {
|
|
332
|
+
blockId: blockId,
|
|
333
|
+
colors: colors,
|
|
334
|
+
components: components,
|
|
335
|
+
content: content,
|
|
336
|
+
isDark: isDark,
|
|
337
|
+
leading: parts.leading,
|
|
338
|
+
styles: styles,
|
|
339
|
+
tokens: tokens
|
|
340
|
+
}), /*#__PURE__*/ React.createElement(View, {
|
|
341
|
+
onLayout: hasLeadingSlot && row !== null ? (event)=>row.setSeparatorInset(event.nativeEvent.layout.x) : undefined,
|
|
342
|
+
style: TITLE_COLUMN,
|
|
343
|
+
testID: `${blockId}_text`
|
|
344
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
345
|
+
ellipsizeMode: "tail",
|
|
346
|
+
numberOfLines: properties.titleLines ?? 2,
|
|
347
|
+
style: [
|
|
348
|
+
hasSubtitle ? iosTextStyles.headline : iosTextStyles.body,
|
|
349
|
+
{
|
|
350
|
+
color: colors.label
|
|
351
|
+
},
|
|
352
|
+
styles.title
|
|
353
|
+
]
|
|
354
|
+
}, title), hasSubtitle ? /*#__PURE__*/ React.createElement(Text, {
|
|
355
|
+
ellipsizeMode: "tail",
|
|
356
|
+
numberOfLines: properties.subtitleLines ?? 1,
|
|
357
|
+
style: [
|
|
358
|
+
iosTextStyles.footnote,
|
|
359
|
+
{
|
|
360
|
+
color: colors.secondaryLabel
|
|
361
|
+
},
|
|
362
|
+
styles.description,
|
|
363
|
+
styles.subtitle
|
|
364
|
+
]
|
|
365
|
+
}, parts.subtitle) : null), /*#__PURE__*/ React.createElement(Trailing, {
|
|
366
|
+
blockId: blockId,
|
|
367
|
+
colors: colors,
|
|
368
|
+
components: components,
|
|
369
|
+
content: content,
|
|
370
|
+
isDark: isDark,
|
|
371
|
+
styles: styles,
|
|
372
|
+
tokens: tokens,
|
|
373
|
+
trailing: parts.trailing
|
|
374
|
+
}), checked ? /*#__PURE__*/ React.createElement(SystemIcon, {
|
|
375
|
+
color: tokens.colorTint,
|
|
376
|
+
components: components,
|
|
377
|
+
fallback: "Check",
|
|
378
|
+
size: 17,
|
|
379
|
+
symbol: "checkmark",
|
|
380
|
+
testID: `${blockId}_check`,
|
|
381
|
+
weight: "semibold"
|
|
382
|
+
}) : null, showChevron ? /*#__PURE__*/ React.createElement(components.Icon, {
|
|
383
|
+
properties: {
|
|
384
|
+
name: 'chevron-right',
|
|
385
|
+
strokeWidth: 2.5,
|
|
386
|
+
title: ''
|
|
387
|
+
},
|
|
388
|
+
styles: {
|
|
389
|
+
element: {
|
|
390
|
+
color: colors.tertiaryLabel,
|
|
391
|
+
fontSize: 16,
|
|
392
|
+
marginLeft: -4
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
testID: `${blockId}_chevron`
|
|
396
|
+
}) : null);
|
|
397
|
+
if (nativeMenu) {
|
|
398
|
+
item = /*#__PURE__*/ React.createElement(ListItemContextMenu, {
|
|
399
|
+
isDark: isDark,
|
|
400
|
+
items: menuItems,
|
|
401
|
+
onSelect: fireContextMenu,
|
|
402
|
+
testID: `${blockId}_menu`
|
|
403
|
+
}, item);
|
|
404
|
+
}
|
|
405
|
+
if (androidMenu) {
|
|
406
|
+
// Android's Material dropdown on long press: every item shows and a back or outside tap
|
|
407
|
+
// dismisses it, which Alert.alert cannot do (it keeps three buttons and is not cancelable).
|
|
408
|
+
item = /*#__PURE__*/ React.createElement(NativeMenu, {
|
|
409
|
+
actions: menuItems.map((menuItem)=>({
|
|
410
|
+
id: menuItem.id,
|
|
411
|
+
title: menuItem.title,
|
|
412
|
+
attributes: {
|
|
413
|
+
destructive: menuItem.destructive === true
|
|
414
|
+
}
|
|
415
|
+
})),
|
|
416
|
+
fullWidth: true,
|
|
417
|
+
menuRef: menuRef,
|
|
418
|
+
onSelect: (id)=>fireContextMenu({
|
|
419
|
+
id
|
|
420
|
+
}),
|
|
421
|
+
openOnLongPress: true,
|
|
422
|
+
testID: `${blockId}_menu`
|
|
423
|
+
}, item);
|
|
424
|
+
}
|
|
425
|
+
if (leadingActions.length > 0 || trailingActions.length > 0) {
|
|
426
|
+
item = /*#__PURE__*/ React.createElement(SwipeableRow, {
|
|
427
|
+
background: row?.background ?? colors.cell,
|
|
428
|
+
fullSwipe: FULL_SWIPE[swipeActions.fullSwipe ?? 'leading'],
|
|
429
|
+
Icon: components.Icon,
|
|
430
|
+
leading: leadingActions,
|
|
431
|
+
onAction: fireSwipeAction,
|
|
432
|
+
testID: blockId,
|
|
433
|
+
tokens: tokens,
|
|
434
|
+
trailing: trailingActions
|
|
435
|
+
}, item);
|
|
436
|
+
}
|
|
437
|
+
return item;
|
|
438
|
+
}
|
|
439
|
+
ListItem.meta = meta;
|
|
440
|
+
export default ListItem;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 from 'react';
|
|
16
|
+
import { View } from 'react-native';
|
|
17
|
+
import getSfSymbol from './getSfSymbol.js';
|
|
18
|
+
/**
|
|
19
|
+
* iOS's native context menu around a row: a long press lifts the row and shows its items, as
|
|
20
|
+
* Mail and Linear rows do. The row is React Native content hosted in the SwiftUI menu's trigger.
|
|
21
|
+
* iOS only; Android shows a Material menu on long press (NativeMenu).
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} props
|
|
24
|
+
* @param {boolean} props.isDark
|
|
25
|
+
* @param {{ id: string, title: string, icon?: string|Object, destructive?: boolean }[]} props.items
|
|
26
|
+
* @param {(item: Object) => void} props.onSelect
|
|
27
|
+
* @param {string} props.testID
|
|
28
|
+
*/ function ListItemContextMenu({ children, isDark, items, onSelect, testID }) {
|
|
29
|
+
// Required when drawn, not imported: SwiftUI views exist only on iOS, and ListItem draws this
|
|
30
|
+
// menu only there (as @expo/ui's universal components load @expo/ui/swift-ui only on iOS).
|
|
31
|
+
// eslint-disable-next-line global-require
|
|
32
|
+
const { Button, ContextMenu, Host, RNHostView } = require('@expo/ui/swift-ui');
|
|
33
|
+
return /*#__PURE__*/ React.createElement(Host, {
|
|
34
|
+
colorScheme: isDark ? 'dark' : 'light',
|
|
35
|
+
matchContents: {
|
|
36
|
+
vertical: true
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
39
|
+
alignSelf: 'stretch'
|
|
40
|
+
},
|
|
41
|
+
testID: testID
|
|
42
|
+
}, /*#__PURE__*/ React.createElement(ContextMenu, null, /*#__PURE__*/ React.createElement(ContextMenu.Items, null, items.map((item)=>/*#__PURE__*/ React.createElement(Button, {
|
|
43
|
+
key: item.id,
|
|
44
|
+
label: item.title,
|
|
45
|
+
onPress: ()=>onSelect(item),
|
|
46
|
+
role: item.destructive === true ? 'destructive' : undefined,
|
|
47
|
+
systemImage: getSfSymbol(item.icon)
|
|
48
|
+
}))), /*#__PURE__*/ React.createElement(ContextMenu.Trigger, null, /*#__PURE__*/ React.createElement(RNHostView, {
|
|
49
|
+
matchContents: {
|
|
50
|
+
vertical: true
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
53
|
+
style: {
|
|
54
|
+
width: '100%'
|
|
55
|
+
}
|
|
56
|
+
}, children)))));
|
|
57
|
+
}
|
|
58
|
+
export default ListItemContextMenu;
|
|
@@ -0,0 +1,101 @@
|
|
|
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 { type } from '@lowdefy/helpers';
|
|
16
|
+
const ROW_PADDING = 16;
|
|
17
|
+
const GAP = 12;
|
|
18
|
+
const ICON_BOX = 28;
|
|
19
|
+
const STATUS_SIZE = 18;
|
|
20
|
+
function getLeading({ properties }) {
|
|
21
|
+
const leading = {
|
|
22
|
+
avatar: properties.avatar,
|
|
23
|
+
icon: properties.icon,
|
|
24
|
+
...properties.leading ?? {}
|
|
25
|
+
};
|
|
26
|
+
if (!type.isNone(leading.status)) {
|
|
27
|
+
const status = type.isString(leading.status) ? {
|
|
28
|
+
name: leading.status
|
|
29
|
+
} : leading.status;
|
|
30
|
+
const size = status.size ?? STATUS_SIZE;
|
|
31
|
+
return {
|
|
32
|
+
kind: 'status',
|
|
33
|
+
status: {
|
|
34
|
+
...status,
|
|
35
|
+
size
|
|
36
|
+
},
|
|
37
|
+
width: size
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (type.isObject(leading.avatar)) {
|
|
41
|
+
const size = leading.avatar.size ?? (type.isNone(getSubtitle({
|
|
42
|
+
properties
|
|
43
|
+
})) ? 28 : 40);
|
|
44
|
+
return {
|
|
45
|
+
kind: 'avatar',
|
|
46
|
+
avatar: leading.avatar,
|
|
47
|
+
size,
|
|
48
|
+
width: size
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (!type.isNone(leading.icon)) {
|
|
52
|
+
return {
|
|
53
|
+
kind: 'icon',
|
|
54
|
+
icon: leading.icon,
|
|
55
|
+
width: ICON_BOX
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function getSubtitle({ properties }) {
|
|
61
|
+
return properties.subtitle ?? properties.description;
|
|
62
|
+
}
|
|
63
|
+
function getTrailing({ properties }) {
|
|
64
|
+
const trailing = properties.trailing ?? {};
|
|
65
|
+
return {
|
|
66
|
+
avatar: trailing.avatar,
|
|
67
|
+
avatars: trailing.avatars,
|
|
68
|
+
badges: trailing.badges ?? [],
|
|
69
|
+
check: trailing.check === true,
|
|
70
|
+
icon: trailing.icon,
|
|
71
|
+
status: trailing.status,
|
|
72
|
+
text: trailing.text ?? properties.extra,
|
|
73
|
+
textColor: trailing.textColor
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* What a ListItem draws from its properties: the leading glyph (a status glyph, else an avatar,
|
|
78
|
+
* else an icon), the subtitle, the trailing parts, and where the row's separator starts (in line
|
|
79
|
+
* with the title, as iOS insets it). The phase 1 `icon`, `avatar`, `description` and `extra`
|
|
80
|
+
* properties stand for `leading.icon`, `leading.avatar`, `subtitle` and `trailing.text`.
|
|
81
|
+
*
|
|
82
|
+
* @param {Object} params
|
|
83
|
+
* @param {Object} params.properties The ListItem's properties.
|
|
84
|
+
* @returns {{ leading: Object|null, subtitle?: string, trailing: Object, separatorInset: number }}
|
|
85
|
+
*/ function getListItemParts({ properties }) {
|
|
86
|
+
const leading = getLeading({
|
|
87
|
+
properties
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
leading,
|
|
91
|
+
separatorInset: leading === null ? ROW_PADDING : ROW_PADDING + leading.width + GAP,
|
|
92
|
+
subtitle: getSubtitle({
|
|
93
|
+
properties
|
|
94
|
+
}),
|
|
95
|
+
trailing: getTrailing({
|
|
96
|
+
properties
|
|
97
|
+
})
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export { GAP, ICON_BOX, ROW_PADDING };
|
|
101
|
+
export default getListItemParts;
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { type } from '@lowdefy/helpers';
|
|
16
|
+
// SF Symbol names are lower case words joined by dots (trash, doc.on.doc, checkmark.circle).
|
|
17
|
+
const SF_SYMBOL = /^[a-z0-9]+(\.[a-z0-9]+)*$/;
|
|
18
|
+
/**
|
|
19
|
+
* The SF Symbol a native menu item shows for a configured icon: `{ sf }`, or an icon name that
|
|
20
|
+
* reads as an SF Symbol. A native menu cannot draw a Lucide icon (PascalCase), so it shows none.
|
|
21
|
+
*
|
|
22
|
+
* @param {string|Object} [icon]
|
|
23
|
+
* @returns {string|undefined}
|
|
24
|
+
*/ function getSfSymbol(icon) {
|
|
25
|
+
if (type.isObject(icon)) {
|
|
26
|
+
return type.isString(icon.sf) ? icon.sf : getSfSymbol(icon.name);
|
|
27
|
+
}
|
|
28
|
+
if (type.isString(icon) && SF_SYMBOL.test(icon)) {
|
|
29
|
+
return icon;
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
export default getSfSymbol;
|