@amplifyup/sdk 0.1.62 → 0.1.63

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,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.mjs';
3
3
  export { Z as ZoneConfig } from './types-Db_eLrfU.mjs';
4
- import React__default, { ReactNode } from 'react';
5
- import { L as LayoutComponentProps, F as Field$1 } from './AmplifyRenderer-W7eqltSj.mjs';
6
- export { A as AmplifyRenderer, b as Fields, I as ImageValue, a as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-W7eqltSj.mjs';
4
+ import react__default, { ReactNode } from 'react';
5
+ import { L as LayoutComponentProps, F as Field$1, C as CollectionField, a as Fields } from './AmplifyRenderer-TawbUIKZ.mjs';
6
+ export { A as AmplifyRenderer, I as ImageValue, P as PortableRef, b as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-TawbUIKZ.mjs';
7
7
  export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-DIZjc7st.mjs';
8
8
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
9
9
 
@@ -81,16 +81,50 @@ declare function Slot({ name, className, }: {
81
81
  name: string;
82
82
  className?: string;
83
83
  }): react_jsx_runtime.JSX.Element | null;
84
- declare function Field(props: {
85
- /** Envelope from `props.fields` (`{ value, name }`). */
86
- field?: Field$1<unknown>;
84
+ type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
85
+ /**
86
+ * Field Component
87
+ *
88
+ * Pass a field envelope: `<Field field={fields.title} />`.
89
+ * For a computed value, pass `value` and `name`.
90
+ *
91
+ * For markdown / rich text fields, use {@link RichText} instead.
92
+ * List fields use {@link Collection} (repeaters) or `.value` (reference lists).
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * function Hero({ fields }: { fields: Fields<{ title: string; description: string }> }) {
97
+ * return (
98
+ * <section className="hero">
99
+ * <h1>
100
+ * <Field field={fields.title} />
101
+ * </h1>
102
+ * <p>{fields.description.value}</p>
103
+ * </section>
104
+ * );
105
+ * }
106
+ * ```
107
+ */
108
+ declare function Field<T = unknown>(props: {
109
+ /** Envelope from `props.fields` (`{ value, name }`). Arrays are not allowed. */
110
+ field?: Field$1<RejectArray<T>>;
87
111
  /** Computed value — requires `name`. */
88
- value?: unknown;
112
+ value?: RejectArray<T>;
89
113
  /** Required with `value` for computed values. */
90
114
  name?: string;
91
115
  className?: string;
92
- render?: (value: any) => ReactNode;
93
- }): string | number | true | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null;
116
+ }): react_jsx_runtime.JSX.Element | null;
117
+ /**
118
+ * Repeater (inline-authored list). Inside Composer: empty placeholder plus
119
+ * add / remove / reorder. Outside Composer: children only.
120
+ *
121
+ * Reference lists are not canvas-bound — map `fields.posts.value` instead.
122
+ */
123
+ declare function Collection<T extends Record<string, unknown>>({ field, children, className, }: {
124
+ field: CollectionField<T> | Field$1<T[]>;
125
+ children: (item: Fields<T>, index: number) => ReactNode;
126
+ className?: string;
127
+ }): react_jsx_runtime.JSX.Element | null;
94
128
  /**
95
129
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
96
130
  *
@@ -142,7 +176,7 @@ declare function Image(props: {
142
176
  /** Required with `value` for computed values. */
143
177
  name?: string;
144
178
  alt?: string;
145
- } & Omit<React__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
179
+ } & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
146
180
 
147
181
  declare function ComposerProvider({ layoutNodeId, children, }: {
148
182
  layoutNodeId?: string;
@@ -173,4 +207,4 @@ interface AmplifyUpProviderProps {
173
207
  declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
174
208
  declare function useAmplifyUp(): AmplifyUpContextType;
175
209
 
176
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
210
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, Collection, CollectionField, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Fields, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
package/dist/react.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.js';
3
3
  export { Z as ZoneConfig } from './types-Db_eLrfU.js';
4
- import React__default, { ReactNode } from 'react';
5
- import { L as LayoutComponentProps, F as Field$1 } from './AmplifyRenderer-BQ8-H2H4.js';
6
- export { A as AmplifyRenderer, b as Fields, I as ImageValue, a as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-BQ8-H2H4.js';
4
+ import react__default, { ReactNode } from 'react';
5
+ import { L as LayoutComponentProps, F as Field$1, C as CollectionField, a as Fields } from './AmplifyRenderer-Bwob7ICJ.js';
6
+ export { A as AmplifyRenderer, I as ImageValue, P as PortableRef, b as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-Bwob7ICJ.js';
7
7
  export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-3AXnQgzO.js';
8
8
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
9
9
 
@@ -81,16 +81,50 @@ declare function Slot({ name, className, }: {
81
81
  name: string;
82
82
  className?: string;
83
83
  }): react_jsx_runtime.JSX.Element | null;
84
- declare function Field(props: {
85
- /** Envelope from `props.fields` (`{ value, name }`). */
86
- field?: Field$1<unknown>;
84
+ type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
85
+ /**
86
+ * Field Component
87
+ *
88
+ * Pass a field envelope: `<Field field={fields.title} />`.
89
+ * For a computed value, pass `value` and `name`.
90
+ *
91
+ * For markdown / rich text fields, use {@link RichText} instead.
92
+ * List fields use {@link Collection} (repeaters) or `.value` (reference lists).
93
+ *
94
+ * @example
95
+ * ```tsx
96
+ * function Hero({ fields }: { fields: Fields<{ title: string; description: string }> }) {
97
+ * return (
98
+ * <section className="hero">
99
+ * <h1>
100
+ * <Field field={fields.title} />
101
+ * </h1>
102
+ * <p>{fields.description.value}</p>
103
+ * </section>
104
+ * );
105
+ * }
106
+ * ```
107
+ */
108
+ declare function Field<T = unknown>(props: {
109
+ /** Envelope from `props.fields` (`{ value, name }`). Arrays are not allowed. */
110
+ field?: Field$1<RejectArray<T>>;
87
111
  /** Computed value — requires `name`. */
88
- value?: unknown;
112
+ value?: RejectArray<T>;
89
113
  /** Required with `value` for computed values. */
90
114
  name?: string;
91
115
  className?: string;
92
- render?: (value: any) => ReactNode;
93
- }): string | number | true | Iterable<React__default.ReactNode> | react_jsx_runtime.JSX.Element | null;
116
+ }): react_jsx_runtime.JSX.Element | null;
117
+ /**
118
+ * Repeater (inline-authored list). Inside Composer: empty placeholder plus
119
+ * add / remove / reorder. Outside Composer: children only.
120
+ *
121
+ * Reference lists are not canvas-bound — map `fields.posts.value` instead.
122
+ */
123
+ declare function Collection<T extends Record<string, unknown>>({ field, children, className, }: {
124
+ field: CollectionField<T> | Field$1<T[]>;
125
+ children: (item: Fields<T>, index: number) => ReactNode;
126
+ className?: string;
127
+ }): react_jsx_runtime.JSX.Element | null;
94
128
  /**
95
129
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
96
130
  *
@@ -142,7 +176,7 @@ declare function Image(props: {
142
176
  /** Required with `value` for computed values. */
143
177
  name?: string;
144
178
  alt?: string;
145
- } & Omit<React__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
179
+ } & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
146
180
 
147
181
  declare function ComposerProvider({ layoutNodeId, children, }: {
148
182
  layoutNodeId?: string;
@@ -173,4 +207,4 @@ interface AmplifyUpProviderProps {
173
207
  declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
174
208
  declare function useAmplifyUp(): AmplifyUpContextType;
175
209
 
176
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
210
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, Collection, CollectionField, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Fields, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };