@aws-amplify/ui 2.0.4-unstable.93 → 3.0.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 (63) hide show
  1. package/README.md +7 -0
  2. package/dist/esm/index.js +32 -0
  3. package/dist/esm/index.js.map +7 -0
  4. package/dist/index.d.ts +788 -0
  5. package/dist/index.js +32 -0
  6. package/dist/index.js.map +7 -0
  7. package/dist/styles.css +2697 -0
  8. package/dist/theme.css +781 -0
  9. package/package.json +51 -28
  10. package/CHANGELOG.md +0 -331
  11. package/Readme.md +0 -5
  12. package/dist/aws-amplify-ui.js +0 -2
  13. package/dist/aws-amplify-ui.js.map +0 -1
  14. package/dist/aws-amplify-ui.min.js +0 -2
  15. package/dist/aws-amplify-ui.min.js.map +0 -1
  16. package/dist/style.css +0 -775
  17. package/dist/style.css.map +0 -1
  18. package/lib/Anchor.css.d.ts +0 -2
  19. package/lib/Button.css.d.ts +0 -10
  20. package/lib/Form.css.d.ts +0 -5
  21. package/lib/Hint.css.d.ts +0 -2
  22. package/lib/Input.css.d.ts +0 -5
  23. package/lib/Nav.css.d.ts +0 -5
  24. package/lib/PhotoPicker.css.d.ts +0 -4
  25. package/lib/Section.css.d.ts +0 -10
  26. package/lib/SelectInput.css.d.ts +0 -2
  27. package/lib/Strike.css.d.ts +0 -3
  28. package/lib/Toast.css.d.ts +0 -3
  29. package/lib/Totp.css.d.ts +0 -2
  30. package/lib/XR.css.d.ts +0 -17
  31. package/lib/index.d.ts +0 -13
  32. package/postcss.config.js +0 -3
  33. package/src/Anchor.css +0 -10
  34. package/src/Anchor.css.d.ts +0 -2
  35. package/src/Angular.css +0 -607
  36. package/src/Button.css +0 -131
  37. package/src/Button.css.d.ts +0 -10
  38. package/src/Form.css +0 -43
  39. package/src/Form.css.d.ts +0 -5
  40. package/src/Hint.css +0 -6
  41. package/src/Hint.css.d.ts +0 -2
  42. package/src/Input.css +0 -41
  43. package/src/Input.css.d.ts +0 -5
  44. package/src/Nav.css +0 -21
  45. package/src/Nav.css.d.ts +0 -5
  46. package/src/PhotoPicker.css +0 -15
  47. package/src/PhotoPicker.css.d.ts +0 -4
  48. package/src/Section.css +0 -67
  49. package/src/Section.css.d.ts +0 -10
  50. package/src/SelectInput.css +0 -36
  51. package/src/SelectInput.css.d.ts +0 -2
  52. package/src/Strike.css +0 -17
  53. package/src/Strike.css.d.ts +0 -3
  54. package/src/Theme.css +0 -150
  55. package/src/Toast.css +0 -63
  56. package/src/Toast.css.d.ts +0 -3
  57. package/src/Totp.css +0 -4
  58. package/src/Totp.css.d.ts +0 -2
  59. package/src/XR.css +0 -201
  60. package/src/XR.css.d.ts +0 -17
  61. package/src/index.ts +0 -25
  62. package/tsconfig.json +0 -29
  63. package/webpack.config.js +0 -63
@@ -0,0 +1,788 @@
1
+ import * as xstate from 'xstate';
2
+ import { State, Interpreter, Sender } from 'xstate';
3
+ import { CognitoUser } from 'amazon-cognito-identity-js';
4
+ import { PartialDeep } from 'type-fest';
5
+
6
+ declare type ValidationError = Record<string, string>;
7
+ /**
8
+ * Return type of validator. This is `null` if there are no error, and `ValidationError` otherwise.
9
+ */
10
+ declare type ValidatorResult = void | null | ValidationError;
11
+ /**
12
+ * Validates the given formData. This can be synchronous or asynchronous.
13
+ */
14
+ declare type Validator = (formData: AuthFormData) => ValidatorResult | Promise<ValidatorResult>;
15
+
16
+ declare type AuthFormData = Record<string, string>;
17
+ interface AuthContext {
18
+ actorRef?: any;
19
+ config?: {
20
+ loginMechanisms?: LoginMechanism[];
21
+ signUpAttributes?: SignUpAttribute[];
22
+ socialProviders?: SocialProvider[];
23
+ };
24
+ user?: CognitoUserAmplify;
25
+ }
26
+ interface BaseFormContext {
27
+ authAttributes?: Record<string, any>;
28
+ challengeName?: string;
29
+ formValues?: AuthFormData;
30
+ intent?: string;
31
+ remoteError?: string;
32
+ user?: CognitoUserAmplify;
33
+ validationError?: ValidationError;
34
+ country_code?: string;
35
+ }
36
+ interface SignInContext extends BaseFormContext {
37
+ loginMechanisms: AuthContext['config']['loginMechanisms'];
38
+ socialProviders: AuthContext['config']['socialProviders'];
39
+ attributeToVerify?: string;
40
+ redirectIntent?: string;
41
+ unverifiedAttributes?: Record<string, string>;
42
+ }
43
+ declare const signUpFieldsWithDefault: readonly ["birthdate", "email", "family_name", "given_name", "middle_name", "name", "nickname", "phone_number", "preferred_username", "profile", "website"];
44
+ declare const signUpFieldsWithoutDefault: readonly ["address", "gender", "locale", "picture", "updated_at", "zoneinfo"];
45
+ declare type SignUpFieldsWithDefaults = typeof signUpFieldsWithDefault[number];
46
+ declare type SignUpFieldsWithoutDefaults = typeof signUpFieldsWithoutDefault[number];
47
+ declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDefaults;
48
+ interface SignUpContext extends BaseFormContext {
49
+ loginMechanisms: AuthContext['config']['loginMechanisms'];
50
+ socialProviders: AuthContext['config']['socialProviders'];
51
+ unverifiedAttributes?: Record<string, string>;
52
+ }
53
+ interface ResetPasswordContext extends BaseFormContext {
54
+ username?: string;
55
+ unverifiedAttributes?: Record<string, string>;
56
+ }
57
+ interface SignOutContext {
58
+ authAttributes?: Record<string, any>;
59
+ challengeName?: string;
60
+ unverifiedAttributes?: Record<string, string>;
61
+ user?: CognitoUserAmplify;
62
+ }
63
+ declare type ActorContextWithForms = SignInContext | SignUpContext | ResetPasswordContext;
64
+ declare type SignInState = State<SignInContext, AuthEvent>;
65
+ declare type SignUpState = State<SignUpContext, AuthEvent>;
66
+ declare type SignOutState = State<SignOutContext, AuthEvent>;
67
+ declare type ResetPasswordState = State<ResetPasswordContext, AuthEvent>;
68
+ declare type AuthActorContext = ActorContextWithForms | SignOutContext;
69
+ declare type AuthActorState = State<AuthActorContext, AuthEvent>;
70
+ interface CognitoUserAmplify extends CognitoUser {
71
+ username?: string;
72
+ }
73
+ declare type InvokeActorEventTypes = 'done.invoke.signInActor' | 'done.invoke.signUpActor' | 'done.invoke.signOutActor' | 'done.invoke.resetPasswordActor';
74
+ declare type AuthEventTypes = 'CHANGE' | 'FEDERATED_SIGN_IN' | 'RESEND' | 'RESET_PASSWORD' | 'SIGN_IN' | 'SIGN_OUT' | 'SIGN_UP' | 'SKIP' | 'SUBMIT' | InvokeActorEventTypes;
75
+ declare enum AuthChallengeNames {
76
+ SMS_MFA = "SMS_MFA",
77
+ SOFTWARE_TOKEN_MFA = "SOFTWARE_TOKEN_MFA",
78
+ NEW_PASSWORD_REQUIRED = "NEW_PASSWORD_REQUIRED",
79
+ RESET_REQUIRED = "RESET_REQUIRED",
80
+ MFA_SETUP = "MFA_SETUP"
81
+ }
82
+ interface InputAttributes {
83
+ label: string;
84
+ type: string;
85
+ placeholder: string;
86
+ autocomplete?: string;
87
+ }
88
+ declare const LoginMechanismArray: readonly ["username", "email", "phone_number"];
89
+ declare type LoginMechanism = typeof LoginMechanismArray[number];
90
+ declare type SocialProvider = 'amazon' | 'apple' | 'facebook' | 'google';
91
+ declare type AuthFieldsWithDefaults = LoginMechanism | SignUpFieldsWithDefaults | 'confirmation_code' | 'password';
92
+ declare type AuthInputAttributes = Record<AuthFieldsWithDefaults, InputAttributes>;
93
+ declare type AuthEventData = Record<PropertyKey, any>;
94
+ interface AuthEvent {
95
+ type: AuthEventTypes;
96
+ data?: AuthEventData;
97
+ }
98
+ declare type AuthMachineState = State<AuthContext, AuthEvent>;
99
+ declare type AuthInterpreter = Interpreter<AuthContext, any, AuthEvent>;
100
+
101
+ declare type NoInfer<T> = [T][T extends any ? 0 : never];
102
+
103
+ declare const authInputAttributes: AuthInputAttributes;
104
+ declare enum FederatedIdentityProviders {
105
+ Apple = "SignInWithApple",
106
+ Amazon = "LoginWithAmazon",
107
+ Facebook = "Facebook",
108
+ Google = "Google"
109
+ }
110
+ /**
111
+ * Given xstate context from AuthMachine, this returns the input label, type,
112
+ * and error attributes of the configured login_mechanisms. An optional "alias"
113
+ * may be passed in to get info from context for that specific alias.
114
+ */
115
+ declare const getAliasInfoFromContext: (context: AuthContext, alias?: LoginMechanism) => {
116
+ label: string;
117
+ type: string;
118
+ error: any;
119
+ };
120
+ /**
121
+ * Given xstate context from AuthMachine, returns the primaryAlias and
122
+ * secondaryAliases.
123
+ */
124
+ declare const getConfiguredAliases: (context: AuthContext) => {
125
+ primaryAlias: "username" | "email" | "phone_number";
126
+ secondaryAliases: ("username" | "email" | "phone_number")[];
127
+ };
128
+ /**
129
+ * Get the state of current actor. This is useful for checking which screen
130
+ * to render: e.g. `getActorState(state).matches('confirmSignUp.edit').
131
+ */
132
+ declare const getActorState: (state: AuthMachineState) => AuthActorState;
133
+ /**
134
+ * Get the context of current actor. Useful for getting any nested context
135
+ * like remoteError.
136
+ */
137
+ declare const getActorContext: (state: AuthMachineState) => AuthActorContext;
138
+ /**
139
+ * Creates public facing auth helpers that abstracts out xstate implementation
140
+ * detail. Each framework implementation can export these helpers so that
141
+ * developers can send events without having to learn internals.
142
+ *
143
+ * ```
144
+ * const [state, send] = useActor(...);
145
+ * const { submit } = getSendEventAliases(send);
146
+ * submit({ username, password})
147
+ * ```
148
+ */
149
+ declare const getSendEventAliases: (send: Sender<AuthEvent>) => {
150
+ readonly resendCode: (data?: AuthEventData) => void;
151
+ readonly signOut: (data?: AuthEventData) => void;
152
+ readonly submitForm: (data?: AuthEventData) => void;
153
+ readonly updateForm: (data?: AuthEventData) => void;
154
+ readonly toFederatedSignIn: (data?: AuthEventData) => void;
155
+ readonly toResetPassword: (data?: AuthEventData) => void;
156
+ readonly toSignIn: (data?: AuthEventData) => void;
157
+ readonly toSignUp: (data?: AuthEventData) => void;
158
+ readonly skipVerification: (data?: AuthEventData) => void;
159
+ };
160
+ declare const getServiceContextFacade: (state: AuthMachineState) => {
161
+ error: string;
162
+ hasValidationErrors: boolean;
163
+ isPending: boolean;
164
+ route: string;
165
+ user: CognitoUserAmplify;
166
+ validationErrors: {
167
+ [x: string]: string;
168
+ };
169
+ };
170
+ declare const getServiceFacade: ({ send, state }: {
171
+ send: any;
172
+ state: any;
173
+ }) => {
174
+ error: string;
175
+ hasValidationErrors: boolean;
176
+ isPending: boolean;
177
+ route: string;
178
+ user: CognitoUserAmplify;
179
+ validationErrors: {
180
+ [x: string]: string;
181
+ };
182
+ resendCode: (data?: AuthEventData) => void;
183
+ signOut: (data?: AuthEventData) => void;
184
+ submitForm: (data?: AuthEventData) => void;
185
+ updateForm: (data?: AuthEventData) => void;
186
+ toFederatedSignIn: (data?: AuthEventData) => void;
187
+ toResetPassword: (data?: AuthEventData) => void;
188
+ toSignIn: (data?: AuthEventData) => void;
189
+ toSignUp: (data?: AuthEventData) => void;
190
+ skipVerification: (data?: AuthEventData) => void;
191
+ };
192
+
193
+ declare type ContactMethod = 'Email' | 'Phone Number';
194
+ declare const censorAllButFirstAndLast: (value: string) => string;
195
+ declare const censorPhoneNumber: (val: string) => string;
196
+
197
+ declare const countryDialCodes: string[];
198
+
199
+ /**
200
+ * Contains translatable strings that authenticator provides by default. Customers
201
+ * can use this to add custom vocabularies:
202
+ *
203
+ * ```
204
+ * I18n.putVocabulariesForLanguage("en", {
205
+ * [DefaultTexts.SIGN_IN]: "Custom Sign In Text",
206
+ * [DefaultTexts.SIGN_IN_BUTTON]: "Custom Click Here to Sign In"
207
+ * });
208
+ * ```
209
+ */
210
+ declare const DefaultTexts: {
211
+ readonly BACK_SIGN_IN: "Back to Sign In";
212
+ readonly BIRTHDATE: "Birthdate";
213
+ readonly CHANGE_PASSWORD: "Change Password";
214
+ readonly CHANGING_PASSWORD: "Changing";
215
+ readonly CODE: "Code";
216
+ readonly CONFIRM_PASSWORD: "Confirm Password";
217
+ readonly CONFIRM_RESET_PASSWORD_HEADING: "Reset your Password";
218
+ readonly CONFIRM_SIGNUP_HEADING: "Confirm Sign Up";
219
+ readonly CONFIRM_SMS: "Confirm SMS Code";
220
+ readonly CONFIRM_TOTP: "Confirm TOTP Code";
221
+ readonly CONFIRM: "Confirm";
222
+ readonly CONFIRMATION_CODE: "Confirmation Code";
223
+ readonly CONFIRMING: "Confirming";
224
+ readonly CREATE_ACCOUNT: "Create Account";
225
+ readonly CREATING_ACCOUNT: "Creating Account";
226
+ readonly EMAIL_ADDRESS: "Email";
227
+ readonly ENTER_CODE: "Enter your code";
228
+ readonly ENTER_USERNAME: "Enter your username";
229
+ readonly FAMILY_NAME: "Family Name";
230
+ readonly GIVEN_NAME: "Given Name";
231
+ readonly FORGOT_YOUR_PASSWORD: "Forgot your password? ";
232
+ readonly HIDE_PASSWORD: "Hide password";
233
+ readonly LOADING: "Loading";
234
+ readonly LOGIN_NAME: "Username";
235
+ readonly MIDDLE_NAME: "Middle Name";
236
+ readonly NAME: "Name";
237
+ readonly NICKNAME: "Nickname";
238
+ readonly NEW_PASSWORD: "New password";
239
+ readonly PASSWORD: "Password";
240
+ readonly PHONE_NUMBER: "Phone Number";
241
+ readonly PREFERRED_USERNAME: "Preferred Username";
242
+ readonly PROFILE: "Profile";
243
+ readonly RESEND_CODE: "Resend Code";
244
+ readonly RESET_PASSWORD_HEADING: "Reset your password";
245
+ readonly RESET_PASSWORD: "Send Code";
246
+ readonly SEND_CODE: "Send code";
247
+ readonly SENDING: "Sending";
248
+ readonly SETUP_TOTP: "Setup TOTP";
249
+ readonly SHOW_PASSWORD: "Show password";
250
+ readonly SIGN_IN_BUTTON: "Sign in";
251
+ readonly SIGN_IN_TAB: "Sign In";
252
+ readonly SIGN_IN_WITH_AMAZON: "Sign In with Amazon";
253
+ readonly SIGN_IN_WITH_APPLE: "Sign In with Apple";
254
+ readonly SIGN_IN_WITH_FACEBOOK: "Sign In with Facebook";
255
+ readonly SIGN_IN_WITH_GOOGLE: "Sign In with Google";
256
+ readonly SIGN_IN: "Sign in to your account";
257
+ readonly SIGN_UP_BUTTON: "Create a new account";
258
+ readonly SIGNING_IN_BUTTON: "Signing in";
259
+ readonly SKIP: "Skip";
260
+ readonly SUBMIT: "Submit";
261
+ readonly SUBMITTING: "Submitting";
262
+ readonly VERIFY_CONTACT: "Verify Contact";
263
+ readonly VERIFY_HEADING: "Account recovery requires verified contact information";
264
+ readonly VERIFY: "Verify";
265
+ readonly WEBSITE: "Website";
266
+ };
267
+ declare type Phrase = typeof DefaultTexts[keyof typeof DefaultTexts];
268
+ /**
269
+ * TODO: Translation keys for dictionaries can be inferred from DefaultTexts
270
+ * by typing it to Partial<Record<Phrase, string>>.
271
+ *
272
+ * But this requires error string keys to be standarized as well, and can be a
273
+ * limiting factor for custom translation keys. Marking it as TODO until we see
274
+ * a reason to strongly type this.
275
+ */
276
+ declare type Dict = Record<string, string>;
277
+ /**
278
+ * This helper type checks that given phrase is one of the texts @aws-amplify/ui
279
+ * provides by default. This enables vscode autocompletion to help catch typos
280
+ * during development.
281
+ *
282
+ * You can also use translate<string> to handle custom strings or dynamic content.
283
+ */
284
+ declare function translate<T = Phrase>(phrase: NoInfer<T>): string;
285
+ declare const translations: Record<string, Dict>;
286
+
287
+ declare const defaultServices: {
288
+ getAmplifyConfig(): Promise<{}>;
289
+ getCurrentUser(): Promise<any>;
290
+ validateCustomSignUp(formData: any): Promise<ValidatorResult>;
291
+ validateConfirmPassword<Validator>(formData: any): Promise<ValidatorResult>;
292
+ validatePreferredUsername(formData: any): Promise<ValidatorResult>;
293
+ };
294
+
295
+ declare type AuthenticatorMachineOptions = AuthContext['config'] & {
296
+ initialState?: 'signIn' | 'signUp' | 'resetPassword';
297
+ services?: Partial<typeof defaultServices>;
298
+ };
299
+ declare function createAuthenticatorMachine({ initialState, loginMechanisms, signUpAttributes, socialProviders, services: customServices, }: AuthenticatorMachineOptions): xstate.StateMachine<AuthContext, any, AuthEvent, {
300
+ value: any;
301
+ context: AuthContext;
302
+ }, xstate.ActionObject<AuthContext, AuthEvent>>;
303
+
304
+ /**
305
+ * Helper function to test if something is a design token or not.
306
+ * Used in the React component style props.
307
+ *
308
+ * @param arg - thing to test if it is a design token or not
309
+ * @returns boolean
310
+ */
311
+ declare function isDesignToken(arg: unknown): arg is WebDesignToken;
312
+ /**
313
+ *
314
+ */
315
+ declare type DesignToken<ValueType = any> = {
316
+ value: ValueType;
317
+ };
318
+ /**
319
+ * A fully setup design token ready to be used in web platform.
320
+ */
321
+ declare type WebDesignToken<ValueType = any> = {
322
+ /**
323
+ * Name of the design token
324
+ */
325
+ name: string;
326
+ /**
327
+ * Object path of the design token. Used for constructing the name
328
+ */
329
+ path: Array<string>;
330
+ /**
331
+ * Original (unresolved, untransformed) value of the design token
332
+ */
333
+ original: ValueType;
334
+ /**
335
+ * The wrapped CSS variable name of this design token, for example
336
+ * `var(--amplify-colors-font-primary)`
337
+ */
338
+ toString(): string;
339
+ } & DesignToken<ValueType>;
340
+ declare type ColorValue = string;
341
+ declare type BorderWidthValue = string;
342
+ declare type FontValue = string;
343
+ declare type FontSizeValue = string;
344
+ declare type FontWeightValue = number;
345
+ declare type LineHeightValue = string;
346
+ declare type OpacityValue = string;
347
+ declare type OutlineOffsetValue = string;
348
+ declare type OutlineWidthValue = string;
349
+ declare type RadiusValue = string;
350
+ declare type ShadowValue = {
351
+ offsetX: string;
352
+ offsetY: string;
353
+ blurRadius: string;
354
+ spreadRadius?: string;
355
+ color: string;
356
+ };
357
+ declare type SpaceValue = string;
358
+ declare type TimeValue = string;
359
+ declare type TransformValue = string;
360
+
361
+ declare type BorderWidths = {
362
+ /**
363
+ * Small border, used for inputs and such
364
+ */
365
+ small: DesignToken<BorderWidthValue>;
366
+ /**
367
+ * Medium border, used for
368
+ */
369
+ medium: DesignToken<BorderWidthValue>;
370
+ /**
371
+ * Large border
372
+ */
373
+ large: DesignToken<BorderWidthValue>;
374
+ };
375
+ declare type WebBorderWidths = {
376
+ [Property in keyof BorderWidths]: WebDesignToken<BorderWidthValue>;
377
+ };
378
+
379
+ interface OrdinalScale<DesignTokenType = DesignToken<ColorValue>> {
380
+ primary: DesignTokenType;
381
+ secondary: DesignTokenType;
382
+ tertiary: DesignTokenType;
383
+ }
384
+ interface OrdinalVariation<DesignTokenType = DesignToken<ColorValue>> {
385
+ info: DesignTokenType;
386
+ warning: DesignTokenType;
387
+ error: DesignTokenType;
388
+ success: DesignTokenType;
389
+ }
390
+
391
+ declare type ScaleKeys = 10 | 20 | 40 | 60 | 80 | 90 | 100;
392
+ declare type ColorScale<DesignTokenType = DesignToken<ColorValue>> = {
393
+ [key in ScaleKeys]: DesignTokenType;
394
+ };
395
+ declare type FontColors<DesignTokenType = DesignToken<ColorValue>> = {
396
+ inverse: DesignTokenType;
397
+ interactive: DesignTokenType;
398
+ hover: DesignTokenType;
399
+ focus: DesignTokenType;
400
+ active: DesignTokenType;
401
+ disabled: DesignTokenType;
402
+ } & OrdinalScale<DesignTokenType> & OrdinalVariation<DesignTokenType>;
403
+ declare type BackgroundColors<DesignTokenType = DesignToken<ColorValue>> = {
404
+ disabled: DesignTokenType;
405
+ } & OrdinalScale<DesignTokenType> & OrdinalVariation<DesignTokenType>;
406
+ declare type BorderColors<DesignTokenType = DesignToken<ColorValue>> = {
407
+ disabled: DesignTokenType;
408
+ focus: DesignTokenType;
409
+ error: DesignTokenType;
410
+ } & OrdinalScale<DesignTokenType>;
411
+ declare type ColorTypes<DesignTokenType = DesignToken<ColorValue>> = {
412
+ [key in ScaleKeys]: DesignTokenType;
413
+ } | FontColors | BackgroundColors | DesignTokenType | BorderColors;
414
+ declare type WebColorTypes = ColorTypes<WebDesignToken<ColorValue>>;
415
+ declare type Colors = {
416
+ red: ColorScale;
417
+ orange: ColorScale;
418
+ yellow: ColorScale;
419
+ green: ColorScale;
420
+ teal: ColorScale;
421
+ blue: ColorScale;
422
+ purple: ColorScale;
423
+ pink: ColorScale;
424
+ neutral: ColorScale;
425
+ white: DesignToken<ColorValue>;
426
+ black: DesignToken<ColorValue>;
427
+ font: FontColors;
428
+ background: BackgroundColors;
429
+ border: BorderColors;
430
+ brand: {
431
+ primary: ColorScale;
432
+ secondary: ColorScale;
433
+ };
434
+ [key: string]: ColorTypes | Record<string, ColorTypes>;
435
+ };
436
+ declare type WebColors = {
437
+ red: ColorScale<WebDesignToken<ColorValue>>;
438
+ orange: ColorScale<WebDesignToken<ColorValue>>;
439
+ yellow: ColorScale<WebDesignToken<ColorValue>>;
440
+ green: ColorScale<WebDesignToken<ColorValue>>;
441
+ teal: ColorScale<WebDesignToken<ColorValue>>;
442
+ blue: ColorScale<WebDesignToken<ColorValue>>;
443
+ purple: ColorScale<WebDesignToken<ColorValue>>;
444
+ pink: ColorScale<WebDesignToken<ColorValue>>;
445
+ neutral: ColorScale<WebDesignToken<ColorValue>>;
446
+ white: WebDesignToken<ColorValue>;
447
+ black: WebDesignToken<ColorValue>;
448
+ font: FontColors<WebDesignToken<ColorValue>>;
449
+ background: BackgroundColors<WebDesignToken<ColorValue>>;
450
+ border: BorderColors<WebDesignToken<ColorValue>>;
451
+ brand: {
452
+ primary: ColorScale<WebDesignToken<ColorValue>>;
453
+ secondary: ColorScale<WebDesignToken<ColorValue>>;
454
+ };
455
+ [key: string]: WebColorTypes | Record<string, WebColorTypes>;
456
+ };
457
+
458
+ declare type Fonts = {
459
+ default: {
460
+ variable: DesignToken<FontValue>;
461
+ static: DesignToken<FontValue>;
462
+ };
463
+ };
464
+ interface WebFonts {
465
+ default: {
466
+ [Property in keyof Fonts['default']]: WebDesignToken<FontValue>;
467
+ };
468
+ }
469
+
470
+ declare type FontSizes = {
471
+ xxxs: DesignToken<FontSizeValue>;
472
+ xxs: DesignToken<FontSizeValue>;
473
+ xs: DesignToken<FontSizeValue>;
474
+ small: DesignToken<FontSizeValue>;
475
+ medium: DesignToken<FontSizeValue>;
476
+ large: DesignToken<FontSizeValue>;
477
+ xl: DesignToken<FontSizeValue>;
478
+ xxl: DesignToken<FontSizeValue>;
479
+ xxxl: DesignToken<FontSizeValue>;
480
+ xxxxl: DesignToken<FontSizeValue>;
481
+ };
482
+ declare type WebFontSizes = {
483
+ [Property in keyof FontSizes]: WebDesignToken<FontSizeValue>;
484
+ };
485
+
486
+ declare type FontWeights = {
487
+ hairline: DesignToken<FontWeightValue>;
488
+ thin: DesignToken<FontWeightValue>;
489
+ light: DesignToken<FontWeightValue>;
490
+ normal: DesignToken<FontWeightValue>;
491
+ medium: DesignToken<FontWeightValue>;
492
+ semibold: DesignToken<FontWeightValue>;
493
+ bold: DesignToken<FontWeightValue>;
494
+ extrabold: DesignToken<FontWeightValue>;
495
+ black: DesignToken<FontWeightValue>;
496
+ };
497
+ declare type WebFontWeights = {
498
+ [Property in keyof FontWeights]: WebDesignToken<FontWeightValue>;
499
+ };
500
+
501
+ declare type LineHeights = {
502
+ small: DesignToken<LineHeightValue>;
503
+ medium: DesignToken<LineHeightValue>;
504
+ large: DesignToken<LineHeightValue>;
505
+ };
506
+ declare type WebLineHeights = {
507
+ [Property in keyof LineHeights]: WebDesignToken<LineHeightValue>;
508
+ };
509
+
510
+ declare type Opacities = {
511
+ 0: DesignToken<OpacityValue>;
512
+ 10: DesignToken<OpacityValue>;
513
+ 20: DesignToken<OpacityValue>;
514
+ 30: DesignToken<OpacityValue>;
515
+ 40: DesignToken<OpacityValue>;
516
+ 50: DesignToken<OpacityValue>;
517
+ 60: DesignToken<OpacityValue>;
518
+ 70: DesignToken<OpacityValue>;
519
+ 80: DesignToken<OpacityValue>;
520
+ 90: DesignToken<OpacityValue>;
521
+ 100: DesignToken<OpacityValue>;
522
+ };
523
+ declare type WebOpacities = {
524
+ [Property in keyof Opacities]: WebDesignToken<OpacityValue>;
525
+ };
526
+
527
+ declare type OutlineOffsets = {
528
+ small: DesignToken<OutlineOffsetValue>;
529
+ medium: DesignToken<OutlineOffsetValue>;
530
+ large: DesignToken<OutlineOffsetValue>;
531
+ };
532
+ declare type WebOutlineOffsets = {
533
+ [Property in keyof OutlineOffsets]: WebDesignToken<OutlineOffsetValue>;
534
+ };
535
+
536
+ declare type OutlineWidths = {
537
+ small: DesignToken<OutlineWidthValue>;
538
+ medium: DesignToken<OutlineWidthValue>;
539
+ large: DesignToken<OutlineWidthValue>;
540
+ };
541
+ declare type WebOutlineWidths = {
542
+ [Property in keyof OutlineWidths]: WebDesignToken<OutlineWidthValue>;
543
+ };
544
+
545
+ declare type Radii = {
546
+ xs: DesignToken<RadiusValue>;
547
+ small: DesignToken<RadiusValue>;
548
+ medium: DesignToken<RadiusValue>;
549
+ large: DesignToken<RadiusValue>;
550
+ xl: DesignToken<RadiusValue>;
551
+ xxl: DesignToken<RadiusValue>;
552
+ xxxl: DesignToken<RadiusValue>;
553
+ };
554
+ declare type WebRadii = {
555
+ [Property in keyof Radii]: WebDesignToken<RadiusValue>;
556
+ };
557
+
558
+ declare type Shadows = {
559
+ small: DesignToken<ShadowValue>;
560
+ medium: DesignToken<ShadowValue>;
561
+ large: DesignToken<ShadowValue>;
562
+ };
563
+ declare type WebShadows = {
564
+ [Property in keyof Shadows]: WebDesignToken<ShadowValue>;
565
+ };
566
+
567
+ declare type Space = {
568
+ xxxs: DesignToken<SpaceValue>;
569
+ xxs: DesignToken<SpaceValue>;
570
+ xs: DesignToken<SpaceValue>;
571
+ small: DesignToken<SpaceValue>;
572
+ medium: DesignToken<SpaceValue>;
573
+ large: DesignToken<SpaceValue>;
574
+ xl: DesignToken<SpaceValue>;
575
+ xxl: DesignToken<SpaceValue>;
576
+ xxxl: DesignToken<SpaceValue>;
577
+ relative: {
578
+ xxxs: DesignToken<SpaceValue>;
579
+ xxs: DesignToken<SpaceValue>;
580
+ xs: DesignToken<SpaceValue>;
581
+ small: DesignToken<SpaceValue>;
582
+ medium: DesignToken<SpaceValue>;
583
+ large: DesignToken<SpaceValue>;
584
+ xl: DesignToken<SpaceValue>;
585
+ xxl: DesignToken<SpaceValue>;
586
+ xxxl: DesignToken<SpaceValue>;
587
+ };
588
+ };
589
+ declare type WebSpace = {
590
+ [Property in keyof Omit<Space, 'relative'>]: WebDesignToken<SpaceValue>;
591
+ } & {
592
+ relative: {
593
+ [Property in keyof Space['relative']]: WebDesignToken<SpaceValue>;
594
+ };
595
+ };
596
+
597
+ declare type Time = {
598
+ short: DesignToken<TimeValue>;
599
+ medium: DesignToken<TimeValue>;
600
+ long: DesignToken<TimeValue>;
601
+ };
602
+ declare type WebTime = {
603
+ [Property in keyof Time]: WebDesignToken<TimeValue>;
604
+ };
605
+
606
+ declare type Transforms = {
607
+ slideX: {
608
+ small: DesignToken<TransformValue>;
609
+ medium: DesignToken<TransformValue>;
610
+ large: DesignToken<TransformValue>;
611
+ };
612
+ };
613
+ declare type WebTransforms = {
614
+ slideX: {
615
+ [Property in keyof Transforms['slideX']]: WebDesignToken<TransformValue>;
616
+ };
617
+ };
618
+
619
+ interface Tokens {
620
+ components: any;
621
+ borderWidths: BorderWidths;
622
+ colors: Colors;
623
+ fonts: Fonts;
624
+ fontSizes: FontSizes;
625
+ fontWeights: FontWeights;
626
+ lineHeights: LineHeights;
627
+ opacities: Opacities;
628
+ outlineOffsets: OutlineOffsets;
629
+ outlineWidths: OutlineWidths;
630
+ radii: Radii;
631
+ shadows: Shadows;
632
+ space: Space;
633
+ time: Time;
634
+ transforms: Transforms;
635
+ }
636
+ /**
637
+ * The fully setup theme tokens. It has the same shape as Tokens
638
+ * but each token has added fields.
639
+ */
640
+ interface WebTokens extends Tokens {
641
+ borderWidths: WebBorderWidths;
642
+ colors: WebColors;
643
+ fonts: WebFonts;
644
+ fontSizes: WebFontSizes;
645
+ fontWeights: WebFontWeights;
646
+ lineHeights: WebLineHeights;
647
+ opacities: WebOpacities;
648
+ outlineOffsets: WebOutlineOffsets;
649
+ outlineWidths: WebOutlineWidths;
650
+ radii: WebRadii;
651
+ shadows: WebShadows;
652
+ space: WebSpace;
653
+ time: WebTime;
654
+ transform: WebTransforms;
655
+ }
656
+
657
+ interface Breakpoints {
658
+ values: {
659
+ base: number;
660
+ small: number;
661
+ medium: number;
662
+ large: number;
663
+ xl: number;
664
+ xxl: number;
665
+ };
666
+ unit: string;
667
+ defaultBreakpoint: string;
668
+ }
669
+
670
+ /**
671
+ * An override is a set of tokens that override others
672
+ * in certain contexts. On Android, these are like resource
673
+ * qualifiers. On the web, these are like media queries with
674
+ * a set of CSS variables in it. A theme should contain
675
+ * everything it needs to render
676
+ */
677
+ declare type Override = SelectorOverride | MediaQueryOverride | BreakpointOverride | ColorModeOverride;
678
+ interface BaseOverride {
679
+ tokens?: PartialDeep<Tokens>;
680
+ }
681
+ /**
682
+ * This override takes a breakpoint name and creates a media-query for that
683
+ * breakpoint
684
+ * ```css
685
+ * @media (min-width: 20em) {
686
+ * [data-amplify-theme] {
687
+ * --amplify-font-size-large: 2rem;
688
+ * }
689
+ * }
690
+ * ```
691
+ */
692
+ interface BreakpointOverride extends BaseOverride {
693
+ breakpoint: keyof Breakpoints['values'];
694
+ }
695
+ /**
696
+ * ```css
697
+ * @media (prefers-color-scheme: dark) {
698
+ * --amplify-colors-background-primary: black;
699
+ * --amplify-colors-font-primary: white;
700
+ * }
701
+ * ```
702
+ */
703
+ interface MediaQueryOverride extends BaseOverride {
704
+ mediaQuery: string;
705
+ }
706
+ /**
707
+ * ```css
708
+ * .disco-theme {
709
+ * --amplify-colors-background-primary: pink;
710
+ * }
711
+ * [data-my-cool-theme] {
712
+ * --amplify-colors-font-primary: purple;
713
+ * }
714
+ * ```
715
+ */
716
+ interface SelectorOverride extends BaseOverride {
717
+ selector: string;
718
+ }
719
+ declare type ColorMode = 'light' | 'dark';
720
+ /**
721
+ * This creates a color mode override, where the color mode is 'light' or 'dark'.
722
+ * Note: there is no 'system' here.
723
+ *
724
+ * ```css
725
+ * @media(prefers-color-scheme: dark) {
726
+ * [data-amplify-color-mode="system"] {
727
+ * }
728
+ * }
729
+ *
730
+ * [data-amplify-color-mode="dark"] {
731
+ *
732
+ * }
733
+ * ```
734
+ */
735
+ interface ColorModeOverride extends BaseOverride {
736
+ colorMode: ColorMode;
737
+ }
738
+ /**
739
+ * A Theme just needs a name. This is what a user would generally deal with.
740
+ * They can define any tokens or breakpoints they need, but they don't need a
741
+ * complete theme with all tokens.
742
+ */
743
+ interface Theme {
744
+ /**
745
+ * The name of the theme. This is used to create scoped CSS to allow for
746
+ * multiple themes on a page.
747
+ */
748
+ name: string;
749
+ tokens?: PartialDeep<Tokens>;
750
+ breakpoints?: PartialDeep<Breakpoints>;
751
+ /**
752
+ * Overrides allow you to change design tokens in different contexts, like
753
+ * light and dark mode. You can also have other media query overrides as well
754
+ * as breakpoint overrides which correspond to the Breakpoints on a theme,
755
+ * and a generic selector override.
756
+ */
757
+ overrides?: Array<Override>;
758
+ }
759
+ /**
760
+ * A BaseTheme has all tokens and breakpoints required
761
+ */
762
+ interface BaseTheme extends Theme {
763
+ tokens: Tokens;
764
+ breakpoints: Breakpoints;
765
+ overrides?: Array<Override>;
766
+ }
767
+ /**
768
+ * WebTheme is a fully built theme that has cssText based
769
+ * on the design tokens and all design tokens have added fields
770
+ * to be used in Javascript/Typescript.
771
+ */
772
+ interface WebTheme extends BaseTheme {
773
+ tokens: WebTokens;
774
+ cssText: string;
775
+ }
776
+
777
+ /**
778
+ * This will be used like `const myTheme = createTheme({})`
779
+ * `myTheme` can then be passed to a Provider or the generated CSS
780
+ * can be passed to a stylesheet at build-time or run-time.
781
+ * const myTheme = createTheme({})
782
+ * const myOtherTheme = createTheme({}, myTheme);
783
+ */
784
+ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
785
+
786
+ declare const defaultTheme: WebTheme;
787
+
788
+ export { ActorContextWithForms, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoUserAmplify, ColorModeOverride, ColorValue, ContactMethod, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, InputAttributes, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, ShadowValue, SignInContext, SignInState, SignOutContext, SignOutState, SignUpAttribute, SignUpContext, SignUpFieldsWithDefaults, SignUpFieldsWithoutDefaults, SignUpState, SocialProvider, SpaceValue, Theme, TimeValue, TransformValue, ValidationError, Validator, ValidatorResult, WebDesignToken, WebTheme, authInputAttributes, censorAllButFirstAndLast, censorPhoneNumber, countryDialCodes, createAuthenticatorMachine, createTheme, defaultTheme, getActorContext, getActorState, getAliasInfoFromContext, getConfiguredAliases, getSendEventAliases, getServiceContextFacade, getServiceFacade, isDesignToken, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };