@contentful/experiences-components-react 1.39.0-alpha-20250528T1201-58ca01e.0 → 1.39.0-alpha-20250528T1549-bd210e1.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 +30 -85
- package/dist/index.js +152 -188
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ 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 */
|
|
12
13
|
/**
|
|
13
14
|
* These modes are ONLY intended to be internally used within the context of
|
|
14
15
|
* editing an experience inside of Contentful Studio. i.e. these modes
|
|
@@ -1161,17 +1162,16 @@ const PrimitiveValueSchema = z.union([
|
|
|
1161
1162
|
z.record(z.any(), z.any()),
|
|
1162
1163
|
z.undefined(),
|
|
1163
1164
|
]);
|
|
1165
|
+
const UsedComponentsSchema = z.array(z.object({
|
|
1166
|
+
sys: z.object({
|
|
1167
|
+
type: z.literal('Link'),
|
|
1168
|
+
id: z.string(),
|
|
1169
|
+
linkType: z.literal('Entry'),
|
|
1170
|
+
}),
|
|
1171
|
+
}));
|
|
1164
1172
|
const uuidKeySchema = z
|
|
1165
1173
|
.string()
|
|
1166
1174
|
.regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });
|
|
1167
|
-
/**
|
|
1168
|
-
* Property keys for imported components have a limit of 32 characters (to be implemented) while
|
|
1169
|
-
* property keys for patterns have a limit of 54 characters (<32-char-variabl-name>_<21-char-nanoid-id>).
|
|
1170
|
-
* Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.
|
|
1171
|
-
*/
|
|
1172
|
-
const propertyKeySchema = z
|
|
1173
|
-
.string()
|
|
1174
|
-
.regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });
|
|
1175
1175
|
const DataSourceSchema = z.record(uuidKeySchema, z.object({
|
|
1176
1176
|
sys: z.object({
|
|
1177
1177
|
type: z.literal('Link'),
|
|
@@ -1179,7 +1179,62 @@ const DataSourceSchema = z.record(uuidKeySchema, z.object({
|
|
|
1179
1179
|
linkType: z.enum(['Entry', 'Asset']),
|
|
1180
1180
|
}),
|
|
1181
1181
|
}));
|
|
1182
|
+
const UnboundValuesSchema = z.record(uuidKeySchema, z.object({
|
|
1183
|
+
value: PrimitiveValueSchema,
|
|
1184
|
+
}));
|
|
1185
|
+
/**
|
|
1186
|
+
* Property keys for imported components have a limit of 32 characters (to be implemented) while
|
|
1187
|
+
* property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).
|
|
1188
|
+
* Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.
|
|
1189
|
+
*/
|
|
1190
|
+
const propertyKeySchema = z
|
|
1191
|
+
.string()
|
|
1192
|
+
.regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });
|
|
1193
|
+
const ComponentTreeNodeIdSchema = z
|
|
1194
|
+
.string()
|
|
1195
|
+
.regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });
|
|
1196
|
+
const breakpointsRefinement = (value, ctx) => {
|
|
1197
|
+
if (!value.length || value[0].query !== '*') {
|
|
1198
|
+
ctx.addIssue({
|
|
1199
|
+
code: z.ZodIssueCode.custom,
|
|
1200
|
+
message: `The first breakpoint should include the following attributes: { "query": "*" }`,
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
const hasDuplicateIds = value.some((currentBreakpoint, currentBreakpointIndex) => {
|
|
1204
|
+
// check if the current breakpoint id is found in the rest of the array
|
|
1205
|
+
const breakpointIndex = value.findIndex((breakpoint) => breakpoint.id === currentBreakpoint.id);
|
|
1206
|
+
return breakpointIndex !== currentBreakpointIndex;
|
|
1207
|
+
});
|
|
1208
|
+
if (hasDuplicateIds) {
|
|
1209
|
+
ctx.addIssue({
|
|
1210
|
+
code: z.ZodIssueCode.custom,
|
|
1211
|
+
message: `Breakpoint IDs must be unique`,
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
// Extract the queries boundary by removing the special characters around it
|
|
1215
|
+
const queries = value.map((bp) => bp.query === '*' ? bp.query : parseInt(bp.query.replace(/px|<|>/, '')));
|
|
1216
|
+
// sort updates queries array in place so we need to create a copy
|
|
1217
|
+
const originalQueries = [...queries];
|
|
1218
|
+
queries.sort((q1, q2) => {
|
|
1219
|
+
if (q1 === '*') {
|
|
1220
|
+
return -1;
|
|
1221
|
+
}
|
|
1222
|
+
if (q2 === '*') {
|
|
1223
|
+
return 1;
|
|
1224
|
+
}
|
|
1225
|
+
return q1 > q2 ? -1 : 1;
|
|
1226
|
+
});
|
|
1227
|
+
if (originalQueries.join('') !== queries.join('')) {
|
|
1228
|
+
ctx.addIssue({
|
|
1229
|
+
code: z.ZodIssueCode.custom,
|
|
1230
|
+
message: `Breakpoints should be ordered from largest to smallest pixel value`,
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1182
1234
|
const ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));
|
|
1235
|
+
const BindingSourceTypeEnumSchema = z
|
|
1236
|
+
.array(z.enum(['entry', 'asset', 'manual', 'experience']))
|
|
1237
|
+
.nonempty();
|
|
1183
1238
|
const DesignValueSchema = z
|
|
1184
1239
|
.object({
|
|
1185
1240
|
type: z.literal('DesignValue'),
|
|
@@ -1212,8 +1267,6 @@ const ComponentValueSchema = z
|
|
|
1212
1267
|
key: z.string(),
|
|
1213
1268
|
})
|
|
1214
1269
|
.strict();
|
|
1215
|
-
// TODO: finalize schema structure before release
|
|
1216
|
-
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1217
1270
|
const NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();
|
|
1218
1271
|
const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
1219
1272
|
DesignValueSchema,
|
|
@@ -1225,41 +1278,12 @@ const ComponentPropertyValueSchema = z.discriminatedUnion('type', [
|
|
|
1225
1278
|
]);
|
|
1226
1279
|
// TODO: finalize schema structure before release
|
|
1227
1280
|
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1228
|
-
const VariableMappingSchema = z.object({
|
|
1229
|
-
patternPropertyDefinitionId: propertyKeySchema,
|
|
1230
|
-
type: z.literal('ContentTypeMapping'),
|
|
1231
|
-
pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
|
|
1232
|
-
});
|
|
1233
|
-
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
1234
|
-
// TODO: finalize schema structure before release
|
|
1235
|
-
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1236
|
-
const PatternPropertyDefinitionSchema = z.object({
|
|
1237
|
-
defaultValue: z
|
|
1238
|
-
.record(z.string(), z.object({
|
|
1239
|
-
sys: z.object({
|
|
1240
|
-
type: z.literal('Link'),
|
|
1241
|
-
id: z.string(),
|
|
1242
|
-
linkType: z.enum(['Entry']),
|
|
1243
|
-
}),
|
|
1244
|
-
}))
|
|
1245
|
-
.optional(),
|
|
1246
|
-
contentTypes: z.record(z.string(), z.object({
|
|
1247
|
-
sys: z.object({
|
|
1248
|
-
type: z.literal('Link'),
|
|
1249
|
-
id: z.string(),
|
|
1250
|
-
linkType: z.enum(['ContentType']),
|
|
1251
|
-
}),
|
|
1252
|
-
})),
|
|
1253
|
-
});
|
|
1254
|
-
const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
|
|
1255
|
-
// TODO: finalize schema structure before release
|
|
1256
|
-
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1257
1281
|
const PatternPropertySchema = z.object({
|
|
1258
1282
|
type: z.literal('BoundValue'),
|
|
1259
1283
|
path: z.string(),
|
|
1260
1284
|
contentType: z.string(),
|
|
1261
1285
|
});
|
|
1262
|
-
const
|
|
1286
|
+
const PatternPropertiesSchema = z.record(propertyKeySchema, PatternPropertySchema);
|
|
1263
1287
|
const BreakpointSchema = z
|
|
1264
1288
|
.object({
|
|
1265
1289
|
id: propertyKeySchema,
|
|
@@ -1269,12 +1293,6 @@ const BreakpointSchema = z
|
|
|
1269
1293
|
displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),
|
|
1270
1294
|
})
|
|
1271
1295
|
.strict();
|
|
1272
|
-
const UnboundValuesSchema = z.record(uuidKeySchema, z.object({
|
|
1273
|
-
value: PrimitiveValueSchema,
|
|
1274
|
-
}));
|
|
1275
|
-
const ComponentTreeNodeIdSchema = z
|
|
1276
|
-
.string()
|
|
1277
|
-
.regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });
|
|
1278
1296
|
// Use helper schema to define a recursive schema with its type correctly below
|
|
1279
1297
|
const BaseComponentTreeNodeSchema = z.object({
|
|
1280
1298
|
id: ComponentTreeNodeIdSchema.optional(),
|
|
@@ -1282,14 +1300,8 @@ const BaseComponentTreeNodeSchema = z.object({
|
|
|
1282
1300
|
displayName: z.string().optional(),
|
|
1283
1301
|
slotId: z.string().optional(),
|
|
1284
1302
|
variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),
|
|
1285
|
-
patternProperties:
|
|
1286
|
-
});
|
|
1287
|
-
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
1288
|
-
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
1303
|
+
patternProperties: PatternPropertiesSchema.optional(),
|
|
1289
1304
|
});
|
|
1290
|
-
const BindingSourceTypeEnumSchema = z
|
|
1291
|
-
.array(z.enum(['entry', 'asset', 'manual', 'experience']))
|
|
1292
|
-
.nonempty();
|
|
1293
1305
|
const ComponentVariableSchema = z.object({
|
|
1294
1306
|
displayName: z.string().optional(),
|
|
1295
1307
|
type: DefinitionPropertyTypeSchema,
|
|
@@ -1310,8 +1322,25 @@ const ComponentVariableSchema = z.object({
|
|
|
1310
1322
|
})
|
|
1311
1323
|
.optional(),
|
|
1312
1324
|
});
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1325
|
+
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
1326
|
+
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
1327
|
+
});
|
|
1328
|
+
const ComponentTreeSchema = z
|
|
1329
|
+
.object({
|
|
1330
|
+
breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),
|
|
1331
|
+
children: z.array(ComponentTreeNodeSchema),
|
|
1332
|
+
schemaVersion: SchemaVersions,
|
|
1333
|
+
})
|
|
1334
|
+
.strict();
|
|
1335
|
+
const localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);
|
|
1336
|
+
|
|
1337
|
+
z.object({
|
|
1338
|
+
componentTree: localeWrapper(ComponentTreeSchema),
|
|
1339
|
+
dataSource: localeWrapper(DataSourceSchema),
|
|
1340
|
+
unboundValues: localeWrapper(UnboundValuesSchema),
|
|
1341
|
+
usedComponents: localeWrapper(UsedComponentsSchema).optional(),
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1315
1344
|
const THUMBNAIL_IDS = [
|
|
1316
1345
|
'columns',
|
|
1317
1346
|
'columnsPlusRight',
|
|
@@ -1337,6 +1366,37 @@ const THUMBNAIL_IDS = [
|
|
|
1337
1366
|
'textColumns',
|
|
1338
1367
|
'duplex',
|
|
1339
1368
|
];
|
|
1369
|
+
// TODO: finalize schema structure before release
|
|
1370
|
+
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1371
|
+
const VariableMappingSchema = z.object({
|
|
1372
|
+
patternPropertyDefinitionId: propertyKeySchema,
|
|
1373
|
+
type: z.literal('ContentTypeMapping'),
|
|
1374
|
+
pathsByContentType: z.record(z.string(), z.object({ path: z.string() })),
|
|
1375
|
+
});
|
|
1376
|
+
// TODO: finalize schema structure before release
|
|
1377
|
+
// https://contentful.atlassian.net/browse/LUMOS-523
|
|
1378
|
+
const PatternPropertyDefinitionSchema = z.object({
|
|
1379
|
+
defaultValue: z
|
|
1380
|
+
.record(z.string(), z.object({
|
|
1381
|
+
sys: z.object({
|
|
1382
|
+
type: z.literal('Link'),
|
|
1383
|
+
id: z.string(),
|
|
1384
|
+
linkType: z.enum(['Entry']),
|
|
1385
|
+
}),
|
|
1386
|
+
}))
|
|
1387
|
+
.optional(),
|
|
1388
|
+
contentTypes: z.record(z.string(), z.object({
|
|
1389
|
+
sys: z.object({
|
|
1390
|
+
type: z.literal('Link'),
|
|
1391
|
+
id: z.string(),
|
|
1392
|
+
linkType: z.enum(['ContentType']),
|
|
1393
|
+
}),
|
|
1394
|
+
})),
|
|
1395
|
+
});
|
|
1396
|
+
const PatternPropertyDefinitionsSchema = z.record(propertyKeySchema, PatternPropertyDefinitionSchema);
|
|
1397
|
+
const VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);
|
|
1398
|
+
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
|
|
1399
|
+
ComponentVariableSchema);
|
|
1340
1400
|
const ComponentSettingsSchema = z.object({
|
|
1341
1401
|
variableDefinitions: ComponentVariablesSchema,
|
|
1342
1402
|
thumbnailId: z.enum(THUMBNAIL_IDS).optional(),
|
|
@@ -1344,65 +1404,12 @@ const ComponentSettingsSchema = z.object({
|
|
|
1344
1404
|
variableMappings: VariableMappingsSchema.optional(),
|
|
1345
1405
|
patternPropertyDefinitions: PatternPropertyDefinitionsSchema.optional(),
|
|
1346
1406
|
});
|
|
1347
|
-
const UsedComponentsSchema = z.array(z.object({
|
|
1348
|
-
sys: z.object({
|
|
1349
|
-
type: z.literal('Link'),
|
|
1350
|
-
id: z.string(),
|
|
1351
|
-
linkType: z.literal('Entry'),
|
|
1352
|
-
}),
|
|
1353
|
-
}));
|
|
1354
|
-
const breakpointsRefinement = (value, ctx) => {
|
|
1355
|
-
if (!value.length || value[0].query !== '*') {
|
|
1356
|
-
ctx.addIssue({
|
|
1357
|
-
code: z.ZodIssueCode.custom,
|
|
1358
|
-
message: `The first breakpoint should include the following attributes: { "query": "*" }`,
|
|
1359
|
-
});
|
|
1360
|
-
}
|
|
1361
|
-
const hasDuplicateIds = value.some((currentBreakpoint, currentBreakpointIndex) => {
|
|
1362
|
-
// check if the current breakpoint id is found in the rest of the array
|
|
1363
|
-
const breakpointIndex = value.findIndex((breakpoint) => breakpoint.id === currentBreakpoint.id);
|
|
1364
|
-
return breakpointIndex !== currentBreakpointIndex;
|
|
1365
|
-
});
|
|
1366
|
-
if (hasDuplicateIds) {
|
|
1367
|
-
ctx.addIssue({
|
|
1368
|
-
code: z.ZodIssueCode.custom,
|
|
1369
|
-
message: `Breakpoint IDs must be unique`,
|
|
1370
|
-
});
|
|
1371
|
-
}
|
|
1372
|
-
// Extract the queries boundary by removing the special characters around it
|
|
1373
|
-
const queries = value.map((bp) => bp.query === '*' ? bp.query : parseInt(bp.query.replace(/px|<|>/, '')));
|
|
1374
|
-
// sort updates queries array in place so we need to create a copy
|
|
1375
|
-
const originalQueries = [...queries];
|
|
1376
|
-
queries.sort((q1, q2) => {
|
|
1377
|
-
if (q1 === '*') {
|
|
1378
|
-
return -1;
|
|
1379
|
-
}
|
|
1380
|
-
if (q2 === '*') {
|
|
1381
|
-
return 1;
|
|
1382
|
-
}
|
|
1383
|
-
return q1 > q2 ? -1 : 1;
|
|
1384
|
-
});
|
|
1385
|
-
if (originalQueries.join('') !== queries.join('')) {
|
|
1386
|
-
ctx.addIssue({
|
|
1387
|
-
code: z.ZodIssueCode.custom,
|
|
1388
|
-
message: `Breakpoints should be ordered from largest to smallest pixel value`,
|
|
1389
|
-
});
|
|
1390
|
-
}
|
|
1391
|
-
};
|
|
1392
|
-
const ComponentTreeSchema = z
|
|
1393
|
-
.object({
|
|
1394
|
-
breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),
|
|
1395
|
-
children: z.array(ComponentTreeNodeSchema),
|
|
1396
|
-
schemaVersion: SchemaVersions,
|
|
1397
|
-
})
|
|
1398
|
-
.strict();
|
|
1399
|
-
const localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);
|
|
1400
1407
|
z.object({
|
|
1401
1408
|
componentTree: localeWrapper(ComponentTreeSchema),
|
|
1402
1409
|
dataSource: localeWrapper(DataSourceSchema),
|
|
1403
1410
|
unboundValues: localeWrapper(UnboundValuesSchema),
|
|
1404
1411
|
usedComponents: localeWrapper(UsedComponentsSchema).optional(),
|
|
1405
|
-
componentSettings: localeWrapper(ComponentSettingsSchema)
|
|
1412
|
+
componentSettings: localeWrapper(ComponentSettingsSchema),
|
|
1406
1413
|
});
|
|
1407
1414
|
|
|
1408
1415
|
z.object({
|
|
@@ -1579,7 +1586,7 @@ var VisualEditorMode;
|
|
|
1579
1586
|
VisualEditorMode["InjectScript"] = "injectScript";
|
|
1580
1587
|
})(VisualEditorMode || (VisualEditorMode = {}));
|
|
1581
1588
|
|
|
1582
|
-
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-
|
|
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";
|
|
1583
1590
|
styleInject(css_248z$2);
|
|
1584
1591
|
|
|
1585
1592
|
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) => {
|
|
@@ -1604,31 +1611,29 @@ const Flex = forwardRef(({ id, children, onMouseEnter, onMouseUp, onMouseLeave,
|
|
|
1604
1611
|
});
|
|
1605
1612
|
Flex.displayName = 'Flex';
|
|
1606
1613
|
|
|
1607
|
-
|
|
1614
|
+
function extractRenderProps(props) {
|
|
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
|
+
|
|
1608
1623
|
const ContentfulContainerAsHyperlink = (props) => {
|
|
1609
|
-
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children } = props;
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
rel: 'noopener noreferrer',
|
|
1616
|
-
};
|
|
1624
|
+
const { cfHyperlink, cfOpenInNewTab, editorMode, className, children, ...otherProps } = props;
|
|
1625
|
+
const eventHandlingProps = editorMode === true ? { onClick: stopEventPropagation } : {};
|
|
1626
|
+
const anchorTagProps = cfOpenInNewTab
|
|
1627
|
+
? {
|
|
1628
|
+
target: '_blank',
|
|
1629
|
+
rel: 'noopener noreferrer',
|
|
1617
1630
|
}
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
};
|
|
1625
|
-
return renderDropzone(node, {
|
|
1626
|
-
['data-test-id']: 'contentful-container',
|
|
1627
|
-
className: combineClasses(className, 'contentful-container', 'contentful-container-link'),
|
|
1628
|
-
zoneId: node.data.id,
|
|
1629
|
-
WrapperComponent: 'a',
|
|
1630
|
-
onClick: stopPropagationInEditorMode,
|
|
1631
|
-
});
|
|
1631
|
+
: {};
|
|
1632
|
+
return (React.createElement("a", { className: combineClasses(className, 'contentful-container', 'contentful-container-link'), href: cfHyperlink, ...anchorTagProps, ...eventHandlingProps, ...extractRenderProps(otherProps) }, children));
|
|
1633
|
+
};
|
|
1634
|
+
const stopEventPropagation = (event) => {
|
|
1635
|
+
event.stopPropagation();
|
|
1636
|
+
event.preventDefault();
|
|
1632
1637
|
};
|
|
1633
1638
|
|
|
1634
1639
|
/* eslint-disable */
|
|
@@ -1637,21 +1642,14 @@ const ContentfulContainer = (props) => {
|
|
|
1637
1642
|
if (cfHyperlink) {
|
|
1638
1643
|
return React.createElement(ContentfulContainerAsHyperlink, { ...props }, children);
|
|
1639
1644
|
}
|
|
1640
|
-
if (editorMode
|
|
1645
|
+
if (!editorMode) {
|
|
1641
1646
|
return (React.createElement(Flex, { "data-test-id": "contentful-container", className: combineClasses(className, 'contentful-container') }, children));
|
|
1642
1647
|
}
|
|
1643
1648
|
// Extract properties that are only available in editor mode
|
|
1644
|
-
const {
|
|
1649
|
+
const { node } = props;
|
|
1645
1650
|
const isEmpty = !node.children.length;
|
|
1646
1651
|
const isSection = node.data.blockId === CONTENTFUL_COMPONENTS$1.section.id;
|
|
1647
|
-
return
|
|
1648
|
-
...editorModeProps,
|
|
1649
|
-
['data-test-id']: 'contentful-container',
|
|
1650
|
-
id: 'ContentfulContainer',
|
|
1651
|
-
className: combineClasses('contentful-container', className, isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : ''),
|
|
1652
|
-
WrapperComponent: Flex,
|
|
1653
|
-
dragProps,
|
|
1654
|
-
});
|
|
1652
|
+
return (React.createElement(Flex, { "data-test-id": "contentful-container", ...extractRenderProps(props), className: combineClasses(className, 'contentful-container', isEmpty ? (isSection ? 'contentful-section-label' : 'contentful-container-label') : '') }, children));
|
|
1655
1653
|
};
|
|
1656
1654
|
|
|
1657
1655
|
const containerDefinition = {
|
|
@@ -1675,7 +1673,7 @@ const sectionDefinition = {
|
|
|
1675
1673
|
},
|
|
1676
1674
|
};
|
|
1677
1675
|
|
|
1678
|
-
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
|
|
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";
|
|
1679
1677
|
styleInject(css_248z$1);
|
|
1680
1678
|
|
|
1681
1679
|
const ContentfulDivider = ({ className = '',
|
|
@@ -1696,48 +1694,25 @@ const dividerDefinition = {
|
|
|
1696
1694
|
},
|
|
1697
1695
|
};
|
|
1698
1696
|
|
|
1699
|
-
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
|
|
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";
|
|
1700
1698
|
styleInject(css_248z);
|
|
1701
1699
|
|
|
1702
|
-
const
|
|
1703
|
-
return (React.createElement("div", {
|
|
1704
|
-
...(props.style || {}),
|
|
1700
|
+
const Columns = ({ className, children, ...otherProps }) => {
|
|
1701
|
+
return (React.createElement("div", { className: combineClasses(className, 'cf-columns'), style: {
|
|
1705
1702
|
display: 'grid',
|
|
1706
1703
|
gridTemplateColumns: 'repeat(12, [col-start] 1fr)',
|
|
1707
|
-
} },
|
|
1708
|
-
});
|
|
1709
|
-
ColumnWrapper.displayName = 'ColumnWrapper';
|
|
1710
|
-
const Columns = (props) => {
|
|
1711
|
-
const { editorMode, className, children } = props;
|
|
1712
|
-
if (!editorMode) {
|
|
1713
|
-
return (React.createElement(ColumnWrapper, { className: combineClasses(className, 'cf-columns') }, children));
|
|
1714
|
-
}
|
|
1715
|
-
const { node, renderDropzone, dragProps = {}, ...rest } = props;
|
|
1716
|
-
return renderDropzone(node, {
|
|
1717
|
-
...rest,
|
|
1718
|
-
['data-test-id']: 'contentful-columns',
|
|
1719
|
-
id: 'ContentfulContainer',
|
|
1720
|
-
className: combineClasses('cf-columns', className),
|
|
1721
|
-
WrapperComponent: ColumnWrapper,
|
|
1722
|
-
dragProps,
|
|
1723
|
-
});
|
|
1704
|
+
}, ...extractRenderProps(otherProps) }, children));
|
|
1724
1705
|
};
|
|
1725
1706
|
|
|
1726
1707
|
const SingleColumn = (props) => {
|
|
1727
|
-
const { className, editorMode
|
|
1728
|
-
if (editorMode
|
|
1729
|
-
return React.createElement(Flex, { className: className }, children);
|
|
1708
|
+
const { className, editorMode } = props;
|
|
1709
|
+
if (!editorMode) {
|
|
1710
|
+
return React.createElement(Flex, { className: className }, props.children);
|
|
1730
1711
|
}
|
|
1731
|
-
const {
|
|
1712
|
+
const { node, children } = props;
|
|
1732
1713
|
const isEmpty = !node.children.length;
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
id: 'ContentfulSingleColumn',
|
|
1736
|
-
className: combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : ''),
|
|
1737
|
-
WrapperComponent: Flex,
|
|
1738
|
-
dragProps,
|
|
1739
|
-
...editorProps,
|
|
1740
|
-
});
|
|
1714
|
+
const mixedClassName = combineClasses('cf-single-column-wrapper', className, isEmpty ? 'cf-single-column-label' : '');
|
|
1715
|
+
return (React.createElement(Flex, { ...extractRenderProps(props), className: mixedClassName }, children));
|
|
1741
1716
|
};
|
|
1742
1717
|
|
|
1743
1718
|
const columnsDefinition = {
|
|
@@ -1759,18 +1734,7 @@ const singleColumnDefinition = {
|
|
|
1759
1734
|
};
|
|
1760
1735
|
|
|
1761
1736
|
const assemblyStyle = { display: 'contents' };
|
|
1762
|
-
// Feel free to do any magic as regards variable definitions for assemblies
|
|
1763
|
-
// Or if this isn't necessary by the time we figure that part out, we can bid this part farewell
|
|
1764
1737
|
const Assembly = (props) => {
|
|
1765
|
-
if (props.editorMode) {
|
|
1766
|
-
const { node, dragProps, ...editorModeProps } = props;
|
|
1767
|
-
return props.renderDropzone(node, {
|
|
1768
|
-
...editorModeProps,
|
|
1769
|
-
['data-test-id']: 'contentful-assembly',
|
|
1770
|
-
className: props.className,
|
|
1771
|
-
dragProps,
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
1738
|
// Using a display contents so assembly content/children
|
|
1775
1739
|
// can appear as if they are direct children of the div wrapper's parent
|
|
1776
1740
|
return React.createElement("div", { "data-test-id": "assembly", ...props, style: assemblyStyle });
|