@contentful/experiences-components-react 1.39.0-alpha-20250528T1201-58ca01e.0 → 1.39.0-alpha-20250528T1342-e28bc3d.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 +30 -85
- package/dist/index.js +37 -79
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ComponentDefinition, OptimizedImageAsset,
|
|
2
|
-
import React
|
|
1
|
+
import { ComponentDefinition, OptimizedImageAsset, StructureComponentProps, StyleProps } from '@contentful/experiences-core/types';
|
|
2
|
+
import React, { HTMLAttributes } from 'react';
|
|
3
3
|
import { Document } from '@contentful/rich-text-types';
|
|
4
|
-
import { EntityStore } from '@contentful/experiences-core';
|
|
5
4
|
|
|
6
|
-
interface ButtonProps extends React
|
|
5
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
6
|
/**
|
|
8
7
|
* The URL to navigate to when the button is clicked. When provided, the button will be wrapped in an anchor tag.
|
|
9
8
|
* @default undefined
|
|
@@ -60,13 +59,13 @@ interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
60
59
|
* <Button>Go</Button>
|
|
61
60
|
* ```
|
|
62
61
|
*/
|
|
63
|
-
children?: React
|
|
62
|
+
children?: React.ReactNode;
|
|
64
63
|
}
|
|
65
|
-
declare const Button: React
|
|
64
|
+
declare const Button: React.FC<ButtonProps>;
|
|
66
65
|
|
|
67
66
|
declare const ButtonComponentDefinition: ComponentDefinition;
|
|
68
67
|
|
|
69
|
-
interface HeadingProps extends React
|
|
68
|
+
interface HeadingProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
70
69
|
/**
|
|
71
70
|
* The text to display in the heading. If not provided, children will be used instead.
|
|
72
71
|
* @default undefined
|
|
@@ -86,7 +85,7 @@ interface HeadingProps extends React$1.HTMLAttributes<HTMLHeadingElement> {
|
|
|
86
85
|
* <Heading>My Heading</Heading>
|
|
87
86
|
* ```
|
|
88
87
|
*/
|
|
89
|
-
children?: React
|
|
88
|
+
children?: React.ReactNode;
|
|
90
89
|
/**
|
|
91
90
|
* The type of heading to render
|
|
92
91
|
* @default h1
|
|
@@ -98,11 +97,11 @@ interface HeadingProps extends React$1.HTMLAttributes<HTMLHeadingElement> {
|
|
|
98
97
|
*/
|
|
99
98
|
type?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
100
99
|
}
|
|
101
|
-
declare const Heading: React
|
|
100
|
+
declare const Heading: React.FC<HeadingProps>;
|
|
102
101
|
|
|
103
102
|
declare const HeadingComponentDefinition: ComponentDefinition;
|
|
104
103
|
|
|
105
|
-
interface RichTextProps extends Omit<React
|
|
104
|
+
interface RichTextProps extends Omit<React.HTMLAttributes<HTMLElement>, 'value'> {
|
|
106
105
|
/**
|
|
107
106
|
* Renders the text in a specific HTML tag.
|
|
108
107
|
* @default p
|
|
@@ -132,11 +131,11 @@ interface RichTextProps extends Omit<React$1.HTMLAttributes<HTMLElement>, 'value
|
|
|
132
131
|
*/
|
|
133
132
|
value: Document;
|
|
134
133
|
}
|
|
135
|
-
declare const RichText: React
|
|
134
|
+
declare const RichText: React.FC<RichTextProps>;
|
|
136
135
|
|
|
137
136
|
declare const RichTextComponentDefinition: ComponentDefinition;
|
|
138
137
|
|
|
139
|
-
interface TextProps extends React
|
|
138
|
+
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
140
139
|
/**
|
|
141
140
|
* The URL to navigate to when the text is clicked. When provided, the text will be wrapped in an anchor tag.
|
|
142
141
|
* @default undefined
|
|
@@ -194,7 +193,7 @@ interface TextProps extends React$1.HTMLAttributes<HTMLElement> {
|
|
|
194
193
|
* <Text>My Text</Text>
|
|
195
194
|
* ```
|
|
196
195
|
*/
|
|
197
|
-
children?: React
|
|
196
|
+
children?: React.ReactNode;
|
|
198
197
|
/**
|
|
199
198
|
* Renders the text in a specific HTML tag.
|
|
200
199
|
* @default p
|
|
@@ -206,38 +205,24 @@ interface TextProps extends React$1.HTMLAttributes<HTMLElement> {
|
|
|
206
205
|
*/
|
|
207
206
|
as?: 'p' | 'span' | 'div' | 'label' | 'caption' | 'small' | 'strong' | 'em';
|
|
208
207
|
}
|
|
209
|
-
declare const Text: React
|
|
208
|
+
declare const Text: React.FC<TextProps>;
|
|
210
209
|
|
|
211
210
|
declare const TextComponentDefinition: ComponentDefinition;
|
|
212
211
|
|
|
213
|
-
interface ImageProps extends React
|
|
212
|
+
interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
|
214
213
|
cfImageAsset?: OptimizedImageAsset | string;
|
|
215
214
|
}
|
|
216
|
-
declare const Image: React
|
|
215
|
+
declare const Image: React.FC<ImageProps>;
|
|
217
216
|
|
|
218
217
|
declare const ImageComponentDefinition: ComponentDefinition;
|
|
219
218
|
|
|
220
|
-
type ContentfulContainerAsHyperlinkProps
|
|
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;
|
|
219
|
+
type ContentfulContainerAsHyperlinkProps = StructureComponentProps<{
|
|
233
220
|
className?: string;
|
|
234
221
|
cfHyperlink?: StyleProps['cfHyperlink'];
|
|
235
222
|
cfOpenInNewTab?: StyleProps['cfOpenInNewTab'];
|
|
236
|
-
|
|
237
|
-
dragProps?: DragWrapperProps;
|
|
238
|
-
};
|
|
223
|
+
}>;
|
|
239
224
|
|
|
240
|
-
declare const ContentfulContainer: React
|
|
225
|
+
declare const ContentfulContainer: React.FC<ContentfulContainerAsHyperlinkProps>;
|
|
241
226
|
|
|
242
227
|
declare const containerDefinition: ComponentDefinition;
|
|
243
228
|
declare const sectionDefinition: ComponentDefinition;
|
|
@@ -246,71 +231,31 @@ type ContentfulDividerProps = {
|
|
|
246
231
|
className?: string;
|
|
247
232
|
dragProps?: unknown;
|
|
248
233
|
};
|
|
249
|
-
declare const ContentfulDivider: ({ className, dragProps: _, ...props }: ContentfulDividerProps) => React
|
|
234
|
+
declare const ContentfulDivider: ({ className, dragProps: _, ...props }: ContentfulDividerProps) => React.JSX.Element;
|
|
250
235
|
|
|
251
236
|
declare const dividerDefinition: ComponentDefinition;
|
|
252
237
|
|
|
253
|
-
|
|
254
|
-
editorMode: boolean;
|
|
238
|
+
type ColumnsProps = StructureComponentProps<{
|
|
255
239
|
className?: string;
|
|
256
|
-
|
|
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;
|
|
240
|
+
}>;
|
|
241
|
+
declare const Columns: ({ className, children, ...otherProps }: ColumnsProps) => React.JSX.Element;
|
|
288
242
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
243
|
+
type SingleColumnProps = StructureComponentProps<{
|
|
244
|
+
className?: string;
|
|
245
|
+
}>;
|
|
246
|
+
declare const SingleColumn: React.FC<SingleColumnProps>;
|
|
292
247
|
|
|
293
248
|
declare const columnsDefinition: ComponentDefinition;
|
|
294
249
|
declare const singleColumnDefinition: ComponentDefinition;
|
|
295
250
|
|
|
296
|
-
type AssemblyProps
|
|
297
|
-
|
|
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>;
|
|
251
|
+
type AssemblyProps = StructureComponentProps<HTMLAttributes<HTMLDivElement>>;
|
|
252
|
+
declare const Assembly: React.FC<AssemblyProps>;
|
|
308
253
|
|
|
309
254
|
interface CarouselProps {
|
|
310
255
|
className?: string;
|
|
311
|
-
children?: React
|
|
256
|
+
children?: React.ReactNode;
|
|
312
257
|
}
|
|
313
|
-
declare const Carousel: React
|
|
258
|
+
declare const Carousel: React.FC<CarouselProps>;
|
|
314
259
|
|
|
315
260
|
declare const carouselDefinition: ComponentDefinition;
|
|
316
261
|
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import 'md5';
|
|
|
9
9
|
var css_248z$8 = "/* Initially added with PR #253 for each component, this is now a global setting\n * It is recommended on MDN to use this as a default for layouting.\n*/\n* {\n box-sizing: border-box;\n}\n";
|
|
10
10
|
styleInject(css_248z$8);
|
|
11
11
|
|
|
12
|
+
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
12
13
|
/**
|
|
13
14
|
* These modes are ONLY intended to be internally used within the context of
|
|
14
15
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -1579,7 +1580,7 @@ var VisualEditorMode;
|
|
|
1579
1580
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
1580
1581
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
1581
1582
|
|
|
1582
|
-
var css_248z$2 = ".contentful-container {\n position: relative;\n display: flex;\n box-sizing: border-box;\n pointer-events: all;\n}\n\n.contentful-container::-webkit-scrollbar {\n display: none; /* Safari and Chrome */\n}\n\n.cf-
|
|
1583
|
+
var css_248z$2 = ".contentful-container {\n position: relative;\n display: flex;\n box-sizing: border-box;\n pointer-events: all;\n}\n\n.contentful-container::-webkit-scrollbar {\n display: none; /* Safari and Chrome */\n}\n\n.cf-container-wrapper {\n position: relative;\n width: 100%;\n}\n\n.contentful-container:after {\n content: '';\n display: block;\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow-x: clip;\n font-family: var(--exp-builder-font-stack-primary);\n font-size: 12px;\n color: var(--exp-builder-gray400);\n z-index: 1;\n}\n\n.contentful-section-label:after {\n content: 'Section';\n}\n\n.contentful-container-label:after {\n content: 'Container';\n}\n\n/* used by ContentfulSectionAsHyperlink.tsx */\n\n.contentful-container-link,\n.contentful-container-link:active,\n.contentful-container-link:visited,\n.contentful-container-link:hover,\n.contentful-container-link:read-write,\n.contentful-container-link:focus-visible {\n color: inherit;\n text-decoration: unset;\n outline: unset;\n}\n";
|
|
1583
1584
|
styleInject(css_248z$2);
|
|
1584
1585
|
|
|
1585
1586
|
const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave, onMouseDown, onClick, flex, flexBasis, flexShrink, flexDirection, gap, justifyContent, justifyItems, justifySelf, alignItems, alignSelf, alignContent, order, flexWrap, flexGrow, className, cssStyles, ...props }, ref) => {
|
|
@@ -1604,31 +1605,29 @@ const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave,
|
|
|
1604
1605
|
});
|
|
1605
1606
|
Flex.displayName = 'Flex';
|
|
1606
1607
|
|
|
1607
|
-
|
|
1608
|
+
function extractRenderProps(props) {
|
|
1609
|
+
if (props.editorMode) {
|
|
1610
|
+
const { editorMode, node, children, ...renderProps } = props;
|
|
1611
|
+
return renderProps;
|
|
1612
|
+
}
|
|
1613
|
+
const { editorMode, children, ...renderProps } = props;
|
|
1614
|
+
return renderProps;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1608
1617
|
const ContentfulContainerAsHyperlink = (props) => {
|
|
1609
|
-
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children } = props;
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
rel: 'noopener noreferrer',
|
|
1616
|
-
};
|
|
1618
|
+
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children, ...otherProps } = props;
|
|
1619
|
+
const eventHandlingProps = editorMode === true ? { onClick: stopEventPropagation } : {};
|
|
1620
|
+
const anchorTagProps = cfOpenInNewTab
|
|
1621
|
+
? {
|
|
1622
|
+
target: '_blank',
|
|
1623
|
+
rel: 'noopener noreferrer',
|
|
1617
1624
|
}
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
};
|
|
1625
|
-
return renderDropzone(node, {
|
|
1626
|
-
['data-test-id']: 'contentful-container',
|
|
1627
|
-
className: combineClasses(className, 'contentful-container', 'contentful-container-link'),
|
|
1628
|
-
zoneId: node.data.id,
|
|
1629
|
-
WrapperComponent: 'a',
|
|
1630
|
-
onClick: stopPropagationInEditorMode,
|
|
1631
|
-
});
|
|
1625
|
+
: {};
|
|
1626
|
+
return (React.createElement("a", { className: combineClasses(className, 'contentful-container', 'contentful-container-link'), href: cfHyperlink, ...anchorTagProps, ...eventHandlingProps, ...extractRenderProps(otherProps) }, children));
|
|
1627
|
+
};
|
|
1628
|
+
const stopEventPropagation = (event) => {
|
|
1629
|
+
event.stopPropagation();
|
|
1630
|
+
event.preventDefault();
|
|
1632
1631
|
};
|
|
1633
1632
|
|
|
1634
1633
|
/* eslint-disable */
|
|
@@ -1637,21 +1636,14 @@ const ContentfulContainer = (props) => {
|
|
|
1637
1636
|
if (cfHyperlink) {
|
|
1638
1637
|
return React.createElement(ContentfulContainerAsHyperlink, { ...props }, children);
|
|
1639
1638
|
}
|
|
1640
|
-
if (editorMode
|
|
1639
|
+
if (!editorMode) {
|
|
1641
1640
|
return (React.createElement(Flex, { "data-test-id": "contentful-container", className: combineClasses(className, 'contentful-container') }, children));
|
|
1642
1641
|
}
|
|
1643
1642
|
// Extract properties that are only available in editor mode
|
|
1644
|
-
const {
|
|
1643
|
+
const { node } = props;
|
|
1645
1644
|
const isEmpty = !node.children.length;
|
|
1646
1645
|
const isSection = node.data.blockId === CONTENTFUL_COMPONENTS$1.section.id;
|
|
1647
|
-
return
|
|
1648
|
-
...editorModeProps,
|
|
1649
|
-
['data-test-id']: 'contentful-container',
|
|
1650
|
-
id: 'ContentfulContainer',
|
|
1651
|
-
className: combineClasses('contentful-container', className, isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : ''),
|
|
1652
|
-
WrapperComponent: Flex,
|
|
1653
|
-
dragProps,
|
|
1654
|
-
});
|
|
1646
|
+
return (React.createElement(Flex, { "data-test-id": "contentful-container", ...extractRenderProps(props), className: combineClasses(className, 'contentful-container', isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : '') }, children));
|
|
1655
1647
|
};
|
|
1656
1648
|
|
|
1657
1649
|
const containerDefinition = {
|
|
@@ -1675,7 +1667,7 @@ const sectionDefinition = {
|
|
|
1675
1667
|
},
|
|
1676
1668
|
};
|
|
1677
1669
|
|
|
1678
|
-
var css_248z$1 = ".cf-divider {\n display: contents;\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.cf-divider hr {\n border: none;\n}\n
|
|
1670
|
+
var css_248z$1 = ".cf-divider {\n display: contents;\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.cf-divider hr {\n border: none;\n}\n";
|
|
1679
1671
|
styleInject(css_248z$1);
|
|
1680
1672
|
|
|
1681
1673
|
const ContentfulDivider = ({ className = '',
|
|
@@ -1696,48 +1688,25 @@ const dividerDefinition = {
|
|
|
1696
1688
|
},
|
|
1697
1689
|
};
|
|
1698
1690
|
|
|
1699
|
-
var css_248z = ".cf-columns {\n display: flex;\n gap: 24px;\n grid-template-columns: repeat(12, 1fr);\n flex-direction: column;\n min-height: 0; /* NEW */\n min-width: 0; /* NEW; needed for Firefox */\n}\n\n@media (min-width: 768px) {\n .cf-columns {\n display: grid;\n }\n}\n\n.cf-single-column-wrapper {\n position: relative;\n
|
|
1691
|
+
var css_248z = ".cf-columns {\n display: flex;\n gap: 24px;\n grid-template-columns: repeat(12, 1fr);\n flex-direction: column;\n min-height: 0; /* NEW */\n min-width: 0; /* NEW; needed for Firefox */\n}\n\n@media (min-width: 768px) {\n .cf-columns {\n display: grid;\n }\n}\n\n.cf-single-column-wrapper {\n position: relative;\n}\n\n.cf-single-column-wrapper:after {\n content: '';\n display: block;\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n overflow-x: clip;\n font-family: var(--exp-builder-font-stack-primary);\n font-size: 12px;\n color: var(--exp-builder-gray400);\n z-index: 1;\n}\n\n.cf-single-column-label:after {\n content: 'Column';\n}\n";
|
|
1700
1692
|
styleInject(css_248z);
|
|
1701
1693
|
|
|
1702
|
-
const
|
|
1703
|
-
return (React.createElement("div", {
|
|
1704
|
-
...(props.style || {}),
|
|
1694
|
+
const Columns = ({ className, children, ...otherProps }) => {
|
|
1695
|
+
return (React.createElement("div", { className: combineClasses(className, 'cf-columns'), style: {
|
|
1705
1696
|
display: 'grid',
|
|
1706
1697
|
gridTemplateColumns: 'repeat(12, [col-start] 1fr)',
|
|
1707
|
-
} },
|
|
1708
|
-
});
|
|
1709
|
-
ColumnWrapper.displayName = 'ColumnWrapper';
|
|
1710
|
-
const Columns = (props) => {
|
|
1711
|
-
const { editorMode, className, children } = props;
|
|
1712
|
-
if (!editorMode) {
|
|
1713
|
-
return (React.createElement(ColumnWrapper, { className: combineClasses(className, 'cf-columns') }, children));
|
|
1714
|
-
}
|
|
1715
|
-
const { node, renderDropzone, dragProps = {}, ...rest } = props;
|
|
1716
|
-
return renderDropzone(node, {
|
|
1717
|
-
...rest,
|
|
1718
|
-
['data-test-id']: 'contentful-columns',
|
|
1719
|
-
id: 'ContentfulContainer',
|
|
1720
|
-
className: combineClasses('cf-columns', className),
|
|
1721
|
-
WrapperComponent: ColumnWrapper,
|
|
1722
|
-
dragProps,
|
|
1723
|
-
});
|
|
1698
|
+
}, ...extractRenderProps(otherProps) }, children));
|
|
1724
1699
|
};
|
|
1725
1700
|
|
|
1726
1701
|
const SingleColumn = (props) => {
|
|
1727
|
-
const { className, editorMode
|
|
1728
|
-
if (editorMode
|
|
1729
|
-
return React.createElement(Flex, { className: className }, children);
|
|
1702
|
+
const { className, editorMode } = props;
|
|
1703
|
+
if (!editorMode) {
|
|
1704
|
+
return React.createElement(Flex, { className: className }, props.children);
|
|
1730
1705
|
}
|
|
1731
|
-
const {
|
|
1706
|
+
const { node, children } = props;
|
|
1732
1707
|
const isEmpty = !node.children.length;
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
id: 'ContentfulSingleColumn',
|
|
1736
|
-
className: combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : ''),
|
|
1737
|
-
WrapperComponent: Flex,
|
|
1738
|
-
dragProps,
|
|
1739
|
-
...editorProps,
|
|
1740
|
-
});
|
|
1708
|
+
const mixedClassName = combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : '');
|
|
1709
|
+
return (React.createElement(Flex, { ...extractRenderProps(props), className: mixedClassName }, children));
|
|
1741
1710
|
};
|
|
1742
1711
|
|
|
1743
1712
|
const columnsDefinition = {
|
|
@@ -1759,18 +1728,7 @@ const singleColumnDefinition = {
|
|
|
1759
1728
|
};
|
|
1760
1729
|
|
|
1761
1730
|
const assemblyStyle = { display: 'contents' };
|
|
1762
|
-
// Feel free to do any magic as regards variable definitions for assemblies
|
|
1763
|
-
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell
|
|
1764
1731
|
const Assembly = (props) => {
|
|
1765
|
-
if (props.editorMode) {
|
|
1766
|
-
const { node, dragProps, ...editorModeProps } = props;
|
|
1767
|
-
return props.renderDropzone(node, {
|
|
1768
|
-
...editorModeProps,
|
|
1769
|
-
['data-test-id']: 'contentful-assembly',
|
|
1770
|
-
className: props.className,
|
|
1771
|
-
dragProps,
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
1732
|
// Using a display contents so assembly content/children
|
|
1775
1733
|
// can appear as if they are direct children of the div wrapper's parent
|
|
1776
1734
|
return React.createElement("div", { "data-test-id": "assembly", ...props, style: assemblyStyle });
|