@aws-amplify/ui-react 5.0.0 → 5.0.1

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.
@@ -50,12 +50,7 @@ export interface CollectionWrapperProps extends BaseStyleProps {
50
50
  */
51
51
  searchNoResultsFound?: React.ReactNode;
52
52
  }
53
- export interface CollectionBaseProps<Item> {
54
- /**
55
- * @description
56
- * The items from a data source that will be mapped by the Collection component
57
- */
58
- items: Array<Item>;
53
+ interface CollectionChildren<Item> {
59
54
  /**
60
55
  * @description
61
56
  * The component to be repeated
@@ -63,11 +58,27 @@ export interface CollectionBaseProps<Item> {
63
58
  */
64
59
  children: (item: Item, index: number) => JSX.Element;
65
60
  }
61
+ export interface CollectionBaseProps<Item> extends CollectionChildren<Item> {
62
+ /**
63
+ * @description
64
+ * The items from a data source that will be mapped by the Collection component
65
+ */
66
+ items: Array<Item>;
67
+ }
66
68
  export type ListCollectionProps<Item> = BaseFlexProps & CollectionBaseProps<Item>;
67
69
  export type GridCollectionProps<Item> = BaseGridProps & CollectionBaseProps<Item>;
68
- export type BaseCollectionProps<Item, Element extends ElementType> = PrimitivePropsWithAs<CollectionWrapperProps, Element> & (({
70
+ /**
71
+ * Omits `React.ReactNode` as children to prevent intersection type for `children` of
72
+ * `React.ReactNode & (item: Item, index: number) => JSX.Element`
73
+ * and replaces with `CollectionChildren`
74
+ */
75
+ type ReplaceChildren<T, Item> = Omit<T, 'children'> & CollectionChildren<Item>;
76
+ export type BaseCollectionProps<Item, Element extends ElementType> = PrimitivePropsWithAs<CollectionWrapperProps, Element> & (ReplaceChildren<{
69
77
  type: 'list';
70
- } & ListCollectionProps<Item>) | ({
78
+ } & ListCollectionProps<Item>, Item> | ReplaceChildren<{
71
79
  type: 'grid';
72
- } & GridCollectionProps<Item>));
73
- export type CollectionProps<Item, Element extends ElementType = 'div'> = PrimitiveProps<BaseCollectionProps<Item, Element>, Element>;
80
+ } & GridCollectionProps<Item>, Item>);
81
+ export type CollectionProps<Item, Element extends ElementType = 'div'> = ReplaceChildren<PrimitiveProps<BaseCollectionProps<Item, Element> & {
82
+ children: React.ReactNode;
83
+ }, Element>, Item>;
84
+ export {};
@@ -1 +1 @@
1
- export declare const VERSION = "5.0.0";
1
+ export declare const VERSION = "5.0.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {