@aws-amplify/ui 6.0.10 → 6.0.12

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.
@@ -10,7 +10,7 @@ const getChallengeText = (challengeName) => {
10
10
  case 'SOFTWARE_TOKEN_MFA':
11
11
  return translate(DefaultTexts.CONFIRM_TOTP);
12
12
  default:
13
- throw new Error(`${translate('Unexpected challengeName encountered in ConfirmSignIn:')} ${challengeName}`);
13
+ return translate(DefaultTexts.CONFIRM_MFA_DEFAULT);
14
14
  }
15
15
  };
16
16
  /**
@@ -21,6 +21,18 @@ const censorPhoneNumber = (val) => {
21
21
  }
22
22
  return split.join('');
23
23
  };
24
+ // censors all but the first and last of the name of an email and keeps domain
25
+ const censorEmail = (val) => {
26
+ const splitEmail = val.split('@');
27
+ const censoredName = censorAllButFirstAndLast(splitEmail[0]);
28
+ return `${censoredName}@${splitEmail[1]}`;
29
+ };
30
+ // based on the ContactMethod type, returns a censored contact value
31
+ const censorContactMethod = (type, value) => {
32
+ return type === 'Phone Number'
33
+ ? censorPhoneNumber(value)
34
+ : censorEmail(value);
35
+ };
24
36
  const hasSpecialChars = (password) => ALLOWED_SPECIAL_CHARACTERS.some((char) => password.includes(char));
25
37
  const getTotpCodeURL = (issuer, username, secret) => encodeURI(`otpauth://totp/${issuer}:${username}?secret=${secret}&issuer=${issuer}`);
26
38
  function trimValues(values, ...ignored) {
@@ -35,4 +47,4 @@ const isValidEmail = (value) => {
35
47
  return emailRegex.test(value);
36
48
  };
37
49
 
38
- export { censorAllButFirstAndLast, censorPhoneNumber, getTotpCodeURL, hasSpecialChars, isValidEmail, trimValues };
50
+ export { censorAllButFirstAndLast, censorContactMethod, censorEmail, censorPhoneNumber, getTotpCodeURL, hasSpecialChars, isValidEmail, trimValues };
@@ -15,6 +15,8 @@ const defaultTexts = {
15
15
  CONFIRM_RESET_PASSWORD_HEADING: 'Reset your Password',
16
16
  CONFIRM_SIGNUP_HEADING: 'Confirm Sign Up',
17
17
  CONFIRM_SMS: 'Confirm SMS Code',
18
+ // If challenge name is not returned
19
+ CONFIRM_MFA_DEFAULT: 'Confirm MFA Code',
18
20
  CONFIRM_TOTP: 'Confirm TOTP Code',
19
21
  CONFIRM: 'Confirm',
20
22
  CONFIRMATION_CODE: 'Confirmation Code',
@@ -9,6 +9,7 @@ const enDict = {
9
9
  'Confirm Password': 'Confirm Password',
10
10
  'Confirm Sign Up': 'Confirm Sign Up',
11
11
  'Confirm SMS Code': 'Confirm SMS Code',
12
+ 'Confirm MFA Code': 'Confirm MFA Code',
12
13
  'Confirm TOTP Code': 'Confirm TOTP Code',
13
14
  Confirm: 'Confirm',
14
15
  'Confirmation Code': 'Confirmation Code',
@@ -20,7 +20,7 @@ const heDict = {
20
20
  'Enter your Email': 'הכנס את המייל שלך',
21
21
  'Enter your phone number': 'הכנס את מספר הטלפון שלך',
22
22
  'Enter your username': 'הכנס את שם המתמש שלך',
23
- 'Forgot your password?': 'שחכת סיסמא ?',
23
+ 'Forgot your password?': 'שכחת סיסמא ?',
24
24
  'Hide password': 'הסתר סיסמא',
25
25
  Loading: 'טוען',
26
26
  'New password': 'סיסמא חדשה',
@@ -3,7 +3,7 @@ export { defaultAuthHubHandler, listenToAuthHub } from './helpers/authenticator/
3
3
  export { getNextServiceContextFacade, getNextServiceFacade, getSendEventAliases, getServiceContextFacade, getServiceFacade } from './helpers/authenticator/facade.mjs';
4
4
  export { ALLOWED_SPECIAL_CHARACTERS, NAVIGABLE_ROUTE_EVENT, defaultFormFieldOptions, emailRegex } from './helpers/authenticator/constants.mjs';
5
5
  export { getErrors, getFormDataFromEvent, isAuthFieldWithDefaults, setFormOrder } from './helpers/authenticator/form.mjs';
6
- export { censorAllButFirstAndLast, censorPhoneNumber, getTotpCodeURL, hasSpecialChars, isValidEmail, trimValues } from './helpers/authenticator/utils.mjs';
6
+ export { censorAllButFirstAndLast, censorContactMethod, censorEmail, censorPhoneNumber, getTotpCodeURL, hasSpecialChars, isValidEmail, trimValues } from './helpers/authenticator/utils.mjs';
7
7
  export { getCustomFormFields, getDefaultFormFields, getFormFields, getSortedFormFields, removeOrderKeys } from './helpers/authenticator/formFields/formFields.mjs';
8
8
  export { DEFAULT_COUNTRY_CODE, defaultFormFieldsGetters, getAliasDefaultFormField } from './helpers/authenticator/formFields/defaults.mjs';
9
9
  export { applyTranslation, getPrimaryAlias, sortFormFields } from './helpers/authenticator/formFields/utils.mjs';
@@ -276,6 +276,7 @@ function createAuthenticatorMachine(options) {
276
276
  ]),
277
277
  setActorDoneData: assign({
278
278
  actorDoneData: (context, event) => ({
279
+ challengeName: event.data.challengeName,
279
280
  codeDeliveryDetails: event.data.codeDeliveryDetails,
280
281
  missingAttributes: event.data.missingAttributes,
281
282
  remoteError: event.data.remoteError,
@@ -64,8 +64,11 @@ const checkbox = {
64
64
  },
65
65
  },
66
66
  label: {
67
+ color: { value: '{components.text.color.value}' },
67
68
  _disabled: {
68
- color: { value: '{colors.font.disabled.value}' },
69
+ color: {
70
+ value: '{colors.font.disabled.value}',
71
+ },
69
72
  },
70
73
  },
71
74
  };
package/dist/index.js CHANGED
@@ -752,6 +752,7 @@ const enDict$1 = {
752
752
  'Confirm Password': 'Confirm Password',
753
753
  'Confirm Sign Up': 'Confirm Sign Up',
754
754
  'Confirm SMS Code': 'Confirm SMS Code',
755
+ 'Confirm MFA Code': 'Confirm MFA Code',
755
756
  'Confirm TOTP Code': 'Confirm TOTP Code',
756
757
  Confirm: 'Confirm',
757
758
  'Confirmation Code': 'Confirmation Code',
@@ -1919,7 +1920,7 @@ const heDict$1 = {
1919
1920
  'Enter your Email': 'הכנס את המייל שלך',
1920
1921
  'Enter your phone number': 'הכנס את מספר הטלפון שלך',
1921
1922
  'Enter your username': 'הכנס את שם המתמש שלך',
1922
- 'Forgot your password?': 'שחכת סיסמא ?',
1923
+ 'Forgot your password?': 'שכחת סיסמא ?',
1923
1924
  'Hide password': 'הסתר סיסמא',
1924
1925
  Loading: 'טוען',
1925
1926
  'New password': 'סיסמא חדשה',
@@ -2050,6 +2051,8 @@ const defaultTexts$1 = {
2050
2051
  CONFIRM_RESET_PASSWORD_HEADING: 'Reset your Password',
2051
2052
  CONFIRM_SIGNUP_HEADING: 'Confirm Sign Up',
2052
2053
  CONFIRM_SMS: 'Confirm SMS Code',
2054
+ // If challenge name is not returned
2055
+ CONFIRM_MFA_DEFAULT: 'Confirm MFA Code',
2053
2056
  CONFIRM_TOTP: 'Confirm TOTP Code',
2054
2057
  CONFIRM: 'Confirm',
2055
2058
  CONFIRMATION_CODE: 'Confirmation Code',
@@ -2815,6 +2818,18 @@ const censorPhoneNumber = (val) => {
2815
2818
  }
2816
2819
  return split.join('');
2817
2820
  };
2821
+ // censors all but the first and last of the name of an email and keeps domain
2822
+ const censorEmail = (val) => {
2823
+ const splitEmail = val.split('@');
2824
+ const censoredName = censorAllButFirstAndLast(splitEmail[0]);
2825
+ return `${censoredName}@${splitEmail[1]}`;
2826
+ };
2827
+ // based on the ContactMethod type, returns a censored contact value
2828
+ const censorContactMethod = (type, value) => {
2829
+ return type === 'Phone Number'
2830
+ ? censorPhoneNumber(value)
2831
+ : censorEmail(value);
2832
+ };
2818
2833
  const hasSpecialChars = (password) => ALLOWED_SPECIAL_CHARACTERS.some((char) => password.includes(char));
2819
2834
  const getTotpCodeURL = (issuer, username, secret) => encodeURI(`otpauth://totp/${issuer}:${username}?secret=${secret}&issuer=${issuer}`);
2820
2835
  function trimValues(values, ...ignored) {
@@ -3051,7 +3066,7 @@ const getChallengeText = (challengeName) => {
3051
3066
  case 'SOFTWARE_TOKEN_MFA':
3052
3067
  return translate(DefaultTexts.CONFIRM_TOTP);
3053
3068
  default:
3054
- throw new Error(`${translate('Unexpected challengeName encountered in ConfirmSignIn:')} ${challengeName}`);
3069
+ return translate(DefaultTexts.CONFIRM_MFA_DEFAULT);
3055
3070
  }
3056
3071
  };
3057
3072
  /**
@@ -4888,6 +4903,7 @@ function createAuthenticatorMachine(options) {
4888
4903
  ]),
4889
4904
  setActorDoneData: xstate.assign({
4890
4905
  actorDoneData: (context, event) => ({
4906
+ challengeName: event.data.challengeName,
4891
4907
  codeDeliveryDetails: event.data.codeDeliveryDetails,
4892
4908
  missingAttributes: event.data.missingAttributes,
4893
4909
  remoteError: event.data.remoteError,
@@ -6036,8 +6052,11 @@ const checkbox = {
6036
6052
  },
6037
6053
  },
6038
6054
  label: {
6055
+ color: { value: '{components.text.color.value}' },
6039
6056
  _disabled: {
6040
- color: { value: '{colors.font.disabled.value}' },
6057
+ color: {
6058
+ value: '{colors.font.disabled.value}',
6059
+ },
6041
6060
  },
6042
6061
  },
6043
6062
  };
@@ -8323,6 +8342,8 @@ exports.authFieldsWithDefaults = authFieldsWithDefaults;
8323
8342
  exports.authenticatorTextUtil = authenticatorTextUtil;
8324
8343
  exports.capitalize = capitalize;
8325
8344
  exports.censorAllButFirstAndLast = censorAllButFirstAndLast;
8345
+ exports.censorContactMethod = censorContactMethod;
8346
+ exports.censorEmail = censorEmail;
8326
8347
  exports.censorPhoneNumber = censorPhoneNumber;
8327
8348
  exports.changePassword = changePassword;
8328
8349
  exports.classNameModifier = classNameModifier;
@@ -512,6 +512,7 @@
512
512
  --amplify-components-checkbox-icon-indeterminate-opacity: var(--amplify-opacities-100);
513
513
  --amplify-components-checkbox-icon-indeterminate-transform: scale(1);
514
514
  --amplify-components-checkbox-icon-indeterminate-disabled-background-color: var(--amplify-colors-background-disabled);
515
+ --amplify-components-checkbox-label-color: var(--amplify-components-text-color);
515
516
  --amplify-components-checkbox-label-disabled-color: var(--amplify-colors-font-disabled);
516
517
  --amplify-components-checkboxfield-align-items: flex-start;
517
518
  --amplify-components-checkboxfield-align-content: center;
@@ -513,6 +513,7 @@
513
513
  --amplify-components-checkbox-icon-indeterminate-opacity: var(--amplify-opacities-100);
514
514
  --amplify-components-checkbox-icon-indeterminate-transform: scale(1);
515
515
  --amplify-components-checkbox-icon-indeterminate-disabled-background-color: var(--amplify-colors-background-disabled);
516
+ --amplify-components-checkbox-label-color: var(--amplify-components-text-color);
516
517
  --amplify-components-checkbox-label-disabled-color: var(--amplify-colors-font-disabled);
517
518
  --amplify-components-checkboxfield-align-items: flex-start;
518
519
  --amplify-components-checkboxfield-align-content: center;
@@ -91,5 +91,8 @@
91
91
  }
92
92
 
93
93
  .amplify-checkbox__label {
94
- color: inherit;
94
+ color: var(--amplify-components-checkbox-label-color);
95
+ }
96
+ .amplify-checkbox__label--disabled {
97
+ color: var(--amplify-components-checkbox-label-disabled-color);
95
98
  }
@@ -92,6 +92,9 @@
92
92
  }
93
93
 
94
94
  .amplify-checkbox__label {
95
- color: inherit;
95
+ color: var(--amplify-components-checkbox-label-color);
96
+ }
97
+ .amplify-checkbox__label--disabled {
98
+ color: var(--amplify-components-checkbox-label-disabled-color);
96
99
  }
97
100
  }
@@ -282,7 +282,7 @@
282
282
 
283
283
  .amplify-liveness-landscape-error-modal {
284
284
  background-color: var(--amplify-colors-background-primary);
285
- direction: column;
285
+ flex-direction: column;
286
286
  text-align: center;
287
287
  align-items: center;
288
288
  justify-content: center;
@@ -283,7 +283,7 @@
283
283
 
284
284
  .amplify-liveness-landscape-error-modal {
285
285
  background-color: var(--amplify-colors-background-primary);
286
- direction: column;
286
+ flex-direction: column;
287
287
  text-align: center;
288
288
  align-items: center;
289
289
  justify-content: center;
package/dist/styles.css CHANGED
@@ -512,6 +512,7 @@
512
512
  --amplify-components-checkbox-icon-indeterminate-opacity: var(--amplify-opacities-100);
513
513
  --amplify-components-checkbox-icon-indeterminate-transform: scale(1);
514
514
  --amplify-components-checkbox-icon-indeterminate-disabled-background-color: var(--amplify-colors-background-disabled);
515
+ --amplify-components-checkbox-label-color: var(--amplify-components-text-color);
515
516
  --amplify-components-checkbox-label-disabled-color: var(--amplify-colors-font-disabled);
516
517
  --amplify-components-checkboxfield-align-items: flex-start;
517
518
  --amplify-components-checkboxfield-align-content: center;
@@ -3668,7 +3669,10 @@ strong.amplify-text {
3668
3669
  }
3669
3670
 
3670
3671
  .amplify-checkbox__label {
3671
- color: inherit;
3672
+ color: var(--amplify-components-checkbox-label-color);
3673
+ }
3674
+ .amplify-checkbox__label--disabled {
3675
+ color: var(--amplify-components-checkbox-label-disabled-color);
3672
3676
  }
3673
3677
 
3674
3678
  .amplify-checkboxfield {
@@ -4201,7 +4205,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4201
4205
 
4202
4206
  .amplify-liveness-landscape-error-modal {
4203
4207
  background-color: var(--amplify-colors-background-primary);
4204
- direction: column;
4208
+ flex-direction: column;
4205
4209
  text-align: center;
4206
4210
  align-items: center;
4207
4211
  justify-content: center;
@@ -513,6 +513,7 @@
513
513
  --amplify-components-checkbox-icon-indeterminate-opacity: var(--amplify-opacities-100);
514
514
  --amplify-components-checkbox-icon-indeterminate-transform: scale(1);
515
515
  --amplify-components-checkbox-icon-indeterminate-disabled-background-color: var(--amplify-colors-background-disabled);
516
+ --amplify-components-checkbox-label-color: var(--amplify-components-text-color);
516
517
  --amplify-components-checkbox-label-disabled-color: var(--amplify-colors-font-disabled);
517
518
  --amplify-components-checkboxfield-align-items: flex-start;
518
519
  --amplify-components-checkboxfield-align-content: center;
@@ -3669,7 +3670,10 @@ strong.amplify-text {
3669
3670
  }
3670
3671
 
3671
3672
  .amplify-checkbox__label {
3672
- color: inherit;
3673
+ color: var(--amplify-components-checkbox-label-color);
3674
+ }
3675
+ .amplify-checkbox__label--disabled {
3676
+ color: var(--amplify-components-checkbox-label-disabled-color);
3673
3677
  }
3674
3678
 
3675
3679
  .amplify-checkboxfield {
@@ -4202,7 +4206,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4202
4206
 
4203
4207
  .amplify-liveness-landscape-error-modal {
4204
4208
  background-color: var(--amplify-colors-background-primary);
4205
- direction: column;
4209
+ flex-direction: column;
4206
4210
  text-align: center;
4207
4211
  align-items: center;
4208
4212
  justify-content: center;
package/dist/theme.css CHANGED
@@ -509,6 +509,7 @@
509
509
  --amplify-components-checkbox-icon-indeterminate-opacity: var(--amplify-opacities-100);
510
510
  --amplify-components-checkbox-icon-indeterminate-transform: scale(1);
511
511
  --amplify-components-checkbox-icon-indeterminate-disabled-background-color: var(--amplify-colors-background-disabled);
512
+ --amplify-components-checkbox-label-color: var(--amplify-components-text-color);
512
513
  --amplify-components-checkbox-label-disabled-color: var(--amplify-colors-font-disabled);
513
514
  --amplify-components-checkboxfield-align-items: flex-start;
514
515
  --amplify-components-checkboxfield-align-content: center;
@@ -1,5 +1,8 @@
1
+ import type { ContactMethod } from '../../types';
1
2
  export declare const censorAllButFirstAndLast: (value: string) => string;
2
3
  export declare const censorPhoneNumber: (val: string) => string;
4
+ export declare const censorEmail: (val: string) => string;
5
+ export declare const censorContactMethod: (type: ContactMethod, value: string) => string;
3
6
  export declare const hasSpecialChars: (password: string) => boolean;
4
7
  export declare const getTotpCodeURL: (issuer: string, username: string, secret: string) => string;
5
8
  export declare function trimValues<T extends Record<string, string>>(values: T, ...ignored: string[]): T;
@@ -15,6 +15,7 @@ export declare const defaultTexts: {
15
15
  CONFIRM_RESET_PASSWORD_HEADING: string;
16
16
  CONFIRM_SIGNUP_HEADING: string;
17
17
  CONFIRM_SMS: string;
18
+ CONFIRM_MFA_DEFAULT: string;
18
19
  CONFIRM_TOTP: string;
19
20
  CONFIRM: string;
20
21
  CONFIRMATION_CODE: string;
@@ -951,6 +951,7 @@ export declare const defaultTexts: {
951
951
  CONFIRM_RESET_PASSWORD_HEADING: string;
952
952
  CONFIRM_SIGNUP_HEADING: string;
953
953
  CONFIRM_SMS: string;
954
+ CONFIRM_MFA_DEFAULT: string;
954
955
  CONFIRM_TOTP: string;
955
956
  CONFIRM: string;
956
957
  CONFIRMATION_CODE: string;
@@ -26,6 +26,7 @@ export declare const DefaultTexts: {
26
26
  readonly CONFIRM_RESET_PASSWORD_HEADING: string;
27
27
  readonly CONFIRM_SIGNUP_HEADING: string;
28
28
  readonly CONFIRM_SMS: string;
29
+ readonly CONFIRM_MFA_DEFAULT: string;
29
30
  readonly CONFIRM_TOTP: string;
30
31
  readonly CONFIRM: string;
31
32
  readonly CONFIRMATION_CODE: string;
@@ -50,6 +50,7 @@ export interface AuthEvent {
50
50
  * Data that actor returns when they are done and reach the final state
51
51
  */
52
52
  export interface ActorDoneData {
53
+ challengeName?: ChallengeName;
53
54
  codeDeliveryDetails?: V5CodeDeliveryDetails;
54
55
  missingAttributes?: string[];
55
56
  remoteError?: string;
@@ -20,7 +20,7 @@ export type CheckboxTokens<Output extends OutputVariantKey> = DesignTokenPropert
20
20
  _disabled?: DesignTokenProperties<'cursor', Output>;
21
21
  button?: ButtonToken<Output>;
22
22
  icon?: IconToken<Output>;
23
- label?: {
23
+ label?: DesignTokenProperties<'color', Output> & {
24
24
  _disabled?: DesignTokenProperties<'color', Output>;
25
25
  };
26
26
  };
@@ -51,6 +51,8 @@ export interface FormFieldOptions {
51
51
  type?: string;
52
52
  /** Desired autocomplete HTML attribute */
53
53
  autocomplete?: string;
54
+ /** Whether the first character is auto-capitalized */
55
+ autocapitalize?: string;
54
56
  }
55
57
  export interface LegacyFormFieldOptions extends FormFieldOptions {
56
58
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui",
3
- "version": "6.0.10",
3
+ "version": "6.0.12",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {