@aws-amplify/ui 5.5.5 → 5.5.6

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.
@@ -1,13 +1,13 @@
1
1
  import { DesignTokenProperties, OutputVariantKey } from '../types/designToken';
2
2
  export declare type AutocompleteTokens<OutputType extends OutputVariantKey> = {
3
3
  menu?: DesignTokenProperties<'backgroundColor' | 'borderColor' | 'borderRadius' | 'borderStyle' | 'borderWidth' | 'marginBlockStart' | 'width', OutputType> & {
4
- options: DesignTokenProperties<'display' | 'flexDirection' | 'maxHeight', OutputType>;
5
- option: DesignTokenProperties<'backgroundColor' | 'color' | 'cursor' | 'transitionDuration' | 'transitionProperty' | 'transitionTimingFunction', OutputType> & {
6
- _active: DesignTokenProperties<'backgroundColor' | 'color', OutputType>;
4
+ options?: DesignTokenProperties<'display' | 'flexDirection' | 'maxHeight', OutputType>;
5
+ option?: DesignTokenProperties<'backgroundColor' | 'color' | 'cursor' | 'transitionDuration' | 'transitionProperty' | 'transitionTimingFunction', OutputType> & {
6
+ _active?: DesignTokenProperties<'backgroundColor' | 'color', OutputType>;
7
7
  };
8
- _empty: DesignTokenProperties<'display', OutputType>;
9
- _loading: DesignTokenProperties<'alignItems' | 'display' | 'gap', OutputType>;
10
- spaceShared: DesignTokenProperties<'paddingBlock' | 'paddingInline', OutputType>;
8
+ _empty?: DesignTokenProperties<'display', OutputType>;
9
+ _loading?: DesignTokenProperties<'alignItems' | 'display' | 'gap', OutputType>;
10
+ spaceShared?: DesignTokenProperties<'paddingBlock' | 'paddingInline', OutputType>;
11
11
  };
12
12
  };
13
13
  export declare const autocomplete: Required<AutocompleteTokens<'default'>>;
@@ -2,11 +2,11 @@ import { DesignTokenProperties, OutputVariantKey } from '../types/designToken';
2
2
  declare type ButtonFocusToken<Output> = DesignTokenProperties<'outlineColor' | 'outlineStyle' | 'outlineWidth' | 'outlineOffset' | 'borderColor' | 'boxShadow', Output>;
3
3
  declare type BeforeToken<Output> = DesignTokenProperties<'width' | 'height' | 'borderWidth' | 'borderRadius' | 'borderStyle' | 'borderColor', Output>;
4
4
  declare type ButtonToken<Output> = DesignTokenProperties<'position' | 'alignItems' | 'justifyContent' | 'color', Output> & {
5
- before: BeforeToken<Output>;
6
- _focus: ButtonFocusToken<Output>;
7
- _disabled: DesignTokenProperties<'borderColor', Output>;
8
- _error: DesignTokenProperties<'borderColor', Output> & {
9
- _focus: DesignTokenProperties<'borderColor' | 'boxShadow', Output>;
5
+ before?: BeforeToken<Output>;
6
+ _focus?: ButtonFocusToken<Output>;
7
+ _disabled?: DesignTokenProperties<'borderColor', Output>;
8
+ _error?: DesignTokenProperties<'borderColor', Output> & {
9
+ _focus?: DesignTokenProperties<'borderColor' | 'boxShadow', Output>;
10
10
  };
11
11
  };
12
12
  declare type IconCheckedStateToken<Output> = DesignTokenProperties<'opacity' | 'transform'> & {
@@ -1,4 +1,4 @@
1
- import { PartialDeep } from 'type-fest';
1
+ import { PartialDeep } from '../types';
2
2
  import { DefaultTokens, Tokens, WebTokens } from './tokens';
3
3
  import { Breakpoints } from './breakpoints';
4
4
  export * from './tokens/types/designToken';
@@ -1 +1,96 @@
1
1
  export declare type NoInfer<T> = [T][T extends any ? 0 : never];
2
+ /**
3
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
4
+
5
+ @category Type
6
+ */
7
+ declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
8
+ /**
9
+ Matches any primitive, `Date`, or `RegExp` value.
10
+ */
11
+ declare type BuiltIns = Primitive | Date | RegExp;
12
+ /**
13
+ @see PartialDeep
14
+ */
15
+ export interface PartialDeepOptions {
16
+ /**
17
+ Whether to affect the individual elements of arrays and tuples.
18
+
19
+ @default true
20
+ */
21
+ readonly recurseIntoArrays?: boolean;
22
+ }
23
+ /**
24
+ Create a type from another type with all keys and nested keys set to optional.
25
+
26
+ Use-cases:
27
+ - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
28
+ - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
29
+
30
+ @example
31
+ ```
32
+ const settings: Settings = {
33
+ textEditor: {
34
+ fontSize: 14;
35
+ fontColor: '#000000';
36
+ fontWeight: 400;
37
+ }
38
+ autocomplete: false;
39
+ autosave: true;
40
+ };
41
+
42
+ const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
43
+ return {...settings, ...savedSettings};
44
+ }
45
+
46
+ settings = applySavedSettings({textEditor: {fontWeight: 500}});
47
+ ```
48
+
49
+ By default, this also affects array and tuple types:
50
+
51
+ ```
52
+
53
+ interface Settings {
54
+ languages: string[];
55
+ }
56
+
57
+ const partialSettings: PartialDeep<Settings> = {
58
+ languages: [undefined]
59
+ };
60
+ ```
61
+
62
+ If this is undesirable, you can pass `{recurseIntoArrays: false}` as the second type argument.
63
+
64
+ @category Object
65
+ @category Array
66
+ @category Set
67
+ @category Map
68
+ */
69
+ export declare type PartialDeep<T, Options extends PartialDeepOptions = {}> = T extends BuiltIns ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray<infer ItemType> ? Options['recurseIntoArrays'] extends false ? T : ItemType[] extends T ? readonly ItemType[] extends T ? ReadonlyArray<PartialDeep<ItemType | undefined, Options>> : Array<PartialDeep<ItemType | undefined, Options>> : PartialObjectDeep<T, Options> : PartialObjectDeep<T, Options> : unknown;
70
+ /**
71
+ Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
72
+ */
73
+ interface PartialMapDeep<KeyType, ValueType, Options extends PartialDeepOptions> extends Map<PartialDeep<KeyType, Options>, PartialDeep<ValueType, Options>> {
74
+ }
75
+ /**
76
+ Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
77
+ */
78
+ interface PartialSetDeep<T, Options extends PartialDeepOptions> extends Set<PartialDeep<T, Options>> {
79
+ }
80
+ /**
81
+ Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
82
+ */
83
+ interface PartialReadonlyMapDeep<KeyType, ValueType, Options extends PartialDeepOptions> extends ReadonlyMap<PartialDeep<KeyType, Options>, PartialDeep<ValueType, Options>> {
84
+ }
85
+ /**
86
+ Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
87
+ */
88
+ interface PartialReadonlySetDeep<T, Options extends PartialDeepOptions> extends ReadonlySet<PartialDeep<T, Options>> {
89
+ }
90
+ /**
91
+ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
92
+ */
93
+ declare type PartialObjectDeep<ObjectType extends object, Options extends PartialDeepOptions> = {
94
+ [KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType], Options>;
95
+ };
96
+ export {};
@@ -1,17 +1,3 @@
1
- /**
2
- * We re-export any lodash imports to avoid appending .js extension across codebase
3
- * The ultimate goal is have replacement implementation to remove the entire dependency
4
- */
5
- export { default as isEqual } from 'lodash/isEqual.js';
6
- export { default as isEmpty } from 'lodash/isEmpty.js';
7
- export { default as debounce } from 'lodash/debounce.js';
8
- export { default as isNil } from 'lodash/isNil.js';
9
- export { default as includes } from 'lodash/includes.js';
10
- export { default as get } from 'lodash/get.js';
11
- export { default as pickBy } from 'lodash/pickBy.js';
12
- export { default as has } from 'lodash/has.js';
13
- export { default as kebabCase } from 'lodash/kebabCase.js';
14
- export { default as merge } from 'lodash/merge.js';
15
1
  /**
16
2
  * Some libraries may not follow Node ES module spec and could be loaded as CommonJS modules,
17
3
  * To ensure the interoperability between ESM and CJS, modules from those libraries have to be loaded via namespace import
@@ -35,6 +21,20 @@ export declare function isObject(value: unknown): value is object;
35
21
  * @returns {boolean} Returns `true` if `value` is a string, `false` otherwise
36
22
  */
37
23
  export declare function isString(value: unknown): value is string;
24
+ /**
25
+ * Checks if `value` is a Map
26
+ *
27
+ * @param {unknown} value The value to check
28
+ * @returns {boolean} Returns `true` if `value` is a Map, `false` otherwise
29
+ */
30
+ export declare function isMap(value: unknown): value is Map<unknown, unknown>;
31
+ /**
32
+ * Checks if `value` is a Set
33
+ *
34
+ * @param {unknown} value The value to check
35
+ * @returns {boolean} Returns `true` if `value` is a Set, `false` otherwise
36
+ */
37
+ export declare function isSet<T>(value: unknown): value is Set<T>;
38
38
  /**
39
39
  * Checks if `value` is undefined
40
40
  *
@@ -43,8 +43,52 @@ export declare function isString(value: unknown): value is string;
43
43
  */
44
44
  export declare function isUndefined(value: unknown): value is undefined;
45
45
  /**
46
+ * Checks if `value` is nullish
46
47
  *
47
- * @param value capitalizes `value` and its type.
48
- * @returns Capitalized `value`
48
+ * @param {unknown} value The value to check
49
+ * @returns {boolean} Returns `true` if `value` is nullish, `false` otherwise
50
+ */
51
+ export declare function isNil(value: unknown): value is null | undefined;
52
+ /**
53
+ * Checks if `value` is empty
54
+ *
55
+ * @param {unknown} value The value to check
56
+ * @returns {boolean} Returns `true` if `value` is empty, `false` otherwise
57
+ */
58
+ export declare function isEmpty<T>(value: T): boolean;
59
+ /**
60
+ * Checks if all members of the `values` param are empty arrays
61
+ *
62
+ * @param {unknown} value The values to check
63
+ * @returns {boolean} Returns `true` if all members of `values` are empty, `false` otherwise
64
+ */
65
+ export declare function areEmptyArrays<T>(...values: T[]): boolean;
66
+ /**
67
+ * Checks if all members of the `values` param are empty objects
68
+ *
69
+ * @param {unknown} values The values to check
70
+ * @returns {boolean} Returns `true` if all members of the `values` param are empty, `false` otherwise
71
+ */
72
+ export declare function areEmptyObjects<T>(...values: T[]): boolean;
73
+ /**
74
+ * Capitalizes `value` and its return type
75
+ *
76
+ * @param {string} value string to capitalize
77
+ * @returns {string} capitalized string
49
78
  */
50
79
  export declare function capitalize<T extends string>(value: T): Capitalize<T>;
80
+ /**
81
+ * Checks if `key` is a direct property of `value`
82
+ *
83
+ * @param {unknown} value `object` potentially containing property
84
+ * @param {string} key property key
85
+ * @returns whether `key` param is a property of the `obj` param
86
+ */
87
+ export declare function has(value: unknown, key: string): boolean;
88
+ /**
89
+ * Checks if `value` is a function
90
+ *
91
+ * @param {unknown} value param to check
92
+ * @returns {boolean} whether `value` is a function
93
+ */
94
+ export declare function isFunction(value: unknown): value is Function;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui",
3
- "version": "5.5.5",
3
+ "version": "5.5.6",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -76,8 +76,7 @@
76
76
  "rollup-plugin-terser": "^7.0.2",
77
77
  "sass": "^1.35.2",
78
78
  "ts-jest": "^27.0.3",
79
- "ts-node": "^10.2.1",
80
- "type-fest": "^2.3.4"
79
+ "ts-node": "^10.2.1"
81
80
  },
82
81
  "sideEffects": [
83
82
  "dist/**/*.css"