@contentful/experiences-components-react 1.39.0-alpha-20250528T1342-e28bc3d.0 → 1.39.0-dev-20250528T1423-593ccdb.0

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/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { ComponentDefinition, OptimizedImageAsset, StructureComponentProps, StyleProps } from '@contentful/experiences-core/types';
2
- import React, { HTMLAttributes } from 'react';
1
+ import { ComponentDefinition, OptimizedImageAsset, ExperienceTreeNode, ExperienceDataSource, ExperienceUnboundValues, StyleProps, DragWrapperProps, ResolveDesignValueType } from '@contentful/experiences-core/types';
2
+ import React$1, { RefObject, CSSProperties, SyntheticEvent } from 'react';
3
3
  import { Document } from '@contentful/rich-text-types';
4
+ import { EntityStore } from '@contentful/experiences-core';
4
5
 
5
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
+ interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
6
7
  /**
7
8
  * The URL to navigate to when the button is clicked. When provided, the button will be wrapped in an anchor tag.
8
9
  * @default undefined
@@ -59,13 +60,13 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
59
60
  * <Button>Go</Button>
60
61
  * ```
61
62
  */
62
- children?: React.ReactNode;
63
+ children?: React$1.ReactNode;
63
64
  }
64
- declare const Button: React.FC<ButtonProps>;
65
+ declare const Button: React$1.FC<ButtonProps>;
65
66
 
66
67
  declare const ButtonComponentDefinition: ComponentDefinition;
67
68
 
68
- interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
69
+ interface HeadingProps extends React$1.HTMLAttributes<HTMLHeadingElement> {
69
70
  /**
70
71
  * The text to display in the heading. If not provided, children will be used instead.
71
72
  * @default undefined
@@ -85,7 +86,7 @@ interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
85
86
  * <Heading>My Heading</Heading>
86
87
  * ```
87
88
  */
88
- children?: React.ReactNode;
89
+ children?: React$1.ReactNode;
89
90
  /**
90
91
  * The type of heading to render
91
92
  * @default h1
@@ -97,11 +98,11 @@ interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
97
98
  */
98
99
  type?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
99
100
  }
100
- declare const Heading: React.FC<HeadingProps>;
101
+ declare const Heading: React$1.FC<HeadingProps>;
101
102
 
102
103
  declare const HeadingComponentDefinition: ComponentDefinition;
103
104
 
104
- interface RichTextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'value'> {
105
+ interface RichTextProps extends Omit<React$1.HTMLAttributes<HTMLElement>, 'value'> {
105
106
  /**
106
107
  * Renders the text in a specific HTML tag.
107
108
  * @default p
@@ -131,11 +132,11 @@ interface RichTextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'value'>
131
132
  */
132
133
  value: Document;
133
134
  }
134
- declare const RichText: React.FC<RichTextProps>;
135
+ declare const RichText: React$1.FC<RichTextProps>;
135
136
 
136
137
  declare const RichTextComponentDefinition: ComponentDefinition;
137
138
 
138
- interface TextProps extends React.HTMLAttributes<HTMLElement> {
139
+ interface TextProps extends React$1.HTMLAttributes<HTMLElement> {
139
140
  /**
140
141
  * The URL to navigate to when the text is clicked. When provided, the text will be wrapped in an anchor tag.
141
142
  * @default undefined
@@ -193,7 +194,7 @@ interface TextProps extends React.HTMLAttributes<HTMLElement> {
193
194
  * <Text>My Text</Text>
194
195
  * ```
195
196
  */
196
- children?: React.ReactNode;
197
+ children?: React$1.ReactNode;
197
198
  /**
198
199
  * Renders the text in a specific HTML tag.
199
200
  * @default p
@@ -205,24 +206,38 @@ interface TextProps extends React.HTMLAttributes<HTMLElement> {
205
206
  */
206
207
  as?: 'p' | 'span' | 'div' | 'label' | 'caption' | 'small' | 'strong' | 'em';
207
208
  }
208
- declare const Text: React.FC<TextProps>;
209
+ declare const Text: React$1.FC<TextProps>;
209
210
 
210
211
  declare const TextComponentDefinition: ComponentDefinition;
211
212
 
212
- interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
213
+ interface ImageProps extends React$1.ImgHTMLAttributes<HTMLImageElement> {
213
214
  cfImageAsset?: OptimizedImageAsset | string;
214
215
  }
215
- declare const Image: React.FC<ImageProps>;
216
+ declare const Image: React$1.FC<ImageProps>;
216
217
 
217
218
  declare const ImageComponentDefinition: ComponentDefinition;
218
219
 
219
- type ContentfulContainerAsHyperlinkProps = StructureComponentProps<{
220
+ type ContentfulContainerAsHyperlinkProps<EditorMode = boolean> = (EditorMode extends true ? {
221
+ editorMode?: EditorMode;
222
+ node: ExperienceTreeNode;
223
+ dataSource?: ExperienceDataSource;
224
+ unboundValues?: ExperienceUnboundValues;
225
+ resolveDesignValue?: any;
226
+ entityStore?: RefObject<EntityStore>;
227
+ areEntitiesFetched?: boolean;
228
+ renderDropzone: (node: ExperienceTreeNode, props?: Record<string, any>) => React$1.ReactNode;
229
+ } : {
230
+ editorMode: EditorMode;
231
+ }) & {
232
+ children?: React$1.ReactNode;
220
233
  className?: string;
221
234
  cfHyperlink?: StyleProps['cfHyperlink'];
222
235
  cfOpenInNewTab?: StyleProps['cfOpenInNewTab'];
223
- }>;
236
+ WrapperComponent?: React$1.ElementType;
237
+ dragProps?: DragWrapperProps;
238
+ };
224
239
 
225
- declare const ContentfulContainer: React.FC<ContentfulContainerAsHyperlinkProps>;
240
+ declare const ContentfulContainer: React$1.FC<ContentfulContainerAsHyperlinkProps>;
226
241
 
227
242
  declare const containerDefinition: ComponentDefinition;
228
243
  declare const sectionDefinition: ComponentDefinition;
@@ -231,31 +246,71 @@ type ContentfulDividerProps = {
231
246
  className?: string;
232
247
  dragProps?: unknown;
233
248
  };
234
- declare const ContentfulDivider: ({ className, dragProps: _, ...props }: ContentfulDividerProps) => React.JSX.Element;
249
+ declare const ContentfulDivider: ({ className, dragProps: _, ...props }: ContentfulDividerProps) => React$1.JSX.Element;
235
250
 
236
251
  declare const dividerDefinition: ComponentDefinition;
237
252
 
238
- type ColumnsProps = StructureComponentProps<{
253
+ interface ColumnsBaseProps {
254
+ editorMode: boolean;
239
255
  className?: string;
240
- }>;
241
- declare const Columns: ({ className, children, ...otherProps }: ColumnsProps) => React.JSX.Element;
256
+ children?: React.ReactNode;
257
+ }
258
+ interface ColumnsEditorModeProps extends ColumnsBaseProps {
259
+ editorMode: true;
260
+ cfColumns: string;
261
+ node: ExperienceTreeNode;
262
+ renderDropzone: (node: ExperienceTreeNode, props?: Record<string, unknown>) => React.ReactNode;
263
+ dragProps?: unknown;
264
+ }
265
+ interface ColumnsDeliveryModeProps extends ColumnsBaseProps {
266
+ editorMode: false;
267
+ }
268
+ interface SingleColumnEditorModeProps extends ColumnsBaseProps {
269
+ editorMode: true;
270
+ node: ExperienceTreeNode;
271
+ renderDropzone: (node: ExperienceTreeNode, props?: Record<string, unknown>) => React.ReactNode;
272
+ cfColumnSpan: string;
273
+ dragProps?: unknown;
274
+ ['data-ctfl-draggable-id']: string;
275
+ style?: CSSProperties;
276
+ className: string;
277
+ onMouseOver: (e: SyntheticEvent<Element, Event>) => void;
278
+ onMouseOut: (e: SyntheticEvent<Element, Event>) => void;
279
+ onMouseDown: (e: SyntheticEvent<Element, Event>) => void;
280
+ onMouseUp: (e: SyntheticEvent<Element, Event>) => void;
281
+ onClick: (e: SyntheticEvent<Element, Event>) => void;
282
+ }
283
+ interface SingleColumnDeliveryModeProps extends ColumnsBaseProps {
284
+ editorMode: false;
285
+ }
286
+ type ColumnsProps = ColumnsEditorModeProps | ColumnsDeliveryModeProps;
287
+ type SingleColumnProps = SingleColumnEditorModeProps | SingleColumnDeliveryModeProps;
242
288
 
243
- type SingleColumnProps = StructureComponentProps<{
244
- className?: string;
245
- }>;
246
- declare const SingleColumn: React.FC<SingleColumnProps>;
289
+ declare const Columns: React$1.FC<ColumnsProps>;
290
+
291
+ declare const SingleColumn: React$1.FC<SingleColumnProps>;
247
292
 
248
293
  declare const columnsDefinition: ComponentDefinition;
249
294
  declare const singleColumnDefinition: ComponentDefinition;
250
295
 
251
- type AssemblyProps = StructureComponentProps<HTMLAttributes<HTMLDivElement>>;
252
- declare const Assembly: React.FC<AssemblyProps>;
296
+ type AssemblyProps<EditorMode = boolean> = EditorMode extends true ? {
297
+ children?: React$1.ReactNode;
298
+ className?: string;
299
+ cfHyperlink?: StyleProps['cfHyperlink'];
300
+ cfOpenInNewTab?: StyleProps['cfOpenInNewTab'];
301
+ editorMode?: EditorMode;
302
+ node: ExperienceTreeNode;
303
+ resolveDesignValue?: ResolveDesignValueType;
304
+ dragProps?: Record<string, any>;
305
+ renderDropzone: (node: ExperienceTreeNode, props?: Record<string, any>) => React$1.ReactNode;
306
+ } : Record<string, any>;
307
+ declare const Assembly: React$1.FC<AssemblyProps>;
253
308
 
254
309
  interface CarouselProps {
255
310
  className?: string;
256
- children?: React.ReactNode;
311
+ children?: React$1.ReactNode;
257
312
  }
258
- declare const Carousel: React.FC<CarouselProps>;
313
+ declare const Carousel: React$1.FC<CarouselProps>;
259
314
 
260
315
  declare const carouselDefinition: ComponentDefinition;
261
316