@coinbase/cdp-react 0.0.98 → 0.0.99

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 (198) hide show
  1. package/dist/components/AuthButton/index.d.ts +102 -0
  2. package/dist/components/CDPReactProvider/index.d.ts +114 -0
  3. package/dist/components/CopyAddress/index.d.ts +29 -0
  4. package/dist/components/CopyEvmKeyButton/index.d.ts +77 -0
  5. package/dist/components/CopySolanaKeyButton/index.d.ts +73 -0
  6. package/dist/components/EnrollMfa/EnrollMfaDescription.d.ts +21 -0
  7. package/dist/components/EnrollMfa/EnrollMfaFlow.d.ts +27 -0
  8. package/dist/components/EnrollMfa/EnrollMfaFlowBackButton.d.ts +19 -0
  9. package/dist/components/EnrollMfa/EnrollMfaFlowProvider.d.ts +52 -0
  10. package/dist/components/EnrollMfa/EnrollMfaFooter.d.ts +18 -0
  11. package/dist/components/EnrollMfa/EnrollMfaImage.d.ts +24 -0
  12. package/dist/components/EnrollMfa/EnrollMfaItem.d.ts +21 -0
  13. package/dist/components/EnrollMfa/EnrollMfaItems.d.ts +17 -0
  14. package/dist/components/EnrollMfa/EnrollMfaProvider.d.ts +35 -0
  15. package/dist/components/EnrollMfa/EnrollMfaTitle.d.ts +21 -0
  16. package/dist/components/EnrollMfa/index.d.ts +65 -0
  17. package/dist/components/EnrollMfa/methods/sms.d.ts +25 -0
  18. package/dist/components/EnrollMfa/methods/totp.d.ts +25 -0
  19. package/dist/components/EnrollMfa/types.d.ts +48 -0
  20. package/dist/components/EnrollMfa/useEnrollMfaReducer.d.ts +6 -0
  21. package/dist/components/EnrollMfaModal/index.d.ts +111 -0
  22. package/dist/components/ExportWallet/index.d.ts +163 -0
  23. package/dist/components/ExportWalletModal/index.d.ts +173 -0
  24. package/dist/components/Fund/FundForm.d.ts +18 -0
  25. package/dist/components/Fund/FundProvider.d.ts +17 -0
  26. package/dist/components/Fund/FundTitle.d.ts +12 -0
  27. package/dist/components/Fund/components/FundAmountInput.d.ts +13 -0
  28. package/dist/components/Fund/components/FundErrorScreen.d.ts +7 -0
  29. package/dist/components/Fund/components/FundPaymentMethods.d.ts +7 -0
  30. package/dist/components/Fund/components/FundPresetAmountInputs.d.ts +7 -0
  31. package/dist/components/Fund/components/FundTransactionStatus.d.ts +6 -0
  32. package/dist/components/Fund/hooks/useBuyUrl.d.ts +23 -0
  33. package/dist/components/Fund/hooks/useEmitLifecycleStatus.d.ts +12 -0
  34. package/dist/components/Fund/hooks/useExchangeRate.d.ts +17 -0
  35. package/dist/components/Fund/hooks/usePaymentMethods.d.ts +16 -0
  36. package/dist/components/Fund/hooks/usePopupMonitor.d.ts +9 -0
  37. package/dist/components/Fund/hooks/useSetupOnrampEventListeners.d.ts +6 -0
  38. package/dist/components/Fund/index.d.ts +87 -0
  39. package/dist/components/Fund/types.d.ts +137 -0
  40. package/dist/components/Fund/useFundReducer.d.ts +15 -0
  41. package/dist/components/Fund/utils/buildPaymentMethods.d.ts +15 -0
  42. package/dist/components/Fund/utils/setupOnrampEventListeners.d.ts +10 -0
  43. package/dist/components/Fund/utils/subscribeToWindowMessage.d.ts +27 -0
  44. package/dist/components/FundModal/index.d.ts +106 -0
  45. package/dist/components/LinkAuth/LinkAuthFlow.d.ts +25 -0
  46. package/dist/components/LinkAuth/LinkAuthFlowBackButton.d.ts +19 -0
  47. package/dist/components/LinkAuth/LinkAuthFlowProvider.d.ts +60 -0
  48. package/dist/components/LinkAuth/LinkAuthItem.d.ts +23 -0
  49. package/dist/components/LinkAuth/LinkAuthItems.d.ts +17 -0
  50. package/dist/components/LinkAuth/LinkAuthProvider.d.ts +31 -0
  51. package/dist/components/LinkAuth/LinkAuthTitle.d.ts +17 -0
  52. package/dist/components/LinkAuth/index.d.ts +170 -0
  53. package/dist/components/LinkAuth/types.d.ts +31 -0
  54. package/dist/components/LinkAuth/utils.d.ts +12 -0
  55. package/dist/components/LinkAuthModal/index.d.ts +112 -0
  56. package/dist/components/OAuthStatusModal/index.d.ts +24 -0
  57. package/dist/components/SendEvmTransactionButton/index.d.ts +27 -0
  58. package/dist/components/SendSolanaTransactionButton/index.d.ts +27 -0
  59. package/dist/components/SignIn/SignInAuthMethodButtons.d.ts +26 -0
  60. package/dist/components/SignIn/SignInBackButton.d.ts +40 -0
  61. package/dist/components/SignIn/SignInCredentials.d.ts +13 -0
  62. package/dist/components/SignIn/SignInDescription.d.ts +35 -0
  63. package/dist/components/SignIn/SignInFooter.d.ts +27 -0
  64. package/dist/components/SignIn/SignInForm.d.ts +39 -0
  65. package/dist/components/SignIn/SignInImage.d.ts +38 -0
  66. package/dist/components/SignIn/SignInProvider.d.ts +54 -0
  67. package/dist/components/SignIn/SignInTitle.d.ts +35 -0
  68. package/dist/components/SignIn/flows/SignInWithEmail.d.ts +26 -0
  69. package/dist/components/SignIn/flows/SignInWithOAuth.d.ts +19 -0
  70. package/dist/components/SignIn/flows/SignInWithSms.d.ts +26 -0
  71. package/dist/components/SignIn/hooks/useEmailForm.d.ts +7 -0
  72. package/dist/components/SignIn/hooks/useOTPForm.d.ts +8 -0
  73. package/dist/components/SignIn/hooks/usePhoneNumberForm.d.ts +7 -0
  74. package/dist/components/SignIn/hooks/useSignInWithOAuth.d.ts +8 -0
  75. package/dist/components/SignIn/index.d.ts +124 -0
  76. package/dist/components/SignIn/types.d.ts +37 -0
  77. package/dist/components/SignIn/useSignInReducer.d.ts +9 -0
  78. package/dist/components/SignInModal/index.d.ts +123 -0
  79. package/dist/components/SignOutButton/index.d.ts +39 -0
  80. package/dist/components/ThemeProvider/index.d.ts +70 -0
  81. package/dist/components/VerifyMfa/VerifyMfaDescription.d.ts +24 -0
  82. package/dist/components/VerifyMfa/VerifyMfaFlow.d.ts +30 -0
  83. package/dist/components/VerifyMfa/VerifyMfaFlowBackButton.d.ts +19 -0
  84. package/dist/components/VerifyMfa/VerifyMfaFlowProvider.d.ts +51 -0
  85. package/dist/components/VerifyMfa/VerifyMfaFooter.d.ts +18 -0
  86. package/dist/components/VerifyMfa/VerifyMfaImage.d.ts +23 -0
  87. package/dist/components/VerifyMfa/VerifyMfaItem.d.ts +20 -0
  88. package/dist/components/VerifyMfa/VerifyMfaItems.d.ts +18 -0
  89. package/dist/components/VerifyMfa/VerifyMfaProvider.d.ts +40 -0
  90. package/dist/components/VerifyMfa/VerifyMfaTitle.d.ts +24 -0
  91. package/dist/components/VerifyMfa/index.d.ts +55 -0
  92. package/dist/components/VerifyMfa/methods/sms.d.ts +29 -0
  93. package/dist/components/VerifyMfa/methods/totp.d.ts +29 -0
  94. package/dist/components/VerifyMfa/types.d.ts +33 -0
  95. package/dist/components/VerifyMfa/useVerifyMfaReducer.d.ts +7 -0
  96. package/dist/components/VerifyMfaInline/index.d.ts +212 -0
  97. package/dist/components/VerifyMfaModal/index.d.ts +114 -0
  98. package/dist/components/forms/AmountInput/index.d.ts +16 -0
  99. package/dist/components/forms/AmountInput/types.d.ts +9 -0
  100. package/dist/components/forms/AmountInput/useAmountInput.d.ts +14 -0
  101. package/dist/components/forms/AmountInput/useInputScale.d.ts +12 -0
  102. package/dist/components/forms/AmountInput/useNumberParseAndFormat.d.ts +20 -0
  103. package/dist/components/forms/CountrySelect/index.d.ts +9 -0
  104. package/dist/components/forms/EmailForm/index.d.ts +17 -0
  105. package/dist/components/forms/ExchangeAmountInput/index.d.ts +19 -0
  106. package/dist/components/forms/ExchangeAmountInput/types.d.ts +12 -0
  107. package/dist/components/forms/ExchangeAmountInput/useExchangeAmountInput.d.ts +17 -0
  108. package/dist/components/forms/Field/index.d.ts +15 -0
  109. package/dist/components/forms/Input/index.d.ts +15 -0
  110. package/dist/components/forms/Label/index.d.ts +8 -0
  111. package/dist/components/forms/OTP/index.d.ts +6 -0
  112. package/dist/components/forms/OTPForm/index.d.ts +20 -0
  113. package/dist/components/forms/PhoneNumberForm/index.d.ts +27 -0
  114. package/dist/components/forms/PhoneNumberInput/index.d.ts +16 -0
  115. package/dist/components/forms/PhoneNumberInput/maskOverride.d.ts +6 -0
  116. package/dist/components/forms/PhoneNumberInput/usePhoneNumberFormatter.d.ts +7 -0
  117. package/dist/components/forms/Select/index.d.ts +30 -0
  118. package/dist/components/ui/Badge/index.d.ts +19 -0
  119. package/dist/components/ui/Banner/index.d.ts +25 -0
  120. package/dist/components/ui/Button/index.d.ts +50 -0
  121. package/dist/components/ui/ButtonBase/index.d.ts +20 -0
  122. package/dist/components/ui/CoinbaseFooter/index.d.ts +16 -0
  123. package/dist/components/ui/CopyTextField/index.d.ts +35 -0
  124. package/dist/components/ui/Error/index.d.ts +14 -0
  125. package/dist/components/ui/IframeButton/index.d.ts +17 -0
  126. package/dist/components/ui/LoadingSkeleton/index.d.ts +22 -0
  127. package/dist/components/ui/LoadingSpinner/index.d.ts +11 -0
  128. package/dist/components/ui/Modal/index.d.ts +82 -0
  129. package/dist/components/ui/QRCode/QRCodeSvg.d.ts +35 -0
  130. package/dist/components/ui/QRCode/index.d.ts +7 -0
  131. package/dist/components/ui/QRCode/useCorners.d.ts +9 -0
  132. package/dist/components/ui/QRCode/useDotsPath.d.ts +18 -0
  133. package/dist/components/ui/QRCode/useLogo.d.ts +18 -0
  134. package/dist/components/ui/QRCode/useMatrix.d.ts +7 -0
  135. package/dist/components/ui/ServerError/index.d.ts +6 -0
  136. package/dist/components/ui/SuccessMessage/index.d.ts +14 -0
  137. package/dist/components/ui/SwitchFadeTransition/index.d.ts +15 -0
  138. package/dist/components/ui/SwitchSlideTransition/index.d.ts +16 -0
  139. package/dist/components/ui/SwitchTransition/index.d.ts +42 -0
  140. package/dist/components/ui/ToggleListItem/index.d.ts +31 -0
  141. package/dist/components/ui/VisuallyHidden/index.d.ts +18 -0
  142. package/dist/data/countries.d.ts +15 -0
  143. package/dist/data/countryNames.d.ts +4 -0
  144. package/dist/hooks/useKeyExportPostMessage.d.ts +25 -0
  145. package/dist/hooks/usePhoneNumberState.d.ts +47 -0
  146. package/dist/hooks/usePhoneNumberValidators.d.ts +8 -0
  147. package/dist/hooks/useTimeout.d.ts +18 -0
  148. package/dist/hooks/useTimer.d.ts +6 -0
  149. package/dist/hooks/useTransitionMap.d.ts +22 -0
  150. package/dist/hooks/useVerifyMfaModal.d.ts +78 -0
  151. package/dist/icons/IconAppleLogo.d.ts +22 -0
  152. package/dist/icons/IconArrowLeft.d.ts +22 -0
  153. package/dist/icons/IconArrowsUpDown.d.ts +22 -0
  154. package/dist/icons/IconCheck.d.ts +22 -0
  155. package/dist/icons/IconCheckCircle.d.ts +21 -0
  156. package/dist/icons/IconChevronDown.d.ts +22 -0
  157. package/dist/icons/IconCoinbaseMark.d.ts +22 -0
  158. package/dist/icons/IconCoinbaseWordmark.d.ts +22 -0
  159. package/dist/icons/IconCopy.d.ts +22 -0
  160. package/dist/icons/IconCreditCard.d.ts +22 -0
  161. package/dist/icons/IconCurrencies.d.ts +22 -0
  162. package/dist/icons/IconEnvelope.d.ts +22 -0
  163. package/dist/icons/IconExclamationCircle.d.ts +22 -0
  164. package/dist/icons/IconExclamationTriangle.d.ts +22 -0
  165. package/dist/icons/IconGoogleColorLogo.d.ts +22 -0
  166. package/dist/icons/IconGoogleLogo.d.ts +22 -0
  167. package/dist/icons/IconLock.d.ts +22 -0
  168. package/dist/icons/IconMinus.d.ts +21 -0
  169. package/dist/icons/IconPhone.d.ts +22 -0
  170. package/dist/icons/IconPinCode.d.ts +22 -0
  171. package/dist/icons/IconPlus.d.ts +21 -0
  172. package/dist/icons/IconShield.d.ts +22 -0
  173. package/dist/icons/IconSmartPhone.d.ts +22 -0
  174. package/dist/icons/IconTelegramLogo.d.ts +22 -0
  175. package/dist/icons/IconXLogo.d.ts +22 -0
  176. package/dist/icons/IconXMark.d.ts +22 -0
  177. package/dist/icons/SvgIcon.d.ts +6 -0
  178. package/dist/theme/cssVariables.d.ts +10 -0
  179. package/dist/theme/theme.d.ts +246 -0
  180. package/dist/theme/tokens.d.ts +54 -0
  181. package/dist/theme/utils.d.ts +63 -0
  182. package/dist/types/secureIframe.d.ts +3 -0
  183. package/dist/utils/capitalize.d.ts +8 -0
  184. package/dist/utils/childrenHasComponent.d.ts +10 -0
  185. package/dist/utils/clamp.d.ts +10 -0
  186. package/dist/utils/formatFiat.d.ts +11 -0
  187. package/dist/utils/formatPhoneNumber.d.ts +8 -0
  188. package/dist/utils/getMessageFromUnknownError.d.ts +9 -0
  189. package/dist/utils/isApiError.d.ts +21 -0
  190. package/dist/utils/isEmailInvalid.d.ts +15 -0
  191. package/dist/utils/openPopup.d.ts +15 -0
  192. package/dist/utils/parseValuesFromPhoneNumber.d.ts +16 -0
  193. package/dist/utils/sendIframeMessage.d.ts +8 -0
  194. package/dist/utils/toOAuthProviderType.d.ts +8 -0
  195. package/dist/utils/transition.d.ts +41 -0
  196. package/dist/version.d.ts +5 -1
  197. package/dist/version.js +1 -1
  198. package/package.json +5 -5
@@ -1,5 +1,20 @@
1
1
  import { borderRadiusSemantic, borderRadiusComponents, colorsSemantic, colorsComponents, fontSemantic, fontComponents, zIndexSemantic, zIndexComponents } from './tokens';
2
2
  import { Flattened } from './utils';
3
+ /**
4
+ * The theme is a flattened tokens object with values appropriate for web environments
5
+ * (i.e. CSS properties & CSS Variables).
6
+ *
7
+ * It DOES NOT include the namespace (`--cdp-web-`) in the keys.
8
+ *
9
+ * @example
10
+ * ```tsx lines
11
+ * const theme: Partial<Theme> = {
12
+ * "colors-bg-primary": "#0052ff",
13
+ * "colors-cta-primary-bg-default": "var(--cdp-web-colors-bg-primary)",
14
+ * "font-size-base": "16px",
15
+ * };
16
+ * ```
17
+ */
3
18
  export declare const theme: Flattened<{
4
19
  borderRadius: {
5
20
  readonly badge: {
@@ -674,36 +689,267 @@ export declare const theme: Flattened<{
674
689
  };
675
690
  };
676
691
  }>;
692
+ /**
693
+ * Semantic colors are the base colors for the theme.
694
+ *
695
+ * They are typically not used directly in the components, but are used to define the base colors
696
+ * for the components.
697
+ *
698
+ * @example
699
+ * ```tsx lines
700
+ * const theme: Partial<SemanticColors> = {
701
+ * "colors-bg-default": "#ffffff",
702
+ * "colors-bg-alternate": "#eef0f3",
703
+ * "colors-bg-overlay": "color(from var(--cdp-web-colors-bg-alternate) srgb r g b / 0.33)",
704
+ * };
705
+ * ```
706
+ *
707
+ * @see {@link colorsSemantic} for the default token values
708
+ * @see {@link ComponentColors} for the component colors that inherit from the SemanticColors
709
+ */
677
710
  export type SemanticColors = Flattened<{
678
711
  colors: typeof colorsSemantic;
679
712
  }>;
713
+ /**
714
+ * Component colors are the colors for the individual UI components.
715
+ * They inherit values from the SemanticColors via CSS variables.
716
+ *
717
+ * @example
718
+ * ```tsx lines
719
+ * const theme: Partial<ComponentColors> = {
720
+ * "colors-cta-primary-bg-default": "var(--cdp-web-colors-bg-primary)",
721
+ * };
722
+ * ```
723
+ *
724
+ * @see {@link colorsComponents} for the default token values
725
+ * @see {@link SemanticColors} for the semantic colors that the component colors inherit from
726
+ */
680
727
  export type ComponentColors = Flattened<{
681
728
  colors: typeof colorsComponents;
682
729
  }>;
730
+ /**
731
+ * Defines all the colors in the theme.
732
+ *
733
+ * To fully change the theme, you only need to define the {@link SemanticColors}, and the rest of the values
734
+ * will inherit from them. For more granular control, individual {@link ComponentColors} can be overridden.
735
+ *
736
+ * For example, the `colors-bg-primary` semantic color is used to define the background color for
737
+ * a "primary" variant component. The `colors-cta-primary-bg-default` component color inherits
738
+ * from the `colors-bg-primary` semantic color via CSS variables.
739
+ *
740
+ * If you want to override the just the default background color of the primary cta, you can do so
741
+ * by defining the `colors-cta-primary-bg-default` token in the theme.
742
+ *
743
+ * @example
744
+ * ```tsx lines
745
+ * // Change the primary background color to teal but make the primary cta button black
746
+ * const theme: Partial<Theme> = {
747
+ * "colors-bg-primary": "teal",
748
+ * "colors-cta-primary-bg-default": "black",
749
+ * };
750
+ * ```
751
+ */
683
752
  export type ColorTokens = SemanticColors & ComponentColors;
753
+ /**
754
+ * Semantic fonts are the base fonts for the theme.
755
+ *
756
+ * They are typically not used directly in the components, but are used to define the base fonts
757
+ * for the components. Semantic fonts are defined based on their context (i.e. body, interactive).
758
+ *
759
+ * @example
760
+ * ```tsx lines
761
+ * const theme: Partial<SemanticFonts> = {
762
+ * "font-family-interactive": "var(--cdp-web-font-family-mono)", // Change the font for interactive elements to monospace font
763
+ * };
764
+ * ```
765
+ *
766
+ * @see {@link fontSemantic} for the default token values
767
+ * @see {@link ComponentFonts} for the component fonts that inherit from the SemanticFonts
768
+ */
684
769
  export type SemanticFonts = Flattened<{
685
770
  font: typeof fontSemantic;
686
771
  }>;
772
+ /**
773
+ * Component fonts are the fonts for the individual UI components.
774
+ * They inherit values from the SemanticFonts via CSS variables.
775
+ *
776
+ * @example
777
+ * ```tsx lines
778
+ * const theme: Partial<ComponentFonts> = {
779
+ * // Change the font for ctas to monospace font
780
+ * "font-family-cta": "var(--cdp-web-font-family-mono)",
781
+ * // Change the font for iframed content to monospace font
782
+ * "font-family-iframe": "var(--cdp-web-font-family-mono)",
783
+ * // Provide a custom font URL for iframed content (must be a google webfont URL)
784
+ * "font-url-iframe": "https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap",
785
+ * };
786
+ * ```
787
+ *
788
+ * @see {@link fontComponents} for the default token values
789
+ * @see {@link SemanticFonts} for the semantic fonts that the component fonts inherit from
790
+ */
687
791
  export type ComponentFonts = Flattened<{
688
792
  font: typeof fontComponents;
689
793
  }>;
794
+ /**
795
+ * Defines all the fonts in the theme.
796
+ *
797
+ * To fully change the theme, you only need to define the {@link SemanticFonts}, and the rest of the values
798
+ * will inherit from them. For more granular control, individual {@link ComponentFonts} can be overridden.
799
+ *
800
+ * For example, the `font-family-interactive` semantic font is used to define the default font
801
+ * for interactive elements. The `font-family-cta` component font inherits
802
+ * from the `font-family-interactive` semantic font via CSS variables.
803
+ *
804
+ * If you want to override the just the default CTA font, you can do so
805
+ * by defining the `font-family-cta` token in the theme.
806
+ *
807
+ * @example
808
+ * ```tsx lines
809
+ * const fontTokens: Partial<FontTokens> = {
810
+ * // Change the default monospace font
811
+ * "font-family-mono": "'Source Code Pro', monospace",
812
+ * // Make buttons use the default monospace font
813
+ * "font-family-cta": "var(--cdp-web-font-family-mono)",
814
+ * // Make iframed content use the default monospace font
815
+ * "font-family-iframe": "var(--cdp-web-font-family-mono)",
816
+ * // Provide a custom font URL for iframed content (must be a google webfont URL)
817
+ * "font-url-iframe": "https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap",
818
+ * };
819
+ * ```
820
+ *
821
+ * @see {@link font} for the default token values
822
+ */
690
823
  export type FontTokens = SemanticFonts & ComponentFonts;
824
+ /**
825
+ * Semantic border radii are the base border radius definitions for the theme.
826
+ *
827
+ * They are typically not used directly in the components, but are used to define the border radius
828
+ * for the components. Semantic border radius values are defind in a scale (none, xs - xl, full).
829
+ *
830
+ * The default values are derived from the base font size using calc(). This is to mimic the way
831
+ * rems function but instead of using the font-size applied to the root document, it uses the
832
+ * base font size provided by the theme. Rems can be used, but it's recommended to set the base font
833
+ * size to a value that uses rems as well (most applications will use 16px or 1rem).
834
+ *
835
+ * @example
836
+ * ```tsx lines
837
+ * const theme: Partial<SemanticBorderRadius> = {
838
+ * "border-radius-lg": "1.5rem", // make sure to set base font size to a rem value if you use rems
839
+ * "border-radius-xl": "2rem",
840
+ * };
841
+ * ```
842
+ *
843
+ * @see {@link borderRadiusSemantic} for the default semantic border radius token values
844
+ * @see {@link ComponentBorderRadius} for the component border radius values that inherit from the SemanticBorderRadius
845
+ */
691
846
  export type SemanticBorderRadius = Flattened<{
692
847
  borderRadius: typeof borderRadiusSemantic;
693
848
  }>;
849
+ /**
850
+ * Component border radii are the border radius values for the individual UI components.
851
+ * They inherit values from the SemanticBorderRadius via CSS variables.
852
+ *
853
+ * @example
854
+ * ```tsx lines
855
+ * const theme: Partial<ComponentBorderRadius> = {
856
+ * "border-radius-cta": "var(--cdp-web-border-radius-none)", // Remove border radius for ctas only
857
+ * };
858
+ * ```
859
+ *
860
+ * @see {@link borderRadiusComponents} for the default token values
861
+ * @see {@link SemanticBorderRadius} for the semantic border radius values that the component border radius values inherit from
862
+ */
694
863
  export type ComponentBorderRadius = Flattened<{
695
864
  borderRadius: typeof borderRadiusComponents;
696
865
  }>;
866
+ /**
867
+ * Defines all the border radius values in the theme.
868
+ *
869
+ * To change the border radius scale, you can override the {@link SemanticBorderRadius} values, and the rest of the values
870
+ * will inherit from them. For more granular control, individual {@link ComponentBorderRadius} can be overridden.
871
+ *
872
+ * For example, the `borderRadius-sm` semantic border radius is used to define a small amount of border radius.
873
+ * The `borderRadius-input` and `borderRadius-modal` component values inherit from the `borderRadius-sm` semantic
874
+ * border radius via CSS variables.
875
+ *
876
+ * If you want to override the just the default modal border radius, you can do so
877
+ * by defining the `borderRadius-modal` token in the theme.
878
+ *
879
+ * @see {@link borderRadius} for the default token values
880
+ */
697
881
  export type BorderRadiusTokens = SemanticBorderRadius & ComponentBorderRadius;
882
+ /**
883
+ * Semantic z-index values define stacking context purposes.
884
+ *
885
+ * They describe the purpose of each layer rather than arbitrary numbers:
886
+ * - `base`: Default layer (0)
887
+ * - `raised`: Slight elevation (1)
888
+ * - `popup`: Emerges from content, like dropdowns (200)
889
+ * - `scrim`: Blocks what's beneath, like modal overlays (400)
890
+ * - `floating`: Above blocking layer, like content inside modals (500)
891
+ *
892
+ * @example
893
+ * ```tsx lines
894
+ * const theme: Partial<SemanticZIndex> = {
895
+ * "zIndex-scrim": "1000",
896
+ * "zIndex-floating": "1001",
897
+ * };
898
+ * ```
899
+ *
900
+ * @see {@link zIndexSemantic} for the default token values
901
+ * @see {@link ComponentZIndex} for the component z-index values that inherit from SemanticZIndex
902
+ */
698
903
  export type SemanticZIndex = Flattened<{
699
904
  zIndex: typeof zIndexSemantic;
700
905
  }>;
906
+ /**
907
+ * Component z-index values for individual UI components.
908
+ * They inherit from the SemanticZIndex via CSS variables.
909
+ *
910
+ * @example
911
+ * ```tsx lines
912
+ * const theme: Partial<ComponentZIndex> = {
913
+ * "zIndex-modal-overlay": "1000",
914
+ * "zIndex-modal-dialog": "1001",
915
+ * };
916
+ * ```
917
+ *
918
+ * @see {@link zIndexComponents} for the default token values
919
+ * @see {@link SemanticZIndex} for the semantic z-index values that component values inherit from
920
+ */
701
921
  export type ComponentZIndex = Flattened<{
702
922
  zIndex: typeof zIndexComponents;
703
923
  }>;
924
+ /**
925
+ * Defines all the z-index values in the theme.
926
+ *
927
+ * To change the z-index scale, override the {@link SemanticZIndex} values, and component values
928
+ * will inherit from them. For more granular control, individual {@link ComponentZIndex} can be overridden.
929
+ *
930
+ * @see {@link zIndex} for the default token values
931
+ */
704
932
  export type ZIndexTokens = SemanticZIndex & ComponentZIndex;
933
+ /**
934
+ * The theme is a flattened tokens object with values appropriate for web environments
935
+ * (i.e. CSS properties & CSS Variables).
936
+ *
937
+ * It DOES NOT include the namespace (`--cdp-web-`) in the keys.
938
+ */
705
939
  export type Theme = ColorTokens & FontTokens & BorderRadiusTokens & ZIndexTokens;
940
+ /**
941
+ * The variant of a button.
942
+ */
706
943
  export type ButtonVariant = "primary" | "secondary" | "linkPrimary" | "linkSecondary" | "transparentPrimary" | "transparentSecondary" | "control";
944
+ /**
945
+ * Base sizes for the theme.
946
+ */
707
947
  export type Size = "lg" | "md" | "sm" | "xs";
948
+ /**
949
+ * The size of a button.
950
+ */
708
951
  export type ButtonSize = Size | "none";
952
+ /**
953
+ * The size of a form input.
954
+ */
709
955
  export type InputSize = Size;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * All colors used in the CDP web component library default theme.
3
+ */
1
4
  export declare const colorsBase: {
2
5
  readonly blue500: "#0052ff";
3
6
  readonly blue550: "#014cec";
@@ -13,6 +16,15 @@ export declare const colorsBase: {
13
16
  readonly green500: "#098551";
14
17
  readonly amber500: "#ed702f";
15
18
  };
19
+ /**
20
+ * These are the default values for the semantic color tokens.
21
+ *
22
+ * Semantic colors are the base colors for the theme.
23
+ * They are typically not used directly in the components, but are used to define the base colors
24
+ * for the components.
25
+ *
26
+ * @see {@link colorsComponents} for the component colors that inherit from these
27
+ */
16
28
  export declare const colorsSemantic: {
17
29
  readonly bg: {
18
30
  readonly default: {
@@ -129,6 +141,12 @@ export declare const colorsSemantic: {
129
141
  };
130
142
  };
131
143
  };
144
+ /**
145
+ * These are the default values for the component color tokens.
146
+ *
147
+ * Component colors are the colors for the individual UI components.
148
+ * They inherit values from the {@link colorsSemantic}.
149
+ */
132
150
  export declare const colorsComponents: {
133
151
  readonly page: {
134
152
  readonly bg: {
@@ -536,6 +554,9 @@ export declare const colorsComponents: {
536
554
  };
537
555
  };
538
556
  };
557
+ /**
558
+ * All the color tokens.
559
+ */
539
560
  export declare const colors: {
540
561
  readonly page: {
541
562
  readonly bg: {
@@ -1057,6 +1078,9 @@ export declare const colors: {
1057
1078
  };
1058
1079
  };
1059
1080
  };
1081
+ /**
1082
+ * Semantic font tokens.
1083
+ */
1060
1084
  export declare const fontSemantic: {
1061
1085
  readonly family: {
1062
1086
  readonly mono: {
@@ -1078,6 +1102,9 @@ export declare const fontSemantic: {
1078
1102
  };
1079
1103
  };
1080
1104
  };
1105
+ /**
1106
+ * Component font tokens.
1107
+ */
1081
1108
  export declare const fontComponents: {
1082
1109
  readonly family: {
1083
1110
  readonly page: {
@@ -1108,6 +1135,9 @@ export declare const fontComponents: {
1108
1135
  };
1109
1136
  };
1110
1137
  };
1138
+ /**
1139
+ * All the font tokens.
1140
+ */
1111
1141
  export declare const font: {
1112
1142
  readonly family: {
1113
1143
  readonly page: {
@@ -1155,6 +1185,9 @@ export declare const font: {
1155
1185
  };
1156
1186
  };
1157
1187
  };
1188
+ /**
1189
+ * Semantic border radius tokens.
1190
+ */
1158
1191
  export declare const borderRadiusSemantic: {
1159
1192
  readonly none: {
1160
1193
  readonly value: 0;
@@ -1198,6 +1231,9 @@ export declare const borderRadiusSemantic: {
1198
1231
  readonly value: 99999;
1199
1232
  };
1200
1233
  };
1234
+ /**
1235
+ * Component border radius tokens.
1236
+ */
1201
1237
  export declare const borderRadiusComponents: {
1202
1238
  readonly badge: {
1203
1239
  readonly value: "{borderRadius.full}";
@@ -1226,6 +1262,9 @@ export declare const borderRadiusComponents: {
1226
1262
  };
1227
1263
  };
1228
1264
  };
1265
+ /**
1266
+ * All the border radius tokens.
1267
+ */
1229
1268
  export declare const borderRadius: {
1230
1269
  readonly badge: {
1231
1270
  readonly value: "{borderRadius.full}";
@@ -1295,6 +1334,9 @@ export declare const borderRadius: {
1295
1334
  readonly value: 99999;
1296
1335
  };
1297
1336
  };
1337
+ /**
1338
+ * Semantic z-index tokens.
1339
+ */
1298
1340
  export declare const zIndexSemantic: {
1299
1341
  readonly base: {
1300
1342
  readonly value: 0;
@@ -1317,6 +1359,9 @@ export declare const zIndexSemantic: {
1317
1359
  readonly unit: "none";
1318
1360
  };
1319
1361
  };
1362
+ /**
1363
+ * Component z-index tokens.
1364
+ */
1320
1365
  export declare const zIndexComponents: {
1321
1366
  readonly select: {
1322
1367
  readonly list: {
@@ -1332,6 +1377,9 @@ export declare const zIndexComponents: {
1332
1377
  };
1333
1378
  };
1334
1379
  };
1380
+ /**
1381
+ * All the z-index tokens.
1382
+ */
1335
1383
  export declare const zIndex: {
1336
1384
  readonly select: {
1337
1385
  readonly list: {
@@ -1367,6 +1415,9 @@ export declare const zIndex: {
1367
1415
  readonly unit: "none";
1368
1416
  };
1369
1417
  };
1418
+ /**
1419
+ * All the tokens used in the theme.
1420
+ */
1370
1421
  export declare const tokens: {
1371
1422
  borderRadius: {
1372
1423
  readonly badge: {
@@ -2041,4 +2092,7 @@ export declare const tokens: {
2041
2092
  };
2042
2093
  };
2043
2094
  };
2095
+ /**
2096
+ * All design tokens.
2097
+ */
2044
2098
  export type Tokens = typeof tokens;
@@ -1,14 +1,45 @@
1
+ /**
2
+ * A type that recursively converts a nested object to a flattened object with kebab-case keys.
3
+ *
4
+ * @example
5
+ * type MyObject = {
6
+ * a: {
7
+ * b: {
8
+ * cKey: string;
9
+ * };
10
+ * };
11
+ * };
12
+ *
13
+ * type Flattened = Flattened<MyObject>;
14
+ * // { 'a-b-cKey': string }
15
+ */
1
16
  export type KebabCasePaths<T> = T extends Record<string, unknown> ? {
2
17
  [K in keyof T]: T[K] extends {
3
18
  value: unknown;
4
19
  } ? K & string : T[K] extends Record<string, unknown> ? `${K & string}-${KebabCasePaths<T[K]> & string}` : K & string;
5
20
  }[keyof T] : never;
21
+ /**
22
+ * A flattened representation of the Tokens type, where keys are
23
+ * kebab-cased paths and all values are strings.
24
+ *
25
+ * @example
26
+ * const themeOverrides: Partial<Flattened<typeof tokens>> = {
27
+ * 'colors-brand-primary': string;
28
+ * 'fontFamily-sans': string;
29
+ * }
30
+ */
6
31
  export type Flattened<T extends Record<string, unknown>> = {
7
32
  [K in KebabCasePaths<T>]: string;
8
33
  };
34
+ /**
35
+ * Represents a single theme value, which can be a direct value or a reference with modifications.
36
+ */
9
37
  export type TokenValue = {
38
+ /** The value of the token. */
10
39
  value: string | number;
40
+ /** Unit for numeric values. Defaults to "px" if not specified. Use "none" for unitless values like z-index. */
11
41
  unit?: "px" | "none";
42
+ /** Modifications to the value. */
12
43
  modify?: {
13
44
  type: "color-alpha";
14
45
  value: number | string;
@@ -23,11 +54,43 @@ export type TokenValue = {
23
54
  value: number | string;
24
55
  };
25
56
  };
57
+ /**
58
+ * Represents a nested structure of theme values.
59
+ */
26
60
  export type NestedTokenObject = {
27
61
  [key: string]: TokenValue | NestedTokenObject;
28
62
  };
63
+ /**
64
+ * Flattens a nested theme object into a single-level object with CSS variable representations.
65
+ *
66
+ * @param {NestedTokenObject} tokensObject - The nested tokens object to flatten.
67
+ * @param {string} [cssVarPrefix] - An optional prefix for the generated CSS variables.
68
+ * @returns {Flattened<NestedTokenObject>} A flattened theme object.
69
+ *
70
+ * @group Utilities
71
+ */
29
72
  export declare function flattenTokensObject<T extends NestedTokenObject>(tokensObject: T, cssVarPrefix?: string): Flattened<T>;
73
+ /**
74
+ * Converts a theme object to a CSS variables object for the CDP web component library.
75
+ *
76
+ * @param theme - The theme object to convert.
77
+ * @returns A CSS variables object.
78
+ *
79
+ * @group Utilities
80
+ *
81
+ * @example
82
+ * ```tsx lines
83
+ * const themeOverrides: Partial<Theme> = {
84
+ * "color-bg-primary": "red",
85
+ * };
86
+ *
87
+ * // { "--cdp-web-color-bg-primary": "red" }
88
+ * const cssVariables = themeToCssVariables(themeOverrides);
89
+ */
30
90
  export declare const themeToCssVariables: (theme: Record<string, string>) => CDPWebCSSVariables;
91
+ /**
92
+ * CSS variables for the CDP web component library.
93
+ */
31
94
  export type CDPWebCSSVariables = {
32
95
  [key: `--cdp-web-${string}`]: string;
33
96
  };
@@ -1,4 +1,7 @@
1
1
  import { SECURE_IFRAME_EVENT_TYPE_PREFIX, SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE, SecureIframeTheme, SecureIframeAuthState, SecureIframeChainType, SecureIframeContext, SecureIframeStatus, SecureIframeEventType, SecureIframeInitMessage, SecureIframeThemeMessage, SecureIframeIncomingMessage, SecureIframeListeningMessage, SecureIframeStatusMessage, SecureIframeOutgoingMessage, SecureIframeKeyExportEventType, SecureIframeGetPrivateKeyMessage, SecureIframeKeyExportIncomingMessage, SecureIframeKeyExportOutgoingMessage } from '@coinbase/cdp-core';
2
+ /**
3
+ * The theme for the secure iframe.
4
+ */
2
5
  export type IframeTheme = SecureIframeTheme;
3
6
  export { SECURE_IFRAME_EVENT_TYPE_PREFIX, SECURE_IFRAME_KEY_EXPORT_EVENT_TYPE };
4
7
  export type { SecureIframeAuthState, SecureIframeChainType, SecureIframeContext, SecureIframeStatus, SecureIframeEventType, SecureIframeInitMessage, SecureIframeThemeMessage, SecureIframeIncomingMessage, SecureIframeListeningMessage, SecureIframeStatusMessage, SecureIframeOutgoingMessage, SecureIframeKeyExportEventType, SecureIframeGetPrivateKeyMessage, SecureIframeKeyExportIncomingMessage, SecureIframeKeyExportOutgoingMessage, };
@@ -1 +1,9 @@
1
+ /**
2
+ * Capitalizes the first letter of a string.
3
+ *
4
+ * @param value - The value to capitalize.
5
+ * @returns The capitalized value.
6
+ *
7
+ * @group Utilities
8
+ */
1
9
  export declare function capitalize(value: string): string;
@@ -1,2 +1,12 @@
1
1
  import { JSXElementConstructor, ReactNode } from 'react';
2
+ /**
3
+ * A helper function to search for a component type within children.
4
+ *
5
+ * @param {ReactNode | ReactNode[]} children - The children to search within.
6
+ * @param {string | JSXElementConstructor<any>} component - The component to search for.
7
+ * @param {number} depth - Internal parameter to track recursion depth (default: 0).
8
+ * @returns {boolean} - Whether the component is found within the children.
9
+ *
10
+ * @group Utilities
11
+ */
2
12
  export declare const childrenHasComponent: <T = unknown>(children: ReactNode | ReactNode[], component: string | JSXElementConstructor<T>, depth?: number) => boolean;
@@ -1 +1,11 @@
1
+ /**
2
+ * Clamp a value between a minimum and maximum value.
3
+ *
4
+ * @param value - The value to clamp.
5
+ * @param min - The minimum value.
6
+ * @param max - The maximum value.
7
+ * @returns The clamped value.
8
+ *
9
+ * @group Utilities
10
+ */
1
11
  export declare const clamp: (value: number, min: number, max: number) => number;
@@ -1 +1,12 @@
1
+ /**
2
+ * Format a fiat currency value.
3
+ *
4
+ * @param {number} value - The value to format.
5
+ * @param {string} currency - The currency to format the value in.
6
+ * @param {number} [decimalPlaces] - The number of decimal places to display. Defaults to 2.
7
+ * @param {string} [locale] - The locale to format the value in. Defaults to "en-US".
8
+ * @returns {string} The formatted value.
9
+ *
10
+ * @group Utilities
11
+ */
1
12
  export declare const formatFiat: (value: number, currency?: string, decimalPlaces?: number, locale?: string) => string;
@@ -1 +1,9 @@
1
+ /**
2
+ * Format a phone number.
3
+ *
4
+ * @param phoneNumber - The phone number in E.164 format, e.g. "+12345678900".
5
+ * @returns The formatted phone number (calling code + national format) or the incomplete phone number if it cannot be parsed.
6
+ *
7
+ * @group Utilities
8
+ */
1
9
  export declare const formatPhoneNumber: (phoneNumber: string) => string;
@@ -1 +1,10 @@
1
+ /**
2
+ * Get a message from an unknown error with a fallback in case one is not found.
3
+ *
4
+ * @param {unknown} error - The error to get a message from.
5
+ * @param {string} [defaultMesasge] - The default message to return if no message is found.
6
+ * @returns {string} The message from the error.
7
+ *
8
+ * @group Utilities
9
+ */
1
10
  export declare const getMessageFromUnknownError: (error: unknown, defaultMesasge?: string) => string;
@@ -1,2 +1,23 @@
1
1
  import { APIError } from '@coinbase/cdp-hooks';
2
+ /**
3
+ * Type guard to check if the error is an API error.
4
+ *
5
+ * @param {unknown} error - The error to check.
6
+ * @returns {error is ApiError} - True if the error is an API error, false otherwise.
7
+ *
8
+ * @group Utilities
9
+ *
10
+ * @example
11
+ * ```tsx lines
12
+ * try {
13
+ * ...
14
+ * }
15
+ * catch (error) {
16
+ * if (isApiError(error)) {
17
+ * // Handle API error
18
+ * console.log(error.errorMessage);
19
+ * }
20
+ * }
21
+ * ```
22
+ */
2
23
  export declare const isApiError: (error: unknown) => error is APIError;
@@ -1 +1,16 @@
1
+ /**
2
+ * Check if an email address is invalid.
3
+ *
4
+ * @param value - The email address to validate.
5
+ * @returns `true` if the email address is invalid, `false` otherwise.
6
+ *
7
+ * @group Utilities
8
+ *
9
+ * @example
10
+ * ```tsx lines
11
+ * if (isEmailInvalid("test@example")) {
12
+ * console.log("Invalid email address");
13
+ * }
14
+ * ```
15
+ */
1
16
  export declare const isEmailInvalid: (value: string) => boolean;
@@ -1,7 +1,22 @@
1
+ /**
2
+ * The parameters for the openPopup function.
3
+ */
1
4
  export type OpenPopupParams = {
2
5
  url: string;
3
6
  height: number;
4
7
  width: number;
5
8
  target?: string;
6
9
  };
10
+ /**
11
+ * Open a popup in the center of the screen with the specified size.
12
+ *
13
+ * @param {OpenPopupParams} params - The parameters for the popup.
14
+ * @param {string} params.url - The URL to open in the popup.
15
+ * @param {string} [params.target] - The target window for the popup.
16
+ * @param {number} params.height - The height of the popup.
17
+ * @param {number} params.width - The width of the popup.
18
+ * @returns {Window | null} The popup window.
19
+ *
20
+ * @group Utilities
21
+ */
7
22
  export declare const openPopup: ({ url, target, height, width }: OpenPopupParams) => Window | null;