@contentful/experiences-components-react 2.0.0-prerelease-20250704T1603-11d76eb.0 → 2.0.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
|
@@ -10,7 +10,6 @@ import { create } from 'zustand';
|
|
|
10
10
|
var css_248z$8 = "@import url(https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;1,400;1,600&display=swap);:root{--cf-color-white:#fff;--cf-color-black:#000;--cf-color-gray100:#f7f9fa;--cf-color-gray400:#aec1cc;--cf-color-gray400-rgb:174,193,204;--cf-spacing-0:0rem;--cf-spacing-1:0.125rem;--cf-spacing-2:0.25rem;--cf-spacing-3:0.375rem;--cf-spacing-4:0.5rem;--cf-spacing-5:0.625rem;--cf-spacing-6:0.75rem;--cf-spacing-7:0.875rem;--cf-spacing-8:1rem;--cf-spacing-9:1.25rem;--cf-spacing-10:1.5rem;--cf-spacing-11:1.75rem;--cf-spacing-12:2rem;--cf-spacing-13:2.25rem;--cf-text-xs:0.75rem;--cf-text-sm:0.875rem;--cf-text-base:1rem;--cf-text-lg:1.125rem;--cf-text-xl:1.25rem;--cf-text-2xl:1.5rem;--cf-text-3xl:2rem;--cf-text-4xl:2.75rem;--cf-font-light:300;--cf-font-normal:400;--cf-font-medium:500;--cf-font-semibold:600;--cf-font-bold:700;--cf-font-extra-bold:800;--cf-font-black:900;--cf-border-radius-none:0px;--cf-border-radius-sm:0.125rem;--cf-border-radius:0.25rem;--cf-border-radius-md:0.375rem;--cf-border-radius-lg:0.5rem;--cf-border-radius-xl:0.75rem;--cf-border-radius-2xl:1rem;--cf-border-radius-3xl:1.5rem;--cf-border-radius-full:9999px;--cf-font-family-sans:Archivo,Helvetica,Arial,sans-serif;--cf-font-family-serif:Georgia,Cambria,Times New Roman,Times,serif;--cf-max-width-full:100%;--cf-button-bg:var(--cf-color-black);--cf-button-color:var(--cf-color-white);--cf-text-color:var(--cf-color-black)}*{box-sizing:border-box}";
|
|
11
11
|
styleInject(css_248z$8);
|
|
12
12
|
|
|
13
|
-
/** @deprecated will be removed when dropping backward compatibility for old DND */
|
|
14
13
|
/**
|
|
15
14
|
* These modes are ONLY intended to be internally used within the context of
|
|
16
15
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -2055,7 +2054,7 @@ var VisualEditorMode;
|
|
|
2055
2054
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
2056
2055
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
2057
2056
|
|
|
2058
|
-
var css_248z$2 = ".contentful-container{display:flex;pointer-events:all;position:relative}.contentful-container::-webkit-scrollbar{display:none}.cf-container-wrapper{position:relative;width:100%}.contentful-container:after{align-items:center;bottom:0;color:var(--exp-builder-gray400);content:\"\";display:block;display:flex;font-family:var(--exp-builder-font-stack-primary);font-size:12px;justify-content:center;left:0;overflow-x:clip;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.contentful-section-label:after{content:\"Section\"}.contentful-container-label:after{content:\"Container\"}.contentful-container-link,.contentful-container-link:active,.contentful-container-link:focus-visible,.contentful-container-link:hover,.contentful-container-link:read-write,.contentful-container-link:visited{color:inherit;outline:unset;text-decoration:unset}";
|
|
2057
|
+
var css_248z$2 = ".contentful-container{display:flex;pointer-events:all;position:relative}.contentful-container::-webkit-scrollbar{display:none}.cf-single-column-wrapper{position:relative}.cf-container-wrapper{position:relative;width:100%}.contentful-container:after{align-items:center;bottom:0;color:var(--exp-builder-gray400);content:\"\";display:block;display:flex;font-family:var(--exp-builder-font-stack-primary);font-size:12px;justify-content:center;left:0;overflow-x:clip;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.contentful-section-label:after{content:\"Section\"}.contentful-container-label:after{content:\"Container\"}.contentful-container-link,.contentful-container-link:active,.contentful-container-link:focus-visible,.contentful-container-link:hover,.contentful-container-link:read-write,.contentful-container-link:visited{color:inherit;outline:unset;text-decoration:unset}";
|
|
2059
2058
|
styleInject(css_248z$2);
|
|
2060
2059
|
|
|
2061
2060
|
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) => {
|
|
@@ -2080,29 +2079,31 @@ const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave,
|
|
|
2080
2079
|
});
|
|
2081
2080
|
Flex.displayName = 'Flex';
|
|
2082
2081
|
|
|
2083
|
-
|
|
2084
|
-
if (props.editorMode) {
|
|
2085
|
-
const { editorMode, node, children, ...renderProps } = props;
|
|
2086
|
-
return renderProps;
|
|
2087
|
-
}
|
|
2088
|
-
const { editorMode, children, ...renderProps } = props;
|
|
2089
|
-
return renderProps;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2082
|
+
/* eslint-disable */ /* TODO: fix eslint errors */
|
|
2092
2083
|
const ContentfulContainerAsHyperlink = (props) => {
|
|
2093
|
-
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2084
|
+
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children } = props;
|
|
2085
|
+
if (editorMode === false) {
|
|
2086
|
+
let anchorTagProps = {};
|
|
2087
|
+
if (cfOpenInNewTab) {
|
|
2088
|
+
anchorTagProps = {
|
|
2089
|
+
target: '_blank',
|
|
2090
|
+
rel: 'noopener noreferrer',
|
|
2091
|
+
};
|
|
2099
2092
|
}
|
|
2100
|
-
:
|
|
2101
|
-
|
|
2102
|
-
};
|
|
2103
|
-
const
|
|
2104
|
-
|
|
2105
|
-
|
|
2093
|
+
return (React.createElement("a", { className: combineClasses(className, 'contentful-container', 'contentful-container-link'), href: cfHyperlink, ...anchorTagProps }, children));
|
|
2094
|
+
}
|
|
2095
|
+
const { renderDropzone, node } = props;
|
|
2096
|
+
const stopPropagationInEditorMode = (e) => {
|
|
2097
|
+
e.stopPropagation();
|
|
2098
|
+
e.preventDefault();
|
|
2099
|
+
};
|
|
2100
|
+
return renderDropzone(node, {
|
|
2101
|
+
['data-test-id']: 'contentful-container',
|
|
2102
|
+
className: combineClasses(className, 'contentful-container', 'contentful-container-link'),
|
|
2103
|
+
zoneId: node.data.id,
|
|
2104
|
+
WrapperComponent: 'a',
|
|
2105
|
+
onClick: stopPropagationInEditorMode,
|
|
2106
|
+
});
|
|
2106
2107
|
};
|
|
2107
2108
|
|
|
2108
2109
|
/* eslint-disable */
|
|
@@ -2111,14 +2112,21 @@ const ContentfulContainer = (props) => {
|
|
|
2111
2112
|
if (cfHyperlink) {
|
|
2112
2113
|
return React.createElement(ContentfulContainerAsHyperlink, { ...props }, children);
|
|
2113
2114
|
}
|
|
2114
|
-
if (
|
|
2115
|
+
if (editorMode === false) {
|
|
2115
2116
|
return (React.createElement(Flex, { "data-test-id": "contentful-container", className: combineClasses(className, 'contentful-container') }, children));
|
|
2116
2117
|
}
|
|
2117
2118
|
// Extract properties that are only available in editor mode
|
|
2118
|
-
const { node } = props;
|
|
2119
|
+
const { renderDropzone, node, dragProps = {}, ...editorModeProps } = props;
|
|
2119
2120
|
const isEmpty = !node.children.length;
|
|
2120
2121
|
const isSection = node.data.blockId === CONTENTFUL_COMPONENTS$1.section.id;
|
|
2121
|
-
return (
|
|
2122
|
+
return renderDropzone(node, {
|
|
2123
|
+
...editorModeProps,
|
|
2124
|
+
['data-test-id']: 'contentful-container',
|
|
2125
|
+
id: 'ContentfulContainer',
|
|
2126
|
+
className: combineClasses('contentful-container', className, isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : ''),
|
|
2127
|
+
WrapperComponent: Flex,
|
|
2128
|
+
dragProps,
|
|
2129
|
+
});
|
|
2122
2130
|
};
|
|
2123
2131
|
|
|
2124
2132
|
const containerDefinition = {
|
|
@@ -2142,7 +2150,7 @@ const sectionDefinition = {
|
|
|
2142
2150
|
},
|
|
2143
2151
|
};
|
|
2144
2152
|
|
|
2145
|
-
var css_248z$1 = ".cf-divider{display:contents;height:100%;position:relative;width:100%}.cf-divider hr{border:none}";
|
|
2153
|
+
var css_248z$1 = ".cf-divider{display:contents;height:100%;position:relative;width:100%}.cf-divider hr{border:none}[data-ctfl-zone-id=root] .cf-divider:before{bottom:-5px;content:\"\";left:-5px;pointer-events:all;position:absolute;right:-5px;top:-5px}";
|
|
2146
2154
|
styleInject(css_248z$1);
|
|
2147
2155
|
|
|
2148
2156
|
const ContentfulDivider = ({ className = '',
|
|
@@ -2163,25 +2171,48 @@ const dividerDefinition = {
|
|
|
2163
2171
|
},
|
|
2164
2172
|
};
|
|
2165
2173
|
|
|
2166
|
-
var css_248z = ".cf-columns{display:flex;flex-direction:column;gap:24px;grid-template-columns:repeat(12,1fr);min-height:0;min-width:0}@media (min-width:768px){.cf-columns{display:grid}}.cf-single-column-wrapper{position:relative}.cf-single-column-wrapper:after{align-items:center;bottom:0;color:var(--exp-builder-gray400);content:\"\";display:block;display:flex;font-family:var(--exp-builder-font-stack-primary);font-size:12px;justify-content:center;left:0;overflow-x:clip;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.cf-single-column-label:after{content:\"Column\"}";
|
|
2174
|
+
var css_248z = ".cf-columns{display:flex;flex-direction:column;gap:24px;grid-template-columns:repeat(12,1fr);min-height:0;min-width:0}@media (min-width:768px){.cf-columns{display:grid}}.cf-single-column-wrapper{display:flex;position:relative}.cf-single-column{pointer-events:all}.cf-single-column-wrapper:after{align-items:center;bottom:0;color:var(--exp-builder-gray400);content:\"\";display:block;display:flex;font-family:var(--exp-builder-font-stack-primary);font-size:12px;justify-content:center;left:0;overflow-x:clip;pointer-events:none;position:absolute;right:0;top:0;z-index:1}.cf-single-column-label:after{content:\"Column\"}";
|
|
2167
2175
|
styleInject(css_248z);
|
|
2168
2176
|
|
|
2169
|
-
const
|
|
2170
|
-
return (React.createElement("div", {
|
|
2177
|
+
const ColumnWrapper = forwardRef((props, ref) => {
|
|
2178
|
+
return (React.createElement("div", { ref: ref, ...props, style: {
|
|
2179
|
+
...(props.style || {}),
|
|
2171
2180
|
display: 'grid',
|
|
2172
2181
|
gridTemplateColumns: 'repeat(12, [col-start] 1fr)',
|
|
2173
|
-
}
|
|
2182
|
+
} }, props.children));
|
|
2183
|
+
});
|
|
2184
|
+
ColumnWrapper.displayName = 'ColumnWrapper';
|
|
2185
|
+
const Columns = (props) => {
|
|
2186
|
+
const { editorMode, className, children } = props;
|
|
2187
|
+
if (!editorMode) {
|
|
2188
|
+
return (React.createElement(ColumnWrapper, { className: combineClasses(className, 'cf-columns') }, children));
|
|
2189
|
+
}
|
|
2190
|
+
const { node, renderDropzone, dragProps = {}, ...rest } = props;
|
|
2191
|
+
return renderDropzone(node, {
|
|
2192
|
+
...rest,
|
|
2193
|
+
['data-test-id']: 'contentful-columns',
|
|
2194
|
+
id: 'ContentfulContainer',
|
|
2195
|
+
className: combineClasses('cf-columns', className),
|
|
2196
|
+
WrapperComponent: ColumnWrapper,
|
|
2197
|
+
dragProps,
|
|
2198
|
+
});
|
|
2174
2199
|
};
|
|
2175
2200
|
|
|
2176
2201
|
const SingleColumn = (props) => {
|
|
2177
|
-
const { className, editorMode } = props;
|
|
2178
|
-
if (
|
|
2179
|
-
return React.createElement(Flex, { className: className },
|
|
2202
|
+
const { className, editorMode, children } = props;
|
|
2203
|
+
if (editorMode === false) {
|
|
2204
|
+
return React.createElement(Flex, { className: className }, children);
|
|
2180
2205
|
}
|
|
2181
|
-
const { node,
|
|
2206
|
+
const { renderDropzone, node, className: _className, dragProps = {}, cfColumnSpan, editorMode: edit, ...editorProps } = props;
|
|
2182
2207
|
const isEmpty = !node.children.length;
|
|
2183
|
-
|
|
2184
|
-
|
|
2208
|
+
return renderDropzone(node, {
|
|
2209
|
+
['data-test-id']: 'contentful-single-column',
|
|
2210
|
+
id: 'ContentfulSingleColumn',
|
|
2211
|
+
className: combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : ''),
|
|
2212
|
+
WrapperComponent: Flex,
|
|
2213
|
+
dragProps,
|
|
2214
|
+
...editorProps,
|
|
2215
|
+
});
|
|
2185
2216
|
};
|
|
2186
2217
|
|
|
2187
2218
|
const columnsDefinition = {
|
|
@@ -2203,7 +2234,18 @@ const singleColumnDefinition = {
|
|
|
2203
2234
|
};
|
|
2204
2235
|
|
|
2205
2236
|
const assemblyStyle = { display: 'contents' };
|
|
2237
|
+
// Feel free to do any magic as regards variable definitions for assemblies
|
|
2238
|
+
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell
|
|
2206
2239
|
const Assembly = (props) => {
|
|
2240
|
+
if (props.editorMode) {
|
|
2241
|
+
const { node, dragProps, ...editorModeProps } = props;
|
|
2242
|
+
return props.renderDropzone(node, {
|
|
2243
|
+
...editorModeProps,
|
|
2244
|
+
['data-test-id']: 'contentful-assembly',
|
|
2245
|
+
className: props.className,
|
|
2246
|
+
dragProps,
|
|
2247
|
+
});
|
|
2248
|
+
}
|
|
2207
2249
|
// Using a display contents so assembly content/children
|
|
2208
2250
|
// can appear as if they are direct children of the div wrapper's parent
|
|
2209
2251
|
return React.createElement("div", { "data-test-id": "assembly", ...props, style: assemblyStyle });
|