@coinbase/cds-mcp-server 8.17.3 → 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.
Files changed (284) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/mcp-docs/mobile/components/Accordion.txt +11 -12
  3. package/mcp-docs/mobile/components/AccordionItem.txt +5 -6
  4. package/mcp-docs/mobile/components/Alert.txt +21 -22
  5. package/mcp-docs/mobile/components/AreaChart.txt +118 -119
  6. package/mcp-docs/mobile/components/Avatar.txt +82 -83
  7. package/mcp-docs/mobile/components/AvatarButton.txt +103 -104
  8. package/mcp-docs/mobile/components/Banner.txt +100 -101
  9. package/mcp-docs/mobile/components/BarChart.txt +120 -121
  10. package/mcp-docs/mobile/components/Box.txt +65 -66
  11. package/mcp-docs/mobile/components/BrowserBar.txt +38 -39
  12. package/mcp-docs/mobile/components/Button.txt +78 -79
  13. package/mcp-docs/mobile/components/ButtonGroup.txt +10 -11
  14. package/mcp-docs/mobile/components/Carousel.txt +103 -104
  15. package/mcp-docs/mobile/components/CartesianChart.txt +107 -108
  16. package/mcp-docs/mobile/components/CellMedia.txt +15 -16
  17. package/mcp-docs/mobile/components/Checkbox.txt +35 -36
  18. package/mcp-docs/mobile/components/CheckboxCell.txt +73 -74
  19. package/mcp-docs/mobile/components/CheckboxGroup.txt +24 -25
  20. package/mcp-docs/mobile/components/Chip.txt +67 -68
  21. package/mcp-docs/mobile/components/Coachmark.txt +42 -43
  22. package/mcp-docs/mobile/components/Collapsible.txt +15 -16
  23. package/mcp-docs/mobile/components/ContainedAssetCard.txt +16 -17
  24. package/mcp-docs/mobile/components/ContentCard.txt +99 -100
  25. package/mcp-docs/mobile/components/ContentCardBody.txt +23 -24
  26. package/mcp-docs/mobile/components/ContentCardFooter.txt +19 -20
  27. package/mcp-docs/mobile/components/ContentCardHeader.txt +33 -34
  28. package/mcp-docs/mobile/components/ContentCell.txt +102 -103
  29. package/mcp-docs/mobile/components/ControlGroup.txt +106 -107
  30. package/mcp-docs/mobile/components/DatePicker.txt +121 -122
  31. package/mcp-docs/mobile/components/Divider.txt +31 -32
  32. package/mcp-docs/mobile/components/DotCount.txt +15 -16
  33. package/mcp-docs/mobile/components/DotStatusColor.txt +12 -13
  34. package/mcp-docs/mobile/components/DotSymbol.txt +21 -22
  35. package/mcp-docs/mobile/components/Fallback.txt +49 -50
  36. package/mcp-docs/mobile/components/FloatingAssetCard.txt +13 -14
  37. package/mcp-docs/mobile/components/HStack.txt +99 -100
  38. package/mcp-docs/mobile/components/HeroSquare.txt +11 -12
  39. package/mcp-docs/mobile/components/Icon.txt +16 -17
  40. package/mcp-docs/mobile/components/IconButton.txt +104 -105
  41. package/mcp-docs/mobile/components/InputChip.txt +62 -63
  42. package/mcp-docs/mobile/components/Interactable.txt +72 -73
  43. package/mcp-docs/mobile/components/LineChart.txt +117 -118
  44. package/mcp-docs/mobile/components/Link.txt +113 -114
  45. package/mcp-docs/mobile/components/ListCell.txt +149 -128
  46. package/mcp-docs/mobile/components/LogoMark.txt +8 -9
  47. package/mcp-docs/mobile/components/LogoWordMark.txt +7 -8
  48. package/mcp-docs/mobile/components/Lottie.txt +39 -40
  49. package/mcp-docs/mobile/components/LottieStatusAnimation.txt +11 -12
  50. package/mcp-docs/mobile/components/Modal.txt +36 -37
  51. package/mcp-docs/mobile/components/ModalBody.txt +5 -6
  52. package/mcp-docs/mobile/components/ModalFooter.txt +5 -6
  53. package/mcp-docs/mobile/components/ModalHeader.txt +5 -6
  54. package/mcp-docs/mobile/components/MultiContentModule.txt +107 -108
  55. package/mcp-docs/mobile/components/NavigationTitle.txt +13 -14
  56. package/mcp-docs/mobile/components/NavigationTitleSelect.txt +20 -21
  57. package/mcp-docs/mobile/components/NudgeCard.txt +20 -21
  58. package/mcp-docs/mobile/components/Numpad.txt +108 -109
  59. package/mcp-docs/mobile/components/Overlay.txt +45 -46
  60. package/mcp-docs/mobile/components/PageFooter.txt +57 -58
  61. package/mcp-docs/mobile/components/PageHeader.txt +79 -80
  62. package/mcp-docs/mobile/components/PeriodSelector.txt +98 -99
  63. package/mcp-docs/mobile/components/Pictogram.txt +11 -12
  64. package/mcp-docs/mobile/components/Point.txt +21 -22
  65. package/mcp-docs/mobile/components/PortalProvider.txt +7 -8
  66. package/mcp-docs/mobile/components/Pressable.txt +67 -68
  67. package/mcp-docs/mobile/components/ProgressBar.txt +18 -19
  68. package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +13 -14
  69. package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +13 -14
  70. package/mcp-docs/mobile/components/ProgressCircle.txt +22 -23
  71. package/mcp-docs/mobile/components/Radio.txt +35 -36
  72. package/mcp-docs/mobile/components/RadioCell.txt +73 -74
  73. package/mcp-docs/mobile/components/RadioGroup.txt +35 -36
  74. package/mcp-docs/mobile/components/ReferenceLine.txt +15 -16
  75. package/mcp-docs/mobile/components/RemoteImage.txt +47 -48
  76. package/mcp-docs/mobile/components/RemoteImageGroup.txt +11 -12
  77. package/mcp-docs/mobile/components/RollingNumber.txt +130 -131
  78. package/mcp-docs/mobile/components/Scrubber.txt +19 -20
  79. package/mcp-docs/mobile/components/SearchInput.txt +77 -78
  80. package/mcp-docs/mobile/components/SectionHeader.txt +16 -17
  81. package/mcp-docs/mobile/components/SegmentedTabs.txt +105 -106
  82. package/mcp-docs/mobile/components/Select.txt +35 -36
  83. package/mcp-docs/mobile/components/SelectChip.txt +143 -144
  84. package/mcp-docs/mobile/components/SelectOption.txt +26 -27
  85. package/mcp-docs/mobile/components/SlideButton.txt +128 -129
  86. package/mcp-docs/mobile/components/Spacer.txt +27 -28
  87. package/mcp-docs/mobile/components/Sparkline.txt +18 -19
  88. package/mcp-docs/mobile/components/SparklineGradient.txt +18 -19
  89. package/mcp-docs/mobile/components/SparklineInteractive.txt +37 -38
  90. package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +12 -13
  91. package/mcp-docs/mobile/components/Spinner.txt +15 -16
  92. package/mcp-docs/mobile/components/SpotIcon.txt +11 -12
  93. package/mcp-docs/mobile/components/SpotRectangle.txt +11 -12
  94. package/mcp-docs/mobile/components/SpotSquare.txt +11 -12
  95. package/mcp-docs/mobile/components/Stepper.txt +113 -114
  96. package/mcp-docs/mobile/components/SubBrandLogoMark.txt +8 -9
  97. package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +8 -9
  98. package/mcp-docs/mobile/components/Switch.txt +35 -36
  99. package/mcp-docs/mobile/components/TabIndicator.txt +12 -13
  100. package/mcp-docs/mobile/components/TabLabel.txt +28 -29
  101. package/mcp-docs/mobile/components/TabNavigation.txt +41 -42
  102. package/mcp-docs/mobile/components/TabbedChips.txt +38 -39
  103. package/mcp-docs/mobile/components/Tabs.txt +76 -77
  104. package/mcp-docs/mobile/components/Tag.txt +102 -103
  105. package/mcp-docs/mobile/components/Text.txt +91 -92
  106. package/mcp-docs/mobile/components/TextInput.txt +107 -108
  107. package/mcp-docs/mobile/components/ThemeProvider.txt +8 -9
  108. package/mcp-docs/mobile/components/Toast.txt +82 -83
  109. package/mcp-docs/mobile/components/Tooltip.txt +20 -21
  110. package/mcp-docs/mobile/components/TopNavBar.txt +55 -56
  111. package/mcp-docs/mobile/components/Tour.txt +18 -19
  112. package/mcp-docs/mobile/components/Tray.txt +43 -44
  113. package/mcp-docs/mobile/components/UpsellCard.txt +16 -17
  114. package/mcp-docs/mobile/components/VStack.txt +99 -100
  115. package/mcp-docs/mobile/components/XAxis.txt +25 -26
  116. package/mcp-docs/mobile/components/YAxis.txt +26 -27
  117. package/mcp-docs/mobile/getting-started/{mcp-server.txt → ai-overview.txt} +51 -37
  118. package/mcp-docs/mobile/getting-started/installation.txt +57 -0
  119. package/mcp-docs/mobile/getting-started/introduction.txt +3 -0
  120. package/mcp-docs/mobile/getting-started/playground.txt +3 -0
  121. package/mcp-docs/mobile/getting-started/styling.txt +84 -0
  122. package/mcp-docs/mobile/getting-started/theming.txt +286 -0
  123. package/mcp-docs/mobile/hooks/useDimensions.txt +27 -2
  124. package/mcp-docs/mobile/hooks/useEventHandler.txt +120 -0
  125. package/mcp-docs/mobile/hooks/useMergeRefs.txt +116 -0
  126. package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +67 -2
  127. package/mcp-docs/mobile/hooks/usePreviousValue.txt +74 -0
  128. package/mcp-docs/mobile/hooks/useRefMap.txt +178 -0
  129. package/mcp-docs/mobile/hooks/useTheme.txt +213 -2
  130. package/mcp-docs/mobile/routes.txt +8 -1
  131. package/mcp-docs/web/components/Accordion.txt +12 -13
  132. package/mcp-docs/web/components/AccordionItem.txt +5 -6
  133. package/mcp-docs/web/components/Alert.txt +24 -25
  134. package/mcp-docs/web/components/AreaChart.txt +137 -138
  135. package/mcp-docs/web/components/Avatar.txt +91 -92
  136. package/mcp-docs/web/components/AvatarButton.txt +113 -114
  137. package/mcp-docs/web/components/Banner.txt +101 -102
  138. package/mcp-docs/web/components/BarChart.txt +367 -368
  139. package/mcp-docs/web/components/Box.txt +65 -66
  140. package/mcp-docs/web/components/Button.txt +81 -82
  141. package/mcp-docs/web/components/ButtonGroup.txt +10 -11
  142. package/mcp-docs/web/components/Calendar.txt +56 -57
  143. package/mcp-docs/web/components/Carousel.txt +116 -117
  144. package/mcp-docs/web/components/CartesianChart.txt +357 -358
  145. package/mcp-docs/web/components/CellMedia.txt +14 -15
  146. package/mcp-docs/web/components/Checkbox.txt +22 -23
  147. package/mcp-docs/web/components/CheckboxCell.txt +70 -71
  148. package/mcp-docs/web/components/CheckboxGroup.txt +15 -16
  149. package/mcp-docs/web/components/Chip.txt +67 -68
  150. package/mcp-docs/web/components/Coachmark.txt +69 -70
  151. package/mcp-docs/web/components/Collapsible.txt +15 -16
  152. package/mcp-docs/web/components/ContainedAssetCard.txt +108 -109
  153. package/mcp-docs/web/components/ContentCard.txt +101 -102
  154. package/mcp-docs/web/components/ContentCardBody.txt +23 -24
  155. package/mcp-docs/web/components/ContentCardFooter.txt +19 -20
  156. package/mcp-docs/web/components/ContentCardHeader.txt +33 -34
  157. package/mcp-docs/web/components/ContentCell.txt +85 -86
  158. package/mcp-docs/web/components/ControlGroup.txt +108 -109
  159. package/mcp-docs/web/components/DatePicker.txt +59 -60
  160. package/mcp-docs/web/components/Divider.txt +31 -32
  161. package/mcp-docs/web/components/DotCount.txt +17 -18
  162. package/mcp-docs/web/components/DotStatusColor.txt +12 -13
  163. package/mcp-docs/web/components/DotSymbol.txt +24 -25
  164. package/mcp-docs/web/components/Dropdown.txt +31 -32
  165. package/mcp-docs/web/components/Fallback.txt +49 -50
  166. package/mcp-docs/web/components/FloatingAssetCard.txt +108 -109
  167. package/mcp-docs/web/components/FullscreenAlert.txt +20 -21
  168. package/mcp-docs/web/components/FullscreenModal.txt +28 -29
  169. package/mcp-docs/web/components/FullscreenModalLayout.txt +19 -20
  170. package/mcp-docs/web/components/Grid.txt +106 -107
  171. package/mcp-docs/web/components/GridColumn.txt +96 -97
  172. package/mcp-docs/web/components/HStack.txt +101 -102
  173. package/mcp-docs/web/components/HeroSquare.txt +12 -13
  174. package/mcp-docs/web/components/Icon.txt +27 -28
  175. package/mcp-docs/web/components/IconButton.txt +117 -118
  176. package/mcp-docs/web/components/InputChip.txt +62 -63
  177. package/mcp-docs/web/components/Interactable.txt +75 -76
  178. package/mcp-docs/web/components/LineChart.txt +366 -367
  179. package/mcp-docs/web/components/Link.txt +114 -115
  180. package/mcp-docs/web/components/ListCell.txt +157 -136
  181. package/mcp-docs/web/components/LogoMark.txt +8 -9
  182. package/mcp-docs/web/components/LogoWordMark.txt +7 -8
  183. package/mcp-docs/web/components/Lottie.txt +44 -45
  184. package/mcp-docs/web/components/LottieStatusAnimation.txt +11 -12
  185. package/mcp-docs/web/components/MediaQueryProvider.txt +7 -8
  186. package/mcp-docs/web/components/Modal.txt +69 -66
  187. package/mcp-docs/web/components/ModalBody.txt +5 -6
  188. package/mcp-docs/web/components/ModalFooter.txt +5 -6
  189. package/mcp-docs/web/components/ModalHeader.txt +5 -6
  190. package/mcp-docs/web/components/MultiContentModule.txt +109 -110
  191. package/mcp-docs/web/components/NavigationBar.txt +18 -19
  192. package/mcp-docs/web/components/NavigationTitle.txt +7 -8
  193. package/mcp-docs/web/components/NavigationTitleSelect.txt +9 -10
  194. package/mcp-docs/web/components/NudgeCard.txt +61 -62
  195. package/mcp-docs/web/components/Overlay.txt +57 -58
  196. package/mcp-docs/web/components/PageFooter.txt +77 -78
  197. package/mcp-docs/web/components/PageHeader.txt +107 -108
  198. package/mcp-docs/web/components/Pagination.txt +115 -116
  199. package/mcp-docs/web/components/PeriodSelector.txt +158 -159
  200. package/mcp-docs/web/components/Pictogram.txt +13 -14
  201. package/mcp-docs/web/components/Point.txt +169 -170
  202. package/mcp-docs/web/components/PortalProvider.txt +6 -7
  203. package/mcp-docs/web/components/Pressable.txt +73 -74
  204. package/mcp-docs/web/components/ProgressBar.txt +20 -21
  205. package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +15 -16
  206. package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +15 -16
  207. package/mcp-docs/web/components/ProgressCircle.txt +24 -25
  208. package/mcp-docs/web/components/Radio.txt +22 -23
  209. package/mcp-docs/web/components/RadioCell.txt +83 -84
  210. package/mcp-docs/web/components/RadioGroup.txt +22 -23
  211. package/mcp-docs/web/components/ReferenceLine.txt +22 -23
  212. package/mcp-docs/web/components/RemoteImage.txt +49 -50
  213. package/mcp-docs/web/components/RemoteImageGroup.txt +11 -12
  214. package/mcp-docs/web/components/RollingNumber.txt +131 -132
  215. package/mcp-docs/web/components/Scrubber.txt +22 -23
  216. package/mcp-docs/web/components/SearchInput.txt +29 -30
  217. package/mcp-docs/web/components/SectionHeader.txt +98 -99
  218. package/mcp-docs/web/components/SegmentedTabs.txt +109 -110
  219. package/mcp-docs/web/components/Select.txt +22 -23
  220. package/mcp-docs/web/components/SelectChip.txt +134 -135
  221. package/mcp-docs/web/components/SelectOption.txt +31 -32
  222. package/mcp-docs/web/components/Sidebar.txt +109 -110
  223. package/mcp-docs/web/components/SidebarItem.txt +6 -7
  224. package/mcp-docs/web/components/SidebarMoreMenu.txt +5 -6
  225. package/mcp-docs/web/components/Spacer.txt +57 -58
  226. package/mcp-docs/web/components/Sparkline.txt +18 -19
  227. package/mcp-docs/web/components/SparklineGradient.txt +18 -19
  228. package/mcp-docs/web/components/SparklineInteractive.txt +34 -35
  229. package/mcp-docs/web/components/SparklineInteractiveHeader.txt +12 -13
  230. package/mcp-docs/web/components/Spinner.txt +15 -16
  231. package/mcp-docs/web/components/SpotIcon.txt +12 -13
  232. package/mcp-docs/web/components/SpotRectangle.txt +12 -13
  233. package/mcp-docs/web/components/SpotSquare.txt +12 -13
  234. package/mcp-docs/web/components/Stepper.txt +119 -120
  235. package/mcp-docs/web/components/SubBrandLogoMark.txt +8 -9
  236. package/mcp-docs/web/components/SubBrandLogoWordMark.txt +8 -9
  237. package/mcp-docs/web/components/Switch.txt +23 -24
  238. package/mcp-docs/web/components/TabIndicator.txt +12 -13
  239. package/mcp-docs/web/components/TabLabel.txt +28 -29
  240. package/mcp-docs/web/components/TabNavigation.txt +41 -42
  241. package/mcp-docs/web/components/TabbedChips.txt +38 -39
  242. package/mcp-docs/web/components/Table.txt +17 -18
  243. package/mcp-docs/web/components/TableBody.txt +9 -10
  244. package/mcp-docs/web/components/TableCaption.txt +13 -14
  245. package/mcp-docs/web/components/TableCell.txt +21 -22
  246. package/mcp-docs/web/components/TableCellFallback.txt +16 -17
  247. package/mcp-docs/web/components/TableFooter.txt +9 -10
  248. package/mcp-docs/web/components/TableHeader.txt +10 -11
  249. package/mcp-docs/web/components/TableRow.txt +13 -14
  250. package/mcp-docs/web/components/Tabs.txt +94 -95
  251. package/mcp-docs/web/components/Tag.txt +106 -107
  252. package/mcp-docs/web/components/Text.txt +110 -111
  253. package/mcp-docs/web/components/TextInput.txt +32 -33
  254. package/mcp-docs/web/components/ThemeProvider.txt +27 -28
  255. package/mcp-docs/web/components/TileButton.txt +37 -38
  256. package/mcp-docs/web/components/Toast.txt +82 -83
  257. package/mcp-docs/web/components/Tooltip.txt +22 -23
  258. package/mcp-docs/web/components/Tour.txt +21 -22
  259. package/mcp-docs/web/components/Tray.txt +23 -24
  260. package/mcp-docs/web/components/UpsellCard.txt +16 -17
  261. package/mcp-docs/web/components/VStack.txt +101 -102
  262. package/mcp-docs/web/components/XAxis.txt +25 -26
  263. package/mcp-docs/web/components/YAxis.txt +26 -27
  264. package/mcp-docs/web/getting-started/{mcp-server.txt → ai-overview.txt} +51 -37
  265. package/mcp-docs/web/getting-started/installation.txt +103 -0
  266. package/mcp-docs/web/getting-started/introduction.txt +3 -0
  267. package/mcp-docs/web/getting-started/playground.txt +3 -0
  268. package/mcp-docs/web/getting-started/styling.txt +161 -0
  269. package/mcp-docs/web/getting-started/templates.txt +121 -0
  270. package/mcp-docs/web/getting-started/theming.txt +426 -0
  271. package/mcp-docs/web/hooks/useBreakpoints.txt +30 -2
  272. package/mcp-docs/web/hooks/useDimensions.txt +61 -2
  273. package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
  274. package/mcp-docs/web/hooks/useHasMounted.txt +22 -2
  275. package/mcp-docs/web/hooks/useIsoEffect.txt +18 -2
  276. package/mcp-docs/web/hooks/useMediaQuery.txt +22 -2
  277. package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
  278. package/mcp-docs/web/hooks/useOverlayContentContext.txt +64 -2
  279. package/mcp-docs/web/hooks/usePreviousValue.txt +74 -0
  280. package/mcp-docs/web/hooks/useRefMap.txt +178 -0
  281. package/mcp-docs/web/hooks/useScrollBlocker.txt +21 -2
  282. package/mcp-docs/web/hooks/useTheme.txt +261 -2
  283. package/mcp-docs/web/routes.txt +9 -1
  284. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
-
2
1
  # useHasMounted
2
+
3
3
  Returns a boolean indicating if the component has mounted.
4
4
 
5
5
  ## Import
@@ -8,6 +8,27 @@ Returns a boolean indicating if the component has mounted.
8
8
  import { useHasMounted } from '@coinbase/cds-web/hooks/useHasMounted'
9
9
  ```
10
10
 
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useHasMounted` hook does not accept any parameters.
16
+
17
+ ### Returns
18
+
19
+ ```tsx
20
+ type Return = boolean;
21
+ ```
22
+
23
+ Returns a boolean:
24
+
25
+ - `true`: Component has mounted and is running in a browser environment
26
+ - `false`: Component hasn't mounted yet or is running in a non-browser environment (e.g., server-side rendering)
27
+
28
+ :::tip
29
+ This hook is useful for preventing hydration mismatches and ensuring code only runs in the browser environment.
30
+ :::
31
+
11
32
  ## Examples
12
33
 
13
34
  `useHasMounted` should be used when conditionally rendering components or styles in SSR or SSG environments.
@@ -52,4 +73,3 @@ function Example() {
52
73
  }
53
74
  ```
54
75
 
55
-
@@ -1,5 +1,5 @@
1
-
2
1
  # useIsoEffect
2
+
3
3
  A safe way of calling useLayoutEffect only on the client. Does nothing on the server.
4
4
 
5
5
  ## Import
@@ -8,6 +8,23 @@ A safe way of calling useLayoutEffect only on the client. Does nothing on the se
8
8
  import { useIsoEffect } from '@coinbase/cds-web/hooks/useIsoEffect'
9
9
  ```
10
10
 
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useIsoEffect` hook accepts the same parameters as React's `useEffect` and `useLayoutEffect`:
16
+
17
+ - `effect: () => (void | (() => void))` - The effect function to run
18
+ - `deps?: any[]` - Optional array of dependencies
19
+
20
+ ### Returns
21
+
22
+ Returns nothing (void).
23
+
24
+ :::tip
25
+ This hook automatically uses `useLayoutEffect` when running in the browser and falls back to `useEffect` during server-side rendering. This prevents warnings and ensures proper timing of effects across different environments.
26
+ :::
27
+
11
28
  ## Examples
12
29
 
13
30
  ### Usage
@@ -39,4 +56,3 @@ function Example() {
39
56
  }
40
57
  ```
41
58
 
42
-
@@ -1,5 +1,5 @@
1
-
2
1
  # useMediaQuery
2
+
3
3
  Subscribes to window.matchMedia changes with SSR support.
4
4
 
5
5
  ## Import
@@ -8,6 +8,27 @@ Subscribes to window.matchMedia changes with SSR support.
8
8
  import { useMediaQuery } from '@coinbase/cds-web/hooks/useMediaQuery'
9
9
  ```
10
10
 
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useMediaQuery` hook accepts a single parameter:
16
+
17
+ - `query: string` - A CSS media query string to subscribe to. Can include:
18
+ - **Viewport dimensions**: `(min-width: 768px)`, `(max-width: 767px)`, `(width: 1024px)`
19
+ - **User preferences**: `(prefers-color-scheme: dark)`, `(prefers-reduced-motion: reduce)`
20
+ - **Device features**: `(orientation: portrait)`, `(pointer: coarse)`, `(hover: hover)`
21
+ - **Complex queries**: Combined with `and`, `not`, or `,` operators
22
+
23
+ ### Returns
24
+
25
+ Returns a `boolean` that indicates whether the media query matches:
26
+
27
+ - `true` - The media query conditions are currently met
28
+ - `false` - The media query conditions are not met
29
+ - Automatically updates when the media query state changes
30
+ - Uses MediaQueryProvider's default values during server-side rendering
31
+
11
32
  ## Examples
12
33
 
13
34
  ### Basic usage
@@ -91,4 +112,3 @@ Complex queries cannot be solved during SSR. They are solved on the client by ca
91
112
  };
92
113
  ```
93
114
 
94
-
@@ -0,0 +1,116 @@
1
+ # useMergeRefs
2
+
3
+ Combines multiple refs into a single ref callback, allowing a component to work with multiple ref instances simultaneously. Useful when you need to combine refs from different sources, such as forwarded refs and internal component state.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { useMergeRefs } from '@coinbase/cds-common/hooks/useMergeRefs'
9
+ ```
10
+
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useMergeRefs` hook accepts a spread of refs as its parameter:
16
+
17
+ - `...refs: (React.MutableRefObject<T> | React.LegacyRef<T> | undefined | null)[]` - An array of refs to merge. Can include:
18
+ - `MutableRefObject` - Object-based refs created with `useRef`
19
+ - `LegacyRef` - Function-based refs or string refs (legacy)
20
+ - `undefined` or `null` - Optional refs that might not be provided
21
+
22
+ ### Returns
23
+
24
+ Returns a `React.RefCallback<T>` function that can be used as a ref:
25
+
26
+ - The returned callback handles updating all provided refs when the referenced element changes
27
+ - Properly handles both object-based and function-based refs
28
+ - Safely handles undefined or null refs by ignoring them
29
+
30
+ :::tip
31
+ This hook is particularly useful when working with components that need to combine multiple refs, such as when using both forwarded refs and internal state refs, or when composing components that each require their own ref.
32
+ :::
33
+
34
+ ## Examples
35
+
36
+ ### Basic usage
37
+
38
+ ```tsx live
39
+ function Example() {
40
+ // Create an internal ref for component logic
41
+ const internalRef = useRef<HTMLDivElement>(null);
42
+
43
+ // Simulating a forwarded ref from parent
44
+ const Component = forwardRef((props, forwardedRef) => {
45
+ // Merge the internal ref with the forwarded ref
46
+ const refs = useMergeRefs(forwardedRef, internalRef);
47
+
48
+ return (
49
+ <Box ref={refs} padding={3} background="bgAlternate" borderRadius={300}>
50
+ <TextBody>This box uses a merged ref</TextBody>
51
+ </Box>
52
+ );
53
+ });
54
+
55
+ return <Component />;
56
+ }
57
+ ```
58
+
59
+ ### With Multiple Refs
60
+
61
+ ```tsx live
62
+ function Example() {
63
+ const firstRef = useRef<HTMLDivElement>(null);
64
+ const secondRef = useRef<HTMLDivElement>(null);
65
+ const thirdRef = useRef<HTMLDivElement>(null);
66
+
67
+ // Function to check if all refs are properly set
68
+ const checkRefs = () => {
69
+ const allRefsSet = firstRef.current && secondRef.current && thirdRef.current;
70
+ alert(`All refs are ${allRefsSet ? 'set' : 'not set'}`);
71
+ };
72
+
73
+ // Merge all three refs
74
+ const mergedRefs = useMergeRefs(firstRef, secondRef, thirdRef);
75
+
76
+ return (
77
+ <VStack gap={2}>
78
+ <Box ref={mergedRefs} padding={3} background="bgAlternate" borderRadius={300}>
79
+ <TextBody>This element is referenced by three refs</TextBody>
80
+ </Box>
81
+ <Button onClick={checkRefs}>Check Refs</Button>
82
+ </VStack>
83
+ );
84
+ }
85
+ ```
86
+
87
+ ### With Function Ref
88
+
89
+ ```tsx live
90
+ function Example() {
91
+ const [elementWidth, setElementWidth] = useState<number>(0);
92
+
93
+ // Create a function ref that measures the element
94
+ const functionRef = (element: HTMLDivElement | null) => {
95
+ if (element) {
96
+ setElementWidth(element.offsetWidth);
97
+ }
98
+ };
99
+
100
+ // Create an object ref for other purposes
101
+ const objectRef = useRef<HTMLDivElement>(null);
102
+
103
+ // Merge both types of refs
104
+ const refs = useMergeRefs(functionRef, objectRef);
105
+
106
+ return (
107
+ <VStack gap={2}>
108
+ <Box ref={refs} padding={3} background="bgAlternate" borderRadius={300} width="100%">
109
+ <TextBody>This box uses both function and object refs</TextBody>
110
+ </Box>
111
+ <TextBody>Box width: {elementWidth}px</TextBody>
112
+ </VStack>
113
+ );
114
+ }
115
+ ```
116
+
@@ -1,5 +1,5 @@
1
-
2
1
  # useOverlayContentContext
2
+
3
3
  A React context and hook for detecting if components are rendered inside overlay containers like modals, drawers, tours, and trays.
4
4
 
5
5
  ## Import
@@ -8,6 +8,69 @@ A React context and hook for detecting if components are rendered inside overlay
8
8
  import { OverlayContentContext, useOverlayContentContext } from '@coinbase/cds-common/overlays/OverlayContentContext'
9
9
  ```
10
10
 
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useOverlayContentContext` hook accepts no parameters.
16
+
17
+ ### Returns
18
+
19
+ Returns an `OverlayContentContextValue` object with overlay state information:
20
+
21
+ - `isOverlay?: boolean` - True if inside any overlay component (automatically derived from other values if not explicitly set)
22
+ - `isModal?: boolean` - True if inside a Modal component
23
+ - `isDrawer?: boolean` - True if inside a Drawer or Tray component
24
+ - `isTour?: boolean` - True if inside a Tour component
25
+
26
+ All properties are optional and will be `undefined` when outside of overlay contexts.
27
+
28
+ :::tip
29
+ This hook is safe to use anywhere in your component tree - it does not throw an error when used outside a provider. When `isOverlay` is not explicitly provided, it will be automatically derived as `true` if any of the other overlay type flags are `true`.
30
+ :::
31
+
32
+ ### OverlayContentContext
33
+
34
+ The React context that provides overlay state information. Can be used directly with `React.useContext` or through the `useOverlayContentContext` hook.
35
+
36
+ #### Context Value Type
37
+
38
+ ```typescript
39
+ type OverlayContentContextValue = {
40
+ isOverlay?: boolean;
41
+ isModal?: boolean;
42
+ isDrawer?: boolean;
43
+ isTour?: boolean;
44
+ };
45
+ ```
46
+
47
+ ### Provider Usage
48
+
49
+ ```tsx
50
+ import { OverlayContentContext } from '@coinbase/cds-common/overlays/OverlayContentContext';
51
+
52
+ function MyOverlayComponent() {
53
+ const contextValue = {
54
+ isModal: true,
55
+ isDrawer: false,
56
+ isTour: false,
57
+ // isOverlay will be automatically derived as true
58
+ };
59
+
60
+ return (
61
+ <OverlayContentContext.Provider value={contextValue}>
62
+ {/* Your overlay content */}
63
+ </OverlayContentContext.Provider>
64
+ );
65
+ }
66
+ ```
67
+
68
+ ### Automatic Derivation
69
+
70
+ If `isOverlay` is not explicitly provided in the context value, it will be automatically derived as `true` when any of `isModal`, `isDrawer`, or `isTour` is `true`. This ensures consistent behavior across the system.
71
+
72
+ **Important**: When adding new overlay types to the `OverlayContentContextValue` type, remember to update the derivation logic in the `useOverlayContentContext` hook.
73
+
11
74
  ## Examples
12
75
 
13
76
  The `useOverlayContentContext` hook provides information about whether a component is rendered inside various types of overlay containers. This is useful for conditional rendering and styling based on the overlay context.
@@ -214,4 +277,3 @@ function StylingExample() {
214
277
  }
215
278
  ```
216
279
 
217
-
@@ -0,0 +1,74 @@
1
+ # usePreviousValue
2
+
3
+ Returns the previous value of a given variable, useful for comparing current and previous states in effects or for tracking changes over time.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { usePreviousValue } from '@coinbase/cds-common/hooks/usePreviousValue'
9
+ ```
10
+
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `usePreviousValue` hook accepts a single parameter:
16
+
17
+ - `value: T` - The value to track. Can be of any type.
18
+
19
+ ### Returns
20
+
21
+ Returns the previous value of type `T | undefined`:
22
+
23
+ - Returns `undefined` on the first render
24
+ - Returns the previous value of the tracked value on subsequent renders
25
+
26
+ :::tip
27
+ This hook is useful for comparing the current value with its previous state, such as in animations, transitions, or when you need to react to value changes. The hook uses a ref to store the previous value, ensuring it persists between renders.
28
+ :::
29
+
30
+ ## Examples
31
+
32
+ ### Basic usage
33
+
34
+ ```tsx live
35
+ function Example() {
36
+ const [count, setCount] = useState(0);
37
+ const previousCount = usePreviousValue(count);
38
+
39
+ return (
40
+ <VStack gap={3} alignItems="start">
41
+ <VStack gap={1}>
42
+ <TextHeadline>Current count: {count}</TextHeadline>
43
+ <TextHeadline>Previous count: {previousCount ?? 'None'}</TextHeadline>
44
+ </VStack>
45
+ <Button onClick={() => setCount(count + 1)}>Increment</Button>
46
+ </VStack>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ### With Complex Values
52
+
53
+ ```tsx live
54
+ function Example() {
55
+ const [user, setUser] = useState({ name: 'John', age: 25 });
56
+ const previousUser = usePreviousValue(user);
57
+
58
+ const updateAge = () => {
59
+ setUser((prev) => ({ ...prev, age: prev.age + 1 }));
60
+ };
61
+
62
+ return (
63
+ <VStack gap={3} alignItems="start">
64
+ <VStack gap={1}>
65
+ <TextHeadline>Name: {user.name}</TextHeadline>
66
+ <TextHeadline>Age: {user.age}</TextHeadline>
67
+ <TextHeadline>Previous age: {previousUser?.age ?? 'None'}</TextHeadline>
68
+ </VStack>
69
+ <Button onClick={updateAge}>Add Year</Button>
70
+ </VStack>
71
+ );
72
+ }
73
+ ```
74
+
@@ -0,0 +1,178 @@
1
+ # useRefMap
2
+
3
+ Manages a collection of refs using a key-value map structure, allowing dynamic registration and retrieval of refs by their unique identifiers. Commonly used in components that need to track multiple DOM elements, such as tabs, tours, or complex navigation systems.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { useRefMap } from '@coinbase/cds-common/hooks/useRefMap'
9
+ ```
10
+
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useRefMap` hook accepts an optional configuration object:
16
+
17
+ - `options?: RefMapOptions<RefValue>` - Configuration options for the ref map
18
+ - `initialRefMap?: Record<string, RefValue>` - Optional initial map of refs
19
+
20
+ The generic type `RefValue` represents the type of values stored in the ref map (typically `HTMLElement` or a specific element type).
21
+
22
+ ### Returns
23
+
24
+ Returns a `RefMapApi<RefValue>` object with the following properties:
25
+
26
+ - `refs: Record<string, RefValue>` - The current map of all registered refs
27
+ - `getRef: (id: string) => RefValue | null` - Function to retrieve a ref by its ID
28
+ - `registerRef: (id: string, ref: RefValue) => void` - Function to register a new ref with an ID
29
+
30
+ :::tip
31
+ This hook is particularly useful when working with components that need to manage multiple refs, such as in tour guides where elements need to be highlighted, or in tab systems where tab panels need to be referenced. The hook maintains a stable reference to the ref map and its utility functions across renders.
32
+ :::
33
+
34
+ ## Examples
35
+
36
+ ### Basic usage
37
+
38
+ ```tsx live
39
+ function Example() {
40
+ const { registerRef, getRef } = useRefMap<HTMLDivElement>();
41
+ const toast = useToast();
42
+
43
+ const handleClick = () => {
44
+ // Get the element by its ID and log its dimensions
45
+ const element = getRef('box1');
46
+ if (element) {
47
+ toast.show(`Box dimensions: ${element.offsetWidth}x${element.offsetHeight}`);
48
+ }
49
+ };
50
+
51
+ return (
52
+ <VStack gap={2}>
53
+ <Box
54
+ ref={(el) => el && registerRef('box1', el)}
55
+ padding={3}
56
+ background="bgAlternate"
57
+ borderRadius={300}
58
+ >
59
+ <TextBody>This box is registered with ID 'box1'</TextBody>
60
+ </Box>
61
+ <Button onClick={handleClick}>Get Box Dimensions</Button>
62
+ </VStack>
63
+ );
64
+ }
65
+ ```
66
+
67
+ ### With Multiple Elements
68
+
69
+ ```tsx live
70
+ function Example() {
71
+ const { registerRef, getRef } = useRefMap<HTMLDivElement>();
72
+ const [activeId, setActiveId] = useState<string | null>(null);
73
+
74
+ const highlightElement = (id: string) => {
75
+ // Reset previous highlight
76
+ if (activeId) {
77
+ const prevElement = getRef(activeId);
78
+ if (prevElement) {
79
+ prevElement.style.outline = 'none';
80
+ }
81
+ }
82
+
83
+ // Highlight new element
84
+ const element = getRef(id);
85
+ if (element) {
86
+ element.style.outline = '2px solid var(--color-fgPrimary)';
87
+ setActiveId(id);
88
+ }
89
+ };
90
+
91
+ return (
92
+ <VStack gap={3}>
93
+ <HStack gap={2}>
94
+ <Button onClick={() => highlightElement('box1')}>Highlight Box 1</Button>
95
+ <Button onClick={() => highlightElement('box2')}>Highlight Box 2</Button>
96
+ <Button onClick={() => highlightElement('box3')}>Highlight Box 3</Button>
97
+ </HStack>
98
+
99
+ <VStack gap={2}>
100
+ <Box
101
+ ref={(el) => el && registerRef('box1', el)}
102
+ padding={3}
103
+ background="bgAlternate"
104
+ borderRadius={300}
105
+ >
106
+ <TextBody>Box 1</TextBody>
107
+ </Box>
108
+
109
+ <Box
110
+ ref={(el) => el && registerRef('box2', el)}
111
+ padding={3}
112
+ background="bgAlternate"
113
+ borderRadius={300}
114
+ >
115
+ <TextBody>Box 2</TextBody>
116
+ </Box>
117
+
118
+ <Box
119
+ ref={(el) => el && registerRef('box3', el)}
120
+ padding={3}
121
+ background="bgAlternate"
122
+ borderRadius={300}
123
+ >
124
+ <TextBody>Box 3</TextBody>
125
+ </Box>
126
+ </VStack>
127
+ </VStack>
128
+ );
129
+ }
130
+ ```
131
+
132
+ ### With Initial Refs
133
+
134
+ ```tsx live
135
+ function Example() {
136
+ // Create initial refs map
137
+ const box1Ref = useRef<HTMLDivElement>(null);
138
+ const box2Ref = useRef<HTMLDivElement>(null);
139
+
140
+ const initialRefs = {
141
+ box1: box1Ref.current,
142
+ box2: box2Ref.current,
143
+ };
144
+
145
+ const { refs, registerRef } = useRefMap<HTMLDivElement>({
146
+ initialRefMap: initialRefs,
147
+ });
148
+
149
+ const logRefs = () => {
150
+ console.log('Current refs:', refs);
151
+ };
152
+
153
+ return (
154
+ <VStack gap={2}>
155
+ <Box
156
+ ref={(el) => el && registerRef('box1', el)}
157
+ padding={3}
158
+ background="bgAlternate"
159
+ borderRadius={300}
160
+ >
161
+ <TextBody>Box 1</TextBody>
162
+ </Box>
163
+
164
+ <Box
165
+ ref={(el) => el && registerRef('box2', el)}
166
+ padding={3}
167
+ background="bgAlternate"
168
+ borderRadius={300}
169
+ >
170
+ <TextBody>Box 2</TextBody>
171
+ </Box>
172
+
173
+ <Button onClick={logRefs}>Log Refs</Button>
174
+ </VStack>
175
+ );
176
+ }
177
+ ```
178
+
@@ -1,5 +1,5 @@
1
-
2
1
  # useScrollBlocker
2
+
3
3
  Block and unblock page scrolling.
4
4
 
5
5
  ## Import
@@ -8,6 +8,26 @@ Block and unblock page scrolling.
8
8
  import { useScrollBlocker } from '@coinbase/cds-web/hooks/useScrollBlocker'
9
9
  ```
10
10
 
11
+ ## API
12
+
13
+ ### Parameters
14
+
15
+ The `useScrollBlocker` hook does not accept any parameters.
16
+
17
+ ### Returns
18
+
19
+ ```tsx
20
+ type Return = (shouldBlock: boolean) => void;
21
+ ```
22
+
23
+ Returns a function that takes a boolean parameter to control scroll blocking:
24
+
25
+ - `shouldBlock`: When `true`, blocks page scrolling. When `false`, re-enables scrolling.
26
+
27
+ :::tip
28
+ This hook is useful for temporarily disabling page scrolling, such as when displaying modals or overlays. It automatically handles scroll bar width compensation to prevent layout shifts.
29
+ :::
30
+
11
31
  ## Examples
12
32
 
13
33
  ### Basic usage
@@ -60,4 +80,3 @@ function Example() {
60
80
  }
61
81
  ```
62
82
 
63
-