@amplifyup/sdk 0.1.27 → 0.1.29

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/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import React, { ReactNode } from 'react';
3
3
  import { P as PageConfig, b as AmplifyUpConfig, C as ContentSource, A as AmplifyContentMeta } from './types-BxpG9Gsy.mjs';
4
4
  export { Z as ZoneConfig } from './types-BxpG9Gsy.mjs';
5
5
  export { AmplifyRenderer } from './AmplifyRenderer.mjs';
@@ -40,10 +40,12 @@ interface AmplifyPageContentProps {
40
40
  */
41
41
  declare function AmplifyPageContent({ fallback, renderComponent, pageConfig: pageConfigProp, forceComposerPreview, previewLoadingComponent, previewEmptyComponent, loadingComponent, emptyComponent, errorComponent, }: AmplifyPageContentProps): react_jsx_runtime.JSX.Element | null;
42
42
 
43
+ declare function useLiveComposerProps(layoutNodeId: string | undefined, props: Record<string, any>): Record<string, any>;
43
44
  /**
44
- * ComponentContextProvider - Provides slots and props to child components
45
- * This should wrap each component when rendering
45
+ * Live props for this layout node (CMS fields + settings).
46
+ * Same values `<Field>` reads — use this when you want to render yourself.
46
47
  */
48
+ declare function useComponentProps<T extends Record<string, any> = Record<string, any>>(): T;
47
49
  declare function ComponentContextProvider({ children, slots, props, layoutNodeId, componentId, }: {
48
50
  children: ReactNode;
49
51
  slots?: Record<string, ReactNode>;
@@ -81,37 +83,12 @@ declare function Slot({ name, className, }: {
81
83
  name: string;
82
84
  className?: string;
83
85
  }): react_jsx_runtime.JSX.Element | null;
84
- /**
85
- * Field Component
86
- *
87
- * Renders a field value from component props. Developers use this to define
88
- * where field values should appear in their component, with full control
89
- * over styling and formatting.
90
- *
91
- * For markdown / rich text fields, use {@link RichText} instead.
92
- *
93
- * @example
94
- * ```tsx
95
- * function Hero({ title, description }) {
96
- * return (
97
- * <section className="hero">
98
- * <h1>
99
- * <Field name="title" fallback="Default Title" />
100
- * </h1>
101
- * <p>
102
- * <Field name="description" />
103
- * </p>
104
- * </section>
105
- * );
106
- * }
107
- * ```
108
- */
109
86
  declare function Field({ name, fallback, className, render, }: {
110
87
  name: string;
111
88
  fallback?: ReactNode;
112
89
  className?: string;
113
90
  render?: (value: any) => ReactNode;
114
- }): react_jsx_runtime.JSX.Element | null;
91
+ }): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
115
92
  /**
116
93
  * RichText - Renders a markdown (or HTML string) field as formatted HTML.
117
94
  *
@@ -144,4 +121,4 @@ interface AmplifyUpProviderProps {
144
121
  declare function AmplifyUpProvider({ children, config }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
145
122
  declare function useAmplifyUp(): AmplifyUpContextType;
146
123
 
147
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ContentSource, Field, PageConfig, RichText, Slot, useAmplifyUp };
124
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ContentSource, Field, PageConfig, RichText, Slot, useAmplifyUp, useComponentProps, useLiveComposerProps };
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import React, { ReactNode } from 'react';
3
3
  import { P as PageConfig, b as AmplifyUpConfig, C as ContentSource, A as AmplifyContentMeta } from './types-BxpG9Gsy.js';
4
4
  export { Z as ZoneConfig } from './types-BxpG9Gsy.js';
5
5
  export { AmplifyRenderer } from './AmplifyRenderer.js';
@@ -40,10 +40,12 @@ interface AmplifyPageContentProps {
40
40
  */
41
41
  declare function AmplifyPageContent({ fallback, renderComponent, pageConfig: pageConfigProp, forceComposerPreview, previewLoadingComponent, previewEmptyComponent, loadingComponent, emptyComponent, errorComponent, }: AmplifyPageContentProps): react_jsx_runtime.JSX.Element | null;
42
42
 
43
+ declare function useLiveComposerProps(layoutNodeId: string | undefined, props: Record<string, any>): Record<string, any>;
43
44
  /**
44
- * ComponentContextProvider - Provides slots and props to child components
45
- * This should wrap each component when rendering
45
+ * Live props for this layout node (CMS fields + settings).
46
+ * Same values `<Field>` reads — use this when you want to render yourself.
46
47
  */
48
+ declare function useComponentProps<T extends Record<string, any> = Record<string, any>>(): T;
47
49
  declare function ComponentContextProvider({ children, slots, props, layoutNodeId, componentId, }: {
48
50
  children: ReactNode;
49
51
  slots?: Record<string, ReactNode>;
@@ -81,37 +83,12 @@ declare function Slot({ name, className, }: {
81
83
  name: string;
82
84
  className?: string;
83
85
  }): react_jsx_runtime.JSX.Element | null;
84
- /**
85
- * Field Component
86
- *
87
- * Renders a field value from component props. Developers use this to define
88
- * where field values should appear in their component, with full control
89
- * over styling and formatting.
90
- *
91
- * For markdown / rich text fields, use {@link RichText} instead.
92
- *
93
- * @example
94
- * ```tsx
95
- * function Hero({ title, description }) {
96
- * return (
97
- * <section className="hero">
98
- * <h1>
99
- * <Field name="title" fallback="Default Title" />
100
- * </h1>
101
- * <p>
102
- * <Field name="description" />
103
- * </p>
104
- * </section>
105
- * );
106
- * }
107
- * ```
108
- */
109
86
  declare function Field({ name, fallback, className, render, }: {
110
87
  name: string;
111
88
  fallback?: ReactNode;
112
89
  className?: string;
113
90
  render?: (value: any) => ReactNode;
114
- }): react_jsx_runtime.JSX.Element | null;
91
+ }): string | number | true | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null;
115
92
  /**
116
93
  * RichText - Renders a markdown (or HTML string) field as formatted HTML.
117
94
  *
@@ -144,4 +121,4 @@ interface AmplifyUpProviderProps {
144
121
  declare function AmplifyUpProvider({ children, config }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
145
122
  declare function useAmplifyUp(): AmplifyUpContextType;
146
123
 
147
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ContentSource, Field, PageConfig, RichText, Slot, useAmplifyUp };
124
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ContentSource, Field, PageConfig, RichText, Slot, useAmplifyUp, useComponentProps, useLiveComposerProps };