@contentful/experiences-components-react 1.40.0-alpha-20250604T0813-1f6e699.0 → 1.40.0-dev-20250604T0933-fc115de.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 +95 -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
|
|
@@ -594,6 +593,10 @@ const builtInStyles = {
|
|
|
594
593
|
value: 'end',
|
|
595
594
|
displayName: 'Align right',
|
|
596
595
|
},
|
|
596
|
+
{
|
|
597
|
+
value: 'stretch',
|
|
598
|
+
displayName: 'Stretch',
|
|
599
|
+
},
|
|
597
600
|
],
|
|
598
601
|
},
|
|
599
602
|
type: 'Text',
|
|
@@ -617,6 +620,10 @@ const builtInStyles = {
|
|
|
617
620
|
value: 'end',
|
|
618
621
|
displayName: 'Align bottom',
|
|
619
622
|
},
|
|
623
|
+
{
|
|
624
|
+
value: 'stretch',
|
|
625
|
+
displayName: 'Stretch',
|
|
626
|
+
},
|
|
620
627
|
],
|
|
621
628
|
},
|
|
622
629
|
type: 'Text',
|
|
@@ -987,6 +994,10 @@ const singleColumnBuiltInStyles = {
|
|
|
987
994
|
value: 'end',
|
|
988
995
|
displayName: 'Align right',
|
|
989
996
|
},
|
|
997
|
+
{
|
|
998
|
+
value: 'stretch',
|
|
999
|
+
displayName: 'Stretch',
|
|
1000
|
+
},
|
|
990
1001
|
],
|
|
991
1002
|
},
|
|
992
1003
|
type: 'Text',
|
|
@@ -1010,6 +1021,10 @@ const singleColumnBuiltInStyles = {
|
|
|
1010
1021
|
value: 'end',
|
|
1011
1022
|
displayName: 'Align bottom',
|
|
1012
1023
|
},
|
|
1024
|
+
{
|
|
1025
|
+
value: 'stretch',
|
|
1026
|
+
displayName: 'Stretch',
|
|
1027
|
+
},
|
|
1013
1028
|
],
|
|
1014
1029
|
},
|
|
1015
1030
|
type: 'Text',
|
|
@@ -1612,7 +1627,7 @@ var VisualEditorMode;
|
|
|
1612
1627
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
1613
1628
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
1614
1629
|
|
|
1615
|
-
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";
|
|
1630
|
+
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";
|
|
1616
1631
|
styleInject(css_248z$2);
|
|
1617
1632
|
|
|
1618
1633
|
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) => {
|
|
@@ -1637,29 +1652,31 @@ const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave,
|
|
|
1637
1652
|
});
|
|
1638
1653
|
Flex.displayName = 'Flex';
|
|
1639
1654
|
|
|
1640
|
-
|
|
1641
|
-
if (props.editorMode) {
|
|
1642
|
-
const { editorMode, node, children, ...renderProps } = props;
|
|
1643
|
-
return renderProps;
|
|
1644
|
-
}
|
|
1645
|
-
const { editorMode, children, ...renderProps } = props;
|
|
1646
|
-
return renderProps;
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1655
|
+
/* eslint-disable */ /* TODO: fix eslint errors */
|
|
1649
1656
|
const ContentfulContainerAsHyperlink = (props) => {
|
|
1650
|
-
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1657
|
+
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children } = props;
|
|
1658
|
+
if (editorMode === false) {
|
|
1659
|
+
let anchorTagProps = {};
|
|
1660
|
+
if (cfOpenInNewTab) {
|
|
1661
|
+
anchorTagProps = {
|
|
1662
|
+
target: '_blank',
|
|
1663
|
+
rel: 'noopener noreferrer',
|
|
1664
|
+
};
|
|
1656
1665
|
}
|
|
1657
|
-
:
|
|
1658
|
-
|
|
1659
|
-
};
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1662
|
-
|
|
1666
|
+
return (React.createElement("a", { className: combineClasses(className, 'contentful-container', 'contentful-container-link'), href: cfHyperlink, ...anchorTagProps }, children));
|
|
1667
|
+
}
|
|
1668
|
+
const { renderDropzone, node } = props;
|
|
1669
|
+
const stopPropagationInEditorMode = (e) => {
|
|
1670
|
+
e.stopPropagation();
|
|
1671
|
+
e.preventDefault();
|
|
1672
|
+
};
|
|
1673
|
+
return renderDropzone(node, {
|
|
1674
|
+
['data-test-id']: 'contentful-container',
|
|
1675
|
+
className: combineClasses(className, 'contentful-container', 'contentful-container-link'),
|
|
1676
|
+
zoneId: node.data.id,
|
|
1677
|
+
WrapperComponent: 'a',
|
|
1678
|
+
onClick: stopPropagationInEditorMode,
|
|
1679
|
+
});
|
|
1663
1680
|
};
|
|
1664
1681
|
|
|
1665
1682
|
/* eslint-disable */
|
|
@@ -1668,14 +1685,21 @@ const ContentfulContainer = (props) => {
|
|
|
1668
1685
|
if (cfHyperlink) {
|
|
1669
1686
|
return React.createElement(ContentfulContainerAsHyperlink, { ...props }, children);
|
|
1670
1687
|
}
|
|
1671
|
-
if (
|
|
1688
|
+
if (editorMode === false) {
|
|
1672
1689
|
return (React.createElement(Flex, { "data-test-id": "contentful-container", className: combineClasses(className, 'contentful-container') }, children));
|
|
1673
1690
|
}
|
|
1674
1691
|
// Extract properties that are only available in editor mode
|
|
1675
|
-
const { node } = props;
|
|
1692
|
+
const { renderDropzone, node, dragProps = {}, ...editorModeProps } = props;
|
|
1676
1693
|
const isEmpty = !node.children.length;
|
|
1677
1694
|
const isSection = node.data.blockId === CONTENTFUL_COMPONENTS$1.section.id;
|
|
1678
|
-
return (
|
|
1695
|
+
return renderDropzone(node, {
|
|
1696
|
+
...editorModeProps,
|
|
1697
|
+
['data-test-id']: 'contentful-container',
|
|
1698
|
+
id: 'ContentfulContainer',
|
|
1699
|
+
className: combineClasses('contentful-container', className, isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : ''),
|
|
1700
|
+
WrapperComponent: Flex,
|
|
1701
|
+
dragProps,
|
|
1702
|
+
});
|
|
1679
1703
|
};
|
|
1680
1704
|
|
|
1681
1705
|
const containerDefinition = {
|
|
@@ -1699,7 +1723,7 @@ const sectionDefinition = {
|
|
|
1699
1723
|
},
|
|
1700
1724
|
};
|
|
1701
1725
|
|
|
1702
|
-
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";
|
|
1726
|
+
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";
|
|
1703
1727
|
styleInject(css_248z$1);
|
|
1704
1728
|
|
|
1705
1729
|
const ContentfulDivider = ({ className = '',
|
|
@@ -1720,25 +1744,48 @@ const dividerDefinition = {
|
|
|
1720
1744
|
},
|
|
1721
1745
|
};
|
|
1722
1746
|
|
|
1723
|
-
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";
|
|
1747
|
+
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";
|
|
1724
1748
|
styleInject(css_248z);
|
|
1725
1749
|
|
|
1726
|
-
const
|
|
1727
|
-
return (React.createElement("div", {
|
|
1750
|
+
const ColumnWrapper = forwardRef((props, ref) => {
|
|
1751
|
+
return (React.createElement("div", { ref: ref, ...props, style: {
|
|
1752
|
+
...(props.style || {}),
|
|
1728
1753
|
display: 'grid',
|
|
1729
1754
|
gridTemplateColumns: 'repeat(12, [col-start] 1fr)',
|
|
1730
|
-
}
|
|
1755
|
+
} }, props.children));
|
|
1756
|
+
});
|
|
1757
|
+
ColumnWrapper.displayName = 'ColumnWrapper';
|
|
1758
|
+
const Columns = (props) => {
|
|
1759
|
+
const { editorMode, className, children } = props;
|
|
1760
|
+
if (!editorMode) {
|
|
1761
|
+
return (React.createElement(ColumnWrapper, { className: combineClasses(className, 'cf-columns') }, children));
|
|
1762
|
+
}
|
|
1763
|
+
const { node, renderDropzone, dragProps = {}, ...rest } = props;
|
|
1764
|
+
return renderDropzone(node, {
|
|
1765
|
+
...rest,
|
|
1766
|
+
['data-test-id']: 'contentful-columns',
|
|
1767
|
+
id: 'ContentfulContainer',
|
|
1768
|
+
className: combineClasses('cf-columns', className),
|
|
1769
|
+
WrapperComponent: ColumnWrapper,
|
|
1770
|
+
dragProps,
|
|
1771
|
+
});
|
|
1731
1772
|
};
|
|
1732
1773
|
|
|
1733
1774
|
const SingleColumn = (props) => {
|
|
1734
|
-
const { className, editorMode } = props;
|
|
1735
|
-
if (
|
|
1736
|
-
return React.createElement(Flex, { className: className },
|
|
1775
|
+
const { className, editorMode, children } = props;
|
|
1776
|
+
if (editorMode === false) {
|
|
1777
|
+
return React.createElement(Flex, { className: className }, children);
|
|
1737
1778
|
}
|
|
1738
|
-
const { node,
|
|
1779
|
+
const { renderDropzone, node, className: _className, dragProps = {}, cfColumnSpan, editorMode: edit, ...editorProps } = props;
|
|
1739
1780
|
const isEmpty = !node.children.length;
|
|
1740
|
-
|
|
1741
|
-
|
|
1781
|
+
return renderDropzone(node, {
|
|
1782
|
+
['data-test-id']: 'contentful-single-column',
|
|
1783
|
+
id: 'ContentfulSingleColumn',
|
|
1784
|
+
className: combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : ''),
|
|
1785
|
+
WrapperComponent: Flex,
|
|
1786
|
+
dragProps,
|
|
1787
|
+
...editorProps,
|
|
1788
|
+
});
|
|
1742
1789
|
};
|
|
1743
1790
|
|
|
1744
1791
|
const columnsDefinition = {
|
|
@@ -1760,7 +1807,18 @@ const singleColumnDefinition = {
|
|
|
1760
1807
|
};
|
|
1761
1808
|
|
|
1762
1809
|
const assemblyStyle = { display: 'contents' };
|
|
1810
|
+
// Feel free to do any magic as regards variable definitions for assemblies
|
|
1811
|
+
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell
|
|
1763
1812
|
const Assembly = (props) => {
|
|
1813
|
+
if (props.editorMode) {
|
|
1814
|
+
const { node, dragProps, ...editorModeProps } = props;
|
|
1815
|
+
return props.renderDropzone(node, {
|
|
1816
|
+
...editorModeProps,
|
|
1817
|
+
['data-test-id']: 'contentful-assembly',
|
|
1818
|
+
className: props.className,
|
|
1819
|
+
dragProps,
|
|
1820
|
+
});
|
|
1821
|
+
}
|
|
1764
1822
|
// Using a display contents so assembly content/children
|
|
1765
1823
|
// can appear as if they are direct children of the div wrapper's parent
|
|
1766
1824
|
return React.createElement("div", { "data-test-id": "assembly", ...props, style: assemblyStyle });
|