@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,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import icon from '../../schemas/icon.js';
|
|
16
|
+
import { theme } from '../../schemas/inputProperties.js';
|
|
17
|
+
import status from '../../schemas/status.js';
|
|
18
|
+
import tone from '../../schemas/tone.js';
|
|
19
|
+
const count = {
|
|
20
|
+
type: [
|
|
21
|
+
'number',
|
|
22
|
+
'string'
|
|
23
|
+
],
|
|
24
|
+
description: 'A count shown after the title. Defaults to the number of items with showCount.'
|
|
25
|
+
};
|
|
26
|
+
export default {
|
|
27
|
+
category: 'list',
|
|
28
|
+
icons: [],
|
|
29
|
+
valueType: 'array',
|
|
30
|
+
slots: {
|
|
31
|
+
content: 'Blocks rendered for each list item.'
|
|
32
|
+
},
|
|
33
|
+
cssKeys: {
|
|
34
|
+
element: 'The List.',
|
|
35
|
+
cell: "Each item's row: a cell of its section in an inset grouped List.",
|
|
36
|
+
sectionHeader: 'The section headers.',
|
|
37
|
+
sectionFooter: 'The section footers.'
|
|
38
|
+
},
|
|
39
|
+
events: {
|
|
40
|
+
onRefresh: 'Mobile only. Trigger actions when the List is pulled down to refresh. The refresh spinner shows while they run. Needs scroll: true.'
|
|
41
|
+
},
|
|
42
|
+
properties: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
properties: {
|
|
46
|
+
direction: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
enum: [
|
|
49
|
+
'row',
|
|
50
|
+
'column',
|
|
51
|
+
'row-reverse',
|
|
52
|
+
'column-reverse'
|
|
53
|
+
],
|
|
54
|
+
description: "List items along a 'row' or down a 'column'."
|
|
55
|
+
},
|
|
56
|
+
header: {
|
|
57
|
+
type: [
|
|
58
|
+
'string',
|
|
59
|
+
'object'
|
|
60
|
+
],
|
|
61
|
+
description: "Mobile only. The title of the List's one section, when there is no sectionKey: a string, or { title, count, status, footer }.",
|
|
62
|
+
additionalProperties: false,
|
|
63
|
+
properties: {
|
|
64
|
+
title: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
description: 'The section title.'
|
|
67
|
+
},
|
|
68
|
+
count,
|
|
69
|
+
status,
|
|
70
|
+
footer: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
description: 'Text under the section.'
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
headerVariant: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
enum: [
|
|
79
|
+
'footnote',
|
|
80
|
+
'headline'
|
|
81
|
+
],
|
|
82
|
+
description: "Mobile only. The section header style: 'footnote' (small, upper case, secondary, as iOS settings) or 'headline' (17pt semibold). Defaults to footnote for insetGrouped and headline for plain."
|
|
83
|
+
},
|
|
84
|
+
scroll: {
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
description: 'Let the List scroll itself, in place of scrolling with the page. Give it a height in its style.'
|
|
87
|
+
},
|
|
88
|
+
sectionKey: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
description: "Mobile only. The path in each item of its section's key. Without sections, items with the same key next to each other form a section titled by the key. With sections, every item joins its key's section."
|
|
91
|
+
},
|
|
92
|
+
sections: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
description: 'Mobile only. With sectionKey: the sections in the order to show them, with their titles, counts, glyphs and footers. Items are grouped by key whatever their order in the list. Keys not listed follow in the order they appear, titled by the key. Sections with no items are hidden.',
|
|
95
|
+
items: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
required: [
|
|
98
|
+
'key'
|
|
99
|
+
],
|
|
100
|
+
additionalProperties: false,
|
|
101
|
+
properties: {
|
|
102
|
+
key: {
|
|
103
|
+
type: [
|
|
104
|
+
'string',
|
|
105
|
+
'number',
|
|
106
|
+
'boolean'
|
|
107
|
+
],
|
|
108
|
+
description: 'The sectionKey value of the items in this section.'
|
|
109
|
+
},
|
|
110
|
+
title: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'The section title. A section without one has no header.'
|
|
113
|
+
},
|
|
114
|
+
count,
|
|
115
|
+
status: {
|
|
116
|
+
...status,
|
|
117
|
+
description: 'A status glyph or stage dot before the title: a StatusIcon name, or { name, color }.'
|
|
118
|
+
},
|
|
119
|
+
footer: {
|
|
120
|
+
type: 'string',
|
|
121
|
+
description: 'Text under the section.'
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
showCount: {
|
|
127
|
+
type: 'boolean',
|
|
128
|
+
default: false,
|
|
129
|
+
description: "Mobile only. Show each section's number of items after its title."
|
|
130
|
+
},
|
|
131
|
+
stickyHeaders: {
|
|
132
|
+
type: 'boolean',
|
|
133
|
+
description: 'Mobile only. Keep the section header at the top while its section scrolls under it. Defaults to true for plain and false for insetGrouped. Needs scroll: true.'
|
|
134
|
+
},
|
|
135
|
+
swipeActions: {
|
|
136
|
+
type: 'array',
|
|
137
|
+
description: 'Mobile only. Buttons an item shows when it is swiped to the left. Each fires the List event it names, with the item index as `_event: index`. For actions on one row, use the ListItem swipeActions.',
|
|
138
|
+
items: {
|
|
139
|
+
type: 'object',
|
|
140
|
+
required: [
|
|
141
|
+
'title',
|
|
142
|
+
'event'
|
|
143
|
+
],
|
|
144
|
+
additionalProperties: false,
|
|
145
|
+
properties: {
|
|
146
|
+
title: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
description: 'The button title.'
|
|
149
|
+
},
|
|
150
|
+
event: {
|
|
151
|
+
type: 'string',
|
|
152
|
+
description: 'The name of the List event the button fires, such as onDelete.'
|
|
153
|
+
},
|
|
154
|
+
color: {
|
|
155
|
+
type: 'string',
|
|
156
|
+
description: 'The button colour. Defaults to the primary colour.'
|
|
157
|
+
},
|
|
158
|
+
danger: {
|
|
159
|
+
type: 'boolean',
|
|
160
|
+
default: false,
|
|
161
|
+
description: "Draw the button in the danger colour. The same as tone: 'danger'."
|
|
162
|
+
},
|
|
163
|
+
icon,
|
|
164
|
+
tone
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
theme,
|
|
169
|
+
variant: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
enum: [
|
|
172
|
+
'insetGrouped',
|
|
173
|
+
'plain'
|
|
174
|
+
],
|
|
175
|
+
default: 'insetGrouped',
|
|
176
|
+
description: "Mobile only. 'insetGrouped' draws each section as a rounded group of cells, inset from the screen edges on the grouped background. 'plain' draws edge to edge rows with sticky section headers. A row List is always plain."
|
|
177
|
+
},
|
|
178
|
+
wrap: {
|
|
179
|
+
type: 'string',
|
|
180
|
+
enum: [
|
|
181
|
+
'wrap',
|
|
182
|
+
'nowrap',
|
|
183
|
+
'wrap-reverse'
|
|
184
|
+
],
|
|
185
|
+
nativeIgnored: true,
|
|
186
|
+
description: 'Ignored on mobile: list items do not wrap.'
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React, { useContext, useLayoutEffect } from 'react';
|
|
16
|
+
import { Platform, Pressable, Text, View } from 'react-native';
|
|
17
|
+
import { resolveColor } from '@lowdefy/client-native';
|
|
18
|
+
import { type } from '@lowdefy/helpers';
|
|
19
|
+
import AvatarCircle from '../Avatar/AvatarCircle.js';
|
|
20
|
+
import AvatarStack from '../Avatar/AvatarStack.js';
|
|
21
|
+
import getListItemParts, { GAP, ICON_BOX, ROW_PADDING } from './getListItemParts.js';
|
|
22
|
+
import getSemanticColors from '../../shared/getSemanticColors.js';
|
|
23
|
+
import iosTextStyles from '../../shared/iosTextStyles.js';
|
|
24
|
+
import ListItemContextMenu from './ListItemContextMenu.js';
|
|
25
|
+
import ListRowContext from '../List/ListRowContext.js';
|
|
26
|
+
import meta from './meta.js';
|
|
27
|
+
import showContextMenuAlert from './showContextMenuAlert.js';
|
|
28
|
+
import StatusMark from '../StatusIcon/StatusMark.js';
|
|
29
|
+
import SwipeableRow from '../../shared/SwipeableRow.js';
|
|
30
|
+
import SystemIcon from '../../shared/SystemIcon.js';
|
|
31
|
+
import useComponentTokens from '../../useComponentTokens.js';
|
|
32
|
+
const FULL_SWIPE = {
|
|
33
|
+
leading: {
|
|
34
|
+
leading: true
|
|
35
|
+
},
|
|
36
|
+
trailing: {
|
|
37
|
+
trailing: true
|
|
38
|
+
},
|
|
39
|
+
both: {
|
|
40
|
+
leading: true,
|
|
41
|
+
trailing: true
|
|
42
|
+
},
|
|
43
|
+
none: {}
|
|
44
|
+
};
|
|
45
|
+
function Leading({ blockId, colors, components, content, isDark, leading, styles, tokens }) {
|
|
46
|
+
if (!type.isNone(content.leading)) {
|
|
47
|
+
return content.leading();
|
|
48
|
+
}
|
|
49
|
+
if (leading === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
switch(leading.kind){
|
|
53
|
+
case 'status':
|
|
54
|
+
return /*#__PURE__*/ React.createElement(StatusMark, {
|
|
55
|
+
status: leading.status,
|
|
56
|
+
testID: `${blockId}_status`,
|
|
57
|
+
tokens: tokens
|
|
58
|
+
});
|
|
59
|
+
case 'avatar':
|
|
60
|
+
return /*#__PURE__*/ React.createElement(AvatarCircle, {
|
|
61
|
+
avatar: leading.avatar,
|
|
62
|
+
isDark: isDark,
|
|
63
|
+
size: leading.size,
|
|
64
|
+
style: styles.avatar,
|
|
65
|
+
testID: `${blockId}_avatar`,
|
|
66
|
+
tokens: tokens
|
|
67
|
+
});
|
|
68
|
+
default:
|
|
69
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
70
|
+
style: {
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
width: ICON_BOX
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/ React.createElement(components.Icon, {
|
|
75
|
+
properties: leading.icon,
|
|
76
|
+
styles: {
|
|
77
|
+
element: [
|
|
78
|
+
{
|
|
79
|
+
color: colors.secondaryLabel,
|
|
80
|
+
fontSize: 22
|
|
81
|
+
},
|
|
82
|
+
styles.icon
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
testID: `${blockId}_icon`
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// The trailing parts keep their natural width and the title column takes what is left, shrinking
|
|
90
|
+
// and ending its title with an ellipsis, so a long title never pushes a badge off the row.
|
|
91
|
+
const TITLE_COLUMN = {
|
|
92
|
+
flexBasis: 0,
|
|
93
|
+
flexGrow: 1,
|
|
94
|
+
flexShrink: 1,
|
|
95
|
+
gap: 1,
|
|
96
|
+
minWidth: 0
|
|
97
|
+
};
|
|
98
|
+
const TRAILING = {
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
flexDirection: 'row',
|
|
101
|
+
flexShrink: 0,
|
|
102
|
+
gap: 8
|
|
103
|
+
};
|
|
104
|
+
function Trailing({ blockId, colors, components, content, isDark, styles, tokens, trailing }) {
|
|
105
|
+
const parts = [];
|
|
106
|
+
if (!type.isNone(content.trailing)) {
|
|
107
|
+
parts.push(/*#__PURE__*/ React.createElement(React.Fragment, {
|
|
108
|
+
key: "slot"
|
|
109
|
+
}, content.trailing()));
|
|
110
|
+
}
|
|
111
|
+
trailing.badges.forEach((badge, index)=>{
|
|
112
|
+
const color = type.isString(badge.color) ? resolveColor({
|
|
113
|
+
color: badge.color,
|
|
114
|
+
tokens
|
|
115
|
+
}) : colors.secondaryLabel;
|
|
116
|
+
parts.push(/*#__PURE__*/ React.createElement(View, {
|
|
117
|
+
key: `badge-${index}`,
|
|
118
|
+
style: {
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
flexShrink: 0,
|
|
122
|
+
gap: 3
|
|
123
|
+
},
|
|
124
|
+
testID: `${blockId}_badge_${index}`
|
|
125
|
+
}, type.isNone(badge.icon) ? null : /*#__PURE__*/ React.createElement(components.Icon, {
|
|
126
|
+
properties: badge.icon,
|
|
127
|
+
styles: {
|
|
128
|
+
element: {
|
|
129
|
+
color,
|
|
130
|
+
fontSize: 14
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}), type.isNone(badge.text) ? null : /*#__PURE__*/ React.createElement(Text, {
|
|
134
|
+
style: [
|
|
135
|
+
iosTextStyles.footnote,
|
|
136
|
+
{
|
|
137
|
+
color,
|
|
138
|
+
fontVariant: [
|
|
139
|
+
'tabular-nums'
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}, `${badge.text}`)));
|
|
144
|
+
});
|
|
145
|
+
if (type.isString(trailing.text)) {
|
|
146
|
+
parts.push(/*#__PURE__*/ React.createElement(Text, {
|
|
147
|
+
key: "text",
|
|
148
|
+
numberOfLines: 1,
|
|
149
|
+
style: [
|
|
150
|
+
iosTextStyles.subheadline,
|
|
151
|
+
{
|
|
152
|
+
color: type.isString(trailing.textColor) ? resolveColor({
|
|
153
|
+
color: trailing.textColor,
|
|
154
|
+
tokens
|
|
155
|
+
}) : colors.secondaryLabel,
|
|
156
|
+
fontVariant: [
|
|
157
|
+
'tabular-nums'
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
styles.extra
|
|
161
|
+
]
|
|
162
|
+
}, trailing.text));
|
|
163
|
+
}
|
|
164
|
+
if (!type.isNone(trailing.status)) {
|
|
165
|
+
parts.push(/*#__PURE__*/ React.createElement(StatusMark, {
|
|
166
|
+
key: "status",
|
|
167
|
+
status: trailing.status,
|
|
168
|
+
testID: `${blockId}_trailing_status`,
|
|
169
|
+
tokens: tokens
|
|
170
|
+
}));
|
|
171
|
+
}
|
|
172
|
+
if (!type.isNone(trailing.icon)) {
|
|
173
|
+
parts.push(/*#__PURE__*/ React.createElement(components.Icon, {
|
|
174
|
+
key: "icon",
|
|
175
|
+
properties: trailing.icon,
|
|
176
|
+
styles: {
|
|
177
|
+
element: {
|
|
178
|
+
color: colors.secondaryLabel,
|
|
179
|
+
fontSize: 17
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
testID: `${blockId}_trailing_icon`
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
if (type.isArray(trailing.avatars)) {
|
|
186
|
+
parts.push(/*#__PURE__*/ React.createElement(AvatarStack, {
|
|
187
|
+
avatars: trailing.avatars,
|
|
188
|
+
isDark: isDark,
|
|
189
|
+
key: "avatars",
|
|
190
|
+
max: 3,
|
|
191
|
+
size: 20,
|
|
192
|
+
testID: `${blockId}_trailing_avatars`,
|
|
193
|
+
tokens: tokens
|
|
194
|
+
}));
|
|
195
|
+
} else if (type.isObject(trailing.avatar)) {
|
|
196
|
+
parts.push(/*#__PURE__*/ React.createElement(AvatarCircle, {
|
|
197
|
+
avatar: trailing.avatar,
|
|
198
|
+
isDark: isDark,
|
|
199
|
+
key: "avatar",
|
|
200
|
+
size: trailing.avatar.size ?? 20,
|
|
201
|
+
testID: `${blockId}_trailing_avatar`,
|
|
202
|
+
tokens: tokens
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
if (parts.length === 0) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
return /*#__PURE__*/ React.createElement(View, {
|
|
209
|
+
style: TRAILING,
|
|
210
|
+
testID: `${blockId}_trailing`
|
|
211
|
+
}, parts);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* An iOS list row: a leading status glyph, avatar or icon (or `leading` slot), a title of one or
|
|
215
|
+
* two lines and a subtitle of meta, trailing meta text, badges, a glyph or avatars (or `trailing`
|
|
216
|
+
* slot), and a chevron when it has onClick, or the iOS checkmark in the tint colour where the
|
|
217
|
+
* chevron goes with `trailing.check` (a picked row of a multi-select list, which has no chevron).
|
|
218
|
+
* It highlights while pressed, has swipe actions (`onSwipeAction`) and a long-press context menu
|
|
219
|
+
* (`onContextMenu`), and in a List moves the row's separator in to its title.
|
|
220
|
+
*
|
|
221
|
+
* The title is a Headline when the row has a subtitle and Body when it stands alone, as iOS sets
|
|
222
|
+
* a two-line cell and a settings row.
|
|
223
|
+
*/ function ListItem({ blockId, components, content, events, methods, properties, styles }) {
|
|
224
|
+
const { isDark, tokens } = useComponentTokens(properties.theme);
|
|
225
|
+
const colors = getSemanticColors({
|
|
226
|
+
tokens
|
|
227
|
+
});
|
|
228
|
+
const row = useContext(ListRowContext);
|
|
229
|
+
const parts = getListItemParts({
|
|
230
|
+
properties
|
|
231
|
+
});
|
|
232
|
+
const hasLeadingSlot = !type.isNone(content.leading);
|
|
233
|
+
useLayoutEffect(()=>{
|
|
234
|
+
if (row !== null && !hasLeadingSlot) {
|
|
235
|
+
row.setSeparatorInset(parts.separatorInset);
|
|
236
|
+
}
|
|
237
|
+
}, [
|
|
238
|
+
row,
|
|
239
|
+
hasLeadingSlot,
|
|
240
|
+
parts.separatorInset
|
|
241
|
+
]);
|
|
242
|
+
const pressable = !type.isNone(events.onClick);
|
|
243
|
+
const disabled = properties.disabled === true;
|
|
244
|
+
const checked = parts.trailing.check;
|
|
245
|
+
const showChevron = properties.chevron ?? (pressable && !checked);
|
|
246
|
+
const title = properties.title ?? '';
|
|
247
|
+
const hasSubtitle = type.isString(parts.subtitle);
|
|
248
|
+
const swipeActions = properties.swipeActions ?? {};
|
|
249
|
+
const leadingActions = swipeActions.leading ?? [];
|
|
250
|
+
const trailingActions = swipeActions.trailing ?? [];
|
|
251
|
+
const menuItems = properties.contextMenu ?? [];
|
|
252
|
+
function fireSwipeAction(action) {
|
|
253
|
+
methods.triggerEvent({
|
|
254
|
+
name: 'onSwipeAction',
|
|
255
|
+
event: {
|
|
256
|
+
id: action.id
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function fireContextMenu(item) {
|
|
261
|
+
methods.triggerEvent({
|
|
262
|
+
name: 'onContextMenu',
|
|
263
|
+
event: {
|
|
264
|
+
id: item.id
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
const accessibilityActions = [
|
|
269
|
+
...[
|
|
270
|
+
...leadingActions,
|
|
271
|
+
...trailingActions
|
|
272
|
+
].map((action)=>({
|
|
273
|
+
name: `swipe:${action.id}`,
|
|
274
|
+
label: action.title ?? action.id
|
|
275
|
+
})),
|
|
276
|
+
...menuItems.map((item)=>({
|
|
277
|
+
name: `menu:${item.id}`,
|
|
278
|
+
label: item.title
|
|
279
|
+
}))
|
|
280
|
+
];
|
|
281
|
+
function onAccessibilityAction(event) {
|
|
282
|
+
const [kind, id] = event.nativeEvent.actionName.split(/:(.*)/s);
|
|
283
|
+
if (kind === 'swipe') {
|
|
284
|
+
fireSwipeAction({
|
|
285
|
+
id
|
|
286
|
+
});
|
|
287
|
+
} else if (kind === 'menu') {
|
|
288
|
+
fireContextMenu({
|
|
289
|
+
id
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const nativeMenu = menuItems.length > 0 && Platform.OS === 'ios';
|
|
294
|
+
const onLongPress = menuItems.length > 0 && !nativeMenu ? ()=>showContextMenuAlert({
|
|
295
|
+
items: menuItems,
|
|
296
|
+
onSelect: fireContextMenu,
|
|
297
|
+
title
|
|
298
|
+
}) : undefined;
|
|
299
|
+
let item = /*#__PURE__*/ React.createElement(Pressable, {
|
|
300
|
+
accessibilityActions: accessibilityActions.length > 0 ? accessibilityActions : undefined,
|
|
301
|
+
accessibilityLabel: [
|
|
302
|
+
title,
|
|
303
|
+
parts.subtitle
|
|
304
|
+
].filter((text)=>type.isString(text)).join(', '),
|
|
305
|
+
accessibilityRole: pressable ? 'button' : undefined,
|
|
306
|
+
accessibilityState: checked ? {
|
|
307
|
+
selected: true
|
|
308
|
+
} : undefined,
|
|
309
|
+
disabled: disabled,
|
|
310
|
+
onAccessibilityAction: onAccessibilityAction,
|
|
311
|
+
onLongPress: onLongPress,
|
|
312
|
+
onPress: pressable ? ()=>methods.triggerEvent({
|
|
313
|
+
name: 'onClick'
|
|
314
|
+
}) : undefined,
|
|
315
|
+
style: ({ pressed })=>[
|
|
316
|
+
{
|
|
317
|
+
alignItems: 'center',
|
|
318
|
+
backgroundColor: pressed && pressable ? colors.cellPressed : 'transparent',
|
|
319
|
+
flexDirection: 'row',
|
|
320
|
+
gap: GAP,
|
|
321
|
+
minHeight: 44,
|
|
322
|
+
opacity: disabled ? 0.4 : 1,
|
|
323
|
+
paddingHorizontal: ROW_PADDING,
|
|
324
|
+
paddingVertical: hasSubtitle ? 10 : 11
|
|
325
|
+
},
|
|
326
|
+
styles.element
|
|
327
|
+
],
|
|
328
|
+
testID: `${blockId}_item`
|
|
329
|
+
}, /*#__PURE__*/ React.createElement(Leading, {
|
|
330
|
+
blockId: blockId,
|
|
331
|
+
colors: colors,
|
|
332
|
+
components: components,
|
|
333
|
+
content: content,
|
|
334
|
+
isDark: isDark,
|
|
335
|
+
leading: parts.leading,
|
|
336
|
+
styles: styles,
|
|
337
|
+
tokens: tokens
|
|
338
|
+
}), /*#__PURE__*/ React.createElement(View, {
|
|
339
|
+
onLayout: hasLeadingSlot && row !== null ? (event)=>row.setSeparatorInset(event.nativeEvent.layout.x) : undefined,
|
|
340
|
+
style: TITLE_COLUMN,
|
|
341
|
+
testID: `${blockId}_text`
|
|
342
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
343
|
+
ellipsizeMode: "tail",
|
|
344
|
+
numberOfLines: properties.titleLines ?? 2,
|
|
345
|
+
style: [
|
|
346
|
+
hasSubtitle ? iosTextStyles.headline : iosTextStyles.body,
|
|
347
|
+
{
|
|
348
|
+
color: colors.label
|
|
349
|
+
},
|
|
350
|
+
styles.title
|
|
351
|
+
]
|
|
352
|
+
}, title), hasSubtitle ? /*#__PURE__*/ React.createElement(Text, {
|
|
353
|
+
ellipsizeMode: "tail",
|
|
354
|
+
numberOfLines: properties.subtitleLines ?? 1,
|
|
355
|
+
style: [
|
|
356
|
+
iosTextStyles.footnote,
|
|
357
|
+
{
|
|
358
|
+
color: colors.secondaryLabel
|
|
359
|
+
},
|
|
360
|
+
styles.description,
|
|
361
|
+
styles.subtitle
|
|
362
|
+
]
|
|
363
|
+
}, parts.subtitle) : null), /*#__PURE__*/ React.createElement(Trailing, {
|
|
364
|
+
blockId: blockId,
|
|
365
|
+
colors: colors,
|
|
366
|
+
components: components,
|
|
367
|
+
content: content,
|
|
368
|
+
isDark: isDark,
|
|
369
|
+
styles: styles,
|
|
370
|
+
tokens: tokens,
|
|
371
|
+
trailing: parts.trailing
|
|
372
|
+
}), checked ? /*#__PURE__*/ React.createElement(SystemIcon, {
|
|
373
|
+
color: tokens.colorTint,
|
|
374
|
+
components: components,
|
|
375
|
+
fallback: "Check",
|
|
376
|
+
size: 17,
|
|
377
|
+
symbol: "checkmark",
|
|
378
|
+
testID: `${blockId}_check`,
|
|
379
|
+
weight: "semibold"
|
|
380
|
+
}) : null, showChevron ? /*#__PURE__*/ React.createElement(components.Icon, {
|
|
381
|
+
properties: {
|
|
382
|
+
name: 'chevron-right',
|
|
383
|
+
strokeWidth: 2.5,
|
|
384
|
+
title: ''
|
|
385
|
+
},
|
|
386
|
+
styles: {
|
|
387
|
+
element: {
|
|
388
|
+
color: colors.tertiaryLabel,
|
|
389
|
+
fontSize: 16,
|
|
390
|
+
marginLeft: -4
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
testID: `${blockId}_chevron`
|
|
394
|
+
}) : null);
|
|
395
|
+
if (nativeMenu) {
|
|
396
|
+
item = /*#__PURE__*/ React.createElement(ListItemContextMenu, {
|
|
397
|
+
isDark: isDark,
|
|
398
|
+
items: menuItems,
|
|
399
|
+
onSelect: fireContextMenu,
|
|
400
|
+
testID: `${blockId}_menu`
|
|
401
|
+
}, item);
|
|
402
|
+
}
|
|
403
|
+
if (leadingActions.length > 0 || trailingActions.length > 0) {
|
|
404
|
+
item = /*#__PURE__*/ React.createElement(SwipeableRow, {
|
|
405
|
+
background: row?.background ?? colors.cell,
|
|
406
|
+
fullSwipe: FULL_SWIPE[swipeActions.fullSwipe ?? 'leading'],
|
|
407
|
+
Icon: components.Icon,
|
|
408
|
+
leading: leadingActions,
|
|
409
|
+
onAction: fireSwipeAction,
|
|
410
|
+
testID: blockId,
|
|
411
|
+
tokens: tokens,
|
|
412
|
+
trailing: trailingActions
|
|
413
|
+
}, item);
|
|
414
|
+
}
|
|
415
|
+
return item;
|
|
416
|
+
}
|
|
417
|
+
ListItem.meta = meta;
|
|
418
|
+
export default ListItem;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2026 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import React from 'react';
|
|
16
|
+
import { View } from 'react-native';
|
|
17
|
+
import getSfSymbol from './getSfSymbol.js';
|
|
18
|
+
/**
|
|
19
|
+
* iOS's native context menu around a row: a long press lifts the row and shows its items, as
|
|
20
|
+
* Mail and Linear rows do. The row is React Native content hosted in the SwiftUI menu's trigger.
|
|
21
|
+
* iOS only; other platforms show the items in an alert on long press (showContextMenuAlert).
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} props
|
|
24
|
+
* @param {boolean} props.isDark
|
|
25
|
+
* @param {{ id: string, title: string, icon?: string|Object, destructive?: boolean }[]} props.items
|
|
26
|
+
* @param {(item: Object) => void} props.onSelect
|
|
27
|
+
* @param {string} props.testID
|
|
28
|
+
*/ function ListItemContextMenu({ children, isDark, items, onSelect, testID }) {
|
|
29
|
+
// Required when drawn, not imported: SwiftUI views exist only on iOS, and ListItem draws this
|
|
30
|
+
// menu only there (as @expo/ui's universal components load @expo/ui/swift-ui only on iOS).
|
|
31
|
+
// eslint-disable-next-line global-require
|
|
32
|
+
const { Button, ContextMenu, Host, RNHostView } = require('@expo/ui/swift-ui');
|
|
33
|
+
return /*#__PURE__*/ React.createElement(Host, {
|
|
34
|
+
colorScheme: isDark ? 'dark' : 'light',
|
|
35
|
+
matchContents: {
|
|
36
|
+
vertical: true
|
|
37
|
+
},
|
|
38
|
+
style: {
|
|
39
|
+
alignSelf: 'stretch'
|
|
40
|
+
},
|
|
41
|
+
testID: testID
|
|
42
|
+
}, /*#__PURE__*/ React.createElement(ContextMenu, null, /*#__PURE__*/ React.createElement(ContextMenu.Items, null, items.map((item)=>/*#__PURE__*/ React.createElement(Button, {
|
|
43
|
+
key: item.id,
|
|
44
|
+
label: item.title,
|
|
45
|
+
onPress: ()=>onSelect(item),
|
|
46
|
+
role: item.destructive === true ? 'destructive' : undefined,
|
|
47
|
+
systemImage: getSfSymbol(item.icon)
|
|
48
|
+
}))), /*#__PURE__*/ React.createElement(ContextMenu.Trigger, null, /*#__PURE__*/ React.createElement(RNHostView, {
|
|
49
|
+
matchContents: {
|
|
50
|
+
vertical: true
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/ React.createElement(View, {
|
|
53
|
+
style: {
|
|
54
|
+
width: '100%'
|
|
55
|
+
}
|
|
56
|
+
}, children)))));
|
|
57
|
+
}
|
|
58
|
+
export default ListItemContextMenu;
|