@contentful/experiences-components-react 1.39.0-alpha-20250528T1549-bd210e1.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 +85 -30
- package/dist/index.js +79 -37
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ComponentDefinition, OptimizedImageAsset,
|
|
2
|
-
import 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 =
|
|
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
|
-
|
|
253
|
+
interface ColumnsBaseProps {
|
|
254
|
+
editorMode: boolean;
|
|
239
255
|
className?: string;
|
|
240
|
-
|
|
241
|
-
|
|
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
|
-
|
|
244
|
-
|
|
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 =
|
|
252
|
-
|
|
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
|
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ 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 */
|
|
13
12
|
/**
|
|
14
13
|
* These modes are ONLY intended to be internally used within the context of
|
|
15
14
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -1586,7 +1585,7 @@ var VisualEditorMode;
|
|
|
1586
1585
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
1587
1586
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
1588
1587
|
|
|
1589
|
-
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";
|
|
1588
|
+
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-single-column-wrapper {\n position: relative;\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";
|
|
1590
1589
|
styleInject(css_248z$2);
|
|
1591
1590
|
|
|
1592
1591
|
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) => {
|
|
@@ -1611,29 +1610,31 @@ const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave,
|
|
|
1611
1610
|
});
|
|
1612
1611
|
Flex.displayName = 'Flex';
|
|
1613
1612
|
|
|
1614
|
-
|
|
1615
|
-
if (props.editorMode) {
|
|
1616
|
-
const { editorMode, node, children, ...renderProps } = props;
|
|
1617
|
-
return renderProps;
|
|
1618
|
-
}
|
|
1619
|
-
const { editorMode, children, ...renderProps } = props;
|
|
1620
|
-
return renderProps;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1613
|
+
/* eslint-disable */ /* TODO: fix eslint errors */
|
|
1623
1614
|
const ContentfulContainerAsHyperlink = (props) => {
|
|
1624
|
-
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1615
|
+
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children } = props;
|
|
1616
|
+
if (editorMode === false) {
|
|
1617
|
+
let anchorTagProps = {};
|
|
1618
|
+
if (cfOpenInNewTab) {
|
|
1619
|
+
anchorTagProps = {
|
|
1620
|
+
target: '_blank',
|
|
1621
|
+
rel: 'noopener noreferrer',
|
|
1622
|
+
};
|
|
1630
1623
|
}
|
|
1631
|
-
:
|
|
1632
|
-
|
|
1633
|
-
};
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
|
|
1624
|
+
return (React.createElement("a", { className: combineClasses(className, 'contentful-container', 'contentful-container-link'), href: cfHyperlink, ...anchorTagProps }, children));
|
|
1625
|
+
}
|
|
1626
|
+
const { renderDropzone, node } = props;
|
|
1627
|
+
const stopPropagationInEditorMode = (e) => {
|
|
1628
|
+
e.stopPropagation();
|
|
1629
|
+
e.preventDefault();
|
|
1630
|
+
};
|
|
1631
|
+
return renderDropzone(node, {
|
|
1632
|
+
['data-test-id']: 'contentful-container',
|
|
1633
|
+
className: combineClasses(className, 'contentful-container', 'contentful-container-link'),
|
|
1634
|
+
zoneId: node.data.id,
|
|
1635
|
+
WrapperComponent: 'a',
|
|
1636
|
+
onClick: stopPropagationInEditorMode,
|
|
1637
|
+
});
|
|
1637
1638
|
};
|
|
1638
1639
|
|
|
1639
1640
|
/* eslint-disable */
|
|
@@ -1642,14 +1643,21 @@ const ContentfulContainer = (props) => {
|
|
|
1642
1643
|
if (cfHyperlink) {
|
|
1643
1644
|
return React.createElement(ContentfulContainerAsHyperlink, { ...props }, children);
|
|
1644
1645
|
}
|
|
1645
|
-
if (
|
|
1646
|
+
if (editorMode === false) {
|
|
1646
1647
|
return (React.createElement(Flex, { "data-test-id": "contentful-container", className: combineClasses(className, 'contentful-container') }, children));
|
|
1647
1648
|
}
|
|
1648
1649
|
// Extract properties that are only available in editor mode
|
|
1649
|
-
const { node } = props;
|
|
1650
|
+
const { renderDropzone, node, dragProps = {}, ...editorModeProps } = props;
|
|
1650
1651
|
const isEmpty = !node.children.length;
|
|
1651
1652
|
const isSection = node.data.blockId === CONTENTFUL_COMPONENTS$1.section.id;
|
|
1652
|
-
return (
|
|
1653
|
+
return renderDropzone(node, {
|
|
1654
|
+
...editorModeProps,
|
|
1655
|
+
['data-test-id']: 'contentful-container',
|
|
1656
|
+
id: 'ContentfulContainer',
|
|
1657
|
+
className: combineClasses('contentful-container', className, isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : ''),
|
|
1658
|
+
WrapperComponent: Flex,
|
|
1659
|
+
dragProps,
|
|
1660
|
+
});
|
|
1653
1661
|
};
|
|
1654
1662
|
|
|
1655
1663
|
const containerDefinition = {
|
|
@@ -1673,7 +1681,7 @@ const sectionDefinition = {
|
|
|
1673
1681
|
},
|
|
1674
1682
|
};
|
|
1675
1683
|
|
|
1676
|
-
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";
|
|
1684
|
+
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\n/* For the editor mode add this 10px tolerance to make it easier picking up the divider component.\n * Using the DND zone as precondition makes sure that we don't render this pseudo element in delivery. */\n\n[data-ctfl-zone-id='root'] .cf-divider::before {\n content: \"\";\n position: absolute;\n top: -5px;\n left: -5px;\n bottom: -5px;\n right: -5px;\n pointer-events: all;\n}\n";
|
|
1677
1685
|
styleInject(css_248z$1);
|
|
1678
1686
|
|
|
1679
1687
|
const ContentfulDivider = ({ className = '',
|
|
@@ -1694,25 +1702,48 @@ const dividerDefinition = {
|
|
|
1694
1702
|
},
|
|
1695
1703
|
};
|
|
1696
1704
|
|
|
1697
|
-
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";
|
|
1705
|
+
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 display: flex;\n}\n\n.cf-single-column {\n pointer-events: all;\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";
|
|
1698
1706
|
styleInject(css_248z);
|
|
1699
1707
|
|
|
1700
|
-
const
|
|
1701
|
-
return (React.createElement("div", {
|
|
1708
|
+
const ColumnWrapper = forwardRef((props, ref) => {
|
|
1709
|
+
return (React.createElement("div", { ref: ref, ...props, style: {
|
|
1710
|
+
...(props.style || {}),
|
|
1702
1711
|
display: 'grid',
|
|
1703
1712
|
gridTemplateColumns: 'repeat(12, [col-start] 1fr)',
|
|
1704
|
-
}
|
|
1713
|
+
} }, props.children));
|
|
1714
|
+
});
|
|
1715
|
+
ColumnWrapper.displayName = 'ColumnWrapper';
|
|
1716
|
+
const Columns = (props) => {
|
|
1717
|
+
const { editorMode, className, children } = props;
|
|
1718
|
+
if (!editorMode) {
|
|
1719
|
+
return (React.createElement(ColumnWrapper, { className: combineClasses(className, 'cf-columns') }, children));
|
|
1720
|
+
}
|
|
1721
|
+
const { node, renderDropzone, dragProps = {}, ...rest } = props;
|
|
1722
|
+
return renderDropzone(node, {
|
|
1723
|
+
...rest,
|
|
1724
|
+
['data-test-id']: 'contentful-columns',
|
|
1725
|
+
id: 'ContentfulContainer',
|
|
1726
|
+
className: combineClasses('cf-columns', className),
|
|
1727
|
+
WrapperComponent: ColumnWrapper,
|
|
1728
|
+
dragProps,
|
|
1729
|
+
});
|
|
1705
1730
|
};
|
|
1706
1731
|
|
|
1707
1732
|
const SingleColumn = (props) => {
|
|
1708
|
-
const { className, editorMode } = props;
|
|
1709
|
-
if (
|
|
1710
|
-
return React.createElement(Flex, { className: className },
|
|
1733
|
+
const { className, editorMode, children } = props;
|
|
1734
|
+
if (editorMode === false) {
|
|
1735
|
+
return React.createElement(Flex, { className: className }, children);
|
|
1711
1736
|
}
|
|
1712
|
-
const { node,
|
|
1737
|
+
const { renderDropzone, node, className: _className, dragProps = {}, cfColumnSpan, editorMode: edit, ...editorProps } = props;
|
|
1713
1738
|
const isEmpty = !node.children.length;
|
|
1714
|
-
|
|
1715
|
-
|
|
1739
|
+
return renderDropzone(node, {
|
|
1740
|
+
['data-test-id']: 'contentful-single-column',
|
|
1741
|
+
id: 'ContentfulSingleColumn',
|
|
1742
|
+
className: combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : ''),
|
|
1743
|
+
WrapperComponent: Flex,
|
|
1744
|
+
dragProps,
|
|
1745
|
+
...editorProps,
|
|
1746
|
+
});
|
|
1716
1747
|
};
|
|
1717
1748
|
|
|
1718
1749
|
const columnsDefinition = {
|
|
@@ -1734,7 +1765,18 @@ const singleColumnDefinition = {
|
|
|
1734
1765
|
};
|
|
1735
1766
|
|
|
1736
1767
|
const assemblyStyle = { display: 'contents' };
|
|
1768
|
+
// Feel free to do any magic as regards variable definitions for assemblies
|
|
1769
|
+
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell
|
|
1737
1770
|
const Assembly = (props) => {
|
|
1771
|
+
if (props.editorMode) {
|
|
1772
|
+
const { node, dragProps, ...editorModeProps } = props;
|
|
1773
|
+
return props.renderDropzone(node, {
|
|
1774
|
+
...editorModeProps,
|
|
1775
|
+
['data-test-id']: 'contentful-assembly',
|
|
1776
|
+
className: props.className,
|
|
1777
|
+
dragProps,
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1738
1780
|
// Using a display contents so assembly content/children
|
|
1739
1781
|
// can appear as if they are direct children of the div wrapper's parent
|
|
1740
1782
|
return React.createElement("div", { "data-test-id": "assembly", ...props, style: assemblyStyle });
|