@aws-amplify/ui 3.3.2 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/dist/esm/helpers/authenticator/actor.js +1 -0
  2. package/dist/esm/helpers/authenticator/constants.js +1 -0
  3. package/dist/esm/helpers/authenticator/context.js +1 -0
  4. package/dist/esm/helpers/authenticator/facade.js +1 -0
  5. package/dist/esm/helpers/authenticator/form.js +1 -0
  6. package/dist/esm/helpers/authenticator/formFields/defaults.js +1 -0
  7. package/dist/esm/helpers/authenticator/formFields/formFields.js +1 -0
  8. package/dist/esm/helpers/authenticator/formFields/util.js +1 -0
  9. package/dist/esm/helpers/authenticator/utils.js +1 -0
  10. package/dist/esm/i18n/country-dial-codes.js +1 -0
  11. package/dist/esm/i18n/dictionaries/authenticator/de.js +1 -0
  12. package/dist/esm/i18n/dictionaries/authenticator/defaultTexts.js +1 -0
  13. package/dist/esm/i18n/dictionaries/authenticator/en.js +1 -0
  14. package/dist/esm/i18n/dictionaries/authenticator/es.js +1 -0
  15. package/dist/esm/i18n/dictionaries/authenticator/fr.js +1 -0
  16. package/dist/esm/i18n/dictionaries/authenticator/id.js +1 -0
  17. package/dist/esm/i18n/dictionaries/authenticator/it.js +1 -0
  18. package/dist/esm/i18n/dictionaries/authenticator/ja.js +1 -0
  19. package/dist/esm/i18n/dictionaries/authenticator/kr.js +1 -0
  20. package/dist/esm/i18n/dictionaries/authenticator/nl.js +1 -0
  21. package/dist/esm/i18n/dictionaries/authenticator/pl.js +1 -0
  22. package/dist/esm/i18n/dictionaries/authenticator/pt.js +1 -0
  23. package/dist/esm/i18n/dictionaries/authenticator/sv.js +1 -0
  24. package/dist/esm/i18n/dictionaries/authenticator/tr.js +1 -0
  25. package/dist/esm/i18n/dictionaries/authenticator/zh.js +1 -0
  26. package/dist/esm/i18n/dictionaries/index.js +1 -0
  27. package/dist/esm/i18n/translations.js +1 -0
  28. package/dist/esm/index.js +1 -37
  29. package/dist/esm/machines/authenticator/actions.js +1 -0
  30. package/dist/esm/machines/authenticator/actors/resetPassword.js +1 -0
  31. package/dist/esm/machines/authenticator/actors/signIn.js +1 -0
  32. package/dist/esm/machines/authenticator/actors/signOut.js +1 -0
  33. package/dist/esm/machines/authenticator/defaultServices.js +1 -0
  34. package/dist/esm/machines/authenticator/index.js +1 -0
  35. package/dist/esm/machines/authenticator/signUp.js +1 -0
  36. package/dist/esm/node_modules/tslib/tslib.es6.js +15 -0
  37. package/dist/esm/theme/baseTheme.js +1 -0
  38. package/dist/esm/theme/breakpoints.js +1 -0
  39. package/dist/esm/theme/createTheme.js +1 -0
  40. package/dist/esm/theme/index.js +1 -0
  41. package/dist/esm/theme/tokens/borderWidths.js +1 -0
  42. package/dist/esm/theme/tokens/colors.js +1 -0
  43. package/dist/esm/theme/tokens/components/alert.js +1 -0
  44. package/dist/esm/theme/tokens/components/authenticator.js +1 -0
  45. package/dist/esm/theme/tokens/components/badge.js +1 -0
  46. package/dist/esm/theme/tokens/components/button.js +1 -0
  47. package/dist/esm/theme/tokens/components/card.js +1 -0
  48. package/dist/esm/theme/tokens/components/checkbox.js +1 -0
  49. package/dist/esm/theme/tokens/components/checkboxField.js +1 -0
  50. package/dist/esm/theme/tokens/components/copy.js +1 -0
  51. package/dist/esm/theme/tokens/components/countryCodeSelect.js +1 -0
  52. package/dist/esm/theme/tokens/components/divider.js +1 -0
  53. package/dist/esm/theme/tokens/components/expander.js +1 -0
  54. package/dist/esm/theme/tokens/components/field.js +1 -0
  55. package/dist/esm/theme/tokens/components/fieldControl.js +1 -0
  56. package/dist/esm/theme/tokens/components/fieldGroup.js +1 -0
  57. package/dist/esm/theme/tokens/components/fieldMessages.js +1 -0
  58. package/dist/esm/theme/tokens/components/flex.js +1 -0
  59. package/dist/esm/theme/tokens/components/heading.js +1 -0
  60. package/dist/esm/theme/tokens/components/icon.js +1 -0
  61. package/dist/esm/theme/tokens/components/image.js +1 -0
  62. package/dist/esm/theme/tokens/components/index.js +1 -0
  63. package/dist/esm/theme/tokens/components/link.js +1 -0
  64. package/dist/esm/theme/tokens/components/loader.js +1 -0
  65. package/dist/esm/theme/tokens/components/menu.js +1 -0
  66. package/dist/esm/theme/tokens/components/pagination.js +1 -0
  67. package/dist/esm/theme/tokens/components/phoneNumberField.js +1 -0
  68. package/dist/esm/theme/tokens/components/placeholder.js +1 -0
  69. package/dist/esm/theme/tokens/components/radio.js +1 -0
  70. package/dist/esm/theme/tokens/components/rating.js +1 -0
  71. package/dist/esm/theme/tokens/components/select.js +1 -0
  72. package/dist/esm/theme/tokens/components/selectField.js +1 -0
  73. package/dist/esm/theme/tokens/components/sliderField.js +1 -0
  74. package/dist/esm/theme/tokens/components/stepperField.js +1 -0
  75. package/dist/esm/theme/tokens/components/switchField.js +1 -0
  76. package/dist/esm/theme/tokens/components/table.js +1 -0
  77. package/dist/esm/theme/tokens/components/tabs.js +1 -0
  78. package/dist/esm/theme/tokens/components/text.js +1 -0
  79. package/dist/esm/theme/tokens/components/toggleButton.js +1 -0
  80. package/dist/esm/theme/tokens/components/toggleButtonGroup.js +1 -0
  81. package/dist/esm/theme/tokens/fontSizes.js +1 -0
  82. package/dist/esm/theme/tokens/fontWeights.js +1 -0
  83. package/dist/esm/theme/tokens/fonts.js +1 -0
  84. package/dist/esm/theme/tokens/index.js +1 -0
  85. package/dist/esm/theme/tokens/lineHeights.js +1 -0
  86. package/dist/esm/theme/tokens/opacities.js +1 -0
  87. package/dist/esm/theme/tokens/outlineOffsets.js +1 -0
  88. package/dist/esm/theme/tokens/outlineWidths.js +1 -0
  89. package/dist/esm/theme/tokens/radii.js +1 -0
  90. package/dist/esm/theme/tokens/shadows.js +1 -0
  91. package/dist/esm/theme/tokens/space.js +1 -0
  92. package/dist/esm/theme/tokens/time.js +1 -0
  93. package/dist/esm/theme/tokens/transforms.js +1 -0
  94. package/dist/esm/theme/tokens/types/designToken.js +1 -0
  95. package/dist/esm/theme/utils.js +1 -0
  96. package/dist/esm/types/authenticator/attributes.js +1 -0
  97. package/dist/esm/types/authenticator/user.js +1 -0
  98. package/dist/esm/validators/index.js +1 -0
  99. package/dist/index.js +16 -37
  100. package/dist/styles.css +18 -6
  101. package/dist/theme.css +1 -1
  102. package/dist/types/helpers/authenticator/actor.d.ts +15 -0
  103. package/dist/types/helpers/authenticator/constants.d.ts +5 -0
  104. package/dist/types/helpers/authenticator/context.d.ts +10 -0
  105. package/dist/types/helpers/authenticator/facade.d.ts +66 -0
  106. package/dist/types/helpers/authenticator/form.d.ts +7 -0
  107. package/dist/types/helpers/authenticator/formFields/defaults.d.ts +3 -0
  108. package/dist/types/helpers/authenticator/formFields/formFields.d.ts +11 -0
  109. package/dist/types/helpers/authenticator/formFields/index.d.ts +3 -0
  110. package/dist/types/helpers/authenticator/formFields/util.d.ts +7 -0
  111. package/dist/types/helpers/authenticator/index.d.ts +7 -0
  112. package/dist/types/helpers/authenticator/utils.d.ts +16 -0
  113. package/dist/types/helpers/index.d.ts +1 -0
  114. package/dist/types/i18n/country-dial-codes.d.ts +1 -0
  115. package/dist/types/i18n/dictionaries/authenticator/de.d.ts +56 -0
  116. package/dist/types/i18n/dictionaries/authenticator/defaultTexts.d.ts +58 -0
  117. package/dist/types/i18n/dictionaries/authenticator/en.d.ts +50 -0
  118. package/dist/types/i18n/dictionaries/authenticator/es.d.ts +55 -0
  119. package/dist/types/i18n/dictionaries/authenticator/fr.d.ts +65 -0
  120. package/dist/types/i18n/dictionaries/authenticator/id.d.ts +78 -0
  121. package/dist/types/i18n/dictionaries/authenticator/index.d.ts +15 -0
  122. package/dist/types/i18n/dictionaries/authenticator/it.d.ts +49 -0
  123. package/dist/types/i18n/dictionaries/authenticator/ja.d.ts +52 -0
  124. package/dist/types/i18n/dictionaries/authenticator/kr.d.ts +56 -0
  125. package/dist/types/i18n/dictionaries/authenticator/nl.d.ts +50 -0
  126. package/dist/types/i18n/dictionaries/authenticator/pl.d.ts +57 -0
  127. package/dist/types/i18n/dictionaries/authenticator/pt.d.ts +50 -0
  128. package/dist/types/i18n/dictionaries/authenticator/sv.d.ts +51 -0
  129. package/dist/types/i18n/dictionaries/authenticator/tr.d.ts +65 -0
  130. package/dist/types/i18n/dictionaries/authenticator/zh.d.ts +32 -0
  131. package/dist/types/i18n/dictionaries/index.d.ts +824 -0
  132. package/dist/types/i18n/index.d.ts +2 -0
  133. package/dist/types/i18n/translations.d.ts +93 -0
  134. package/dist/types/index.d.ts +5 -0
  135. package/dist/types/machines/authenticator/actions.d.ts +60 -0
  136. package/dist/types/machines/authenticator/actors/index.d.ts +3 -0
  137. package/dist/types/machines/authenticator/actors/resetPassword.d.ts +29 -0
  138. package/dist/types/machines/authenticator/actors/signIn.d.ts +29 -0
  139. package/dist/types/machines/authenticator/actors/signOut.d.ts +25 -0
  140. package/dist/types/machines/authenticator/defaultServices.d.ts +29 -0
  141. package/dist/types/machines/authenticator/index.d.ts +28 -0
  142. package/dist/types/machines/authenticator/signUp.d.ts +29 -0
  143. package/dist/types/machines/index.d.ts +1 -0
  144. package/dist/types/theme/baseTheme.d.ts +2 -0
  145. package/dist/types/theme/breakpoints.d.ts +12 -0
  146. package/dist/types/theme/createTheme.d.ts +9 -0
  147. package/dist/types/theme/index.d.ts +4 -0
  148. package/dist/types/theme/tokens/borderWidths.d.ts +19 -0
  149. package/dist/types/theme/tokens/colors.d.ts +76 -0
  150. package/dist/types/theme/tokens/components/alert.d.ts +65 -0
  151. package/dist/types/theme/tokens/components/authenticator.d.ts +71 -0
  152. package/dist/types/theme/tokens/components/badge.d.ts +83 -0
  153. package/dist/types/theme/tokens/components/button.d.ts +328 -0
  154. package/dist/types/theme/tokens/components/card.d.ts +63 -0
  155. package/dist/types/theme/tokens/components/checkbox.d.ts +140 -0
  156. package/dist/types/theme/tokens/components/checkboxField.d.ts +14 -0
  157. package/dist/types/theme/tokens/components/copy.d.ts +26 -0
  158. package/dist/types/theme/tokens/components/countryCodeSelect.d.ts +5 -0
  159. package/dist/types/theme/tokens/components/divider.d.ts +38 -0
  160. package/dist/types/theme/tokens/components/expander.d.ts +135 -0
  161. package/dist/types/theme/tokens/components/field.d.ts +29 -0
  162. package/dist/types/theme/tokens/components/fieldControl.d.ts +174 -0
  163. package/dist/types/theme/tokens/components/fieldGroup.d.ts +15 -0
  164. package/dist/types/theme/tokens/components/fieldMessages.d.ts +21 -0
  165. package/dist/types/theme/tokens/components/flex.d.ts +17 -0
  166. package/dist/types/theme/tokens/components/heading.d.ts +56 -0
  167. package/dist/types/theme/tokens/components/icon.d.ts +8 -0
  168. package/dist/types/theme/tokens/components/image.d.ts +14 -0
  169. package/dist/types/theme/tokens/components/index.d.ts +2479 -0
  170. package/dist/types/theme/tokens/components/link.d.ts +35 -0
  171. package/dist/types/theme/tokens/components/loader.d.ts +78 -0
  172. package/dist/types/theme/tokens/components/menu.d.ts +59 -0
  173. package/dist/types/theme/tokens/components/pagination.d.ts +82 -0
  174. package/dist/types/theme/tokens/components/phoneNumberField.d.ts +1 -0
  175. package/dist/types/theme/tokens/components/placeholder.d.ts +29 -0
  176. package/dist/types/theme/tokens/components/radio.d.ts +131 -0
  177. package/dist/types/theme/tokens/components/rating.d.ts +27 -0
  178. package/dist/types/theme/tokens/components/select.d.ts +60 -0
  179. package/dist/types/theme/tokens/components/selectField.d.ts +5 -0
  180. package/dist/types/theme/tokens/components/sliderField.d.ts +118 -0
  181. package/dist/types/theme/tokens/components/stepperField.d.ts +10 -0
  182. package/dist/types/theme/tokens/components/switchField.d.ts +78 -0
  183. package/dist/types/theme/tokens/components/table.d.ts +197 -0
  184. package/dist/types/theme/tokens/components/tabs.d.ts +84 -0
  185. package/dist/types/theme/tokens/components/text.d.ts +40 -0
  186. package/dist/types/theme/tokens/components/toggleButton.d.ts +154 -0
  187. package/dist/types/theme/tokens/components/toggleButtonGroup.d.ts +11 -0
  188. package/dist/types/theme/tokens/fontSizes.d.ts +17 -0
  189. package/dist/types/theme/tokens/fontWeights.d.ts +16 -0
  190. package/dist/types/theme/tokens/fonts.d.ts +13 -0
  191. package/dist/types/theme/tokens/index.d.ts +52 -0
  192. package/dist/types/theme/tokens/lineHeights.d.ts +10 -0
  193. package/dist/types/theme/tokens/opacities.d.ts +18 -0
  194. package/dist/types/theme/tokens/outlineOffsets.d.ts +10 -0
  195. package/dist/types/theme/tokens/outlineWidths.d.ts +10 -0
  196. package/dist/types/theme/tokens/radii.d.ts +14 -0
  197. package/dist/types/theme/tokens/shadows.d.ts +10 -0
  198. package/dist/types/theme/tokens/space.d.ts +27 -0
  199. package/dist/types/theme/tokens/time.d.ts +10 -0
  200. package/dist/types/theme/tokens/transforms.d.ts +14 -0
  201. package/dist/types/theme/tokens/types/designToken.d.ts +56 -0
  202. package/dist/types/theme/tokens/types/scales.d.ts +12 -0
  203. package/dist/types/theme/types.d.ts +110 -0
  204. package/dist/types/theme/utils.d.ts +8 -0
  205. package/dist/types/types/authenticator/attributes.d.ts +21 -0
  206. package/dist/types/types/authenticator/form.d.ts +61 -0
  207. package/dist/types/types/authenticator/index.d.ts +5 -0
  208. package/dist/types/types/authenticator/stateMachine/authMachine.d.ts +15 -0
  209. package/dist/types/types/authenticator/stateMachine/context.d.ts +101 -0
  210. package/dist/types/types/authenticator/stateMachine/event.d.ts +17 -0
  211. package/dist/types/types/authenticator/stateMachine/index.d.ts +4 -0
  212. package/dist/types/types/authenticator/stateMachine/state.d.ts +10 -0
  213. package/dist/types/types/authenticator/user.d.ts +29 -0
  214. package/dist/types/types/authenticator/validator.d.ts +17 -0
  215. package/dist/types/types/index.d.ts +2 -0
  216. package/dist/types/types/util.d.ts +1 -0
  217. package/dist/types/validators/index.d.ts +2 -0
  218. package/package.json +11 -5
  219. package/dist/esm/index.js.map +0 -1
  220. package/dist/index.d.ts +0 -1044
  221. package/dist/index.js.map +0 -1
package/dist/index.d.ts DELETED
@@ -1,1044 +0,0 @@
1
- import * as amazon_cognito_identity_js from 'amazon-cognito-identity-js';
2
- import { CognitoUser, CodeDeliveryDetails } from 'amazon-cognito-identity-js';
3
- import * as xstate from 'xstate';
4
- import { Interpreter, State, Sender } from 'xstate';
5
- import { PartialDeep } from 'type-fest';
6
-
7
- /** Array of auth fields that we supply defaults with */
8
- declare const signUpFieldsWithDefault: readonly ["birthdate", "email", "family_name", "given_name", "middle_name", "name", "nickname", "phone_number", "preferred_username", "profile", "website"];
9
- /** Auth fields that we supply defaults with */
10
- declare type SignUpFieldsWithDefaults = typeof signUpFieldsWithDefault[number];
11
- /** Array of auth fields that we do not supply defaults with */
12
- declare const signUpFieldsWithoutDefault: readonly ["address", "gender", "locale", "picture", "updated_at", "zoneinfo"];
13
- /** Auth fields that we do not supply defaults with */
14
- declare type SignUpFieldsWithoutDefaults = typeof signUpFieldsWithoutDefault[number];
15
- /** All known auth fields */
16
- declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDefaults;
17
- /** Fields that are common in all routes */
18
- declare type CommonFields = 'username' | 'password' | 'confirm_password';
19
- /** Array of known login mechanisms */
20
- declare const LoginMechanismArray: readonly ["username", "email", "phone_number"];
21
- /** Login mechanisms that can be used to sign in */
22
- declare type LoginMechanism = typeof LoginMechanismArray[number];
23
- /** List of social provider Authenticator supports */
24
- declare type SocialProvider = 'amazon' | 'apple' | 'facebook' | 'google';
25
- declare const authFieldsWithDefaults: readonly ["username", "email", "phone_number", "birthdate", "email", "family_name", "given_name", "middle_name", "name", "nickname", "phone_number", "preferred_username", "profile", "website", "confirmation_code", "password", "confirm_password"];
26
- /** Input fields that we provide default fields with */
27
- declare type AuthFieldsWithDefaults = typeof authFieldsWithDefaults[number];
28
-
29
- /**
30
- * Map of each input name to its value
31
- */
32
- declare type AuthFormData = Record<string, string>;
33
- /**
34
- * List of routes that support custom formFields
35
- */
36
- declare type FormFieldComponents = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP';
37
- /**
38
- * Used to customize form field attributes for each authenticator screen.
39
- */
40
- declare type AuthFormFields = {
41
- [key in FormFieldComponents]?: FormFields;
42
- };
43
- /**
44
- * Override option for each screen. Maps each input to override options.
45
- */
46
- interface FormFields {
47
- [field_name: string]: FormFieldOptions;
48
- }
49
- /**
50
- * Override options for each field
51
- */
52
- interface FormFieldOptions {
53
- /** Will hide the label above the input if set to true */
54
- labelHidden?: boolean;
55
- /** Label text */
56
- label?: string;
57
- /** Placeholder text */
58
- placeholder?: string;
59
- /**
60
- * @deprecated For internal use only, please use `isRequired` instead.
61
- */
62
- required?: boolean;
63
- /** Whether this field is required for submission */
64
- isRequired?: boolean;
65
- /** Default dial code value */
66
- dialCode?: string;
67
- /** TOTP issuer to be used in the QR setup */
68
- totpIssuer?: string;
69
- /** TOTP username to be used in the QR */
70
- totpUsername?: string;
71
- /** List of dial codes you want to show in phone number field */
72
- dialCodeList?: Array<string>;
73
- /** Integer that denotes where this field should be positioned in. */
74
- order?: number;
75
- /** Desired HTML input type */
76
- type?: string;
77
- /** Desired autocomplete HTML attribute */
78
- autocomplete?: string;
79
- }
80
- /** Default formField values for each supported auth field */
81
- declare type DefaultFormFieldOptions = Record<AuthFieldsWithDefaults, FormFieldOptions>;
82
- /** Ordered list of formFields */
83
- declare type FormFieldsArray = Array<[string, FormFieldOptions]>;
84
- declare type PasswordPolicyRules = 'REQUIRES_LOWERCASE' | 'REQUIRES_NUMBERS' | 'REQUIRES_SYMBOLS' | 'REQUIRES_UPPERCASE';
85
- interface PasswordSettings {
86
- passwordPolicyMinLength: number;
87
- passwordPolicyCharacters: Array<PasswordPolicyRules>;
88
- }
89
-
90
- /** Enum of known challenge names */
91
- declare enum AuthChallengeNames {
92
- SMS_MFA = "SMS_MFA",
93
- SOFTWARE_TOKEN_MFA = "SOFTWARE_TOKEN_MFA",
94
- NEW_PASSWORD_REQUIRED = "NEW_PASSWORD_REQUIRED",
95
- RESET_REQUIRED = "RESET_REQUIRED",
96
- MFA_SETUP = "MFA_SETUP"
97
- }
98
- /** Contact destinations that we can send user confirmation code to */
99
- declare type ContactMethod = 'Email' | 'Phone Number';
100
- /** Federated IDPs that Authenticator supports */
101
- declare enum FederatedIdentityProviders {
102
- Apple = "SignInWithApple",
103
- Amazon = "LoginWithAmazon",
104
- Facebook = "Facebook",
105
- Google = "Google"
106
- }
107
- /** Known cognito user attributes */
108
- interface CognitoAttributes {
109
- email: string;
110
- phone_number: string;
111
- [key: string]: string;
112
- }
113
- /** Cognito User Interface */
114
- interface CognitoUserAmplify extends CognitoUser {
115
- username?: string;
116
- attributes?: CognitoAttributes;
117
- }
118
-
119
- /**
120
- * Maps each input to its validation error, if any
121
- */
122
- declare type ValidationError = Record<string, string | string[]>;
123
- /**
124
- * Return type of validator. This is `null` if there are no error, and `ValidationError` otherwise.
125
- */
126
- declare type ValidatorResult = void | null | ValidationError;
127
- declare type SignInResult = string;
128
- /**
129
- * Validates the given formData. This can be synchronous or asynchronous.
130
- */
131
- declare type Validator = (formData: AuthFormData, touchData?: AuthFormData, passwordSettings?: PasswordSettings) => ValidatorResult | Promise<ValidatorResult>;
132
- declare type SignInTypes = (user: string, code: string, mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA) => SignInResult | Promise<SignInResult>;
133
-
134
- declare const defaultServices: {
135
- getAmplifyConfig(): Promise<{}>;
136
- getCurrentUser(): Promise<any>;
137
- handleSignUp(formData: any): Promise<any>;
138
- handleSignIn({ username, password, }: {
139
- username: string;
140
- password: string;
141
- }): Promise<any>;
142
- handleConfirmSignIn({ user, code, mfaType, }: {
143
- user: any;
144
- code: string;
145
- mfaType: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
146
- }): Promise<any>;
147
- handleConfirmSignUp({ username, code, }: {
148
- username: string;
149
- code: string;
150
- }): Promise<any>;
151
- handleForgotPasswordSubmit({ username, code, password, }: {
152
- username: string;
153
- code: string;
154
- password: string;
155
- }): Promise<SignInResult>;
156
- handleForgotPassword(formData: any): Promise<any>;
157
- validateCustomSignUp(formData: any, touchData: any): Promise<ValidatorResult>;
158
- validateFormPassword<Validator>(formData: any, touchData: any, passwordSettings: PasswordSettings): Promise<ValidatorResult>;
159
- validateConfirmPassword<Validator_1>(formData: any, touchData: any): Promise<ValidatorResult>;
160
- validatePreferredUsername(formData: any, touchData: any): Promise<ValidatorResult>;
161
- };
162
-
163
- /**
164
- * Data that actor returns when they are done and reach the final state
165
- */
166
- interface ActorDoneData {
167
- /** Any auth form values that needs to be persisted between the actors */
168
- authAttributes?: AuthFormData;
169
- /** String that indicates where authMachine should next transition to */
170
- intent?: string;
171
- /** User returned by the actor it's done */
172
- user?: CognitoUserAmplify;
173
- }
174
- /**
175
- * Context interface for the top-level machine
176
- */
177
- interface AuthContext {
178
- /** Reference to the spawned actor */
179
- actorRef?: any;
180
- config?: {
181
- loginMechanisms?: LoginMechanism[];
182
- signUpAttributes?: SignUpAttribute[];
183
- socialProviders?: SocialProvider[];
184
- formFields?: AuthFormFields;
185
- initialState?: 'signIn' | 'signUp' | 'resetPassword';
186
- passwordSettings?: PasswordSettings;
187
- };
188
- services?: Partial<typeof defaultServices>;
189
- user?: CognitoUserAmplify;
190
- username?: string;
191
- password?: string;
192
- code?: string;
193
- mfaType?: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
194
- actorDoneData?: Omit<ActorDoneData, 'user'>;
195
- }
196
- /**
197
- * Base context for all actors that have auth forms associated
198
- */
199
- interface BaseFormContext {
200
- /** Any user attributes set that needs to persist between states */
201
- authAttributes?: Record<string, any>;
202
- /** Current challengeName issued by Cognnito */
203
- challengeName?: string;
204
- /** Required attributes for form submission */
205
- requiredAttributes?: Array<string>;
206
- /** Maps each input name to tis value */
207
- formValues?: AuthFormData;
208
- /** Input (names) that has been blurred at least ones */
209
- touched?: AuthFormData;
210
- /** String that indicates where authMachine should next transition to */
211
- intent?: string;
212
- /** Error returned from remote service / API */
213
- remoteError?: string;
214
- /** Current user inteface the actor is working with */
215
- user?: CognitoUserAmplify;
216
- /** Maps each input to its validation error, if any */
217
- validationError?: ValidationError;
218
- /** Maps each password validation rule */
219
- passwordSettings?: PasswordSettings;
220
- /** Denotes where a confirmation code has been sent to */
221
- codeDeliveryDetails?: CodeDeliveryDetails;
222
- /** Default country code for all phone number fields. */
223
- country_code?: string;
224
- }
225
- interface SignInContext extends BaseFormContext {
226
- loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
227
- socialProviders: Required<AuthContext>['config']['socialProviders'];
228
- formFields?: AuthFormFields;
229
- attributeToVerify?: string;
230
- redirectIntent?: string;
231
- unverifiedAttributes?: Record<string, string>;
232
- }
233
- interface SignUpContext extends BaseFormContext {
234
- loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
235
- socialProviders: Required<AuthContext>['config']['socialProviders'];
236
- formFields: AuthFormFields;
237
- unverifiedAttributes?: Record<string, string>;
238
- }
239
- interface ResetPasswordContext extends BaseFormContext {
240
- username?: string;
241
- unverifiedAttributes?: Record<string, string>;
242
- formFields?: AuthFormFields;
243
- }
244
- interface SignOutContext {
245
- authAttributes?: Record<string, any>;
246
- challengeName?: string;
247
- unverifiedAttributes?: Record<string, string>;
248
- user?: CognitoUserAmplify;
249
- formFields?: AuthFormFields;
250
- }
251
- /**
252
- * Context for actors that have forms
253
- */
254
- declare type ActorContextWithForms = SignInContext | SignUpContext | ResetPasswordContext;
255
- declare type AuthActorContext = ActorContextWithForms | SignOutContext;
256
-
257
- /**
258
- * Events that occur when actors are done
259
- */
260
- declare type InvokeActorEventTypes = 'done.invoke.signInActor' | 'done.invoke.signUpActor' | 'done.invoke.signOutActor' | 'done.invoke.resetPasswordActor';
261
- /**
262
- * All known explicit events for xstate
263
- */
264
- declare type AuthEventTypes = 'CHANGE' | 'BLUR' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | 'INIT' | InvokeActorEventTypes;
265
- /**
266
- * Data payload for auth events
267
- */
268
- declare type AuthEventData = Record<PropertyKey, any>;
269
- /** Top-level auth machine event interface */
270
- interface AuthEvent {
271
- type: AuthEventTypes;
272
- data?: AuthEventData;
273
- }
274
-
275
- /**
276
- * This files provides types that describe general shape of
277
- * authenticator machine and its intepreter.
278
- */
279
-
280
- /**
281
- * Intefrace for `authMachine` machine interpreter
282
- */
283
- declare type AuthInterpreter = Interpreter<AuthContext, any, AuthEvent>;
284
- /**
285
- * Function type for `send` in `authMachine`
286
- */
287
- declare type AuthMachineSend = AuthInterpreter['send'];
288
-
289
- declare type SignInState = State<SignInContext, AuthEvent>;
290
- declare type SignUpState = State<SignUpContext, AuthEvent>;
291
- declare type SignOutState = State<SignOutContext, AuthEvent>;
292
- declare type ResetPasswordState = State<ResetPasswordContext, AuthEvent>;
293
- declare type AuthActorState = State<AuthActorContext, AuthEvent>;
294
- declare type AuthMachineState = State<AuthContext, AuthEvent>;
295
-
296
- declare type NoInfer<T> = [T][T extends any ? 0 : never];
297
-
298
- /**
299
- * This file contains helpers that lets you easily access current actor's state
300
- * and context.
301
- */
302
-
303
- /**
304
- * Get the state of current actor. This is useful for checking which screen
305
- * to render: e.g. `getActorState(state).matches('confirmSignUp.edit').
306
- */
307
- declare const getActorState: (state: AuthMachineState) => AuthActorState;
308
- /**
309
- * Get the context of current actor. Useful for getting any nested context
310
- * like remoteError.
311
- */
312
- declare const getActorContext: (state: AuthMachineState) => AuthActorContext;
313
-
314
- declare const getPrimaryAlias: (state: AuthMachineState) => "email" | "phone_number" | "username";
315
- /**
316
- * Given xstate context from AuthMachine, returns the primaryAlias and
317
- * secondaryAliases.
318
- */
319
- declare const getConfiguredAliases: (context: AuthContext) => {
320
- primaryAlias: "email" | "phone_number" | "username";
321
- secondaryAliases: ("email" | "phone_number" | "username")[];
322
- };
323
-
324
- /**
325
- * Creates public facing auth helpers that abstracts out xstate implementation
326
- * detail. Each framework implementation can export these helpers so that
327
- * developers can send events without having to learn internals.
328
- *
329
- * ```
330
- * const [state, send] = useActor(...);
331
- * const { submit } = getSendEventAliases(send);
332
- * submit({ username, password})
333
- * ```
334
- */
335
- declare const getSendEventAliases: (send: Sender<AuthEvent>) => {
336
- readonly resendCode: (data?: AuthEventData) => void;
337
- readonly signOut: (data?: AuthEventData) => void;
338
- readonly submitForm: (data?: AuthEventData) => void;
339
- readonly updateForm: (data?: AuthEventData) => void;
340
- readonly updateBlur: (data?: AuthEventData) => void;
341
- readonly toFederatedSignIn: (data?: AuthEventData) => void;
342
- readonly toResetPassword: (data?: AuthEventData) => void;
343
- readonly toSignIn: (data?: AuthEventData) => void;
344
- readonly toSignUp: (data?: AuthEventData) => void;
345
- readonly skipVerification: (data?: AuthEventData) => void;
346
- };
347
- declare const getServiceContextFacade: (state: AuthMachineState) => {
348
- error: string;
349
- hasValidationErrors: boolean;
350
- isPending: boolean;
351
- route: string;
352
- user: CognitoUserAmplify;
353
- validationErrors: {
354
- [x: string]: string | string[];
355
- };
356
- codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
357
- };
358
- declare const getServiceFacade: ({ send, state }: {
359
- send: any;
360
- state: any;
361
- }) => {
362
- error: string;
363
- hasValidationErrors: boolean;
364
- isPending: boolean;
365
- route: string;
366
- user: CognitoUserAmplify;
367
- validationErrors: {
368
- [x: string]: string | string[];
369
- };
370
- codeDeliveryDetails: amazon_cognito_identity_js.CodeDeliveryDetails;
371
- resendCode: (data?: AuthEventData) => void;
372
- signOut: (data?: AuthEventData) => void;
373
- submitForm: (data?: AuthEventData) => void;
374
- updateForm: (data?: AuthEventData) => void;
375
- updateBlur: (data?: AuthEventData) => void;
376
- toFederatedSignIn: (data?: AuthEventData) => void;
377
- toResetPassword: (data?: AuthEventData) => void;
378
- toSignIn: (data?: AuthEventData) => void;
379
- toSignUp: (data?: AuthEventData) => void;
380
- skipVerification: (data?: AuthEventData) => void;
381
- };
382
-
383
- /**
384
- * This file contains helpers related to forms and input attributes.
385
- */
386
-
387
- declare const defaultFormFieldOptions: DefaultFormFieldOptions;
388
-
389
- declare const getFormDataFromEvent: (event: Event) => {
390
- [k: string]: FormDataEntryValue;
391
- };
392
- declare const setFormOrder: (formOverrides: FormFields, fieldNames: Array<SignUpAttribute | CommonFields>) => Array<string | number>;
393
- declare const isAuthFieldWithDefaults: (field: string) => field is "birthdate" | "email" | "family_name" | "given_name" | "middle_name" | "name" | "nickname" | "phone_number" | "preferred_username" | "profile" | "website" | "username" | "password" | "confirm_password" | "confirmation_code";
394
- declare const getErrors: (errors: string | string[]) => string[];
395
-
396
- /**
397
- * This file contains general helpers that state machine or authenticator
398
- * implementations can use.
399
- */
400
-
401
- declare const censorAllButFirstAndLast: (value: string) => string;
402
- declare const censorPhoneNumber: (val: string) => string;
403
- /**
404
- * Listens to external auth Hub events and sends corresponding event to
405
- * the `authService` of interest
406
- *
407
- * @param send - `send` function associated with the `authService` of interest
408
- *
409
- * @returns function that unsubscribes to the hub evenmt
410
- */
411
- declare const listenToAuthHub: (send: AuthMachineSend) => () => void;
412
-
413
- /**
414
- * This file contains helpers that generate default form fields, given the
415
- * current Authenticator / Zero Config configuration.
416
- */
417
-
418
- /** Gets the default formFields for given route/route */
419
- declare const getDefaultFormFields: (route: FormFieldComponents, state: AuthMachineState) => FormFields;
420
- /** Gets default formFields, then merges custom formFields into it */
421
- declare const getFormFields: (route: FormFieldComponents, state: AuthMachineState) => FormFields;
422
- /** Calls `getFormFields` above, then sorts it into an indexed array */
423
- declare const getSortedFormFields: (route: FormFieldComponents, state: AuthMachineState) => FormFieldsArray;
424
-
425
- /** Collect all the defaultFormFields getters */
426
- declare const defaultFormFieldsGetters: Record<FormFieldComponents, (state: AuthMachineState) => FormFields>;
427
-
428
- /** Applies translations to label and placeholder */
429
- declare const applyTranslation: (formFields: FormFields) => FormFields;
430
- /** Sorts formFields according to their `order`. */
431
- declare const sortFormFields: (formFields: FormFields) => FormFieldsArray;
432
- /** Applies defaultFormFields value into customFormFields */
433
- declare const applyDefaults: (defaultFormFields: FormFields, customFormFields?: FormFields) => FormFields;
434
-
435
- declare const countryDialCodes: string[];
436
-
437
- /**
438
- * Contains translatable strings that authenticator provides by default. Customers
439
- * can use this to add custom vocabularies:
440
- *
441
- * ```
442
- * I18n.putVocabulariesForLanguage("en", {
443
- * [DefaultTexts.SIGN_IN]: "Custom Sign In Text",
444
- * [DefaultTexts.SIGN_IN_BUTTON]: "Custom Click Here to Sign In"
445
- * });
446
- * ```
447
- */
448
- declare const DefaultTexts: {
449
- readonly BACK_SIGN_IN: string;
450
- readonly BIRTHDATE: string;
451
- readonly CHANGE_PASSWORD: string;
452
- readonly CHANGING_PASSWORD: string;
453
- readonly CODE: string;
454
- readonly CONFIRM_PASSWORD: string;
455
- readonly CONFIRM_RESET_PASSWORD_HEADING: string;
456
- readonly CONFIRM_SIGNUP_HEADING: string;
457
- readonly CONFIRM_SMS: string;
458
- readonly CONFIRM_TOTP: string;
459
- readonly CONFIRM: string;
460
- readonly CONFIRMATION_CODE: string;
461
- readonly CONFIRMING: string;
462
- readonly CREATE_ACCOUNT: string;
463
- readonly CREATING_ACCOUNT: string;
464
- readonly EMAIL_ADDRESS: string;
465
- readonly ENTER_CODE: string;
466
- readonly ENTER_USERNAME: string;
467
- readonly FAMILY_NAME: string;
468
- readonly GIVEN_NAME: string;
469
- readonly FORGOT_YOUR_PASSWORD: string;
470
- readonly FORGOT_YOUR_PASSWORD_LEGACY: string;
471
- readonly HIDE_PASSWORD: string;
472
- readonly LOADING: string;
473
- readonly LOGIN_NAME: string;
474
- readonly MIDDLE_NAME: string;
475
- readonly NAME: string;
476
- readonly NICKNAME: string;
477
- readonly NEW_PASSWORD: string;
478
- readonly PASSWORD: string;
479
- readonly PHONE_NUMBER: string;
480
- readonly PREFERRED_USERNAME: string;
481
- readonly PROFILE: string;
482
- readonly RESEND_CODE: string;
483
- readonly RESET_PASSWORD_HEADING: string;
484
- readonly RESET_PASSWORD: string;
485
- readonly SEND_CODE: string;
486
- readonly SENDING: string;
487
- readonly SETUP_TOTP: string;
488
- readonly SHOW_PASSWORD: string;
489
- readonly SIGN_IN_BUTTON: string;
490
- readonly SIGN_IN_TAB: string;
491
- readonly SIGN_IN_WITH_AMAZON: string;
492
- readonly SIGN_IN_WITH_APPLE: string;
493
- readonly SIGN_IN_WITH_FACEBOOK: string;
494
- readonly SIGN_IN_WITH_GOOGLE: string;
495
- readonly SIGN_IN: string;
496
- readonly SIGN_UP_BUTTON: string;
497
- readonly SIGNING_IN_BUTTON: string;
498
- readonly SKIP: string;
499
- readonly SUBMIT: string;
500
- readonly SUBMITTING: string;
501
- readonly VERIFY_CONTACT: string;
502
- readonly VERIFY_HEADING: string;
503
- readonly VERIFY: string;
504
- readonly WEBSITE: string;
505
- };
506
- declare type Phrase = typeof DefaultTexts[keyof typeof DefaultTexts];
507
- /**
508
- * TODO: Translation keys for dictionaries can be inferred from DefaultTexts
509
- * by typing it to Partial<Record<Phrase, string>>.
510
- *
511
- * But this requires error string keys to be standarized as well, and can be a
512
- * limiting factor for custom translation keys. Marking it as TODO until we see
513
- * a reason to strongly type this.
514
- */
515
- declare type Dict = Record<string, string>;
516
- /**
517
- * This helper type checks that given phrase is one of the texts @aws-amplify/ui
518
- * provides by default. This enables vscode autocompletion to help catch typos
519
- * during development.
520
- *
521
- * You can also use translate<string> to handle custom strings or dynamic content.
522
- */
523
- declare function translate<T = Phrase>(phrase: NoInfer<T>): string;
524
- /**
525
- * Whether I18n has a translation entry for given phrase
526
- */
527
- declare function hasTranslation(phrase: string): boolean;
528
- declare const translations: Record<string, Dict>;
529
-
530
- declare type AuthenticatorMachineOptions = AuthContext['config'] & {
531
- services?: AuthContext['services'];
532
- };
533
- declare function createAuthenticatorMachine(): xstate.StateMachine<AuthContext, any, AuthEvent, {
534
- value: any;
535
- context: AuthContext;
536
- }, xstate.BaseActionObject, Record<string, {
537
- data: any;
538
- }>, xstate.TypegenDisabled & {
539
- missingImplementations: {
540
- actions: never;
541
- delays: never;
542
- guards: never;
543
- services: never;
544
- };
545
- } & {
546
- eventsCausingActions: Record<string, string>;
547
- eventsCausingDelays: Record<string, string>;
548
- eventsCausingGuards: Record<string, string>;
549
- eventsCausingServices: Record<string, string>;
550
- } & {
551
- indexedActions: xstate.IndexByType<xstate.BaseActionObject>;
552
- indexedEvents: Record<string, AuthEvent> & {
553
- __XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__: {
554
- data: any;
555
- };
556
- };
557
- invokeSrcNameMap: Record<string, "__XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__">;
558
- }>;
559
-
560
- /**
561
- * Helper function to test if something is a design token or not.
562
- * Used in the React component style props.
563
- *
564
- * @param arg - thing to test if it is a design token or not
565
- * @returns boolean
566
- */
567
- declare function isDesignToken(arg: unknown): arg is WebDesignToken;
568
- /**
569
- *
570
- */
571
- declare type DesignToken<ValueType = any> = {
572
- value: ValueType;
573
- };
574
- /**
575
- * A fully setup design token ready to be used in web platform.
576
- */
577
- declare type WebDesignToken<ValueType = any> = {
578
- /**
579
- * Name of the design token
580
- */
581
- name: string;
582
- /**
583
- * Object path of the design token. Used for constructing the name
584
- */
585
- path: Array<string>;
586
- /**
587
- * Original (unresolved, untransformed) value of the design token
588
- */
589
- original: ValueType;
590
- /**
591
- * The wrapped CSS variable name of this design token, for example
592
- * `var(--amplify-colors-font-primary)`
593
- */
594
- toString(): string;
595
- } & DesignToken<ValueType>;
596
- declare type ColorValue = string;
597
- declare type BorderWidthValue = string;
598
- declare type FontValue = string;
599
- declare type FontSizeValue = string;
600
- declare type FontWeightValue = number;
601
- declare type LineHeightValue = string;
602
- declare type OpacityValue = string;
603
- declare type OutlineOffsetValue = string;
604
- declare type OutlineWidthValue = string;
605
- declare type RadiusValue = string;
606
- declare type ShadowValue = {
607
- offsetX: string;
608
- offsetY: string;
609
- blurRadius: string;
610
- spreadRadius?: string;
611
- color: string;
612
- };
613
- declare type SpaceValue = string;
614
- declare type TimeValue = string;
615
- declare type TransformValue = string;
616
-
617
- declare type BorderWidths = {
618
- /**
619
- * Small border, used for inputs and such
620
- */
621
- small: DesignToken<BorderWidthValue>;
622
- /**
623
- * Medium border, used for
624
- */
625
- medium: DesignToken<BorderWidthValue>;
626
- /**
627
- * Large border
628
- */
629
- large: DesignToken<BorderWidthValue>;
630
- };
631
- declare type WebBorderWidths = {
632
- [Property in keyof BorderWidths]: WebDesignToken<BorderWidthValue>;
633
- };
634
-
635
- interface OrdinalScale<DesignTokenType = DesignToken<ColorValue>> {
636
- primary: DesignTokenType;
637
- secondary: DesignTokenType;
638
- tertiary: DesignTokenType;
639
- }
640
- interface OrdinalVariation<DesignTokenType = DesignToken<ColorValue>> {
641
- info: DesignTokenType;
642
- warning: DesignTokenType;
643
- error: DesignTokenType;
644
- success: DesignTokenType;
645
- }
646
-
647
- declare type ScaleKeys = 10 | 20 | 40 | 60 | 80 | 90 | 100;
648
- declare type OverlayKeys = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90;
649
- declare type ColorScale<DesignTokenType = DesignToken<ColorValue>> = {
650
- [key in ScaleKeys]: DesignTokenType;
651
- };
652
- declare type OverlayColors<DesignTokenType = DesignToken<ColorValue>> = {
653
- [key in OverlayKeys]: DesignTokenType;
654
- };
655
- declare type FontColors<DesignTokenType = DesignToken<ColorValue>> = {
656
- inverse: DesignTokenType;
657
- interactive: DesignTokenType;
658
- hover: DesignTokenType;
659
- focus: DesignTokenType;
660
- active: DesignTokenType;
661
- disabled: DesignTokenType;
662
- } & OrdinalScale<DesignTokenType> & OrdinalVariation<DesignTokenType>;
663
- declare type BackgroundColors<DesignTokenType = DesignToken<ColorValue>> = {
664
- disabled: DesignTokenType;
665
- } & OrdinalScale<DesignTokenType> & OrdinalVariation<DesignTokenType>;
666
- declare type BorderColors<DesignTokenType = DesignToken<ColorValue>> = {
667
- disabled: DesignTokenType;
668
- focus: DesignTokenType;
669
- error: DesignTokenType;
670
- } & OrdinalScale<DesignTokenType>;
671
- declare type ColorTypes<DesignTokenType = DesignToken<ColorValue>> = {
672
- [key in ScaleKeys]: DesignTokenType;
673
- } | FontColors | BackgroundColors | DesignTokenType | BorderColors;
674
- declare type WebColorTypes = ColorTypes<WebDesignToken<ColorValue>>;
675
- declare type Colors = {
676
- red: ColorScale;
677
- orange: ColorScale;
678
- yellow: ColorScale;
679
- green: ColorScale;
680
- teal: ColorScale;
681
- blue: ColorScale;
682
- purple: ColorScale;
683
- pink: ColorScale;
684
- neutral: ColorScale;
685
- white: DesignToken<ColorValue>;
686
- black: DesignToken<ColorValue>;
687
- font: FontColors;
688
- background: BackgroundColors;
689
- border: BorderColors;
690
- brand: {
691
- primary: ColorScale;
692
- secondary: ColorScale;
693
- };
694
- overlay: OverlayColors;
695
- [key: string]: ColorTypes | Record<string, ColorTypes>;
696
- };
697
- declare type WebColors = {
698
- red: ColorScale<WebDesignToken<ColorValue>>;
699
- orange: ColorScale<WebDesignToken<ColorValue>>;
700
- yellow: ColorScale<WebDesignToken<ColorValue>>;
701
- green: ColorScale<WebDesignToken<ColorValue>>;
702
- teal: ColorScale<WebDesignToken<ColorValue>>;
703
- blue: ColorScale<WebDesignToken<ColorValue>>;
704
- purple: ColorScale<WebDesignToken<ColorValue>>;
705
- pink: ColorScale<WebDesignToken<ColorValue>>;
706
- neutral: ColorScale<WebDesignToken<ColorValue>>;
707
- white: WebDesignToken<ColorValue>;
708
- black: WebDesignToken<ColorValue>;
709
- font: FontColors<WebDesignToken<ColorValue>>;
710
- background: BackgroundColors<WebDesignToken<ColorValue>>;
711
- border: BorderColors<WebDesignToken<ColorValue>>;
712
- brand: {
713
- primary: ColorScale<WebDesignToken<ColorValue>>;
714
- secondary: ColorScale<WebDesignToken<ColorValue>>;
715
- };
716
- overlay: OverlayColors<WebDesignToken<ColorValue>>;
717
- [key: string]: WebColorTypes | Record<string, WebColorTypes>;
718
- };
719
-
720
- declare type Fonts = {
721
- default: {
722
- variable: DesignToken<FontValue>;
723
- static: DesignToken<FontValue>;
724
- };
725
- };
726
- interface WebFonts {
727
- default: {
728
- [Property in keyof Fonts['default']]: WebDesignToken<FontValue>;
729
- };
730
- }
731
-
732
- declare type FontSizes = {
733
- xxxs: DesignToken<FontSizeValue>;
734
- xxs: DesignToken<FontSizeValue>;
735
- xs: DesignToken<FontSizeValue>;
736
- small: DesignToken<FontSizeValue>;
737
- medium: DesignToken<FontSizeValue>;
738
- large: DesignToken<FontSizeValue>;
739
- xl: DesignToken<FontSizeValue>;
740
- xxl: DesignToken<FontSizeValue>;
741
- xxxl: DesignToken<FontSizeValue>;
742
- xxxxl: DesignToken<FontSizeValue>;
743
- };
744
- declare type WebFontSizes = {
745
- [Property in keyof FontSizes]: WebDesignToken<FontSizeValue>;
746
- };
747
-
748
- declare type FontWeights = {
749
- hairline: DesignToken<FontWeightValue>;
750
- thin: DesignToken<FontWeightValue>;
751
- light: DesignToken<FontWeightValue>;
752
- normal: DesignToken<FontWeightValue>;
753
- medium: DesignToken<FontWeightValue>;
754
- semibold: DesignToken<FontWeightValue>;
755
- bold: DesignToken<FontWeightValue>;
756
- extrabold: DesignToken<FontWeightValue>;
757
- black: DesignToken<FontWeightValue>;
758
- };
759
- declare type WebFontWeights = {
760
- [Property in keyof FontWeights]: WebDesignToken<FontWeightValue>;
761
- };
762
-
763
- declare type LineHeights = {
764
- small: DesignToken<LineHeightValue>;
765
- medium: DesignToken<LineHeightValue>;
766
- large: DesignToken<LineHeightValue>;
767
- };
768
- declare type WebLineHeights = {
769
- [Property in keyof LineHeights]: WebDesignToken<LineHeightValue>;
770
- };
771
-
772
- declare type Opacities = {
773
- 0: DesignToken<OpacityValue>;
774
- 10: DesignToken<OpacityValue>;
775
- 20: DesignToken<OpacityValue>;
776
- 30: DesignToken<OpacityValue>;
777
- 40: DesignToken<OpacityValue>;
778
- 50: DesignToken<OpacityValue>;
779
- 60: DesignToken<OpacityValue>;
780
- 70: DesignToken<OpacityValue>;
781
- 80: DesignToken<OpacityValue>;
782
- 90: DesignToken<OpacityValue>;
783
- 100: DesignToken<OpacityValue>;
784
- };
785
- declare type WebOpacities = {
786
- [Property in keyof Opacities]: WebDesignToken<OpacityValue>;
787
- };
788
-
789
- declare type OutlineOffsets = {
790
- small: DesignToken<OutlineOffsetValue>;
791
- medium: DesignToken<OutlineOffsetValue>;
792
- large: DesignToken<OutlineOffsetValue>;
793
- };
794
- declare type WebOutlineOffsets = {
795
- [Property in keyof OutlineOffsets]: WebDesignToken<OutlineOffsetValue>;
796
- };
797
-
798
- declare type OutlineWidths = {
799
- small: DesignToken<OutlineWidthValue>;
800
- medium: DesignToken<OutlineWidthValue>;
801
- large: DesignToken<OutlineWidthValue>;
802
- };
803
- declare type WebOutlineWidths = {
804
- [Property in keyof OutlineWidths]: WebDesignToken<OutlineWidthValue>;
805
- };
806
-
807
- declare type Radii = {
808
- xs: DesignToken<RadiusValue>;
809
- small: DesignToken<RadiusValue>;
810
- medium: DesignToken<RadiusValue>;
811
- large: DesignToken<RadiusValue>;
812
- xl: DesignToken<RadiusValue>;
813
- xxl: DesignToken<RadiusValue>;
814
- xxxl: DesignToken<RadiusValue>;
815
- };
816
- declare type WebRadii = {
817
- [Property in keyof Radii]: WebDesignToken<RadiusValue>;
818
- };
819
-
820
- declare type Shadows = {
821
- small: DesignToken<ShadowValue>;
822
- medium: DesignToken<ShadowValue>;
823
- large: DesignToken<ShadowValue>;
824
- };
825
- declare type WebShadows = {
826
- [Property in keyof Shadows]: WebDesignToken<ShadowValue>;
827
- };
828
-
829
- declare type SpaceSizes = {
830
- xxxs: DesignToken<SpaceValue>;
831
- xxs: DesignToken<SpaceValue>;
832
- xs: DesignToken<SpaceValue>;
833
- small: DesignToken<SpaceValue>;
834
- medium: DesignToken<SpaceValue>;
835
- large: DesignToken<SpaceValue>;
836
- xl: DesignToken<SpaceValue>;
837
- xxl: DesignToken<SpaceValue>;
838
- xxxl: DesignToken<SpaceValue>;
839
- };
840
- declare type Space = SpaceSizes & {
841
- zero: DesignToken<SpaceValue>;
842
- relative: SpaceSizes & {
843
- full: DesignToken<SpaceValue>;
844
- };
845
- };
846
- declare type WebSpace = {
847
- [Property in keyof Omit<Space, 'relative'>]: WebDesignToken<SpaceValue>;
848
- } & {
849
- relative: {
850
- [Property in keyof Space['relative']]: WebDesignToken<SpaceValue>;
851
- };
852
- };
853
-
854
- declare type Time = {
855
- short: DesignToken<TimeValue>;
856
- medium: DesignToken<TimeValue>;
857
- long: DesignToken<TimeValue>;
858
- };
859
- declare type WebTime = {
860
- [Property in keyof Time]: WebDesignToken<TimeValue>;
861
- };
862
-
863
- declare type Transforms = {
864
- slideX: {
865
- small: DesignToken<TransformValue>;
866
- medium: DesignToken<TransformValue>;
867
- large: DesignToken<TransformValue>;
868
- };
869
- };
870
- declare type WebTransforms = {
871
- slideX: {
872
- [Property in keyof Transforms['slideX']]: WebDesignToken<TransformValue>;
873
- };
874
- };
875
-
876
- interface Tokens {
877
- components: any;
878
- borderWidths: BorderWidths;
879
- colors: Colors;
880
- fonts: Fonts;
881
- fontSizes: FontSizes;
882
- fontWeights: FontWeights;
883
- lineHeights: LineHeights;
884
- opacities: Opacities;
885
- outlineOffsets: OutlineOffsets;
886
- outlineWidths: OutlineWidths;
887
- radii: Radii;
888
- shadows: Shadows;
889
- space: Space;
890
- time: Time;
891
- transforms: Transforms;
892
- }
893
- /**
894
- * The fully setup theme tokens. It has the same shape as Tokens
895
- * but each token has added fields.
896
- */
897
- interface WebTokens extends Tokens {
898
- borderWidths: WebBorderWidths;
899
- colors: WebColors;
900
- fonts: WebFonts;
901
- fontSizes: WebFontSizes;
902
- fontWeights: WebFontWeights;
903
- lineHeights: WebLineHeights;
904
- opacities: WebOpacities;
905
- outlineOffsets: WebOutlineOffsets;
906
- outlineWidths: WebOutlineWidths;
907
- radii: WebRadii;
908
- shadows: WebShadows;
909
- space: WebSpace;
910
- time: WebTime;
911
- transform: WebTransforms;
912
- }
913
-
914
- interface Breakpoints {
915
- values: {
916
- base: number;
917
- small: number;
918
- medium: number;
919
- large: number;
920
- xl: number;
921
- xxl: number;
922
- };
923
- defaultBreakpoint: string;
924
- }
925
-
926
- /**
927
- * An override is a set of tokens that override others
928
- * in certain contexts. On Android, these are like resource
929
- * qualifiers. On the web, these are like media queries with
930
- * a set of CSS variables in it. A theme should contain
931
- * everything it needs to render
932
- */
933
- declare type Override = SelectorOverride | MediaQueryOverride | BreakpointOverride | ColorModeOverride;
934
- interface BaseOverride {
935
- tokens?: PartialDeep<Tokens>;
936
- }
937
- /**
938
- * This override takes a breakpoint name and creates a media-query for that
939
- * breakpoint
940
- * ```css
941
- * @media (min-width: 20em) {
942
- * [data-amplify-theme] {
943
- * --amplify-font-size-large: 2rem;
944
- * }
945
- * }
946
- * ```
947
- */
948
- interface BreakpointOverride extends BaseOverride {
949
- breakpoint: keyof Breakpoints['values'];
950
- }
951
- /**
952
- * ```css
953
- * @media (prefers-color-scheme: dark) {
954
- * --amplify-colors-background-primary: black;
955
- * --amplify-colors-font-primary: white;
956
- * }
957
- * ```
958
- */
959
- interface MediaQueryOverride extends BaseOverride {
960
- mediaQuery: string;
961
- }
962
- /**
963
- * ```css
964
- * .disco-theme {
965
- * --amplify-colors-background-primary: pink;
966
- * }
967
- * [data-my-cool-theme] {
968
- * --amplify-colors-font-primary: purple;
969
- * }
970
- * ```
971
- */
972
- interface SelectorOverride extends BaseOverride {
973
- selector: string;
974
- }
975
- declare type ColorMode = 'light' | 'dark';
976
- /**
977
- * This creates a color mode override, where the color mode is 'light' or 'dark'.
978
- * Note: there is no 'system' here.
979
- *
980
- * ```css
981
- * @media(prefers-color-scheme: dark) {
982
- * [data-amplify-color-mode="system"] {
983
- * }
984
- * }
985
- *
986
- * [data-amplify-color-mode="dark"] {
987
- *
988
- * }
989
- * ```
990
- */
991
- interface ColorModeOverride extends BaseOverride {
992
- colorMode: ColorMode;
993
- }
994
- /**
995
- * A Theme just needs a name. This is what a user would generally deal with.
996
- * They can define any tokens or breakpoints they need, but they don't need a
997
- * complete theme with all tokens.
998
- */
999
- interface Theme {
1000
- /**
1001
- * The name of the theme. This is used to create scoped CSS to allow for
1002
- * multiple themes on a page.
1003
- */
1004
- name: string;
1005
- tokens?: PartialDeep<Tokens>;
1006
- breakpoints?: PartialDeep<Breakpoints>;
1007
- /**
1008
- * Overrides allow you to change design tokens in different contexts, like
1009
- * light and dark mode. You can also have other media query overrides as well
1010
- * as breakpoint overrides which correspond to the Breakpoints on a theme,
1011
- * and a generic selector override.
1012
- */
1013
- overrides?: Array<Override>;
1014
- }
1015
- /**
1016
- * A BaseTheme has all tokens and breakpoints required
1017
- */
1018
- interface BaseTheme extends Theme {
1019
- tokens: Tokens;
1020
- breakpoints: Breakpoints;
1021
- overrides?: Array<Override>;
1022
- }
1023
- /**
1024
- * WebTheme is a fully built theme that has cssText based
1025
- * on the design tokens and all design tokens have added fields
1026
- * to be used in Javascript/Typescript.
1027
- */
1028
- interface WebTheme extends BaseTheme {
1029
- tokens: WebTokens;
1030
- cssText: string;
1031
- }
1032
-
1033
- /**
1034
- * This will be used like `const myTheme = createTheme({})`
1035
- * `myTheme` can then be passed to a Provider or the generated CSS
1036
- * can be passed to a stylesheet at build-time or run-time.
1037
- * const myTheme = createTheme({})
1038
- * const myOtherTheme = createTheme({}, myTheme);
1039
- */
1040
- declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
1041
-
1042
- declare const defaultTheme: WebTheme;
1043
-
1044
- export { ActorContextWithForms, ActorDoneData, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthFormFields, AuthInterpreter, AuthMachineSend, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoAttributes, CognitoUserAmplify, ColorModeOverride, ColorValue, CommonFields, ContactMethod, DefaultFormFieldOptions, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, FormFieldComponents, FormFieldOptions, FormFields, FormFieldsArray, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, PasswordPolicyRules, PasswordSettings, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, ShadowValue, SignInContext, SignInResult, SignInState, SignInTypes, SignOutContext, SignOutState, SignUpAttribute, SignUpContext, SignUpFieldsWithDefaults, SignUpFieldsWithoutDefaults, SignUpState, SocialProvider, SpaceValue, Theme, TimeValue, TransformValue, ValidationError, Validator, ValidatorResult, WebDesignToken, WebTheme, applyDefaults, applyTranslation, authFieldsWithDefaults, censorAllButFirstAndLast, censorPhoneNumber, countryDialCodes, createAuthenticatorMachine, createTheme, defaultFormFieldOptions, defaultFormFieldsGetters, defaultTheme, getActorContext, getActorState, getConfiguredAliases, getDefaultFormFields, getErrors, getFormDataFromEvent, getFormFields, getPrimaryAlias, getSendEventAliases, getServiceContextFacade, getServiceFacade, getSortedFormFields, hasTranslation, isAuthFieldWithDefaults, isDesignToken, listenToAuthHub, setFormOrder, signUpFieldsWithDefault, signUpFieldsWithoutDefault, sortFormFields, translate, translations };