@contentful/experiences-components-react 1.39.0-alpha-20250528T1549-bd210e1.0 → 1.39.0-beta.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 +106 -38
- 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
|
|
@@ -1533,6 +1532,32 @@ var CodeNames;
|
|
|
1533
1532
|
})(CodeNames || (CodeNames = {}));
|
|
1534
1533
|
|
|
1535
1534
|
const CF_DEBUG_KEY = 'cf_debug';
|
|
1535
|
+
/**
|
|
1536
|
+
* To ensure that the localStorage API can be used safely, we check
|
|
1537
|
+
* for availability (e.g. undefined in Node.js). Additionally, we
|
|
1538
|
+
* check if the localStorage can be used as some browsers throw a
|
|
1539
|
+
* SecurityError (e.g. Brave or Chromium with specific settings).
|
|
1540
|
+
*/
|
|
1541
|
+
const checkLocalStorageAvailability = () => {
|
|
1542
|
+
if (typeof localStorage === 'undefined' || localStorage === null) {
|
|
1543
|
+
return false;
|
|
1544
|
+
}
|
|
1545
|
+
try {
|
|
1546
|
+
// Attempt to set and remove an item to check if localStorage is enabled
|
|
1547
|
+
const TEST_KEY = 'cf_test_local_storage';
|
|
1548
|
+
localStorage.setItem(TEST_KEY, 'yes');
|
|
1549
|
+
if (localStorage.getItem(TEST_KEY) === 'yes') {
|
|
1550
|
+
localStorage.removeItem(TEST_KEY);
|
|
1551
|
+
return true;
|
|
1552
|
+
}
|
|
1553
|
+
else {
|
|
1554
|
+
return false;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
catch (_error) {
|
|
1558
|
+
return false;
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1536
1561
|
class DebugLogger {
|
|
1537
1562
|
constructor() {
|
|
1538
1563
|
// Public methods for logging
|
|
@@ -1540,7 +1565,7 @@ class DebugLogger {
|
|
|
1540
1565
|
this.warn = this.logger('warn');
|
|
1541
1566
|
this.log = this.logger('log');
|
|
1542
1567
|
this.debug = this.logger('debug');
|
|
1543
|
-
if (
|
|
1568
|
+
if (!checkLocalStorageAvailability()) {
|
|
1544
1569
|
this.enabled = false;
|
|
1545
1570
|
return;
|
|
1546
1571
|
}
|
|
@@ -1586,7 +1611,7 @@ var VisualEditorMode;
|
|
|
1586
1611
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
1587
1612
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
1588
1613
|
|
|
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";
|
|
1614
|
+
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
1615
|
styleInject(css_248z$2);
|
|
1591
1616
|
|
|
1592
1617
|
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 +1636,31 @@ const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave,
|
|
|
1611
1636
|
});
|
|
1612
1637
|
Flex.displayName = 'Flex';
|
|
1613
1638
|
|
|
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
|
-
|
|
1639
|
+
/* eslint-disable */ /* TODO: fix eslint errors */
|
|
1623
1640
|
const ContentfulContainerAsHyperlink = (props) => {
|
|
1624
|
-
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1641
|
+
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children } = props;
|
|
1642
|
+
if (editorMode === false) {
|
|
1643
|
+
let anchorTagProps = {};
|
|
1644
|
+
if (cfOpenInNewTab) {
|
|
1645
|
+
anchorTagProps = {
|
|
1646
|
+
target: '_blank',
|
|
1647
|
+
rel: 'noopener noreferrer',
|
|
1648
|
+
};
|
|
1630
1649
|
}
|
|
1631
|
-
:
|
|
1632
|
-
|
|
1633
|
-
};
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
|
|
1650
|
+
return (React.createElement("a", { className: combineClasses(className, 'contentful-container', 'contentful-container-link'), href: cfHyperlink, ...anchorTagProps }, children));
|
|
1651
|
+
}
|
|
1652
|
+
const { renderDropzone, node } = props;
|
|
1653
|
+
const stopPropagationInEditorMode = (e) => {
|
|
1654
|
+
e.stopPropagation();
|
|
1655
|
+
e.preventDefault();
|
|
1656
|
+
};
|
|
1657
|
+
return renderDropzone(node, {
|
|
1658
|
+
['data-test-id']: 'contentful-container',
|
|
1659
|
+
className: combineClasses(className, 'contentful-container', 'contentful-container-link'),
|
|
1660
|
+
zoneId: node.data.id,
|
|
1661
|
+
WrapperComponent: 'a',
|
|
1662
|
+
onClick: stopPropagationInEditorMode,
|
|
1663
|
+
});
|
|
1637
1664
|
};
|
|
1638
1665
|
|
|
1639
1666
|
/* eslint-disable */
|
|
@@ -1642,14 +1669,21 @@ const ContentfulContainer = (props) => {
|
|
|
1642
1669
|
if (cfHyperlink) {
|
|
1643
1670
|
return React.createElement(ContentfulContainerAsHyperlink, { ...props }, children);
|
|
1644
1671
|
}
|
|
1645
|
-
if (
|
|
1672
|
+
if (editorMode === false) {
|
|
1646
1673
|
return (React.createElement(Flex, { "data-test-id": "contentful-container", className: combineClasses(className, 'contentful-container') }, children));
|
|
1647
1674
|
}
|
|
1648
1675
|
// Extract properties that are only available in editor mode
|
|
1649
|
-
const { node } = props;
|
|
1676
|
+
const { renderDropzone, node, dragProps = {}, ...editorModeProps } = props;
|
|
1650
1677
|
const isEmpty = !node.children.length;
|
|
1651
1678
|
const isSection = node.data.blockId === CONTENTFUL_COMPONENTS$1.section.id;
|
|
1652
|
-
return (
|
|
1679
|
+
return renderDropzone(node, {
|
|
1680
|
+
...editorModeProps,
|
|
1681
|
+
['data-test-id']: 'contentful-container',
|
|
1682
|
+
id: 'ContentfulContainer',
|
|
1683
|
+
className: combineClasses('contentful-container', className, isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : ''),
|
|
1684
|
+
WrapperComponent: Flex,
|
|
1685
|
+
dragProps,
|
|
1686
|
+
});
|
|
1653
1687
|
};
|
|
1654
1688
|
|
|
1655
1689
|
const containerDefinition = {
|
|
@@ -1673,7 +1707,7 @@ const sectionDefinition = {
|
|
|
1673
1707
|
},
|
|
1674
1708
|
};
|
|
1675
1709
|
|
|
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";
|
|
1710
|
+
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
1711
|
styleInject(css_248z$1);
|
|
1678
1712
|
|
|
1679
1713
|
const ContentfulDivider = ({ className = '',
|
|
@@ -1694,25 +1728,48 @@ const dividerDefinition = {
|
|
|
1694
1728
|
},
|
|
1695
1729
|
};
|
|
1696
1730
|
|
|
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";
|
|
1731
|
+
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
1732
|
styleInject(css_248z);
|
|
1699
1733
|
|
|
1700
|
-
const
|
|
1701
|
-
return (React.createElement("div", {
|
|
1734
|
+
const ColumnWrapper = forwardRef((props, ref) => {
|
|
1735
|
+
return (React.createElement("div", { ref: ref, ...props, style: {
|
|
1736
|
+
...(props.style || {}),
|
|
1702
1737
|
display: 'grid',
|
|
1703
1738
|
gridTemplateColumns: 'repeat(12, [col-start] 1fr)',
|
|
1704
|
-
}
|
|
1739
|
+
} }, props.children));
|
|
1740
|
+
});
|
|
1741
|
+
ColumnWrapper.displayName = 'ColumnWrapper';
|
|
1742
|
+
const Columns = (props) => {
|
|
1743
|
+
const { editorMode, className, children } = props;
|
|
1744
|
+
if (!editorMode) {
|
|
1745
|
+
return (React.createElement(ColumnWrapper, { className: combineClasses(className, 'cf-columns') }, children));
|
|
1746
|
+
}
|
|
1747
|
+
const { node, renderDropzone, dragProps = {}, ...rest } = props;
|
|
1748
|
+
return renderDropzone(node, {
|
|
1749
|
+
...rest,
|
|
1750
|
+
['data-test-id']: 'contentful-columns',
|
|
1751
|
+
id: 'ContentfulContainer',
|
|
1752
|
+
className: combineClasses('cf-columns', className),
|
|
1753
|
+
WrapperComponent: ColumnWrapper,
|
|
1754
|
+
dragProps,
|
|
1755
|
+
});
|
|
1705
1756
|
};
|
|
1706
1757
|
|
|
1707
1758
|
const SingleColumn = (props) => {
|
|
1708
|
-
const { className, editorMode } = props;
|
|
1709
|
-
if (
|
|
1710
|
-
return React.createElement(Flex, { className: className },
|
|
1759
|
+
const { className, editorMode, children } = props;
|
|
1760
|
+
if (editorMode === false) {
|
|
1761
|
+
return React.createElement(Flex, { className: className }, children);
|
|
1711
1762
|
}
|
|
1712
|
-
const { node,
|
|
1763
|
+
const { renderDropzone, node, className: _className, dragProps = {}, cfColumnSpan, editorMode: edit, ...editorProps } = props;
|
|
1713
1764
|
const isEmpty = !node.children.length;
|
|
1714
|
-
|
|
1715
|
-
|
|
1765
|
+
return renderDropzone(node, {
|
|
1766
|
+
['data-test-id']: 'contentful-single-column',
|
|
1767
|
+
id: 'ContentfulSingleColumn',
|
|
1768
|
+
className: combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : ''),
|
|
1769
|
+
WrapperComponent: Flex,
|
|
1770
|
+
dragProps,
|
|
1771
|
+
...editorProps,
|
|
1772
|
+
});
|
|
1716
1773
|
};
|
|
1717
1774
|
|
|
1718
1775
|
const columnsDefinition = {
|
|
@@ -1734,7 +1791,18 @@ const singleColumnDefinition = {
|
|
|
1734
1791
|
};
|
|
1735
1792
|
|
|
1736
1793
|
const assemblyStyle = { display: 'contents' };
|
|
1794
|
+
// Feel free to do any magic as regards variable definitions for assemblies
|
|
1795
|
+
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell
|
|
1737
1796
|
const Assembly = (props) => {
|
|
1797
|
+
if (props.editorMode) {
|
|
1798
|
+
const { node, dragProps, ...editorModeProps } = props;
|
|
1799
|
+
return props.renderDropzone(node, {
|
|
1800
|
+
...editorModeProps,
|
|
1801
|
+
['data-test-id']: 'contentful-assembly',
|
|
1802
|
+
className: props.className,
|
|
1803
|
+
dragProps,
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1738
1806
|
// Using a display contents so assembly content/children
|
|
1739
1807
|
// can appear as if they are direct children of the div wrapper's parent
|
|
1740
1808
|
return React.createElement("div", { "data-test-id": "assembly", ...props, style: assemblyStyle });
|