@contentful/experiences-components-react 3.6.1 → 3.6.2-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.js +34 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1477,8 +1477,20 @@ z.object({
|
|
|
1477
1477
|
componentSettings: localeWrapper(ComponentSettingsSchema),
|
|
1478
1478
|
});
|
|
1479
1479
|
|
|
1480
|
-
z
|
|
1480
|
+
z
|
|
1481
|
+
.object({
|
|
1481
1482
|
id: DefinitionPropertyKeySchema,
|
|
1483
|
+
name: z.string(),
|
|
1484
|
+
category: z.string().optional(),
|
|
1485
|
+
thumbnailUrl: z.string().optional(),
|
|
1486
|
+
thumbnailId: z.string().optional(),
|
|
1487
|
+
hyperlinkPattern: z.string().optional(),
|
|
1488
|
+
children: z.boolean().optional(),
|
|
1489
|
+
slots: z
|
|
1490
|
+
.record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))
|
|
1491
|
+
.optional(),
|
|
1492
|
+
builtInStyles: z.array(z.string()).optional(),
|
|
1493
|
+
tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),
|
|
1482
1494
|
variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({
|
|
1483
1495
|
defaultValue: PrimitiveValueSchema.optional(),
|
|
1484
1496
|
}).superRefine((val, ctx) => {
|
|
@@ -1584,6 +1596,27 @@ z.object({
|
|
|
1584
1596
|
break;
|
|
1585
1597
|
}
|
|
1586
1598
|
})),
|
|
1599
|
+
})
|
|
1600
|
+
.superRefine((val, ctx) => {
|
|
1601
|
+
if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {
|
|
1602
|
+
ctx.addIssue({
|
|
1603
|
+
code: z.ZodIssueCode.custom,
|
|
1604
|
+
message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,
|
|
1605
|
+
fatal: false,
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
// Ensure that slots and variables don't use the same names
|
|
1609
|
+
if (val.variables && val.slots) {
|
|
1610
|
+
Object.keys(val.variables).forEach((name) => {
|
|
1611
|
+
if (val.slots[name]) {
|
|
1612
|
+
ctx.addIssue({
|
|
1613
|
+
code: z.ZodIssueCode.custom,
|
|
1614
|
+
message: `Variable and slot cannot have the same name: ${name}`,
|
|
1615
|
+
fatal: false,
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1587
1620
|
});
|
|
1588
1621
|
|
|
1589
1622
|
var CodeNames;
|