@aws-amplify/ui 6.0.9 → 6.0.11

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.
@@ -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 };
@@ -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';
@@ -31,7 +31,7 @@ const stopActor = (machineId) => stop(machineId);
31
31
  const LEGACY_WAIT_CONFIG = {
32
32
  on: {
33
33
  INIT: {
34
- actions: ['configure'],
34
+ actions: 'configure',
35
35
  target: 'getConfig',
36
36
  },
37
37
  SIGN_OUT: '#authenticator.signOut',
@@ -39,7 +39,7 @@ const LEGACY_WAIT_CONFIG = {
39
39
  };
40
40
  // setup step proceeds directly to configure
41
41
  const NEXT_WAIT_CONFIG = {
42
- always: { actions: ['configure'], target: 'getConfig' },
42
+ always: { actions: 'configure', target: 'getConfig' },
43
43
  };
44
44
  function createAuthenticatorMachine(options) {
45
45
  const { useNextWaitConfig, ...overrideConfigServices } = options ?? {};
@@ -165,6 +165,11 @@ function createAuthenticatorMachine(options) {
165
165
  cond: 'hasCompletedAttributeConfirmation',
166
166
  target: '#authenticator.getCurrentUser',
167
167
  },
168
+ {
169
+ cond: 'isShouldConfirmUserAttributeStep',
170
+ actions: 'setActorDoneData',
171
+ target: '#authenticator.verifyUserAttributesActor',
172
+ },
168
173
  {
169
174
  cond: 'isConfirmUserAttributeStep',
170
175
  target: '#authenticator.verifyUserAttributesActor',
@@ -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
@@ -1919,7 +1919,7 @@ const heDict$1 = {
1919
1919
  'Enter your Email': 'הכנס את המייל שלך',
1920
1920
  'Enter your phone number': 'הכנס את מספר הטלפון שלך',
1921
1921
  'Enter your username': 'הכנס את שם המתמש שלך',
1922
- 'Forgot your password?': 'שחכת סיסמא ?',
1922
+ 'Forgot your password?': 'שכחת סיסמא ?',
1923
1923
  'Hide password': 'הסתר סיסמא',
1924
1924
  Loading: 'טוען',
1925
1925
  'New password': 'סיסמא חדשה',
@@ -2815,6 +2815,18 @@ const censorPhoneNumber = (val) => {
2815
2815
  }
2816
2816
  return split.join('');
2817
2817
  };
2818
+ // censors all but the first and last of the name of an email and keeps domain
2819
+ const censorEmail = (val) => {
2820
+ const splitEmail = val.split('@');
2821
+ const censoredName = censorAllButFirstAndLast(splitEmail[0]);
2822
+ return `${censoredName}@${splitEmail[1]}`;
2823
+ };
2824
+ // based on the ContactMethod type, returns a censored contact value
2825
+ const censorContactMethod = (type, value) => {
2826
+ return type === 'Phone Number'
2827
+ ? censorPhoneNumber(value)
2828
+ : censorEmail(value);
2829
+ };
2818
2830
  const hasSpecialChars = (password) => ALLOWED_SPECIAL_CHARACTERS.some((char) => password.includes(char));
2819
2831
  const getTotpCodeURL = (issuer, username, secret) => encodeURI(`otpauth://totp/${issuer}:${username}?secret=${secret}&issuer=${issuer}`);
2820
2832
  function trimValues(values, ...ignored) {
@@ -4643,7 +4655,7 @@ const stopActor = (machineId) => stop(machineId);
4643
4655
  const LEGACY_WAIT_CONFIG = {
4644
4656
  on: {
4645
4657
  INIT: {
4646
- actions: ['configure'],
4658
+ actions: 'configure',
4647
4659
  target: 'getConfig',
4648
4660
  },
4649
4661
  SIGN_OUT: '#authenticator.signOut',
@@ -4651,7 +4663,7 @@ const LEGACY_WAIT_CONFIG = {
4651
4663
  };
4652
4664
  // setup step proceeds directly to configure
4653
4665
  const NEXT_WAIT_CONFIG = {
4654
- always: { actions: ['configure'], target: 'getConfig' },
4666
+ always: { actions: 'configure', target: 'getConfig' },
4655
4667
  };
4656
4668
  function createAuthenticatorMachine(options) {
4657
4669
  const { useNextWaitConfig, ...overrideConfigServices } = options ?? {};
@@ -4777,6 +4789,11 @@ function createAuthenticatorMachine(options) {
4777
4789
  cond: 'hasCompletedAttributeConfirmation',
4778
4790
  target: '#authenticator.getCurrentUser',
4779
4791
  },
4792
+ {
4793
+ cond: 'isShouldConfirmUserAttributeStep',
4794
+ actions: 'setActorDoneData',
4795
+ target: '#authenticator.verifyUserAttributesActor',
4796
+ },
4780
4797
  {
4781
4798
  cond: 'isConfirmUserAttributeStep',
4782
4799
  target: '#authenticator.verifyUserAttributesActor',
@@ -6031,8 +6048,11 @@ const checkbox = {
6031
6048
  },
6032
6049
  },
6033
6050
  label: {
6051
+ color: { value: '{components.text.color.value}' },
6034
6052
  _disabled: {
6035
- color: { value: '{colors.font.disabled.value}' },
6053
+ color: {
6054
+ value: '{colors.font.disabled.value}',
6055
+ },
6036
6056
  },
6037
6057
  },
6038
6058
  };
@@ -8318,6 +8338,8 @@ exports.authFieldsWithDefaults = authFieldsWithDefaults;
8318
8338
  exports.authenticatorTextUtil = authenticatorTextUtil;
8319
8339
  exports.capitalize = capitalize;
8320
8340
  exports.censorAllButFirstAndLast = censorAllButFirstAndLast;
8341
+ exports.censorContactMethod = censorContactMethod;
8342
+ exports.censorEmail = censorEmail;
8321
8343
  exports.censorPhoneNumber = censorPhoneNumber;
8322
8344
  exports.changePassword = changePassword;
8323
8345
  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
  }
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 {
@@ -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 {
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;
@@ -0,0 +1,11 @@
1
+ import { GetRoute } from './getRoute';
2
+ /**
3
+ * @internal Not to be used in production
4
+ * @description Debugging tool for logging `state` and `actorState`
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const getRouteWithLogs = logRouteChanges(getRoute);
9
+ * ```
10
+ */
11
+ export declare const logRouteChanges: (fn: GetRoute) => GetRoute;
@@ -1,2 +1,4 @@
1
1
  import { AuthActorState, AuthMachineState } from '../../machines/authenticator/types';
2
- export declare const getRoute: (state: AuthMachineState, actorState: AuthActorState) => "signIn" | "signUp" | "forceNewPassword" | "confirmResetPassword" | "confirmSignIn" | "confirmSignUp" | "confirmVerifyUser" | "forgotPassword" | "setupTotp" | "idle" | "setup" | "signOut" | "authenticated" | "verifyUser" | "transition";
2
+ import { AuthenticatorRoute } from './facade';
3
+ export type GetRoute = (state: AuthMachineState, actorState: AuthActorState) => AuthenticatorRoute;
4
+ export declare const getRoute: (state: AuthMachineState, actorState: AuthActorState) => AuthenticatorRoute;
@@ -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;
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui",
3
- "version": "6.0.9",
3
+ "version": "6.0.11",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {