@aws-amplify/ui-react 6.1.11 → 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.
@@ -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, excludeFromTabOrder: true, 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 }));
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)
@@ -23,7 +23,7 @@ const SelectPrimitive = ({ autoComplete, className, size, variation, value, defa
23
23
  : defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, multiple: isMultiple, size: selectSize, required: isRequired, className: componentClasses, ref: ref, ...rest },
24
24
  placeholder && React.createElement("option", { value: "" }, placeholder),
25
25
  children),
26
- isExpanded ? null : (React.createElement(Flex, { className: classNames(ComponentClassName.SelectIcon, classNameModifier(ComponentClassName.SelectIcon, size)), color: iconColor }, icon ?? icons?.expand ?? React.createElement(IconExpandMore, null)))));
26
+ isExpanded ? null : (React.createElement(Flex, { className: classNames(ComponentClassName.SelectIcon, classNameModifier(ComponentClassName.SelectIcon, size)), color: iconColor, "aria-hidden": "true" }, icon ?? icons?.expand ?? React.createElement(IconExpandMore, null)))));
27
27
  };
28
28
  const Select = primitiveWithForwardRef(SelectPrimitive);
29
29
  Select.displayName = 'Select';
@@ -1,3 +1,3 @@
1
- const VERSION = '6.1.11';
1
+ const VERSION = '6.1.13';
2
2
 
3
3
  export { VERSION };
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, excludeFromTabOrder: true, 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 }));
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)
@@ -1501,7 +1501,7 @@ const SelectPrimitive = ({ autoComplete, className, size, variation, value, defa
1501
1501
  : defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, multiple: isMultiple, size: selectSize, required: isRequired, className: componentClasses, ref: ref, ...rest },
1502
1502
  placeholder && React__namespace.createElement("option", { value: "" }, placeholder),
1503
1503
  children),
1504
- isExpanded ? null : (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.SelectIcon, ui.classNameModifier(ui.ComponentClassName.SelectIcon, size)), color: iconColor }, icon ?? icons?.expand ?? React__namespace.createElement(Field.IconExpandMore, null)))));
1504
+ isExpanded ? null : (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.SelectIcon, ui.classNameModifier(ui.ComponentClassName.SelectIcon, size)), color: iconColor, "aria-hidden": "true" }, icon ?? icons?.expand ?? React__namespace.createElement(Field.IconExpandMore, null)))));
1505
1505
  };
1506
1506
  const Select = Field.primitiveWithForwardRef(SelectPrimitive);
1507
1507
  Select.displayName = 'Select';
@@ -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.11';
2386
+ const VERSION = '6.1.13';
2387
2387
 
2388
2388
  const logger$2 = ui.getLogger('AccountSettings');
2389
2389
  const getIsDisabled = (formValues, validationError) => {
@@ -1,5 +1,5 @@
1
1
  .amplify-rating {
2
- display: inline-flex;
2
+ display: flex;
3
3
  position: relative;
4
4
  text-align: left;
5
5
  font-size: var(--amplify-components-rating-default-size);
@@ -1,6 +1,6 @@
1
1
  @layer amplify.components {
2
2
  .amplify-rating {
3
- display: inline-flex;
3
+ display: flex;
4
4
  position: relative;
5
5
  text-align: left;
6
6
  font-size: var(--amplify-components-rating-default-size);
package/dist/styles.css CHANGED
@@ -4682,7 +4682,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4682
4682
  }
4683
4683
 
4684
4684
  .amplify-rating {
4685
- display: inline-flex;
4685
+ display: flex;
4686
4686
  position: relative;
4687
4687
  text-align: left;
4688
4688
  font-size: var(--amplify-components-rating-default-size);
@@ -4683,7 +4683,7 @@ html[dir=rtl] .amplify-field-group__inner-start {
4683
4683
  }
4684
4684
 
4685
4685
  .amplify-rating {
4686
- display: inline-flex;
4686
+ display: flex;
4687
4687
  position: relative;
4688
4688
  text-align: left;
4689
4689
  font-size: var(--amplify-components-rating-default-size);
@@ -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,3 @@
1
+ export { default as defineBaseElement } from './defineBaseElement';
2
+ export { default as withBaseElementProps } from './withBaseElementProps';
3
+ export { ElementsProvider } from './ElementsContext';
@@ -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>>;
@@ -1 +1 @@
1
- export declare const VERSION = "6.1.11";
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.11",
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.16",
53
- "@aws-amplify/ui-react-core": "3.0.16",
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",