@lowdefy/blocks-native 0.0.0-stage → 7.2.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,96 @@
|
|
|
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 label from '../../schemas/inputLabel.js';
|
|
16
|
+
import { allowClear, autoFocus, bordered, disabled, inputTitle, placeholder, sizeSmallMiddleLarge, theme, variant } from '../../schemas/inputProperties.js';
|
|
17
|
+
export default {
|
|
18
|
+
category: 'input',
|
|
19
|
+
icons: [
|
|
20
|
+
'ArrowUp'
|
|
21
|
+
],
|
|
22
|
+
valueType: 'string',
|
|
23
|
+
cssKeys: {
|
|
24
|
+
element: 'The TextArea box (the composer field with `variant: composer`).',
|
|
25
|
+
label: 'The TextArea label.',
|
|
26
|
+
extra: 'The TextArea extra content.',
|
|
27
|
+
feedback: 'The TextArea validation feedback.'
|
|
28
|
+
},
|
|
29
|
+
events: {
|
|
30
|
+
onBlur: 'Trigger actions when the text area loses focus.',
|
|
31
|
+
onChange: {
|
|
32
|
+
description: 'Trigger actions when the text area is changed.',
|
|
33
|
+
event: {
|
|
34
|
+
value: 'The current input value.'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
onClear: 'Trigger actions when the clear button is pressed.',
|
|
38
|
+
onFocus: 'Trigger actions when the text area gets focus.',
|
|
39
|
+
onPressEnter: 'Never fires on mobile: the return key adds a new line, as it does in a web text area.',
|
|
40
|
+
onSend: {
|
|
41
|
+
description: 'Mobile only. With `variant: composer`, the block shows a send button that triggers these actions with the text; the field clears when they succeed.',
|
|
42
|
+
event: {
|
|
43
|
+
value: 'The text sent.'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
properties: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
additionalProperties: false,
|
|
50
|
+
properties: {
|
|
51
|
+
allowClear: {
|
|
52
|
+
...allowClear,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
autoFocus,
|
|
56
|
+
autoSize: {
|
|
57
|
+
type: [
|
|
58
|
+
'boolean',
|
|
59
|
+
'object'
|
|
60
|
+
],
|
|
61
|
+
description: 'On mobile the text area always grows with its text, from the height of `rows` lines.'
|
|
62
|
+
},
|
|
63
|
+
bordered,
|
|
64
|
+
disabled,
|
|
65
|
+
label,
|
|
66
|
+
maxLength: {
|
|
67
|
+
type: 'integer',
|
|
68
|
+
description: 'The max number of input characters.'
|
|
69
|
+
},
|
|
70
|
+
placeholder,
|
|
71
|
+
rows: {
|
|
72
|
+
type: 'integer',
|
|
73
|
+
description: 'Number of lines the text area shows when empty.'
|
|
74
|
+
},
|
|
75
|
+
showCount: {
|
|
76
|
+
type: [
|
|
77
|
+
'boolean',
|
|
78
|
+
'object'
|
|
79
|
+
],
|
|
80
|
+
default: false,
|
|
81
|
+
description: 'Show the character count beneath the text area.'
|
|
82
|
+
},
|
|
83
|
+
size: sizeSmallMiddleLarge,
|
|
84
|
+
theme,
|
|
85
|
+
title: inputTitle,
|
|
86
|
+
variant: {
|
|
87
|
+
...variant,
|
|
88
|
+
enum: [
|
|
89
|
+
...variant.enum,
|
|
90
|
+
'composer'
|
|
91
|
+
],
|
|
92
|
+
description: `${variant.description} \`composer\` (mobile only) is a message composer: a rounded field that grows from one line to six, with a send button when the block has onSend.`
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
@@ -0,0 +1,253 @@
|
|
|
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, { useRef, useState } from 'react';
|
|
16
|
+
import { Pressable, Text, TextInput as RNTextInput, View } from 'react-native';
|
|
17
|
+
import { type } from '@lowdefy/helpers';
|
|
18
|
+
import applyReplaceInput from './applyReplaceInput.js';
|
|
19
|
+
import ClearButton from '../../shared/ClearButton.js';
|
|
20
|
+
import CountText from '../../shared/CountText.js';
|
|
21
|
+
import getInputBoxStyle from '../../shared/getInputBoxStyle.js';
|
|
22
|
+
import getIosTextStyle from '../../typography/getIosTextStyle.js';
|
|
23
|
+
import getKeyboardProps from './getKeyboardProps.js';
|
|
24
|
+
import getLabelProperties from '../Label/getLabelProperties.js';
|
|
25
|
+
import getLabelState from '../Label/getLabelState.js';
|
|
26
|
+
import getPropertyRowTextStyles from '../../shared/getPropertyRowTextStyles.js';
|
|
27
|
+
import getSearchBoxStyle from './getSearchBoxStyle.js';
|
|
28
|
+
import Label from '../Label/Label.js';
|
|
29
|
+
import meta from './meta.js';
|
|
30
|
+
import PropertyRow from '../../shared/PropertyRow.js';
|
|
31
|
+
import useBlockTokens from '../../shared/useBlockTokens.js';
|
|
32
|
+
// A text field. `variant: search` is the iOS search field: a rounded grey fill with a magnifying
|
|
33
|
+
// glass, a clear button while it has text, the keyboard's Search key, and Cancel beside it while
|
|
34
|
+
// it is focused, which clears the text and closes the keyboard. `variant: row` is an iOS
|
|
35
|
+
// Settings-style row (PropertyRow): the title at the left and the one-line value right-aligned in
|
|
36
|
+
// the secondary label colour, "Not set" while it is empty; pressing the row focuses the field.
|
|
37
|
+
function TextInput({ blockId, components, loading, methods, properties, required, styles, validation, value }) {
|
|
38
|
+
const { tokens } = useBlockTokens({
|
|
39
|
+
properties
|
|
40
|
+
});
|
|
41
|
+
const inputRef = useRef(null);
|
|
42
|
+
const [focused, setFocused] = useState(false);
|
|
43
|
+
const { accessibilityLabel, labelProperties } = getLabelProperties({
|
|
44
|
+
properties
|
|
45
|
+
});
|
|
46
|
+
const disabled = loading === true || properties.disabled === true;
|
|
47
|
+
const search = properties.variant === 'search';
|
|
48
|
+
const { box, text } = search ? getSearchBoxStyle({
|
|
49
|
+
disabled,
|
|
50
|
+
tokens
|
|
51
|
+
}) : getInputBoxStyle({
|
|
52
|
+
disabled,
|
|
53
|
+
properties,
|
|
54
|
+
status: validation?.status,
|
|
55
|
+
tokens
|
|
56
|
+
});
|
|
57
|
+
const hasValue = !type.isNone(value) && value !== '';
|
|
58
|
+
const setText = (input)=>{
|
|
59
|
+
methods.setValue(input);
|
|
60
|
+
methods.triggerEvent({
|
|
61
|
+
name: 'onChange',
|
|
62
|
+
event: {
|
|
63
|
+
value: input
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const clear = ()=>{
|
|
68
|
+
setText('');
|
|
69
|
+
methods.triggerEvent({
|
|
70
|
+
name: 'onClear'
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const showClear = (search || properties.allowClear === true) && !disabled && hasValue;
|
|
74
|
+
const inputProps = {
|
|
75
|
+
...getKeyboardProps({
|
|
76
|
+
type: properties.type
|
|
77
|
+
}),
|
|
78
|
+
accessibilityLabel,
|
|
79
|
+
autoFocus: properties.autoFocus === true,
|
|
80
|
+
editable: !disabled,
|
|
81
|
+
maxLength: properties.maxLength,
|
|
82
|
+
onBlur: ()=>{
|
|
83
|
+
setFocused(false);
|
|
84
|
+
methods.triggerEvent({
|
|
85
|
+
name: 'onBlur'
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
onChangeText: (input)=>setText(applyReplaceInput({
|
|
89
|
+
replaceInput: properties.replaceInput,
|
|
90
|
+
text: input
|
|
91
|
+
})),
|
|
92
|
+
onFocus: ()=>{
|
|
93
|
+
setFocused(true);
|
|
94
|
+
methods.triggerEvent({
|
|
95
|
+
name: 'onFocus'
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
onSubmitEditing: ()=>methods.triggerEvent({
|
|
99
|
+
name: 'onPressEnter'
|
|
100
|
+
}),
|
|
101
|
+
ref: inputRef,
|
|
102
|
+
selectionColor: tokens.colorTint,
|
|
103
|
+
testID: `${blockId}_input`,
|
|
104
|
+
value: value ?? ''
|
|
105
|
+
};
|
|
106
|
+
if (properties.variant === 'row') {
|
|
107
|
+
const rowText = getPropertyRowTextStyles({
|
|
108
|
+
tokens
|
|
109
|
+
});
|
|
110
|
+
const { title } = getLabelState({
|
|
111
|
+
properties: labelProperties
|
|
112
|
+
});
|
|
113
|
+
return /*#__PURE__*/ React.createElement(Label, {
|
|
114
|
+
blockId: blockId,
|
|
115
|
+
properties: {
|
|
116
|
+
...labelProperties,
|
|
117
|
+
disabled: true
|
|
118
|
+
},
|
|
119
|
+
required: required,
|
|
120
|
+
styles: styles,
|
|
121
|
+
tokens: tokens,
|
|
122
|
+
validation: validation
|
|
123
|
+
}, /*#__PURE__*/ React.createElement(PropertyRow, {
|
|
124
|
+
disabled: disabled,
|
|
125
|
+
onPress: ()=>inputRef.current?.focus(),
|
|
126
|
+
required: required,
|
|
127
|
+
styles: styles,
|
|
128
|
+
testID: `${blockId}_row`,
|
|
129
|
+
title: title,
|
|
130
|
+
tokens: tokens
|
|
131
|
+
}, type.isString(properties.prefix) ? /*#__PURE__*/ React.createElement(Text, {
|
|
132
|
+
style: [
|
|
133
|
+
rowText.value,
|
|
134
|
+
styles.value
|
|
135
|
+
]
|
|
136
|
+
}, properties.prefix) : null, /*#__PURE__*/ React.createElement(RNTextInput, {
|
|
137
|
+
...inputProps,
|
|
138
|
+
placeholder: properties.placeholder ?? 'Not set',
|
|
139
|
+
placeholderTextColor: rowText.value.color,
|
|
140
|
+
style: [
|
|
141
|
+
rowText.value,
|
|
142
|
+
{
|
|
143
|
+
flex: 1,
|
|
144
|
+
padding: 0,
|
|
145
|
+
textAlign: 'right'
|
|
146
|
+
},
|
|
147
|
+
styles.value
|
|
148
|
+
]
|
|
149
|
+
}), showClear && focused ? /*#__PURE__*/ React.createElement(ClearButton, {
|
|
150
|
+
blockId: blockId,
|
|
151
|
+
onPress: clear,
|
|
152
|
+
tokens: tokens
|
|
153
|
+
}) : null, type.isString(properties.suffix) ? /*#__PURE__*/ React.createElement(Text, {
|
|
154
|
+
style: [
|
|
155
|
+
rowText.value,
|
|
156
|
+
styles.value
|
|
157
|
+
]
|
|
158
|
+
}, properties.suffix) : null));
|
|
159
|
+
}
|
|
160
|
+
return /*#__PURE__*/ React.createElement(Label, {
|
|
161
|
+
blockId: blockId,
|
|
162
|
+
properties: labelProperties,
|
|
163
|
+
required: required,
|
|
164
|
+
styles: styles,
|
|
165
|
+
tokens: tokens,
|
|
166
|
+
validation: validation
|
|
167
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
168
|
+
style: {
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
flexDirection: 'row'
|
|
171
|
+
}
|
|
172
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
173
|
+
style: [
|
|
174
|
+
box,
|
|
175
|
+
{
|
|
176
|
+
flex: 1
|
|
177
|
+
},
|
|
178
|
+
styles.element
|
|
179
|
+
]
|
|
180
|
+
}, search ? /*#__PURE__*/ React.createElement(components.Icon, {
|
|
181
|
+
properties: {
|
|
182
|
+
name: 'search',
|
|
183
|
+
title: ''
|
|
184
|
+
},
|
|
185
|
+
styles: {
|
|
186
|
+
element: {
|
|
187
|
+
color: tokens.colorSecondaryLabel,
|
|
188
|
+
fontSize: 17,
|
|
189
|
+
marginRight: 6
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
testID: `${blockId}_search_icon`
|
|
193
|
+
}) : null, type.isString(properties.prefix) ? /*#__PURE__*/ React.createElement(Text, {
|
|
194
|
+
style: [
|
|
195
|
+
text,
|
|
196
|
+
{
|
|
197
|
+
color: tokens.colorSecondaryLabel,
|
|
198
|
+
marginRight: 4
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}, properties.prefix) : null, /*#__PURE__*/ React.createElement(RNTextInput, {
|
|
202
|
+
...inputProps,
|
|
203
|
+
...search ? {
|
|
204
|
+
autoCapitalize: 'none',
|
|
205
|
+
autoCorrect: false,
|
|
206
|
+
returnKeyType: 'search'
|
|
207
|
+
} : {},
|
|
208
|
+
placeholder: properties.placeholder ?? (search ? 'Search' : undefined),
|
|
209
|
+
placeholderTextColor: tokens.colorTertiaryLabel,
|
|
210
|
+
style: [
|
|
211
|
+
text,
|
|
212
|
+
{
|
|
213
|
+
flex: 1,
|
|
214
|
+
paddingVertical: 0
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}), properties.showCount === true ? /*#__PURE__*/ React.createElement(CountText, {
|
|
218
|
+
maxLength: properties.maxLength,
|
|
219
|
+
tokens: tokens,
|
|
220
|
+
value: value
|
|
221
|
+
}) : null, showClear ? /*#__PURE__*/ React.createElement(ClearButton, {
|
|
222
|
+
blockId: blockId,
|
|
223
|
+
onPress: clear,
|
|
224
|
+
tokens: tokens
|
|
225
|
+
}) : null, type.isString(properties.suffix) ? /*#__PURE__*/ React.createElement(Text, {
|
|
226
|
+
style: [
|
|
227
|
+
text,
|
|
228
|
+
{
|
|
229
|
+
color: tokens.colorSecondaryLabel,
|
|
230
|
+
marginLeft: 4
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}, properties.suffix) : null), search && focused ? /*#__PURE__*/ React.createElement(Pressable, {
|
|
234
|
+
accessibilityRole: "button",
|
|
235
|
+
hitSlop: 8,
|
|
236
|
+
onPress: ()=>{
|
|
237
|
+
if (hasValue) clear();
|
|
238
|
+
inputRef.current?.blur();
|
|
239
|
+
},
|
|
240
|
+
style: {
|
|
241
|
+
marginLeft: 12
|
|
242
|
+
},
|
|
243
|
+
testID: `${blockId}_cancel`
|
|
244
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
245
|
+
style: getIosTextStyle({
|
|
246
|
+
color: tokens.colorTint,
|
|
247
|
+
textStyle: 'body',
|
|
248
|
+
tokens
|
|
249
|
+
})
|
|
250
|
+
}, "Cancel")) : null));
|
|
251
|
+
}
|
|
252
|
+
TextInput.meta = meta;
|
|
253
|
+
export default TextInput;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* The typed text with `replaceInput` applied, as the web TextInput sanitizes its input.
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} params
|
|
20
|
+
* @param {string} params.text
|
|
21
|
+
* @param {{ pattern: string, flags?: string, replacement?: string }} [params.replaceInput]
|
|
22
|
+
* @returns {string}
|
|
23
|
+
*/ function applyReplaceInput({ replaceInput, text }) {
|
|
24
|
+
if (type.isNone(replaceInput)) {
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
const regex = new RegExp(replaceInput.pattern, replaceInput.flags ?? 'gm');
|
|
28
|
+
return text.replace(regex, replaceInput.replacement ?? '');
|
|
29
|
+
}
|
|
30
|
+
export default applyReplaceInput;
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
*/ /**
|
|
16
|
+
* The keyboard and autofill props of a React Native TextInput for the web input `type`, so each
|
|
17
|
+
* input opens the keyboard its value needs.
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} params
|
|
20
|
+
* @param {string} [params.type] 'text', 'number', 'password', 'tel', 'email' or 'url'.
|
|
21
|
+
* @returns {Object} TextInput props.
|
|
22
|
+
*/ function getKeyboardProps({ type }) {
|
|
23
|
+
switch(type){
|
|
24
|
+
case 'email':
|
|
25
|
+
return {
|
|
26
|
+
autoCapitalize: 'none',
|
|
27
|
+
autoComplete: 'email',
|
|
28
|
+
autoCorrect: false,
|
|
29
|
+
keyboardType: 'email-address',
|
|
30
|
+
textContentType: 'emailAddress'
|
|
31
|
+
};
|
|
32
|
+
case 'number':
|
|
33
|
+
return {
|
|
34
|
+
keyboardType: 'numeric'
|
|
35
|
+
};
|
|
36
|
+
case 'password':
|
|
37
|
+
return {
|
|
38
|
+
autoCapitalize: 'none',
|
|
39
|
+
autoComplete: 'password',
|
|
40
|
+
autoCorrect: false,
|
|
41
|
+
secureTextEntry: true,
|
|
42
|
+
textContentType: 'password'
|
|
43
|
+
};
|
|
44
|
+
case 'tel':
|
|
45
|
+
return {
|
|
46
|
+
autoComplete: 'tel',
|
|
47
|
+
keyboardType: 'phone-pad',
|
|
48
|
+
textContentType: 'telephoneNumber'
|
|
49
|
+
};
|
|
50
|
+
case 'url':
|
|
51
|
+
return {
|
|
52
|
+
autoCapitalize: 'none',
|
|
53
|
+
autoComplete: 'url',
|
|
54
|
+
autoCorrect: false,
|
|
55
|
+
keyboardType: 'url',
|
|
56
|
+
textContentType: 'URL'
|
|
57
|
+
};
|
|
58
|
+
default:
|
|
59
|
+
return {
|
|
60
|
+
keyboardType: 'default'
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export default getKeyboardProps;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
*/ /**
|
|
16
|
+
* The iOS search field: 36 points tall, a rounded fill in the tertiary system fill, body text.
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} params
|
|
19
|
+
* @param {boolean} params.disabled
|
|
20
|
+
* @param {Object} params.tokens The block's theme tokens.
|
|
21
|
+
* @returns {{ box: Object, text: Object }}
|
|
22
|
+
*/ function getSearchBoxStyle({ disabled, tokens }) {
|
|
23
|
+
return {
|
|
24
|
+
box: {
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
backgroundColor: tokens.colorTertiarySystemFill,
|
|
27
|
+
borderRadius: 10,
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
minHeight: 36,
|
|
30
|
+
opacity: disabled ? 0.6 : 1,
|
|
31
|
+
paddingHorizontal: 8
|
|
32
|
+
},
|
|
33
|
+
text: {
|
|
34
|
+
color: tokens.colorLabel,
|
|
35
|
+
fontSize: 17
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export default getSearchBoxStyle;
|
|
@@ -0,0 +1,113 @@
|
|
|
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 label from '../../schemas/inputLabel.js';
|
|
16
|
+
import { allowClear, autoFocus, bordered, disabled, inputTitle, placeholder, prefix, sizeSmallMiddleLarge, suffix, theme, variant, webIcon } from '../../schemas/inputProperties.js';
|
|
17
|
+
export default {
|
|
18
|
+
category: 'input',
|
|
19
|
+
icons: [
|
|
20
|
+
'search'
|
|
21
|
+
],
|
|
22
|
+
valueType: 'string',
|
|
23
|
+
cssKeys: {
|
|
24
|
+
element: 'The TextInput box (the search field with `variant: search`, the row with `variant: row`).',
|
|
25
|
+
label: 'The TextInput label (the row title with `variant: row`).',
|
|
26
|
+
extra: 'The TextInput extra content.',
|
|
27
|
+
feedback: 'The TextInput validation feedback.',
|
|
28
|
+
value: 'The text and its prefix and suffix with `variant: row`.'
|
|
29
|
+
},
|
|
30
|
+
events: {
|
|
31
|
+
onBlur: 'Trigger actions when the text input loses focus.',
|
|
32
|
+
onChange: {
|
|
33
|
+
description: 'Trigger actions when the text input is changed.',
|
|
34
|
+
event: {
|
|
35
|
+
value: 'The current input value.'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
onClear: 'Trigger actions when the clear button is pressed, or Cancel beside a search field clears it.',
|
|
39
|
+
onFocus: 'Trigger actions when the text input gets focus.',
|
|
40
|
+
onPressEnter: "Trigger actions when the keyboard's return key is pressed (the Search key of a search field)."
|
|
41
|
+
},
|
|
42
|
+
properties: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
properties: {
|
|
46
|
+
allowClear: {
|
|
47
|
+
...allowClear,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
autoFocus,
|
|
51
|
+
bordered,
|
|
52
|
+
disabled,
|
|
53
|
+
label,
|
|
54
|
+
maxLength: {
|
|
55
|
+
type: 'integer',
|
|
56
|
+
description: 'The max number of input characters.'
|
|
57
|
+
},
|
|
58
|
+
placeholder,
|
|
59
|
+
prefix,
|
|
60
|
+
prefixIcon: webIcon,
|
|
61
|
+
replaceInput: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
description: 'Regex used to sanitize input.',
|
|
64
|
+
properties: {
|
|
65
|
+
pattern: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
description: 'The regular expression pattern to use to sanitize input.'
|
|
68
|
+
},
|
|
69
|
+
flags: {
|
|
70
|
+
type: 'string',
|
|
71
|
+
description: "The regex flags to use. The default value is 'gm'."
|
|
72
|
+
},
|
|
73
|
+
replacement: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
description: "The string used to replace the input that matches the pattern. The default value is ''."
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
showCount: {
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
default: false,
|
|
82
|
+
description: 'Show the character count.'
|
|
83
|
+
},
|
|
84
|
+
size: sizeSmallMiddleLarge,
|
|
85
|
+
suffix,
|
|
86
|
+
suffixIcon: webIcon,
|
|
87
|
+
theme,
|
|
88
|
+
title: inputTitle,
|
|
89
|
+
type: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
enum: [
|
|
92
|
+
'text',
|
|
93
|
+
'number',
|
|
94
|
+
'password',
|
|
95
|
+
'tel',
|
|
96
|
+
'email',
|
|
97
|
+
'url'
|
|
98
|
+
],
|
|
99
|
+
default: 'text',
|
|
100
|
+
description: 'The type of input. On mobile it picks the keyboard: email, phone, URL or numeric keys, or a hidden password entry.'
|
|
101
|
+
},
|
|
102
|
+
variant: {
|
|
103
|
+
...variant,
|
|
104
|
+
enum: [
|
|
105
|
+
...variant.enum,
|
|
106
|
+
'search',
|
|
107
|
+
'row'
|
|
108
|
+
],
|
|
109
|
+
description: `${variant.description} \`search\` (mobile only) is the iOS search field: a rounded fill with a magnifying glass, a clear button while it has text, the Search key, and Cancel while it is focused. Its placeholder defaults to "Search". \`row\` (mobile only) is an iOS Settings-style row for an insetGrouped List or a Card with \`padding: none\`: the title at the left in Body and the one-line text right-aligned in the secondary label colour (its placeholder defaults to "Not set"), at the height and padding of a Selector menu row. Pressing the row focuses the field; \`allowClear\` shows the clear button while it is focused.`
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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 getIosTextStyle from '../../typography/getIosTextStyle.js';
|
|
17
|
+
import getTextStyle from '../../typography/getTextStyle.js';
|
|
18
|
+
import meta from './meta.js';
|
|
19
|
+
import TITLE_LEVEL_STYLES from '../../typography/TITLE_LEVEL_STYLES.js';
|
|
20
|
+
import TypographyText from '../../typography/TypographyText.js';
|
|
21
|
+
import useComponentTokens from '../../useComponentTokens.js';
|
|
22
|
+
// A heading in the iOS text style of its level (or its own textStyle), in the label colour, with
|
|
23
|
+
// a third of an em below it. The block's own theme can still set the level's antd heading size.
|
|
24
|
+
// A screen reader reads it as a header.
|
|
25
|
+
function Title({ blockId, methods, properties, styles = {} }) {
|
|
26
|
+
const { tokens } = useComponentTokens(properties.theme);
|
|
27
|
+
const level = properties.level ?? 1;
|
|
28
|
+
const textStyle = getIosTextStyle({
|
|
29
|
+
textStyle: properties.textStyle ?? TITLE_LEVEL_STYLES[level],
|
|
30
|
+
tokens
|
|
31
|
+
});
|
|
32
|
+
const fontSize = properties.theme?.[`fontSizeHeading${level}`] ?? textStyle.fontSize;
|
|
33
|
+
const baseStyle = {
|
|
34
|
+
...textStyle,
|
|
35
|
+
fontSize,
|
|
36
|
+
lineHeight: fontSize * textStyle.lineHeight / textStyle.fontSize
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/ React.createElement(TypographyText, {
|
|
39
|
+
accessibilityRole: "header",
|
|
40
|
+
blockId: blockId,
|
|
41
|
+
linkStyle: [
|
|
42
|
+
getIosTextStyle({
|
|
43
|
+
color: tokens.colorTint,
|
|
44
|
+
textStyle: 'body',
|
|
45
|
+
tokens
|
|
46
|
+
}),
|
|
47
|
+
styles.actions
|
|
48
|
+
],
|
|
49
|
+
methods: methods,
|
|
50
|
+
properties: properties,
|
|
51
|
+
style: [
|
|
52
|
+
getTextStyle({
|
|
53
|
+
baseStyle,
|
|
54
|
+
properties,
|
|
55
|
+
tokens
|
|
56
|
+
}),
|
|
57
|
+
styles.element
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
Title.meta = meta;
|
|
62
|
+
export default Title;
|