@contentful/experiences-components-react 1.42.0-dev-20250630T1149-4da2e67.0 → 1.42.0-prerelease-20250620T0958-8e54295.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 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';
@@ -5,6 +6,9 @@ import { z } from 'zod';
5
6
  import 'lodash-es';
6
7
  import 'md5';
7
8
 
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
+
8
12
  /**
9
13
  * These modes are ONLY intended to be internally used within the context of
10
14
  * editing an experience inside of Contentful Studio. i.e. these modes
@@ -77,6 +81,9 @@ function combineClasses(...classes) {
77
81
  .join(' ');
78
82
  }
79
83
 
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
+
80
87
  const Button = ({ children, className, label, onClick, onNavigate, target, url, ...props }) => {
81
88
  const classes = combineClasses('cf-button', className);
82
89
  const handleClick = (event) => {
@@ -189,6 +196,9 @@ const ButtonComponentDefinition = {
189
196
  },
190
197
  };
191
198
 
199
+ var css_248z$6 = ".cf-heading {\n white-space: pre-line;\n}\n";
200
+ styleInject(css_248z$6);
201
+
192
202
  const Heading = ({ children, className, text, type = 'h1', ...props }) => {
193
203
  const Tag = type;
194
204
  const classes = combineClasses('cf-heading', className);
@@ -275,6 +285,9 @@ const HeadingComponentDefinition = {
275
285
  },
276
286
  };
277
287
 
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
+
278
291
  const RichText = ({ as = 'p', className, value, ...props }) => {
279
292
  const Tag = as;
280
293
  return (React.createElement("div", { className: combineClasses('cf-richtext', className), ...props }, documentToReactComponents(value, {
@@ -362,6 +375,9 @@ const RichTextComponentDefinition = {
362
375
  },
363
376
  };
364
377
 
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
+
365
381
  const Text = ({ as = 'p', children, className, value, url, target, onNavigate, onClick, ...props }) => {
366
382
  const Tag = as;
367
383
  if (url) {
@@ -453,6 +469,9 @@ const TextComponentDefinition = {
453
469
  },
454
470
  };
455
471
 
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
+
456
475
  const Image = ({ className = '', src, cfImageAsset, ...props }) => {
457
476
  if (!cfImageAsset && !src) {
458
477
  return (React.createElement("div", { className: combineClasses('cf-placeholder-wrapper', className) },
@@ -1274,11 +1293,11 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
1274
1293
  ]);
1275
1294
  // TODO: finalize schema structure before release
1276
1295
  // https://contentful.atlassian.net/browse/LUMOS-523
1277
- const ParameterSchema = z.object({
1296
+ const PatternPropertySchema = z.object({
1278
1297
  type: z.literal('BoundValue'),
1279
1298
  path: z.string(),
1280
1299
  });
1281
- const ParametersSchema = z.record(propertyKeySchema, ParameterSchema);
1300
+ const ParametersSchema = z.record(propertyKeySchema, PatternPropertySchema);
1282
1301
  const BreakpointSchema = z
1283
1302
  .object({
1284
1303
  id: propertyKeySchema,
@@ -1364,25 +1383,21 @@ const THUMBNAIL_IDS = [
1364
1383
  // TODO: finalize schema structure before release
1365
1384
  // https://contentful.atlassian.net/browse/LUMOS-523
1366
1385
  const VariableMappingSchema = z.object({
1367
- parameterId: propertyKeySchema,
1386
+ parameterDefinitionId: propertyKeySchema,
1368
1387
  type: z.literal('ContentTypeMapping'),
1369
1388
  pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
1370
1389
  });
1371
1390
  // TODO: finalize schema structure before release
1372
1391
  // https://contentful.atlassian.net/browse/LUMOS-523
1373
1392
  const ParameterDefinitionSchema = z.object({
1374
- defaultSource: z
1375
- .strictObject({
1376
- type: z.enum(['Entry']),
1377
- contentTypeId: z.string(),
1378
- link: z.strictObject({
1379
- sys: z.strictObject({
1380
- type: z.literal('Link'),
1381
- id: z.string(),
1382
- linkType: z.enum(['Entry']),
1383
- }),
1393
+ defaultValue: z
1394
+ .record(z.string(), z.object({
1395
+ sys: z.object({
1396
+ type: z.literal('Link'),
1397
+ id: z.string(),
1398
+ linkType: z.enum(['Entry']),
1384
1399
  }),
1385
- })
1400
+ }))
1386
1401
  .optional(),
1387
1402
  contentTypes: z.record(z.string(), z.object({
1388
1403
  sys: z.object({
@@ -1612,6 +1627,9 @@ var VisualEditorMode;
1612
1627
  VisualEditorMode["InjectScript"] = "injectScript";
1613
1628
  })(VisualEditorMode || (VisualEditorMode = {}));
1614
1629
 
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
+
1615
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) => {
1616
1634
  return (React.createElement("div", { id: id, ref: ref, style: {
1617
1635
  display: 'flex',
@@ -1705,6 +1723,9 @@ const sectionDefinition = {
1705
1723
  },
1706
1724
  };
1707
1725
 
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
+
1708
1729
  const ContentfulDivider = ({ className = '',
1709
1730
  // We have to exclude this explicitly from rendering as withComponentWrapper is not used
1710
1731
  dragProps: _, ...props }) => {
@@ -1723,6 +1744,9 @@ const dividerDefinition = {
1723
1744
  },
1724
1745
  };
1725
1746
 
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
+
1726
1750
  const ColumnWrapper = forwardRef((props, ref) => {
1727
1751
  return (React.createElement("div", { ref: ref, ...props, style: {
1728
1752
  ...(props.style || {}),