@multiplatform.one/components 8.3.0 → 8.4.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/README.md +18 -3
- package/dist/cjs/Chip/index.cjs +1 -1
- package/dist/cjs/Chip/index.native.js +1 -1
- package/dist/cjs/Chip/index.native.js.map +1 -1
- package/dist/cjs/Material/blur.native.js +5 -1
- package/dist/cjs/Material/blur.native.js.map +1 -1
- package/dist/cjs/ScrollView/useRevealFocusedField.native.js +3 -2
- package/dist/cjs/ScrollView/useRevealFocusedField.native.js.map +1 -1
- package/dist/cjs/SheetModal/index.cjs +10 -1
- package/dist/cjs/SheetModal/index.native.js +14 -5
- package/dist/cjs/SheetModal/index.native.js.map +1 -1
- package/dist/cjs/Tabs/index.cjs +16 -39
- package/dist/cjs/Tabs/index.native.js +17 -40
- package/dist/cjs/Tabs/index.native.js.map +1 -1
- package/dist/cjs/Tooltip/index.native.js +9 -1
- package/dist/cjs/Tooltip/index.native.js.map +1 -1
- package/dist/cjs/appShell/AppShell.cjs +91 -107
- package/dist/cjs/appShell/AppShell.native.js +100 -114
- package/dist/cjs/appShell/AppShell.native.js.map +1 -1
- package/dist/cjs/appShell/Springboard.cjs +2 -2
- package/dist/cjs/appShell/Springboard.native.js +2 -2
- package/dist/cjs/appShell/Springboard.native.js.map +1 -1
- package/dist/cjs/appShell/SystemBar.cjs +147 -55
- package/dist/cjs/appShell/SystemBar.native.js +152 -59
- package/dist/cjs/appShell/SystemBar.native.js.map +1 -1
- package/dist/cjs/appShell/TabHost.native.js +5 -2
- package/dist/cjs/appShell/TabHost.native.js.map +1 -1
- package/dist/cjs/appShell/stackBack.cjs +49 -0
- package/dist/cjs/appShell/stackBack.native.js +55 -0
- package/dist/cjs/appShell/stackBack.native.js.map +1 -0
- package/dist/cjs/appShell/systemBarFit.cjs +12 -2
- package/dist/cjs/appShell/systemBarFit.native.js +16 -2
- package/dist/cjs/appShell/systemBarFit.native.js.map +1 -1
- package/dist/cjs/code/CodeBlock/index.cjs +21 -12
- package/dist/cjs/code/CodeBlock/index.native.js +21 -12
- package/dist/cjs/code/CodeBlock/index.native.js.map +1 -1
- package/dist/cjs/code/HoldSelect/index.cjs +69 -0
- package/dist/cjs/code/HoldSelect/index.native.js +132 -0
- package/dist/cjs/code/HoldSelect/index.native.js.map +1 -0
- package/dist/cjs/code/HoldSelect/tapGate.cjs +88 -0
- package/dist/cjs/code/HoldSelect/tapGate.native.js +95 -0
- package/dist/cjs/code/HoldSelect/tapGate.native.js.map +1 -0
- package/dist/cjs/code/LogView.cjs +14 -3
- package/dist/cjs/code/LogView.native.js +15 -3
- package/dist/cjs/code/LogView.native.js.map +1 -1
- package/dist/cjs/code/index.cjs +1 -0
- package/dist/cjs/code/index.native.js +1 -0
- package/dist/cjs/code/index.native.js.map +1 -1
- package/dist/cjs/componentColors.cjs +5 -4
- package/dist/cjs/componentColors.native.js +5 -4
- package/dist/cjs/componentColors.native.js.map +1 -1
- package/dist/cjs/layouts/AsyncBoundary.cjs +21 -1
- package/dist/cjs/layouts/AsyncBoundary.native.js +21 -1
- package/dist/cjs/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/cjs/layouts/asyncFailure.cjs +15 -15
- package/dist/cjs/layouts/asyncFailure.native.js +15 -15
- package/dist/cjs/layouts/asyncFailure.native.js.map +1 -1
- package/dist/cjs/layouts/attachments.cjs +45 -6
- package/dist/cjs/layouts/attachments.native.js +47 -6
- package/dist/cjs/layouts/attachments.native.js.map +1 -1
- package/dist/cjs/layouts/page.cjs +89 -13
- package/dist/cjs/layouts/page.native.js +93 -14
- package/dist/cjs/layouts/page.native.js.map +1 -1
- package/dist/cjs/layouts/screenScroll.cjs +8 -4
- package/dist/cjs/layouts/screenScroll.native.js +12 -4
- package/dist/cjs/layouts/screenScroll.native.js.map +1 -1
- package/dist/cjs/layouts/tags.cjs +2 -1
- package/dist/cjs/layouts/tags.native.js +2 -1
- package/dist/cjs/layouts/tags.native.js.map +1 -1
- package/dist/cjs/views/Dashboard.cjs +18 -5
- package/dist/cjs/views/Dashboard.native.js +18 -5
- package/dist/cjs/views/Dashboard.native.js.map +1 -1
- package/dist/cjs/views/FilePreview.cjs +624 -0
- package/dist/cjs/views/FilePreview.native.js +675 -0
- package/dist/cjs/views/FilePreview.native.js.map +1 -0
- package/dist/cjs/views/ListGroup.cjs +2 -2
- package/dist/cjs/views/ListGroup.native.js +2 -2
- package/dist/cjs/views/ListGroup.native.js.map +1 -1
- package/dist/cjs/views/index.cjs +13 -0
- package/dist/cjs/views/index.native.js +13 -0
- package/dist/cjs/views/index.native.js.map +1 -1
- package/dist/esm/Accordion/index.native.js.map +1 -1
- package/dist/esm/AnimateHeight/index.native.js.map +1 -1
- package/dist/esm/Avatar/getInitials.native.js.map +1 -1
- package/dist/esm/Avatar/index.native.js.map +1 -1
- package/dist/esm/Badge/index.native.js.map +1 -1
- package/dist/esm/Button.native.js.map +1 -1
- package/dist/esm/Carousel/geometry.native.js.map +1 -1
- package/dist/esm/Carousel/index.native.js.map +1 -1
- package/dist/esm/ChatTurn/index.native.js.map +1 -1
- package/dist/esm/CheckGlyph/MenuCheckColumn.native.js.map +1 -1
- package/dist/esm/CheckGlyph/index.native.js.map +1 -1
- package/dist/esm/Chip/index.mjs +3 -3
- package/dist/esm/Chip/index.mjs.map +1 -1
- package/dist/esm/Chip/index.native.js +3 -3
- package/dist/esm/Chip/index.native.js.map +1 -1
- package/dist/esm/ChoiceChips/index.native.js.map +1 -1
- package/dist/esm/Collapsible.native.js.map +1 -1
- package/dist/esm/ContextMenu/index.native.js.map +1 -1
- package/dist/esm/CopyField/CopyMenuButton.native.js.map +1 -1
- package/dist/esm/CopyField/index.native.js.map +1 -1
- package/dist/esm/Dialog.native.js.map +1 -1
- package/dist/esm/Diff/diff.native.js.map +1 -1
- package/dist/esm/Diff/index.native.js.map +1 -1
- package/dist/esm/DotIndicator/index.native.js.map +1 -1
- package/dist/esm/DrillStack/DrillBar.native.js.map +1 -1
- package/dist/esm/DrillStack/context.native.js.map +1 -1
- package/dist/esm/DrillStack/drillMotion.native.js.map +1 -1
- package/dist/esm/DropDownPanel/index.native.js.map +1 -1
- package/dist/esm/DropdownMenu/index.native.js.map +1 -1
- package/dist/esm/DropdownMenu/menuSettle.native.js.map +1 -1
- package/dist/esm/ElapsedProgress/index.native.js.map +1 -1
- package/dist/esm/ErrorBoundary/index.native.js.map +1 -1
- package/dist/esm/Heading.native.js.map +1 -1
- package/dist/esm/Kbd/index.native.js.map +1 -1
- package/dist/esm/Kbd/keys.native.js.map +1 -1
- package/dist/esm/Lightbox/MediaControl.native.js.map +1 -1
- package/dist/esm/Lightbox/index.gnome.native.js.map +1 -1
- package/dist/esm/Lightbox/shared.native.js.map +1 -1
- package/dist/esm/Lightbox/useLightbox.native.js.map +1 -1
- package/dist/esm/MachineLiteral/index.native.js.map +1 -1
- package/dist/esm/Material/blur.native.js +5 -1
- package/dist/esm/Material/blur.native.js.map +1 -1
- package/dist/esm/Material/index.native.js.map +1 -1
- package/dist/esm/Meter/index.native.js.map +1 -1
- package/dist/esm/Meter/meter.native.js.map +1 -1
- package/dist/esm/MiddleEllipsisText/middleSplit.native.js.map +1 -1
- package/dist/esm/MiddleEllipsisText/types.native.js.map +1 -1
- package/dist/esm/OverflowRow/index.native.js.map +1 -1
- package/dist/esm/Pagination.native.js.map +1 -1
- package/dist/esm/Popover.native.js.map +1 -1
- package/dist/esm/ProgressSteps/index.native.js.map +1 -1
- package/dist/esm/Quote/index.native.js.map +1 -1
- package/dist/esm/SchemeToggle/index.native.js.map +1 -1
- package/dist/esm/ScrollView/revealFocusedField.native.js.map +1 -1
- package/dist/esm/ScrollView/useRevealFocusedField.native.js +3 -2
- package/dist/esm/ScrollView/useRevealFocusedField.native.js.map +1 -1
- package/dist/esm/Separator/index.native.js.map +1 -1
- package/dist/esm/Sheet.native.js.map +1 -1
- package/dist/esm/SheetModal/SheetHeader.native.js.map +1 -1
- package/dist/esm/SheetModal/SheetNavigation.native.js.map +1 -1
- package/dist/esm/SheetModal/detents.native.js.map +1 -1
- package/dist/esm/SheetModal/index.mjs +10 -1
- package/dist/esm/SheetModal/index.mjs.map +1 -1
- package/dist/esm/SheetModal/index.native.js +14 -5
- package/dist/esm/SheetModal/index.native.js.map +1 -1
- package/dist/esm/SheetModal/useSheetFrameFocus.native.js.map +1 -1
- package/dist/esm/SheetScrollView/index.native.js.map +1 -1
- package/dist/esm/SheetScrollView/sheetHandoff.native.js.map +1 -1
- package/dist/esm/Skeleton/index.native.js.map +1 -1
- package/dist/esm/SkipLink/index.native.js.map +1 -1
- package/dist/esm/SortableList/SortableHandle.native.js.map +1 -1
- package/dist/esm/SortableList/index.native.js.map +1 -1
- package/dist/esm/SortableList/useSortableRows.native.js.map +1 -1
- package/dist/esm/SortableList/useUserOrder.native.js.map +1 -1
- package/dist/esm/SwipeDismissRow/index.native.js.map +1 -1
- package/dist/esm/Tabs/index.mjs +16 -40
- package/dist/esm/Tabs/index.mjs.map +1 -1
- package/dist/esm/Tabs/index.native.js +17 -41
- package/dist/esm/Tabs/index.native.js.map +1 -1
- package/dist/esm/Text.native.js.map +1 -1
- package/dist/esm/ThemePresetPicker/index.native.js.map +1 -1
- package/dist/esm/Toast/index.native.js.map +1 -1
- package/dist/esm/Toast/store.native.js.map +1 -1
- package/dist/esm/Tooltip/index.native.js +10 -2
- package/dist/esm/Tooltip/index.native.js.map +1 -1
- package/dist/esm/Tooltip/nativePress.native.js.map +1 -1
- package/dist/esm/Tooltip/tooltipShared.native.js.map +1 -1
- package/dist/esm/TreeSelect/index.native.js.map +1 -1
- package/dist/esm/TreeSelect/treeSelectModel.native.js.map +1 -1
- package/dist/esm/Video/PlayerChrome.native.js.map +1 -1
- package/dist/esm/Video/VideoFrame.native.js.map +1 -1
- package/dist/esm/Video/types.native.js.map +1 -1
- package/dist/esm/Wheel/index.native.js.map +1 -1
- package/dist/esm/Wizard/index.native.js.map +1 -1
- package/dist/esm/actions/ActionBar.native.js.map +1 -1
- package/dist/esm/actions/DangerSection.native.js.map +1 -1
- package/dist/esm/actions/DestructiveAction.native.js.map +1 -1
- package/dist/esm/actions/HeaderActions.native.js.map +1 -1
- package/dist/esm/actions/StandardAction.native.js.map +1 -1
- package/dist/esm/actions/devWarn.native.js.map +1 -1
- package/dist/esm/actions/index.native.js.map +1 -1
- package/dist/esm/actions/severity.native.js.map +1 -1
- package/dist/esm/appShell/AppShell.mjs +91 -107
- package/dist/esm/appShell/AppShell.mjs.map +1 -1
- package/dist/esm/appShell/AppShell.native.js +100 -114
- package/dist/esm/appShell/AppShell.native.js.map +1 -1
- package/dist/esm/appShell/BottomChromeClearance.native.js.map +1 -1
- package/dist/esm/appShell/Dock.native.js.map +1 -1
- package/dist/esm/appShell/MpoTabHost.mjs.map +1 -1
- package/dist/esm/appShell/MpoTabHost.native.js.map +1 -1
- package/dist/esm/appShell/ScopeMenu.native.js.map +1 -1
- package/dist/esm/appShell/SettingsSplit.native.js.map +1 -1
- package/dist/esm/appShell/Springboard.mjs +1 -1
- package/dist/esm/appShell/Springboard.mjs.map +1 -1
- package/dist/esm/appShell/Springboard.native.js +1 -1
- package/dist/esm/appShell/Springboard.native.js.map +1 -1
- package/dist/esm/appShell/SystemBar.mjs +147 -58
- package/dist/esm/appShell/SystemBar.mjs.map +1 -1
- package/dist/esm/appShell/SystemBar.native.js +152 -62
- package/dist/esm/appShell/SystemBar.native.js.map +1 -1
- package/dist/esm/appShell/TabBar.native.js.map +1 -1
- package/dist/esm/appShell/TabHost.native.js +5 -2
- package/dist/esm/appShell/TabHost.native.js.map +1 -1
- package/dist/esm/appShell/appTile.native.js.map +1 -1
- package/dist/esm/appShell/bottomChrome.native.js.map +1 -1
- package/dist/esm/appShell/index.native.js.map +1 -1
- package/dist/esm/appShell/stackBack.mjs +23 -0
- package/dist/esm/appShell/stackBack.mjs.map +1 -0
- package/dist/esm/appShell/stackBack.native.js +26 -0
- package/dist/esm/appShell/stackBack.native.js.map +1 -0
- package/dist/esm/appShell/systemBarFit.mjs +12 -2
- package/dist/esm/appShell/systemBarFit.mjs.map +1 -1
- package/dist/esm/appShell/systemBarFit.native.js +16 -2
- package/dist/esm/appShell/systemBarFit.native.js.map +1 -1
- package/dist/esm/charts/Axis.native.js.map +1 -1
- package/dist/esm/charts/BarChart.native.js.map +1 -1
- package/dist/esm/charts/ChartDataView.native.js.map +1 -1
- package/dist/esm/charts/ChartSurface.native.js.map +1 -1
- package/dist/esm/charts/LineChart.native.js.map +1 -1
- package/dist/esm/charts/PieChart.native.js.map +1 -1
- package/dist/esm/charts/Sparkline.native.js.map +1 -1
- package/dist/esm/charts/accessibility.native.js.map +1 -1
- package/dist/esm/charts/chartHeight.native.js.map +1 -1
- package/dist/esm/charts/composeChart.native.js.map +1 -1
- package/dist/esm/charts/index.native.js.map +1 -1
- package/dist/esm/charts/math.native.js.map +1 -1
- package/dist/esm/charts/series.native.js.map +1 -1
- package/dist/esm/charts/svg.native.js.map +1 -1
- package/dist/esm/charts/types.native.js.map +1 -1
- package/dist/esm/charts/useChartTheme.native.js.map +1 -1
- package/dist/esm/code/Code/index.native.js.map +1 -1
- package/dist/esm/code/CodeBlock/index.mjs +21 -12
- package/dist/esm/code/CodeBlock/index.mjs.map +1 -1
- package/dist/esm/code/CodeBlock/index.native.js +21 -12
- package/dist/esm/code/CodeBlock/index.native.js.map +1 -1
- package/dist/esm/code/HighlightedCode/index.native.js.map +1 -1
- package/dist/esm/code/Highlighter/houseSyntaxTheme.native.js.map +1 -1
- package/dist/esm/code/Highlighter/index.native.js.map +1 -1
- package/dist/esm/code/Highlighter/namedGroupMatchAll.native.js.map +1 -1
- package/dist/esm/code/HoldSelect/index.mjs +42 -0
- package/dist/esm/code/HoldSelect/index.mjs.map +1 -0
- package/dist/esm/code/HoldSelect/index.native.js +102 -0
- package/dist/esm/code/HoldSelect/index.native.js.map +1 -0
- package/dist/esm/code/HoldSelect/tapGate.mjs +61 -0
- package/dist/esm/code/HoldSelect/tapGate.mjs.map +1 -0
- package/dist/esm/code/HoldSelect/tapGate.native.js +65 -0
- package/dist/esm/code/HoldSelect/tapGate.native.js.map +1 -0
- package/dist/esm/code/LogView.mjs +13 -3
- package/dist/esm/code/LogView.mjs.map +1 -1
- package/dist/esm/code/LogView.native.js +14 -3
- package/dist/esm/code/LogView.native.js.map +1 -1
- package/dist/esm/code/PayloadView/index.native.js.map +1 -1
- package/dist/esm/code/PayloadView/payloadModel.native.js.map +1 -1
- package/dist/esm/code/Pre/index.native.js.map +1 -1
- package/dist/esm/code/index.mjs +1 -0
- package/dist/esm/code/index.mjs.map +1 -1
- package/dist/esm/code/index.native.js +1 -0
- package/dist/esm/code/index.native.js.map +1 -1
- package/dist/esm/componentColors.mjs +5 -4
- package/dist/esm/componentColors.mjs.map +1 -1
- package/dist/esm/componentColors.native.js +5 -4
- package/dist/esm/componentColors.native.js.map +1 -1
- package/dist/esm/feedback/ConfirmDialog.native.js.map +1 -1
- package/dist/esm/feedback/NotifyHost.native.js.map +1 -1
- package/dist/esm/feedback/copy.native.js.map +1 -1
- package/dist/esm/feedback/index.native.js.map +1 -1
- package/dist/esm/feedback/notify.native.js.map +1 -1
- package/dist/esm/feedback/route.native.js.map +1 -1
- package/dist/esm/feedback/store.native.js.map +1 -1
- package/dist/esm/formLayouts/FormLayouts.native.js.map +1 -1
- package/dist/esm/formLayouts/PreferencePanel.native.js.map +1 -1
- package/dist/esm/formLayouts/index.native.js.map +1 -1
- package/dist/esm/hooks/index.native.js.map +1 -1
- package/dist/esm/hooks/useClipboard.native.js.map +1 -1
- package/dist/esm/hooks/useDocumentTitle.native.js.map +1 -1
- package/dist/esm/icons/CheckRegular.native.js.map +1 -1
- package/dist/esm/icons/MinusRegular.native.js.map +1 -1
- package/dist/esm/icons/index.native.js.map +1 -1
- package/dist/esm/icons/lucide.native.js.map +1 -1
- package/dist/esm/icons/themed.native.js.map +1 -1
- package/dist/esm/images/Image/ImageFrame.native.js.map +1 -1
- package/dist/esm/images/Image/framing.native.js.map +1 -1
- package/dist/esm/images/Image/mediaRadius.native.js.map +1 -1
- package/dist/esm/images/Image/shared.native.js.map +1 -1
- package/dist/esm/images/Image/types.native.js.map +1 -1
- package/dist/esm/images/RemoteArt/remoteArtCache.native.js.map +1 -1
- package/dist/esm/images/RemoteArt/svgMarkup.native.js.map +1 -1
- package/dist/esm/images/RemoteArt/types.native.js.map +1 -1
- package/dist/esm/images/index.native.js.map +1 -1
- package/dist/esm/index.gnome.native.js.map +1 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/knobImmuneExports.native.js.map +1 -1
- package/dist/esm/layouts/AsyncBoundary.mjs +22 -2
- package/dist/esm/layouts/AsyncBoundary.mjs.map +1 -1
- package/dist/esm/layouts/AsyncBoundary.native.js +22 -2
- package/dist/esm/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/esm/layouts/Debug/index.native.js.map +1 -1
- package/dist/esm/layouts/EmptyState.native.js.map +1 -1
- package/dist/esm/layouts/IdentityPlate.native.js.map +1 -1
- package/dist/esm/layouts/KeyboardAvoidingWrapper/behavior.native.js.map +1 -1
- package/dist/esm/layouts/PageTemplates.native.js.map +1 -1
- package/dist/esm/layouts/PaneScaffold.native.js.map +1 -1
- package/dist/esm/layouts/SafeAreaWrapper/insets.native.js.map +1 -1
- package/dist/esm/layouts/StatusDot.native.js.map +1 -1
- package/dist/esm/layouts/StatusGlyphStrip.native.js.map +1 -1
- package/dist/esm/layouts/ViewSwitcher.native.js.map +1 -1
- package/dist/esm/layouts/asyncFailure.mjs +15 -15
- package/dist/esm/layouts/asyncFailure.mjs.map +1 -1
- package/dist/esm/layouts/asyncFailure.native.js +15 -15
- package/dist/esm/layouts/asyncFailure.native.js.map +1 -1
- package/dist/esm/layouts/attachments.mjs +45 -6
- package/dist/esm/layouts/attachments.mjs.map +1 -1
- package/dist/esm/layouts/attachments.native.js +47 -6
- package/dist/esm/layouts/attachments.native.js.map +1 -1
- package/dist/esm/layouts/barTitleSpan.native.js.map +1 -1
- package/dist/esm/layouts/bottomAccessory.native.js.map +1 -1
- package/dist/esm/layouts/breadcrumbs.native.js.map +1 -1
- package/dist/esm/layouts/index.native.js.map +1 -1
- package/dist/esm/layouts/page.mjs +94 -18
- package/dist/esm/layouts/page.mjs.map +1 -1
- package/dist/esm/layouts/page.native.js +96 -17
- package/dist/esm/layouts/page.native.js.map +1 -1
- package/dist/esm/layouts/pageHeadingScope.native.js.map +1 -1
- package/dist/esm/layouts/screenScroll.mjs +8 -4
- package/dist/esm/layouts/screenScroll.mjs.map +1 -1
- package/dist/esm/layouts/screenScroll.native.js +12 -4
- package/dist/esm/layouts/screenScroll.native.js.map +1 -1
- package/dist/esm/layouts/shellSidebarSlot.native.js.map +1 -1
- package/dist/esm/layouts/sidebar.native.js.map +1 -1
- package/dist/esm/layouts/tags.mjs +2 -1
- package/dist/esm/layouts/tags.mjs.map +1 -1
- package/dist/esm/layouts/tags.native.js +2 -1
- package/dist/esm/layouts/tags.native.js.map +1 -1
- package/dist/esm/layouts/timeline.native.js.map +1 -1
- package/dist/esm/layouts/toolbar.native.js.map +1 -1
- package/dist/esm/shared/actionScan.native.js.map +1 -1
- package/dist/esm/shared/i18n.native.js.map +1 -1
- package/dist/esm/shared/restoreRetries.native.js.map +1 -1
- package/dist/esm/shared/t.native.js.map +1 -1
- package/dist/esm/shared/textRidesText.native.js.map +1 -1
- package/dist/esm/shared/useReturnFocusOnClose.native.js.map +1 -1
- package/dist/esm/surfaces.native.js.map +1 -1
- package/dist/esm/tamagui.native.js.map +1 -1
- package/dist/esm/testSetup.native.js.map +1 -1
- package/dist/esm/utils/unwrapText.native.js.map +1 -1
- package/dist/esm/views/Calendar.native.js.map +1 -1
- package/dist/esm/views/CardGrid.native.js.map +1 -1
- package/dist/esm/views/Dashboard.mjs +19 -6
- package/dist/esm/views/Dashboard.mjs.map +1 -1
- package/dist/esm/views/Dashboard.native.js +19 -6
- package/dist/esm/views/Dashboard.native.js.map +1 -1
- package/dist/esm/views/FilePreview.mjs +588 -0
- package/dist/esm/views/FilePreview.mjs.map +1 -0
- package/dist/esm/views/FilePreview.native.js +636 -0
- package/dist/esm/views/FilePreview.native.js.map +1 -0
- package/dist/esm/views/Gantt.native.js.map +1 -1
- package/dist/esm/views/GanttDateGrip.native.js.map +1 -1
- package/dist/esm/views/ImageGrid.native.js.map +1 -1
- package/dist/esm/views/List.native.js.map +1 -1
- package/dist/esm/views/ListGroup.mjs +1 -1
- package/dist/esm/views/ListGroup.native.js +1 -1
- package/dist/esm/views/ListGroup.native.js.map +1 -1
- package/dist/esm/views/ListRow.native.js.map +1 -1
- package/dist/esm/views/Matrix.native.js.map +1 -1
- package/dist/esm/views/ReportBuilder.native.js.map +1 -1
- package/dist/esm/views/ShortcutCard.native.js.map +1 -1
- package/dist/esm/views/TreeView.native.js.map +1 -1
- package/dist/esm/views/calendarMath.native.js.map +1 -1
- package/dist/esm/views/ganttIntervals.native.js.map +1 -1
- package/dist/esm/views/ganttMath.native.js.map +1 -1
- package/dist/esm/views/index.mjs +2 -1
- package/dist/esm/views/index.mjs.map +1 -1
- package/dist/esm/views/index.native.js +2 -1
- package/dist/esm/views/index.native.js.map +1 -1
- package/dist/esm/views/kanbanDnd.native.js.map +1 -1
- package/dist/esm/views/matrixMath.native.js.map +1 -1
- package/dist/esm/views/sameNameScope.native.js.map +1 -1
- package/dist/esm/views/treeViewDnd.native.js.map +1 -1
- package/dist/esm/views/treeViewLayout.native.js.map +1 -1
- package/dist/esm/views/treeViewMotion.native.js.map +1 -1
- package/dist/esm/views/treeViewReveal.native.js.map +1 -1
- package/dist/esm/views/usePageFlowLoadMore.native.js.map +1 -1
- package/dist/esm/views/widgetChrome.native.js.map +1 -1
- package/dist/jsx/Chip/index.mjs +3 -3
- package/dist/jsx/Chip/index.mjs.map +1 -1
- package/dist/jsx/Chip/index.native.js +1 -1
- package/dist/jsx/Chip/index.native.js.map +1 -1
- package/dist/jsx/Material/blur.native.js +5 -1
- package/dist/jsx/Material/blur.native.js.map +1 -1
- package/dist/jsx/ScrollView/useRevealFocusedField.native.js +3 -2
- package/dist/jsx/ScrollView/useRevealFocusedField.native.js.map +1 -1
- package/dist/jsx/SheetModal/index.mjs +10 -1
- package/dist/jsx/SheetModal/index.mjs.map +1 -1
- package/dist/jsx/SheetModal/index.native.js +14 -5
- package/dist/jsx/SheetModal/index.native.js.map +1 -1
- package/dist/jsx/Tabs/index.mjs +16 -40
- package/dist/jsx/Tabs/index.mjs.map +1 -1
- package/dist/jsx/Tabs/index.native.js +17 -40
- package/dist/jsx/Tabs/index.native.js.map +1 -1
- package/dist/jsx/Tooltip/index.native.js +9 -1
- package/dist/jsx/Tooltip/index.native.js.map +1 -1
- package/dist/jsx/appShell/AppShell.mjs +91 -107
- package/dist/jsx/appShell/AppShell.mjs.map +1 -1
- package/dist/jsx/appShell/AppShell.native.js +100 -114
- package/dist/jsx/appShell/AppShell.native.js.map +1 -1
- package/dist/jsx/appShell/MpoTabHost.mjs.map +1 -1
- package/dist/jsx/appShell/MpoTabHost.native.js.map +1 -1
- package/dist/jsx/appShell/Springboard.mjs +1 -1
- package/dist/jsx/appShell/Springboard.mjs.map +1 -1
- package/dist/jsx/appShell/Springboard.native.js +2 -2
- package/dist/jsx/appShell/Springboard.native.js.map +1 -1
- package/dist/jsx/appShell/SystemBar.mjs +147 -58
- package/dist/jsx/appShell/SystemBar.mjs.map +1 -1
- package/dist/jsx/appShell/SystemBar.native.js +152 -59
- package/dist/jsx/appShell/SystemBar.native.js.map +1 -1
- package/dist/jsx/appShell/TabHost.native.js +5 -2
- package/dist/jsx/appShell/TabHost.native.js.map +1 -1
- package/dist/jsx/appShell/stackBack.mjs +23 -0
- package/dist/jsx/appShell/stackBack.mjs.map +1 -0
- package/dist/jsx/appShell/stackBack.native.js +55 -0
- package/dist/jsx/appShell/stackBack.native.js.map +1 -0
- package/dist/jsx/appShell/systemBarFit.mjs +12 -2
- package/dist/jsx/appShell/systemBarFit.mjs.map +1 -1
- package/dist/jsx/appShell/systemBarFit.native.js +16 -2
- package/dist/jsx/appShell/systemBarFit.native.js.map +1 -1
- package/dist/jsx/code/CodeBlock/index.mjs +21 -12
- package/dist/jsx/code/CodeBlock/index.mjs.map +1 -1
- package/dist/jsx/code/CodeBlock/index.native.js +21 -12
- package/dist/jsx/code/CodeBlock/index.native.js.map +1 -1
- package/dist/jsx/code/HoldSelect/index.mjs +42 -0
- package/dist/jsx/code/HoldSelect/index.mjs.map +1 -0
- package/dist/jsx/code/HoldSelect/index.native.js +132 -0
- package/dist/jsx/code/HoldSelect/index.native.js.map +1 -0
- package/dist/jsx/code/HoldSelect/tapGate.mjs +61 -0
- package/dist/jsx/code/HoldSelect/tapGate.mjs.map +1 -0
- package/dist/jsx/code/HoldSelect/tapGate.native.js +95 -0
- package/dist/jsx/code/HoldSelect/tapGate.native.js.map +1 -0
- package/dist/jsx/code/LogView.mjs +13 -3
- package/dist/jsx/code/LogView.mjs.map +1 -1
- package/dist/jsx/code/LogView.native.js +15 -3
- package/dist/jsx/code/LogView.native.js.map +1 -1
- package/dist/jsx/code/index.mjs +1 -0
- package/dist/jsx/code/index.mjs.map +1 -1
- package/dist/jsx/code/index.native.js +1 -0
- package/dist/jsx/code/index.native.js.map +1 -1
- package/dist/jsx/componentColors.mjs +5 -4
- package/dist/jsx/componentColors.mjs.map +1 -1
- package/dist/jsx/componentColors.native.js +5 -4
- package/dist/jsx/componentColors.native.js.map +1 -1
- package/dist/jsx/layouts/AsyncBoundary.mjs +22 -2
- package/dist/jsx/layouts/AsyncBoundary.mjs.map +1 -1
- package/dist/jsx/layouts/AsyncBoundary.native.js +21 -1
- package/dist/jsx/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/jsx/layouts/asyncFailure.mjs +15 -15
- package/dist/jsx/layouts/asyncFailure.mjs.map +1 -1
- package/dist/jsx/layouts/asyncFailure.native.js +15 -15
- package/dist/jsx/layouts/asyncFailure.native.js.map +1 -1
- package/dist/jsx/layouts/attachments.mjs +45 -6
- package/dist/jsx/layouts/attachments.mjs.map +1 -1
- package/dist/jsx/layouts/attachments.native.js +47 -6
- package/dist/jsx/layouts/attachments.native.js.map +1 -1
- package/dist/jsx/layouts/page.mjs +94 -18
- package/dist/jsx/layouts/page.mjs.map +1 -1
- package/dist/jsx/layouts/page.native.js +93 -14
- package/dist/jsx/layouts/page.native.js.map +1 -1
- package/dist/jsx/layouts/screenScroll.mjs +8 -4
- package/dist/jsx/layouts/screenScroll.mjs.map +1 -1
- package/dist/jsx/layouts/screenScroll.native.js +12 -4
- package/dist/jsx/layouts/screenScroll.native.js.map +1 -1
- package/dist/jsx/layouts/tags.mjs +2 -1
- package/dist/jsx/layouts/tags.mjs.map +1 -1
- package/dist/jsx/layouts/tags.native.js +2 -1
- package/dist/jsx/layouts/tags.native.js.map +1 -1
- package/dist/jsx/views/Dashboard.mjs +19 -6
- package/dist/jsx/views/Dashboard.mjs.map +1 -1
- package/dist/jsx/views/Dashboard.native.js +18 -5
- package/dist/jsx/views/Dashboard.native.js.map +1 -1
- package/dist/jsx/views/FilePreview.mjs +588 -0
- package/dist/jsx/views/FilePreview.mjs.map +1 -0
- package/dist/jsx/views/FilePreview.native.js +675 -0
- package/dist/jsx/views/FilePreview.native.js.map +1 -0
- package/dist/jsx/views/ListGroup.mjs +1 -1
- package/dist/jsx/views/ListGroup.native.js +2 -2
- package/dist/jsx/views/ListGroup.native.js.map +1 -1
- package/dist/jsx/views/index.mjs +2 -1
- package/dist/jsx/views/index.mjs.map +1 -1
- package/dist/jsx/views/index.native.js +13 -0
- package/dist/jsx/views/index.native.js.map +1 -1
- package/package.json +8 -11
- package/src/Chip/index.tsx +4 -3
- package/src/Material/blur.native.tsx +7 -1
- package/src/OverflowRow/OverflowRow.native.spec.tsx +10 -0
- package/src/OverflowRow/OverflowRow.stories.tsx +46 -17
- package/src/ScrollView/useRevealFocusedField.native.ts +2 -2
- package/src/SheetModal/SheetModal.elevation.spec.tsx +4 -4
- package/src/SheetModal/SheetModal.fill.spec.tsx +47 -0
- package/src/SheetModal/index.native.tsx +11 -3
- package/src/SheetModal/index.tsx +8 -0
- package/src/Tabs/Tabs.edgeFades.spec.tsx +77 -0
- package/src/Tabs/Tabs.fades.native.spec.tsx +23 -21
- package/src/Tabs/Tabs.measurement.spec.tsx +3 -3
- package/src/Tabs/Tabs.native.spec.tsx +1 -1
- package/src/Tabs/index.tsx +29 -50
- package/src/Tooltip/Tooltip.holdCue.native.spec.tsx +71 -0
- package/src/Tooltip/Tooltip.spec.tsx +1 -1
- package/src/Tooltip/index.native.tsx +6 -1
- package/src/appShell/AppShell.native.spec.tsx +104 -0
- package/src/appShell/AppShell.spec.tsx +49 -0
- package/src/appShell/AppShell.stackBack.native-press.spec.tsx +61 -0
- package/src/appShell/AppShell.stackBack.spec.tsx +112 -0
- package/src/appShell/AppShell.stories.tsx +51 -1
- package/src/appShell/AppShell.tsx +66 -80
- package/src/appShell/MpoTabHost.tsx +6 -0
- package/src/appShell/Springboard.spec.tsx +1 -1
- package/src/appShell/Springboard.tsx +1 -1
- package/src/appShell/SystemBar.phoneWidth.spec.tsx +17 -0
- package/src/appShell/SystemBar.spec.tsx +155 -3
- package/src/appShell/SystemBar.stories.tsx +48 -3
- package/src/appShell/SystemBar.tsx +172 -48
- package/src/appShell/TabHost.native.tsx +4 -2
- package/src/appShell/stackBack.ts +31 -0
- package/src/appShell/systemBarFit.ts +10 -7
- package/src/checkedRow.native-press.spec.tsx +4 -4
- package/src/checkedRow.spec.tsx +2 -2
- package/src/code/CodeBlock/codeBlock.stories.ts +21 -0
- package/src/code/CodeBlock/index.tsx +24 -17
- package/src/code/HoldSelect/holdSelect.spec.tsx +128 -0
- package/src/code/HoldSelect/index.native.tsx +86 -0
- package/src/code/HoldSelect/index.tsx +53 -0
- package/src/code/HoldSelect/tapGate.ts +87 -0
- package/src/code/LogView.follow.spec.tsx +104 -0
- package/src/code/LogView.tsx +29 -4
- package/src/code/index.ts +1 -0
- package/src/componentColors.spec.ts +3 -3
- package/src/componentColors.ts +5 -4
- package/src/elevatedGround.spec.tsx +7 -7
- package/src/layouts/AsyncBoundary.reason.spec.tsx +64 -23
- package/src/layouts/AsyncBoundary.stories.tsx +1 -0
- package/src/layouts/AsyncBoundary.tsx +21 -2
- package/src/layouts/Attachments.stories.tsx +31 -1
- package/src/layouts/ScreenToolbar.stories.tsx +54 -1
- package/src/layouts/Sidebar.spec.tsx +6 -1
- package/src/layouts/asyncFailure.spec.ts +28 -13
- package/src/layouts/asyncFailure.ts +17 -19
- package/src/layouts/attachments.tsx +60 -8
- package/src/layouts/heroBarTitle.native-press.spec.tsx +132 -0
- package/src/layouts/page.tsx +136 -16
- package/src/layouts/screenScroll.tsx +21 -14
- package/src/layouts/tags.tsx +2 -1
- package/src/layouts/toolbarLeadingClip.spec.tsx +120 -0
- package/src/overlayElevation.spec.tsx +1 -1
- package/src/overlayGround.spec.tsx +77 -0
- package/src/views/Dashboard.stories.tsx +21 -0
- package/src/views/Dashboard.tsx +34 -7
- package/src/views/FilePreview.tsx +640 -0
- package/src/views/Kanban.spec.tsx +6 -1
- package/src/views/List.selection.spec.tsx +42 -0
- package/src/views/List.spec.tsx +1 -26
- package/src/views/ListGroup.states.spec.tsx +1 -1
- package/src/views/ListGroup.stories.tsx +119 -2
- package/src/views/ListGroup.tsx +1 -1
- package/src/views/ReportBuilder.spec.tsx +9 -4
- package/src/views/TreeView.spec.tsx +6 -1
- package/src/views/dataIdentity.spec.tsx +5 -0
- package/src/views/filePreview.spec.tsx +282 -0
- package/src/views/index.ts +17 -0
- package/src/views/kpiNotMeasured.spec.tsx +56 -0
- package/types/Chip/index.d.ts.map +1 -1
- package/types/Material/blur.native.d.ts.map +1 -1
- package/types/SheetModal/index.d.ts +6 -1
- package/types/SheetModal/index.d.ts.map +1 -1
- package/types/SheetModal/index.native.d.ts +1 -1
- package/types/SheetModal/index.native.d.ts.map +1 -1
- package/types/Tabs/index.d.ts +2 -1
- package/types/Tabs/index.d.ts.map +1 -1
- package/types/Tooltip/index.native.d.ts.map +1 -1
- package/types/appShell/AppShell.d.ts +5 -1
- package/types/appShell/AppShell.d.ts.map +1 -1
- package/types/appShell/MpoTabHost.d.ts +6 -0
- package/types/appShell/MpoTabHost.d.ts.map +1 -1
- package/types/appShell/Springboard.d.ts.map +1 -1
- package/types/appShell/SystemBar.d.ts +39 -2
- package/types/appShell/SystemBar.d.ts.map +1 -1
- package/types/appShell/TabHost.native.d.ts +1 -1
- package/types/appShell/TabHost.native.d.ts.map +1 -1
- package/types/appShell/stackBack.d.ts +3 -0
- package/types/appShell/stackBack.d.ts.map +1 -0
- package/types/appShell/systemBarFit.d.ts +1 -0
- package/types/appShell/systemBarFit.d.ts.map +1 -1
- package/types/code/CodeBlock/index.d.ts +3 -1
- package/types/code/CodeBlock/index.d.ts.map +1 -1
- package/types/code/HoldSelect/index.d.ts +16 -0
- package/types/code/HoldSelect/index.d.ts.map +1 -0
- package/types/code/HoldSelect/index.native.d.ts +17 -0
- package/types/code/HoldSelect/index.native.d.ts.map +1 -0
- package/types/code/HoldSelect/tapGate.d.ts +41 -0
- package/types/code/HoldSelect/tapGate.d.ts.map +1 -0
- package/types/code/LogView.d.ts +3 -1
- package/types/code/LogView.d.ts.map +1 -1
- package/types/code/index.d.ts +1 -0
- package/types/code/index.d.ts.map +1 -1
- package/types/componentColors.d.ts +4 -4
- package/types/componentColors.d.ts.map +1 -1
- package/types/layouts/AsyncBoundary.d.ts +3 -1
- package/types/layouts/AsyncBoundary.d.ts.map +1 -1
- package/types/layouts/asyncFailure.d.ts +4 -1
- package/types/layouts/asyncFailure.d.ts.map +1 -1
- package/types/layouts/attachments.d.ts.map +1 -1
- package/types/layouts/page.d.ts.map +1 -1
- package/types/layouts/screenScroll.d.ts +4 -2
- package/types/layouts/screenScroll.d.ts.map +1 -1
- package/types/layouts/tags.d.ts.map +1 -1
- package/types/views/Dashboard.d.ts +7 -1
- package/types/views/Dashboard.d.ts.map +1 -1
- package/types/views/FilePreview.d.ts +62 -0
- package/types/views/FilePreview.d.ts.map +1 -0
- package/types/views/index.d.ts +1 -0
- package/types/views/index.d.ts.map +1 -1
- package/dist/cjs/hooks/useHoldCue.cjs +0 -52
- package/dist/cjs/hooks/useHoldCue.native.js +0 -60
- package/dist/cjs/hooks/useHoldCue.native.js.map +0 -1
- package/dist/esm/hooks/useHoldCue.mjs +0 -26
- package/dist/esm/hooks/useHoldCue.mjs.map +0 -1
- package/dist/esm/hooks/useHoldCue.native.js +0 -31
- package/dist/esm/hooks/useHoldCue.native.js.map +0 -1
- package/dist/jsx/hooks/useHoldCue.mjs +0 -26
- package/dist/jsx/hooks/useHoldCue.mjs.map +0 -1
- package/dist/jsx/hooks/useHoldCue.native.js +0 -60
- package/dist/jsx/hooks/useHoldCue.native.js.map +0 -1
- package/src/hooks/useHoldCue.ts +0 -23
- package/types/hooks/useHoldCue.d.ts +0 -8
- package/types/hooks/useHoldCue.d.ts.map +0 -1
|
@@ -45,6 +45,7 @@ import { useReturnFocusOnClose } from "../shared/useReturnFocusOnClose";
|
|
|
45
45
|
import { AsyncBoundary, resolveAsyncStatus } from "./AsyncBoundary";
|
|
46
46
|
import { MiddleEllipsisText } from "../MiddleEllipsisText";
|
|
47
47
|
import { Text } from "../Text";
|
|
48
|
+
import { FileViewer, isTextFile, useFileViewerHost, type PreviewFile } from "../views/FilePreview";
|
|
48
49
|
|
|
49
50
|
// ---------------------------------------------------------------------------
|
|
50
51
|
// Types (generic -- no Frappe dependency)
|
|
@@ -175,6 +176,22 @@ function isImageFile(attachment: AttachmentItem): boolean {
|
|
|
175
176
|
return imageExtensions.includes(ext);
|
|
176
177
|
}
|
|
177
178
|
|
|
179
|
+
function isTextAttachment(attachment: AttachmentItem): boolean {
|
|
180
|
+
if (isImageFile(attachment)) return false;
|
|
181
|
+
const mime = (attachment.fileType || "").toLowerCase();
|
|
182
|
+
if (mime.startsWith("text/") || /json|yaml|xml|javascript|toml/.test(mime)) return true;
|
|
183
|
+
return isTextFile({ name: attachment.fileName });
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function attachmentPreviewFile(attachment: AttachmentItem): PreviewFile {
|
|
187
|
+
return {
|
|
188
|
+
name: attachment.fileName,
|
|
189
|
+
meta: attachment.formattedSize || formatFileSize(attachment.fileSize),
|
|
190
|
+
url: attachment.fileUrl,
|
|
191
|
+
kind: "text",
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
178
195
|
function getFileExtension(attachment: AttachmentItem): string {
|
|
179
196
|
const name = attachment.fileName || "";
|
|
180
197
|
const dot = name.lastIndexOf(".");
|
|
@@ -305,6 +322,7 @@ interface AttachmentRowProps {
|
|
|
305
322
|
previewLabel: string;
|
|
306
323
|
downloadLabel: string;
|
|
307
324
|
removeLabel: string;
|
|
325
|
+
selected: boolean;
|
|
308
326
|
onAttachmentClick?: (attachment: AttachmentItem) => void;
|
|
309
327
|
onPreview: (attachment: AttachmentItem) => void;
|
|
310
328
|
onDownload: (attachment: AttachmentItem) => void;
|
|
@@ -330,6 +348,7 @@ function AttachmentRow({
|
|
|
330
348
|
previewLabel,
|
|
331
349
|
downloadLabel,
|
|
332
350
|
removeLabel,
|
|
351
|
+
selected,
|
|
333
352
|
onAttachmentClick,
|
|
334
353
|
onPreview,
|
|
335
354
|
onDownload,
|
|
@@ -345,7 +364,8 @@ function AttachmentRow({
|
|
|
345
364
|
const ext = getFileExtension(attachment);
|
|
346
365
|
const iconSize = small ? 14 : 16;
|
|
347
366
|
const position = getGroupPosition(index, count);
|
|
348
|
-
const corners = stackRadiusProps(position, knobProps.containerRadius.borderRadius);
|
|
367
|
+
const corners = stackRadiusProps(position, selected ? 0 : knobProps.containerRadius.borderRadius);
|
|
368
|
+
const metaInk = selected ? componentColors.selection.ink : componentColors.text.subtle;
|
|
349
369
|
|
|
350
370
|
const actions = {
|
|
351
371
|
onPreview: () => onPreview(attachment),
|
|
@@ -381,7 +401,7 @@ function AttachmentRow({
|
|
|
381
401
|
|
|
382
402
|
const actionButtons = (
|
|
383
403
|
<XStack gap="$1" alignItems="center">
|
|
384
|
-
{enablePreview && isImage && (
|
|
404
|
+
{enablePreview && (isImage || isTextAttachment(attachment)) && (
|
|
385
405
|
<Button
|
|
386
406
|
size="$2"
|
|
387
407
|
chromeless
|
|
@@ -437,15 +457,23 @@ function AttachmentRow({
|
|
|
437
457
|
overflow="hidden"
|
|
438
458
|
cursor="pointer"
|
|
439
459
|
{...corners}
|
|
460
|
+
{...(selected
|
|
461
|
+
? ({
|
|
462
|
+
backgroundColor: componentColors.selection.background,
|
|
463
|
+
"data-selected": true,
|
|
464
|
+
} as Record<string, unknown>)
|
|
465
|
+
: null)}
|
|
440
466
|
{...transitionProps(knobProps.motion.control)}
|
|
441
467
|
hoverStyle={{
|
|
442
468
|
backgroundColor: componentColors.interactive.background,
|
|
443
469
|
...control.hoverKnobProps,
|
|
470
|
+
...(selected ? { backgroundColor: componentColors.selection.hover } : null),
|
|
444
471
|
...corners,
|
|
445
472
|
}}
|
|
446
473
|
pressStyle={{
|
|
447
474
|
backgroundColor: componentColors.interactive.hover,
|
|
448
475
|
...control.pressKnobProps,
|
|
476
|
+
...(selected ? { backgroundColor: componentColors.selection.press } : null),
|
|
449
477
|
...corners,
|
|
450
478
|
}}
|
|
451
479
|
{...(kbFocus ? ensureFocusVisibleRing({ outlineOffset: -2 }) : { outlineWidth: 0 })}
|
|
@@ -470,10 +498,10 @@ function AttachmentRow({
|
|
|
470
498
|
</Text>
|
|
471
499
|
{ext ? (
|
|
472
500
|
<>
|
|
473
|
-
<Text fontSize="$2" color={
|
|
501
|
+
<Text fontSize="$2" color={metaInk}>
|
|
474
502
|
·
|
|
475
503
|
</Text>
|
|
476
|
-
<Text fontSize="$2" color={
|
|
504
|
+
<Text fontSize="$2" color={metaInk}>
|
|
477
505
|
{ext}
|
|
478
506
|
</Text>
|
|
479
507
|
</>
|
|
@@ -533,6 +561,7 @@ export function Attachments({
|
|
|
533
561
|
const LabelTag = small ? Label : SizableText;
|
|
534
562
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
535
563
|
const [previewFile, setPreviewFile] = useState<AttachmentItem | null>(null);
|
|
564
|
+
const viewerHost = useFileViewerHost();
|
|
536
565
|
const [uploadError, setUploadError] = useState<string | null>(null);
|
|
537
566
|
const [dragOver, setDragOver] = useState(false);
|
|
538
567
|
useReturnFocusOnClose(!!previewFile);
|
|
@@ -586,9 +615,16 @@ export function Attachments({
|
|
|
586
615
|
[acceptFile],
|
|
587
616
|
);
|
|
588
617
|
|
|
589
|
-
const handlePreview = useCallback(
|
|
590
|
-
|
|
591
|
-
|
|
618
|
+
const handlePreview = useCallback(
|
|
619
|
+
(attachment: AttachmentItem) => {
|
|
620
|
+
if (viewerHost && isTextAttachment(attachment)) {
|
|
621
|
+
viewerHost.open(attachmentPreviewFile(attachment));
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
setPreviewFile(attachment);
|
|
625
|
+
},
|
|
626
|
+
[viewerHost],
|
|
627
|
+
);
|
|
592
628
|
|
|
593
629
|
const handleDownload = useCallback(
|
|
594
630
|
(attachment: AttachmentItem) => {
|
|
@@ -758,6 +794,12 @@ export function Attachments({
|
|
|
758
794
|
previewLabel={previewLabel}
|
|
759
795
|
downloadLabel={downloadLabel}
|
|
760
796
|
removeLabel={removeLabel}
|
|
797
|
+
selected={
|
|
798
|
+
previewFile?.id === attachment.id ||
|
|
799
|
+
(viewerHost?.file != null &&
|
|
800
|
+
isTextAttachment(attachment) &&
|
|
801
|
+
viewerHost.file.url === attachment.fileUrl)
|
|
802
|
+
}
|
|
761
803
|
onAttachmentClick={onAttachmentClick}
|
|
762
804
|
onPreview={handlePreview}
|
|
763
805
|
onDownload={handleDownload}
|
|
@@ -768,7 +810,17 @@ export function Attachments({
|
|
|
768
810
|
</YStack>
|
|
769
811
|
</AsyncBoundary>
|
|
770
812
|
|
|
771
|
-
<
|
|
813
|
+
<FileViewer
|
|
814
|
+
file={
|
|
815
|
+
previewFile && isTextAttachment(previewFile) ? attachmentPreviewFile(previewFile) : null
|
|
816
|
+
}
|
|
817
|
+
open={!!previewFile && isTextAttachment(previewFile)}
|
|
818
|
+
onOpenChange={(open) => !open && setPreviewFile(null)}
|
|
819
|
+
/>
|
|
820
|
+
<Dialog
|
|
821
|
+
open={!!previewFile && !isTextAttachment(previewFile)}
|
|
822
|
+
onOpenChange={(open) => !open && setPreviewFile(null)}
|
|
823
|
+
>
|
|
772
824
|
<Dialog.Portal>
|
|
773
825
|
<DialogOverlay opacity={0.5} />
|
|
774
826
|
<DialogContent maxWidth={800} maxHeight="80vh">
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FZ-9016, under tamagui's NATIVE build (vitest.native.config.mjs). The One
|
|
3
|
+
* Pokémon detail is LC-270's hero variant: the record's name heads the
|
|
4
|
+
* identity block and the bar takes it once it scrolls away (LC-157). On iOS
|
|
5
|
+
* the bar stayed empty however far the page scrolled. The record page renders
|
|
6
|
+
* its name before the record has one, and tamagui composes a component's ref
|
|
7
|
+
* once, on its first render, so a ref that joined later never reached the
|
|
8
|
+
* name: nothing was measured and the bar never collapsed. Web hid it by
|
|
9
|
+
* finding the node by its marker, which native has no DOM for.
|
|
10
|
+
*
|
|
11
|
+
* Scroll events are fed straight to the Screen's ScrollView handler, as the
|
|
12
|
+
* native ScrollView delivers them (MPO-368); measureLayout answers the way
|
|
13
|
+
* Fabric does, from the node it is called on.
|
|
14
|
+
*/
|
|
15
|
+
import { act, cleanup } from "@testing-library/react";
|
|
16
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
17
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
18
|
+
import { useEffect, useState, type ReactNode } from "react";
|
|
19
|
+
import { isWeb } from "tamagui";
|
|
20
|
+
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
|
21
|
+
import { H1 } from "../Heading";
|
|
22
|
+
import { PushedPage, Screen, ScreenToolbar } from "./page";
|
|
23
|
+
import { useLargeTitle } from "./screenScroll";
|
|
24
|
+
|
|
25
|
+
type ScrollHandler = (event: { nativeEvent: { contentOffset: { y: number } } }) => void;
|
|
26
|
+
|
|
27
|
+
const scroller: { onScroll?: ScrollHandler } = {};
|
|
28
|
+
|
|
29
|
+
vi.mock("../ScrollView", () => ({
|
|
30
|
+
ScrollView: ({ onScroll, children }: { onScroll?: ScrollHandler; children?: ReactNode }) => {
|
|
31
|
+
scroller.onScroll = onScroll;
|
|
32
|
+
return <div data-scroll-content="">{children}</div>;
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
/** The name's top and height in the Screen's content, as Fabric reports them. */
|
|
37
|
+
const NAME_TOP = 300;
|
|
38
|
+
const NAME_HEIGHT = 40;
|
|
39
|
+
const NAME_BOTTOM = NAME_TOP + NAME_HEIGHT;
|
|
40
|
+
const NAME = "Bulbasaur";
|
|
41
|
+
|
|
42
|
+
beforeAll(() => {
|
|
43
|
+
Object.defineProperty(HTMLElement.prototype, "measureLayout", {
|
|
44
|
+
configurable: true,
|
|
45
|
+
get() {
|
|
46
|
+
const self = this as HTMLElement;
|
|
47
|
+
return (_root: unknown, done: (x: number, y: number, w: number, h: number) => void) => {
|
|
48
|
+
if (self.textContent === NAME) done(0, NAME_TOP, 200, NAME_HEIGHT);
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
set() {},
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
afterEach(() => {
|
|
56
|
+
cleanup();
|
|
57
|
+
scroller.onScroll = undefined;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/** The record page's name, as frappe-ui's RecordLargeTitle draws it. */
|
|
61
|
+
function RecordName({ title }: { title: string }) {
|
|
62
|
+
const { knobProps } = useResolvedKnobs();
|
|
63
|
+
const largeTitle = useLargeTitle(title);
|
|
64
|
+
return (
|
|
65
|
+
<H1 margin={0} {...largeTitle} {...knobProps.pageTitle} {...knobProps.heading}>
|
|
66
|
+
{title}
|
|
67
|
+
</H1>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** A record page whose record arrives after its first render. */
|
|
72
|
+
function LoadingRecordName() {
|
|
73
|
+
const [title, setTitle] = useState("");
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const timer = setTimeout(() => setTitle(NAME), 10);
|
|
76
|
+
return () => clearTimeout(timer);
|
|
77
|
+
}, []);
|
|
78
|
+
return <RecordName title={title} />;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function renderHero(name: ReactNode) {
|
|
82
|
+
return renderWithProviders(
|
|
83
|
+
<PushedPage hero>
|
|
84
|
+
<Screen noPadding topBar={<ScreenToolbar leading={<span>Pokemon</span>} />}>
|
|
85
|
+
{name}
|
|
86
|
+
<div style={{ height: 2000 }} />
|
|
87
|
+
</Screen>
|
|
88
|
+
</PushedPage>,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function scrollTo(y: number) {
|
|
93
|
+
await act(async () => {
|
|
94
|
+
scroller.onScroll?.({ nativeEvent: { contentOffset: { y } } });
|
|
95
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Whether the bar shows the name: a copy outside the scroll content, painted. */
|
|
100
|
+
function barShowsName(container: HTMLElement): boolean {
|
|
101
|
+
return [...container.querySelectorAll("*")]
|
|
102
|
+
.filter((el) => el.children.length === 0 && el.textContent === NAME)
|
|
103
|
+
.filter((el) => !el.closest("[data-scroll-content]"))
|
|
104
|
+
.some((el) => (el.parentElement as HTMLElement).style.opacity !== "0");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
describe("LC-270 hero bar title on native (FZ-9016)", () => {
|
|
108
|
+
it("runs tamagui's native build", () => {
|
|
109
|
+
expect(isWeb).toBe(false);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("shows the name in the bar once it scrolls past the name's bottom edge", async () => {
|
|
113
|
+
const { container } = renderHero(<RecordName title={NAME} />);
|
|
114
|
+
await scrollTo(0);
|
|
115
|
+
expect(barShowsName(container)).toBe(false);
|
|
116
|
+
await scrollTo(NAME_BOTTOM + 10);
|
|
117
|
+
expect(barShowsName(container)).toBe(true);
|
|
118
|
+
await scrollTo(NAME_TOP);
|
|
119
|
+
expect(barShowsName(container)).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("shows it when the record's name arrives after the page's first render", async () => {
|
|
123
|
+
const { container } = renderHero(<LoadingRecordName />);
|
|
124
|
+
await act(async () => {
|
|
125
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
126
|
+
});
|
|
127
|
+
await scrollTo(0);
|
|
128
|
+
expect(barShowsName(container)).toBe(false);
|
|
129
|
+
await scrollTo(NAME_BOTTOM + 10);
|
|
130
|
+
expect(barShowsName(container)).toBe(true);
|
|
131
|
+
});
|
|
132
|
+
});
|
package/src/layouts/page.tsx
CHANGED
|
@@ -31,6 +31,16 @@ import {
|
|
|
31
31
|
useParentScreen,
|
|
32
32
|
usePageGutter,
|
|
33
33
|
useResolvedKnobs,
|
|
34
|
+
H1 as HouseH1,
|
|
35
|
+
H2 as HouseH2,
|
|
36
|
+
H3 as HouseH3,
|
|
37
|
+
H4 as HouseH4,
|
|
38
|
+
H5 as HouseH5,
|
|
39
|
+
H6 as HouseH6,
|
|
40
|
+
Heading as HouseHeading,
|
|
41
|
+
Paragraph as HouseParagraph,
|
|
42
|
+
SizableText as HouseSizableText,
|
|
43
|
+
Text as HouseText,
|
|
34
44
|
type PageTitleScale,
|
|
35
45
|
type ParentScreen,
|
|
36
46
|
} from "@multiplatform.one/theme";
|
|
@@ -41,7 +51,17 @@ import {
|
|
|
41
51
|
type ButtonProps,
|
|
42
52
|
} from "@multiplatform.one/forms";
|
|
43
53
|
import { CaretLeftIcon, CaretRightIcon, DotsThreeIcon } from "@phosphor-icons/react";
|
|
44
|
-
import {
|
|
54
|
+
import {
|
|
55
|
+
Children,
|
|
56
|
+
Fragment,
|
|
57
|
+
cloneElement,
|
|
58
|
+
createContext,
|
|
59
|
+
isValidElement,
|
|
60
|
+
useContext,
|
|
61
|
+
useState,
|
|
62
|
+
type ReactElement,
|
|
63
|
+
type ReactNode,
|
|
64
|
+
} from "react";
|
|
45
65
|
import { barTitleSpan, sideExtents } from "./barTitleSpan";
|
|
46
66
|
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
|
|
47
67
|
import type {
|
|
@@ -63,6 +83,7 @@ import {
|
|
|
63
83
|
XStack,
|
|
64
84
|
YStack,
|
|
65
85
|
isWeb,
|
|
86
|
+
styled,
|
|
66
87
|
} from "tamagui";
|
|
67
88
|
import { BottomChromeClearance } from "../appShell/BottomChromeClearance";
|
|
68
89
|
import { componentColors, sectionHeading } from "../componentColors";
|
|
@@ -814,6 +835,108 @@ function BarTitle({
|
|
|
814
835
|
);
|
|
815
836
|
}
|
|
816
837
|
|
|
838
|
+
const houseTextTypes = new Set<unknown>([
|
|
839
|
+
HouseText,
|
|
840
|
+
HouseSizableText,
|
|
841
|
+
HouseParagraph,
|
|
842
|
+
HouseHeading,
|
|
843
|
+
HouseH1,
|
|
844
|
+
HouseH2,
|
|
845
|
+
HouseH3,
|
|
846
|
+
HouseH4,
|
|
847
|
+
HouseH5,
|
|
848
|
+
HouseH6,
|
|
849
|
+
]);
|
|
850
|
+
|
|
851
|
+
function isTextElement(node: ReactNode): node is ReactElement<Record<string, unknown>> {
|
|
852
|
+
if (!isValidElement(node)) return false;
|
|
853
|
+
const type = node.type as { staticConfig?: { isText?: boolean } };
|
|
854
|
+
return houseTextTypes.has(node.type) || Boolean(type.staticConfig?.isText);
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/** LC-143: text in a bar's leading group keeps one line and gives way with an ellipsis. */
|
|
858
|
+
function oneLineText(node: ReactNode): ReactNode {
|
|
859
|
+
return Children.map(node, (child) => {
|
|
860
|
+
if (isValidElement<{ children?: ReactNode }>(child) && child.type === Fragment) {
|
|
861
|
+
return oneLineText(child.props.children);
|
|
862
|
+
}
|
|
863
|
+
if (!isTextElement(child)) return child;
|
|
864
|
+
const { numberOfLines, flexShrink, minWidth } = child.props;
|
|
865
|
+
return cloneElement(child, {
|
|
866
|
+
numberOfLines: numberOfLines ?? 1,
|
|
867
|
+
flexShrink: flexShrink ?? 1,
|
|
868
|
+
minWidth: minWidth ?? 0,
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
const TOOLBAR_LEADING_STYLE_ID = "mp-toolbar-leading-css";
|
|
874
|
+
|
|
875
|
+
// Text a consumer wraps in its own component never reaches oneLineText, so
|
|
876
|
+
// on the web the clip also truncates any Tamagui text directly inside it
|
|
877
|
+
// that has not asked for more than one line.
|
|
878
|
+
const toolbarLeadingCss = `[data-toolbar-leading-clip] > .is_Text:not([class*="_WebkitLineClamp-"]) {
|
|
879
|
+
min-width: 0;
|
|
880
|
+
flex-shrink: 1;
|
|
881
|
+
white-space: nowrap;
|
|
882
|
+
overflow: hidden;
|
|
883
|
+
text-overflow: ellipsis;
|
|
884
|
+
}`;
|
|
885
|
+
|
|
886
|
+
function ensureToolbarLeadingStyles() {
|
|
887
|
+
if (!isWeb || typeof document === "undefined") return;
|
|
888
|
+
if (document.getElementById(TOOLBAR_LEADING_STYLE_ID)) return;
|
|
889
|
+
const tag = document.createElement("style");
|
|
890
|
+
tag.id = TOOLBAR_LEADING_STYLE_ID;
|
|
891
|
+
tag.textContent = toolbarLeadingCss;
|
|
892
|
+
document.head.appendChild(tag);
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
const ToolbarLeadingClip = styled(XStack, {
|
|
896
|
+
name: "ToolbarLeadingClip",
|
|
897
|
+
alignItems: "center",
|
|
898
|
+
flexShrink: 1,
|
|
899
|
+
minWidth: 0,
|
|
900
|
+
overflow: "hidden",
|
|
901
|
+
});
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* The bar's leading group (FZ-9032). It gives way first when the row runs
|
|
905
|
+
* out, and what it holds stays inside it: text truncates on one line, other
|
|
906
|
+
* content is clipped. The clip reaches past the group's start, top and bottom
|
|
907
|
+
* by the bar's padding, so back's edge pull and focus rings still paint, and
|
|
908
|
+
* past its end by less than the bar's gap, so nothing reaches the trailing
|
|
909
|
+
* group.
|
|
910
|
+
*/
|
|
911
|
+
function ToolbarLeading({
|
|
912
|
+
children,
|
|
913
|
+
wrap,
|
|
914
|
+
reach,
|
|
915
|
+
...rest
|
|
916
|
+
}: { children: ReactNode; wrap: boolean; reach: string } & XStackProps) {
|
|
917
|
+
const { knobProps } = useResolvedKnobs({ component: "ScreenToolbar" });
|
|
918
|
+
ensureToolbarLeadingStyles();
|
|
919
|
+
const end = knobProps.gapSm.gap as "$2";
|
|
920
|
+
const start = reach as "$4";
|
|
921
|
+
return (
|
|
922
|
+
<XStack minWidth={0} alignItems="center" data-toolbar-leading="" {...rest}>
|
|
923
|
+
<ToolbarLeadingClip
|
|
924
|
+
{...knobProps.gap}
|
|
925
|
+
flexWrap={wrap ? "wrap" : "nowrap"}
|
|
926
|
+
marginVertical={negateSpaceToken(start) as "$-4"}
|
|
927
|
+
paddingVertical={start}
|
|
928
|
+
marginInlineStart={negateSpaceToken(start) as "$-4"}
|
|
929
|
+
paddingInlineStart={start}
|
|
930
|
+
marginInlineEnd={negateSpaceToken(end) as "$-2"}
|
|
931
|
+
paddingInlineEnd={end}
|
|
932
|
+
data-toolbar-leading-clip=""
|
|
933
|
+
>
|
|
934
|
+
{oneLineText(children)}
|
|
935
|
+
</ToolbarLeadingClip>
|
|
936
|
+
</XStack>
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
|
|
817
940
|
/**
|
|
818
941
|
* Minimal toolbar with leading/trailing slots. For the standard "back +
|
|
819
942
|
* primary action" pattern at the top of detail screens.
|
|
@@ -855,22 +978,21 @@ function InlineToolbar({ leading, trailing, title, children, ...rest }: ScreenTo
|
|
|
855
978
|
{...knobProps.gap}
|
|
856
979
|
{...rest}
|
|
857
980
|
>
|
|
858
|
-
<
|
|
859
|
-
{
|
|
860
|
-
alignItems="center"
|
|
861
|
-
flexWrap="wrap"
|
|
981
|
+
<ToolbarLeading
|
|
982
|
+
wrap={!oneRow}
|
|
862
983
|
// Shrink weight, not a size: the back label gives way before the actions wrap.
|
|
863
984
|
flexShrink={oneRow ? 1000 : 1}
|
|
864
|
-
|
|
985
|
+
reach={insetToken ?? knobProps.panelPadding.padding}
|
|
865
986
|
{...(title ? { onLayout: titleSpan.measureLeading } : null)}
|
|
866
987
|
>
|
|
867
988
|
{leading}
|
|
868
|
-
</
|
|
989
|
+
</ToolbarLeading>
|
|
869
990
|
{children}
|
|
870
991
|
<IconButtonGroup
|
|
871
992
|
{...knobProps.gap}
|
|
872
|
-
flexWrap="wrap"
|
|
873
|
-
|
|
993
|
+
flexWrap={oneRow ? "nowrap" : "wrap"}
|
|
994
|
+
// On one row the leading group gives way alone; the actions keep their width.
|
|
995
|
+
flexShrink={oneRow ? 0 : 1}
|
|
874
996
|
minWidth={0}
|
|
875
997
|
justifyContent="flex-end"
|
|
876
998
|
{...(title ? { onLayout: titleSpan.measureTrailing } : null)}
|
|
@@ -943,23 +1065,21 @@ function PinnedTopBar({
|
|
|
943
1065
|
{...knobProps.gap}
|
|
944
1066
|
{...rest}
|
|
945
1067
|
>
|
|
946
|
-
<
|
|
947
|
-
{
|
|
948
|
-
alignItems="center"
|
|
1068
|
+
<ToolbarLeading
|
|
1069
|
+
wrap={false}
|
|
949
1070
|
flexShrink={1000}
|
|
950
|
-
|
|
1071
|
+
reach={slot.inset ?? knobProps.panelPadding.padding}
|
|
951
1072
|
onLayout={titleSpan.measureLeading}
|
|
952
1073
|
>
|
|
953
1074
|
{leading}
|
|
954
|
-
</
|
|
1075
|
+
</ToolbarLeading>
|
|
955
1076
|
{children}
|
|
956
1077
|
{/* Pushes the actions to the trailing edge (LC-102: no space-between)
|
|
957
1078
|
without widening the leading group the bar title clears. */}
|
|
958
1079
|
<XStack flexGrow={1} />
|
|
959
1080
|
<IconButtonGroup
|
|
960
1081
|
{...knobProps.gap}
|
|
961
|
-
flexShrink={
|
|
962
|
-
minWidth={0}
|
|
1082
|
+
flexShrink={0}
|
|
963
1083
|
justifyContent="flex-end"
|
|
964
1084
|
onLayout={titleSpan.measureTrailing}
|
|
965
1085
|
>
|
|
@@ -205,28 +205,35 @@ export function useLargeTitle(title: string | undefined, enabled = true) {
|
|
|
205
205
|
return register(title);
|
|
206
206
|
}, [active, register, title]);
|
|
207
207
|
|
|
208
|
-
const measure = useCallback(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
208
|
+
const measure = useCallback(
|
|
209
|
+
(event?: { currentTarget?: unknown }) => {
|
|
210
|
+
const root = contentRoot?.current as Measurable | null | undefined;
|
|
211
|
+
const target = event?.currentTarget as Measurable | null | undefined;
|
|
212
|
+
if (!node.current && target?.measureLayout) node.current = target;
|
|
213
|
+
// On web a title rendered through a knob-aware heading (the record page's
|
|
214
|
+
// name) never received the ref callback, so it is found by its marker.
|
|
215
|
+
if (!node.current && isWeb && typeof document !== "undefined") {
|
|
216
|
+
node.current = document.querySelector(`[data-large-title="${uid}"]`) as Measurable | null;
|
|
217
|
+
}
|
|
218
|
+
if (!active || !node.current || !root || !setTitleBottom) return;
|
|
219
|
+
measureBottom(node.current, root, setTitleBottom);
|
|
220
|
+
},
|
|
221
|
+
[active, contentRoot, setTitleBottom, uid],
|
|
222
|
+
);
|
|
218
223
|
|
|
219
|
-
useLayoutEffect(measure, [measure]);
|
|
224
|
+
useLayoutEffect(() => measure(), [measure]);
|
|
220
225
|
// The Screen's content root attaches its ref after this child's layout
|
|
221
226
|
// effect has run, so the first measure finds no root; measure again once
|
|
222
|
-
// the commit has finished.
|
|
223
|
-
useEffect(measure, [measure]);
|
|
227
|
+
// the commit has finished. A new title unregisters the old one's edge.
|
|
228
|
+
useEffect(() => measure(), [measure, title]);
|
|
224
229
|
|
|
225
230
|
const ref = useCallback((value: unknown) => {
|
|
226
231
|
node.current = value as Measurable | null;
|
|
227
232
|
}, []);
|
|
228
233
|
|
|
229
|
-
|
|
234
|
+
// tamagui composes a component's ref once, on its first render, so the ref
|
|
235
|
+
// rides from the start even while the title is still empty (FZ-9016).
|
|
236
|
+
return active ? { ref, onLayout: measure, "data-large-title": uid } : { ref };
|
|
230
237
|
}
|
|
231
238
|
|
|
232
239
|
/**
|
package/src/layouts/tags.tsx
CHANGED
|
@@ -546,11 +546,12 @@ export function Tags({
|
|
|
546
546
|
backgroundColor={knobProps.inputBackground}
|
|
547
547
|
{...knobProps.inputSurface}
|
|
548
548
|
{...knobProps.borderRadius}
|
|
549
|
+
borderColor="$borderColorField"
|
|
549
550
|
overflow="hidden"
|
|
550
551
|
cursor={canAdd ? "text" : "default"}
|
|
551
552
|
{...(isWeb ? { className: "mp-composite-ring" } : {})}
|
|
552
553
|
outlineWidth={0}
|
|
553
|
-
hoverStyle={canAdd ? { borderColor: "$
|
|
554
|
+
hoverStyle={canAdd ? { borderColor: "$borderColorFieldHover" } : undefined}
|
|
554
555
|
focusStyle={{ outlineWidth: 0 }}
|
|
555
556
|
focusVisibleStyle={{ outlineWidth: 0 }}
|
|
556
557
|
{...(disabled
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FZ-9032: when a ScreenToolbar's row runs out, its leading group gives way
|
|
3
|
+
* first, and what it holds stays inside it. Single-line text truncates with
|
|
4
|
+
* an ellipsis (LC-143) and anything else is clipped at the group's edge, so
|
|
5
|
+
* nothing paints under the trailing group.
|
|
6
|
+
*
|
|
7
|
+
* happy-dom has no layout, so the spec reads the CSS that keeps the leading
|
|
8
|
+
* content's painted box inside the group's: the clip, the one-line text and
|
|
9
|
+
* an end reach shorter than the bar's gap. The 390pt box measurement lives
|
|
10
|
+
* on the card (Storybook `Components/ScreenToolbar → Long Leading On Phone`).
|
|
11
|
+
*/
|
|
12
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
13
|
+
import { Text } from "@multiplatform.one/theme";
|
|
14
|
+
import { cleanup, screen } from "@testing-library/react";
|
|
15
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
16
|
+
import { Screen, ScreenToolbar } from "./page";
|
|
17
|
+
|
|
18
|
+
const layout = vi.hoisted(() => ({ size: "compact" }));
|
|
19
|
+
vi.mock("@multiplatform.one/theme", async (original) => {
|
|
20
|
+
const actual = await original<typeof import("@multiplatform.one/theme")>();
|
|
21
|
+
return { ...actual, useLayoutSizeClass: () => layout.size };
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
layout.size = "compact";
|
|
26
|
+
cleanup();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const brand = "multiplatform.one and a much longer product name";
|
|
30
|
+
|
|
31
|
+
function bar() {
|
|
32
|
+
return (
|
|
33
|
+
<ScreenToolbar
|
|
34
|
+
leading={
|
|
35
|
+
<>
|
|
36
|
+
<Text>{brand}</Text>
|
|
37
|
+
<div data-testid="leading-tabs" style={{ width: 240 }}>
|
|
38
|
+
Home · Todos · Pokédex
|
|
39
|
+
</div>
|
|
40
|
+
</>
|
|
41
|
+
}
|
|
42
|
+
trailing={<div data-testid="trailing-actions" style={{ width: 200 }} />}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function leadingClip(node: HTMLElement) {
|
|
48
|
+
const clip = node.closest("[data-toolbar-leading-clip]") as HTMLElement | null;
|
|
49
|
+
expect(clip, "leading content sits in the clipped group").not.toBeNull();
|
|
50
|
+
return clip as HTMLElement;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function px(value: string) {
|
|
54
|
+
return Number.parseFloat(value) || 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The `$space` step a Tamagui atomic class sets for a prop: `_gap-t-space-3` → 3. */
|
|
58
|
+
function spaceStep(node: Element, prop: string) {
|
|
59
|
+
const match = node.className.match(new RegExp(`(?:^| )_${prop}-t-space-(-?\\d+)`));
|
|
60
|
+
return match ? Number(match[1]) : Number.NaN;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe("ScreenToolbar leading group stays in its box (FZ-9032)", () => {
|
|
64
|
+
it.each([
|
|
65
|
+
["inline", () => bar()],
|
|
66
|
+
["pinned", () => <Screen topBar={bar()}>body</Screen>],
|
|
67
|
+
])("clips the %s bar's leading content at its edge", (_name, render) => {
|
|
68
|
+
renderWithProviders(render());
|
|
69
|
+
const clip = leadingClip(screen.getByTestId("leading-tabs"));
|
|
70
|
+
expect(getComputedStyle(clip).overflowX).toBe("hidden");
|
|
71
|
+
expect(clip.contains(screen.getByTestId("trailing-actions"))).toBe(false);
|
|
72
|
+
|
|
73
|
+
const row = clip.closest("[data-toolbar-leading]")?.parentElement as HTMLElement;
|
|
74
|
+
const gap = spaceStep(row, "gap");
|
|
75
|
+
const reach = spaceStep(clip, "paddingInlineEnd");
|
|
76
|
+
expect(spaceStep(clip, "marginInlineEnd"), "the clip reaches past the group's end").toBe(
|
|
77
|
+
-reach,
|
|
78
|
+
);
|
|
79
|
+
expect(reach, "but stops short of the trailing group").toBeLessThan(gap);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("keeps leading text on one line with an ellipsis (LC-143)", () => {
|
|
83
|
+
renderWithProviders(bar());
|
|
84
|
+
const text = screen.getByText(brand);
|
|
85
|
+
const style = getComputedStyle(text);
|
|
86
|
+
expect(style.whiteSpace).toBe("nowrap");
|
|
87
|
+
expect(style.textOverflow).toBe("ellipsis");
|
|
88
|
+
expect(px(style.minWidth)).toBe(0);
|
|
89
|
+
expect(style.flexShrink).toBe("1");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("keeps text a consumer wraps in its own component on one line", () => {
|
|
93
|
+
function Brand() {
|
|
94
|
+
return <Text>{brand}</Text>;
|
|
95
|
+
}
|
|
96
|
+
renderWithProviders(
|
|
97
|
+
<ScreenToolbar leading={<Brand />} trailing={<div style={{ width: 200 }} />} />,
|
|
98
|
+
);
|
|
99
|
+
const style = getComputedStyle(screen.getByText(brand));
|
|
100
|
+
expect(style.whiteSpace).toBe("nowrap");
|
|
101
|
+
expect(style.textOverflow).toBe("ellipsis");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("keeps the trailing actions' width on a one-row bar", () => {
|
|
105
|
+
renderWithProviders(bar());
|
|
106
|
+
const trailing = screen.getByTestId("trailing-actions").parentElement as HTMLElement;
|
|
107
|
+
expect(getComputedStyle(trailing).flexShrink).toBe("0");
|
|
108
|
+
expect(getComputedStyle(trailing).flexWrap).not.toBe("wrap");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("leaves a consumer's own line count alone", () => {
|
|
112
|
+
renderWithProviders(
|
|
113
|
+
<ScreenToolbar
|
|
114
|
+
leading={<Text numberOfLines={2}>{brand}</Text>}
|
|
115
|
+
trailing={<div style={{ width: 200 }} />}
|
|
116
|
+
/>,
|
|
117
|
+
);
|
|
118
|
+
expect(getComputedStyle(screen.getByText(brand)).whiteSpace).not.toBe("nowrap");
|
|
119
|
+
});
|
|
120
|
+
});
|