@coinbase/cds-common 0.0.0 → 8.13.1

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 (764) hide show
  1. package/README.md +3 -0
  2. package/dts/accordion/AccordionProvider.d.ts +24 -0
  3. package/dts/accordion/AccordionProvider.d.ts.map +1 -0
  4. package/dts/accordion/__tests__/AccordionProvider.test.d.ts +2 -0
  5. package/dts/accordion/__tests__/AccordionProvider.test.d.ts.map +1 -0
  6. package/dts/animation/accordion.d.ts +4 -0
  7. package/dts/animation/accordion.d.ts.map +1 -0
  8. package/dts/animation/border.d.ts +4 -0
  9. package/dts/animation/border.d.ts.map +1 -0
  10. package/dts/animation/carousel.d.ts +8 -0
  11. package/dts/animation/carousel.d.ts.map +1 -0
  12. package/dts/animation/collapsible.d.ts +15 -0
  13. package/dts/animation/collapsible.d.ts.map +1 -0
  14. package/dts/animation/dot.d.ts +6 -0
  15. package/dts/animation/dot.d.ts.map +1 -0
  16. package/dts/animation/drawer.d.ts +20 -0
  17. package/dts/animation/drawer.d.ts.map +1 -0
  18. package/dts/animation/dropdown.d.ts +27 -0
  19. package/dts/animation/dropdown.d.ts.map +1 -0
  20. package/dts/animation/fullscreenModal.d.ts +12 -0
  21. package/dts/animation/fullscreenModal.d.ts.map +1 -0
  22. package/dts/animation/likeButton.d.ts +6 -0
  23. package/dts/animation/likeButton.d.ts.map +1 -0
  24. package/dts/animation/menu.d.ts +29 -0
  25. package/dts/animation/menu.d.ts.map +1 -0
  26. package/dts/animation/modal.d.ts +10 -0
  27. package/dts/animation/modal.d.ts.map +1 -0
  28. package/dts/animation/overlay.d.ts +6 -0
  29. package/dts/animation/overlay.d.ts.map +1 -0
  30. package/dts/animation/paddle.d.ts +7 -0
  31. package/dts/animation/paddle.d.ts.map +1 -0
  32. package/dts/animation/progress.d.ts +3 -0
  33. package/dts/animation/progress.d.ts.map +1 -0
  34. package/dts/animation/rotate.d.ts +3 -0
  35. package/dts/animation/rotate.d.ts.map +1 -0
  36. package/dts/animation/select.d.ts +4 -0
  37. package/dts/animation/select.d.ts.map +1 -0
  38. package/dts/animation/sparkline.d.ts +7 -0
  39. package/dts/animation/sparkline.d.ts.map +1 -0
  40. package/dts/animation/tabs.d.ts +5 -0
  41. package/dts/animation/tabs.d.ts.map +1 -0
  42. package/dts/animation/toast.d.ts +12 -0
  43. package/dts/animation/toast.d.ts.map +1 -0
  44. package/dts/animation/tooltip.d.ts +18 -0
  45. package/dts/animation/tooltip.d.ts.map +1 -0
  46. package/dts/cards/getCardBodySpacingProps.d.ts +5 -0
  47. package/dts/cards/getCardBodySpacingProps.d.ts.map +1 -0
  48. package/dts/color/__tests__/blendColors.test.d.ts +2 -0
  49. package/dts/color/__tests__/blendColors.test.d.ts.map +1 -0
  50. package/dts/color/__tests__/isLightOrDarkColor.test.d.ts +2 -0
  51. package/dts/color/__tests__/isLightOrDarkColor.test.d.ts.map +1 -0
  52. package/dts/color/__tests__/overrideAlpha.test.d.ts +2 -0
  53. package/dts/color/__tests__/overrideAlpha.test.d.ts.map +1 -0
  54. package/dts/color/blendColors.d.ts +21 -0
  55. package/dts/color/blendColors.d.ts.map +1 -0
  56. package/dts/color/colorToHex.d.ts +7 -0
  57. package/dts/color/colorToHex.d.ts.map +1 -0
  58. package/dts/color/darkenColor.d.ts +2 -0
  59. package/dts/color/darkenColor.d.ts.map +1 -0
  60. package/dts/color/getAccessibleForegroundGradient.d.ts +13 -0
  61. package/dts/color/getAccessibleForegroundGradient.d.ts.map +1 -0
  62. package/dts/color/getBlendedColor.d.ts +114 -0
  63. package/dts/color/getBlendedColor.d.ts.map +1 -0
  64. package/dts/color/getContrastRatio.d.ts +6 -0
  65. package/dts/color/getContrastRatio.d.ts.map +1 -0
  66. package/dts/color/getLuminance.d.ts +13 -0
  67. package/dts/color/getLuminance.d.ts.map +1 -0
  68. package/dts/color/isAccessibleColor.d.ts +18 -0
  69. package/dts/color/isAccessibleColor.d.ts.map +1 -0
  70. package/dts/color/isLightOrDarkColor.d.ts +2 -0
  71. package/dts/color/isLightOrDarkColor.d.ts.map +1 -0
  72. package/dts/color/overrideAlpha.d.ts +8 -0
  73. package/dts/color/overrideAlpha.d.ts.map +1 -0
  74. package/dts/core/theme.d.ts +286 -0
  75. package/dts/core/theme.d.ts.map +1 -0
  76. package/dts/dates/DateInputValidationError.d.ts +6 -0
  77. package/dts/dates/DateInputValidationError.d.ts.map +1 -0
  78. package/dts/dates/IntlDateFormat.d.ts +45 -0
  79. package/dts/dates/IntlDateFormat.d.ts.map +1 -0
  80. package/dts/dates/__tests__/IntlDateFormat.test.d.ts +2 -0
  81. package/dts/dates/__tests__/IntlDateFormat.test.d.ts.map +1 -0
  82. package/dts/dates/__tests__/useDateInput.test.d.ts +2 -0
  83. package/dts/dates/__tests__/useDateInput.test.d.ts.map +1 -0
  84. package/dts/dates/generateCalendarMonth.d.ts +5 -0
  85. package/dts/dates/generateCalendarMonth.d.ts.map +1 -0
  86. package/dts/dates/getISOStringLocal.d.ts +5 -0
  87. package/dts/dates/getISOStringLocal.d.ts.map +1 -0
  88. package/dts/dates/getMidnightDate.d.ts +5 -0
  89. package/dts/dates/getMidnightDate.d.ts.map +1 -0
  90. package/dts/dates/getTimesFromDatesAndRanges.d.ts +5 -0
  91. package/dts/dates/getTimesFromDatesAndRanges.d.ts.map +1 -0
  92. package/dts/dates/useDateInput.d.ts +23 -0
  93. package/dts/dates/useDateInput.d.ts.map +1 -0
  94. package/dts/dates/useDateInputValidation.d.ts +46 -0
  95. package/dts/dates/useDateInputValidation.d.ts.map +1 -0
  96. package/dts/hooks/__tests__/useFallbackShape.test.d.ts +2 -0
  97. package/dts/hooks/__tests__/useFallbackShape.test.d.ts.map +1 -0
  98. package/dts/hooks/__tests__/usePrefixedId.test.d.ts +2 -0
  99. package/dts/hooks/__tests__/usePrefixedId.test.d.ts.map +1 -0
  100. package/dts/hooks/__tests__/usePreviousValue.test.d.ts +2 -0
  101. package/dts/hooks/__tests__/usePreviousValue.test.d.ts.map +1 -0
  102. package/dts/hooks/__tests__/useRefMap.test.d.ts +2 -0
  103. package/dts/hooks/__tests__/useRefMap.test.d.ts.map +1 -0
  104. package/dts/hooks/__tests__/useSort.test.d.ts +2 -0
  105. package/dts/hooks/__tests__/useSort.test.d.ts.map +1 -0
  106. package/dts/hooks/__tests__/useTimer.test.d.ts +2 -0
  107. package/dts/hooks/__tests__/useTimer.test.d.ts.map +1 -0
  108. package/dts/hooks/useEventHandler.d.ts +3 -0
  109. package/dts/hooks/useEventHandler.d.ts.map +1 -0
  110. package/dts/hooks/useFallbackShape.d.ts +10 -0
  111. package/dts/hooks/useFallbackShape.d.ts.map +1 -0
  112. package/dts/hooks/useGroupToggler.d.ts +23 -0
  113. package/dts/hooks/useGroupToggler.d.ts.map +1 -0
  114. package/dts/hooks/useHasMounted.d.ts +2 -0
  115. package/dts/hooks/useHasMounted.d.ts.map +1 -0
  116. package/dts/hooks/useIndexCounter.d.ts +18 -0
  117. package/dts/hooks/useIndexCounter.d.ts.map +1 -0
  118. package/dts/hooks/useInputVariant.d.ts +3 -0
  119. package/dts/hooks/useInputVariant.d.ts.map +1 -0
  120. package/dts/hooks/useLogo.d.ts +26 -0
  121. package/dts/hooks/useLogo.d.ts.map +1 -0
  122. package/dts/hooks/useMergeRefs.d.ts +2 -0
  123. package/dts/hooks/useMergeRefs.d.ts.map +1 -0
  124. package/dts/hooks/usePrefixedId.d.ts +12 -0
  125. package/dts/hooks/usePrefixedId.d.ts.map +1 -0
  126. package/dts/hooks/usePreviousValue.d.ts +2 -0
  127. package/dts/hooks/usePreviousValue.d.ts.map +1 -0
  128. package/dts/hooks/usePreviousValues.d.ts +5 -0
  129. package/dts/hooks/usePreviousValues.d.ts.map +1 -0
  130. package/dts/hooks/useRefMap.d.ts +13 -0
  131. package/dts/hooks/useRefMap.d.ts.map +1 -0
  132. package/dts/hooks/useSort.d.ts +19 -0
  133. package/dts/hooks/useSort.d.ts.map +1 -0
  134. package/dts/hooks/useSubBrandLogo.d.ts +62 -0
  135. package/dts/hooks/useSubBrandLogo.d.ts.map +1 -0
  136. package/dts/hooks/useTimer.d.ts +7 -0
  137. package/dts/hooks/useTimer.d.ts.map +1 -0
  138. package/dts/hooks/useToggler.d.ts +10 -0
  139. package/dts/hooks/useToggler.d.ts.map +1 -0
  140. package/dts/hooks/useValueChanges.d.ts +8 -0
  141. package/dts/hooks/useValueChanges.d.ts.map +1 -0
  142. package/dts/index.d.ts +8 -0
  143. package/dts/index.d.ts.map +1 -0
  144. package/dts/internal/data/accounts.d.ts +359 -0
  145. package/dts/internal/data/accounts.d.ts.map +1 -0
  146. package/dts/internal/data/announcementCards.d.ts +10 -0
  147. package/dts/internal/data/announcementCards.d.ts.map +1 -0
  148. package/dts/internal/data/asset.d.ts +171 -0
  149. package/dts/internal/data/asset.d.ts.map +1 -0
  150. package/dts/internal/data/assets.d.ts +78 -0
  151. package/dts/internal/data/assets.d.ts.map +1 -0
  152. package/dts/internal/data/avatars.d.ts +3 -0
  153. package/dts/internal/data/avatars.d.ts.map +1 -0
  154. package/dts/internal/data/dataCards.d.ts +23 -0
  155. package/dts/internal/data/dataCards.d.ts.map +1 -0
  156. package/dts/internal/data/featureEntryCards.d.ts +17 -0
  157. package/dts/internal/data/featureEntryCards.d.ts.map +1 -0
  158. package/dts/internal/data/feedImages.d.ts +2 -0
  159. package/dts/internal/data/feedImages.d.ts.map +1 -0
  160. package/dts/internal/data/iconData.d.ts +2 -0
  161. package/dts/internal/data/iconData.d.ts.map +1 -0
  162. package/dts/internal/data/loremIpsum.d.ts +2 -0
  163. package/dts/internal/data/loremIpsum.d.ts.map +1 -0
  164. package/dts/internal/data/navigation.d.ts +7 -0
  165. package/dts/internal/data/navigation.d.ts.map +1 -0
  166. package/dts/internal/data/prices.d.ts +7 -0
  167. package/dts/internal/data/prices.d.ts.map +1 -0
  168. package/dts/internal/data/product.d.ts +25 -0
  169. package/dts/internal/data/product.d.ts.map +1 -0
  170. package/dts/internal/data/tabs.d.ts +15 -0
  171. package/dts/internal/data/tabs.d.ts.map +1 -0
  172. package/dts/internal/data/users.d.ts +10 -0
  173. package/dts/internal/data/users.d.ts.map +1 -0
  174. package/dts/internal/utils/storyBuilder.d.ts +113 -0
  175. package/dts/internal/utils/storyBuilder.d.ts.map +1 -0
  176. package/dts/internal/visualizations/SparklineInteractiveData.d.ts +13 -0
  177. package/dts/internal/visualizations/SparklineInteractiveData.d.ts.map +1 -0
  178. package/dts/jest/timeTravel.d.ts +15 -0
  179. package/dts/jest/timeTravel.d.ts.map +1 -0
  180. package/dts/lottie/lottieUtils.d.ts +11 -0
  181. package/dts/lottie/lottieUtils.d.ts.map +1 -0
  182. package/dts/lottie/lottieUtils.test.d.ts +2 -0
  183. package/dts/lottie/lottieUtils.test.d.ts.map +1 -0
  184. package/dts/lottie/useStatusAnimationPoller.d.ts +12 -0
  185. package/dts/lottie/useStatusAnimationPoller.d.ts.map +1 -0
  186. package/dts/media/getAvatarFallbackColor.d.ts +7 -0
  187. package/dts/media/getAvatarFallbackColor.d.ts.map +1 -0
  188. package/dts/media/remoteImageFallbackSrc.d.ts +6 -0
  189. package/dts/media/remoteImageFallbackSrc.d.ts.map +1 -0
  190. package/dts/motion/animatedCaret.d.ts +3 -0
  191. package/dts/motion/animatedCaret.d.ts.map +1 -0
  192. package/dts/motion/checkbox.d.ts +81 -0
  193. package/dts/motion/checkbox.d.ts.map +1 -0
  194. package/dts/motion/dot.d.ts +81 -0
  195. package/dts/motion/dot.d.ts.map +1 -0
  196. package/dts/motion/hint.d.ts +48 -0
  197. package/dts/motion/hint.d.ts.map +1 -0
  198. package/dts/motion/switch.d.ts +7 -0
  199. package/dts/motion/switch.d.ts.map +1 -0
  200. package/dts/motion/tokens.d.ts +422 -0
  201. package/dts/motion/tokens.d.ts.map +1 -0
  202. package/dts/motion/utils.d.ts +15 -0
  203. package/dts/motion/utils.d.ts.map +1 -0
  204. package/dts/numbers/IntlNumberFormat.d.ts +131 -0
  205. package/dts/numbers/IntlNumberFormat.d.ts.map +1 -0
  206. package/dts/numbers/__tests__/formatToParts.test.d.ts +2 -0
  207. package/dts/numbers/__tests__/formatToParts.test.d.ts.map +1 -0
  208. package/dts/numbers/__tests__/subscript.test.d.ts +2 -0
  209. package/dts/numbers/__tests__/subscript.test.d.ts.map +1 -0
  210. package/dts/numbers/subscript.d.ts +7 -0
  211. package/dts/numbers/subscript.d.ts.map +1 -0
  212. package/dts/overlays/ModalContext.d.ts +25 -0
  213. package/dts/overlays/ModalContext.d.ts.map +1 -0
  214. package/dts/overlays/OverlayContentContext.d.ts +13 -0
  215. package/dts/overlays/OverlayContentContext.d.ts.map +1 -0
  216. package/dts/overlays/PortalContext.d.ts +8 -0
  217. package/dts/overlays/PortalContext.d.ts.map +1 -0
  218. package/dts/overlays/ToastProvider.d.ts +73 -0
  219. package/dts/overlays/ToastProvider.d.ts.map +1 -0
  220. package/dts/overlays/__tests__/useOverlay.test.d.ts +2 -0
  221. package/dts/overlays/__tests__/useOverlay.test.d.ts.map +1 -0
  222. package/dts/overlays/__tests__/useToastQueue.test.d.ts +2 -0
  223. package/dts/overlays/__tests__/useToastQueue.test.d.ts.map +1 -0
  224. package/dts/overlays/useAlert.d.ts +8 -0
  225. package/dts/overlays/useAlert.d.ts.map +1 -0
  226. package/dts/overlays/useModal.d.ts +8 -0
  227. package/dts/overlays/useModal.d.ts.map +1 -0
  228. package/dts/overlays/useOverlay.d.ts +6 -0
  229. package/dts/overlays/useOverlay.d.ts.map +1 -0
  230. package/dts/overlays/usePortal.d.ts +2 -0
  231. package/dts/overlays/usePortal.d.ts.map +1 -0
  232. package/dts/overlays/usePortalState.d.ts +24 -0
  233. package/dts/overlays/usePortalState.d.ts.map +1 -0
  234. package/dts/overlays/useToastQueue.d.ts +11 -0
  235. package/dts/overlays/useToastQueue.d.ts.map +1 -0
  236. package/dts/stepper/__tests__/useStepper.test.d.ts +2 -0
  237. package/dts/stepper/__tests__/useStepper.test.d.ts.map +1 -0
  238. package/dts/stepper/__tests__/utils.test.d.ts +2 -0
  239. package/dts/stepper/__tests__/utils.test.d.ts.map +1 -0
  240. package/dts/stepper/useStepper.d.ts +41 -0
  241. package/dts/stepper/useStepper.d.ts.map +1 -0
  242. package/dts/stepper/utils.d.ts +22 -0
  243. package/dts/stepper/utils.d.ts.map +1 -0
  244. package/dts/system/EventHandlerProvider.d.ts +31 -0
  245. package/dts/system/EventHandlerProvider.d.ts.map +1 -0
  246. package/dts/system/LocaleProvider.d.ts +12 -0
  247. package/dts/system/LocaleProvider.d.ts.map +1 -0
  248. package/dts/system/RefMapContext.d.ts +10 -0
  249. package/dts/system/RefMapContext.d.ts.map +1 -0
  250. package/dts/system/__tests__/EventHandlerProvider.test.d.ts +2 -0
  251. package/dts/system/__tests__/EventHandlerProvider.test.d.ts.map +1 -0
  252. package/dts/tabs/TabsContext.d.ts +5 -0
  253. package/dts/tabs/TabsContext.d.ts.map +1 -0
  254. package/dts/tabs/__tests__/TabsContext.test.d.ts +2 -0
  255. package/dts/tabs/__tests__/TabsContext.test.d.ts.map +1 -0
  256. package/dts/tabs/__tests__/useTabs.test.d.ts +2 -0
  257. package/dts/tabs/__tests__/useTabs.test.d.ts.map +1 -0
  258. package/dts/tabs/useTabs.d.ts +29 -0
  259. package/dts/tabs/useTabs.d.ts.map +1 -0
  260. package/dts/tokens/accordion.d.ts +7 -0
  261. package/dts/tokens/accordion.d.ts.map +1 -0
  262. package/dts/tokens/appSwitcher.d.ts +4 -0
  263. package/dts/tokens/appSwitcher.d.ts.map +1 -0
  264. package/dts/tokens/avatar.d.ts +14 -0
  265. package/dts/tokens/avatar.d.ts.map +1 -0
  266. package/dts/tokens/banner.d.ts +15 -0
  267. package/dts/tokens/banner.d.ts.map +1 -0
  268. package/dts/tokens/borderRadius.d.ts +3 -0
  269. package/dts/tokens/borderRadius.d.ts.map +1 -0
  270. package/dts/tokens/button.d.ts +65 -0
  271. package/dts/tokens/button.d.ts.map +1 -0
  272. package/dts/tokens/card.d.ts +29 -0
  273. package/dts/tokens/card.d.ts.map +1 -0
  274. package/dts/tokens/cell.d.ts +27 -0
  275. package/dts/tokens/cell.d.ts.map +1 -0
  276. package/dts/tokens/chip.d.ts +2 -0
  277. package/dts/tokens/chip.d.ts.map +1 -0
  278. package/dts/tokens/dot.d.ts +12 -0
  279. package/dts/tokens/dot.d.ts.map +1 -0
  280. package/dts/tokens/drawer.d.ts +12 -0
  281. package/dts/tokens/drawer.d.ts.map +1 -0
  282. package/dts/tokens/illustrations.d.ts +28 -0
  283. package/dts/tokens/illustrations.d.ts.map +1 -0
  284. package/dts/tokens/input.d.ts +6 -0
  285. package/dts/tokens/input.d.ts.map +1 -0
  286. package/dts/tokens/interactable.d.ts +5 -0
  287. package/dts/tokens/interactable.d.ts.map +1 -0
  288. package/dts/tokens/interactableHeight.d.ts +5 -0
  289. package/dts/tokens/interactableHeight.d.ts.map +1 -0
  290. package/dts/tokens/menu.d.ts +3 -0
  291. package/dts/tokens/menu.d.ts.map +1 -0
  292. package/dts/tokens/multiContentModule.d.ts +2 -0
  293. package/dts/tokens/multiContentModule.d.ts.map +1 -0
  294. package/dts/tokens/navigation.d.ts +2 -0
  295. package/dts/tokens/navigation.d.ts.map +1 -0
  296. package/dts/tokens/overlays.d.ts +2 -0
  297. package/dts/tokens/overlays.d.ts.map +1 -0
  298. package/dts/tokens/page.d.ts +3 -0
  299. package/dts/tokens/page.d.ts.map +1 -0
  300. package/dts/tokens/select.d.ts +7 -0
  301. package/dts/tokens/select.d.ts.map +1 -0
  302. package/dts/tokens/sidebar.d.ts +3 -0
  303. package/dts/tokens/sidebar.d.ts.map +1 -0
  304. package/dts/tokens/sizing.d.ts +3 -0
  305. package/dts/tokens/sizing.d.ts.map +1 -0
  306. package/dts/tokens/sparkline.d.ts +11 -0
  307. package/dts/tokens/sparkline.d.ts.map +1 -0
  308. package/dts/tokens/tags.d.ts +12 -0
  309. package/dts/tokens/tags.d.ts.map +1 -0
  310. package/dts/tokens/tile.d.ts +4 -0
  311. package/dts/tokens/tile.d.ts.map +1 -0
  312. package/dts/tokens/toast.d.ts +5 -0
  313. package/dts/tokens/toast.d.ts.map +1 -0
  314. package/dts/tokens/tooltip.d.ts +4 -0
  315. package/dts/tokens/tooltip.d.ts.map +1 -0
  316. package/dts/tokens/zIndex.d.ts +14 -0
  317. package/dts/tokens/zIndex.d.ts.map +1 -0
  318. package/dts/tour/TourContext.d.ts +6 -0
  319. package/dts/tour/TourContext.d.ts.map +1 -0
  320. package/dts/tour/__tests__/TourContext.test.d.ts +2 -0
  321. package/dts/tour/__tests__/TourContext.test.d.ts.map +1 -0
  322. package/dts/tour/__tests__/useTour.test.d.ts +2 -0
  323. package/dts/tour/__tests__/useTour.test.d.ts.map +1 -0
  324. package/dts/tour/useTour.d.ts +98 -0
  325. package/dts/tour/useTour.d.ts.map +1 -0
  326. package/dts/types/AvatarBaseProps.d.ts +6 -0
  327. package/dts/types/AvatarBaseProps.d.ts.map +1 -0
  328. package/dts/types/AvatarSize.d.ts +2 -0
  329. package/dts/types/AvatarSize.d.ts.map +1 -0
  330. package/dts/types/BannerBaseProps.d.ts +3 -0
  331. package/dts/types/BannerBaseProps.d.ts.map +1 -0
  332. package/dts/types/BoxBaseProps.d.ts +62 -0
  333. package/dts/types/BoxBaseProps.d.ts.map +1 -0
  334. package/dts/types/ButtonBaseProps.d.ts +2 -0
  335. package/dts/types/ButtonBaseProps.d.ts.map +1 -0
  336. package/dts/types/CardHeaderProps.d.ts +12 -0
  337. package/dts/types/CardHeaderProps.d.ts.map +1 -0
  338. package/dts/types/CardMediaProps.d.ts +27 -0
  339. package/dts/types/CardMediaProps.d.ts.map +1 -0
  340. package/dts/types/CardRemoteImageProps.d.ts +18 -0
  341. package/dts/types/CardRemoteImageProps.d.ts.map +1 -0
  342. package/dts/types/CdsPlatform.d.ts +2 -0
  343. package/dts/types/CdsPlatform.d.ts.map +1 -0
  344. package/dts/types/CellBaseProps.d.ts +8 -0
  345. package/dts/types/CellBaseProps.d.ts.map +1 -0
  346. package/dts/types/Chart.d.ts +27 -0
  347. package/dts/types/Chart.d.ts.map +1 -0
  348. package/dts/types/CollapsibleBaseProps.d.ts +2 -0
  349. package/dts/types/CollapsibleBaseProps.d.ts.map +1 -0
  350. package/dts/types/Color.d.ts +6 -0
  351. package/dts/types/Color.d.ts.map +1 -0
  352. package/dts/types/ComponentEventHandlerProps.d.ts +6 -0
  353. package/dts/types/ComponentEventHandlerProps.d.ts.map +1 -0
  354. package/dts/types/DimensionStyles.d.ts +24 -0
  355. package/dts/types/DimensionStyles.d.ts.map +1 -0
  356. package/dts/types/Display.d.ts +2 -0
  357. package/dts/types/Display.d.ts.map +1 -0
  358. package/dts/types/DotBaseProps.d.ts +5 -0
  359. package/dts/types/DotBaseProps.d.ts.map +1 -0
  360. package/dts/types/DotCountBaseProps.d.ts +5 -0
  361. package/dts/types/DotCountBaseProps.d.ts.map +1 -0
  362. package/dts/types/ElevationLevels.d.ts +7 -0
  363. package/dts/types/ElevationLevels.d.ts.map +1 -0
  364. package/dts/types/FallbackBaseProps.d.ts +10 -0
  365. package/dts/types/FallbackBaseProps.d.ts.map +1 -0
  366. package/dts/types/Grid.d.ts +2 -0
  367. package/dts/types/Grid.d.ts.map +1 -0
  368. package/dts/types/Helpers.d.ts +4 -0
  369. package/dts/types/Helpers.d.ts.map +1 -0
  370. package/dts/types/IconButtonBaseProps.d.ts +3 -0
  371. package/dts/types/IconButtonBaseProps.d.ts.map +1 -0
  372. package/dts/types/IconName.d.ts +3 -0
  373. package/dts/types/IconName.d.ts.map +1 -0
  374. package/dts/types/IconSize.d.ts +3 -0
  375. package/dts/types/IconSize.d.ts.map +1 -0
  376. package/dts/types/IllustrationNames.d.ts +8 -0
  377. package/dts/types/IllustrationNames.d.ts.map +1 -0
  378. package/dts/types/IllustrationProps.d.ts +15 -0
  379. package/dts/types/IllustrationProps.d.ts.map +1 -0
  380. package/dts/types/InputBaseProps.d.ts +19 -0
  381. package/dts/types/InputBaseProps.d.ts.map +1 -0
  382. package/dts/types/LottiePlayer.d.ts +9 -0
  383. package/dts/types/LottiePlayer.d.ts.map +1 -0
  384. package/dts/types/LottieSource.d.ts +30 -0
  385. package/dts/types/LottieSource.d.ts.map +1 -0
  386. package/dts/types/LottieStatusAnimationProps.d.ts +24 -0
  387. package/dts/types/LottieStatusAnimationProps.d.ts.map +1 -0
  388. package/dts/types/Motion.d.ts +34 -0
  389. package/dts/types/Motion.d.ts.map +1 -0
  390. package/dts/types/OverlayLifecycleProps.d.ts +19 -0
  391. package/dts/types/OverlayLifecycleProps.d.ts.map +1 -0
  392. package/dts/types/Palette.d.ts +5 -0
  393. package/dts/types/Palette.d.ts.map +1 -0
  394. package/dts/types/Placement.d.ts +3 -0
  395. package/dts/types/Placement.d.ts.map +1 -0
  396. package/dts/types/Position.d.ts +2 -0
  397. package/dts/types/Position.d.ts.map +1 -0
  398. package/dts/types/ProgressContainerWithButtonsProps.d.ts +8 -0
  399. package/dts/types/ProgressContainerWithButtonsProps.d.ts.map +1 -0
  400. package/dts/types/PulseBaseProps.d.ts +2 -0
  401. package/dts/types/PulseBaseProps.d.ts.map +1 -0
  402. package/dts/types/React.d.ts +3 -0
  403. package/dts/types/React.d.ts.map +1 -0
  404. package/dts/types/Rect.d.ts +8 -0
  405. package/dts/types/Rect.d.ts.map +1 -0
  406. package/dts/types/Responsive.d.ts +3 -0
  407. package/dts/types/Responsive.d.ts.map +1 -0
  408. package/dts/types/ResponsiveProps.d.ts +24 -0
  409. package/dts/types/ResponsiveProps.d.ts.map +1 -0
  410. package/dts/types/SectionHeaderProps.d.ts +18 -0
  411. package/dts/types/SectionHeaderProps.d.ts.map +1 -0
  412. package/dts/types/Shape.d.ts +3 -0
  413. package/dts/types/Shape.d.ts.map +1 -0
  414. package/dts/types/SharedAccessibilityProps.d.ts +34 -0
  415. package/dts/types/SharedAccessibilityProps.d.ts.map +1 -0
  416. package/dts/types/SharedProps.d.ts +9 -0
  417. package/dts/types/SharedProps.d.ts.map +1 -0
  418. package/dts/types/SpacingProps.d.ts +46 -0
  419. package/dts/types/SpacingProps.d.ts.map +1 -0
  420. package/dts/types/SparklineInteractiveHeaderBaseProps.d.ts +3 -0
  421. package/dts/types/SparklineInteractiveHeaderBaseProps.d.ts.map +1 -0
  422. package/dts/types/SpreadPropsSafely.d.ts +28 -0
  423. package/dts/types/SpreadPropsSafely.d.ts.map +1 -0
  424. package/dts/types/StickyFooterProps.d.ts +22 -0
  425. package/dts/types/StickyFooterProps.d.ts.map +1 -0
  426. package/dts/types/TagBaseProps.d.ts +4 -0
  427. package/dts/types/TagBaseProps.d.ts.map +1 -0
  428. package/dts/types/TextBaseProps.d.ts +10 -0
  429. package/dts/types/TextBaseProps.d.ts.map +1 -0
  430. package/dts/types/TooltipBaseProps.d.ts +2 -0
  431. package/dts/types/TooltipBaseProps.d.ts.map +1 -0
  432. package/dts/types/TypeOrNumber.d.ts +3 -0
  433. package/dts/types/TypeOrNumber.d.ts.map +1 -0
  434. package/dts/types/Visibility.d.ts +5 -0
  435. package/dts/types/Visibility.d.ts.map +1 -0
  436. package/dts/types/Weight.d.ts +2 -0
  437. package/dts/types/Weight.d.ts.map +1 -0
  438. package/dts/types/index.d.ts +57 -0
  439. package/dts/types/index.d.ts.map +1 -0
  440. package/dts/utils/__tests__/cell.test.d.ts +2 -0
  441. package/dts/utils/__tests__/cell.test.d.ts.map +1 -0
  442. package/dts/utils/__tests__/chart.test.d.ts +2 -0
  443. package/dts/utils/__tests__/chart.test.d.ts.map +1 -0
  444. package/dts/utils/__tests__/flattenNodes.test.d.ts +2 -0
  445. package/dts/utils/__tests__/flattenNodes.test.d.ts.map +1 -0
  446. package/dts/utils/__tests__/formatCount.test.d.ts +2 -0
  447. package/dts/utils/__tests__/formatCount.test.d.ts.map +1 -0
  448. package/dts/utils/__tests__/getRectWidthVariant.test.d.ts +2 -0
  449. package/dts/utils/__tests__/getRectWidthVariant.test.d.ts.map +1 -0
  450. package/dts/utils/cell.d.ts +3 -0
  451. package/dts/utils/cell.d.ts.map +1 -0
  452. package/dts/utils/chart.d.ts +2 -0
  453. package/dts/utils/chart.d.ts.map +1 -0
  454. package/dts/utils/circle.d.ts +4 -0
  455. package/dts/utils/circle.d.ts.map +1 -0
  456. package/dts/utils/convertDimensionToAspectRatio.d.ts +4 -0
  457. package/dts/utils/convertDimensionToAspectRatio.d.ts.map +1 -0
  458. package/dts/utils/convertDimensionToSize.d.ts +8 -0
  459. package/dts/utils/convertDimensionToSize.d.ts.map +1 -0
  460. package/dts/utils/convertSizeWithMultiplier.d.ts +9 -0
  461. package/dts/utils/convertSizeWithMultiplier.d.ts.map +1 -0
  462. package/dts/utils/debounce.d.ts +2 -0
  463. package/dts/utils/debounce.d.ts.map +1 -0
  464. package/dts/utils/delay.d.ts +5 -0
  465. package/dts/utils/delay.d.ts.map +1 -0
  466. package/dts/utils/flattenNodes.d.ts +5 -0
  467. package/dts/utils/flattenNodes.d.ts.map +1 -0
  468. package/dts/utils/formatCount.d.ts +26 -0
  469. package/dts/utils/formatCount.d.ts.map +1 -0
  470. package/dts/utils/getAccessibleColor.d.ts +28 -0
  471. package/dts/utils/getAccessibleColor.d.ts.map +1 -0
  472. package/dts/utils/getButtonSpacingProps.d.ts +16 -0
  473. package/dts/utils/getButtonSpacingProps.d.ts.map +1 -0
  474. package/dts/utils/getDefaultAspectRatioForIllustration.d.ts +4 -0
  475. package/dts/utils/getDefaultAspectRatioForIllustration.d.ts.map +1 -0
  476. package/dts/utils/getDefaultSizeObjectForIllustration.d.ts +4 -0
  477. package/dts/utils/getDefaultSizeObjectForIllustration.d.ts.map +1 -0
  478. package/dts/utils/getRectWidthVariant.d.ts +2 -0
  479. package/dts/utils/getRectWidthVariant.d.ts.map +1 -0
  480. package/dts/utils/getWidthInEm.d.ts +6 -0
  481. package/dts/utils/getWidthInEm.d.ts.map +1 -0
  482. package/dts/utils/join.d.ts +6 -0
  483. package/dts/utils/join.d.ts.map +1 -0
  484. package/dts/utils/mergeProps.d.ts +3 -0
  485. package/dts/utils/mergeProps.d.ts.map +1 -0
  486. package/dts/utils/mockUtils.d.ts +2 -0
  487. package/dts/utils/mockUtils.d.ts.map +1 -0
  488. package/dts/utils/modulate.d.ts +9 -0
  489. package/dts/utils/modulate.d.ts.map +1 -0
  490. package/dts/utils/parseDotCountMaxOverflow.d.ts +3 -0
  491. package/dts/utils/parseDotCountMaxOverflow.d.ts.map +1 -0
  492. package/dts/visualizations/__tests__/getSparklineRange.test.d.ts +2 -0
  493. package/dts/visualizations/__tests__/getSparklineRange.test.d.ts.map +1 -0
  494. package/dts/visualizations/__tests__/largestTriangleThreeBucket.test.d.ts +2 -0
  495. package/dts/visualizations/__tests__/largestTriangleThreeBucket.test.d.ts.map +1 -0
  496. package/dts/visualizations/__tests__/useCounter.test.d.ts +2 -0
  497. package/dts/visualizations/__tests__/useCounter.test.d.ts.map +1 -0
  498. package/dts/visualizations/__tests__/useSparklineArea.test.d.ts +2 -0
  499. package/dts/visualizations/__tests__/useSparklineArea.test.d.ts.map +1 -0
  500. package/dts/visualizations/__tests__/useSparklineCoordinates.test.d.ts +2 -0
  501. package/dts/visualizations/__tests__/useSparklineCoordinates.test.d.ts.map +1 -0
  502. package/dts/visualizations/__tests__/useSparklinePath.test.d.ts +2 -0
  503. package/dts/visualizations/__tests__/useSparklinePath.test.d.ts.map +1 -0
  504. package/dts/visualizations/getProgressCircleParams.d.ts +15 -0
  505. package/dts/visualizations/getProgressCircleParams.d.ts.map +1 -0
  506. package/dts/visualizations/getSparklineRange.d.ts +9 -0
  507. package/dts/visualizations/getSparklineRange.d.ts.map +1 -0
  508. package/dts/visualizations/getSparklineTransform.d.ts +4 -0
  509. package/dts/visualizations/getSparklineTransform.d.ts.map +1 -0
  510. package/dts/visualizations/largestTriangleThreeBucket.d.ts +16 -0
  511. package/dts/visualizations/largestTriangleThreeBucket.d.ts.map +1 -0
  512. package/dts/visualizations/useCounter.d.ts +7 -0
  513. package/dts/visualizations/useCounter.d.ts.map +1 -0
  514. package/dts/visualizations/useDateLookup.d.ts +8 -0
  515. package/dts/visualizations/useDateLookup.d.ts.map +1 -0
  516. package/dts/visualizations/useProgressSize.d.ts +3 -0
  517. package/dts/visualizations/useProgressSize.d.ts.map +1 -0
  518. package/dts/visualizations/useSparklineArea.d.ts +3 -0
  519. package/dts/visualizations/useSparklineArea.d.ts.map +1 -0
  520. package/dts/visualizations/useSparklineAreaOpacity.d.ts +2 -0
  521. package/dts/visualizations/useSparklineAreaOpacity.d.ts.map +1 -0
  522. package/dts/visualizations/useSparklineCoordinates.d.ts +21 -0
  523. package/dts/visualizations/useSparklineCoordinates.d.ts.map +1 -0
  524. package/dts/visualizations/useSparklinePath.d.ts +3 -0
  525. package/dts/visualizations/useSparklinePath.d.ts.map +1 -0
  526. package/dts/visualizations/useSparklinePathGenerator.d.ts +18 -0
  527. package/dts/visualizations/useSparklinePathGenerator.d.ts.map +1 -0
  528. package/dts/visualizations/useTimeseriesPaths.d.ts +11 -0
  529. package/dts/visualizations/useTimeseriesPaths.d.ts.map +1 -0
  530. package/dts/visualizations/useVisualizationDimensions.d.ts +15 -0
  531. package/dts/visualizations/useVisualizationDimensions.d.ts.map +1 -0
  532. package/esm/accordion/AccordionProvider.js +38 -0
  533. package/esm/animation/accordion.js +3 -0
  534. package/esm/animation/border.js +10 -0
  535. package/esm/animation/carousel.js +21 -0
  536. package/esm/animation/collapsible.js +75 -0
  537. package/esm/animation/dot.js +15 -0
  538. package/esm/animation/drawer.js +19 -0
  539. package/esm/animation/dropdown.js +31 -0
  540. package/esm/animation/fullscreenModal.js +39 -0
  541. package/esm/animation/likeButton.js +18 -0
  542. package/esm/animation/menu.js +31 -0
  543. package/esm/animation/modal.js +32 -0
  544. package/esm/animation/overlay.js +16 -0
  545. package/esm/animation/paddle.js +17 -0
  546. package/esm/animation/progress.js +4 -0
  547. package/esm/animation/rotate.js +5 -0
  548. package/esm/animation/select.js +16 -0
  549. package/esm/animation/sparkline.js +8 -0
  550. package/esm/animation/tabs.js +5 -0
  551. package/esm/animation/toast.js +36 -0
  552. package/esm/animation/tooltip.js +87 -0
  553. package/esm/cards/getCardBodySpacingProps.js +25 -0
  554. package/esm/color/blendColors.js +44 -0
  555. package/esm/color/colorToHex.js +11 -0
  556. package/esm/color/darkenColor.js +5 -0
  557. package/esm/color/getAccessibleForegroundGradient.js +32 -0
  558. package/esm/color/getBlendedColor.js +202 -0
  559. package/esm/color/getContrastRatio.js +11 -0
  560. package/esm/color/getLuminance.js +28 -0
  561. package/esm/color/isAccessibleColor.js +31 -0
  562. package/esm/color/isLightOrDarkColor.js +21 -0
  563. package/esm/color/overrideAlpha.js +15 -0
  564. package/esm/core/theme.js +26 -0
  565. package/esm/dates/DateInputValidationError.js +7 -0
  566. package/esm/dates/IntlDateFormat.js +66 -0
  567. package/esm/dates/generateCalendarMonth.js +22 -0
  568. package/esm/dates/getISOStringLocal.js +8 -0
  569. package/esm/dates/getMidnightDate.js +4 -0
  570. package/esm/dates/getTimesFromDatesAndRanges.js +16 -0
  571. package/esm/dates/useDateInput.js +105 -0
  572. package/esm/dates/useDateInputValidation.js +50 -0
  573. package/esm/hooks/useEventHandler.js +54 -0
  574. package/esm/hooks/useFallbackShape.js +29 -0
  575. package/esm/hooks/useGroupToggler.js +105 -0
  576. package/esm/hooks/useHasMounted.js +6 -0
  577. package/esm/hooks/useIndexCounter.js +47 -0
  578. package/esm/hooks/useInputVariant.js +4 -0
  579. package/esm/hooks/useLogo.js +60 -0
  580. package/esm/hooks/useMergeRefs.js +14 -0
  581. package/esm/hooks/usePrefixedId.js +25 -0
  582. package/esm/hooks/usePreviousValue.js +16 -0
  583. package/esm/hooks/usePreviousValues.js +26 -0
  584. package/esm/hooks/useRefMap.js +17 -0
  585. package/esm/hooks/useSort.js +26 -0
  586. package/esm/hooks/useSubBrandLogo.js +244 -0
  587. package/esm/hooks/useTimer.js +51 -0
  588. package/esm/hooks/useToggler.js +24 -0
  589. package/esm/hooks/useValueChanges.js +15 -0
  590. package/esm/index.js +7 -0
  591. package/esm/internal/data/accounts.js +1838 -0
  592. package/esm/internal/data/announcementCards.js +23 -0
  593. package/esm/internal/data/asset.js +6345 -0
  594. package/esm/internal/data/assets.js +82 -0
  595. package/esm/internal/data/avatars.js +2 -0
  596. package/esm/internal/data/dataCards.js +22 -0
  597. package/esm/internal/data/featureEntryCards.js +28 -0
  598. package/esm/internal/data/feedImages.js +1 -0
  599. package/esm/internal/data/iconData.js +1 -0
  600. package/esm/internal/data/loremIpsum.js +1 -0
  601. package/esm/internal/data/navigation.js +11 -0
  602. package/esm/internal/data/prices.js +7 -0
  603. package/esm/internal/data/product.js +24 -0
  604. package/esm/internal/data/tabs.js +58 -0
  605. package/esm/internal/data/users.js +9 -0
  606. package/esm/internal/utils/storyBuilder.js +102 -0
  607. package/esm/internal/visualizations/SparklineInteractiveData.js +67 -0
  608. package/esm/jest/timeTravel.js +42 -0
  609. package/esm/lottie/lottieUtils.js +20 -0
  610. package/esm/lottie/lottieUtils.test.js +44 -0
  611. package/esm/lottie/useStatusAnimationPoller.js +67 -0
  612. package/esm/media/getAvatarFallbackColor.js +50 -0
  613. package/esm/media/remoteImageFallbackSrc.js +11 -0
  614. package/esm/motion/animatedCaret.js +6 -0
  615. package/esm/motion/checkbox.js +9 -0
  616. package/esm/motion/dot.js +9 -0
  617. package/esm/motion/hint.js +19 -0
  618. package/esm/motion/switch.js +8 -0
  619. package/esm/motion/tokens.js +71 -0
  620. package/esm/motion/utils.js +17 -0
  621. package/esm/numbers/IntlNumberFormat.js +204 -0
  622. package/esm/numbers/subscript.js +53 -0
  623. package/esm/overlays/ModalContext.js +8 -0
  624. package/esm/overlays/OverlayContentContext.js +24 -0
  625. package/esm/overlays/PortalContext.js +6 -0
  626. package/esm/overlays/ToastProvider.js +51 -0
  627. package/esm/overlays/useAlert.js +8 -0
  628. package/esm/overlays/useModal.js +16 -0
  629. package/esm/overlays/useOverlay.js +28 -0
  630. package/esm/overlays/usePortal.js +10 -0
  631. package/esm/overlays/usePortalState.js +55 -0
  632. package/esm/overlays/useToastQueue.js +67 -0
  633. package/esm/stepper/useStepper.js +124 -0
  634. package/esm/stepper/utils.js +45 -0
  635. package/esm/system/EventHandlerProvider.js +24 -0
  636. package/esm/system/LocaleProvider.js +19 -0
  637. package/esm/system/RefMapContext.js +7 -0
  638. package/esm/tabs/TabsContext.js +7 -0
  639. package/esm/tabs/useTabs.js +43 -0
  640. package/esm/tokens/accordion.js +6 -0
  641. package/esm/tokens/appSwitcher.js +3 -0
  642. package/esm/tokens/avatar.js +13 -0
  643. package/esm/tokens/banner.js +39 -0
  644. package/esm/tokens/borderRadius.js +7 -0
  645. package/esm/tokens/button.js +64 -0
  646. package/esm/tokens/card.js +29 -0
  647. package/esm/tokens/cell.js +40 -0
  648. package/esm/tokens/chip.js +1 -0
  649. package/esm/tokens/dot.js +31 -0
  650. package/esm/tokens/drawer.js +11 -0
  651. package/esm/tokens/illustrations.js +28 -0
  652. package/esm/tokens/input.js +5 -0
  653. package/esm/tokens/interactable.js +4 -0
  654. package/esm/tokens/interactableHeight.js +4 -0
  655. package/esm/tokens/menu.js +2 -0
  656. package/esm/tokens/multiContentModule.js +1 -0
  657. package/esm/tokens/navigation.js +1 -0
  658. package/esm/tokens/overlays.js +1 -0
  659. package/esm/tokens/page.js +2 -0
  660. package/esm/tokens/select.js +26 -0
  661. package/esm/tokens/sidebar.js +2 -0
  662. package/esm/tokens/sizing.js +2 -0
  663. package/esm/tokens/sparkline.js +24 -0
  664. package/esm/tokens/tags.js +66 -0
  665. package/esm/tokens/tile.js +9 -0
  666. package/esm/tokens/toast.js +4 -0
  667. package/esm/tokens/tooltip.js +5 -0
  668. package/esm/tokens/zIndex.js +15 -0
  669. package/esm/tour/TourContext.js +7 -0
  670. package/esm/tour/useTour.js +84 -0
  671. package/esm/types/AvatarBaseProps.js +1 -0
  672. package/esm/types/AvatarSize.js +1 -0
  673. package/esm/types/BannerBaseProps.js +1 -0
  674. package/esm/types/BoxBaseProps.js +1 -0
  675. package/esm/types/ButtonBaseProps.js +1 -0
  676. package/esm/types/CardHeaderProps.js +1 -0
  677. package/esm/types/CardMediaProps.js +1 -0
  678. package/esm/types/CardRemoteImageProps.js +1 -0
  679. package/esm/types/CdsPlatform.js +1 -0
  680. package/esm/types/CellBaseProps.js +1 -0
  681. package/esm/types/Chart.js +1 -0
  682. package/esm/types/CollapsibleBaseProps.js +1 -0
  683. package/esm/types/Color.js +1 -0
  684. package/esm/types/ComponentEventHandlerProps.js +1 -0
  685. package/esm/types/DimensionStyles.js +1 -0
  686. package/esm/types/Display.js +1 -0
  687. package/esm/types/DotBaseProps.js +1 -0
  688. package/esm/types/DotCountBaseProps.js +1 -0
  689. package/esm/types/ElevationLevels.js +1 -0
  690. package/esm/types/FallbackBaseProps.js +1 -0
  691. package/esm/types/Grid.js +1 -0
  692. package/esm/types/Helpers.js +1 -0
  693. package/esm/types/IconButtonBaseProps.js +1 -0
  694. package/esm/types/IconName.js +1 -0
  695. package/esm/types/IconSize.js +1 -0
  696. package/esm/types/IllustrationNames.js +1 -0
  697. package/esm/types/IllustrationProps.js +1 -0
  698. package/esm/types/InputBaseProps.js +1 -0
  699. package/esm/types/LottiePlayer.js +1 -0
  700. package/esm/types/LottieSource.js +1 -0
  701. package/esm/types/LottieStatusAnimationProps.js +1 -0
  702. package/esm/types/Motion.js +1 -0
  703. package/esm/types/OverlayLifecycleProps.js +1 -0
  704. package/esm/types/Palette.js +1 -0
  705. package/esm/types/Placement.js +1 -0
  706. package/esm/types/Position.js +1 -0
  707. package/esm/types/ProgressContainerWithButtonsProps.js +1 -0
  708. package/esm/types/PulseBaseProps.js +1 -0
  709. package/esm/types/React.js +1 -0
  710. package/esm/types/Rect.js +6 -0
  711. package/esm/types/Responsive.js +1 -0
  712. package/esm/types/ResponsiveProps.js +1 -0
  713. package/esm/types/SectionHeaderProps.js +1 -0
  714. package/esm/types/Shape.js +1 -0
  715. package/esm/types/SharedAccessibilityProps.js +1 -0
  716. package/esm/types/SharedProps.js +1 -0
  717. package/esm/types/SpacingProps.js +1 -0
  718. package/esm/types/SparklineInteractiveHeaderBaseProps.js +1 -0
  719. package/esm/types/SpreadPropsSafely.js +1 -0
  720. package/esm/types/StickyFooterProps.js +1 -0
  721. package/esm/types/TagBaseProps.js +1 -0
  722. package/esm/types/TextBaseProps.js +1 -0
  723. package/esm/types/TooltipBaseProps.js +1 -0
  724. package/esm/types/TypeOrNumber.js +1 -0
  725. package/esm/types/Visibility.js +1 -0
  726. package/esm/types/Weight.js +1 -0
  727. package/esm/types/index.js +58 -0
  728. package/esm/utils/cell.js +5 -0
  729. package/esm/utils/chart.js +14 -0
  730. package/esm/utils/circle.js +12 -0
  731. package/esm/utils/convertDimensionToAspectRatio.js +5 -0
  732. package/esm/utils/convertDimensionToSize.js +9 -0
  733. package/esm/utils/convertSizeWithMultiplier.js +7 -0
  734. package/esm/utils/debounce.js +16 -0
  735. package/esm/utils/delay.js +6 -0
  736. package/esm/utils/flattenNodes.js +33 -0
  737. package/esm/utils/formatCount.js +43 -0
  738. package/esm/utils/getAccessibleColor.js +50 -0
  739. package/esm/utils/getButtonSpacingProps.js +24 -0
  740. package/esm/utils/getDefaultAspectRatioForIllustration.js +6 -0
  741. package/esm/utils/getDefaultSizeObjectForIllustration.js +7 -0
  742. package/esm/utils/getRectWidthVariant.js +1 -0
  743. package/esm/utils/getWidthInEm.js +13 -0
  744. package/esm/utils/join.js +11 -0
  745. package/esm/utils/mergeProps.js +25 -0
  746. package/esm/utils/mockUtils.js +1 -0
  747. package/esm/utils/modulate.js +32 -0
  748. package/esm/utils/parseDotCountMaxOverflow.js +7 -0
  749. package/esm/visualizations/getProgressCircleParams.js +18 -0
  750. package/esm/visualizations/getSparklineRange.js +13 -0
  751. package/esm/visualizations/getSparklineTransform.js +19 -0
  752. package/esm/visualizations/largestTriangleThreeBucket.js +57 -0
  753. package/esm/visualizations/useCounter.js +52 -0
  754. package/esm/visualizations/useDateLookup.js +18 -0
  755. package/esm/visualizations/useProgressSize.js +15 -0
  756. package/esm/visualizations/useSparklineArea.js +30 -0
  757. package/esm/visualizations/useSparklineAreaOpacity.js +3 -0
  758. package/esm/visualizations/useSparklineCoordinates.js +73 -0
  759. package/esm/visualizations/useSparklinePath.js +22 -0
  760. package/esm/visualizations/useSparklinePathGenerator.js +38 -0
  761. package/esm/visualizations/useTimeseriesPaths.js +41 -0
  762. package/esm/visualizations/useVisualizationDimensions.js +27 -0
  763. package/package.json +61 -5
  764. package/index.js +0 -1
@@ -0,0 +1,26 @@
1
+ /**
2
+ * These are the core CDS Theme variable types used across mobile and web.
3
+ */
4
+ /* eslint-disable no-restricted-syntax, @typescript-eslint/no-empty-object-type */
5
+ /**
6
+ * This utility type makes the final intellisense into human-redable literal values.
7
+ */
8
+ /**
9
+ * This is the default set of Theme variables available to all CDS components.
10
+ * Only the interface keys are used to define the available Theme variables.
11
+ * The interface values are not used.
12
+ * @danger You probably don't want to use this namespace directly, unless you are
13
+ * referring explicitly to ONLY the default CDS variables. Otherwise, you probably
14
+ * want to use the ThemeVars namespace instead, which inherits from this namespace.
15
+ * @docs http://cds.coinbase.com/getting-started/theming/#themevars-namespace
16
+ */
17
+ export let ThemeVarsDefault;
18
+ /**
19
+ * This is the complete set of Theme variables available to all CDS components.
20
+ * Combines all variables from the ThemeVarsDefault and ThemeVarsExtended
21
+ * namespaces. You can use this namespace to read all available Theme variables.
22
+ * You can use the ThemeVarsExtended namespace to extend this namespace with new
23
+ * variables.
24
+ * @docs http://cds.coinbase.com/getting-started/theming/#themevars-namespace
25
+ */
26
+ export let ThemeVars;
@@ -0,0 +1,7 @@
1
+ export class DateInputValidationError extends Error {
2
+ constructor(type, message) {
3
+ super(message);
4
+ this.name = 'DateInputValidationError';
5
+ this.type = type;
6
+ }
7
+ }
@@ -0,0 +1,66 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ /**
5
+ * IntlDateFormat is a utility class that uses the Intl.DateTimeFormat API to determine the date format for a given locale.
6
+ * It can be used to parse and format date strings based on the locale's date format.
7
+ * @param locale A valid JavaScript Intl locale used to determine the date format.
8
+ * @param separator Character used to separate values in the date format, e.g. the forward slash in "MM/DD/YYYY".
9
+ * @example
10
+ * const intlDateFormat = new IntlDateFormat({ locale: 'en-US', separator: '/' });
11
+ * const date = intlDateFormat.date('12/31/2020');
12
+ * const dateString = intlDateFormat.format(new Date());
13
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
14
+ */
15
+ export class IntlDateFormat {
16
+ constructor(props) {
17
+ this.locale = props.locale;
18
+ this.separator = props.separator;
19
+ this.invalidDateFormatRegex = new RegExp("[^0-9".concat(this.separator, "]"));
20
+ this.duplicateSeparatorRegex = new RegExp("".concat(this.separator, "{2,}"), 'g');
21
+ this.dateTimeFormat = new Intl.DateTimeFormat(props.locale);
22
+ this.dateTimeFormatParts = this.dateTimeFormat.formatToParts(new Date());
23
+ this.dateStringFormat = this.dateTimeFormatParts.map(part => IntlDateFormat.datePartTypeMap[part.type]).filter(Boolean).join(this.separator);
24
+ this.separatorIndices = this.dateStringFormat.split('').map((char, index) => char === this.separator ? index : undefined).filter(Boolean);
25
+ }
26
+
27
+ /**
28
+ * Converts a valid date string to a Date object based on the locale's date format.
29
+ */
30
+ date(dateString) {
31
+ const dateValues = dateString.split(this.separator);
32
+ const {
33
+ year,
34
+ month,
35
+ day
36
+ } = this.dateTimeFormatParts.filter(part => part.type !== 'literal').reduce((acc, part, index) => {
37
+ acc[part.type] = parseInt(dateValues[index], 10);
38
+ return acc;
39
+ }, {});
40
+ const date = new Date(year, month - 1, day);
41
+
42
+ // Ignore technically valid date inputs like `30/30/2015` that would cause the month or year to roll over
43
+ if (date.getMonth() !== month - 1 || date.getFullYear() !== year) return null;
44
+ return date;
45
+ }
46
+
47
+ /**
48
+ * Converts a Date object to a date string based on the locale's date format.
49
+ */
50
+ format(date) {
51
+ return this.dateTimeFormat.formatToParts(date).map(part => part.type === 'literal' ? this.separator : part.type === 'year' ? date.getFullYear() : part.value.padStart(2, '0')).join('');
52
+ }
53
+ }
54
+ /** A valid JavaScript Intl locale used to determine the date format. */
55
+ /** Character used to separate values in the date format, e.g. the forward slash in "MM/DD/YYYY". */
56
+ /** The indices of the separator characters in the date format. */
57
+ /** Matches any character except digits and the separator character. */
58
+ /** Matches two or more consecutive separator characters. */
59
+ /** Intl.DateTimeFormat class for the locale. */
60
+ /** Array of Intl.DateTimeFormatParts - including day, month, year, and separators. */
61
+ /** The date format, based on the locale and including separator characters, e.g. "MM/DD/YYYY". */
62
+ _defineProperty(IntlDateFormat, "datePartTypeMap", {
63
+ day: 'dd',
64
+ month: 'mm',
65
+ year: 'yyyy'
66
+ });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Generates an array of Dates for a calendar month. Not localized with Intl. Assumes a Gregorian calendar with "en-US" DateTimeFormat. Treats Sunday as the first day of the week.
3
+ */
4
+ export const generateCalendarMonth = seedDate => {
5
+ const firstOfMonth = new Date(seedDate.getFullYear(), seedDate.getMonth(), 1);
6
+ const firstOfCalendar = new Date(firstOfMonth.getFullYear(), firstOfMonth.getMonth(), 1 - firstOfMonth.getDay());
7
+ const daysInMonth = new Date(firstOfMonth.getFullYear(), firstOfMonth.getMonth() + 1, 0).getDate();
8
+ const daysFromNextMonth = 7 - (daysInMonth + firstOfMonth.getDay()) % 7;
9
+ const month = [];
10
+ for (let i = 0; i < firstOfMonth.getDay(); i++) {
11
+ month.push(new Date(firstOfCalendar.getFullYear(), firstOfCalendar.getMonth(), firstOfCalendar.getDate() + i));
12
+ }
13
+ for (let i = 1; i <= daysInMonth; i++) {
14
+ month.push(new Date(firstOfMonth.getFullYear(), firstOfMonth.getMonth(), i));
15
+ }
16
+ if (daysFromNextMonth !== 7) {
17
+ for (let i = 1; i <= daysFromNextMonth; i++) {
18
+ month.push(new Date(firstOfMonth.getFullYear(), firstOfMonth.getMonth() + 1, i));
19
+ }
20
+ }
21
+ return month;
22
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Converts a Date to an ISO 8601 string (YYYY-MM-DD) in the local timezone (not UTC)
3
+ */
4
+ export const getISOStringLocal = date => {
5
+ const day = date.getDate().toString().padStart(2, '0');
6
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
7
+ return "".concat(date.getFullYear(), "-").concat(month, "-").concat(day);
8
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Clones a Date with the time set to midnight (00:00:00.000)
3
+ */
4
+ export const getMidnightDate = date => new Date(date.getFullYear(), date.getMonth(), date.getDate());
@@ -0,0 +1,16 @@
1
+ import { getMidnightDate } from './getMidnightDate';
2
+
3
+ /**
4
+ * Takes an array of Dates and Date tuples for date ranges, and generates a flattened array of corresponding Date.getTime() numbers, with the time set to midnight. A number will be generated for every individual date within a date range.
5
+ */
6
+ export const getTimesFromDatesAndRanges = datesAndRanges => datesAndRanges.flatMap(value => {
7
+ if (value instanceof Date) return getMidnightDate(value).getTime();
8
+ const [startDate, endDate] = value;
9
+ const startDisabledDate = getMidnightDate(startDate);
10
+ const endDisabledDate = getMidnightDate(endDate);
11
+ const times = [];
12
+ for (let date = startDisabledDate; date <= endDisabledDate; date.setDate(date.getDate() + 1)) {
13
+ times.push(date.getTime());
14
+ }
15
+ return times;
16
+ });
@@ -0,0 +1,105 @@
1
+ import { useCallback, useMemo, useRef, useState } from 'react';
2
+ import { useDateInputValidation } from './useDateInputValidation';
3
+ /** Accepts DateInputOptions and returns a DateInputApi, which can be used to control a custom DateInput component. */
4
+ export const useDateInput = _ref => {
5
+ let {
6
+ date,
7
+ onChangeDate,
8
+ error,
9
+ onErrorDate,
10
+ intlDateFormat,
11
+ required,
12
+ disabledDates,
13
+ minDate,
14
+ maxDate,
15
+ requiredError,
16
+ invalidDateError,
17
+ disabledDateError
18
+ } = _ref;
19
+ const [previousDateProp, setPreviousDateProp] = useState(date);
20
+ const [inputValue, setInputValue] = useState(date ? intlDateFormat.format(date) : '');
21
+ const hadCompleteDateString = useRef(Boolean(date));
22
+
23
+ // Sync internal inputValue state with external date prop state
24
+ if (previousDateProp !== date) {
25
+ hadCompleteDateString.current = Boolean(date);
26
+ setPreviousDateProp(date);
27
+ // Only resync the inputValue state if the new date prop is non-null.
28
+ // This allows the user to backspace a completed date input, without
29
+ // the inputValue being overridden by the date prop changing to null.
30
+ if (date) setInputValue(intlDateFormat.format(date));
31
+ }
32
+ const placeholder = " ".concat(intlDateFormat.separator, " ").concat(intlDateFormat.separator);
33
+ const {
34
+ validateDateInput,
35
+ disabledTimes,
36
+ minTime,
37
+ maxTime
38
+ } = useDateInputValidation({
39
+ intlDateFormat,
40
+ required,
41
+ disabledDates,
42
+ minDate,
43
+ maxDate,
44
+ requiredError,
45
+ invalidDateError,
46
+ disabledDateError
47
+ });
48
+
49
+ /**
50
+ * Be careful to preserve the correct event orders
51
+ * 1. Typing a date in a blank DateInput: onChange -> onChange -> ... -> onChangeDate -> onErrorDate
52
+ * 2. Typing a date in a DateInput that already had a date: onChange -> onChangeDate -> onChange -> onChange -> ... -> onChangeDate -> onErrorDate
53
+ */
54
+ const onChangeDateInput = useCallback(newDateString => {
55
+ let dateString = newDateString;
56
+ const newStringLength = dateString.length;
57
+ const maxLength = intlDateFormat.dateStringFormat.length;
58
+ if (newStringLength > maxLength || intlDateFormat.invalidDateFormatRegex.test(dateString)) return;
59
+ const newLastChar = dateString.charAt(newStringLength - 1);
60
+ const isDeletion = newStringLength < inputValue.length;
61
+ if (!isDeletion) {
62
+ const expectSeparator = intlDateFormat.separatorIndices.includes(newStringLength - 1);
63
+
64
+ // Add a separator as the user is typing if they miss one
65
+ if (expectSeparator && newLastChar !== intlDateFormat.separator) {
66
+ dateString = "".concat(dateString.slice(0, -1)).concat(intlDateFormat.separator).concat(dateString.slice(-1));
67
+ }
68
+ const separatorCount = dateString.split(intlDateFormat.separator).length - 1;
69
+
70
+ // Don't allow the user to type a separator unless we expect one
71
+ if (!expectSeparator && newLastChar === intlDateFormat.separator) return;
72
+ // Don't allow the user to type a duplicate separator or more than 2 separators
73
+ if (intlDateFormat.duplicateSeparatorRegex.test(dateString) || separatorCount > intlDateFormat.separatorIndices.length) return;
74
+ }
75
+ const isCompleteDateString = dateString.length === maxLength;
76
+
77
+ // If we have a complete date string, generate a date and validate it
78
+ if (isCompleteDateString) {
79
+ const date = intlDateFormat.date(dateString);
80
+ const newError = validateDateInput(dateString);
81
+ onChangeDate(newError ? null : date);
82
+ if (newError) onErrorDate(newError);else if (error && error.type !== 'custom') onErrorDate(null);
83
+ } else {
84
+ // If it's not a complete date string, but it was on the previous render, we can clear the date
85
+ if (hadCompleteDateString.current) onChangeDate(null);
86
+ // If we had an error with the previous complete date string, we can clear it now
87
+ if (error && error.type !== 'custom') onErrorDate(null);
88
+ }
89
+ hadCompleteDateString.current = isCompleteDateString;
90
+
91
+ // Update the input value with the coerced date string
92
+ setInputValue(dateString);
93
+ }, [inputValue, intlDateFormat, error, validateDateInput, onChangeDate, onErrorDate]);
94
+ const api = useMemo(() => ({
95
+ inputValue,
96
+ onChangeDateInput,
97
+ intlDateFormat,
98
+ placeholder,
99
+ validateDateInput,
100
+ disabledTimes,
101
+ minTime,
102
+ maxTime
103
+ }), [inputValue, onChangeDateInput, intlDateFormat, placeholder, validateDateInput, disabledTimes, minTime, maxTime]);
104
+ return api;
105
+ };
@@ -0,0 +1,50 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import { DateInputValidationError } from './DateInputValidationError';
3
+ import { getMidnightDate } from './getMidnightDate';
4
+ import { getTimesFromDatesAndRanges } from './getTimesFromDatesAndRanges';
5
+ const oneHundredYearsInMs = 3.156e12;
6
+ export const useDateInputValidation = _ref => {
7
+ let {
8
+ intlDateFormat,
9
+ required,
10
+ disabledDates,
11
+ minDate,
12
+ maxDate,
13
+ requiredError = 'This field is required',
14
+ invalidDateError = 'Please enter a valid date',
15
+ disabledDateError = 'Date unavailable'
16
+ } = _ref;
17
+ const disabledTimes = useMemo(() => getTimesFromDatesAndRanges(disabledDates || []), [disabledDates]);
18
+ const minTime = useMemo(() => minDate && getMidnightDate(minDate).getTime(), [minDate]);
19
+ const maxTime = useMemo(() => maxDate && getMidnightDate(maxDate).getTime(), [maxDate]);
20
+ const validateDateInput = useCallback(dateString => {
21
+ // First evaluate the date string for any errors
22
+ const date = intlDateFormat.date(dateString);
23
+ const time = date === null || date === void 0 ? void 0 : date.getTime();
24
+ let errorType;
25
+
26
+ // Check if date string is fully formed if it's required
27
+ if (required && dateString.length !== intlDateFormat.dateStringFormat.length) errorType = 'required';
28
+ // Check if date is valid
29
+ else if (!date || Number.isNaN(date)) errorType = 'invalid';else if (time && (minTime && time < minTime - oneHundredYearsInMs || maxTime && time > maxTime + oneHundredYearsInMs)) errorType = 'invalid';
30
+ // Check if date is disabled
31
+ else if (time && (minTime && time < minTime || maxTime && time > maxTime || disabledTimes.includes(time))) errorType = 'disabled';
32
+
33
+ // Now assign the error message based on the error type and create the DateInputValidationError
34
+ const defaultError = intlDateFormat.dateStringFormat;
35
+ const errorMessages = {
36
+ required: requiredError,
37
+ invalid: invalidDateError,
38
+ disabled: disabledDateError
39
+ };
40
+ const error = errorType ? new DateInputValidationError(errorType, errorMessages[errorType] || defaultError) : null;
41
+ return error;
42
+ }, [intlDateFormat, required, disabledTimes, minTime, maxTime, requiredError, invalidDateError, disabledDateError]);
43
+ const api = useMemo(() => ({
44
+ validateDateInput,
45
+ disabledTimes,
46
+ minTime,
47
+ maxTime
48
+ }), [validateDateInput, disabledTimes, minTime, maxTime]);
49
+ return api;
50
+ };
@@ -0,0 +1,54 @@
1
+ import { useCallback, useContext } from 'react';
2
+ import isEmpty from 'lodash/isEmpty';
3
+ import { EventHandlerContext } from '../system/EventHandlerProvider';
4
+ const noOp = () => {};
5
+ export const useEventHandler = (component, action, eventConfig, analyticsId) => {
6
+ const config = useContext(EventHandlerContext);
7
+ return useCallback(() => {
8
+ var _actionMapping$action, _handler$convertedAct;
9
+ if (!config.handlers || !(eventConfig !== null && eventConfig !== void 0 && eventConfig.actions.length) && !analyticsId) {
10
+ return noOp();
11
+ }
12
+ const handler = config === null || config === void 0 ? void 0 : config.handlers[component];
13
+ if (!handler) {
14
+ return noOp();
15
+ }
16
+ const {
17
+ actionMapping
18
+ } = config;
19
+
20
+ /**
21
+ * Handler can provide an actionMapping object that maps
22
+ * CDS events (onClick, onHover) to its event names.
23
+ * If actionMapping is provided we convert CDS action into the handler one
24
+ * if the mapping between the two values exists
25
+ */
26
+ const convertedAction = (_actionMapping$action = actionMapping === null || actionMapping === void 0 ? void 0 : actionMapping[action]) !== null && _actionMapping$action !== void 0 ? _actionMapping$action : action;
27
+ const callback = (_handler$convertedAct = handler[convertedAction]) !== null && _handler$convertedAct !== void 0 ? _handler$convertedAct : noOp;
28
+ const params = {};
29
+
30
+ /**
31
+ * AnalyticsId is a generic way of autologging events without any meta
32
+ * information besides the ID, giving a way to log events without having
33
+ * engineers to manually include any contextual information. AnalyticsId
34
+ * would be used to identify the component that fires the event.
35
+ * Providing an analyticsId would take precendence over eventConfig
36
+ */
37
+ if (analyticsId) {
38
+ params.analyticsId = analyticsId;
39
+ }
40
+
41
+ /**
42
+ * the component event config provides a list of actions to track.
43
+ * If the current action is not listed we return a noOp
44
+ */
45
+ if (eventConfig !== null && eventConfig !== void 0 && eventConfig.actions.includes(convertedAction)) {
46
+ params.componentName = eventConfig.componentName;
47
+ params.data = eventConfig.data;
48
+ }
49
+ if (isEmpty(params)) {
50
+ return noOp();
51
+ }
52
+ return callback(params);
53
+ }, [action, component, config, eventConfig, analyticsId]);
54
+ };
@@ -0,0 +1,29 @@
1
+ import { useMemo } from 'react';
2
+ import { shapeBorderRadius } from '../tokens/borderRadius';
3
+ const WIDTH_MODIFIERS = [0.5, 0, 0.6, 0.8, 0.1, 0.9, 0.4, 0.2, 0.7, 0.3];
4
+ export function useFallbackShape(shape, baseWidth, options) {
5
+ const width = useMemo(() => {
6
+ // When rectangle, lets vary the width a bit so things are
7
+ // a little less... uniform. Variety is nice.
8
+ if (shape === 'rectangle' && typeof baseWidth === 'number' && (!(options !== null && options !== void 0 && options.disableRandomRectWidth) || (options === null || options === void 0 ? void 0 : options.rectWidthVariant) !== undefined)) {
9
+ const modifier = (options === null || options === void 0 ? void 0 : options.rectWidthVariant) !== undefined ? WIDTH_MODIFIERS[options.rectWidthVariant % WIDTH_MODIFIERS.length] : Math.random();
10
+ const quarter = Math.round(baseWidth / 4);
11
+ const min = Math.max(baseWidth - quarter, 1);
12
+ const max = baseWidth + quarter;
13
+ return Math.floor(modifier * (max - min + 1)) + min;
14
+ }
15
+
16
+ // All other shapes need a fixed aspect ratio
17
+ return baseWidth;
18
+ }, [baseWidth, options, shape]);
19
+ const borderRadius = useMemo(() => {
20
+ if (shape === 'circle' && Number.isInteger(width)) {
21
+ return Number(width) / 2;
22
+ }
23
+ return shape === 'squircle' ? shapeBorderRadius.squircle : 0;
24
+ }, [shape, width]);
25
+ return useMemo(() => ({
26
+ borderRadius,
27
+ width
28
+ }), [borderRadius, width]);
29
+ }
@@ -0,0 +1,105 @@
1
+ // internal to CDS, each platform customizes on top of this hook.
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
+ /**
4
+ *
5
+ * @param values - An array of all possible options. Make sure the array doesn't change if it's the same values so that the handlers will also stay the same.
6
+ * @param initialState - Initial checked option values.
7
+ * @returns [
8
+ * selectedValues,
9
+ {
10
+ select,
11
+ unselect,
12
+ toggle,
13
+ isAllSelected,
14
+ }
15
+ ]
16
+ */
17
+
18
+ /** @deprecated Do not use this. */
19
+ export const useGroupToggler = (values, initialState) => {
20
+ // The function inside useState will still run on every render.
21
+ // This makes sure that we are not creating new Sets on every render
22
+ // and just throwing it away immediately.
23
+ const initialStateSet = useMemo(() => new Set(initialState), [initialState]);
24
+ const [state, setState] = useState(initialStateSet);
25
+ const lastMixedStateRef = useRef();
26
+ useEffect(() => {
27
+ const isStateMixed = state.size !== 0 && state.size !== values.length;
28
+ if (isStateMixed) {
29
+ lastMixedStateRef.current = state;
30
+ }
31
+ }, [state, values.length, lastMixedStateRef]);
32
+ const select = useCallback(value => {
33
+ setState(prevState => {
34
+ if (!value) {
35
+ // select all
36
+ return new Set(values);
37
+ }
38
+ const nextState = new Set(prevState).add(value);
39
+ if (nextState.size === values.length) {
40
+ lastMixedStateRef.current = undefined;
41
+ }
42
+ return nextState;
43
+ });
44
+ }, [setState, values]);
45
+ const unselect = useCallback(value => {
46
+ setState(prevState => {
47
+ if (!value) {
48
+ // unselect all
49
+ return new Set();
50
+ }
51
+ const nextState = new Set(prevState);
52
+ if (nextState.size === 0) {
53
+ lastMixedStateRef.current = undefined;
54
+ }
55
+ return nextState;
56
+ });
57
+ }, [setState]);
58
+ const toggle = useCallback(value => {
59
+ setState(prevState => {
60
+ // group
61
+ if (!value) {
62
+ const isAllSelected = prevState.size === values.length;
63
+ const isAllUnSelected = prevState.size === 0;
64
+ if (isAllSelected) {
65
+ return new Set();
66
+ }
67
+ if (isAllUnSelected) {
68
+ // last mixed values if any
69
+ return lastMixedStateRef.current ? lastMixedStateRef.current : new Set(values);
70
+ }
71
+ // mixed
72
+ return new Set(values);
73
+ }
74
+
75
+ // individual value
76
+ const nextState = new Set(prevState);
77
+ if (nextState.delete(value)) {
78
+ if (nextState.size === 0) {
79
+ lastMixedStateRef.current = undefined;
80
+ }
81
+ return nextState;
82
+ }
83
+ nextState.add(value);
84
+ if (nextState.size === values.length) {
85
+ lastMixedStateRef.current = undefined;
86
+ }
87
+ return nextState;
88
+ });
89
+ }, [setState, values]);
90
+ const isAllSelected = useMemo(() => {
91
+ if (state.size === 0) {
92
+ return false;
93
+ }
94
+ if (state.size === values.length) {
95
+ return true;
96
+ }
97
+ return 'mixed';
98
+ }, [state, values.length]);
99
+ return [state, {
100
+ select,
101
+ unselect,
102
+ toggle,
103
+ isAllSelected
104
+ }];
105
+ };
@@ -0,0 +1,6 @@
1
+ import { useEffect, useState } from 'react';
2
+ export const useHasMounted = () => {
3
+ const [hasMounted, setHasMounted] = useState(false);
4
+ useEffect(() => setHasMounted(true), []);
5
+ return hasMounted;
6
+ };
@@ -0,0 +1,47 @@
1
+ import { useCallback, useMemo, useState } from 'react';
2
+ import { noop } from '@coinbase/cds-utils';
3
+ export function useIndexCounter(_ref) {
4
+ let {
5
+ length,
6
+ startIndex = 0,
7
+ onDecrement = noop,
8
+ onIncrement = noop,
9
+ onMinDecrement = noop,
10
+ onMaxIncrement = noop
11
+ } = _ref;
12
+ const [activeIndex, setActiveIndex] = useState(startIndex);
13
+ const isAtMin = activeIndex === 0;
14
+ const isAtMax = activeIndex === length - 1;
15
+ const handleDecrement = useCallback(() => {
16
+ if (isAtMin) {
17
+ onMinDecrement();
18
+ } else {
19
+ setActiveIndex(curr => {
20
+ const newactiveIndex = curr - 1;
21
+ onDecrement(newactiveIndex);
22
+ return newactiveIndex;
23
+ });
24
+ }
25
+ }, [isAtMin, onDecrement, onMinDecrement]);
26
+ const handleIncrement = useCallback(() => {
27
+ if (isAtMax) {
28
+ onMaxIncrement();
29
+ } else {
30
+ setActiveIndex(curr => {
31
+ const newactiveIndex = curr + 1;
32
+ onIncrement(newactiveIndex);
33
+ return newactiveIndex;
34
+ });
35
+ }
36
+ }, [isAtMax, onMaxIncrement, onIncrement]);
37
+ return useMemo(() => {
38
+ return {
39
+ activeIndex,
40
+ setActiveIndex,
41
+ isAtMin,
42
+ isAtMax,
43
+ handleDecrement,
44
+ handleIncrement
45
+ };
46
+ }, [activeIndex, handleDecrement, handleIncrement, isAtMin, isAtMax]);
47
+ }
@@ -0,0 +1,4 @@
1
+ import { useMemo } from 'react';
2
+ export const useInputVariant = (focused, variant) => {
3
+ return useMemo(() => focused && variant !== 'positive' && variant !== 'negative' ? 'primary' : variant, [focused, variant]);
4
+ };
@@ -0,0 +1,60 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ import { useMemo } from 'react';
7
+ export const blue = '#0052FF';
8
+ export const black = '#0A0B0D';
9
+ export const white = '#FFFFFF';
10
+ const logoMarkData = {
11
+ 16: {
12
+ viewBox: '0 0 16 16',
13
+ path: 'M8,12c-2.21,0-4-1.79-4-4c0-2.21,1.79-4,4-4c1.86,0,3.41,1.28,3.86,3h4.07C15.44,3.05,12.08,0,8,0 C3.58,0,0,3.58,0,8c0,4.42,3.58,8,8,8c4.08,0,7.44-3.05,7.93-7h-4.07C11.41,10.72,9.86,12,8,12z'
14
+ },
15
+ 24: {
16
+ viewBox: '0 0 24 24',
17
+ path: 'M12.0225 18C8.70131 18 6.01127 15.315 6.01127 12C6.01127 8.685 8.70131 6 12.0225 6C14.9981 6 17.4678 8.165 17.9436 11H24C23.489 4.84 18.3244 0 12.0225 0C5.3851 0 0 5.375 0 12C0 18.625 5.3851 24 12.0225 24C18.3244 24 23.489 19.16 24 13H17.9436C17.4678 15.835 14.9981 18 12.0225 18Z'
18
+ },
19
+ 32: {
20
+ viewBox: '0 0 48 48',
21
+ path: 'M24,36c-6.63,0-12-5.37-12-12s5.37-12,12-12c5.94,0,10.87,4.33,11.82,10h12.09C46.89,9.68,36.58,0,24,0 C10.75,0,0,10.75,0,24s10.75,24,24,24c12.58,0,22.89-9.68,23.91-22H35.82C34.87,31.67,29.94,36,24,36z'
22
+ }
23
+ };
24
+ const wordmarkData = {
25
+ viewBox: '0 0 688 123',
26
+ path: 'M138.857 34.3392C113.863 34.3392 94.3343 53.3277 94.3343 78.7477C94.3343 104.168 113.37 122.994 138.857 122.994C164.343 122.994 183.71 103.843 183.71 78.5852C183.71 53.4902 164.674 34.3392 138.857 34.3392ZM139.025 104.674C124.792 104.674 114.363 93.611 114.363 78.754C114.363 63.7282 124.624 52.6714 138.857 52.6714C153.258 52.6714 163.681 63.897 163.681 78.754C163.681 93.611 153.258 104.674 139.025 104.674ZM189.168 53.659H201.584V121.35H221.443V35.9893H189.168V53.659ZM44.3536 52.6652C54.7832 52.6652 63.0581 59.103 66.1995 68.6785H87.2209C83.4113 48.2087 66.5305 34.3392 44.5223 34.3392C19.5288 34.3392 0 53.3277 0 78.754C0 104.18 19.0355 123 44.5223 123C66.0371 123 83.249 109.131 87.0586 88.492H66.1995C63.2205 98.0675 54.9456 104.674 44.516 104.674C30.1145 104.674 20.0222 93.611 20.0222 78.754C20.0285 63.7282 29.9584 52.6652 44.3536 52.6652ZM566.518 70.4973L551.954 68.3535C545.003 67.3659 540.038 65.0533 540.038 59.603C540.038 53.659 546.495 50.6901 555.264 50.6901C564.863 50.6901 570.989 54.8153 572.313 61.5844H591.511C589.357 44.4148 576.117 34.3455 555.763 34.3455C534.742 34.3455 520.84 45.0773 520.84 60.2656C520.84 74.7913 529.946 83.2167 548.313 85.8544L562.877 87.9982C569.996 88.9858 573.968 91.7984 573.968 97.0799C573.968 103.849 567.017 106.655 557.418 106.655C545.665 106.655 539.045 101.868 538.052 94.6048H518.523C520.347 111.281 533.418 123 557.25 123C578.933 123 593.328 113.093 593.328 96.0861C593.328 80.8979 582.905 72.9725 566.518 70.4973ZM211.514 0.825042C204.232 0.825042 198.767 6.10656 198.767 13.3694C198.767 20.6323 204.225 25.9138 211.514 25.9138C218.796 25.9138 224.26 20.6323 224.26 13.3694C224.26 6.10656 218.796 0.825042 211.514 0.825042ZM502.966 65.2158C502.966 46.7274 491.712 34.3455 467.88 34.3455C445.373 34.3455 432.795 45.7398 430.309 63.2407H450.007C451 56.4716 456.296 50.8588 467.549 50.8588C477.648 50.8588 482.613 55.3153 482.613 60.7656C482.613 67.866 473.507 69.6785 462.253 70.8349C447.028 72.4849 428.161 77.7664 428.161 97.58C428.161 112.937 439.583 122.837 457.788 122.837C472.021 122.837 480.958 116.893 485.43 107.48C486.092 115.9 492.38 121.35 501.155 121.35H512.74V103.687H502.972V65.2158H502.966ZM483.437 86.6794C483.437 98.0737 473.507 106.493 461.423 106.493C453.972 106.493 447.683 103.355 447.683 96.7549C447.683 88.3357 457.782 86.0231 467.05 85.0356C475.987 84.2105 480.952 82.2292 483.437 78.429V86.6794ZM378.012 34.3392C366.92 34.3392 357.652 38.9645 351.032 46.7211V0H331.172V121.35H350.701V110.124C357.321 118.212 366.758 123 378.012 123C401.843 123 419.886 104.18 419.886 78.754C419.886 53.3277 401.512 34.3392 378.012 34.3392ZM375.033 104.674C360.8 104.674 350.37 93.611 350.37 78.754C350.37 63.897 360.962 52.6714 375.195 52.6714C389.596 52.6714 399.689 63.7345 399.689 78.754C399.689 93.611 389.265 104.674 375.033 104.674ZM283.671 34.3392C270.762 34.3392 262.319 39.6208 257.354 47.0524V35.9893H237.656V121.344H257.516V74.9538C257.516 61.9094 265.791 52.6652 278.038 52.6652C289.46 52.6652 296.574 60.7531 296.574 72.4787V121.35H316.434V70.9974C316.44 49.5275 305.354 34.3392 283.671 34.3392ZM688 75.9476C688 51.5151 670.126 34.3455 646.126 34.3455C620.639 34.3455 601.934 53.4965 601.934 78.754C601.934 105.337 621.963 123 646.457 123C667.147 123 683.366 110.781 687.5 93.4485H666.81C663.831 101.043 656.549 105.337 646.781 105.337C634.035 105.337 624.436 97.4112 622.288 83.5417H687.994V75.9476H688ZM623.449 69.341C626.597 57.4529 635.534 51.6776 645.795 51.6776C657.049 51.6776 665.655 58.1155 667.641 69.341H623.449Z'
27
+ };
28
+ export const useLogoWordmark = _ref => {
29
+ let {
30
+ foreground,
31
+ colorScheme
32
+ } = _ref;
33
+ const color = colorScheme === 'dark' ? white : foreground ? black : blue;
34
+ return useMemo(() => {
35
+ return _objectSpread(_objectSpread({}, wordmarkData), {}, {
36
+ color
37
+ });
38
+ }, [color]);
39
+ };
40
+ export const useLogoMark = _ref2 => {
41
+ let {
42
+ size = 32,
43
+ foreground,
44
+ colorScheme
45
+ } = _ref2;
46
+ const {
47
+ viewBox,
48
+ path
49
+ } = logoMarkData[size];
50
+ const color = colorScheme === 'dark' ? white : foreground ? black : blue;
51
+ return useMemo(() => {
52
+ return {
53
+ color,
54
+ path,
55
+ viewBox,
56
+ width: size,
57
+ height: size
58
+ };
59
+ }, [color, path, size, viewBox]);
60
+ };
@@ -0,0 +1,14 @@
1
+ export const useMergeRefs = function () {
2
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
3
+ refs[_key] = arguments[_key];
4
+ }
5
+ return value => {
6
+ refs.forEach(ref => {
7
+ if (typeof ref === 'function') {
8
+ ref(value);
9
+ } else if (ref != null) {
10
+ ref.current = value;
11
+ }
12
+ });
13
+ };
14
+ };