@contentful/experiences-components-react 2.0.0-prerelease-20250703T1150-c529c88.0 → 2.0.0-prerelease-20250704T1125-6c39a4b.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.js +30 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.css +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import styleInject from 'style-inject';
|
|
1
2
|
import React, { forwardRef } from 'react';
|
|
2
3
|
import { documentToReactComponents } from '@contentful/rich-text-react-renderer';
|
|
3
4
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
@@ -6,6 +7,9 @@ import 'lodash-es';
|
|
|
6
7
|
import 'md5';
|
|
7
8
|
import { create } from 'zustand';
|
|
8
9
|
|
|
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
|
+
styleInject(css_248z$8);
|
|
12
|
+
|
|
9
13
|
/**
|
|
10
14
|
* These modes are ONLY intended to be internally used within the context of
|
|
11
15
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -78,6 +82,9 @@ function combineClasses(...classes) {
|
|
|
78
82
|
.join(' ');
|
|
79
83
|
}
|
|
80
84
|
|
|
85
|
+
var css_248z$7 = ".cf-button:empty:before{content:\"\";display:inline-block}";
|
|
86
|
+
styleInject(css_248z$7);
|
|
87
|
+
|
|
81
88
|
const Button = ({ children, className, label, onClick, onNavigate, target, url, ...props }) => {
|
|
82
89
|
const classes = combineClasses('cf-button', className);
|
|
83
90
|
const handleClick = (event) => {
|
|
@@ -190,6 +197,9 @@ const ButtonComponentDefinition = {
|
|
|
190
197
|
},
|
|
191
198
|
};
|
|
192
199
|
|
|
200
|
+
var css_248z$6 = ".cf-heading{white-space:pre-line}";
|
|
201
|
+
styleInject(css_248z$6);
|
|
202
|
+
|
|
193
203
|
const Heading = ({ children, className, text, type = 'h1', ...props }) => {
|
|
194
204
|
const Tag = type;
|
|
195
205
|
const classes = combineClasses('cf-heading', className);
|
|
@@ -276,6 +286,9 @@ const HeadingComponentDefinition = {
|
|
|
276
286
|
},
|
|
277
287
|
};
|
|
278
288
|
|
|
289
|
+
var css_248z$5 = ".cf-richtext{white-space:pre-line}.cf-richtext>:first-child{margin-top:0}.cf-richtext>:last-child{margin-bottom:0}";
|
|
290
|
+
styleInject(css_248z$5);
|
|
291
|
+
|
|
279
292
|
const RichText = ({ as = 'p', className, value, ...props }) => {
|
|
280
293
|
const Tag = as;
|
|
281
294
|
return (React.createElement("div", { className: combineClasses('cf-richtext', className), ...props }, documentToReactComponents(value, {
|
|
@@ -363,6 +376,9 @@ const RichTextComponentDefinition = {
|
|
|
363
376
|
},
|
|
364
377
|
};
|
|
365
378
|
|
|
379
|
+
var css_248z$4 = ".cf-text{white-space:pre-line}.cf-text-link .cf-text{margin:0}";
|
|
380
|
+
styleInject(css_248z$4);
|
|
381
|
+
|
|
366
382
|
const Text = ({ as = 'p', children, className, value, url, target, onNavigate, onClick, ...props }) => {
|
|
367
383
|
const Tag = as;
|
|
368
384
|
if (url) {
|
|
@@ -454,6 +470,9 @@ const TextComponentDefinition = {
|
|
|
454
470
|
},
|
|
455
471
|
};
|
|
456
472
|
|
|
473
|
+
var css_248z$3 = "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)}";
|
|
474
|
+
styleInject(css_248z$3);
|
|
475
|
+
|
|
457
476
|
const Image = ({ className = '', src, cfImageAsset, ...props }) => {
|
|
458
477
|
if (!cfImageAsset && !src) {
|
|
459
478
|
return (React.createElement("div", { className: combineClasses('cf-placeholder-wrapper', className) },
|
|
@@ -1390,13 +1409,7 @@ const ParameterDefinitionSchema = z.object({
|
|
|
1390
1409
|
}),
|
|
1391
1410
|
})
|
|
1392
1411
|
.optional(),
|
|
1393
|
-
contentTypes: z.
|
|
1394
|
-
sys: z.object({
|
|
1395
|
-
type: z.literal('Link'),
|
|
1396
|
-
id: z.string(),
|
|
1397
|
-
linkType: z.enum(['ContentType']),
|
|
1398
|
-
}),
|
|
1399
|
-
})),
|
|
1412
|
+
contentTypes: z.array(z.string()),
|
|
1400
1413
|
passToNodes: z.array(PassToNodeSchema).optional(),
|
|
1401
1414
|
});
|
|
1402
1415
|
const ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);
|
|
@@ -1416,7 +1429,7 @@ const ComponentSettingsSchema = z
|
|
|
1416
1429
|
variableDefinitions: ComponentVariablesSchema,
|
|
1417
1430
|
thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
|
|
1418
1431
|
category: z.string().max(50, 'Category must contain at most 50 characters').optional(),
|
|
1419
|
-
prebindingDefinitions: z.array(PrebindingDefinitionSchema).
|
|
1432
|
+
prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),
|
|
1420
1433
|
})
|
|
1421
1434
|
.strict();
|
|
1422
1435
|
z.object({
|
|
@@ -2041,6 +2054,9 @@ var VisualEditorMode;
|
|
|
2041
2054
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
2042
2055
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
2043
2056
|
|
|
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}";
|
|
2058
|
+
styleInject(css_248z$2);
|
|
2059
|
+
|
|
2044
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) => {
|
|
2045
2061
|
return (React.createElement("div", { id: id, ref: ref, style: {
|
|
2046
2062
|
display: 'flex',
|
|
@@ -2134,6 +2150,9 @@ const sectionDefinition = {
|
|
|
2134
2150
|
},
|
|
2135
2151
|
};
|
|
2136
2152
|
|
|
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}";
|
|
2154
|
+
styleInject(css_248z$1);
|
|
2155
|
+
|
|
2137
2156
|
const ContentfulDivider = ({ className = '',
|
|
2138
2157
|
// We have to exclude this explicitly from rendering as withComponentWrapper is not used
|
|
2139
2158
|
dragProps: _, ...props }) => {
|
|
@@ -2152,6 +2171,9 @@ const dividerDefinition = {
|
|
|
2152
2171
|
},
|
|
2153
2172
|
};
|
|
2154
2173
|
|
|
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\"}";
|
|
2175
|
+
styleInject(css_248z);
|
|
2176
|
+
|
|
2155
2177
|
const ColumnWrapper = forwardRef((props, ref) => {
|
|
2156
2178
|
return (React.createElement("div", { ref: ref, ...props, style: {
|
|
2157
2179
|
...(props.style || {}),
|