@contentful/experiences-components-react 1.41.1-dev-20250613T1026-3de1677.0 → 1.42.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.css +1 -0
- package/dist/index.js +7 -35
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@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}.cf-button:empty:before{content:"";display:inline-block}.cf-heading,.cf-richtext{white-space:pre-line}.cf-richtext>:first-child{margin-top:0}.cf-richtext>:last-child{margin-bottom:0}.cf-text{white-space:pre-line}.cf-text-link .cf-text{margin:0}div.cf-placeholder-wrapper{position:relative}img.cf-placeholder-image{background-color:var(--cf-color-gray100);height:100%;outline:2px solid rgba(var(--cf-color-gray400-rgb),.5);outline-offset:-2px;width:100%}svg.cf-placeholder-icon{height:var(--cf-text-3xl);left:50%;max-height:100%;max-width:100%;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--cf-text-3xl)}svg.cf-placeholder-icon path{fill:var(--cf-color-gray400)}.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}.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}.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"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import styleInject from 'style-inject';
|
|
2
1
|
import React, { forwardRef } from 'react';
|
|
3
2
|
import { documentToReactComponents } from '@contentful/rich-text-react-renderer';
|
|
4
3
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
@@ -6,9 +5,6 @@ import { z } from 'zod';
|
|
|
6
5
|
import 'lodash-es';
|
|
7
6
|
import 'md5';
|
|
8
7
|
|
|
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
|
-
styleInject(css_248z$8);
|
|
11
|
-
|
|
12
8
|
/**
|
|
13
9
|
* These modes are ONLY intended to be internally used within the context of
|
|
14
10
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -81,9 +77,6 @@ function combineClasses(...classes) {
|
|
|
81
77
|
.join(' ');
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
var css_248z$7 = "/* If the label is empty, still render the normal height by adding this pseudo element */\n.cf-button:empty::before {\n content: '';\n display: inline-block;\n}\n";
|
|
85
|
-
styleInject(css_248z$7);
|
|
86
|
-
|
|
87
80
|
const Button = ({ children, className, label, onClick, onNavigate, target, url, ...props }) => {
|
|
88
81
|
const classes = combineClasses('cf-button', className);
|
|
89
82
|
const handleClick = (event) => {
|
|
@@ -196,9 +189,6 @@ const ButtonComponentDefinition = {
|
|
|
196
189
|
},
|
|
197
190
|
};
|
|
198
191
|
|
|
199
|
-
var css_248z$6 = ".cf-heading {\n white-space: pre-line;\n}\n";
|
|
200
|
-
styleInject(css_248z$6);
|
|
201
|
-
|
|
202
192
|
const Heading = ({ children, className, text, type = 'h1', ...props }) => {
|
|
203
193
|
const Tag = type;
|
|
204
194
|
const classes = combineClasses('cf-heading', className);
|
|
@@ -285,9 +275,6 @@ const HeadingComponentDefinition = {
|
|
|
285
275
|
},
|
|
286
276
|
};
|
|
287
277
|
|
|
288
|
-
var css_248z$5 = ".cf-richtext {\n white-space: pre-line;\n}\n\n.cf-richtext > *:first-child {\n margin-top: 0;\n}\n\n.cf-richtext > *:last-child {\n margin-bottom: 0;\n}\n";
|
|
289
|
-
styleInject(css_248z$5);
|
|
290
|
-
|
|
291
278
|
const RichText = ({ as = 'p', className, value, ...props }) => {
|
|
292
279
|
const Tag = as;
|
|
293
280
|
return (React.createElement("div", { className: combineClasses('cf-richtext', className), ...props }, documentToReactComponents(value, {
|
|
@@ -375,9 +362,6 @@ const RichTextComponentDefinition = {
|
|
|
375
362
|
},
|
|
376
363
|
};
|
|
377
364
|
|
|
378
|
-
var css_248z$4 = ".cf-text {\n white-space: pre-line;\n}\n\n.cf-text-link .cf-text {\n margin: 0;\n}\n";
|
|
379
|
-
styleInject(css_248z$4);
|
|
380
|
-
|
|
381
365
|
const Text = ({ as = 'p', children, className, value, url, target, onNavigate, onClick, ...props }) => {
|
|
382
366
|
const Tag = as;
|
|
383
367
|
if (url) {
|
|
@@ -469,9 +453,6 @@ const TextComponentDefinition = {
|
|
|
469
453
|
},
|
|
470
454
|
};
|
|
471
455
|
|
|
472
|
-
var css_248z$3 = "@import url(https://fonts.googleapis.com/css2?family=Archivo:ital,wght@0,400;0,500;0,600;1,400;1,600&display=swap);\n\n:root {\n /* All sizing comments based of 16px base body font size */\n\n /* color */\n --cf-color-white: #fff;\n --cf-color-black: #000;\n --cf-color-gray100: #f7f9fa;\n --cf-color-gray400: #aec1cc;\n --cf-color-gray400-rgb: 174, 193, 204;\n\n /* spacing */\n --cf-spacing-0: 0rem; /* 0px */\n --cf-spacing-1: 0.125rem; /* 2px */\n --cf-spacing-2: 0.25rem; /* 4px */\n --cf-spacing-3: 0.375rem; /* 6px */\n --cf-spacing-4: 0.5rem; /* 8px */\n --cf-spacing-5: 0.625rem; /* 10px */\n --cf-spacing-6: 0.75rem; /* 12px */\n --cf-spacing-7: 0.875rem; /* 14px */\n --cf-spacing-8: 1rem; /* 16px */\n --cf-spacing-9: 1.25rem; /* 20px */\n --cf-spacing-10: 1.5rem; /* 24px */\n --cf-spacing-11: 1.75rem; /* 28px */\n --cf-spacing-12: 2rem; /* 32px */\n --cf-spacing-13: 2.25rem; /* 36px */\n\n /* font-size */\n --cf-text-xs: 0.75rem; /* 12px */\n --cf-text-sm: 0.875rem; /* 14px */\n --cf-text-base: 1rem; /* 16px */\n --cf-text-lg: 1.125rem; /* 18px */\n --cf-text-xl: 1.25rem; /* 20px */\n --cf-text-2xl: 1.5rem; /* 24px */\n --cf-text-3xl: 2rem; /* 32px */\n --cf-text-4xl: 2.75rem; /* 44px */\n\n /* font-weight */\n --cf-font-light: 300;\n --cf-font-normal: 400;\n --cf-font-medium: 500;\n --cf-font-semibold: 600;\n --cf-font-bold: 700;\n --cf-font-extra-bold: 800;\n --cf-font-black: 900;\n\n /* border-radius */\n --cf-border-radius-none: 0px; /* none */\n --cf-border-radius-sm: 0.125rem; /* 2px */\n --cf-border-radius: 0.25rem; /* 4px */\n --cf-border-radius-md: 0.375rem; /* 6px */\n --cf-border-radius-lg: 0.5rem; /* 8px */\n --cf-border-radius-xl: 0.75rem; /* 12px */\n --cf-border-radius-2xl: 1rem; /* 16px */\n --cf-border-radius-3xl: 1.5rem; /* 24px */\n --cf-border-radius-full: 9999px; /* full */\n\n /* font-family */\n --cf-font-family-sans: Archivo, Helvetica, Arial, sans-serif;\n --cf-font-family-serif: Georgia, Cambria, Times New Roman, Times, serif;\n\n /* max widths */\n --cf-max-width-full: 100%;\n\n /* component specific colors */\n --cf-button-bg: var(--cf-color-black);\n --cf-button-color: var(--cf-color-white);\n --cf-text-color: var(--cf-color-black);\n}\n\ndiv.cf-placeholder-wrapper {\n /* Required for the absolute positioned icon to render in the center */\n position: relative;\n}\n\nimg.cf-placeholder-image {\n background-color: var(--cf-color-gray100);\n outline-offset: -2px;\n outline: 2px solid rgba(var(--cf-color-gray400-rgb), 0.5);\n width: 100%;\n height: 100%;\n}\n\nsvg.cf-placeholder-icon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: var(--cf-text-3xl);\n width: var(--cf-text-3xl);\n max-height: 100%;\n max-width: 100%;\n}\n\nsvg.cf-placeholder-icon path {\n fill: var(--cf-color-gray400);\n}\n";
|
|
473
|
-
styleInject(css_248z$3);
|
|
474
|
-
|
|
475
456
|
const Image = ({ className = '', src, cfImageAsset, ...props }) => {
|
|
476
457
|
if (!cfImageAsset && !src) {
|
|
477
458
|
return (React.createElement("div", { className: combineClasses('cf-placeholder-wrapper', className) },
|
|
@@ -1293,11 +1274,11 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
|
1293
1274
|
]);
|
|
1294
1275
|
// TODO: finalize schema structure before release
|
|
1295
1276
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1296
|
-
const
|
|
1277
|
+
const ParameterSchema = z.object({
|
|
1297
1278
|
type: z.literal('BoundValue'),
|
|
1298
1279
|
path: z.string(),
|
|
1299
1280
|
});
|
|
1300
|
-
const
|
|
1281
|
+
const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);
|
|
1301
1282
|
const BreakpointSchema = z
|
|
1302
1283
|
.object({
|
|
1303
1284
|
id: propertyKeySchema,
|
|
@@ -1314,7 +1295,7 @@ const BaseComponentTreeNodeSchema = z.object({
|
|
|
1314
1295
|
displayName: z.string().optional(),
|
|
1315
1296
|
slotId: z.string().optional(),
|
|
1316
1297
|
variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
|
|
1317
|
-
|
|
1298
|
+
parameters: ParametersSchema.optional(),
|
|
1318
1299
|
});
|
|
1319
1300
|
const ComponentVariableSchema = z.object({
|
|
1320
1301
|
displayName: z.string().optional(),
|
|
@@ -1383,13 +1364,13 @@ const THUMBNAIL_IDS = [
|
|
|
1383
1364
|
// TODO: finalize schema structure before release
|
|
1384
1365
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1385
1366
|
const VariableMappingSchema = z.object({
|
|
1386
|
-
|
|
1367
|
+
parameterId: propertyKeySchema,
|
|
1387
1368
|
type: z.literal('ContentTypeMapping'),
|
|
1388
1369
|
pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
|
|
1389
1370
|
});
|
|
1390
1371
|
// TODO: finalize schema structure before release
|
|
1391
1372
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1392
|
-
const
|
|
1373
|
+
const ParameterDefinitionSchema = z.object({
|
|
1393
1374
|
defaultValue: z
|
|
1394
1375
|
.record(z.string(), z.object({
|
|
1395
1376
|
sys: z.object({
|
|
@@ -1407,7 +1388,7 @@ const PatternPropertyDefinitionSchema = z.object({
|
|
|
1407
1388
|
}),
|
|
1408
1389
|
})),
|
|
1409
1390
|
});
|
|
1410
|
-
const
|
|
1391
|
+
const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
1411
1392
|
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
1412
1393
|
const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
|
|
1413
1394
|
ComponentVariableSchema);
|
|
@@ -1416,7 +1397,7 @@ const ComponentSettingsSchema = z.object({
|
|
|
1416
1397
|
thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
|
|
1417
1398
|
category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
|
|
1418
1399
|
variableMappings: VariableMappingsSchema.optional(),
|
|
1419
|
-
|
|
1400
|
+
parameterDefinitions: ParameterDefinitionsSchema.optional(),
|
|
1420
1401
|
});
|
|
1421
1402
|
z.object({
|
|
1422
1403
|
componentTree: localeWrapper(ComponentTreeSchema),
|
|
@@ -1627,9 +1608,6 @@ var VisualEditorMode;
|
|
|
1627
1608
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
1628
1609
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
1629
1610
|
|
|
1630
|
-
var css_248z$2 = ".contentful-container {\n position: relative;\n display: flex;\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";
|
|
1631
|
-
styleInject(css_248z$2);
|
|
1632
|
-
|
|
1633
1611
|
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) => {
|
|
1634
1612
|
return (React.createElement("div", { id: id, ref: ref, style: {
|
|
1635
1613
|
display: 'flex',
|
|
@@ -1723,9 +1701,6 @@ const sectionDefinition = {
|
|
|
1723
1701
|
},
|
|
1724
1702
|
};
|
|
1725
1703
|
|
|
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";
|
|
1727
|
-
styleInject(css_248z$1);
|
|
1728
|
-
|
|
1729
1704
|
const ContentfulDivider = ({ className = '',
|
|
1730
1705
|
// We have to exclude this explicitly from rendering as withComponentWrapper is not used
|
|
1731
1706
|
dragProps: _, ...props }) => {
|
|
@@ -1744,9 +1719,6 @@ const dividerDefinition = {
|
|
|
1744
1719
|
},
|
|
1745
1720
|
};
|
|
1746
1721
|
|
|
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";
|
|
1748
|
-
styleInject(css_248z);
|
|
1749
|
-
|
|
1750
1722
|
const ColumnWrapper = forwardRef((props, ref) => {
|
|
1751
1723
|
return (React.createElement("div", { ref: ref, ...props, style: {
|
|
1752
1724
|
...(props.style || {}),
|