@aws-amplify/ui-react 6.1.12 → 6.1.13
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/esm/primitives/Rating/RatingIcon.mjs +1 -1
- package/dist/esm/primitives/SearchField/SearchField.mjs +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +3 -3
- package/dist/styles/rating.css +1 -1
- package/dist/styles/rating.layer.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.layer.css +1 -1
- package/dist/types/context/elements/ElementsContext.d.ts +58 -0
- package/dist/types/context/elements/defineBaseElement.d.ts +26 -0
- package/dist/types/context/elements/index.d.ts +3 -0
- package/dist/types/context/elements/types.d.ts +31 -0
- package/dist/types/context/elements/withBaseElementProps.d.ts +32 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@ import { View } from '../View/View.mjs';
|
|
|
4
4
|
|
|
5
5
|
const RatingIcon = ({ icon, fill, className, }) => {
|
|
6
6
|
return (React.createElement(View, { as: "span", className: ComponentClassName.RatingItem, "aria-hidden": "true" },
|
|
7
|
-
React.createElement(View, { as: "span", className: classNames(className), color: fill }, icon)));
|
|
7
|
+
React.createElement(View, { as: "span", className: classNames(ComponentClassName.RatingIcon, className), color: fill }, icon)));
|
|
8
8
|
};
|
|
9
9
|
RatingIcon.displayName = 'RatingIcon';
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ const SearchFieldPrimitive = ({ autoComplete = 'off', className, isDisabled, cle
|
|
|
27
27
|
const SearchButton = hasSearchButton ? (React.createElement(SearchFieldButton, { isDisabled: isDisabled, onClick: onClick, ref: searchButtonRef, size: size })) : undefined;
|
|
28
28
|
const SearchIcon = hasSearchIcon ? (React.createElement(FieldGroupIcon, null,
|
|
29
29
|
React.createElement(IconSearch, null))) : undefined;
|
|
30
|
-
return (React.createElement(TextField, { autoComplete: autoComplete, className: classNames(ComponentClassName.SearchField, className), labelHidden: labelHidden, innerStartComponent: SearchIcon, innerEndComponent: React.createElement(FieldClearButton, { ariaLabel: clearButtonLabel,
|
|
30
|
+
return (React.createElement(TextField, { autoComplete: autoComplete, className: classNames(ComponentClassName.SearchField, className), labelHidden: labelHidden, innerStartComponent: SearchIcon, innerEndComponent: React.createElement(FieldClearButton, { ariaLabel: clearButtonLabel, isVisible: !isDisabled && strHasLength(composedValue), onClick: onClearHandler, size: size, variation: "link" }), isDisabled: isDisabled, name: name, onChange: handleOnChange, onKeyDown: onKeyDown, outerEndComponent: SearchButton, ref: composedRefs, size: size, value: composedValue, ...rest }));
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/searchfield)
|
package/dist/esm/version.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -553,7 +553,7 @@ const SearchFieldPrimitive = ({ autoComplete = 'off', className, isDisabled, cle
|
|
|
553
553
|
const SearchButton = hasSearchButton ? (React__namespace.createElement(SearchFieldButton, { isDisabled: isDisabled, onClick: onClick, ref: searchButtonRef, size: size })) : undefined;
|
|
554
554
|
const SearchIcon = hasSearchIcon ? (React__namespace.createElement(Field.FieldGroupIcon, null,
|
|
555
555
|
React__namespace.createElement(Field.IconSearch, null))) : undefined;
|
|
556
|
-
return (React__namespace.createElement(TextField, { autoComplete: autoComplete, className: ui.classNames(ui.ComponentClassName.SearchField, className), labelHidden: labelHidden, innerStartComponent: SearchIcon, innerEndComponent: React__namespace.createElement(Field.FieldClearButton, { ariaLabel: clearButtonLabel,
|
|
556
|
+
return (React__namespace.createElement(TextField, { autoComplete: autoComplete, className: ui.classNames(ui.ComponentClassName.SearchField, className), labelHidden: labelHidden, innerStartComponent: SearchIcon, innerEndComponent: React__namespace.createElement(Field.FieldClearButton, { ariaLabel: clearButtonLabel, isVisible: !isDisabled && Field.strHasLength(composedValue), onClick: onClearHandler, size: size, variation: "link" }), isDisabled: isDisabled, name: name, onChange: handleOnChange, onKeyDown: onKeyDown, outerEndComponent: SearchButton, ref: composedRefs, size: size, value: composedValue, ...rest }));
|
|
557
557
|
};
|
|
558
558
|
/**
|
|
559
559
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/searchfield)
|
|
@@ -1656,7 +1656,7 @@ const isIconMixed = (currentIconIndex, ratingValue) => {
|
|
|
1656
1656
|
|
|
1657
1657
|
const RatingIcon = ({ icon, fill, className, }) => {
|
|
1658
1658
|
return (React__namespace.createElement(Field.View, { as: "span", className: ui.ComponentClassName.RatingItem, "aria-hidden": "true" },
|
|
1659
|
-
React__namespace.createElement(Field.View, { as: "span", className: ui.classNames(className), color: fill }, icon)));
|
|
1659
|
+
React__namespace.createElement(Field.View, { as: "span", className: ui.classNames(ui.ComponentClassName.RatingIcon, className), color: fill }, icon)));
|
|
1660
1660
|
};
|
|
1661
1661
|
RatingIcon.displayName = 'RatingIcon';
|
|
1662
1662
|
|
|
@@ -2383,7 +2383,7 @@ const defaultDeleteUserDisplayText = {
|
|
|
2383
2383
|
warningText: 'Deleting your account is not reversible. You will lose access to your account and all data associated with it.',
|
|
2384
2384
|
};
|
|
2385
2385
|
|
|
2386
|
-
const VERSION = '6.1.
|
|
2386
|
+
const VERSION = '6.1.13';
|
|
2387
2387
|
|
|
2388
2388
|
const logger$2 = ui.getLogger('AccountSettings');
|
|
2389
2389
|
const getIsDisabled = (formValues, validationError) => {
|
package/dist/styles/rating.css
CHANGED
package/dist/styles.css
CHANGED
package/dist/styles.layer.css
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ElementDisplayName } from './types';
|
|
3
|
+
export interface Elements extends Partial<Record<ElementDisplayName, React.ComponentType>> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* `ElementsProvider` and its coresponding `useElement` hook provide
|
|
7
|
+
* access to the values of the nearest ancestral `ElementsContext`
|
|
8
|
+
* value.
|
|
9
|
+
*
|
|
10
|
+
* In most use cases, there is no need to directly invoke `useElement`;
|
|
11
|
+
* `ElementsContext` lookup is handled directly by `BaseElement`
|
|
12
|
+
* components returned by `defineBaseElement`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
*
|
|
16
|
+
* Add `ElementsContext` aware `BaseElement` components to a
|
|
17
|
+
* Connected Component
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* // `BaseElement`, renders custom or default element defintion
|
|
21
|
+
* const ViewElement = defineBaseElement({
|
|
22
|
+
* displayName: "View",
|
|
23
|
+
* type: "div",
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // `BaseElement` components to be provided through `ElementsContext`
|
|
27
|
+
* interface ConnectedComponentElements {
|
|
28
|
+
* View: typeof ViewElement;
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* function createConnectedComponent<T extends ConnectedComponentElements>(
|
|
32
|
+
* elements?: T
|
|
33
|
+
* ) {
|
|
34
|
+
* const Provider = ({ children }: { children?: React.ReactNode }) => (
|
|
35
|
+
* <ElementsProvider elements={elements}>
|
|
36
|
+
* <Children />
|
|
37
|
+
* </ElementsProvider>
|
|
38
|
+
* );
|
|
39
|
+
*
|
|
40
|
+
* function ConnectedComponent() {
|
|
41
|
+
* return (
|
|
42
|
+
* <Provider>
|
|
43
|
+
* <ConnectedComponentContent />
|
|
44
|
+
* </Provider>
|
|
45
|
+
* );
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* ConnectedComponent.Provider = Provider;
|
|
49
|
+
*
|
|
50
|
+
* return ConnectedComponent;
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function ElementsProvider<T extends Elements>({ elements, ...props }: {
|
|
55
|
+
children?: React.ReactNode;
|
|
56
|
+
elements?: T;
|
|
57
|
+
}): React.JSX.Element;
|
|
58
|
+
export declare const useElement: <T extends keyof Elements>(name: T) => Elements[T] | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseElement, BaseElementProps, ElementDisplayName, ElementRefType, ReactElementProps, ReactElementType } from './types';
|
|
2
|
+
export interface DefineBaseElementInput<T> {
|
|
3
|
+
/**
|
|
4
|
+
* `BaseElement` display name in React dev tools and stack traces
|
|
5
|
+
*/
|
|
6
|
+
displayName: ElementDisplayName;
|
|
7
|
+
/**
|
|
8
|
+
* base HTML `element` type
|
|
9
|
+
*/
|
|
10
|
+
type: T;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Defines a `ElementsContext` aware `BaseElement` UI component of the
|
|
14
|
+
* provided `type` with an assigned `displayName`.
|
|
15
|
+
*
|
|
16
|
+
* If `BaseElement` is used as a child of an `ElementsProvider`, returns the
|
|
17
|
+
* `BaseElement` value of the provided `displayName` of `ElementsContext`.
|
|
18
|
+
*
|
|
19
|
+
* When used outside of a parent `ElementsProvider` or no `BaseElement`
|
|
20
|
+
* of `displayName` is found in the `ElementsContext`, returns a stateless,
|
|
21
|
+
* unstyled HTML element of the provided `type`.
|
|
22
|
+
*
|
|
23
|
+
* @param {DefineBaseElementInput} input `BaseElement` parameters
|
|
24
|
+
* @returns {BaseElement} `ElementsContext` aware UI component
|
|
25
|
+
*/
|
|
26
|
+
export default function defineBaseElement<T extends ReactElementType, K extends keyof U = never, V = string, U extends ReactElementProps<T> = ReactElementProps<T>, P extends BaseElementProps<K, V, U> = BaseElementProps<K, V, U>>(input: DefineBaseElementInput<T>): BaseElement<P, ElementRefType<P>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Base type definition of `BaseElement` components available through
|
|
4
|
+
* `ElementsContext`. The definitions define a contract between a
|
|
5
|
+
* Connected Component and the `elements` that can be provided as
|
|
6
|
+
* overrides.
|
|
7
|
+
*
|
|
8
|
+
* `BaseElement` interfaces surface a minimal set of HTML semantic `props`
|
|
9
|
+
* required to achieve the base functionality of consumers. `props`
|
|
10
|
+
* are always optional at the interface level, allowing for additional `props`
|
|
11
|
+
* to be added to existing `BaseElement` interfaces as needed.
|
|
12
|
+
*/
|
|
13
|
+
export type BaseElement<T = {}, K = {}> = React.ForwardRefExoticComponent<React.PropsWithoutRef<T> & React.RefAttributes<K>>;
|
|
14
|
+
/**
|
|
15
|
+
* allowed values of `displayName` of `BaseElement` and `ElemebtsContext` keys
|
|
16
|
+
*/
|
|
17
|
+
export type ElementDisplayName = 'Button' | 'View' | 'Icon' | 'Input' | 'Span';
|
|
18
|
+
export type ElementRefType<T> = T extends {
|
|
19
|
+
ref?: React.LegacyRef<infer K> | React.Ref<infer K> | React.ForwardedRef<infer K>;
|
|
20
|
+
} ? K : never;
|
|
21
|
+
export type ReactElementType = keyof React.JSX.IntrinsicElements;
|
|
22
|
+
export type ReactElementProps<T extends ReactElementType> = React.JSX.IntrinsicElements[T];
|
|
23
|
+
/**
|
|
24
|
+
* key of `props` always available on `BaseElement` definitions
|
|
25
|
+
*/
|
|
26
|
+
type ElementPropKey<T> = T | 'children' | 'className' | 'style';
|
|
27
|
+
export type BaseElementProps<T extends keyof K, V = string, K extends Record<ElementPropKey<keyof K>, any> = Record<string, any>> = React.AriaAttributes & React.RefAttributes<ElementRefType<K>> & Pick<K, ElementPropKey<T>> & {
|
|
28
|
+
testId?: string;
|
|
29
|
+
variant?: V;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseElement, ElementRefType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Extend target `BaseElement` with `defaultProps`. `defaultProps`
|
|
5
|
+
* are overidden by `props` provided to returned `BaseElement`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* Extend `InputElement` with default `className` and `type`
|
|
10
|
+
* ```tsx
|
|
11
|
+
*
|
|
12
|
+
* // define extended `props` on `BaseElement` interface
|
|
13
|
+
* type InputElementPropKey = 'onChange' | 'type';
|
|
14
|
+
*
|
|
15
|
+
* // create `InputElement` base with `type` generic and extended `props` key
|
|
16
|
+
* export const InputElement = defineBaseElement<"input", InputElementPropKey>({
|
|
17
|
+
* type: "input",
|
|
18
|
+
* displayName: "Input",
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // extend base `InputElement` with default input `type` of `checkbox`
|
|
22
|
+
* const CheckboxElement = withBaseElementProps(Input, {
|
|
23
|
+
* className: 'submit-toggle__checkbox',
|
|
24
|
+
* type: 'checkbox',
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @param Target `BaseElement` to extend
|
|
29
|
+
* @param defaultProps `defaultProps` to apply to `Target`, accepts object or callback
|
|
30
|
+
* @returns extended `BaseElement` with `defaultProps`
|
|
31
|
+
*/
|
|
32
|
+
export default function withBaseElementProps<T, K extends T | (() => T)>(Target: React.ForwardRefExoticComponent<T>, defaultProps: K): BaseElement<T, ElementRefType<T>>;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "6.1.
|
|
1
|
+
export declare const VERSION = "6.1.13";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/ui-react",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"typecheck": "tsc --noEmit"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@aws-amplify/ui": "6.0.
|
|
53
|
-
"@aws-amplify/ui-react-core": "3.0.
|
|
52
|
+
"@aws-amplify/ui": "6.0.17",
|
|
53
|
+
"@aws-amplify/ui-react-core": "3.0.17",
|
|
54
54
|
"@radix-ui/react-direction": "1.0.0",
|
|
55
55
|
"@radix-ui/react-dropdown-menu": "1.0.0",
|
|
56
56
|
"@radix-ui/react-slider": "1.0.0",
|