diff --git a/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap b/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap index 0e2751f56..2224cf425 100644 --- a/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap +++ b/packages/studio-ui-codegen-react/lib/__tests__/__snapshots__/studio-ui-codegen-react.test.ts.snap @@ -10,7 +10,6 @@ import { Flex, FlexProps, Heading, - findChildOverrides, getOverrideProps, } from \\"@aws-amplify/ui-react\\"; @@ -36,7 +35,7 @@ export default function SiteHeader(props: SiteHeaderProps): React.ReactElement { + + ); +} +" +`; + +exports[`amplify render tests custom components custom parent should render component with ES5 1`] = ` +"var __assign = + (this && this.__assign) || + function () { + __assign = + Object.assign || + function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; +var __rest = + (this && this.__rest) || + function (s, e) { + var t = {}; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === \\"function\\") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if ( + e.indexOf(p[i]) < 0 && + Object.prototype.propertyIsEnumerable.call(s, p[i]) + ) + t[p[i]] = s[p[i]]; + } + return t; + }; +/* eslint-disable */ +import React from \\"react\\"; +import { Button, getOverrideProps } from \\"@aws-amplify/ui-react\\"; +import MyView from \\"./MyView\\"; +export default function CustomParent(props) { + var overridesProp = props.overrides, + rest = __rest(props, [\\"overrides\\"]); + var overrides = __assign({}, overridesProp); + return React.createElement( + MyView, + __assign({}, rest, getOverrideProps(overrides, \\"MyView\\")), + React.createElement( + Button, + __assign({}, getOverrideProps(overrides, \\"MyView.Button\\")) + ) + ); +} +" +`; + +exports[`amplify render tests custom components custom parent should render declarations 1`] = ` +"import React from \\"react\\"; +import { EscapeHatchProps } from \\"@aws-amplify/ui-react\\"; +import { MyViewProps } from \\"./MyView\\"; +export declare type CustomParentProps = Partial & { + overrides?: EscapeHatchProps | undefined | null; +}; +export default function CustomParent(props: CustomParentProps): React.ReactElement; +" +`; + exports[`amplify render tests custom render config should render ES5 1`] = ` "var __assign = (this && this.__assign) || @@ -1898,13 +2161,12 @@ exports[`amplify render tests sample code snippet tests should generate a sample "/* eslint-disable */ import React from \\"react\\"; import { - CustomButton, EscapeHatchProps, View, ViewProps, - findChildOverrides, getOverrideProps, } from \\"@aws-amplify/ui-react\\"; +import CustomButton from \\"./CustomButton\\"; export type ViewWithButtonProps = Partial & { overrides?: EscapeHatchProps | undefined | null; @@ -1920,7 +2182,7 @@ export default function ViewWithButton( color=\\"#ff0000\\" width=\\"20px\\" buttonText=\\"Click Me\\" - {...findChildOverrides(props.overrides, \\"CustomButton\\")} + {...getOverrideProps(overrides, \\"View.CustomButton\\")} > ); @@ -1938,7 +2200,6 @@ import { Flex, FlexProps, Heading, - findChildOverrides, getOverrideProps, } from \\"@aws-amplify/ui-react\\"; @@ -1973,7 +2234,7 @@ export default function SiteHeader(props: SiteHeaderProps): React.ReactElement {