@lowdefy/blocks-native 0.0.0-experimental-20261019052246
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 +10 -0
- package/dist/blocks/ActivityTimeline/ActivityTimeline.js +477 -0
- package/dist/blocks/ActivityTimeline/CommentBody.js +174 -0
- package/dist/blocks/ActivityTimeline/CommentItem.js +300 -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 +159 -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 +314 -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 +49 -0
- package/dist/blocks/Avatar/AvatarCircle.js +111 -0
- package/dist/blocks/Avatar/AvatarPhoto.js +70 -0
- package/dist/blocks/Avatar/AvatarStack.js +87 -0
- package/dist/blocks/Avatar/getAvatarColor.js +84 -0
- package/dist/blocks/Avatar/getAvatarImage.js +95 -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 +311 -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 +501 -0
- package/dist/blocks/Composer/MentionTextInput.js +91 -0
- package/dist/blocks/Composer/SuggestionList.js +163 -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/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 +418 -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/ListItem/showContextMenuAlert.js +36 -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 +42 -0
- package/dist/blocks/Markdown/MarkdownCode.js +67 -0
- package/dist/blocks/Markdown/MarkdownContent.js +101 -0
- package/dist/blocks/Markdown/MarkdownList.js +97 -0
- package/dist/blocks/Markdown/MarkdownListContext.js +22 -0
- package/dist/blocks/Markdown/MarkdownRenderer.js +223 -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 +50 -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 +288 -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/Screen/meta.js +197 -0
- package/dist/blocks/SegmentedControl/SegmentedControl.js +75 -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 +120 -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 +52 -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/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 +83 -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 +48 -0
- package/dist/dictation.js +17 -0
- package/dist/htmlToText.js +32 -0
- package/dist/metas.js +49 -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/shared/ClearButton.js +53 -0
- package/dist/shared/CountText.js +38 -0
- package/dist/shared/NativeMenu.js +66 -0
- package/dist/shared/OptionGlyph.js +58 -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 +292 -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 +17 -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 -0
|
@@ -0,0 +1,295 @@
|
|
|
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 textStyle from '../../schemas/textStyle.js';
|
|
16
|
+
export default {
|
|
17
|
+
category: 'display',
|
|
18
|
+
icons: [],
|
|
19
|
+
valueType: null,
|
|
20
|
+
cssKeys: {
|
|
21
|
+
element: 'The Paragraph element.',
|
|
22
|
+
copyableIcon: 'The copyable icon in the Paragraph. Not drawn on mobile.',
|
|
23
|
+
actions: 'The expand button next to the text.'
|
|
24
|
+
},
|
|
25
|
+
events: {
|
|
26
|
+
onExpand: {
|
|
27
|
+
description: 'Trigger action when the ellipsis expand or collapse button is clicked.',
|
|
28
|
+
event: {
|
|
29
|
+
expanded: 'True when the text was expanded, false when it was collapsed.'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onCopy: 'Trigger action when copy text is clicked. Never fires on mobile.',
|
|
33
|
+
onTextSelection: 'Trigger action when text is selected and pass selected text to the event object. Never fires on mobile.'
|
|
34
|
+
},
|
|
35
|
+
properties: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
additionalProperties: false,
|
|
38
|
+
properties: {
|
|
39
|
+
actions: {
|
|
40
|
+
nativeIgnored: true,
|
|
41
|
+
type: 'object',
|
|
42
|
+
additionalProperties: false,
|
|
43
|
+
description: 'Configure the bar of action buttons, such as copy and expand. Ignored on mobile.',
|
|
44
|
+
properties: {
|
|
45
|
+
placement: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
enum: [
|
|
48
|
+
'start',
|
|
49
|
+
'end'
|
|
50
|
+
],
|
|
51
|
+
default: 'end',
|
|
52
|
+
description: 'Place the action buttons before or after the text.'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
code: {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false,
|
|
59
|
+
description: 'Apply code style.'
|
|
60
|
+
},
|
|
61
|
+
content: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'Paragraph text content - supports html. On mobile, tags are removed and the text is shown plain.',
|
|
64
|
+
docs: {
|
|
65
|
+
displayType: 'text-area'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
copyable: {
|
|
69
|
+
nativeIgnored: true,
|
|
70
|
+
description: 'Provide copy text button. Ignored on mobile.',
|
|
71
|
+
default: false,
|
|
72
|
+
oneOf: [
|
|
73
|
+
{
|
|
74
|
+
type: 'boolean'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
type: 'object',
|
|
78
|
+
additionalProperties: false,
|
|
79
|
+
properties: {
|
|
80
|
+
text: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'Paragraph text to copy when clicked.'
|
|
83
|
+
},
|
|
84
|
+
icon: {
|
|
85
|
+
type: [
|
|
86
|
+
'string',
|
|
87
|
+
'object',
|
|
88
|
+
'array'
|
|
89
|
+
],
|
|
90
|
+
description: 'Copy icon, can be an array or two icons for before and after clicked.',
|
|
91
|
+
docs: {
|
|
92
|
+
displayType: 'icon'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
tooltips: {
|
|
96
|
+
type: [
|
|
97
|
+
'string',
|
|
98
|
+
'array'
|
|
99
|
+
],
|
|
100
|
+
description: 'Tooltip text, can be an array or two strings for before and after clicked.',
|
|
101
|
+
docs: {
|
|
102
|
+
displayType: 'string'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
delete: {
|
|
110
|
+
type: 'boolean',
|
|
111
|
+
default: false,
|
|
112
|
+
description: 'Apply deleted (strikethrough) style.'
|
|
113
|
+
},
|
|
114
|
+
disabled: {
|
|
115
|
+
type: 'boolean',
|
|
116
|
+
default: false,
|
|
117
|
+
description: 'Apply disabled style.'
|
|
118
|
+
},
|
|
119
|
+
ellipsis: {
|
|
120
|
+
default: false,
|
|
121
|
+
oneOf: [
|
|
122
|
+
{
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
description: 'Display ellipsis when text overflows a single line.'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
type: 'object',
|
|
128
|
+
additionalProperties: false,
|
|
129
|
+
properties: {
|
|
130
|
+
rows: {
|
|
131
|
+
type: 'number',
|
|
132
|
+
description: 'Max rows of content.'
|
|
133
|
+
},
|
|
134
|
+
expandable: {
|
|
135
|
+
type: [
|
|
136
|
+
'boolean',
|
|
137
|
+
'string'
|
|
138
|
+
],
|
|
139
|
+
enum: [
|
|
140
|
+
true,
|
|
141
|
+
false,
|
|
142
|
+
'collapsible'
|
|
143
|
+
],
|
|
144
|
+
description: "Show a button that expands the hidden content. Set to 'collapsible' to also allow collapsing it again."
|
|
145
|
+
},
|
|
146
|
+
defaultExpanded: {
|
|
147
|
+
type: 'boolean',
|
|
148
|
+
default: false,
|
|
149
|
+
description: 'Start with the content expanded.'
|
|
150
|
+
},
|
|
151
|
+
suffix: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
description: 'Suffix of ellipses content.'
|
|
154
|
+
},
|
|
155
|
+
symbol: {
|
|
156
|
+
type: [
|
|
157
|
+
'string',
|
|
158
|
+
'array'
|
|
159
|
+
],
|
|
160
|
+
items: {
|
|
161
|
+
type: 'string'
|
|
162
|
+
},
|
|
163
|
+
description: 'Text of the expand button, or an array of two strings for the expand and collapse buttons.',
|
|
164
|
+
docs: {
|
|
165
|
+
displayType: 'string'
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
tooltip: {
|
|
169
|
+
type: [
|
|
170
|
+
'boolean',
|
|
171
|
+
'string'
|
|
172
|
+
],
|
|
173
|
+
nativeIgnored: true,
|
|
174
|
+
description: 'Show a tooltip when the text is truncated. true shows the full text, a string shows that text. Ignored on mobile.',
|
|
175
|
+
docs: {
|
|
176
|
+
displayType: 'string'
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
italic: {
|
|
184
|
+
type: 'boolean',
|
|
185
|
+
default: false,
|
|
186
|
+
description: 'Apply italic style.'
|
|
187
|
+
},
|
|
188
|
+
keyboard: {
|
|
189
|
+
type: 'boolean',
|
|
190
|
+
default: false,
|
|
191
|
+
description: 'Apply keyboard key style.'
|
|
192
|
+
},
|
|
193
|
+
mark: {
|
|
194
|
+
type: 'boolean',
|
|
195
|
+
default: false,
|
|
196
|
+
description: 'Apply marked (highlighted) style.'
|
|
197
|
+
},
|
|
198
|
+
strong: {
|
|
199
|
+
type: 'boolean',
|
|
200
|
+
default: false,
|
|
201
|
+
description: 'Apply strong (bold) style.'
|
|
202
|
+
},
|
|
203
|
+
type: {
|
|
204
|
+
type: 'string',
|
|
205
|
+
default: 'default',
|
|
206
|
+
enum: [
|
|
207
|
+
'success',
|
|
208
|
+
'default',
|
|
209
|
+
'secondary',
|
|
210
|
+
'warning',
|
|
211
|
+
'danger'
|
|
212
|
+
],
|
|
213
|
+
description: "Additional types. Don't specify for default."
|
|
214
|
+
},
|
|
215
|
+
underline: {
|
|
216
|
+
type: 'boolean',
|
|
217
|
+
default: false,
|
|
218
|
+
description: 'Apply underline style.'
|
|
219
|
+
},
|
|
220
|
+
textStyle: {
|
|
221
|
+
...textStyle,
|
|
222
|
+
default: 'body'
|
|
223
|
+
},
|
|
224
|
+
theme: {
|
|
225
|
+
type: 'object',
|
|
226
|
+
description: 'Antd design token overrides for this block. See <a href="https://ant.design/components/overview#design-token">antd design tokens</a>.',
|
|
227
|
+
docs: {
|
|
228
|
+
displayType: 'yaml',
|
|
229
|
+
link: 'https://ant.design/components/typography#design-token'
|
|
230
|
+
},
|
|
231
|
+
properties: {
|
|
232
|
+
titleMarginBottom: {
|
|
233
|
+
type: [
|
|
234
|
+
'string',
|
|
235
|
+
'number'
|
|
236
|
+
],
|
|
237
|
+
default: '0.5em',
|
|
238
|
+
description: 'Margin bottom of title, as a CSS length or a number of pixels.',
|
|
239
|
+
docs: {
|
|
240
|
+
displayType: 'string'
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
titleMarginTop: {
|
|
244
|
+
type: [
|
|
245
|
+
'string',
|
|
246
|
+
'number'
|
|
247
|
+
],
|
|
248
|
+
default: '1.2em',
|
|
249
|
+
description: 'Margin top of title, as a CSS length or a number of pixels.',
|
|
250
|
+
docs: {
|
|
251
|
+
displayType: 'string'
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
fontWeightStrong: {
|
|
255
|
+
type: 'number',
|
|
256
|
+
default: 600,
|
|
257
|
+
description: 'Font weight for strong text.'
|
|
258
|
+
},
|
|
259
|
+
fontFamilyCode: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
description: 'Font family for code style text.'
|
|
262
|
+
},
|
|
263
|
+
colorText: {
|
|
264
|
+
type: 'string',
|
|
265
|
+
description: 'Default text color.'
|
|
266
|
+
},
|
|
267
|
+
colorTextSecondary: {
|
|
268
|
+
type: 'string',
|
|
269
|
+
description: 'Secondary text color.'
|
|
270
|
+
},
|
|
271
|
+
colorSuccess: {
|
|
272
|
+
type: 'string',
|
|
273
|
+
description: 'Success text color.'
|
|
274
|
+
},
|
|
275
|
+
colorWarning: {
|
|
276
|
+
type: 'string',
|
|
277
|
+
description: 'Warning text color.'
|
|
278
|
+
},
|
|
279
|
+
colorError: {
|
|
280
|
+
type: 'string',
|
|
281
|
+
description: 'Danger/error text color.'
|
|
282
|
+
},
|
|
283
|
+
colorTextDisabled: {
|
|
284
|
+
type: 'string',
|
|
285
|
+
description: 'Disabled text color.'
|
|
286
|
+
},
|
|
287
|
+
colorLink: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
description: 'Link color.'
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
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
|
+
*/ // The mobile page type. Its component lives in @lowdefy/client-native, which owns how a page meets
|
|
16
|
+
// the shell's router; this meta lets the build accept mobile pages of type Screen.
|
|
17
|
+
export default {
|
|
18
|
+
category: 'container',
|
|
19
|
+
icons: [],
|
|
20
|
+
valueType: null,
|
|
21
|
+
slots: {
|
|
22
|
+
content: 'The page content, in a scroll view.',
|
|
23
|
+
headerBackdrop: "Blocks drawn in the space above the content, behind the large title and the translucent bar, such as art beside the title. Their box's bottom edge sits at the top of the content, so they scroll away with the title; a negative bottom margin lets a block reach down beside the first content blocks. They take no room in the content and never take touches. Align a block with its own style, such as `alignSelf: flex-end` for the right edge.",
|
|
24
|
+
headerBottom: 'Blocks pinned directly under the screen header (under the large title or the search field), such as a ChipSelector or a SegmentedControl, which stay in view as the page scrolls. Once the page scrolls they take the screen background and a hairline under them. They sit at the 16pt screen inset; a ChipSelector runs edge to edge.',
|
|
25
|
+
headerLeft: 'Blocks drawn at the left of the screen header, at their natural size. Prefer `headerActions` for icon buttons.',
|
|
26
|
+
headerRight: 'Blocks drawn at the right of the screen header, at their natural size. Prefer `headerActions` for icon buttons.',
|
|
27
|
+
footer: 'Blocks pinned to the bottom of the screen, outside the scroll view, above the tab bar and the keyboard, on the bar background with a hairline above. For a Composer, or actions that stay in reach.'
|
|
28
|
+
},
|
|
29
|
+
events: {
|
|
30
|
+
onFocus: 'Trigger actions each time the screen becomes the one shown: on its first show (after onMount), when its tab is picked again, and when the screen above it is closed.',
|
|
31
|
+
onRefresh: 'Turns on pull-to-refresh. Trigger actions when the page is pulled down; the spinner shows until they finish.',
|
|
32
|
+
onSearch: 'Trigger actions when the search is submitted in the header search bar. `_event: value` is the search text.',
|
|
33
|
+
onSearchChange: 'Trigger actions when the header search text changes, once typing pauses (`headerSearch.debounce`), and with an empty value when the search is cancelled. `_event: value` is the search text.',
|
|
34
|
+
onHeaderAction: 'Trigger actions when a header action without its own `event` is pressed, or an item of its menu is picked. `_event: id` is the action id, or the picked item id.'
|
|
35
|
+
},
|
|
36
|
+
properties: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
properties: {
|
|
40
|
+
title: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'The screen title, shown in the header.'
|
|
43
|
+
},
|
|
44
|
+
largeTitle: {
|
|
45
|
+
type: 'boolean',
|
|
46
|
+
default: false,
|
|
47
|
+
description: 'Show the title as an iOS large title, which collapses into the header as the page scrolls. Other platforms show the standard title.'
|
|
48
|
+
},
|
|
49
|
+
backgroundTint: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
required: [
|
|
53
|
+
'color'
|
|
54
|
+
],
|
|
55
|
+
description: "A soft wash of colour at the top of the screen, such as a record's space colour: a vertical gradient from the colour at the top (35% in light mode, 45% in dark mode) easing to clear at `height` of the screen height. It is fixed to the screen, behind the large title, the translucent navigation bar and the content, and continues behind a pinned `headerBottom`. A change of colour cross-fades over 250ms.",
|
|
56
|
+
properties: {
|
|
57
|
+
color: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'The tint colour: a hex or CSS colour, a theme token such as `colorPrimary`, or a palette hue such as `blue`.'
|
|
60
|
+
},
|
|
61
|
+
colorDark: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'The tint colour in dark mode. Defaults to `color`.'
|
|
64
|
+
},
|
|
65
|
+
height: {
|
|
66
|
+
type: 'number',
|
|
67
|
+
minimum: 0,
|
|
68
|
+
maximum: 1,
|
|
69
|
+
default: 0.15,
|
|
70
|
+
description: 'Where the tint has faded to clear, as a fraction of the screen height from the top.'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
presentation: {
|
|
75
|
+
type: 'string',
|
|
76
|
+
enum: [
|
|
77
|
+
'card',
|
|
78
|
+
'modal',
|
|
79
|
+
'sheet'
|
|
80
|
+
],
|
|
81
|
+
default: 'card',
|
|
82
|
+
description: 'How the screen is presented when opened.'
|
|
83
|
+
},
|
|
84
|
+
headerSearch: {
|
|
85
|
+
type: 'object',
|
|
86
|
+
additionalProperties: false,
|
|
87
|
+
description: 'A native search bar in the header (under a large title on iOS). Its text reaches the `onSearchChange` and `onSearch` events.',
|
|
88
|
+
properties: {
|
|
89
|
+
placeholder: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: 'Text shown in the empty search field.'
|
|
92
|
+
},
|
|
93
|
+
autoFocus: {
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
default: false,
|
|
96
|
+
description: 'Focus the search field, with the keyboard up, each time the screen is shown. For a search page, such as the page of a `role: search` tab.'
|
|
97
|
+
},
|
|
98
|
+
debounce: {
|
|
99
|
+
type: 'number',
|
|
100
|
+
default: 300,
|
|
101
|
+
description: 'Milliseconds the text must stay unchanged before `onSearchChange` fires.'
|
|
102
|
+
},
|
|
103
|
+
hideWhenScrolling: {
|
|
104
|
+
type: 'boolean',
|
|
105
|
+
default: false,
|
|
106
|
+
description: 'Hide the search bar as the page scrolls (iOS).'
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
headerActions: {
|
|
111
|
+
type: 'array',
|
|
112
|
+
description: 'Icon buttons in the header, at their natural size. On iOS each is a native bar button drawing the icon as an SF Symbol (`sfSymbol`, or the symbol for the Lucide or semantic name); an icon with no symbol, and every icon elsewhere, draws as its Lucide icon.',
|
|
113
|
+
items: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
additionalProperties: false,
|
|
116
|
+
required: [
|
|
117
|
+
'id',
|
|
118
|
+
'icon'
|
|
119
|
+
],
|
|
120
|
+
properties: {
|
|
121
|
+
id: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'The action id, the `_event: id` of the event it triggers.'
|
|
124
|
+
},
|
|
125
|
+
icon: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'Icon name: a semantic name like `edit`, a Lucide icon name like `Pencil`, or a set-qualified name like `tabler:Pencil`.'
|
|
128
|
+
},
|
|
129
|
+
sfSymbol: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'The SF Symbol iOS draws, such as `square.and.pencil`. Defaults to the symbol mapped from `icon`.'
|
|
132
|
+
},
|
|
133
|
+
title: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'The label screen readers read and iOS shows in a long press. Defaults to a title from the icon name.'
|
|
136
|
+
},
|
|
137
|
+
placement: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
enum: [
|
|
140
|
+
'left',
|
|
141
|
+
'right'
|
|
142
|
+
],
|
|
143
|
+
default: 'right',
|
|
144
|
+
description: 'The side of the header the button is on.'
|
|
145
|
+
},
|
|
146
|
+
event: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
default: 'onHeaderAction',
|
|
149
|
+
description: 'The Screen event the button triggers, such as `onAdd`; list it under the Screen `events`.'
|
|
150
|
+
},
|
|
151
|
+
disabled: {
|
|
152
|
+
type: 'boolean',
|
|
153
|
+
default: false,
|
|
154
|
+
description: 'Draw the button dimmed and ignore presses.'
|
|
155
|
+
},
|
|
156
|
+
items: {
|
|
157
|
+
type: 'array',
|
|
158
|
+
description: "Make the button open a menu of these items, a native menu on iOS, such as a ⋯ menu of a detail page. Picking an item triggers the button's `event` with the item's id as `_event: id`.",
|
|
159
|
+
items: {
|
|
160
|
+
type: 'object',
|
|
161
|
+
additionalProperties: false,
|
|
162
|
+
required: [
|
|
163
|
+
'id',
|
|
164
|
+
'title'
|
|
165
|
+
],
|
|
166
|
+
properties: {
|
|
167
|
+
id: {
|
|
168
|
+
type: 'string',
|
|
169
|
+
description: 'The item id, the `_event: id` it triggers.'
|
|
170
|
+
},
|
|
171
|
+
title: {
|
|
172
|
+
type: 'string',
|
|
173
|
+
description: 'The item text.'
|
|
174
|
+
},
|
|
175
|
+
symbol: {
|
|
176
|
+
type: 'string',
|
|
177
|
+
description: 'An SF Symbol name, such as `link` or `trash`, drawn beside the item on iOS.'
|
|
178
|
+
},
|
|
179
|
+
destructive: {
|
|
180
|
+
type: 'boolean',
|
|
181
|
+
default: false,
|
|
182
|
+
description: 'Draw the item in red, for actions such as Delete.'
|
|
183
|
+
},
|
|
184
|
+
disabled: {
|
|
185
|
+
type: 'boolean',
|
|
186
|
+
default: false,
|
|
187
|
+
description: 'Show the item, dimmed.'
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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 { SegmentedControl as NativeSegmentedControl } from '@expo/ui/community/segmented-control';
|
|
18
|
+
import getOptionIndex from '../Selector/getOptionIndex.js';
|
|
19
|
+
import getOptionLabel from '../Selector/getOptionLabel.js';
|
|
20
|
+
import getOptionValue from '../Selector/getOptionValue.js';
|
|
21
|
+
import meta from './meta.js';
|
|
22
|
+
import useBlockTokens from '../../shared/useBlockTokens.js';
|
|
23
|
+
// No segment is selected while the value matches no option.
|
|
24
|
+
const NO_SEGMENT = -1;
|
|
25
|
+
/**
|
|
26
|
+
* The platform segmented control (a SwiftUI segmented Picker on iOS, Material segmented buttons
|
|
27
|
+
* on Android) as an input: one segment per option, the value is the picked option's value, as a
|
|
28
|
+
* Selector's is. It fills the width of its container.
|
|
29
|
+
*/ function SegmentedControl({ blockId, loading, methods, properties, styles = {}, value }) {
|
|
30
|
+
const { isDark, tokens } = useBlockTokens({
|
|
31
|
+
properties
|
|
32
|
+
});
|
|
33
|
+
const options = properties.options ?? [];
|
|
34
|
+
const selectedIndex = getOptionIndex({
|
|
35
|
+
options,
|
|
36
|
+
value
|
|
37
|
+
}) ?? NO_SEGMENT;
|
|
38
|
+
const disabled = loading === true || properties.disabled === true;
|
|
39
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
40
|
+
accessibilityLabel: properties.title ?? undefined,
|
|
41
|
+
style: [
|
|
42
|
+
{
|
|
43
|
+
alignSelf: 'stretch'
|
|
44
|
+
},
|
|
45
|
+
styles.element
|
|
46
|
+
]
|
|
47
|
+
}, /*#__PURE__*/ React.createElement(NativeSegmentedControl, {
|
|
48
|
+
appearance: isDark ? 'dark' : 'light',
|
|
49
|
+
enabled: !disabled,
|
|
50
|
+
onChange: ({ nativeEvent })=>{
|
|
51
|
+
const index = nativeEvent.selectedSegmentIndex;
|
|
52
|
+
if (index === selectedIndex) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const next = getOptionValue({
|
|
56
|
+
option: options[index]
|
|
57
|
+
});
|
|
58
|
+
methods.setValue(next);
|
|
59
|
+
methods.triggerEvent({
|
|
60
|
+
name: 'onChange',
|
|
61
|
+
event: {
|
|
62
|
+
value: next
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
selectedIndex: selectedIndex,
|
|
67
|
+
testID: `${blockId}_input`,
|
|
68
|
+
tintColor: tokens.colorPrimary,
|
|
69
|
+
values: options.map((option)=>getOptionLabel({
|
|
70
|
+
option
|
|
71
|
+
}))
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
SegmentedControl.meta = meta;
|
|
75
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,78 @@
|
|
|
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 { disabled, theme } from '../../schemas/inputProperties.js';
|
|
16
|
+
const primitiveOption = {
|
|
17
|
+
type: [
|
|
18
|
+
'string',
|
|
19
|
+
'number',
|
|
20
|
+
'boolean'
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
export default {
|
|
24
|
+
category: 'input',
|
|
25
|
+
icons: [],
|
|
26
|
+
valueType: 'any',
|
|
27
|
+
cssKeys: {
|
|
28
|
+
element: 'The SegmentedControl.'
|
|
29
|
+
},
|
|
30
|
+
events: {
|
|
31
|
+
onChange: {
|
|
32
|
+
description: 'Trigger actions when a segment is picked.',
|
|
33
|
+
event: {
|
|
34
|
+
value: 'The value of the picked option.'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
properties: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
properties: {
|
|
42
|
+
disabled,
|
|
43
|
+
options: {
|
|
44
|
+
description: 'The segments, in order: primitives, or objects with a label and a value. Keep labels short; two to four segments fit a phone.',
|
|
45
|
+
oneOf: [
|
|
46
|
+
{
|
|
47
|
+
type: 'array',
|
|
48
|
+
items: primitiveOption
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'array',
|
|
52
|
+
items: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
required: [
|
|
55
|
+
'value'
|
|
56
|
+
],
|
|
57
|
+
additionalProperties: false,
|
|
58
|
+
properties: {
|
|
59
|
+
label: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'Segment label, shown as plain text.'
|
|
62
|
+
},
|
|
63
|
+
value: {
|
|
64
|
+
description: 'The value the segment sets. Can be any type.'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
theme,
|
|
72
|
+
title: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'The label screen readers read for the control. Not drawn.'
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|