dune-react 0.0.40 → 0.0.41
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/components/puck-block/registry.generated.d.ts +3 -0
- package/dist/components/puck-block/testimonial-sections/bento-testimonial/index.d.ts +3 -0
- package/dist/components/puck-block/testimonial-sections/bento-testimonial/index.js +6 -1
- package/dist/components/puck-core/core/props/index.js +7 -0
- package/dist/components/puck-core/core/puck-fields-to-zod.d.ts +1 -0
- package/dist/components/puck-core/core/puck-fields-to-zod.js +21 -10
- package/package.json +1 -1
|
@@ -11142,6 +11142,9 @@ declare const confMap: {
|
|
|
11142
11142
|
label: string;
|
|
11143
11143
|
objectFields: {
|
|
11144
11144
|
media: {
|
|
11145
|
+
ai: {
|
|
11146
|
+
instructions: string;
|
|
11147
|
+
};
|
|
11145
11148
|
type: "object";
|
|
11146
11149
|
objectFields: {
|
|
11147
11150
|
src: import("@puckeditor/core").Field<string>;
|
|
@@ -25,7 +25,12 @@ const conf = {
|
|
|
25
25
|
label: "Props",
|
|
26
26
|
objectFields: {
|
|
27
27
|
// Shared media field (BackgroundImageCard / LogoCard / QuoteCard)
|
|
28
|
-
media:
|
|
28
|
+
media: {
|
|
29
|
+
...mediaField,
|
|
30
|
+
ai: {
|
|
31
|
+
instructions: "Image/media for this card. Usage depends on component type: 'background' → full-bleed background image, 'logo' → company logo, 'quote' → avatar/profile photo of the person."
|
|
32
|
+
}
|
|
33
|
+
},
|
|
29
34
|
// BackgroundImageCard
|
|
30
35
|
heading: { type: "text" },
|
|
31
36
|
button: buttonField,
|
|
@@ -2,6 +2,7 @@ import { buttonsField, badgeField } from "./interactive.js";
|
|
|
2
2
|
import { actionDefaults, actionField, buttonDefaults, buttonField, iconField, resolveActionUrl } from "./interactive.js";
|
|
3
3
|
import { descriptionField, headingField, featuresField } from "./content.js";
|
|
4
4
|
import { cardField, cardsField } from "./content.js";
|
|
5
|
+
import { getPlaceholderMediaUrl, media16x9Placeholder, media1x1Placeholder, media9x16Placeholder, mediaField, mediasField } from "./media.js";
|
|
5
6
|
const contentFields = {
|
|
6
7
|
heading: headingField,
|
|
7
8
|
description: descriptionField,
|
|
@@ -28,7 +29,13 @@ export {
|
|
|
28
29
|
contentFieldsWithFeatures,
|
|
29
30
|
descriptionField,
|
|
30
31
|
featuresField,
|
|
32
|
+
getPlaceholderMediaUrl,
|
|
31
33
|
headingField,
|
|
32
34
|
iconField,
|
|
35
|
+
media16x9Placeholder,
|
|
36
|
+
media1x1Placeholder,
|
|
37
|
+
media9x16Placeholder,
|
|
38
|
+
mediaField,
|
|
39
|
+
mediasField,
|
|
33
40
|
resolveActionUrl
|
|
34
41
|
};
|
|
@@ -54,45 +54,55 @@ function withDescribe(schema, field) {
|
|
|
54
54
|
const desc = (_a = field.ai) == null ? void 0 : _a.instructions;
|
|
55
55
|
return desc ? schema.describe(desc) : schema;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function isFieldOptional(field, fieldKey) {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
if (((_a = field.ai) == null ? void 0 : _a.optional) === true) return true;
|
|
60
|
+
if (((_b = field.ai) == null ? void 0 : _b.optional) === false) return false;
|
|
61
|
+
if (fieldKey === "styles") return true;
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
function maybeOptional(schema, field, fieldKey) {
|
|
65
|
+
return isFieldOptional(field, fieldKey) ? schema.optional() : schema;
|
|
66
|
+
}
|
|
67
|
+
function puckFieldToZod(field, fieldKey) {
|
|
58
68
|
var _a, _b;
|
|
59
69
|
let schema;
|
|
60
70
|
switch (field.type) {
|
|
61
71
|
case "text":
|
|
62
72
|
case "textarea":
|
|
63
|
-
schema = string()
|
|
73
|
+
schema = string();
|
|
64
74
|
break;
|
|
65
75
|
case "select":
|
|
66
76
|
case "radio": {
|
|
67
77
|
const values = (field.options ?? []).map((o) => o.value);
|
|
68
|
-
schema = values.length === 0 ? string()
|
|
78
|
+
schema = values.length === 0 ? string() : _enum(values);
|
|
69
79
|
break;
|
|
70
80
|
}
|
|
71
81
|
case "object": {
|
|
72
82
|
if (!field.objectFields || Object.keys(field.objectFields).length === 0) {
|
|
73
|
-
schema = record(string(), unknown())
|
|
83
|
+
schema = record(string(), unknown());
|
|
74
84
|
} else {
|
|
75
85
|
const shape = {};
|
|
76
86
|
for (const [k, v] of Object.entries(field.objectFields)) {
|
|
77
87
|
if ((_a = v.ai) == null ? void 0 : _a.exclude) continue;
|
|
78
|
-
shape[k] = puckFieldToZod(v);
|
|
88
|
+
shape[k] = puckFieldToZod(v, k);
|
|
79
89
|
}
|
|
80
|
-
schema = object(shape)
|
|
90
|
+
schema = object(shape);
|
|
81
91
|
}
|
|
82
92
|
break;
|
|
83
93
|
}
|
|
84
94
|
case "array": {
|
|
85
95
|
if (!field.arrayFields || Object.keys(field.arrayFields).length === 0) {
|
|
86
|
-
schema = array(unknown())
|
|
96
|
+
schema = array(unknown());
|
|
87
97
|
} else {
|
|
88
98
|
const itemShape = {};
|
|
89
99
|
for (const [k, v] of Object.entries(field.arrayFields)) {
|
|
90
100
|
if ((_b = v.ai) == null ? void 0 : _b.exclude) continue;
|
|
91
|
-
itemShape[k] = puckFieldToZod(v);
|
|
101
|
+
itemShape[k] = puckFieldToZod(v, k);
|
|
92
102
|
}
|
|
93
103
|
let arraySchema = array(object(itemShape));
|
|
94
104
|
if (field.max) arraySchema = arraySchema.max(field.max);
|
|
95
|
-
schema = arraySchema
|
|
105
|
+
schema = arraySchema;
|
|
96
106
|
}
|
|
97
107
|
break;
|
|
98
108
|
}
|
|
@@ -102,6 +112,7 @@ function puckFieldToZod(field) {
|
|
|
102
112
|
default:
|
|
103
113
|
schema = any();
|
|
104
114
|
}
|
|
115
|
+
schema = maybeOptional(schema, field, fieldKey);
|
|
105
116
|
return withDescribe(schema, field);
|
|
106
117
|
}
|
|
107
118
|
function puckFieldsToZod(fields) {
|
|
@@ -109,7 +120,7 @@ function puckFieldsToZod(fields) {
|
|
|
109
120
|
const shape = {};
|
|
110
121
|
for (const [key, field] of Object.entries(fields)) {
|
|
111
122
|
if ((_a = field.ai) == null ? void 0 : _a.exclude) continue;
|
|
112
|
-
shape[key] = puckFieldToZod(field);
|
|
123
|
+
shape[key] = puckFieldToZod(field, key);
|
|
113
124
|
}
|
|
114
125
|
return object(shape);
|
|
115
126
|
}
|