@aws-amplify/ui 3.0.13 → 3.1.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.
package/dist/index.d.ts CHANGED
@@ -45,12 +45,18 @@ declare const defaultServices: {
45
45
  };
46
46
 
47
47
  declare type AuthFormData = Record<string, string>;
48
+ interface ActorDoneData {
49
+ authAttributes?: AuthFormData;
50
+ intent?: string;
51
+ user?: CognitoUserAmplify;
52
+ }
48
53
  interface AuthContext {
49
54
  actorRef?: any;
50
55
  config?: {
51
56
  loginMechanisms?: LoginMechanism[];
52
57
  signUpAttributes?: SignUpAttribute[];
53
58
  socialProviders?: SocialProvider[];
59
+ formFields?: FormFields;
54
60
  initialState?: 'signIn' | 'signUp' | 'resetPassword';
55
61
  };
56
62
  services?: Partial<typeof defaultServices>;
@@ -59,6 +65,7 @@ interface AuthContext {
59
65
  password?: string;
60
66
  code?: string;
61
67
  mfaType?: AuthChallengeNames.SMS_MFA | AuthChallengeNames.SOFTWARE_TOKEN_MFA;
68
+ actorDoneData?: Omit<ActorDoneData, 'user'>;
62
69
  }
63
70
  interface ServicesContext {
64
71
  username?: string;
@@ -83,6 +90,7 @@ interface BaseFormContext {
83
90
  interface SignInContext extends BaseFormContext {
84
91
  loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
85
92
  socialProviders: Required<AuthContext>['config']['socialProviders'];
93
+ formFields?: FormFields;
86
94
  attributeToVerify?: string;
87
95
  redirectIntent?: string;
88
96
  unverifiedAttributes?: Record<string, string>;
@@ -95,17 +103,20 @@ declare type SignUpAttribute = SignUpFieldsWithDefaults | SignUpFieldsWithoutDef
95
103
  interface SignUpContext extends BaseFormContext {
96
104
  loginMechanisms: Required<AuthContext>['config']['loginMechanisms'];
97
105
  socialProviders: Required<AuthContext>['config']['socialProviders'];
106
+ formFields: FormFields;
98
107
  unverifiedAttributes?: Record<string, string>;
99
108
  }
100
109
  interface ResetPasswordContext extends BaseFormContext {
101
110
  username?: string;
102
111
  unverifiedAttributes?: Record<string, string>;
112
+ formFields?: FormFields;
103
113
  }
104
114
  interface SignOutContext {
105
115
  authAttributes?: Record<string, any>;
106
116
  challengeName?: string;
107
117
  unverifiedAttributes?: Record<string, string>;
108
118
  user?: CognitoUserAmplify;
119
+ formFields?: FormFields;
109
120
  }
110
121
  declare type ActorContextWithForms = SignInContext | SignUpContext | ResetPasswordContext;
111
122
  declare type SignInState = State<SignInContext, AuthEvent>;
@@ -139,8 +150,31 @@ interface InputAttributes {
139
150
  autocomplete?: string;
140
151
  }
141
152
  declare const LoginMechanismArray: readonly ["username", "email", "phone_number"];
153
+ declare type CommonFields = 'username' | 'password' | 'confirm_password';
142
154
  declare type LoginMechanism = typeof LoginMechanismArray[number];
143
155
  declare type SocialProvider = 'amazon' | 'apple' | 'facebook' | 'google';
156
+ declare type formFieldComponents = 'signIn' | 'signUp' | 'forceNewPassword' | 'confirmResetPassword' | 'confirmSignIn' | 'confirmSignUp' | 'confirmVerifyUser' | 'resetPassword' | 'setupTOTP';
157
+ declare type FormFields = {
158
+ [key in formFieldComponents]?: formField;
159
+ };
160
+ interface formField {
161
+ [key: string]: formFieldTypes;
162
+ }
163
+ interface formFieldTypes {
164
+ labelHidden?: boolean;
165
+ label?: string;
166
+ placeholder?: string;
167
+ /**
168
+ * @deprecated Internal use only, please use `isRequired` instead.
169
+ */
170
+ required?: boolean;
171
+ isRequired?: boolean;
172
+ dialCode?: string;
173
+ totpIssuer?: string;
174
+ totpUsername?: string;
175
+ dialCodeList?: Array<string>;
176
+ order?: number;
177
+ }
144
178
  declare type AuthFieldsWithDefaults = LoginMechanism | SignUpFieldsWithDefaults | 'confirmation_code' | 'password';
145
179
  declare type AuthInputAttributes = Record<AuthFieldsWithDefaults, InputAttributes>;
146
180
  declare type AuthEventData = Record<PropertyKey, any>;
@@ -260,6 +294,10 @@ declare const listenToAuthHub: (send: AuthMachineSend) => () => void;
260
294
  declare type ContactMethod = 'Email' | 'Phone Number';
261
295
  declare const censorAllButFirstAndLast: (value: string) => string;
262
296
  declare const censorPhoneNumber: (val: string) => string;
297
+ declare const getFormDataFromEvent: (event: Event) => {
298
+ [k: string]: FormDataEntryValue;
299
+ };
300
+ declare const setFormOrder: (formOverrides: formField, fieldNames: Array<SignUpAttribute | CommonFields>) => Array<string | number>;
263
301
 
264
302
  declare const countryDialCodes: string[];
265
303
 
@@ -452,9 +490,13 @@ interface OrdinalVariation<DesignTokenType = DesignToken<ColorValue>> {
452
490
  }
453
491
 
454
492
  declare type ScaleKeys = 10 | 20 | 40 | 60 | 80 | 90 | 100;
493
+ declare type OverlayKeys = 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90;
455
494
  declare type ColorScale<DesignTokenType = DesignToken<ColorValue>> = {
456
495
  [key in ScaleKeys]: DesignTokenType;
457
496
  };
497
+ declare type OverlayColors<DesignTokenType = DesignToken<ColorValue>> = {
498
+ [key in OverlayKeys]: DesignTokenType;
499
+ };
458
500
  declare type FontColors<DesignTokenType = DesignToken<ColorValue>> = {
459
501
  inverse: DesignTokenType;
460
502
  interactive: DesignTokenType;
@@ -494,6 +536,7 @@ declare type Colors = {
494
536
  primary: ColorScale;
495
537
  secondary: ColorScale;
496
538
  };
539
+ overlay: OverlayColors;
497
540
  [key: string]: ColorTypes | Record<string, ColorTypes>;
498
541
  };
499
542
  declare type WebColors = {
@@ -515,6 +558,7 @@ declare type WebColors = {
515
558
  primary: ColorScale<WebDesignToken<ColorValue>>;
516
559
  secondary: ColorScale<WebDesignToken<ColorValue>>;
517
560
  };
561
+ overlay: OverlayColors<WebDesignToken<ColorValue>>;
518
562
  [key: string]: WebColorTypes | Record<string, WebColorTypes>;
519
563
  };
520
564
 
@@ -847,4 +891,4 @@ declare function createTheme(theme?: Theme, baseTheme?: BaseTheme): WebTheme;
847
891
 
848
892
  declare const defaultTheme: WebTheme;
849
893
 
850
- export { ActorContextWithForms, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineSend, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoAttributes, 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, ServicesContext, ShadowValue, SignInContext, SignInResult, SignInState, SignInTypes, 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, hasTranslation, isDesignToken, listenToAuthHub, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };
894
+ export { ActorContextWithForms, ActorDoneData, AuthActorContext, AuthActorState, AuthChallengeNames, AuthContext, AuthEvent, AuthEventData, AuthEventTypes, AuthFieldsWithDefaults, AuthFormData, AuthInputAttributes, AuthInterpreter, AuthMachineSend, AuthMachineState, AuthenticatorMachineOptions, BaseTheme, BorderWidthValue, CognitoAttributes, CognitoUserAmplify, ColorModeOverride, ColorValue, CommonFields, ContactMethod, DefaultTexts, DesignToken, Dict, FederatedIdentityProviders, FontSizeValue, FontValue, FontWeightValue, FormFields, InputAttributes, InvokeActorEventTypes, LineHeightValue, LoginMechanism, LoginMechanismArray, MediaQueryOverride, NoInfer, OpacityValue, OutlineOffsetValue, OutlineWidthValue, Override, Phrase, RadiusValue, ResetPasswordContext, ResetPasswordState, SelectorOverride, ServicesContext, ShadowValue, SignInContext, SignInResult, SignInState, SignInTypes, SignOutContext, SignOutState, SignUpAttribute, SignUpContext, SignUpFieldsWithDefaults, SignUpFieldsWithoutDefaults, SignUpState, SocialProvider, SpaceValue, Theme, TimeValue, TransformValue, ValidationError, Validator, ValidatorResult, WebDesignToken, WebTheme, authInputAttributes, censorAllButFirstAndLast, censorPhoneNumber, countryDialCodes, createAuthenticatorMachine, createTheme, defaultTheme, formField, formFieldComponents, formFieldTypes, getActorContext, getActorState, getAliasInfoFromContext, getConfiguredAliases, getFormDataFromEvent, getSendEventAliases, getServiceContextFacade, getServiceFacade, hasTranslation, isDesignToken, listenToAuthHub, setFormOrder, signUpFieldsWithDefault, signUpFieldsWithoutDefault, translate, translations };