@multiplatform.one/components 7.69.2 → 7.71.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/dist/cjs/DotIndicator/index.cjs +21 -11
- package/dist/cjs/DotIndicator/index.native.js +21 -11
- package/dist/cjs/DotIndicator/index.native.js.map +1 -1
- package/dist/cjs/Pagination.cjs +12 -5
- package/dist/cjs/Pagination.native.js +12 -5
- package/dist/cjs/Pagination.native.js.map +1 -1
- package/dist/cjs/Tabs/index.cjs +5 -5
- package/dist/cjs/Tabs/index.native.js +5 -5
- package/dist/cjs/Tabs/index.native.js.map +1 -1
- package/dist/cjs/appShell/index.cjs +1 -3
- package/dist/cjs/appShell/index.native.js +0 -2
- package/dist/cjs/appShell/index.native.js.map +1 -1
- package/dist/cjs/componentColors.cjs +3 -3
- package/dist/cjs/componentColors.native.js +3 -3
- package/dist/cjs/layouts/ViewSwitcher.cjs +6 -11
- package/dist/cjs/layouts/ViewSwitcher.native.js +6 -11
- package/dist/cjs/layouts/ViewSwitcher.native.js.map +1 -1
- package/dist/cjs/layouts/bottomAccessory.cjs +173 -0
- package/dist/cjs/layouts/bottomAccessory.native.js +225 -0
- package/dist/cjs/layouts/bottomAccessory.native.js.map +1 -0
- package/dist/cjs/{appShell/BottomAccessory.cjs → layouts/bottomSafeArea.cjs} +12 -14
- package/dist/cjs/layouts/bottomSafeArea.native.js +75 -0
- package/dist/cjs/layouts/bottomSafeArea.native.js.map +1 -0
- package/dist/cjs/layouts/index.cjs +2 -0
- package/dist/cjs/layouts/index.native.js +2 -0
- package/dist/cjs/layouts/index.native.js.map +1 -1
- package/dist/cjs/layouts/page.cjs +16 -5
- package/dist/cjs/layouts/page.native.js +16 -5
- package/dist/cjs/layouts/page.native.js.map +1 -1
- package/dist/cjs/layouts/screenScroll.cjs +44 -0
- package/dist/cjs/layouts/screenScroll.native.js +52 -0
- package/dist/cjs/layouts/screenScroll.native.js.map +1 -1
- package/dist/esm/DotIndicator/index.mjs +21 -11
- package/dist/esm/DotIndicator/index.mjs.map +1 -1
- package/dist/esm/DotIndicator/index.native.js +21 -11
- package/dist/esm/DotIndicator/index.native.js.map +1 -1
- package/dist/esm/Pagination.mjs +12 -5
- package/dist/esm/Pagination.mjs.map +1 -1
- package/dist/esm/Pagination.native.js +12 -5
- package/dist/esm/Pagination.native.js.map +1 -1
- package/dist/esm/Tabs/index.mjs +5 -5
- package/dist/esm/Tabs/index.mjs.map +1 -1
- package/dist/esm/Tabs/index.native.js +5 -5
- package/dist/esm/Tabs/index.native.js.map +1 -1
- package/dist/esm/appShell/index.mjs +1 -2
- package/dist/esm/appShell/index.mjs.map +1 -1
- package/dist/esm/appShell/index.native.js +1 -2
- package/dist/esm/appShell/index.native.js.map +1 -1
- package/dist/esm/componentColors.mjs +3 -3
- package/dist/esm/componentColors.native.js +3 -3
- package/dist/esm/layouts/ViewSwitcher.mjs +6 -11
- package/dist/esm/layouts/ViewSwitcher.mjs.map +1 -1
- package/dist/esm/layouts/ViewSwitcher.native.js +6 -11
- package/dist/esm/layouts/ViewSwitcher.native.js.map +1 -1
- package/dist/esm/layouts/bottomAccessory.mjs +144 -0
- package/dist/esm/layouts/bottomAccessory.mjs.map +1 -0
- package/dist/esm/layouts/bottomAccessory.native.js +193 -0
- package/dist/esm/layouts/bottomAccessory.native.js.map +1 -0
- package/dist/esm/layouts/bottomSafeArea.mjs +16 -0
- package/dist/esm/layouts/bottomSafeArea.mjs.map +1 -0
- package/dist/esm/layouts/bottomSafeArea.native.js +47 -0
- package/dist/esm/layouts/bottomSafeArea.native.js.map +1 -0
- package/dist/esm/layouts/index.mjs +2 -0
- package/dist/esm/layouts/index.mjs.map +1 -1
- package/dist/esm/layouts/index.native.js +2 -0
- package/dist/esm/layouts/index.native.js.map +1 -1
- package/dist/esm/layouts/page.mjs +16 -5
- package/dist/esm/layouts/page.mjs.map +1 -1
- package/dist/esm/layouts/page.native.js +16 -5
- package/dist/esm/layouts/page.native.js.map +1 -1
- package/dist/esm/layouts/screenScroll.mjs +43 -1
- package/dist/esm/layouts/screenScroll.mjs.map +1 -1
- package/dist/esm/layouts/screenScroll.native.js +51 -1
- package/dist/esm/layouts/screenScroll.native.js.map +1 -1
- package/dist/jsx/Accordion/index.native.js.map +1 -1
- package/dist/jsx/Alert/index.native.js.map +1 -1
- package/dist/jsx/AnimateHeight/index.native.js.map +1 -1
- package/dist/jsx/Avatar/getInitials.native.js.map +1 -1
- package/dist/jsx/Avatar/index.native.js.map +1 -1
- package/dist/jsx/Badge/index.native.js.map +1 -1
- package/dist/jsx/Button.native.js.map +1 -1
- package/dist/jsx/Card.native.js.map +1 -1
- package/dist/jsx/CardFooter.native.js.map +1 -1
- package/dist/jsx/CardHeader.native.js.map +1 -1
- package/dist/jsx/Carousel/index.native.js.map +1 -1
- package/dist/jsx/Chip/index.native.js.map +1 -1
- package/dist/jsx/Collapsible.native.js.map +1 -1
- package/dist/jsx/ContextMenu/index.native.js.map +1 -1
- package/dist/jsx/CopyField/index.native.js.map +1 -1
- package/dist/jsx/Dialog.native.js.map +1 -1
- package/dist/jsx/DotIndicator/index.mjs +21 -11
- package/dist/jsx/DotIndicator/index.mjs.map +1 -1
- package/dist/jsx/DotIndicator/index.native.js +21 -11
- package/dist/jsx/DotIndicator/index.native.js.map +1 -1
- package/dist/jsx/DropdownMenu/index.native.js.map +1 -1
- package/dist/jsx/DropdownMenu/menuSettle.native.js.map +1 -1
- package/dist/jsx/ErrorBoundary/index.native.js.map +1 -1
- package/dist/jsx/Heading.native.js.map +1 -1
- package/dist/jsx/Kbd/index.native.js.map +1 -1
- package/dist/jsx/Kbd/keys.native.js.map +1 -1
- package/dist/jsx/Lightbox/MediaControl.native.js.map +1 -1
- package/dist/jsx/Lightbox/index.gnome.native.js.map +1 -1
- package/dist/jsx/Lightbox/shared.native.js.map +1 -1
- package/dist/jsx/Lightbox/useLightbox.native.js.map +1 -1
- package/dist/jsx/Material/index.native.js.map +1 -1
- package/dist/jsx/Meter/index.native.js.map +1 -1
- package/dist/jsx/Meter/meter.native.js.map +1 -1
- package/dist/jsx/OverflowRow/index.native.js.map +1 -1
- package/dist/jsx/Pagination.mjs +12 -5
- package/dist/jsx/Pagination.mjs.map +1 -1
- package/dist/jsx/Pagination.native.js +12 -5
- package/dist/jsx/Pagination.native.js.map +1 -1
- package/dist/jsx/Popover.native.js.map +1 -1
- package/dist/jsx/ProgressSteps/index.native.js.map +1 -1
- package/dist/jsx/Quote/index.native.js.map +1 -1
- package/dist/jsx/SchemeToggle/index.native.js.map +1 -1
- package/dist/jsx/ScrollView/revealFocusedField.native.js.map +1 -1
- package/dist/jsx/Separator/index.native.js.map +1 -1
- package/dist/jsx/Sheet.native.js.map +1 -1
- package/dist/jsx/SheetModal/SheetHeader.native.js.map +1 -1
- package/dist/jsx/SheetModal/SheetNavigation.native.js.map +1 -1
- package/dist/jsx/SheetModal/detents.native.js.map +1 -1
- package/dist/jsx/SheetModal/useSheetFrameFocus.native.js.map +1 -1
- package/dist/jsx/Skeleton/index.native.js.map +1 -1
- package/dist/jsx/SkipLink/index.native.js.map +1 -1
- package/dist/jsx/SortableList/SortableHandle.native.js.map +1 -1
- package/dist/jsx/SortableList/index.native.js.map +1 -1
- package/dist/jsx/SortableList/useSortableRows.native.js.map +1 -1
- package/dist/jsx/Tabs/index.mjs +5 -5
- package/dist/jsx/Tabs/index.mjs.map +1 -1
- package/dist/jsx/Tabs/index.native.js +5 -5
- package/dist/jsx/Tabs/index.native.js.map +1 -1
- package/dist/jsx/Text.native.js.map +1 -1
- package/dist/jsx/ThemePresetPicker/index.native.js.map +1 -1
- package/dist/jsx/Toast/index.native.js.map +1 -1
- package/dist/jsx/Toast/store.native.js.map +1 -1
- package/dist/jsx/Tooltip/nativePress.native.js.map +1 -1
- package/dist/jsx/Tooltip/tooltipShared.native.js.map +1 -1
- package/dist/jsx/TreeSelect/index.native.js.map +1 -1
- package/dist/jsx/TreeSelect/treeSelectModel.native.js.map +1 -1
- package/dist/jsx/Video/PlayerChrome.native.js.map +1 -1
- package/dist/jsx/Video/VideoFrame.native.js.map +1 -1
- package/dist/jsx/Video/types.native.js.map +1 -1
- package/dist/jsx/Wheel/index.native.js.map +1 -1
- package/dist/jsx/Wizard/index.native.js.map +1 -1
- package/dist/jsx/actions/ActionBar.native.js.map +1 -1
- package/dist/jsx/actions/DangerSection.native.js.map +1 -1
- package/dist/jsx/actions/DestructiveAction.native.js.map +1 -1
- package/dist/jsx/actions/HeaderActions.native.js.map +1 -1
- package/dist/jsx/actions/StandardAction.native.js.map +1 -1
- package/dist/jsx/actions/devWarn.native.js.map +1 -1
- package/dist/jsx/actions/index.native.js.map +1 -1
- package/dist/jsx/actions/severity.native.js.map +1 -1
- package/dist/jsx/appShell/Dock.native.js.map +1 -1
- package/dist/jsx/appShell/MpoTabHost.native.js.map +1 -1
- package/dist/jsx/appShell/ScopeMenu.native.js.map +1 -1
- package/dist/jsx/appShell/SettingsSplit.native.js.map +1 -1
- package/dist/jsx/appShell/Springboard.native.js.map +1 -1
- package/dist/jsx/appShell/SystemBar.native.js.map +1 -1
- package/dist/jsx/appShell/TabBar.native.js.map +1 -1
- package/dist/jsx/appShell/appTile.native.js.map +1 -1
- package/dist/jsx/appShell/bottomChrome.native.js.map +1 -1
- package/dist/jsx/appShell/index.mjs +1 -2
- package/dist/jsx/appShell/index.mjs.map +1 -1
- package/dist/jsx/appShell/index.native.js +0 -2
- package/dist/jsx/appShell/index.native.js.map +1 -1
- package/dist/jsx/charts/Axis.native.js.map +1 -1
- package/dist/jsx/charts/BarChart.native.js.map +1 -1
- package/dist/jsx/charts/ChartDataView.native.js.map +1 -1
- package/dist/jsx/charts/ChartSurface.native.js.map +1 -1
- package/dist/jsx/charts/LineChart.native.js.map +1 -1
- package/dist/jsx/charts/PieChart.native.js.map +1 -1
- package/dist/jsx/charts/Sparkline.native.js.map +1 -1
- package/dist/jsx/charts/accessibility.native.js.map +1 -1
- package/dist/jsx/charts/chartHeight.native.js.map +1 -1
- package/dist/jsx/charts/composeChart.native.js.map +1 -1
- package/dist/jsx/charts/index.native.js.map +1 -1
- package/dist/jsx/charts/math.native.js.map +1 -1
- package/dist/jsx/charts/series.native.js.map +1 -1
- package/dist/jsx/charts/svg.native.js.map +1 -1
- package/dist/jsx/charts/types.native.js.map +1 -1
- package/dist/jsx/charts/useChartTheme.native.js.map +1 -1
- package/dist/jsx/code/Code/index.native.js.map +1 -1
- package/dist/jsx/code/CodeBlock/index.native.js.map +1 -1
- package/dist/jsx/code/HighlightedCode/index.native.js.map +1 -1
- package/dist/jsx/code/Highlighter/houseSyntaxTheme.native.js.map +1 -1
- package/dist/jsx/code/Highlighter/index.native.js.map +1 -1
- package/dist/jsx/code/Highlighter/namedGroupMatchAll.native.js.map +1 -1
- package/dist/jsx/code/Pre/index.native.js.map +1 -1
- package/dist/jsx/code/index.native.js.map +1 -1
- package/dist/jsx/componentColors.mjs +3 -3
- package/dist/jsx/componentColors.native.js +3 -3
- package/dist/jsx/componentColors.native.js.map +1 -1
- package/dist/jsx/feedback/ConfirmDialog.native.js.map +1 -1
- package/dist/jsx/feedback/NotifyHost.native.js +1 -1
- package/dist/jsx/feedback/NotifyHost.native.js.map +1 -1
- package/dist/jsx/feedback/copy.native.js.map +1 -1
- package/dist/jsx/feedback/index.native.js.map +1 -1
- package/dist/jsx/feedback/notify.native.js.map +1 -1
- package/dist/jsx/feedback/route.native.js.map +1 -1
- package/dist/jsx/feedback/store.native.js.map +1 -1
- package/dist/jsx/formLayouts/FormLayouts.native.js.map +1 -1
- package/dist/jsx/formLayouts/PreferencePanel.native.js +1 -1
- package/dist/jsx/formLayouts/PreferencePanel.native.js.map +1 -1
- package/dist/jsx/formLayouts/index.native.js.map +1 -1
- package/dist/jsx/hooks/index.native.js.map +1 -1
- package/dist/jsx/hooks/useClipboard.native.js.map +1 -1
- package/dist/jsx/hooks/useDocumentTitle.native.js.map +1 -1
- package/dist/jsx/hooks/useHoldCue.native.js.map +1 -1
- package/dist/jsx/icons/CheckRegular.native.js.map +1 -1
- package/dist/jsx/icons/MinusRegular.native.js.map +1 -1
- package/dist/jsx/icons/index.native.js.map +1 -1
- package/dist/jsx/icons/lucide.native.js.map +1 -1
- package/dist/jsx/icons/themed.native.js.map +1 -1
- package/dist/jsx/images/Image/ImageFrame.native.js.map +1 -1
- package/dist/jsx/images/Image/framing.native.js.map +1 -1
- package/dist/jsx/images/Image/mediaRadius.native.js.map +1 -1
- package/dist/jsx/images/Image/shared.native.js.map +1 -1
- package/dist/jsx/images/Image/types.native.js.map +1 -1
- package/dist/jsx/images/index.native.js.map +1 -1
- package/dist/jsx/index.native.js +1 -1
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/knobImmuneExports.native.js.map +1 -1
- package/dist/jsx/layouts/AsyncBoundary.native.js +1 -1
- package/dist/jsx/layouts/AsyncBoundary.native.js.map +1 -1
- package/dist/jsx/layouts/Debug/index.native.js.map +1 -1
- package/dist/jsx/layouts/EmptyState.native.js.map +1 -1
- package/dist/jsx/layouts/IdentityPlate.native.js.map +1 -1
- package/dist/jsx/layouts/KeyboardAvoidingWrapper/behavior.native.js.map +1 -1
- package/dist/jsx/layouts/PageTemplates.native.js.map +1 -1
- package/dist/jsx/layouts/PaneScaffold.native.js.map +1 -1
- package/dist/jsx/layouts/SafeAreaWrapper/insets.native.js.map +1 -1
- package/dist/jsx/layouts/StatusDot.native.js.map +1 -1
- package/dist/jsx/layouts/ViewSwitcher.mjs +6 -11
- package/dist/jsx/layouts/ViewSwitcher.mjs.map +1 -1
- package/dist/jsx/layouts/ViewSwitcher.native.js +6 -11
- package/dist/jsx/layouts/ViewSwitcher.native.js.map +1 -1
- package/dist/jsx/layouts/attachments.native.js.map +1 -1
- package/dist/jsx/layouts/bottomAccessory.mjs +144 -0
- package/dist/jsx/layouts/bottomAccessory.mjs.map +1 -0
- package/dist/jsx/layouts/bottomAccessory.native.js +225 -0
- package/dist/jsx/layouts/bottomAccessory.native.js.map +1 -0
- package/dist/jsx/layouts/bottomSafeArea.mjs +16 -0
- package/dist/jsx/layouts/bottomSafeArea.mjs.map +1 -0
- package/dist/jsx/layouts/bottomSafeArea.native.js +75 -0
- package/dist/jsx/layouts/bottomSafeArea.native.js.map +1 -0
- package/dist/jsx/layouts/breadcrumbs.native.js.map +1 -1
- package/dist/jsx/layouts/index.mjs +2 -0
- package/dist/jsx/layouts/index.mjs.map +1 -1
- package/dist/jsx/layouts/index.native.js +2 -0
- package/dist/jsx/layouts/index.native.js.map +1 -1
- package/dist/jsx/layouts/page.mjs +16 -5
- package/dist/jsx/layouts/page.mjs.map +1 -1
- package/dist/jsx/layouts/page.native.js +16 -5
- package/dist/jsx/layouts/page.native.js.map +1 -1
- package/dist/jsx/layouts/pageHeadingScope.native.js.map +1 -1
- package/dist/jsx/layouts/screenScroll.mjs +43 -1
- package/dist/jsx/layouts/screenScroll.mjs.map +1 -1
- package/dist/jsx/layouts/screenScroll.native.js +52 -0
- package/dist/jsx/layouts/screenScroll.native.js.map +1 -1
- package/dist/jsx/layouts/shellSidebarSlot.native.js.map +1 -1
- package/dist/jsx/layouts/sidebar.native.js.map +1 -1
- package/dist/jsx/layouts/tags.native.js.map +1 -1
- package/dist/jsx/layouts/timeline.native.js.map +1 -1
- package/dist/jsx/layouts/toolbar.native.js.map +1 -1
- package/dist/jsx/shared/actionScan.native.js.map +1 -1
- package/dist/jsx/shared/i18n.native.js.map +1 -1
- package/dist/jsx/shared/restoreRetries.native.js.map +1 -1
- package/dist/jsx/shared/t.native.js.map +1 -1
- package/dist/jsx/shared/textRidesText.native.js.map +1 -1
- package/dist/jsx/shared/useReturnFocusOnClose.native.js.map +1 -1
- package/dist/jsx/surfaces.native.js.map +1 -1
- package/dist/jsx/tamagui.native.js.map +1 -1
- package/dist/jsx/testSetup.native.js.map +1 -1
- package/dist/jsx/utils/setTinted.native.js.map +1 -1
- package/dist/jsx/utils/unwrapText.native.js.map +1 -1
- package/dist/jsx/views/Calendar.native.js.map +1 -1
- package/dist/jsx/views/Dashboard.native.js.map +1 -1
- package/dist/jsx/views/Gantt.native.js.map +1 -1
- package/dist/jsx/views/GanttDateGrip.native.js.map +1 -1
- package/dist/jsx/views/ImageGrid.native.js.map +1 -1
- package/dist/jsx/views/List.native.js.map +1 -1
- package/dist/jsx/views/ListGroup.native.js.map +1 -1
- package/dist/jsx/views/ListRow.native.js.map +1 -1
- package/dist/jsx/views/Matrix.native.js.map +1 -1
- package/dist/jsx/views/ReportBuilder.native.js.map +1 -1
- package/dist/jsx/views/ShortcutCard.native.js.map +1 -1
- package/dist/jsx/views/TreeView.native.js.map +1 -1
- package/dist/jsx/views/calendarMath.native.js.map +1 -1
- package/dist/jsx/views/ganttIntervals.native.js.map +1 -1
- package/dist/jsx/views/ganttMath.native.js.map +1 -1
- package/dist/jsx/views/index.native.js.map +1 -1
- package/dist/jsx/views/kanbanDnd.native.js.map +1 -1
- package/dist/jsx/views/matrixMath.native.js.map +1 -1
- package/dist/jsx/views/treeViewDnd.native.js.map +1 -1
- package/dist/jsx/views/treeViewLayout.native.js.map +1 -1
- package/dist/jsx/views/treeViewMotion.native.js.map +1 -1
- package/dist/jsx/views/treeViewReveal.native.js.map +1 -1
- package/dist/jsx/views/widgetChrome.native.js.map +1 -1
- package/package.json +9 -9
- package/src/DotIndicator/index.tsx +52 -12
- package/src/DotIndicator/pageControl.spec.tsx +105 -0
- package/src/Pagination.stories.tsx +23 -0
- package/src/Pagination.tsx +17 -5
- package/src/Tabs/Tabs.bandColor.spec.tsx +19 -8
- package/src/Tabs/Tabs.measurement.spec.tsx +11 -14
- package/src/Tabs/Tabs.native.spec.tsx +10 -3
- package/src/Tabs/index.tsx +5 -5
- package/src/accentControls.spec.tsx +190 -0
- package/src/appShell/TabBar.spec.tsx +1 -1
- package/src/appShell/index.ts +0 -1
- package/src/componentColors.ts +3 -3
- package/src/icons/slots.nativeInk.spec.tsx +2 -1
- package/src/layouts/ViewSwitcher.spec.tsx +12 -12
- package/src/layouts/ViewSwitcher.tsx +6 -7
- package/src/layouts/bottomAccessory.spec.tsx +147 -0
- package/src/layouts/bottomAccessory.tsx +206 -0
- package/src/layouts/bottomSafeArea.native.tsx +43 -0
- package/src/layouts/bottomSafeArea.tsx +13 -0
- package/src/layouts/index.tsx +2 -0
- package/src/layouts/layouts.spec.tsx +6 -9
- package/src/layouts/page.tsx +31 -12
- package/src/layouts/revealTop.spec.tsx +77 -0
- package/src/layouts/screenScroll.tsx +67 -1
- package/types/Collapsible.d.ts +1 -1
- package/types/DotIndicator/index.d.ts +18 -4
- package/types/DotIndicator/index.d.ts.map +1 -1
- package/types/Pagination.d.ts +7 -1
- package/types/Pagination.d.ts.map +1 -1
- package/types/Tabs/index.d.ts.map +1 -1
- package/types/appShell/index.d.ts +0 -1
- package/types/appShell/index.d.ts.map +1 -1
- package/types/componentColors.d.ts +3 -3
- package/types/layouts/ViewSwitcher.d.ts.map +1 -1
- package/types/layouts/bottomAccessory.d.ts +54 -0
- package/types/layouts/bottomAccessory.d.ts.map +1 -0
- package/types/layouts/bottomSafeArea.d.ts +6 -0
- package/types/layouts/bottomSafeArea.d.ts.map +1 -0
- package/types/layouts/bottomSafeArea.native.d.ts +15 -0
- package/types/layouts/bottomSafeArea.native.d.ts.map +1 -0
- package/types/layouts/index.d.ts +2 -0
- package/types/layouts/index.d.ts.map +1 -1
- package/types/layouts/page.d.ts +8 -0
- package/types/layouts/page.d.ts.map +1 -1
- package/types/layouts/screenScroll.d.ts +24 -0
- package/types/layouts/screenScroll.d.ts.map +1 -1
- package/dist/cjs/appShell/BottomAccessory.native.js +0 -53
- package/dist/cjs/appShell/BottomAccessory.native.js.map +0 -1
- package/dist/esm/appShell/BottomAccessory.mjs +0 -18
- package/dist/esm/appShell/BottomAccessory.mjs.map +0 -1
- package/dist/esm/appShell/BottomAccessory.native.js +0 -25
- package/dist/esm/appShell/BottomAccessory.native.js.map +0 -1
- package/dist/jsx/appShell/BottomAccessory.mjs +0 -18
- package/dist/jsx/appShell/BottomAccessory.mjs.map +0 -1
- package/dist/jsx/appShell/BottomAccessory.native.js +0 -53
- package/dist/jsx/appShell/BottomAccessory.native.js.map +0 -1
- package/src/appShell/BottomAccessory.tsx +0 -18
- package/types/appShell/BottomAccessory.d.ts +0 -11
- package/types/appShell/BottomAccessory.d.ts.map +0 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-172 FILL-CONTRAST, FZ-7970: every filled or selected control takes its
|
|
3
|
+
* colour from the active theme's accent, so switching a preset's accent
|
|
4
|
+
* changes every one of their fills. Each control paints an accent token (never
|
|
5
|
+
* a neutral ramp step or a literal), and the tokens resolve to a different
|
|
6
|
+
* hue in each colour theme.
|
|
7
|
+
*/
|
|
8
|
+
import { render } from "@testing-library/react";
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
Checkbox,
|
|
12
|
+
Progress,
|
|
13
|
+
RadioGroup,
|
|
14
|
+
Slider,
|
|
15
|
+
Switch,
|
|
16
|
+
ToggleGroup,
|
|
17
|
+
} from "@multiplatform.one/forms";
|
|
18
|
+
import {
|
|
19
|
+
createThemesBuilder,
|
|
20
|
+
defaultAccentTheme,
|
|
21
|
+
defaultBaseTheme,
|
|
22
|
+
defaultBuilderOptions,
|
|
23
|
+
normalizeToHex,
|
|
24
|
+
} from "@multiplatform.one/theme";
|
|
25
|
+
import { configWithoutAnimations } from "@tamagui/config";
|
|
26
|
+
import { animationsCSS } from "@tamagui/config/v5-css";
|
|
27
|
+
import type { ReactNode } from "react";
|
|
28
|
+
import { TamaguiProvider, Theme, createTamagui } from "tamagui";
|
|
29
|
+
import { describe, expect, it } from "vitest";
|
|
30
|
+
import { Tabs } from "./Tabs";
|
|
31
|
+
import { ViewSwitcher } from "./layouts/ViewSwitcher";
|
|
32
|
+
|
|
33
|
+
const houseThemes = createThemesBuilder(
|
|
34
|
+
defaultBaseTheme,
|
|
35
|
+
defaultAccentTheme,
|
|
36
|
+
defaultBuilderOptions,
|
|
37
|
+
).themes() as Record<string, Record<string, string>>;
|
|
38
|
+
const houseConfig = createTamagui({
|
|
39
|
+
...configWithoutAnimations,
|
|
40
|
+
animations: animationsCSS,
|
|
41
|
+
themes: houseThemes as any,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Tamagui names a token class by its first 11 characters plus a hash.
|
|
45
|
+
const accentClass = /_(bg|btc|col)-(accentBackg|accentColor|selectedBac|selectedCol)/;
|
|
46
|
+
|
|
47
|
+
function renderUnder(hue: string, element: ReactNode) {
|
|
48
|
+
return render(
|
|
49
|
+
<TamaguiProvider config={houseConfig} defaultTheme="light" disableInjectCSS>
|
|
50
|
+
<Theme name={hue as "blue"}>{element}</Theme>
|
|
51
|
+
</TamaguiProvider>,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function toHex(raw: string | null | undefined): string | null {
|
|
56
|
+
if (!raw) return null;
|
|
57
|
+
const rgb = raw.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
|
|
58
|
+
if (rgb)
|
|
59
|
+
return `#${rgb
|
|
60
|
+
.slice(1, 4)
|
|
61
|
+
.map((n) => Number(n).toString(16).padStart(2, "0"))
|
|
62
|
+
.join("")}`;
|
|
63
|
+
return normalizeToHex(raw);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The background an element paints: its inline style, else its atomic class's injected rule. */
|
|
67
|
+
function paintedBackground(el: HTMLElement): string | null {
|
|
68
|
+
if (el.style.backgroundColor) return toHex(el.style.backgroundColor);
|
|
69
|
+
const cls = Array.from(el.classList).find(
|
|
70
|
+
(c) => c.startsWith("_bg-") && !/^_bg-0(hover|press|active|focus|disabled)/.test(c),
|
|
71
|
+
);
|
|
72
|
+
if (!cls) return null;
|
|
73
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
74
|
+
for (const rule of Array.from(sheet.cssRules)) {
|
|
75
|
+
if (rule instanceof CSSStyleRule && rule.selectorText.endsWith(`.${cls}`)) {
|
|
76
|
+
const value = rule.style.getPropertyValue("background-color");
|
|
77
|
+
if (value) return toHex(value.trim());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function paintsAccent(root: Element): boolean {
|
|
85
|
+
return [root, ...root.querySelectorAll("*")].some((el) =>
|
|
86
|
+
accentClass.test((el as HTMLElement).className?.toString() ?? ""),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const controls: [string, ReactNode, (root: HTMLElement, hue: string) => boolean][] = [
|
|
91
|
+
["Switch on track", <Switch key="s" label="On" name="on" defaultValue />, paintsAccent],
|
|
92
|
+
["Checkbox checked", <Checkbox key="c" label="On" name="c" checked />, paintsAccent],
|
|
93
|
+
[
|
|
94
|
+
"Radio selected",
|
|
95
|
+
<RadioGroup
|
|
96
|
+
key="r"
|
|
97
|
+
label="Pick"
|
|
98
|
+
value="a"
|
|
99
|
+
options={[
|
|
100
|
+
{ label: "A", value: "a" },
|
|
101
|
+
{ label: "B", value: "b" },
|
|
102
|
+
]}
|
|
103
|
+
/>,
|
|
104
|
+
paintsAccent,
|
|
105
|
+
],
|
|
106
|
+
["Progress fill", <Progress key="p" label="Done" value={50} />, paintsAccent],
|
|
107
|
+
[
|
|
108
|
+
"Primary Button",
|
|
109
|
+
<Button key="b" accent>
|
|
110
|
+
Save
|
|
111
|
+
</Button>,
|
|
112
|
+
(root, hue) => Boolean(root.querySelector(`.t_${hue}_accent`)?.textContent?.includes("Save")),
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
"Selected segment",
|
|
116
|
+
<ToggleGroup
|
|
117
|
+
key="t"
|
|
118
|
+
label="Align"
|
|
119
|
+
defaultValue="left"
|
|
120
|
+
options={[
|
|
121
|
+
{ label: "Left", value: "left" },
|
|
122
|
+
{ label: "Right", value: "right" },
|
|
123
|
+
]}
|
|
124
|
+
/>,
|
|
125
|
+
paintsAccent,
|
|
126
|
+
],
|
|
127
|
+
[
|
|
128
|
+
"Selected tab",
|
|
129
|
+
<Tabs
|
|
130
|
+
key="tab"
|
|
131
|
+
value="one"
|
|
132
|
+
items={[
|
|
133
|
+
{ value: "one", label: "One" },
|
|
134
|
+
{ value: "two", label: "Two" },
|
|
135
|
+
]}
|
|
136
|
+
/>,
|
|
137
|
+
paintsAccent,
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
"Selected view",
|
|
141
|
+
<ViewSwitcher
|
|
142
|
+
key="v"
|
|
143
|
+
views={[
|
|
144
|
+
{ type: "list", label: "List" },
|
|
145
|
+
{ type: "board", label: "Board" },
|
|
146
|
+
]}
|
|
147
|
+
currentView="list"
|
|
148
|
+
onViewChange={() => {}}
|
|
149
|
+
/>,
|
|
150
|
+
paintsAccent,
|
|
151
|
+
],
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
describe("LC-172 every filled or selected control takes the theme accent", () => {
|
|
155
|
+
for (const [name, element, check] of controls) {
|
|
156
|
+
it.each(["blue", "pink"])(`${name} paints the accent under %s`, (hue) => {
|
|
157
|
+
const { container } = renderUnder(hue, element);
|
|
158
|
+
expect(check(container, hue)).toBe(true);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
it.each(["blue", "pink"])("Slider range paints the resolved accent ink under %s", (hue) => {
|
|
163
|
+
const { container } = render(
|
|
164
|
+
<TamaguiProvider config={houseConfig} defaultTheme="light">
|
|
165
|
+
<Theme name={hue as "blue"}>
|
|
166
|
+
<Slider label="Level" name="sl" value={[50]} />
|
|
167
|
+
</Theme>
|
|
168
|
+
</TamaguiProvider>,
|
|
169
|
+
);
|
|
170
|
+
const fill = container.querySelector('[data-slider-part="fill"]') as HTMLElement;
|
|
171
|
+
expect(fill).toBeTruthy();
|
|
172
|
+
expect(paintedBackground(fill)).toBe(
|
|
173
|
+
normalizeToHex(String(houseThemes[`light_${hue}`].accentColor)),
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it.each(["light", "dark"])("%s: the accent tokens differ between colour themes", (scheme) => {
|
|
178
|
+
const keys = ["accentBackground", "accentColor", "selectedBackground", "selectedColor"];
|
|
179
|
+
for (const key of keys) {
|
|
180
|
+
const blue = houseThemes[`${scheme}_blue`]?.[key];
|
|
181
|
+
const pink = houseThemes[`${scheme}_pink`]?.[key];
|
|
182
|
+
expect(blue, key).toBeTruthy();
|
|
183
|
+
expect(pink, key).toBeTruthy();
|
|
184
|
+
expect(blue, key).not.toBe(pink);
|
|
185
|
+
}
|
|
186
|
+
expect(houseThemes[`${scheme}_blue_accent`].background).not.toBe(
|
|
187
|
+
houseThemes[`${scheme}_pink_accent`].background,
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
@@ -19,7 +19,7 @@ import path from "node:path";
|
|
|
19
19
|
import type { ReactElement } from "react";
|
|
20
20
|
import { Theme } from "tamagui";
|
|
21
21
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
22
|
-
import { BottomAccessory } from "
|
|
22
|
+
import { BottomAccessory } from "../layouts/bottomAccessory";
|
|
23
23
|
import { useBottomChromeInset } from "./bottomChrome";
|
|
24
24
|
import {
|
|
25
25
|
TabBar,
|
package/src/appShell/index.ts
CHANGED
package/src/componentColors.ts
CHANGED
|
@@ -33,9 +33,9 @@ export const componentColors = {
|
|
|
33
33
|
},
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* LC-05: one selection tier for
|
|
37
|
-
*
|
|
38
|
-
*
|
|
36
|
+
* LC-05: one selection tier for current/highlighted rows (List, Sidebar,
|
|
37
|
+
* TreeView, CommandPalette). Selected tabs, segments and chips take LC-131's
|
|
38
|
+
* `$selectedBackground` / `$selectedColor` instead. Paint background with ink; ring is the optional chip
|
|
39
39
|
* edge or drop line. Same values as forms' formSelectionColors.
|
|
40
40
|
*/
|
|
41
41
|
selection: {
|
|
@@ -28,6 +28,7 @@ function IconProbe({ color }: { color?: string; size?: number }) {
|
|
|
28
28
|
<span
|
|
29
29
|
data-testid="icon"
|
|
30
30
|
data-selection={String(getVariableValue(theme.color12))}
|
|
31
|
+
data-selected-ink={String(getVariableValue((theme as Record<string, unknown>).selectedColor))}
|
|
31
32
|
data-well={wellInk}
|
|
32
33
|
data-color={color ?? "black"}
|
|
33
34
|
data-ink={String(getVariableValue(theme.color))}
|
|
@@ -59,7 +60,7 @@ describe("shared icon slot ink without CSS inheritance", () => {
|
|
|
59
60
|
</TamaguiProvider>,
|
|
60
61
|
);
|
|
61
62
|
const [switcher, accordion, well] = screen.getAllByTestId("icon");
|
|
62
|
-
expect(switcher.dataset.color).toBe(switcher.dataset.
|
|
63
|
+
expect(switcher.dataset.color).toBe(switcher.dataset.selectedInk);
|
|
63
64
|
expect(accordion.dataset.color).toBe(accordion.dataset.selection);
|
|
64
65
|
expect(well.dataset.color).toBe(well.dataset.well);
|
|
65
66
|
},
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { screen } from "@testing-library/react";
|
|
2
2
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
3
|
-
import { getSizeRecipeFamily } from "@multiplatform.one/theme";
|
|
3
|
+
import { createDefaultThemeConfig, getSizeRecipeFamily } from "@multiplatform.one/theme";
|
|
4
|
+
import { TamaguiProvider } from "tamagui";
|
|
4
5
|
import { describe, expect, it } from "vitest";
|
|
5
6
|
import { ViewSwitcher } from "./ViewSwitcher";
|
|
6
7
|
|
|
8
|
+
const houseConfig = createDefaultThemeConfig();
|
|
9
|
+
|
|
7
10
|
const views = [
|
|
8
11
|
{ type: "list", label: "List" },
|
|
9
12
|
{ type: "board", label: "Board" },
|
|
@@ -41,18 +44,15 @@ describe("ViewSwitcher segments ride the tab recipe family", () => {
|
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
describe("ViewSwitcher selection tier", () => {
|
|
44
|
-
it("paints the selected segment with
|
|
47
|
+
it("paints the selected segment with the accent tint and ink", () => {
|
|
45
48
|
const result = renderWithProviders(
|
|
46
|
-
<
|
|
47
|
-
views={
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]}
|
|
51
|
-
currentView="list"
|
|
52
|
-
onViewChange={() => {}}
|
|
53
|
-
/>,
|
|
49
|
+
<TamaguiProvider config={houseConfig.tamagui} defaultTheme="light">
|
|
50
|
+
<ViewSwitcher views={views} currentView="list" onViewChange={() => {}} />
|
|
51
|
+
</TamaguiProvider>,
|
|
52
|
+
{ tamagui: false },
|
|
54
53
|
);
|
|
55
|
-
|
|
56
|
-
expect(
|
|
54
|
+
const selected = result.container.querySelector('[data-state="on"]') as HTMLElement;
|
|
55
|
+
expect(selected.className).toContain("_bg-selectedBac");
|
|
56
|
+
expect(result.getByText("List").className).toContain("_col-selectedCol");
|
|
57
57
|
});
|
|
58
58
|
});
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
useResolvedKnobs,
|
|
10
10
|
wasKeyboardFocus,
|
|
11
11
|
} from "@multiplatform.one/theme";
|
|
12
|
-
import { componentColors } from "../componentColors";
|
|
13
12
|
import type React from "react";
|
|
14
13
|
import { useState } from "react";
|
|
15
14
|
import { Text, ToggleGroup, XStack, isWeb } from "tamagui";
|
|
@@ -68,7 +67,7 @@ export function ViewSwitcher({
|
|
|
68
67
|
// that did not exist in the previous frame, so LC-25 is unreachable until
|
|
69
68
|
// the segment keeps its identity. The selection ink the label and icon need
|
|
70
69
|
// is applied on the row below, which is not a context host.
|
|
71
|
-
const selectedChip = { backgroundColor:
|
|
70
|
+
const selectedChip = { backgroundColor: "$selectedBackground" };
|
|
72
71
|
// Size recipe owns chrome (height/pad/font/icon/gap). Press floor is
|
|
73
72
|
// hitSlop, never painted minHeight. Radius stays on the radius knob.
|
|
74
73
|
// SP-PAD exemption (Chip precedent): this is a control-tier segmented
|
|
@@ -190,12 +189,12 @@ export function ViewSwitcher({
|
|
|
190
189
|
hoverStyle={{
|
|
191
190
|
...restSegment,
|
|
192
191
|
...groupedRadius,
|
|
193
|
-
...(isSelected ?
|
|
192
|
+
...(isSelected ? selectedChip : hoverWash),
|
|
194
193
|
}}
|
|
195
194
|
pressStyle={{
|
|
196
195
|
...restSegment,
|
|
197
196
|
...groupedRadius,
|
|
198
|
-
...(isSelected ?
|
|
197
|
+
...(isSelected ? selectedChip : pressWash),
|
|
199
198
|
}}
|
|
200
199
|
// Rest outline is off; the keyboard ring is merged into the
|
|
201
200
|
// focused state so ToggleFrame's focusStyle cannot zero it.
|
|
@@ -231,13 +230,13 @@ export function ViewSwitcher({
|
|
|
231
230
|
// selection ink for the glyph and the label takes it explicitly
|
|
232
231
|
// (tamagui Text resolves `$color` from the theme, not by CSS
|
|
233
232
|
// inheritance).
|
|
234
|
-
{...(isSelected ? { color:
|
|
233
|
+
{...(isSelected ? { color: "$selectedColor" } : undefined)}
|
|
235
234
|
>
|
|
236
235
|
{Icon && (
|
|
237
236
|
<IconSlot
|
|
238
237
|
icon={Icon}
|
|
239
238
|
size={knobProps.controlIcon.width}
|
|
240
|
-
color={isSelected ?
|
|
239
|
+
color={isSelected ? "$selectedColor" : undefined}
|
|
241
240
|
/>
|
|
242
241
|
)}
|
|
243
242
|
{!view.iconOnly && view.label ? (
|
|
@@ -245,7 +244,7 @@ export function ViewSwitcher({
|
|
|
245
244
|
{...knobProps.tabType}
|
|
246
245
|
numberOfLines={1}
|
|
247
246
|
{...knobProps.body}
|
|
248
|
-
{...(isSelected ? { color:
|
|
247
|
+
{...(isSelected ? { color: "$selectedColor" } : undefined)}
|
|
249
248
|
>
|
|
250
249
|
{view.label}
|
|
251
250
|
</Text>
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-174 BOTTOM-ACCESSORY. Clay on the phone DataTable pager (FZ-7889 round
|
|
3
|
+
* 4): "Shouldn't the arrows and stuff the navigation thing be at the bottom of
|
|
4
|
+
* the screen". A Screen hosts one bottom-accessory slot; a control handed to
|
|
5
|
+
* `<BottomAccessory>` renders there, outside the page's content column, and
|
|
6
|
+
* without a slot it renders in place.
|
|
7
|
+
*/
|
|
8
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
9
|
+
import { act, cleanup } from "@testing-library/react";
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
12
|
+
import { BottomAccessory, createBottomAccessoryStore } from "./bottomAccessory";
|
|
13
|
+
import { Screen } from "./page";
|
|
14
|
+
|
|
15
|
+
afterEach(cleanup);
|
|
16
|
+
|
|
17
|
+
describe("Screen's bottom-accessory slot (LC-174)", () => {
|
|
18
|
+
it("draws nothing until a control registers", () => {
|
|
19
|
+
const { container } = renderWithProviders(
|
|
20
|
+
<Screen>
|
|
21
|
+
<span>content</span>
|
|
22
|
+
</Screen>,
|
|
23
|
+
);
|
|
24
|
+
expect(container.querySelector("[data-bottom-accessory]")).toBeNull();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("renders a registered control in the slot, outside the content column", () => {
|
|
28
|
+
const { container } = renderWithProviders(
|
|
29
|
+
<Screen>
|
|
30
|
+
<span>content</span>
|
|
31
|
+
<BottomAccessory>
|
|
32
|
+
<button type="button">Next</button>
|
|
33
|
+
</BottomAccessory>
|
|
34
|
+
</Screen>,
|
|
35
|
+
);
|
|
36
|
+
const slot = container.querySelector("[data-bottom-accessory='slot']");
|
|
37
|
+
expect(slot?.querySelector("button")?.textContent).toBe("Next");
|
|
38
|
+
const column = container.querySelector("[data-testid='screen']");
|
|
39
|
+
expect(column?.querySelector("button")).toBeNull();
|
|
40
|
+
expect(column?.contains(slot!)).toBe(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("closes the page column after the scroll view, sticky at the bottom (web)", () => {
|
|
44
|
+
const { container } = renderWithProviders(
|
|
45
|
+
<Screen>
|
|
46
|
+
<span>content</span>
|
|
47
|
+
<BottomAccessory>
|
|
48
|
+
<span>pager</span>
|
|
49
|
+
</BottomAccessory>
|
|
50
|
+
</Screen>,
|
|
51
|
+
);
|
|
52
|
+
const slot = container.querySelector<HTMLElement>("[data-bottom-accessory='slot']")!;
|
|
53
|
+
const column = container.querySelector("[data-testid='screen']")!;
|
|
54
|
+
// The scroll view ends above the bar, so the last row stays visible.
|
|
55
|
+
const scroller = slot.previousElementSibling!;
|
|
56
|
+
expect(scroller.contains(column)).toBe(true);
|
|
57
|
+
expect(scroller.contains(slot)).toBe(false);
|
|
58
|
+
expect(slot.parentElement!.lastElementChild).toBe(slot);
|
|
59
|
+
expect(slot.style.position).toBe("sticky");
|
|
60
|
+
expect(slot.style.bottom).toBe("0px");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("leaves the slot when the control unmounts", () => {
|
|
64
|
+
function Toggle() {
|
|
65
|
+
const [on, setOn] = useState(true);
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<button type="button" onClick={() => setOn(false)}>
|
|
69
|
+
hide
|
|
70
|
+
</button>
|
|
71
|
+
{on ? (
|
|
72
|
+
<BottomAccessory>
|
|
73
|
+
<span>pager</span>
|
|
74
|
+
</BottomAccessory>
|
|
75
|
+
) : null}
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
const { container, getByText } = renderWithProviders(
|
|
80
|
+
<Screen>
|
|
81
|
+
<Toggle />
|
|
82
|
+
</Screen>,
|
|
83
|
+
);
|
|
84
|
+
expect(container.querySelector("[data-bottom-accessory='slot']")).not.toBeNull();
|
|
85
|
+
act(() => getByText("hide").click());
|
|
86
|
+
expect(container.querySelector("[data-bottom-accessory]")).toBeNull();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("follows the control's re-renders", () => {
|
|
90
|
+
function Counter() {
|
|
91
|
+
const [n, setN] = useState(1);
|
|
92
|
+
return (
|
|
93
|
+
<>
|
|
94
|
+
<button type="button" onClick={() => setN(n + 1)}>
|
|
95
|
+
more
|
|
96
|
+
</button>
|
|
97
|
+
<BottomAccessory>
|
|
98
|
+
<span data-count="">{n}</span>
|
|
99
|
+
</BottomAccessory>
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
const { container, getByText } = renderWithProviders(
|
|
104
|
+
<Screen>
|
|
105
|
+
<Counter />
|
|
106
|
+
</Screen>,
|
|
107
|
+
);
|
|
108
|
+
act(() => getByText("more").click());
|
|
109
|
+
expect(
|
|
110
|
+
container.querySelector("[data-bottom-accessory='slot'] [data-count]")?.textContent,
|
|
111
|
+
).toBe("2");
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe("BottomAccessory without a slot", () => {
|
|
116
|
+
it("renders in place as a sticky bar on web", () => {
|
|
117
|
+
const { container } = renderWithProviders(
|
|
118
|
+
<div data-host="">
|
|
119
|
+
<BottomAccessory>
|
|
120
|
+
<span>pager</span>
|
|
121
|
+
</BottomAccessory>
|
|
122
|
+
</div>,
|
|
123
|
+
);
|
|
124
|
+
const bar = container.querySelector<HTMLElement>("[data-bottom-accessory='inline']");
|
|
125
|
+
expect(bar?.closest("[data-host]")).not.toBeNull();
|
|
126
|
+
expect(bar?.textContent).toBe("pager");
|
|
127
|
+
expect(bar?.style.position).toBe("sticky");
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
describe("createBottomAccessoryStore", () => {
|
|
132
|
+
it("keeps registration order and skips a no-op set", () => {
|
|
133
|
+
const store = createBottomAccessoryStore();
|
|
134
|
+
let emits = 0;
|
|
135
|
+
store.subscribe(() => emits++);
|
|
136
|
+
const node = <span />;
|
|
137
|
+
store.set(1, node);
|
|
138
|
+
store.set(2, <span />);
|
|
139
|
+
store.set(1, node);
|
|
140
|
+
expect(store.getSnapshot().map((entry) => entry.id)).toEqual([1, 2]);
|
|
141
|
+
expect(emits).toBe(2);
|
|
142
|
+
store.remove(1);
|
|
143
|
+
store.remove(1);
|
|
144
|
+
expect(store.getSnapshot().map((entry) => entry.id)).toEqual([2]);
|
|
145
|
+
expect(emits).toBe(3);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LC-174 BOTTOM-ACCESSORY: on a phone, paging and navigation controls pin to
|
|
3
|
+
* the bottom edge of the screen above the safe area (UIToolbar, the
|
|
4
|
+
* UIPageControl under a paged list), not inline after the content.
|
|
5
|
+
*
|
|
6
|
+
* Under a floating TabBar the accessory moves into the bar, which floats it
|
|
7
|
+
* as its own capsule above the tab capsule (LC-150). Otherwise a page shell
|
|
8
|
+
* (`Screen`) owns one bottom-accessory slot. Any component
|
|
9
|
+
* hands it a control with `<BottomAccessory>`; the shell draws it in a bar
|
|
10
|
+
* under its scroll view that stays put while the content scrolls, so the
|
|
11
|
+
* scroll view ends above the bar and its last row stays visible. Without a
|
|
12
|
+
* slot the control renders where it is: inline on native, a sticky bar on web
|
|
13
|
+
* (`position: sticky; bottom: 0`, so it still meets the viewport's edge).
|
|
14
|
+
*
|
|
15
|
+
* The accessory is rendered by the slot, outside the registering component's
|
|
16
|
+
* tree: it receives the shell's theme and none of the component's own
|
|
17
|
+
* contexts, so pass it plain elements with their handlers bound.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { Surface, hairline, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
21
|
+
import {
|
|
22
|
+
Fragment,
|
|
23
|
+
createContext,
|
|
24
|
+
useContext,
|
|
25
|
+
useEffect,
|
|
26
|
+
useLayoutEffect,
|
|
27
|
+
useRef,
|
|
28
|
+
useState,
|
|
29
|
+
useSyncExternalStore,
|
|
30
|
+
type ReactNode,
|
|
31
|
+
} from "react";
|
|
32
|
+
import { YStack, isWeb } from "tamagui";
|
|
33
|
+
import { setBottomAccessory, useFloatingBarMounted } from "../appShell/bottomChrome";
|
|
34
|
+
import { componentColors } from "../componentColors";
|
|
35
|
+
import { BottomSafeArea } from "./bottomSafeArea";
|
|
36
|
+
|
|
37
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
38
|
+
|
|
39
|
+
interface Entry {
|
|
40
|
+
id: number;
|
|
41
|
+
node: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface BottomAccessoryStore {
|
|
45
|
+
set(id: number, node: ReactNode): void;
|
|
46
|
+
remove(id: number): void;
|
|
47
|
+
subscribe(listener: () => void): () => void;
|
|
48
|
+
getSnapshot(): readonly Entry[];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const empty: readonly Entry[] = [];
|
|
52
|
+
|
|
53
|
+
// Web only: the sticky edge. The fill is the page's, as on native (LC-206).
|
|
54
|
+
const webSticky = isWeb ? { position: "sticky", bottom: 0 } : undefined;
|
|
55
|
+
|
|
56
|
+
/** The registry a page shell's slot reads. One per shell. */
|
|
57
|
+
export function createBottomAccessoryStore(): BottomAccessoryStore {
|
|
58
|
+
let entries: readonly Entry[] = empty;
|
|
59
|
+
const listeners = new Set<() => void>();
|
|
60
|
+
const emit = () => {
|
|
61
|
+
for (const listener of listeners) listener();
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
set(id, node) {
|
|
65
|
+
const at = entries.findIndex((entry) => entry.id === id);
|
|
66
|
+
if (at >= 0 && entries[at]!.node === node) return;
|
|
67
|
+
entries =
|
|
68
|
+
at < 0
|
|
69
|
+
? [...entries, { id, node }]
|
|
70
|
+
: entries.map((entry) => (entry.id === id ? { id, node } : entry));
|
|
71
|
+
emit();
|
|
72
|
+
},
|
|
73
|
+
remove(id) {
|
|
74
|
+
if (!entries.some((entry) => entry.id === id)) return;
|
|
75
|
+
entries = entries.filter((entry) => entry.id !== id);
|
|
76
|
+
emit();
|
|
77
|
+
},
|
|
78
|
+
subscribe(listener) {
|
|
79
|
+
listeners.add(listener);
|
|
80
|
+
return () => listeners.delete(listener);
|
|
81
|
+
},
|
|
82
|
+
getSnapshot: () => entries,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const BottomAccessoryContext = createContext<BottomAccessoryStore | null>(null);
|
|
87
|
+
|
|
88
|
+
/** Declares a page's bottom-accessory slot to the tree under it. Renders no DOM. */
|
|
89
|
+
export function BottomAccessoryScope({
|
|
90
|
+
store,
|
|
91
|
+
children,
|
|
92
|
+
}: {
|
|
93
|
+
store: BottomAccessoryStore;
|
|
94
|
+
children: ReactNode;
|
|
95
|
+
}) {
|
|
96
|
+
return (
|
|
97
|
+
<BottomAccessoryContext.Provider value={store}>{children}</BottomAccessoryContext.Provider>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The nearest page's bottom-accessory slot, or null when nothing hosts one. */
|
|
102
|
+
export function useBottomAccessorySlot(): BottomAccessoryStore | null {
|
|
103
|
+
return useContext(BottomAccessoryContext);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
let nextId = 0;
|
|
107
|
+
|
|
108
|
+
export interface BottomAccessoryProps {
|
|
109
|
+
children: ReactNode;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Hands `children` to the page's bottom-accessory slot. With no slot it
|
|
114
|
+
* renders them in place: inline on native, a sticky bottom bar on web.
|
|
115
|
+
*/
|
|
116
|
+
export function BottomAccessory({ children }: BottomAccessoryProps) {
|
|
117
|
+
const floating = useFloatingBarMounted();
|
|
118
|
+
const slot = useBottomAccessorySlot();
|
|
119
|
+
const store = floating ? null : slot;
|
|
120
|
+
const id = useRef<number | null>(null);
|
|
121
|
+
if (id.current === null) id.current = ++nextId;
|
|
122
|
+
const [barId] = useState(() => Symbol("bottom-accessory"));
|
|
123
|
+
|
|
124
|
+
useIsomorphicLayoutEffect(() => {
|
|
125
|
+
store?.set(id.current!, children);
|
|
126
|
+
});
|
|
127
|
+
useIsomorphicLayoutEffect(() => {
|
|
128
|
+
if (!store) return;
|
|
129
|
+
const own = id.current!;
|
|
130
|
+
return () => store.remove(own);
|
|
131
|
+
}, [store]);
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
setBottomAccessory(barId, floating ? children : null);
|
|
134
|
+
}, [floating, children, barId]);
|
|
135
|
+
useEffect(() => () => setBottomAccessory(barId, null), [barId]);
|
|
136
|
+
|
|
137
|
+
if (floating || store) return null;
|
|
138
|
+
if (!isWeb) return <>{children}</>;
|
|
139
|
+
return <BottomAccessoryBar>{children}</BottomAccessoryBar>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** A page shell's slot: the bar the registered accessories render in. */
|
|
143
|
+
export function BottomAccessoryHost({
|
|
144
|
+
store,
|
|
145
|
+
inset,
|
|
146
|
+
maxWidth,
|
|
147
|
+
}: {
|
|
148
|
+
store: BottomAccessoryStore;
|
|
149
|
+
inset?: string | null;
|
|
150
|
+
maxWidth?: number | null;
|
|
151
|
+
}) {
|
|
152
|
+
const entries = useSyncExternalStore(store.subscribe, store.getSnapshot, () => empty);
|
|
153
|
+
if (entries.length === 0) return null;
|
|
154
|
+
return (
|
|
155
|
+
<BottomAccessoryBar inset={inset} maxWidth={maxWidth} hosted>
|
|
156
|
+
{entries.map((entry) => (
|
|
157
|
+
<Fragment key={entry.id}>{entry.node}</Fragment>
|
|
158
|
+
))}
|
|
159
|
+
</BottomAccessoryBar>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* The bar: the page's fill under a top hairline, and the home indicator's
|
|
165
|
+
* inset below the controls.
|
|
166
|
+
*/
|
|
167
|
+
function BottomAccessoryBar({
|
|
168
|
+
children,
|
|
169
|
+
inset,
|
|
170
|
+
maxWidth,
|
|
171
|
+
hosted = false,
|
|
172
|
+
}: {
|
|
173
|
+
children: ReactNode;
|
|
174
|
+
inset?: string | null;
|
|
175
|
+
maxWidth?: number | null;
|
|
176
|
+
hosted?: boolean;
|
|
177
|
+
}) {
|
|
178
|
+
const { knobProps } = useResolvedKnobs({ component: "ScreenToolbar" });
|
|
179
|
+
return (
|
|
180
|
+
<Surface bar>
|
|
181
|
+
<YStack
|
|
182
|
+
data-bottom-accessory={hosted ? "slot" : "inline"}
|
|
183
|
+
width="100%"
|
|
184
|
+
flexShrink={0}
|
|
185
|
+
zIndex={1}
|
|
186
|
+
backgroundColor="$background"
|
|
187
|
+
{...hairline.top}
|
|
188
|
+
borderColor={componentColors.divider as never}
|
|
189
|
+
style={webSticky as never}
|
|
190
|
+
>
|
|
191
|
+
<BottomSafeArea>
|
|
192
|
+
<YStack
|
|
193
|
+
width="100%"
|
|
194
|
+
{...(maxWidth ? { maxWidth, alignSelf: "center" as const } : null)}
|
|
195
|
+
alignItems="center"
|
|
196
|
+
paddingHorizontal={(inset ?? knobProps.panelPadding.padding) as "$4"}
|
|
197
|
+
paddingVertical={knobProps.gap.gap as "$2"}
|
|
198
|
+
{...knobProps.gap}
|
|
199
|
+
>
|
|
200
|
+
{children}
|
|
201
|
+
</YStack>
|
|
202
|
+
</BottomSafeArea>
|
|
203
|
+
</YStack>
|
|
204
|
+
</Surface>
|
|
205
|
+
);
|
|
206
|
+
}
|