@aws-amplify/ui 6.6.0 → 6.6.2

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.
@@ -25,7 +25,7 @@ const getAliasDefaultFormField = (state) => {
25
25
  };
26
26
  };
27
27
  /** Reusable confirmation code form fields. */
28
- const getConfirmationCodeFormFields = (state) => ({
28
+ const getConfirmationCodeFormFields = (_) => ({
29
29
  confirmation_code: {
30
30
  ...getDefaultFormField('confirmation_code'),
31
31
  label: 'Code *',
@@ -61,12 +61,13 @@ const getSignUpFormFields = (state) => {
61
61
  }
62
62
  else {
63
63
  // There's a `custom:*` attribute or one we don't already have an implementation for
64
+ // eslint-disable-next-line no-console
64
65
  console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize SignUp FormFields to add your own.`);
65
66
  }
66
67
  }
67
68
  return formField;
68
69
  };
69
- const getConfirmSignUpFormFields = (state) => ({
70
+ const getConfirmSignUpFormFields = (_) => ({
70
71
  confirmation_code: {
71
72
  ...getDefaultFormField('confirmation_code'),
72
73
  placeholder: 'Enter your code',
@@ -111,6 +112,7 @@ const getForceNewPasswordFormFields = (state) => {
111
112
  }
112
113
  else {
113
114
  // There's a `custom:*` attribute or one we don't already have an implementation for
115
+ // eslint-disable-next-line no-console
114
116
  console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize ForceNewPassword FormFields to add your own.`);
115
117
  }
116
118
  }
@@ -17,6 +17,7 @@ export { createAuthenticatorMachine } from './machines/authenticator/index.mjs';
17
17
  export { createTheme } from './theme/createTheme/createTheme.mjs';
18
18
  export { defineComponentTheme } from './theme/createTheme/defineComponentTheme.mjs';
19
19
  export { createComponentCSS } from './theme/createTheme/createComponentCSS.mjs';
20
+ export { createGlobalCSS } from './theme/createTheme/createGlobalCSS.mjs';
20
21
  export { cssNameTransform, isDesignToken, setupTokens } from './theme/createTheme/utils.mjs';
21
22
  export { createComponentClasses } from './theme/createTheme/createComponentClasses.mjs';
22
23
  export { defaultTheme } from './theme/defaultTheme.mjs';
@@ -27,6 +28,6 @@ export { isUnverifiedContactMethodType } from './types/authenticator/utils.mjs';
27
28
  export { LoginMechanismArray, authFieldsWithDefaults, isAuthFieldsWithDefaults, signUpFieldsWithDefault, signUpFieldsWithoutDefault } from './types/authenticator/attributes.mjs';
28
29
  export { ComponentClassName } from './types/primitives/componentClassName.mjs';
29
30
  export { setUserAgent } from './utils/setUserAgent/setUserAgent.mjs';
30
- export { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isTypedFunction, isUndefined, noop, sanitizeNamespaceImport, splitObject, templateJoin } from './utils/utils.mjs';
31
+ export { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isUndefined, noop, sanitizeNamespaceImport, splitObject, templateJoin } from './utils/utils.mjs';
31
32
  export { classNames } from './utils/classNames.mjs';
32
33
  export { humanFileSize } from './utils/humanFileSize.mjs';
@@ -55,7 +55,7 @@ const defaultServices = {
55
55
  handleForgotPasswordSubmit: confirmResetPassword,
56
56
  handleForgotPassword: resetPassword,
57
57
  // Validation hooks for overriding
58
- async validateCustomSignUp(formData, touchData) { },
58
+ async validateCustomSignUp(_, __) { },
59
59
  async validateFormPassword(formData, touchData, passwordSettings) {
60
60
  const { password } = formData;
61
61
  const { password: touched_password } = touchData;
@@ -105,7 +105,7 @@ const defaultServices = {
105
105
  };
106
106
  }
107
107
  },
108
- async validatePreferredUsername(formData, touchData) { },
108
+ async validatePreferredUsername(_, __) { },
109
109
  };
110
110
 
111
111
  export { defaultServices };
@@ -84,4 +84,4 @@ function createComponentCSS({ theme, components, }) {
84
84
  return cssText;
85
85
  }
86
86
 
87
- export { createComponentCSS };
87
+ export { createComponentCSS, recursiveComponentCSS };
@@ -0,0 +1,11 @@
1
+ import { recursiveComponentCSS } from './createComponentCSS.mjs';
2
+
3
+ function createGlobalCSS(css) {
4
+ let cssText = ``;
5
+ for (const [selector, styles] of Object.entries(css)) {
6
+ cssText += recursiveComponentCSS(selector, styles);
7
+ }
8
+ return cssText;
9
+ }
10
+
11
+ export { createGlobalCSS };
@@ -173,15 +173,6 @@ const classNameModifier = (base, modifier) => {
173
173
  const classNameModifierByFlag = (base, modifier, flag) => {
174
174
  return flag ? `${base}--${modifier}` : '';
175
175
  };
176
- /**
177
- * `isFunction` but types the param with its function signature
178
- *
179
- * @param {unknown} value param to check
180
- * @returns {boolean} whether `value` is a function
181
- */
182
- function isTypedFunction(value) {
183
- return isFunction(value);
184
- }
185
176
  /**
186
177
  * Similar to `Array.join`, with an optional callback/template param
187
178
  * for formatting returned string values
@@ -244,4 +235,4 @@ function splitObject(obj, predicate) {
244
235
  return [left, right];
245
236
  }
246
237
 
247
- export { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isTypedFunction, isUndefined, noop, sanitizeNamespaceImport, splitObject, templateJoin };
238
+ export { areEmptyArrays, areEmptyObjects, capitalize, classNameModifier, classNameModifierByFlag, groupLog, has, isEmpty, isEmptyObject, isFunction, isMap, isNil, isObject, isSet, isString, isUndefined, noop, sanitizeNamespaceImport, splitObject, templateJoin };
package/dist/index.js CHANGED
@@ -11,11 +11,11 @@ var pickBy = require('lodash/pickBy.js');
11
11
  var merge = require('lodash/merge.js');
12
12
  var kebabCase = require('lodash/kebabCase.js');
13
13
 
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
 
16
- var pickBy__default = /*#__PURE__*/_interopDefaultLegacy(pickBy);
17
- var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
18
- var kebabCase__default = /*#__PURE__*/_interopDefaultLegacy(kebabCase);
16
+ var pickBy__default = /*#__PURE__*/_interopDefault(pickBy);
17
+ var merge__default = /*#__PURE__*/_interopDefault(merge);
18
+ var kebabCase__default = /*#__PURE__*/_interopDefault(kebabCase);
19
19
 
20
20
  /**
21
21
  * This file contains helpers that lets you easily access current actor's state
@@ -255,15 +255,6 @@ const classNameModifier = (base, modifier) => {
255
255
  const classNameModifierByFlag = (base, modifier, flag) => {
256
256
  return flag ? `${base}--${modifier}` : '';
257
257
  };
258
- /**
259
- * `isFunction` but types the param with its function signature
260
- *
261
- * @param {unknown} value param to check
262
- * @returns {boolean} whether `value` is a function
263
- */
264
- function isTypedFunction(value) {
265
- return isFunction(value);
266
- }
267
258
  /**
268
259
  * Similar to `Array.join`, with an optional callback/template param
269
260
  * for formatting returned string values
@@ -3225,7 +3216,7 @@ const getAliasDefaultFormField = (state) => {
3225
3216
  };
3226
3217
  };
3227
3218
  /** Reusable confirmation code form fields. */
3228
- const getConfirmationCodeFormFields = (state) => ({
3219
+ const getConfirmationCodeFormFields = (_) => ({
3229
3220
  confirmation_code: {
3230
3221
  ...getDefaultFormField('confirmation_code'),
3231
3222
  label: 'Code *',
@@ -3261,12 +3252,13 @@ const getSignUpFormFields = (state) => {
3261
3252
  }
3262
3253
  else {
3263
3254
  // There's a `custom:*` attribute or one we don't already have an implementation for
3255
+ // eslint-disable-next-line no-console
3264
3256
  console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize SignUp FormFields to add your own.`);
3265
3257
  }
3266
3258
  }
3267
3259
  return formField;
3268
3260
  };
3269
- const getConfirmSignUpFormFields = (state) => ({
3261
+ const getConfirmSignUpFormFields = (_) => ({
3270
3262
  confirmation_code: {
3271
3263
  ...getDefaultFormField('confirmation_code'),
3272
3264
  placeholder: 'Enter your code',
@@ -3311,6 +3303,7 @@ const getForceNewPasswordFormFields = (state) => {
3311
3303
  }
3312
3304
  else {
3313
3305
  // There's a `custom:*` attribute or one we don't already have an implementation for
3306
+ // eslint-disable-next-line no-console
3314
3307
  console.debug(`Authenticator does not have a default implementation for ${fieldName}. Customize ForceNewPassword FormFields to add your own.`);
3315
3308
  }
3316
3309
  }
@@ -4005,7 +3998,7 @@ const defaultServices = {
4005
3998
  handleForgotPasswordSubmit: auth.confirmResetPassword,
4006
3999
  handleForgotPassword: auth.resetPassword,
4007
4000
  // Validation hooks for overriding
4008
- async validateCustomSignUp(formData, touchData) { },
4001
+ async validateCustomSignUp(_, __) { },
4009
4002
  async validateFormPassword(formData, touchData, passwordSettings) {
4010
4003
  const { password } = formData;
4011
4004
  const { password: touched_password } = touchData;
@@ -4055,7 +4048,7 @@ const defaultServices = {
4055
4048
  };
4056
4049
  }
4057
4050
  },
4058
- async validatePreferredUsername(formData, touchData) { },
4051
+ async validatePreferredUsername(_, __) { },
4059
4052
  };
4060
4053
 
4061
4054
  function forgotPasswordActor({ services, }) {
@@ -9058,6 +9051,14 @@ function defineComponentTheme({ name, theme, overrides, }) {
9058
9051
  };
9059
9052
  }
9060
9053
 
9054
+ function createGlobalCSS(css) {
9055
+ let cssText = ``;
9056
+ for (const [selector, styles] of Object.entries(css)) {
9057
+ cssText += recursiveComponentCSS(selector, styles);
9058
+ }
9059
+ return cssText;
9060
+ }
9061
+
9061
9062
  const darkModeTokens = {
9062
9063
  colors: {
9063
9064
  red: {
@@ -9207,6 +9208,7 @@ exports.countryDialCodes = countryDialCodes;
9207
9208
  exports.createAuthenticatorMachine = createAuthenticatorMachine;
9208
9209
  exports.createComponentCSS = createComponentCSS;
9209
9210
  exports.createComponentClasses = createComponentClasses;
9211
+ exports.createGlobalCSS = createGlobalCSS;
9210
9212
  exports.createTheme = createTheme;
9211
9213
  exports.cssNameTransform = cssNameTransform;
9212
9214
  exports.defaultAuthHubHandler = defaultAuthHubHandler;
@@ -9252,7 +9254,6 @@ exports.isNil = isNil;
9252
9254
  exports.isObject = isObject;
9253
9255
  exports.isSet = isSet;
9254
9256
  exports.isString = isString;
9255
- exports.isTypedFunction = isTypedFunction;
9256
9257
  exports.isUndefined = isUndefined;
9257
9258
  exports.isUnverifiedContactMethodType = isUnverifiedContactMethodType;
9258
9259
  exports.isValidEmail = isValidEmail;
@@ -204,8 +204,8 @@ export declare const defaultServices: {
204
204
  handleConfirmSignUp: typeof confirmSignUp;
205
205
  handleForgotPasswordSubmit: typeof confirmResetPassword;
206
206
  handleForgotPassword: typeof resetPassword;
207
- validateCustomSignUp(formData: AuthFormData, touchData: AuthTouchData): Promise<ValidatorResult>;
207
+ validateCustomSignUp(_: AuthFormData, __: AuthTouchData): Promise<ValidatorResult>;
208
208
  validateFormPassword(formData: AuthFormData, touchData: AuthTouchData, passwordSettings: PasswordSettings): Promise<ValidatorResult>;
209
209
  validateConfirmPassword(formData: AuthFormData, touchData: AuthTouchData): Promise<ValidatorResult>;
210
- validatePreferredUsername(formData: AuthFormData, touchData: AuthTouchData): Promise<ValidatorResult>;
210
+ validatePreferredUsername(_: AuthFormData, __: AuthTouchData): Promise<ValidatorResult>;
211
211
  };
@@ -1,2 +1,3 @@
1
1
  import { ComponentStyles } from './utils';
2
- export type ButtonGroupTheme<Required extends boolean = false> = ComponentStyles;
2
+ export interface ButtonGroupTheme extends ComponentStyles {
3
+ }
@@ -1,2 +1,3 @@
1
1
  import { ComponentStyles } from './utils';
2
- export type CheckboxFieldTheme<Required extends boolean = false> = ComponentStyles;
2
+ export interface CheckboxFieldTheme extends ComponentStyles {
3
+ }
@@ -1,2 +1,3 @@
1
1
  import { ComponentStyles } from './utils';
2
- export type SelectFieldTheme<Required extends boolean = false> = ComponentStyles;
2
+ export interface SelectFieldTheme extends ComponentStyles {
3
+ }
@@ -1,5 +1,7 @@
1
1
  import { WebTheme } from '../types';
2
2
  import { ComponentsTheme } from '../components';
3
+ import { BaseTheme } from '../components/utils';
4
+ export declare function recursiveComponentCSS(baseSelector: string, theme: BaseTheme): string;
3
5
  interface CreateComponentCSSParams {
4
6
  theme: Pick<WebTheme, 'tokens' | 'breakpoints' | 'name'>;
5
7
  components: Array<ComponentsTheme>;
@@ -0,0 +1,4 @@
1
+ import { ComponentStyles } from '../components/utils';
2
+ type GlobalCSS = Record<string, ComponentStyles>;
3
+ export declare function createGlobalCSS(css: GlobalCSS): string;
4
+ export {};
@@ -1,5 +1,6 @@
1
1
  export { createTheme } from './createTheme';
2
2
  export { defineComponentTheme } from './defineComponentTheme';
3
3
  export { createComponentCSS } from './createComponentCSS';
4
+ export { createGlobalCSS } from './createGlobalCSS';
4
5
  export { cssNameTransform, setupTokens, SetupToken, isDesignToken, } from './utils';
5
6
  export { createComponentClasses, ClassNameArgs, } from './createComponentClasses';
@@ -1,4 +1,4 @@
1
- export { createTheme, defineComponentTheme, createComponentClasses, createComponentCSS, cssNameTransform, isDesignToken, setupTokens, SetupToken, } from './createTheme';
1
+ export { createTheme, defineComponentTheme, createComponentClasses, createComponentCSS, createGlobalCSS, cssNameTransform, isDesignToken, setupTokens, SetupToken, } from './createTheme';
2
2
  export { BaseComponentTheme } from './components';
3
3
  export { defaultTheme } from './defaultTheme';
4
4
  export { defaultDarkModeOverride, reactNativeDarkTokens, } from './defaultDarkModeOverride';
@@ -117,13 +117,6 @@ export declare const classNameModifier: (base: string, modifier?: Modifiers) =>
117
117
  * @returns the modified class name or empty string
118
118
  */
119
119
  export declare const classNameModifierByFlag: (base: string, modifier: Modifiers, flag?: boolean) => string;
120
- /**
121
- * `isFunction` but types the param with its function signature
122
- *
123
- * @param {unknown} value param to check
124
- * @returns {boolean} whether `value` is a function
125
- */
126
- export declare function isTypedFunction<T extends (...args: any[]) => any>(value: unknown): value is T;
127
120
  /**
128
121
  * Similar to `Array.join`, with an optional callback/template param
129
122
  * for formatting returned string values
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui",
3
- "version": "6.6.0",
3
+ "version": "6.6.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "check:esm": "node --input-type=module --eval 'import \"@aws-amplify/ui\"'",
38
38
  "clean": "rimraf dist node_modules",
39
39
  "dev": "yarn build --watch",
40
- "lint": "yarn typecheck",
40
+ "lint": "yarn typecheck && eslint src --ext .js,.ts,.tsx",
41
41
  "prebuild": "rimraf dist",
42
42
  "test": "jest",
43
43
  "test:watch": "yarn test --watch",
@@ -49,7 +49,8 @@
49
49
  "tslib": "^2.5.2"
50
50
  },
51
51
  "peerDependencies": {
52
- "aws-amplify": "^6.3.2",
52
+ "@aws-amplify/core": "*",
53
+ "aws-amplify": "^6.6.0",
53
54
  "xstate": "^4.33.6"
54
55
  },
55
56
  "peerDependenciesMeta": {