@coinbase/cds-mcp-server 8.17.2 → 8.17.4
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/CHANGELOG.md +8 -0
- package/mcp-docs/mobile/components/Accordion.txt +188 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +29 -0
- package/mcp-docs/mobile/components/Alert.txt +155 -0
- package/mcp-docs/mobile/components/AreaChart.txt +265 -0
- package/mcp-docs/mobile/components/Avatar.txt +195 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +225 -0
- package/mcp-docs/mobile/components/Banner.txt +221 -0
- package/mcp-docs/mobile/components/BarChart.txt +815 -0
- package/mcp-docs/mobile/components/Box.txt +173 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +146 -0
- package/mcp-docs/mobile/components/Button.txt +198 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +79 -0
- package/mcp-docs/mobile/components/Carousel.txt +1083 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +825 -0
- package/mcp-docs/mobile/components/CellMedia.txt +70 -0
- package/mcp-docs/mobile/components/Checkbox.txt +245 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +201 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +284 -0
- package/mcp-docs/mobile/components/Chip.txt +194 -0
- package/mcp-docs/mobile/components/Coachmark.txt +157 -0
- package/mcp-docs/mobile/components/Collapsible.txt +104 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +134 -0
- package/mcp-docs/mobile/components/ContentCard.txt +365 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +135 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +127 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +145 -0
- package/mcp-docs/mobile/components/ContentCell.txt +226 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +443 -0
- package/mcp-docs/mobile/components/DatePicker.txt +496 -0
- package/mcp-docs/mobile/components/Divider.txt +138 -0
- package/mcp-docs/mobile/components/DotCount.txt +145 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +58 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +134 -0
- package/mcp-docs/mobile/components/Fallback.txt +157 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +155 -0
- package/mcp-docs/mobile/components/HStack.txt +234 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +47 -0
- package/mcp-docs/mobile/components/Icon.txt +51 -0
- package/mcp-docs/mobile/components/IconButton.txt +268 -0
- package/mcp-docs/mobile/components/InputChip.txt +187 -0
- package/mcp-docs/mobile/components/Interactable.txt +186 -0
- package/mcp-docs/mobile/components/LineChart.txt +1324 -0
- package/mcp-docs/mobile/components/Link.txt +291 -0
- package/mcp-docs/mobile/components/ListCell.txt +412 -0
- package/mcp-docs/mobile/components/LogoMark.txt +84 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +93 -0
- package/mcp-docs/mobile/components/Lottie.txt +138 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +46 -0
- package/mcp-docs/mobile/components/Modal.txt +83 -0
- package/mcp-docs/mobile/components/ModalBody.txt +33 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +24 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +27 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +379 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +131 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +141 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +89 -0
- package/mcp-docs/mobile/components/Numpad.txt +340 -0
- package/mcp-docs/mobile/components/Overlay.txt +151 -0
- package/mcp-docs/mobile/components/PageFooter.txt +160 -0
- package/mcp-docs/mobile/components/PageHeader.txt +185 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +407 -0
- package/mcp-docs/mobile/components/Pictogram.txt +47 -0
- package/mcp-docs/mobile/components/Point.txt +204 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +78 -0
- package/mcp-docs/mobile/components/Pressable.txt +210 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +129 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +160 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +137 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +236 -0
- package/mcp-docs/mobile/components/Radio.txt +241 -0
- package/mcp-docs/mobile/components/RadioCell.txt +201 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +281 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +152 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +105 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +60 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +788 -0
- package/mcp-docs/mobile/components/Scrubber.txt +203 -0
- package/mcp-docs/mobile/components/SearchInput.txt +191 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +204 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +315 -0
- package/mcp-docs/mobile/components/Select.txt +211 -0
- package/mcp-docs/mobile/components/SelectChip.txt +323 -0
- package/mcp-docs/mobile/components/SelectOption.txt +84 -0
- package/mcp-docs/mobile/components/SlideButton.txt +330 -0
- package/mcp-docs/mobile/components/Spacer.txt +83 -0
- package/mcp-docs/mobile/components/Sparkline.txt +122 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +106 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +156 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +72 -0
- package/mcp-docs/mobile/components/Spinner.txt +48 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +47 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +47 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +47 -0
- package/mcp-docs/mobile/components/Stepper.txt +527 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/mobile/components/Switch.txt +97 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +48 -0
- package/mcp-docs/mobile/components/TabLabel.txt +153 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +146 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +142 -0
- package/mcp-docs/mobile/components/Tabs.txt +190 -0
- package/mcp-docs/mobile/components/Tag.txt +300 -0
- package/mcp-docs/mobile/components/Text.txt +211 -0
- package/mcp-docs/mobile/components/TextInput.txt +717 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +132 -0
- package/mcp-docs/mobile/components/Toast.txt +196 -0
- package/mcp-docs/mobile/components/Tooltip.txt +59 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +161 -0
- package/mcp-docs/mobile/components/Tour.txt +158 -0
- package/mcp-docs/mobile/components/Tray.txt +252 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +321 -0
- package/mcp-docs/mobile/components/VStack.txt +222 -0
- package/mcp-docs/mobile/components/XAxis.txt +621 -0
- package/mcp-docs/mobile/components/YAxis.txt +567 -0
- package/mcp-docs/mobile/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/mobile/getting-started/installation.txt +57 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +102 -0
- package/mcp-docs/mobile/getting-started/playground.txt +28 -0
- package/mcp-docs/mobile/getting-started/styling.txt +84 -0
- package/mcp-docs/mobile/getting-started/theming.txt +286 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +72 -0
- package/mcp-docs/mobile/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/mobile/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +280 -0
- package/mcp-docs/mobile/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/mobile/hooks/useRefMap.txt +178 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +321 -0
- package/mcp-docs/mobile/routes.txt +139 -0
- package/mcp-docs/web/components/Accordion.txt +189 -0
- package/mcp-docs/web/components/AccordionItem.txt +31 -0
- package/mcp-docs/web/components/Alert.txt +164 -0
- package/mcp-docs/web/components/AreaChart.txt +510 -0
- package/mcp-docs/web/components/Avatar.txt +211 -0
- package/mcp-docs/web/components/AvatarButton.txt +240 -0
- package/mcp-docs/web/components/Banner.txt +226 -0
- package/mcp-docs/web/components/BarChart.txt +1267 -0
- package/mcp-docs/web/components/Box.txt +175 -0
- package/mcp-docs/web/components/Button.txt +212 -0
- package/mcp-docs/web/components/ButtonGroup.txt +79 -0
- package/mcp-docs/web/components/Calendar.txt +181 -0
- package/mcp-docs/web/components/Carousel.txt +1575 -0
- package/mcp-docs/web/components/CartesianChart.txt +1044 -0
- package/mcp-docs/web/components/CellMedia.txt +56 -0
- package/mcp-docs/web/components/Checkbox.txt +188 -0
- package/mcp-docs/web/components/CheckboxCell.txt +202 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +219 -0
- package/mcp-docs/web/components/Chip.txt +196 -0
- package/mcp-docs/web/components/Coachmark.txt +188 -0
- package/mcp-docs/web/components/Collapsible.txt +119 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +232 -0
- package/mcp-docs/web/components/ContentCard.txt +367 -0
- package/mcp-docs/web/components/ContentCardBody.txt +137 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +129 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +147 -0
- package/mcp-docs/web/components/ContentCell.txt +219 -0
- package/mcp-docs/web/components/ControlGroup.txt +436 -0
- package/mcp-docs/web/components/DatePicker.txt +505 -0
- package/mcp-docs/web/components/Divider.txt +143 -0
- package/mcp-docs/web/components/DotCount.txt +149 -0
- package/mcp-docs/web/components/DotStatusColor.txt +58 -0
- package/mcp-docs/web/components/DotSymbol.txt +137 -0
- package/mcp-docs/web/components/Dropdown.txt +119 -0
- package/mcp-docs/web/components/Fallback.txt +163 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +250 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +69 -0
- package/mcp-docs/web/components/FullscreenModal.txt +145 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +187 -0
- package/mcp-docs/web/components/Grid.txt +236 -0
- package/mcp-docs/web/components/GridColumn.txt +209 -0
- package/mcp-docs/web/components/HStack.txt +236 -0
- package/mcp-docs/web/components/HeroSquare.txt +48 -0
- package/mcp-docs/web/components/Icon.txt +145 -0
- package/mcp-docs/web/components/IconButton.txt +390 -0
- package/mcp-docs/web/components/InputChip.txt +187 -0
- package/mcp-docs/web/components/Interactable.txt +193 -0
- package/mcp-docs/web/components/LineChart.txt +1576 -0
- package/mcp-docs/web/components/Link.txt +243 -0
- package/mcp-docs/web/components/ListCell.txt +418 -0
- package/mcp-docs/web/components/LogoMark.txt +84 -0
- package/mcp-docs/web/components/LogoWordMark.txt +93 -0
- package/mcp-docs/web/components/Lottie.txt +157 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +57 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +108 -0
- package/mcp-docs/web/components/Modal.txt +196 -0
- package/mcp-docs/web/components/ModalBody.txt +117 -0
- package/mcp-docs/web/components/ModalFooter.txt +119 -0
- package/mcp-docs/web/components/ModalHeader.txt +123 -0
- package/mcp-docs/web/components/MultiContentModule.txt +381 -0
- package/mcp-docs/web/components/NavigationBar.txt +102 -0
- package/mcp-docs/web/components/NavigationTitle.txt +25 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +45 -0
- package/mcp-docs/web/components/NudgeCard.txt +181 -0
- package/mcp-docs/web/components/Overlay.txt +171 -0
- package/mcp-docs/web/components/PageFooter.txt +184 -0
- package/mcp-docs/web/components/PageHeader.txt +243 -0
- package/mcp-docs/web/components/Pagination.txt +499 -0
- package/mcp-docs/web/components/PeriodSelector.txt +703 -0
- package/mcp-docs/web/components/Pictogram.txt +48 -0
- package/mcp-docs/web/components/Point.txt +460 -0
- package/mcp-docs/web/components/PortalProvider.txt +76 -0
- package/mcp-docs/web/components/Pressable.txt +193 -0
- package/mcp-docs/web/components/ProgressBar.txt +163 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +212 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +181 -0
- package/mcp-docs/web/components/ProgressCircle.txt +443 -0
- package/mcp-docs/web/components/Radio.txt +219 -0
- package/mcp-docs/web/components/RadioCell.txt +215 -0
- package/mcp-docs/web/components/RadioGroup.txt +288 -0
- package/mcp-docs/web/components/ReferenceLine.txt +451 -0
- package/mcp-docs/web/components/RemoteImage.txt +165 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +86 -0
- package/mcp-docs/web/components/RollingNumber.txt +1021 -0
- package/mcp-docs/web/components/Scrubber.txt +231 -0
- package/mcp-docs/web/components/SearchInput.txt +117 -0
- package/mcp-docs/web/components/SectionHeader.txt +217 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +324 -0
- package/mcp-docs/web/components/Select.txt +224 -0
- package/mcp-docs/web/components/SelectChip.txt +314 -0
- package/mcp-docs/web/components/SelectOption.txt +165 -0
- package/mcp-docs/web/components/Sidebar.txt +349 -0
- package/mcp-docs/web/components/SidebarItem.txt +131 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +30 -0
- package/mcp-docs/web/components/Spacer.txt +173 -0
- package/mcp-docs/web/components/Sparkline.txt +122 -0
- package/mcp-docs/web/components/SparklineGradient.txt +106 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +153 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +76 -0
- package/mcp-docs/web/components/Spinner.txt +128 -0
- package/mcp-docs/web/components/SpotIcon.txt +48 -0
- package/mcp-docs/web/components/SpotRectangle.txt +48 -0
- package/mcp-docs/web/components/SpotSquare.txt +48 -0
- package/mcp-docs/web/components/Stepper.txt +682 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/web/components/Switch.txt +85 -0
- package/mcp-docs/web/components/TabIndicator.txt +48 -0
- package/mcp-docs/web/components/TabLabel.txt +158 -0
- package/mcp-docs/web/components/TabNavigation.txt +159 -0
- package/mcp-docs/web/components/TabbedChips.txt +155 -0
- package/mcp-docs/web/components/Table.txt +367 -0
- package/mcp-docs/web/components/TableBody.txt +83 -0
- package/mcp-docs/web/components/TableCaption.txt +102 -0
- package/mcp-docs/web/components/TableCell.txt +165 -0
- package/mcp-docs/web/components/TableCellFallback.txt +97 -0
- package/mcp-docs/web/components/TableFooter.txt +83 -0
- package/mcp-docs/web/components/TableHeader.txt +100 -0
- package/mcp-docs/web/components/TableRow.txt +140 -0
- package/mcp-docs/web/components/Tabs.txt +212 -0
- package/mcp-docs/web/components/Tag.txt +304 -0
- package/mcp-docs/web/components/Text.txt +232 -0
- package/mcp-docs/web/components/TextInput.txt +652 -0
- package/mcp-docs/web/components/ThemeProvider.txt +199 -0
- package/mcp-docs/web/components/TileButton.txt +158 -0
- package/mcp-docs/web/components/Toast.txt +203 -0
- package/mcp-docs/web/components/Tooltip.txt +89 -0
- package/mcp-docs/web/components/Tour.txt +179 -0
- package/mcp-docs/web/components/Tray.txt +288 -0
- package/mcp-docs/web/components/UpsellCard.txt +319 -0
- package/mcp-docs/web/components/VStack.txt +224 -0
- package/mcp-docs/web/components/XAxis.txt +619 -0
- package/mcp-docs/web/components/YAxis.txt +548 -0
- package/mcp-docs/web/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/web/getting-started/installation.txt +103 -0
- package/mcp-docs/web/getting-started/introduction.txt +102 -0
- package/mcp-docs/web/getting-started/playground.txt +28 -0
- package/mcp-docs/web/getting-started/styling.txt +161 -0
- package/mcp-docs/web/getting-started/templates.txt +121 -0
- package/mcp-docs/web/getting-started/theming.txt +426 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +61 -0
- package/mcp-docs/web/hooks/useDimensions.txt +114 -0
- package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +75 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +58 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +114 -0
- package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +279 -0
- package/mcp-docs/web/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/web/hooks/useRefMap.txt +178 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +82 -0
- package/mcp-docs/web/hooks/useTheme.txt +364 -0
- package/mcp-docs/web/routes.txt +163 -0
- package/package.json +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Tour
|
|
2
|
+
|
|
3
|
+
Creates guided tours of a user interface.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Tour, TourStep } from '@coinbase/cds-mobile/tour'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic usage
|
|
14
|
+
|
|
15
|
+
```tsx live
|
|
16
|
+
function Example() {
|
|
17
|
+
const [activeTourStep, setActiveTourStep] = useState(null);
|
|
18
|
+
|
|
19
|
+
const StepOne = () => {
|
|
20
|
+
const [checked, setChecked] = useState(false);
|
|
21
|
+
|
|
22
|
+
const { goNextTourStep, stopTour } = useTourContext();
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Coachmark
|
|
26
|
+
action={<Button variant="secondary" onPress={goNextTourStep} compact label="Next" />}
|
|
27
|
+
checkbox={
|
|
28
|
+
<Checkbox checked={checked} onChange={setChecked}>
|
|
29
|
+
Don't show again
|
|
30
|
+
</Checkbox>
|
|
31
|
+
}
|
|
32
|
+
content="Add up to 3 lines of body copy. Deliver your message with clarity and impact"
|
|
33
|
+
onClose={stopTour}
|
|
34
|
+
title="My first step"
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const StepTwo = () => {
|
|
40
|
+
const { goNextTourStep, stopTour } = useTourContext();
|
|
41
|
+
return (
|
|
42
|
+
<Coachmark
|
|
43
|
+
action={<Button variant="secondary" onPress={goNextTourStep} compact label="Next" />}
|
|
44
|
+
content={
|
|
45
|
+
<VStack gap={2}>
|
|
46
|
+
<TextCaption as="p" color="fgMuted">
|
|
47
|
+
50%
|
|
48
|
+
</TextCaption>
|
|
49
|
+
<ProgressBar progress={0.5} />
|
|
50
|
+
<TextBody as="p">
|
|
51
|
+
Add up to 3 lines of body copy. Deliver your message with clarity and impact
|
|
52
|
+
</TextBody>
|
|
53
|
+
</VStack>
|
|
54
|
+
}
|
|
55
|
+
media={<RemoteImage height={150} source={ethBackground} width="100%" />}
|
|
56
|
+
onClose={stopTour}
|
|
57
|
+
title="My second step"
|
|
58
|
+
/>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const StepThree = () => {
|
|
63
|
+
const { stopTour, goNextTourStep, goPreviousTourStep } = useTourContext();
|
|
64
|
+
return (
|
|
65
|
+
<Coachmark
|
|
66
|
+
action={
|
|
67
|
+
<HStack gap={1}>
|
|
68
|
+
<Button variant="secondary" onPress={goPreviousTourStep} compact label="Back" />
|
|
69
|
+
<Button variant="secondary" onPress={goNextTourStep} compact label="Next" />
|
|
70
|
+
<Button variant="secondary" onPress={stopTour} compact label="Done" />
|
|
71
|
+
</HStack>
|
|
72
|
+
}
|
|
73
|
+
content="Add up to 3 lines of body copy. Deliver your message with clarity and impact"
|
|
74
|
+
title="My third step"
|
|
75
|
+
width={350}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const tourSteps = [
|
|
81
|
+
{
|
|
82
|
+
id: 'step1',
|
|
83
|
+
onBeforeActive: () => console.log('step1 before'),
|
|
84
|
+
Component: StepOne,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'step2',
|
|
88
|
+
onBeforeActive: () => console.log('step2 before'),
|
|
89
|
+
Component: StepTwo,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: 'step3',
|
|
93
|
+
onBeforeActive: () => console.log('step3 before'),
|
|
94
|
+
Component: StepThree,
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
const TourExample = ({ spacerWidthIncrement = 0, spacerHeightIncrement = 500 }) => {
|
|
99
|
+
const { startTour } = useTourContext();
|
|
100
|
+
|
|
101
|
+
const handlePress = useCallback(() => startTour(), [startTour]);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<VStack flexGrow={1} gap={2} justifyContent="space-between">
|
|
105
|
+
<Button onPress={handlePress} compact label="Start tour" />
|
|
106
|
+
<TourStep id="step1">
|
|
107
|
+
<Box backgroundColor="secondary" padding={4}>
|
|
108
|
+
<Text>This is step 1</Text>
|
|
109
|
+
</Box>
|
|
110
|
+
</TourStep>
|
|
111
|
+
<Box height={spacerHeightIncrement} />
|
|
112
|
+
<HStack justifyContent="flex-end">
|
|
113
|
+
<Box flexShrink={0} width={spacerWidthIncrement} />
|
|
114
|
+
<TourStep id="step2">
|
|
115
|
+
<Box backgroundColor="secondary" padding={4} width={150}>
|
|
116
|
+
<Text>This is step 2</Text>
|
|
117
|
+
</Box>
|
|
118
|
+
</TourStep>
|
|
119
|
+
</HStack>
|
|
120
|
+
<Box height={spacerHeightIncrement} />
|
|
121
|
+
<HStack>
|
|
122
|
+
<Box flexShrink={0} width={spacerWidthIncrement * 2} />
|
|
123
|
+
<TourStep id="step3">
|
|
124
|
+
<VStack backgroundColor="secondary" padding={4} width={150}>
|
|
125
|
+
<Text>This is step 3</Text>
|
|
126
|
+
</VStack>
|
|
127
|
+
</TourStep>
|
|
128
|
+
</HStack>
|
|
129
|
+
</VStack>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<Tour activeTourStep={activeTourStep} onChange={setActiveTourStep} steps={tourSteps}>
|
|
135
|
+
<TourExample />
|
|
136
|
+
</Tour>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Props
|
|
142
|
+
|
|
143
|
+
| Prop | Type | Required | Default | Description |
|
|
144
|
+
| --- | --- | --- | --- | --- |
|
|
145
|
+
| `activeTourStep` | `TourStepValue<T> \| null` | Yes | `-` | - |
|
|
146
|
+
| `onChange` | `(tourStep: TourStepValue<T> \| null) => void` | Yes | `-` | - |
|
|
147
|
+
| `steps` | `TourStepValue<T>[]` | Yes | `-` | - |
|
|
148
|
+
| `TourMaskComponent` | `TourMaskComponent` | No | `DefaultTourMask` | The Component to render as a tour overlay and mask. |
|
|
149
|
+
| `TourStepArrowComponent` | `TourStepArrowComponent` | No | `DefaultTourStepArrow` | The default Component to render for each TourStep arrow element. |
|
|
150
|
+
| `hideOverlay` | `boolean` | No | `false` | Hide overlay when tour is active |
|
|
151
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID |
|
|
152
|
+
| `tourMaskBorderRadius` | `string \| number` | No | `-` | Corner radius for the TourMasks content mask. Uses SVG rect elements rx and ry attributes https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx. |
|
|
153
|
+
| `tourMaskPadding` | `string \| number` | No | `-` | Padding to add around the edges of the TourMasks content mask. |
|
|
154
|
+
| `tourStepAutoPlacement` | `Partial<Partial<{ boundary: any; rootBoundary: RootBoundary; elementContext: ElementContext; altBoundary: boolean; padding: Padding; }> & { crossAxis: boolean; alignment: Alignment \| null; autoAlignment: boolean; allowedPlacements: Placement[]; }>` | No | `24` | Configures @floating-ui autoPlacement options for Tour Step component. See https://floating-ui.com/docs/autoplacement. |
|
|
155
|
+
| `tourStepOffset` | `number \| Partial<{ mainAxis: number; crossAxis: number; alignmentAxis: number \| null; }> \| Derivable<OffsetValue>` | No | `24` | Configures @floating-ui offset options for Tour Step component. See https://floating-ui.com/docs/offset. |
|
|
156
|
+
| `tourStepShift` | `Partial<Partial<{ boundary: any; rootBoundary: RootBoundary; elementContext: ElementContext; altBoundary: boolean; padding: Padding; }> & { mainAxis: boolean; crossAxis: boolean; limiter: { fn: (state: MiddlewareState) => Coords; options?: any; }; }>` | No | `-` | Configures @floating-ui shift options for Tour Step component. See https://floating-ui.com/docs/shift. |
|
|
157
|
+
|
|
158
|
+
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Tray
|
|
2
|
+
|
|
3
|
+
An elevated container pinned to the bottom of the screen.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Tray } from '@coinbase/cds-mobile/overlays/tray/Tray'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic usage with Callback
|
|
14
|
+
|
|
15
|
+
The recommended way to use a `Tray` is by passing a callback as children, which receives a `handleClose` function:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
function BasicTray() {
|
|
19
|
+
const [visible, setVisible] = useState(false);
|
|
20
|
+
const handleOpen = () => setVisible(true);
|
|
21
|
+
const handleClose = () => setVisible(false);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<VStack gap={2}>
|
|
25
|
+
<Button onPress={handleOpen}>Open Tray</Button>
|
|
26
|
+
{visible && (
|
|
27
|
+
<Tray title="Example Title" onCloseComplete={handleClose}>
|
|
28
|
+
{({ handleClose }) => (
|
|
29
|
+
<VStack gap={2} padding={3}>
|
|
30
|
+
<Text>This is the content of the tray.</Text>
|
|
31
|
+
<Button onPress={handleClose}>Close</Button>
|
|
32
|
+
</VStack>
|
|
33
|
+
)}
|
|
34
|
+
</Tray>
|
|
35
|
+
)}
|
|
36
|
+
</VStack>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Using Ref to Control the Tray
|
|
42
|
+
|
|
43
|
+
You can also control the Tray using a ref, which provides `open()` and `close()` methods:
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
function TrayWithRef() {
|
|
47
|
+
const [visible, setVisible] = useState(false);
|
|
48
|
+
const trayRef = useRef<DrawerRefBaseProps>(null);
|
|
49
|
+
|
|
50
|
+
const handleOpen = () => setVisible(true);
|
|
51
|
+
const handleClose = () => setVisible(false);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<VStack gap={2}>
|
|
55
|
+
<Button onPress={handleOpen}>Open Tray</Button>
|
|
56
|
+
{visible && (
|
|
57
|
+
<Tray ref={trayRef} title="Ref Controlled Tray" onCloseComplete={handleClose}>
|
|
58
|
+
<VStack gap={2} padding={3}>
|
|
59
|
+
<Text>Control this tray using the ref.</Text>
|
|
60
|
+
<Button onPress={() => trayRef.current?.close()}>Close</Button>
|
|
61
|
+
</VStack>
|
|
62
|
+
</Tray>
|
|
63
|
+
)}
|
|
64
|
+
</VStack>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Scrollable Content
|
|
70
|
+
|
|
71
|
+
To enable scrolling in a Tray, use `ScrollView` and set `disablePanGesture`:
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
function ScrollableTray() {
|
|
75
|
+
const [visible, setVisible] = useState(false);
|
|
76
|
+
const handleOpen = () => setVisible(true);
|
|
77
|
+
const handleClose = () => setVisible(false);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<VStack gap={2}>
|
|
81
|
+
<Button onPress={handleOpen}>Open Scrollable Tray</Button>
|
|
82
|
+
{visible && (
|
|
83
|
+
<Tray title="Scrollable Content" onCloseComplete={handleClose} disablePanGesture>
|
|
84
|
+
{({ handleClose }) => (
|
|
85
|
+
<VStack gap={2}>
|
|
86
|
+
<ScrollView style={{ maxHeight: 200 }}>
|
|
87
|
+
<Pressable>
|
|
88
|
+
<VStack padding={3} gap={2}>
|
|
89
|
+
<Text>
|
|
90
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor
|
|
91
|
+
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
|
|
92
|
+
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
93
|
+
</Text>
|
|
94
|
+
<Text>
|
|
95
|
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
|
|
96
|
+
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
|
|
97
|
+
in culpa qui officia deserunt mollit anim id est laborum.
|
|
98
|
+
</Text>
|
|
99
|
+
</VStack>
|
|
100
|
+
</Pressable>
|
|
101
|
+
</ScrollView>
|
|
102
|
+
<HStack padding={3} justifyContent="flex-end">
|
|
103
|
+
<Button onPress={handleClose}>Close</Button>
|
|
104
|
+
</HStack>
|
|
105
|
+
</VStack>
|
|
106
|
+
)}
|
|
107
|
+
</Tray>
|
|
108
|
+
)}
|
|
109
|
+
</VStack>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### With Selection Menu
|
|
115
|
+
|
|
116
|
+
When using a Tray for selection, wrap the options in a `Menu` component:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
function TrayWithMenu() {
|
|
120
|
+
const [visible, setVisible] = useState(false);
|
|
121
|
+
const [selectedValue, setSelectedValue] = useState<string>();
|
|
122
|
+
const trayRef = useRef<DrawerRefBaseProps>(null);
|
|
123
|
+
|
|
124
|
+
const handleOpen = () => setVisible(true);
|
|
125
|
+
const handleClose = () => setVisible(false);
|
|
126
|
+
|
|
127
|
+
const options = ['Option 1', 'Option 2', 'Option 3'];
|
|
128
|
+
|
|
129
|
+
const handleSelect = (value: string) => {
|
|
130
|
+
setSelectedValue(value);
|
|
131
|
+
trayRef.current?.close();
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<VStack gap={2}>
|
|
136
|
+
<Button onPress={handleOpen}>Open Menu Tray</Button>
|
|
137
|
+
{visible && (
|
|
138
|
+
<Tray ref={trayRef} title="Select an Option" onCloseComplete={handleClose}>
|
|
139
|
+
<Menu value={selectedValue} onChange={handleSelect}>
|
|
140
|
+
{options.map((option) => (
|
|
141
|
+
<SelectOption
|
|
142
|
+
key={option}
|
|
143
|
+
title={option}
|
|
144
|
+
value={option}
|
|
145
|
+
onPress={() => handleSelect(option)}
|
|
146
|
+
/>
|
|
147
|
+
))}
|
|
148
|
+
</Menu>
|
|
149
|
+
</Tray>
|
|
150
|
+
)}
|
|
151
|
+
</VStack>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Multiple Overlay Flow
|
|
157
|
+
|
|
158
|
+
When transitioning between overlays, ensure proper dismounting using `onCloseComplete`:
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
function TrayToModalFlow() {
|
|
162
|
+
const [isTrayVisible, setIsTrayVisible] = useState(false);
|
|
163
|
+
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
164
|
+
|
|
165
|
+
const openTray = () => setIsTrayVisible(true);
|
|
166
|
+
const closeTray = () => setIsTrayVisible(false);
|
|
167
|
+
const openModal = () => setIsModalVisible(true);
|
|
168
|
+
const closeModal = () => setIsModalVisible(false);
|
|
169
|
+
|
|
170
|
+
const handleTrayClose = useCallback(() => {
|
|
171
|
+
closeTray();
|
|
172
|
+
openModal();
|
|
173
|
+
}, []);
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<VStack gap={2}>
|
|
177
|
+
<Button onPress={openTray}>Start Flow</Button>
|
|
178
|
+
{isTrayVisible && (
|
|
179
|
+
<Tray title="First Step" onCloseComplete={handleTrayClose}>
|
|
180
|
+
{({ handleClose }) => (
|
|
181
|
+
<VStack gap={2} padding={3}>
|
|
182
|
+
<Text>Click below to continue to the modal</Text>
|
|
183
|
+
<Button onPress={handleClose}>Continue to Modal</Button>
|
|
184
|
+
</VStack>
|
|
185
|
+
)}
|
|
186
|
+
</Tray>
|
|
187
|
+
)}
|
|
188
|
+
<Modal visible={isModalVisible} onRequestClose={closeModal}>
|
|
189
|
+
<ModalHeader title="Second Step" />
|
|
190
|
+
<ModalBody>
|
|
191
|
+
<VStack gap={2} padding={3}>
|
|
192
|
+
<Text>This is the second step in the flow.</Text>
|
|
193
|
+
<Button onPress={closeModal}>Finish</Button>
|
|
194
|
+
</VStack>
|
|
195
|
+
</ModalBody>
|
|
196
|
+
</Modal>
|
|
197
|
+
</VStack>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Note: The Tray component is built on top of the Drawer component and provides a standardized way to present bottom sheets in your mobile application. Key points:
|
|
203
|
+
|
|
204
|
+
- Use `onCloseComplete` for cleanup when the tray is dismissed
|
|
205
|
+
- Children can be either a React node or a render function that receives a `handleClose` function
|
|
206
|
+
- The `ref` provides `open()` and `close()` methods for controlling the tray
|
|
207
|
+
- Use `disablePanGesture` when implementing scrollable content
|
|
208
|
+
- When transitioning between overlays, ensure proper dismounting using lifecycle methods
|
|
209
|
+
|
|
210
|
+
## Props
|
|
211
|
+
|
|
212
|
+
| Prop | Type | Required | Default | Description |
|
|
213
|
+
| --- | --- | --- | --- | --- |
|
|
214
|
+
| `onCloseComplete` | `() => void` | Yes | `-` | Action that will happen when drawer is dismissed |
|
|
215
|
+
| `animated` | `boolean` | No | `-` | - |
|
|
216
|
+
| `animationType` | `none \| slide \| fade` | No | `-` | The animationType prop controls how the modal animates. - slide slides in from the bottom - fade fades into view - none appears without an animation |
|
|
217
|
+
| `disableCapturePanGestureToDismiss` | `boolean` | No | `false` | Prevents the Drawer from capturing pan gestures on children. Set to true when using a ScrollView as a child |
|
|
218
|
+
| `handleBarAccessibilityLabel` | `string` | No | `-` | Accessibility label for handlebar |
|
|
219
|
+
| `hardwareAccelerated` | `boolean` | No | `-` | Controls whether to force hardware acceleration for the underlying window. |
|
|
220
|
+
| `hideHandleBar` | `boolean` | No | `false` | The HandleBar by default only is used for a bottom pinned drawer. This removes it. |
|
|
221
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
222
|
+
| `onBlur` | `(() => void)` | No | `-` | Callback fired when the overlay is pressed, or swipe to close |
|
|
223
|
+
| `onDismiss` | `(() => void)` | No | `-` | The onDismiss prop allows passing a function that will be called once the modal has been dismissed. |
|
|
224
|
+
| `onOrientationChange` | `((event: NativeSyntheticEvent<any>) => void)` | No | `-` | The onOrientationChange callback is called when the orientation changes while the modal is being displayed. The orientation provided is only portrait or landscape. This callback is also called on initial render, regardless of the current orientation. |
|
|
225
|
+
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
226
|
+
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
227
|
+
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
228
|
+
| `onPointerDownCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
229
|
+
| `onPointerEnter` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
230
|
+
| `onPointerEnterCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
231
|
+
| `onPointerLeave` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
232
|
+
| `onPointerLeaveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
233
|
+
| `onPointerMove` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
234
|
+
| `onPointerMoveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
235
|
+
| `onPointerUp` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
236
|
+
| `onPointerUpCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
237
|
+
| `onShow` | `((event: NativeSyntheticEvent<any>) => void)` | No | `-` | The onShow prop allows passing a function that will be called once the modal has been shown. |
|
|
238
|
+
| `onVisibilityChange` | `((context: visible \| hidden) => void)` | No | `-` | Optional callback that, if provided, will be triggered when the Tray is toggled open/ closed If used for analytics, context (visible \| hidden) can be bundled with the event info to track whether the multiselect was toggled into or out of view |
|
|
239
|
+
| `presentationStyle` | `fullScreen \| pageSheet \| formSheet \| overFullScreen` | No | `-` | The presentationStyle determines the style of modal to show |
|
|
240
|
+
| `preventDismissGestures` | `boolean` | No | `false` | Prevents a user from dismissing the drawer by pressing the overlay or swiping |
|
|
241
|
+
| `preventHardwareBackBehaviorAndroid` | `boolean` | No | `false` | Prevents a user from dismissing the drawer by pressing hardware back button on Android |
|
|
242
|
+
| `ref` | `((instance: DrawerRefBaseProps \| null) => void) \| RefObject<DrawerRefBaseProps> \| null` | No | `-` | - |
|
|
243
|
+
| `statusBarTranslucent` | `boolean` | No | `-` | Determines whether your modal should go under the system statusbar. |
|
|
244
|
+
| `stickyFooter` | `ReactNode \| DrawerRenderChildren` | No | `-` | StickyFooter to be rendered at bottom of Drawer |
|
|
245
|
+
| `supportedOrientations` | `(portrait \| portrait-upside-down \| landscape \| landscape-left \| landscape-right)[]` | No | `-` | The supportedOrientations prop allows the modal to be rotated to any of the specified orientations. On iOS, the modal is still restricted by whats specified in your apps Info.plists UISupportedInterfaceOrientations field. |
|
|
246
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID Used to locate this view in end-to-end tests. |
|
|
247
|
+
| `title` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Text or ReactNode for optional Tray title |
|
|
248
|
+
| `transparent` | `boolean` | No | `-` | The transparent prop determines whether your modal will fill the entire view. Setting this to true will render the modal over a transparent background. |
|
|
249
|
+
| `verticalDrawerPercentageOfView` | `number` | No | `-` | Allow user of component to define maximum percentage of screen that can be taken up by the Drawer |
|
|
250
|
+
| `visible` | `boolean` | No | `-` | The visible prop determines whether your modal is visible. |
|
|
251
|
+
|
|
252
|
+
|