@delmaredigital/payload-puck 0.1.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/LICENSE +73 -0
- package/README.md +1580 -0
- package/dist/AccordionClient.d.mts +24 -0
- package/dist/AccordionClient.d.ts +24 -0
- package/dist/AccordionClient.js +786 -0
- package/dist/AccordionClient.js.map +1 -0
- package/dist/AccordionClient.mjs +784 -0
- package/dist/AccordionClient.mjs.map +1 -0
- package/dist/AnimatedWrapper.d.mts +30 -0
- package/dist/AnimatedWrapper.d.ts +30 -0
- package/dist/AnimatedWrapper.js +379 -0
- package/dist/AnimatedWrapper.js.map +1 -0
- package/dist/AnimatedWrapper.mjs +377 -0
- package/dist/AnimatedWrapper.mjs.map +1 -0
- package/dist/admin/client.d.mts +108 -0
- package/dist/admin/client.d.ts +108 -0
- package/dist/admin/client.js +177 -0
- package/dist/admin/client.js.map +1 -0
- package/dist/admin/client.mjs +173 -0
- package/dist/admin/client.mjs.map +1 -0
- package/dist/admin/index.d.mts +157 -0
- package/dist/admin/index.d.ts +157 -0
- package/dist/admin/index.js +31 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +29 -0
- package/dist/admin/index.mjs.map +1 -0
- package/dist/api/index.d.mts +460 -0
- package/dist/api/index.d.ts +460 -0
- package/dist/api/index.js +588 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/index.mjs +578 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/components/index.css +339 -0
- package/dist/components/index.css.map +1 -0
- package/dist/components/index.d.mts +222 -0
- package/dist/components/index.d.ts +222 -0
- package/dist/components/index.js +9177 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +9130 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/config/config.editor.css +339 -0
- package/dist/config/config.editor.css.map +1 -0
- package/dist/config/config.editor.d.mts +153 -0
- package/dist/config/config.editor.d.ts +153 -0
- package/dist/config/config.editor.js +9400 -0
- package/dist/config/config.editor.js.map +1 -0
- package/dist/config/config.editor.mjs +9368 -0
- package/dist/config/config.editor.mjs.map +1 -0
- package/dist/config/index.d.mts +68 -0
- package/dist/config/index.d.ts +68 -0
- package/dist/config/index.js +2017 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/index.mjs +1991 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/editor/index.d.mts +784 -0
- package/dist/editor/index.d.ts +784 -0
- package/dist/editor/index.js +4517 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/index.mjs +4483 -0
- package/dist/editor/index.mjs.map +1 -0
- package/dist/fields/index.css +339 -0
- package/dist/fields/index.css.map +1 -0
- package/dist/fields/index.d.mts +600 -0
- package/dist/fields/index.d.ts +600 -0
- package/dist/fields/index.js +7739 -0
- package/dist/fields/index.js.map +1 -0
- package/dist/fields/index.mjs +7590 -0
- package/dist/fields/index.mjs.map +1 -0
- package/dist/index-CQu6SzDg.d.mts +327 -0
- package/dist/index-CoUQnyC3.d.ts +327 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +569 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +555 -0
- package/dist/index.mjs.map +1 -0
- package/dist/layouts/index.d.mts +96 -0
- package/dist/layouts/index.d.ts +96 -0
- package/dist/layouts/index.js +394 -0
- package/dist/layouts/index.js.map +1 -0
- package/dist/layouts/index.mjs +378 -0
- package/dist/layouts/index.mjs.map +1 -0
- package/dist/plugin/index.d.mts +289 -0
- package/dist/plugin/index.d.ts +289 -0
- package/dist/plugin/index.js +569 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/index.mjs +555 -0
- package/dist/plugin/index.mjs.map +1 -0
- package/dist/render/index.d.mts +109 -0
- package/dist/render/index.d.ts +109 -0
- package/dist/render/index.js +2146 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/index.mjs +2123 -0
- package/dist/render/index.mjs.map +1 -0
- package/dist/shared-DMAF1AcH.d.mts +545 -0
- package/dist/shared-DMAF1AcH.d.ts +545 -0
- package/dist/theme/index.d.mts +155 -0
- package/dist/theme/index.d.ts +155 -0
- package/dist/theme/index.js +201 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/index.mjs +186 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/types-D7D3rZ1J.d.mts +116 -0
- package/dist/types-D7D3rZ1J.d.ts +116 -0
- package/dist/types-_6MvjyKv.d.mts +104 -0
- package/dist/types-_6MvjyKv.d.ts +104 -0
- package/dist/utils/index.d.mts +267 -0
- package/dist/utils/index.d.ts +267 -0
- package/dist/utils/index.js +426 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +412 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils-DaRs9t0J.d.mts +85 -0
- package/dist/utils-gAvt0Vhw.d.ts +85 -0
- package/examples/README.md +240 -0
- package/examples/api/puck/pages/[id]/route.ts +64 -0
- package/examples/api/puck/pages/[id]/versions/route.ts +47 -0
- package/examples/api/puck/pages/route.ts +45 -0
- package/examples/app/(frontend)/page.tsx +94 -0
- package/examples/app/[...slug]/page.tsx +101 -0
- package/examples/app/pages/[id]/edit/page.tsx +148 -0
- package/examples/components/CustomBanner.tsx +368 -0
- package/examples/config/custom-config.ts +223 -0
- package/examples/config/payload.config.example.ts +64 -0
- package/examples/lib/puck-layouts.ts +258 -0
- package/examples/lib/puck-theme.ts +94 -0
- package/examples/styles/puck-theme.css +171 -0
- package/package.json +157 -0
|
@@ -0,0 +1,2146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var puck = require('@measured/puck');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var AnimatedWrapper = require('../AnimatedWrapper');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var iconsReact = require('@tabler/icons-react');
|
|
8
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
9
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
10
|
+
var clsx = require('clsx');
|
|
11
|
+
var tailwindMerge = require('tailwind-merge');
|
|
12
|
+
var LabelPrimitive = require('@radix-ui/react-label');
|
|
13
|
+
var AccordionClient = require('../AccordionClient');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
|
+
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
35
|
+
|
|
36
|
+
// src/render/PageRenderer.tsx
|
|
37
|
+
|
|
38
|
+
// src/layouts/defaults.ts
|
|
39
|
+
var defaultLayout = {
|
|
40
|
+
value: "default",
|
|
41
|
+
label: "Default",
|
|
42
|
+
description: "Standard page layout with contained content width",
|
|
43
|
+
classes: {
|
|
44
|
+
wrapper: "",
|
|
45
|
+
container: "mx-auto px-4 sm:px-6 lg:px-8",
|
|
46
|
+
content: ""
|
|
47
|
+
},
|
|
48
|
+
maxWidth: "1200px",
|
|
49
|
+
fullWidth: false
|
|
50
|
+
};
|
|
51
|
+
var landingLayout = {
|
|
52
|
+
value: "landing",
|
|
53
|
+
label: "Landing",
|
|
54
|
+
description: "Full-width sections with no global container constraints",
|
|
55
|
+
classes: {
|
|
56
|
+
wrapper: "",
|
|
57
|
+
container: "",
|
|
58
|
+
content: ""
|
|
59
|
+
},
|
|
60
|
+
fullWidth: true
|
|
61
|
+
};
|
|
62
|
+
var fullWidthLayout = {
|
|
63
|
+
value: "full-width",
|
|
64
|
+
label: "Full Width",
|
|
65
|
+
description: "Content spans the full viewport width",
|
|
66
|
+
classes: {
|
|
67
|
+
wrapper: "w-full",
|
|
68
|
+
container: "w-full",
|
|
69
|
+
content: ""
|
|
70
|
+
},
|
|
71
|
+
maxWidth: "100%",
|
|
72
|
+
fullWidth: true
|
|
73
|
+
};
|
|
74
|
+
var DEFAULT_LAYOUTS = [
|
|
75
|
+
defaultLayout,
|
|
76
|
+
landingLayout,
|
|
77
|
+
fullWidthLayout
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// src/layouts/utils.ts
|
|
81
|
+
function getLayout(layouts, value, fallback = "default") {
|
|
82
|
+
const layout = layouts.find((l) => l.value === value);
|
|
83
|
+
if (layout) return layout;
|
|
84
|
+
if (value !== fallback) {
|
|
85
|
+
return layouts.find((l) => l.value === fallback);
|
|
86
|
+
}
|
|
87
|
+
return layouts[0];
|
|
88
|
+
}
|
|
89
|
+
function layoutsToOptions(layouts) {
|
|
90
|
+
return layouts.map(({ value, label, description }) => ({
|
|
91
|
+
value,
|
|
92
|
+
label,
|
|
93
|
+
description
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/fields/shared.ts
|
|
98
|
+
function cn(...classes) {
|
|
99
|
+
return classes.filter(Boolean).join(" ");
|
|
100
|
+
}
|
|
101
|
+
function isLegacyWidthValue(value) {
|
|
102
|
+
if (!value || typeof value !== "object") return false;
|
|
103
|
+
const v = value;
|
|
104
|
+
return typeof v.maxWidth === "number" && typeof v.unit === "string" && typeof v.mode === "string" && !("minWidth" in v) && !("minHeight" in v) && !("maxHeight" in v);
|
|
105
|
+
}
|
|
106
|
+
var alignmentMap = {
|
|
107
|
+
left: "text-left",
|
|
108
|
+
center: "text-center",
|
|
109
|
+
right: "text-right"
|
|
110
|
+
};
|
|
111
|
+
var shadowMap = {
|
|
112
|
+
none: "",
|
|
113
|
+
sm: "shadow-sm",
|
|
114
|
+
md: "shadow-md",
|
|
115
|
+
lg: "shadow-lg",
|
|
116
|
+
xl: "shadow-xl",
|
|
117
|
+
"2xl": "shadow-2xl"
|
|
118
|
+
};
|
|
119
|
+
var headingLevelMap = {
|
|
120
|
+
h1: "text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight",
|
|
121
|
+
h2: "text-3xl md:text-4xl font-bold tracking-tight",
|
|
122
|
+
h3: "text-2xl md:text-3xl font-semibold",
|
|
123
|
+
h4: "text-xl md:text-2xl font-semibold",
|
|
124
|
+
h5: "text-lg md:text-xl font-medium",
|
|
125
|
+
h6: "text-base md:text-lg font-medium"
|
|
126
|
+
};
|
|
127
|
+
var textSizeMap = {
|
|
128
|
+
xs: "text-xs",
|
|
129
|
+
sm: "text-sm",
|
|
130
|
+
base: "text-base",
|
|
131
|
+
lg: "text-lg",
|
|
132
|
+
xl: "text-xl",
|
|
133
|
+
"2xl": "text-2xl"
|
|
134
|
+
};
|
|
135
|
+
var aspectRatioMap = {
|
|
136
|
+
auto: "",
|
|
137
|
+
square: "aspect-square",
|
|
138
|
+
video: "aspect-video",
|
|
139
|
+
portrait: "aspect-[3/4]",
|
|
140
|
+
landscape: "aspect-[4/3]",
|
|
141
|
+
wide: "aspect-[21/9]"
|
|
142
|
+
};
|
|
143
|
+
var dividerStyleMap = {
|
|
144
|
+
solid: "border-solid",
|
|
145
|
+
dashed: "border-dashed",
|
|
146
|
+
dotted: "border-dotted"
|
|
147
|
+
};
|
|
148
|
+
var justifyContentMap = {
|
|
149
|
+
start: "justify-start",
|
|
150
|
+
"flex-start": "justify-start",
|
|
151
|
+
center: "justify-center",
|
|
152
|
+
end: "justify-end",
|
|
153
|
+
"flex-end": "justify-end",
|
|
154
|
+
between: "justify-between",
|
|
155
|
+
"space-between": "justify-between",
|
|
156
|
+
around: "justify-around",
|
|
157
|
+
"space-around": "justify-around",
|
|
158
|
+
evenly: "justify-evenly",
|
|
159
|
+
"space-evenly": "justify-evenly"
|
|
160
|
+
};
|
|
161
|
+
var alignItemsMap = {
|
|
162
|
+
start: "items-start",
|
|
163
|
+
"flex-start": "items-start",
|
|
164
|
+
center: "items-center",
|
|
165
|
+
end: "items-end",
|
|
166
|
+
"flex-end": "items-end",
|
|
167
|
+
stretch: "items-stretch",
|
|
168
|
+
baseline: "items-baseline"
|
|
169
|
+
};
|
|
170
|
+
function hexToRgb(hex) {
|
|
171
|
+
const clean = hex.replace(/^#/, "");
|
|
172
|
+
if (clean.length !== 6) return null;
|
|
173
|
+
const r = parseInt(clean.substring(0, 2), 16);
|
|
174
|
+
const g = parseInt(clean.substring(2, 4), 16);
|
|
175
|
+
const b = parseInt(clean.substring(4, 6), 16);
|
|
176
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) return null;
|
|
177
|
+
return { r, g, b };
|
|
178
|
+
}
|
|
179
|
+
function colorValueToCSS(color) {
|
|
180
|
+
if (!color?.hex) return void 0;
|
|
181
|
+
const rgb = hexToRgb(color.hex);
|
|
182
|
+
if (!rgb) return color.hex;
|
|
183
|
+
const opacity = (color.opacity ?? 100) / 100;
|
|
184
|
+
if (opacity === 1) {
|
|
185
|
+
return color.hex;
|
|
186
|
+
}
|
|
187
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
|
188
|
+
}
|
|
189
|
+
function paddingValueToCSS(padding) {
|
|
190
|
+
if (!padding) return void 0;
|
|
191
|
+
const { top, right, bottom, left, unit } = padding;
|
|
192
|
+
if (top === right && right === bottom && bottom === left) {
|
|
193
|
+
return `${top}${unit}`;
|
|
194
|
+
}
|
|
195
|
+
if (top === bottom && left === right) {
|
|
196
|
+
return `${top}${unit} ${right}${unit}`;
|
|
197
|
+
}
|
|
198
|
+
if (left === right) {
|
|
199
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
|
|
200
|
+
}
|
|
201
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
|
|
202
|
+
}
|
|
203
|
+
function marginValueToCSS(margin) {
|
|
204
|
+
if (!margin) return void 0;
|
|
205
|
+
const { top, right, bottom, left, unit } = margin;
|
|
206
|
+
if (top === right && right === bottom && bottom === left) {
|
|
207
|
+
return `${top}${unit}`;
|
|
208
|
+
}
|
|
209
|
+
if (top === bottom && left === right) {
|
|
210
|
+
return `${top}${unit} ${right}${unit}`;
|
|
211
|
+
}
|
|
212
|
+
if (left === right) {
|
|
213
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
|
|
214
|
+
}
|
|
215
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
|
|
216
|
+
}
|
|
217
|
+
function borderValueToCSS(border) {
|
|
218
|
+
if (!border || border.style === "none") return void 0;
|
|
219
|
+
const color = colorValueToCSS(border.color) || "#000000";
|
|
220
|
+
const style = {};
|
|
221
|
+
if (border.sides.top) {
|
|
222
|
+
style.borderTopWidth = `${border.width}px`;
|
|
223
|
+
style.borderTopStyle = border.style;
|
|
224
|
+
style.borderTopColor = color;
|
|
225
|
+
}
|
|
226
|
+
if (border.sides.right) {
|
|
227
|
+
style.borderRightWidth = `${border.width}px`;
|
|
228
|
+
style.borderRightStyle = border.style;
|
|
229
|
+
style.borderRightColor = color;
|
|
230
|
+
}
|
|
231
|
+
if (border.sides.bottom) {
|
|
232
|
+
style.borderBottomWidth = `${border.width}px`;
|
|
233
|
+
style.borderBottomStyle = border.style;
|
|
234
|
+
style.borderBottomColor = color;
|
|
235
|
+
}
|
|
236
|
+
if (border.sides.left) {
|
|
237
|
+
style.borderLeftWidth = `${border.width}px`;
|
|
238
|
+
style.borderLeftStyle = border.style;
|
|
239
|
+
style.borderLeftColor = color;
|
|
240
|
+
}
|
|
241
|
+
if (border.radius > 0) {
|
|
242
|
+
style.borderRadius = `${border.radius}px`;
|
|
243
|
+
}
|
|
244
|
+
return Object.keys(style).length > 0 ? style : void 0;
|
|
245
|
+
}
|
|
246
|
+
function widthValueToCSS(width) {
|
|
247
|
+
if (!width) return void 0;
|
|
248
|
+
const style = {};
|
|
249
|
+
if (width.mode === "full") {
|
|
250
|
+
style.width = "100%";
|
|
251
|
+
style.maxWidth = "100%";
|
|
252
|
+
} else {
|
|
253
|
+
style.maxWidth = `${width.maxWidth}${width.unit}`;
|
|
254
|
+
style.width = "100%";
|
|
255
|
+
}
|
|
256
|
+
switch (width.alignment) {
|
|
257
|
+
case "left":
|
|
258
|
+
style.marginLeft = "0";
|
|
259
|
+
style.marginRight = "auto";
|
|
260
|
+
break;
|
|
261
|
+
case "center":
|
|
262
|
+
style.marginLeft = "auto";
|
|
263
|
+
style.marginRight = "auto";
|
|
264
|
+
break;
|
|
265
|
+
case "right":
|
|
266
|
+
style.marginLeft = "auto";
|
|
267
|
+
style.marginRight = "0";
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
return style;
|
|
271
|
+
}
|
|
272
|
+
function dimensionsValueToCSS(dimensions) {
|
|
273
|
+
if (!dimensions) return void 0;
|
|
274
|
+
if (isLegacyWidthValue(dimensions)) {
|
|
275
|
+
return widthValueToCSS(dimensions);
|
|
276
|
+
}
|
|
277
|
+
const dim = dimensions;
|
|
278
|
+
const style = {};
|
|
279
|
+
if (dim.mode === "full") {
|
|
280
|
+
style.width = "100%";
|
|
281
|
+
style.maxWidth = "100%";
|
|
282
|
+
} else {
|
|
283
|
+
style.width = "100%";
|
|
284
|
+
if (dim.maxWidth?.enabled !== false && dim.maxWidth?.value > 0) {
|
|
285
|
+
style.maxWidth = `${dim.maxWidth.value}${dim.maxWidth.unit}`;
|
|
286
|
+
}
|
|
287
|
+
if (dim.minWidth?.enabled && dim.minWidth.value > 0) {
|
|
288
|
+
style.minWidth = `${dim.minWidth.value}${dim.minWidth.unit}`;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (dim.minHeight?.enabled && dim.minHeight.value > 0) {
|
|
292
|
+
style.minHeight = `${dim.minHeight.value}${dim.minHeight.unit}`;
|
|
293
|
+
}
|
|
294
|
+
if (dim.maxHeight?.enabled && dim.maxHeight.value > 0) {
|
|
295
|
+
style.maxHeight = `${dim.maxHeight.value}${dim.maxHeight.unit}`;
|
|
296
|
+
}
|
|
297
|
+
switch (dim.alignment) {
|
|
298
|
+
case "left":
|
|
299
|
+
style.marginLeft = "0";
|
|
300
|
+
style.marginRight = "auto";
|
|
301
|
+
break;
|
|
302
|
+
case "center":
|
|
303
|
+
style.marginLeft = "auto";
|
|
304
|
+
style.marginRight = "auto";
|
|
305
|
+
break;
|
|
306
|
+
case "right":
|
|
307
|
+
style.marginLeft = "auto";
|
|
308
|
+
style.marginRight = "0";
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
return style;
|
|
312
|
+
}
|
|
313
|
+
function gradientValueToCSS(gradient) {
|
|
314
|
+
if (!gradient?.stops || gradient.stops.length === 0) {
|
|
315
|
+
return "transparent";
|
|
316
|
+
}
|
|
317
|
+
const sortedStops = [...gradient.stops].sort((a, b) => a.position - b.position);
|
|
318
|
+
const stopsCSS = sortedStops.map((stop) => {
|
|
319
|
+
const color = colorValueToCSS(stop.color) || "transparent";
|
|
320
|
+
return `${color} ${stop.position}%`;
|
|
321
|
+
}).join(", ");
|
|
322
|
+
if (gradient.type === "radial") {
|
|
323
|
+
const shape = gradient.radialShape || "circle";
|
|
324
|
+
const position = gradient.radialPosition || "center";
|
|
325
|
+
return `radial-gradient(${shape} at ${position}, ${stopsCSS})`;
|
|
326
|
+
}
|
|
327
|
+
return `linear-gradient(${gradient.angle}deg, ${stopsCSS})`;
|
|
328
|
+
}
|
|
329
|
+
function positionToCSS(position) {
|
|
330
|
+
const positionMap = {
|
|
331
|
+
center: "center",
|
|
332
|
+
top: "top",
|
|
333
|
+
bottom: "bottom",
|
|
334
|
+
left: "left",
|
|
335
|
+
right: "right",
|
|
336
|
+
"top-left": "top left",
|
|
337
|
+
"top-right": "top right",
|
|
338
|
+
"bottom-left": "bottom left",
|
|
339
|
+
"bottom-right": "bottom right"
|
|
340
|
+
};
|
|
341
|
+
return position ? positionMap[position] || "center" : "center";
|
|
342
|
+
}
|
|
343
|
+
function maskDirectionToCSS(direction) {
|
|
344
|
+
const directionMap = {
|
|
345
|
+
"to-top": "to top",
|
|
346
|
+
"to-bottom": "to bottom",
|
|
347
|
+
"to-left": "to left",
|
|
348
|
+
"to-right": "to right",
|
|
349
|
+
"to-top-left": "to top left",
|
|
350
|
+
"to-top-right": "to top right",
|
|
351
|
+
"to-bottom-left": "to bottom left",
|
|
352
|
+
"to-bottom-right": "to bottom right",
|
|
353
|
+
"from-center": "radial"
|
|
354
|
+
// Not used for linear, handled separately in maskToCSS
|
|
355
|
+
};
|
|
356
|
+
return directionMap[direction] || "to bottom";
|
|
357
|
+
}
|
|
358
|
+
function maskToCSS(mask) {
|
|
359
|
+
const startAlpha = (mask.startOpacity ?? 100) / 100;
|
|
360
|
+
const endAlpha = (mask.endOpacity ?? 0) / 100;
|
|
361
|
+
if (mask.direction === "from-center") {
|
|
362
|
+
return `radial-gradient(circle at center, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
363
|
+
}
|
|
364
|
+
const direction = maskDirectionToCSS(mask.direction);
|
|
365
|
+
return `linear-gradient(${direction}, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
366
|
+
}
|
|
367
|
+
function backgroundValueToCSS(bg) {
|
|
368
|
+
if (!bg || bg.type === "none") {
|
|
369
|
+
return {};
|
|
370
|
+
}
|
|
371
|
+
const style = {};
|
|
372
|
+
switch (bg.type) {
|
|
373
|
+
case "solid":
|
|
374
|
+
if (bg.solid?.hex) {
|
|
375
|
+
style.backgroundColor = colorValueToCSS(bg.solid);
|
|
376
|
+
}
|
|
377
|
+
break;
|
|
378
|
+
case "gradient":
|
|
379
|
+
if (bg.gradient && bg.gradient.stops && bg.gradient.stops.length > 0) {
|
|
380
|
+
style.background = gradientValueToCSS(bg.gradient);
|
|
381
|
+
}
|
|
382
|
+
break;
|
|
383
|
+
case "image":
|
|
384
|
+
if (bg.image?.media?.url) {
|
|
385
|
+
const imageUrl = bg.image.media.url;
|
|
386
|
+
const size = bg.image.size || "cover";
|
|
387
|
+
const position = positionToCSS(bg.image.position);
|
|
388
|
+
const repeat = bg.image.repeat || "no-repeat";
|
|
389
|
+
const attachment = bg.image.attachment || "scroll";
|
|
390
|
+
if (bg.overlay?.enabled) {
|
|
391
|
+
const overlayCSS = bg.overlay.type === "solid" ? colorValueToCSS(bg.overlay.solid) : gradientValueToCSS(bg.overlay.gradient);
|
|
392
|
+
if (bg.overlay.type === "solid" && overlayCSS) {
|
|
393
|
+
style.backgroundImage = `linear-gradient(${overlayCSS}, ${overlayCSS}), url(${imageUrl})`;
|
|
394
|
+
} else {
|
|
395
|
+
style.backgroundImage = `${overlayCSS}, url(${imageUrl})`;
|
|
396
|
+
}
|
|
397
|
+
style.backgroundSize = `auto, ${size}`;
|
|
398
|
+
style.backgroundPosition = `center, ${position}`;
|
|
399
|
+
style.backgroundRepeat = `no-repeat, ${repeat}`;
|
|
400
|
+
style.backgroundAttachment = `scroll, ${attachment}`;
|
|
401
|
+
} else {
|
|
402
|
+
style.backgroundImage = `url(${imageUrl})`;
|
|
403
|
+
style.backgroundSize = size;
|
|
404
|
+
style.backgroundPosition = position;
|
|
405
|
+
style.backgroundRepeat = repeat;
|
|
406
|
+
style.backgroundAttachment = attachment;
|
|
407
|
+
}
|
|
408
|
+
if (bg.image.mask?.enabled) {
|
|
409
|
+
const maskCSS = maskToCSS(bg.image.mask);
|
|
410
|
+
style.maskImage = maskCSS;
|
|
411
|
+
style.WebkitMaskImage = maskCSS;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
return style;
|
|
417
|
+
}
|
|
418
|
+
function transformOriginToCSS(origin) {
|
|
419
|
+
const originMap = {
|
|
420
|
+
center: "center",
|
|
421
|
+
top: "top",
|
|
422
|
+
bottom: "bottom",
|
|
423
|
+
left: "left",
|
|
424
|
+
right: "right",
|
|
425
|
+
"top-left": "top left",
|
|
426
|
+
"top-right": "top right",
|
|
427
|
+
"bottom-left": "bottom left",
|
|
428
|
+
"bottom-right": "bottom right"
|
|
429
|
+
};
|
|
430
|
+
return originMap[origin] || "center";
|
|
431
|
+
}
|
|
432
|
+
function transformValueToCSS(transform) {
|
|
433
|
+
if (!transform) return void 0;
|
|
434
|
+
const style = {};
|
|
435
|
+
const transforms = [];
|
|
436
|
+
if (transform.enable3D && transform.perspective) {
|
|
437
|
+
style.perspective = `${transform.perspective}px`;
|
|
438
|
+
}
|
|
439
|
+
if (transform.translateX !== 0 || transform.translateY !== 0) {
|
|
440
|
+
transforms.push(
|
|
441
|
+
`translate(${transform.translateX}${transform.translateUnit}, ${transform.translateY}${transform.translateUnit})`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
if (transform.rotate !== 0) {
|
|
445
|
+
transforms.push(`rotate(${transform.rotate}deg)`);
|
|
446
|
+
}
|
|
447
|
+
if (transform.enable3D) {
|
|
448
|
+
if (transform.rotateX && transform.rotateX !== 0) {
|
|
449
|
+
transforms.push(`rotateX(${transform.rotateX}deg)`);
|
|
450
|
+
}
|
|
451
|
+
if (transform.rotateY && transform.rotateY !== 0) {
|
|
452
|
+
transforms.push(`rotateY(${transform.rotateY}deg)`);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (transform.scaleX !== 1 || transform.scaleY !== 1) {
|
|
456
|
+
if (transform.scaleX === transform.scaleY) {
|
|
457
|
+
transforms.push(`scale(${transform.scaleX})`);
|
|
458
|
+
} else {
|
|
459
|
+
transforms.push(`scale(${transform.scaleX}, ${transform.scaleY})`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (transform.skewX !== 0 || transform.skewY !== 0) {
|
|
463
|
+
if (transform.skewX !== 0 && transform.skewY !== 0) {
|
|
464
|
+
transforms.push(`skew(${transform.skewX}deg, ${transform.skewY}deg)`);
|
|
465
|
+
} else if (transform.skewX !== 0) {
|
|
466
|
+
transforms.push(`skewX(${transform.skewX}deg)`);
|
|
467
|
+
} else {
|
|
468
|
+
transforms.push(`skewY(${transform.skewY}deg)`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
if (transforms.length > 0) {
|
|
472
|
+
style.transform = transforms.join(" ");
|
|
473
|
+
}
|
|
474
|
+
if (transform.origin !== "center") {
|
|
475
|
+
style.transformOrigin = transformOriginToCSS(transform.origin);
|
|
476
|
+
}
|
|
477
|
+
if (transform.enable3D) {
|
|
478
|
+
style.transformStyle = "preserve-3d";
|
|
479
|
+
}
|
|
480
|
+
return Object.keys(style).length > 0 ? style : void 0;
|
|
481
|
+
}
|
|
482
|
+
var BREAKPOINTS = [
|
|
483
|
+
{ key: "base", label: "Base", minWidth: null },
|
|
484
|
+
{ key: "sm", label: "SM", minWidth: 640 },
|
|
485
|
+
{ key: "md", label: "MD", minWidth: 768 },
|
|
486
|
+
{ key: "lg", label: "LG", minWidth: 1024 },
|
|
487
|
+
{ key: "xl", label: "XL", minWidth: 1280 }
|
|
488
|
+
];
|
|
489
|
+
function isResponsiveValue(value) {
|
|
490
|
+
if (!value || typeof value !== "object") return false;
|
|
491
|
+
return "base" in value;
|
|
492
|
+
}
|
|
493
|
+
function camelToKebab(str) {
|
|
494
|
+
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
495
|
+
}
|
|
496
|
+
function cssPropertiesToString(styles) {
|
|
497
|
+
return Object.entries(styles).filter(([, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => `${camelToKebab(key)}: ${value}`).join("; ");
|
|
498
|
+
}
|
|
499
|
+
function responsiveValueToCSS(value, converter, uniqueId) {
|
|
500
|
+
if (value === null || value === void 0) {
|
|
501
|
+
return { baseStyles: {}, mediaQueryCSS: "" };
|
|
502
|
+
}
|
|
503
|
+
if (!isResponsiveValue(value)) {
|
|
504
|
+
const styles = converter(value);
|
|
505
|
+
return {
|
|
506
|
+
baseStyles: styles || {},
|
|
507
|
+
mediaQueryCSS: ""
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
const mediaQueries = [];
|
|
511
|
+
let baseStyles = {};
|
|
512
|
+
BREAKPOINTS.forEach((bp) => {
|
|
513
|
+
const bpValue = value[bp.key];
|
|
514
|
+
if (bpValue === void 0) return;
|
|
515
|
+
const cssProps = converter(bpValue);
|
|
516
|
+
if (!cssProps) return;
|
|
517
|
+
if (bp.key === "base") {
|
|
518
|
+
baseStyles = cssProps;
|
|
519
|
+
} else {
|
|
520
|
+
const styleString = cssPropertiesToString(cssProps);
|
|
521
|
+
if (styleString) {
|
|
522
|
+
mediaQueries.push(
|
|
523
|
+
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { ${styleString} } }`
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
return { baseStyles, mediaQueryCSS: mediaQueries.join("\n") };
|
|
529
|
+
}
|
|
530
|
+
function visibilityValueToCSS(visibility, uniqueId) {
|
|
531
|
+
if (!visibility) return "";
|
|
532
|
+
const mediaQueries = [];
|
|
533
|
+
if (visibility.base === false) {
|
|
534
|
+
mediaQueries.push(`.${uniqueId} { display: none; }`);
|
|
535
|
+
}
|
|
536
|
+
let lastVisibility = visibility.base;
|
|
537
|
+
BREAKPOINTS.slice(1).forEach((bp) => {
|
|
538
|
+
const bpValue = visibility[bp.key];
|
|
539
|
+
if (bpValue === void 0) return;
|
|
540
|
+
if (bpValue !== lastVisibility) {
|
|
541
|
+
if (bpValue === false) {
|
|
542
|
+
mediaQueries.push(
|
|
543
|
+
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { display: none; } }`
|
|
544
|
+
);
|
|
545
|
+
} else {
|
|
546
|
+
mediaQueries.push(
|
|
547
|
+
`@media (min-width: ${bp.minWidth}px) { .${uniqueId} { display: block; } }`
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
lastVisibility = bpValue;
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
return mediaQueries.join("\n");
|
|
554
|
+
}
|
|
555
|
+
var stickyFooterContainerStyle = {
|
|
556
|
+
minHeight: "100vh",
|
|
557
|
+
display: "flex",
|
|
558
|
+
flexDirection: "column"
|
|
559
|
+
};
|
|
560
|
+
var stickyFooterMainStyle = {
|
|
561
|
+
flex: 1
|
|
562
|
+
};
|
|
563
|
+
function LayoutWrapper({ children, layout, className, overrides }) {
|
|
564
|
+
if (!layout) {
|
|
565
|
+
if (overrides?.background) {
|
|
566
|
+
const bgStyles = backgroundValueToCSS(overrides.background);
|
|
567
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...bgStyles }, children });
|
|
568
|
+
}
|
|
569
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
570
|
+
}
|
|
571
|
+
const Header = layout.header;
|
|
572
|
+
const Footer = layout.footer;
|
|
573
|
+
const shouldShowHeader = overrides?.showHeader === "hide" ? false : overrides?.showHeader === "show" ? true : !!Header;
|
|
574
|
+
const shouldShowFooter = overrides?.showFooter === "hide" ? false : overrides?.showFooter === "show" ? true : !!Footer;
|
|
575
|
+
const useStickyFooter = layout.stickyFooter !== false;
|
|
576
|
+
const mainStyle = {
|
|
577
|
+
...layout.stickyHeaderHeight && shouldShowHeader ? { paddingTop: layout.stickyHeaderHeight } : {},
|
|
578
|
+
...useStickyFooter ? stickyFooterMainStyle : {}
|
|
579
|
+
};
|
|
580
|
+
const outerBackgroundStyles = overrides?.background ? backgroundValueToCSS(overrides.background) : {
|
|
581
|
+
...layout.styles?.wrapper?.background !== void 0 ? { background: layout.styles.wrapper.background } : {},
|
|
582
|
+
...layout.styles?.wrapper?.backgroundAttachment !== void 0 ? { backgroundAttachment: layout.styles.wrapper.backgroundAttachment } : {}
|
|
583
|
+
};
|
|
584
|
+
const effectiveMaxWidth = overrides?.maxWidth && overrides.maxWidth !== "default" ? overrides.maxWidth : layout.maxWidth;
|
|
585
|
+
const wrapWithStickyFooter = (content) => {
|
|
586
|
+
if (useStickyFooter) {
|
|
587
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...stickyFooterContainerStyle, ...outerBackgroundStyles }, children: content });
|
|
588
|
+
}
|
|
589
|
+
const hasBackground = Object.keys(outerBackgroundStyles).length > 0;
|
|
590
|
+
if (hasBackground) {
|
|
591
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { minHeight: "100vh", ...outerBackgroundStyles }, children: content });
|
|
592
|
+
}
|
|
593
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: content });
|
|
594
|
+
};
|
|
595
|
+
if (layout.wrapper) {
|
|
596
|
+
const CustomWrapper = layout.wrapper;
|
|
597
|
+
return wrapWithStickyFooter(
|
|
598
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
599
|
+
shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsx("main", { style: Object.keys(mainStyle).length > 0 ? mainStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(CustomWrapper, { children }) }),
|
|
601
|
+
shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
|
|
602
|
+
] })
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
const wrapperStyle = {
|
|
606
|
+
...layout.styles?.wrapper
|
|
607
|
+
};
|
|
608
|
+
const containerStyle = {
|
|
609
|
+
...effectiveMaxWidth && !layout.fullWidth ? { maxWidth: effectiveMaxWidth } : {},
|
|
610
|
+
...layout.styles?.container
|
|
611
|
+
};
|
|
612
|
+
const contentStyle = {
|
|
613
|
+
...layout.styles?.content
|
|
614
|
+
};
|
|
615
|
+
const dataAttrs = {
|
|
616
|
+
"data-layout": layout.value,
|
|
617
|
+
...layout.dataAttributes
|
|
618
|
+
};
|
|
619
|
+
if (layout.fullWidth) {
|
|
620
|
+
return wrapWithStickyFooter(
|
|
621
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
622
|
+
shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
623
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
624
|
+
"main",
|
|
625
|
+
{
|
|
626
|
+
className: [layout.classes?.wrapper, className].filter(Boolean).join(" ") || void 0,
|
|
627
|
+
style: {
|
|
628
|
+
...mainStyle,
|
|
629
|
+
...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
|
|
630
|
+
},
|
|
631
|
+
...dataAttrs,
|
|
632
|
+
children
|
|
633
|
+
}
|
|
634
|
+
),
|
|
635
|
+
shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
|
|
636
|
+
] })
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
return wrapWithStickyFooter(
|
|
640
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
641
|
+
shouldShowHeader && Header && /* @__PURE__ */ jsxRuntime.jsx(Header, {}),
|
|
642
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
643
|
+
"main",
|
|
644
|
+
{
|
|
645
|
+
className: layout.classes?.wrapper || void 0,
|
|
646
|
+
style: {
|
|
647
|
+
...mainStyle,
|
|
648
|
+
...Object.keys(wrapperStyle).length > 0 ? wrapperStyle : {}
|
|
649
|
+
},
|
|
650
|
+
...dataAttrs,
|
|
651
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
652
|
+
"div",
|
|
653
|
+
{
|
|
654
|
+
className: [layout.classes?.container, className].filter(Boolean).join(" ") || void 0,
|
|
655
|
+
style: Object.keys(containerStyle).length > 0 ? containerStyle : void 0,
|
|
656
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
657
|
+
"div",
|
|
658
|
+
{
|
|
659
|
+
className: layout.classes?.content || void 0,
|
|
660
|
+
style: Object.keys(contentStyle).length > 0 ? contentStyle : void 0,
|
|
661
|
+
children
|
|
662
|
+
}
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
}
|
|
667
|
+
),
|
|
668
|
+
shouldShowFooter && Footer && /* @__PURE__ */ jsxRuntime.jsx(Footer, {})
|
|
669
|
+
] })
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
var idCounter = 0;
|
|
673
|
+
function generateUniqueId() {
|
|
674
|
+
return `c${(++idCounter).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
675
|
+
}
|
|
676
|
+
var defaultProps = {
|
|
677
|
+
content: [],
|
|
678
|
+
background: null,
|
|
679
|
+
customPadding: null,
|
|
680
|
+
dimensions: null,
|
|
681
|
+
border: null,
|
|
682
|
+
margin: null,
|
|
683
|
+
animation: null,
|
|
684
|
+
innerBackground: null,
|
|
685
|
+
innerPadding: null,
|
|
686
|
+
innerBorder: null,
|
|
687
|
+
visibility: null
|
|
688
|
+
};
|
|
689
|
+
var ContainerConfig = {
|
|
690
|
+
label: "Container",
|
|
691
|
+
fields: {
|
|
692
|
+
content: { type: "slot" }
|
|
693
|
+
},
|
|
694
|
+
defaultProps,
|
|
695
|
+
render: ({
|
|
696
|
+
content: Content,
|
|
697
|
+
background,
|
|
698
|
+
customPadding,
|
|
699
|
+
dimensions,
|
|
700
|
+
border,
|
|
701
|
+
margin,
|
|
702
|
+
animation,
|
|
703
|
+
innerBackground,
|
|
704
|
+
innerPadding,
|
|
705
|
+
innerBorder,
|
|
706
|
+
visibility
|
|
707
|
+
}) => {
|
|
708
|
+
const uniqueId = generateUniqueId();
|
|
709
|
+
const outerClass = `puck-container-outer-${uniqueId}`;
|
|
710
|
+
const innerClass = `puck-container-inner-${uniqueId}`;
|
|
711
|
+
const mediaQueries = [];
|
|
712
|
+
const outerBackgroundStyles = backgroundValueToCSS(background);
|
|
713
|
+
const outerStyles = {
|
|
714
|
+
...outerBackgroundStyles
|
|
715
|
+
};
|
|
716
|
+
const outerPaddingResult = responsiveValueToCSS(
|
|
717
|
+
customPadding,
|
|
718
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
719
|
+
outerClass
|
|
720
|
+
);
|
|
721
|
+
Object.assign(outerStyles, outerPaddingResult.baseStyles);
|
|
722
|
+
if (outerPaddingResult.mediaQueryCSS) {
|
|
723
|
+
mediaQueries.push(outerPaddingResult.mediaQueryCSS);
|
|
724
|
+
}
|
|
725
|
+
const outerBorderStyles = borderValueToCSS(border);
|
|
726
|
+
if (outerBorderStyles) {
|
|
727
|
+
Object.assign(outerStyles, outerBorderStyles);
|
|
728
|
+
}
|
|
729
|
+
const marginResult = responsiveValueToCSS(
|
|
730
|
+
margin,
|
|
731
|
+
(v) => ({ margin: marginValueToCSS(v) }),
|
|
732
|
+
outerClass
|
|
733
|
+
);
|
|
734
|
+
Object.assign(outerStyles, marginResult.baseStyles);
|
|
735
|
+
if (marginResult.mediaQueryCSS) {
|
|
736
|
+
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
737
|
+
}
|
|
738
|
+
const innerBackgroundStyles = backgroundValueToCSS(innerBackground);
|
|
739
|
+
const innerStyles = {
|
|
740
|
+
...innerBackgroundStyles
|
|
741
|
+
};
|
|
742
|
+
const dimensionsResult = responsiveValueToCSS(
|
|
743
|
+
dimensions,
|
|
744
|
+
dimensionsValueToCSS,
|
|
745
|
+
innerClass
|
|
746
|
+
);
|
|
747
|
+
Object.assign(innerStyles, dimensionsResult.baseStyles);
|
|
748
|
+
if (dimensionsResult.mediaQueryCSS) {
|
|
749
|
+
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
750
|
+
}
|
|
751
|
+
const innerPaddingResult = responsiveValueToCSS(
|
|
752
|
+
innerPadding,
|
|
753
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
754
|
+
innerClass
|
|
755
|
+
);
|
|
756
|
+
Object.assign(innerStyles, innerPaddingResult.baseStyles);
|
|
757
|
+
if (innerPaddingResult.mediaQueryCSS) {
|
|
758
|
+
mediaQueries.push(innerPaddingResult.mediaQueryCSS);
|
|
759
|
+
}
|
|
760
|
+
const innerBorderStyles = borderValueToCSS(innerBorder);
|
|
761
|
+
if (innerBorderStyles) {
|
|
762
|
+
Object.assign(innerStyles, innerBorderStyles);
|
|
763
|
+
}
|
|
764
|
+
const visibilityCSS = visibilityValueToCSS(visibility, outerClass);
|
|
765
|
+
if (visibilityCSS) {
|
|
766
|
+
mediaQueries.push(visibilityCSS);
|
|
767
|
+
}
|
|
768
|
+
const contentClasses = cn("px-4", innerClass);
|
|
769
|
+
const hasInnerStyles = Object.keys(innerStyles).length > 0;
|
|
770
|
+
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
771
|
+
const ContentSlot = Content;
|
|
772
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
|
|
773
|
+
allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
|
|
774
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: outerClass, style: outerStyles, children: hasInnerStyles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: contentClasses, style: innerStyles, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, {}) }) : /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: innerStyles }) })
|
|
775
|
+
] });
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
var idCounter2 = 0;
|
|
779
|
+
function generateUniqueId2() {
|
|
780
|
+
return `f${(++idCounter2).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
781
|
+
}
|
|
782
|
+
var flexDirectionMap = {
|
|
783
|
+
row: "flex-row",
|
|
784
|
+
column: "flex-col",
|
|
785
|
+
"row-reverse": "flex-row-reverse",
|
|
786
|
+
"column-reverse": "flex-col-reverse"
|
|
787
|
+
};
|
|
788
|
+
var flexWrapMap = {
|
|
789
|
+
wrap: "flex-wrap",
|
|
790
|
+
nowrap: "flex-nowrap",
|
|
791
|
+
"wrap-reverse": "flex-wrap-reverse"
|
|
792
|
+
};
|
|
793
|
+
var defaultProps2 = {
|
|
794
|
+
content: [],
|
|
795
|
+
direction: "row",
|
|
796
|
+
justifyContent: null,
|
|
797
|
+
alignItems: null,
|
|
798
|
+
gap: 24,
|
|
799
|
+
wrap: "wrap",
|
|
800
|
+
background: null,
|
|
801
|
+
customPadding: null,
|
|
802
|
+
margin: null,
|
|
803
|
+
dimensions: null,
|
|
804
|
+
border: null,
|
|
805
|
+
animation: null,
|
|
806
|
+
visibility: null
|
|
807
|
+
};
|
|
808
|
+
var FlexConfig = {
|
|
809
|
+
label: "Flex",
|
|
810
|
+
fields: {
|
|
811
|
+
content: { type: "slot" }
|
|
812
|
+
},
|
|
813
|
+
defaultProps: defaultProps2,
|
|
814
|
+
render: ({
|
|
815
|
+
content: Content,
|
|
816
|
+
direction,
|
|
817
|
+
justifyContent,
|
|
818
|
+
alignItems,
|
|
819
|
+
gap,
|
|
820
|
+
wrap,
|
|
821
|
+
background,
|
|
822
|
+
customPadding,
|
|
823
|
+
margin,
|
|
824
|
+
dimensions,
|
|
825
|
+
border,
|
|
826
|
+
animation,
|
|
827
|
+
visibility
|
|
828
|
+
}) => {
|
|
829
|
+
const uniqueId = generateUniqueId2();
|
|
830
|
+
const wrapperClass = `puck-flex-${uniqueId}`;
|
|
831
|
+
const contentClass = `puck-flex-content-${uniqueId}`;
|
|
832
|
+
const mediaQueries = [];
|
|
833
|
+
const backgroundStyles = backgroundValueToCSS(background);
|
|
834
|
+
const wrapperStyles = {
|
|
835
|
+
...backgroundStyles
|
|
836
|
+
};
|
|
837
|
+
const paddingResult = responsiveValueToCSS(
|
|
838
|
+
customPadding,
|
|
839
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
840
|
+
wrapperClass
|
|
841
|
+
);
|
|
842
|
+
Object.assign(wrapperStyles, paddingResult.baseStyles);
|
|
843
|
+
if (paddingResult.mediaQueryCSS) {
|
|
844
|
+
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
845
|
+
}
|
|
846
|
+
const borderStyles = borderValueToCSS(border);
|
|
847
|
+
if (borderStyles) {
|
|
848
|
+
Object.assign(wrapperStyles, borderStyles);
|
|
849
|
+
}
|
|
850
|
+
const marginResult = responsiveValueToCSS(
|
|
851
|
+
margin,
|
|
852
|
+
(v) => ({ margin: marginValueToCSS(v) }),
|
|
853
|
+
wrapperClass
|
|
854
|
+
);
|
|
855
|
+
Object.assign(wrapperStyles, marginResult.baseStyles);
|
|
856
|
+
if (marginResult.mediaQueryCSS) {
|
|
857
|
+
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
858
|
+
}
|
|
859
|
+
const dimensionsResult = responsiveValueToCSS(
|
|
860
|
+
dimensions,
|
|
861
|
+
dimensionsValueToCSS,
|
|
862
|
+
contentClass
|
|
863
|
+
);
|
|
864
|
+
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
865
|
+
if (visibilityCSS) {
|
|
866
|
+
mediaQueries.push(visibilityCSS);
|
|
867
|
+
}
|
|
868
|
+
const contentClasses = cn(
|
|
869
|
+
"flex w-full min-h-[50px]",
|
|
870
|
+
flexDirectionMap[direction],
|
|
871
|
+
justifyContent && justifyContentMap[justifyContent],
|
|
872
|
+
alignItems && alignItemsMap[alignItems],
|
|
873
|
+
flexWrapMap[wrap],
|
|
874
|
+
"[&>*]:min-w-0",
|
|
875
|
+
contentClass
|
|
876
|
+
);
|
|
877
|
+
const contentStyles = {
|
|
878
|
+
gap,
|
|
879
|
+
...dimensionsResult.baseStyles
|
|
880
|
+
};
|
|
881
|
+
if (dimensionsResult.mediaQueryCSS) {
|
|
882
|
+
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
883
|
+
}
|
|
884
|
+
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
885
|
+
const ContentSlot = Content;
|
|
886
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
|
|
887
|
+
allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
|
|
888
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: wrapperClass, style: wrapperStyles, children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: contentStyles }) })
|
|
889
|
+
] });
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
var idCounter3 = 0;
|
|
893
|
+
function generateUniqueId3() {
|
|
894
|
+
return `g${(++idCounter3).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
895
|
+
}
|
|
896
|
+
var defaultProps3 = {
|
|
897
|
+
content: [],
|
|
898
|
+
numColumns: 3,
|
|
899
|
+
gap: 24,
|
|
900
|
+
background: null,
|
|
901
|
+
customPadding: null,
|
|
902
|
+
dimensions: null,
|
|
903
|
+
border: null,
|
|
904
|
+
margin: null,
|
|
905
|
+
animation: null,
|
|
906
|
+
visibility: null
|
|
907
|
+
};
|
|
908
|
+
var GridConfig = {
|
|
909
|
+
label: "Grid",
|
|
910
|
+
fields: {
|
|
911
|
+
content: { type: "slot" }
|
|
912
|
+
},
|
|
913
|
+
defaultProps: defaultProps3,
|
|
914
|
+
render: ({
|
|
915
|
+
content: Content,
|
|
916
|
+
numColumns,
|
|
917
|
+
gap,
|
|
918
|
+
background,
|
|
919
|
+
customPadding,
|
|
920
|
+
dimensions,
|
|
921
|
+
border,
|
|
922
|
+
margin,
|
|
923
|
+
animation,
|
|
924
|
+
visibility
|
|
925
|
+
}) => {
|
|
926
|
+
const uniqueId = generateUniqueId3();
|
|
927
|
+
const wrapperClass = `puck-grid-${uniqueId}`;
|
|
928
|
+
const contentClass = `puck-grid-content-${uniqueId}`;
|
|
929
|
+
const mediaQueries = [];
|
|
930
|
+
const backgroundStyles = backgroundValueToCSS(background);
|
|
931
|
+
const wrapperStyles = {
|
|
932
|
+
...backgroundStyles
|
|
933
|
+
};
|
|
934
|
+
const paddingResult = responsiveValueToCSS(
|
|
935
|
+
customPadding,
|
|
936
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
937
|
+
wrapperClass
|
|
938
|
+
);
|
|
939
|
+
Object.assign(wrapperStyles, paddingResult.baseStyles);
|
|
940
|
+
if (paddingResult.mediaQueryCSS) {
|
|
941
|
+
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
942
|
+
}
|
|
943
|
+
const borderStyles = borderValueToCSS(border);
|
|
944
|
+
if (borderStyles) {
|
|
945
|
+
Object.assign(wrapperStyles, borderStyles);
|
|
946
|
+
}
|
|
947
|
+
const marginResult = responsiveValueToCSS(
|
|
948
|
+
margin,
|
|
949
|
+
(v) => ({ margin: marginValueToCSS(v) }),
|
|
950
|
+
wrapperClass
|
|
951
|
+
);
|
|
952
|
+
Object.assign(wrapperStyles, marginResult.baseStyles);
|
|
953
|
+
if (marginResult.mediaQueryCSS) {
|
|
954
|
+
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
955
|
+
}
|
|
956
|
+
const dimensionsResult = responsiveValueToCSS(
|
|
957
|
+
dimensions,
|
|
958
|
+
dimensionsValueToCSS,
|
|
959
|
+
contentClass
|
|
960
|
+
);
|
|
961
|
+
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
962
|
+
if (visibilityCSS) {
|
|
963
|
+
mediaQueries.push(visibilityCSS);
|
|
964
|
+
}
|
|
965
|
+
const contentClasses = cn(
|
|
966
|
+
"flex flex-col w-full",
|
|
967
|
+
"md:grid",
|
|
968
|
+
contentClass
|
|
969
|
+
);
|
|
970
|
+
const contentStyles = {
|
|
971
|
+
gap,
|
|
972
|
+
...dimensionsResult.baseStyles
|
|
973
|
+
};
|
|
974
|
+
if (dimensionsResult.mediaQueryCSS) {
|
|
975
|
+
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
976
|
+
}
|
|
977
|
+
const gridStyles = {
|
|
978
|
+
...contentStyles,
|
|
979
|
+
"--grid-cols": numColumns
|
|
980
|
+
};
|
|
981
|
+
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
982
|
+
const ContentSlot = Content;
|
|
983
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
|
|
984
|
+
allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
|
|
985
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, style: wrapperStyles, children: [
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: gridStyles }),
|
|
987
|
+
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
988
|
+
@media (min-width: 768px) {
|
|
989
|
+
.flex.md\\:grid {
|
|
990
|
+
grid-template-columns: repeat(var(--grid-cols), 1fr);
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
` })
|
|
994
|
+
] })
|
|
995
|
+
] });
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
var idCounter4 = 0;
|
|
999
|
+
function generateUniqueId4() {
|
|
1000
|
+
return `s${(++idCounter4).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
1001
|
+
}
|
|
1002
|
+
var defaultProps4 = {
|
|
1003
|
+
id: "",
|
|
1004
|
+
content: [],
|
|
1005
|
+
background: null,
|
|
1006
|
+
fullWidth: false,
|
|
1007
|
+
customPadding: null,
|
|
1008
|
+
dimensions: null,
|
|
1009
|
+
border: null,
|
|
1010
|
+
margin: null,
|
|
1011
|
+
animation: null,
|
|
1012
|
+
visibility: null
|
|
1013
|
+
};
|
|
1014
|
+
var SectionConfig = {
|
|
1015
|
+
label: "Section",
|
|
1016
|
+
fields: {
|
|
1017
|
+
content: { type: "slot" }
|
|
1018
|
+
},
|
|
1019
|
+
defaultProps: defaultProps4,
|
|
1020
|
+
render: ({
|
|
1021
|
+
id,
|
|
1022
|
+
content: Content,
|
|
1023
|
+
background,
|
|
1024
|
+
fullWidth,
|
|
1025
|
+
customPadding,
|
|
1026
|
+
dimensions,
|
|
1027
|
+
border,
|
|
1028
|
+
margin,
|
|
1029
|
+
animation,
|
|
1030
|
+
visibility
|
|
1031
|
+
}) => {
|
|
1032
|
+
const uniqueId = generateUniqueId4();
|
|
1033
|
+
const sectionClass = `puck-section-${uniqueId}`;
|
|
1034
|
+
const contentClass = `puck-section-content-${uniqueId}`;
|
|
1035
|
+
const mediaQueries = [];
|
|
1036
|
+
const backgroundStyles = backgroundValueToCSS(background);
|
|
1037
|
+
const sectionStyles = {
|
|
1038
|
+
...backgroundStyles
|
|
1039
|
+
};
|
|
1040
|
+
const paddingResult = responsiveValueToCSS(
|
|
1041
|
+
customPadding,
|
|
1042
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
1043
|
+
sectionClass
|
|
1044
|
+
);
|
|
1045
|
+
Object.assign(sectionStyles, paddingResult.baseStyles);
|
|
1046
|
+
if (paddingResult.mediaQueryCSS) {
|
|
1047
|
+
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
1048
|
+
}
|
|
1049
|
+
const borderStyles = borderValueToCSS(border);
|
|
1050
|
+
if (borderStyles) {
|
|
1051
|
+
Object.assign(sectionStyles, borderStyles);
|
|
1052
|
+
}
|
|
1053
|
+
const marginResult = responsiveValueToCSS(
|
|
1054
|
+
margin,
|
|
1055
|
+
(v) => ({ margin: marginValueToCSS(v) }),
|
|
1056
|
+
sectionClass
|
|
1057
|
+
);
|
|
1058
|
+
Object.assign(sectionStyles, marginResult.baseStyles);
|
|
1059
|
+
if (marginResult.mediaQueryCSS) {
|
|
1060
|
+
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
1061
|
+
}
|
|
1062
|
+
const visibilityCSS = visibilityValueToCSS(visibility, sectionClass);
|
|
1063
|
+
if (visibilityCSS) {
|
|
1064
|
+
mediaQueries.push(visibilityCSS);
|
|
1065
|
+
}
|
|
1066
|
+
const sectionClasses = cn("relative w-full", sectionClass);
|
|
1067
|
+
const dimensionsResult = responsiveValueToCSS(
|
|
1068
|
+
dimensions,
|
|
1069
|
+
dimensionsValueToCSS,
|
|
1070
|
+
contentClass
|
|
1071
|
+
);
|
|
1072
|
+
if (dimensionsResult.mediaQueryCSS) {
|
|
1073
|
+
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
1074
|
+
}
|
|
1075
|
+
const contentClasses = cn(
|
|
1076
|
+
"relative z-10",
|
|
1077
|
+
// Only apply preset content width if no dimensions set
|
|
1078
|
+
!dimensions && !fullWidth && "max-w-[1200px] mx-auto px-4",
|
|
1079
|
+
contentClass
|
|
1080
|
+
);
|
|
1081
|
+
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
1082
|
+
const ContentSlot = Content;
|
|
1083
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
|
|
1084
|
+
allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
|
|
1085
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1086
|
+
"section",
|
|
1087
|
+
{
|
|
1088
|
+
id: id || void 0,
|
|
1089
|
+
className: sectionClasses,
|
|
1090
|
+
style: sectionStyles,
|
|
1091
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClasses, style: dimensionsResult.baseStyles })
|
|
1092
|
+
}
|
|
1093
|
+
)
|
|
1094
|
+
] });
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
var idCounter5 = 0;
|
|
1098
|
+
function generateUniqueId5() {
|
|
1099
|
+
return `sp${(++idCounter5).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
1100
|
+
}
|
|
1101
|
+
var heightMap = {
|
|
1102
|
+
"8px": "h-2",
|
|
1103
|
+
"16px": "h-4",
|
|
1104
|
+
"24px": "h-6",
|
|
1105
|
+
"32px": "h-8",
|
|
1106
|
+
"48px": "h-12",
|
|
1107
|
+
"64px": "h-16",
|
|
1108
|
+
"80px": "h-20",
|
|
1109
|
+
"96px": "h-24",
|
|
1110
|
+
"128px": "h-32"
|
|
1111
|
+
};
|
|
1112
|
+
var widthMap = {
|
|
1113
|
+
"8px": "w-2",
|
|
1114
|
+
"16px": "w-4",
|
|
1115
|
+
"24px": "w-6",
|
|
1116
|
+
"32px": "w-8",
|
|
1117
|
+
"48px": "w-12",
|
|
1118
|
+
"64px": "w-16",
|
|
1119
|
+
"80px": "w-20",
|
|
1120
|
+
"96px": "w-24",
|
|
1121
|
+
"128px": "w-32"
|
|
1122
|
+
};
|
|
1123
|
+
var defaultProps5 = {
|
|
1124
|
+
size: "24px",
|
|
1125
|
+
direction: "vertical",
|
|
1126
|
+
visibility: null
|
|
1127
|
+
};
|
|
1128
|
+
var SpacerConfig = {
|
|
1129
|
+
label: "Spacer",
|
|
1130
|
+
defaultProps: defaultProps5,
|
|
1131
|
+
render: ({ size, direction, visibility }) => {
|
|
1132
|
+
const uniqueId = generateUniqueId5();
|
|
1133
|
+
const wrapperClass = `puck-spacer-${uniqueId}`;
|
|
1134
|
+
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
1135
|
+
const getClasses = () => {
|
|
1136
|
+
const heightClass = heightMap[size] || "h-6";
|
|
1137
|
+
const widthClass = widthMap[size] || "w-6";
|
|
1138
|
+
if (direction === "vertical") {
|
|
1139
|
+
return `block ${heightClass} w-full`;
|
|
1140
|
+
}
|
|
1141
|
+
if (direction === "horizontal") {
|
|
1142
|
+
return `inline-block ${widthClass} h-full`;
|
|
1143
|
+
}
|
|
1144
|
+
return `block ${heightClass} ${widthClass}`;
|
|
1145
|
+
};
|
|
1146
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1147
|
+
visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
|
|
1148
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(getClasses(), wrapperClass), "aria-hidden": "true" })
|
|
1149
|
+
] });
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
var idCounter6 = 0;
|
|
1153
|
+
function generateUniqueId6() {
|
|
1154
|
+
return `t${(++idCounter6).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
1155
|
+
}
|
|
1156
|
+
var defaultProps6 = {
|
|
1157
|
+
content: [],
|
|
1158
|
+
templateId: null,
|
|
1159
|
+
dimensions: null,
|
|
1160
|
+
customPadding: null,
|
|
1161
|
+
margin: null,
|
|
1162
|
+
visibility: null
|
|
1163
|
+
};
|
|
1164
|
+
var TemplateServerConfig = {
|
|
1165
|
+
label: "Template",
|
|
1166
|
+
fields: {
|
|
1167
|
+
// In server config, templateId is just for reference (no loading UI)
|
|
1168
|
+
templateId: {
|
|
1169
|
+
type: "text",
|
|
1170
|
+
label: "Template ID"
|
|
1171
|
+
},
|
|
1172
|
+
content: {
|
|
1173
|
+
type: "slot"
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
defaultProps: defaultProps6,
|
|
1177
|
+
render: ({ content: Content, dimensions, customPadding, margin, visibility }) => {
|
|
1178
|
+
const uniqueId = generateUniqueId6();
|
|
1179
|
+
const wrapperClass = `puck-template-${uniqueId}`;
|
|
1180
|
+
const contentClass = `puck-template-content-${uniqueId}`;
|
|
1181
|
+
const mediaQueries = [];
|
|
1182
|
+
const wrapperStyles = {};
|
|
1183
|
+
const paddingResult = responsiveValueToCSS(
|
|
1184
|
+
customPadding,
|
|
1185
|
+
(v) => ({ padding: paddingValueToCSS(v) }),
|
|
1186
|
+
wrapperClass
|
|
1187
|
+
);
|
|
1188
|
+
Object.assign(wrapperStyles, paddingResult.baseStyles);
|
|
1189
|
+
if (paddingResult.mediaQueryCSS) {
|
|
1190
|
+
mediaQueries.push(paddingResult.mediaQueryCSS);
|
|
1191
|
+
}
|
|
1192
|
+
const marginResult = responsiveValueToCSS(
|
|
1193
|
+
margin,
|
|
1194
|
+
(v) => ({ margin: marginValueToCSS(v) }),
|
|
1195
|
+
wrapperClass
|
|
1196
|
+
);
|
|
1197
|
+
Object.assign(wrapperStyles, marginResult.baseStyles);
|
|
1198
|
+
if (marginResult.mediaQueryCSS) {
|
|
1199
|
+
mediaQueries.push(marginResult.mediaQueryCSS);
|
|
1200
|
+
}
|
|
1201
|
+
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
1202
|
+
if (visibilityCSS) {
|
|
1203
|
+
mediaQueries.push(visibilityCSS);
|
|
1204
|
+
}
|
|
1205
|
+
const dimensionsResult = responsiveValueToCSS(
|
|
1206
|
+
dimensions,
|
|
1207
|
+
dimensionsValueToCSS,
|
|
1208
|
+
contentClass
|
|
1209
|
+
);
|
|
1210
|
+
if (dimensionsResult.mediaQueryCSS) {
|
|
1211
|
+
mediaQueries.push(dimensionsResult.mediaQueryCSS);
|
|
1212
|
+
}
|
|
1213
|
+
const allMediaQueryCSS = mediaQueries.join("\n");
|
|
1214
|
+
const ContentSlot = Content;
|
|
1215
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1216
|
+
allMediaQueryCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: allMediaQueryCSS }),
|
|
1217
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1218
|
+
"div",
|
|
1219
|
+
{
|
|
1220
|
+
className: cn("template-wrapper", wrapperClass),
|
|
1221
|
+
style: Object.keys(wrapperStyles).length > 0 ? wrapperStyles : void 0,
|
|
1222
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ContentSlot, { className: contentClass, style: dimensionsResult.baseStyles })
|
|
1223
|
+
}
|
|
1224
|
+
)
|
|
1225
|
+
] });
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
var defaultProps7 = {
|
|
1229
|
+
text: "Heading Text",
|
|
1230
|
+
level: "h2",
|
|
1231
|
+
alignment: null,
|
|
1232
|
+
textColor: null,
|
|
1233
|
+
dimensions: null,
|
|
1234
|
+
animation: null,
|
|
1235
|
+
margin: null,
|
|
1236
|
+
customPadding: null
|
|
1237
|
+
};
|
|
1238
|
+
var HeadingConfig = {
|
|
1239
|
+
label: "Heading",
|
|
1240
|
+
defaultProps: defaultProps7,
|
|
1241
|
+
render: ({ text, level, alignment, textColor, dimensions, animation, margin, customPadding }) => {
|
|
1242
|
+
const tag = level || "h2";
|
|
1243
|
+
const alignmentValue = alignment ?? "left";
|
|
1244
|
+
const classes = cn(
|
|
1245
|
+
headingLevelMap[level] || headingLevelMap.h2,
|
|
1246
|
+
alignmentMap[alignmentValue] || alignmentMap.left
|
|
1247
|
+
);
|
|
1248
|
+
const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
|
|
1249
|
+
const style = {
|
|
1250
|
+
...dimensionsStyles
|
|
1251
|
+
};
|
|
1252
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1253
|
+
if (marginCSS) {
|
|
1254
|
+
style.margin = marginCSS;
|
|
1255
|
+
}
|
|
1256
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
1257
|
+
if (paddingCSS) {
|
|
1258
|
+
style.padding = paddingCSS;
|
|
1259
|
+
}
|
|
1260
|
+
const colorCSS = colorValueToCSS(textColor);
|
|
1261
|
+
if (colorCSS) {
|
|
1262
|
+
style.color = colorCSS;
|
|
1263
|
+
}
|
|
1264
|
+
const headingElement = React.createElement(tag, { className: classes, style: Object.keys(style).length > 0 ? style : void 0 }, text);
|
|
1265
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: headingElement });
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
var defaultProps8 = {
|
|
1269
|
+
content: "Enter your text here...",
|
|
1270
|
+
size: "base",
|
|
1271
|
+
alignment: null,
|
|
1272
|
+
textColor: null,
|
|
1273
|
+
dimensions: null,
|
|
1274
|
+
animation: null,
|
|
1275
|
+
margin: null,
|
|
1276
|
+
customPadding: null
|
|
1277
|
+
};
|
|
1278
|
+
var TextConfig = {
|
|
1279
|
+
label: "Text",
|
|
1280
|
+
defaultProps: defaultProps8,
|
|
1281
|
+
render: ({ content, size, alignment, textColor, dimensions, animation, margin, customPadding }) => {
|
|
1282
|
+
const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
|
|
1283
|
+
const style = {
|
|
1284
|
+
...dimensionsStyles
|
|
1285
|
+
};
|
|
1286
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1287
|
+
if (marginCSS) {
|
|
1288
|
+
style.margin = marginCSS;
|
|
1289
|
+
}
|
|
1290
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
1291
|
+
if (paddingCSS) {
|
|
1292
|
+
style.padding = paddingCSS;
|
|
1293
|
+
}
|
|
1294
|
+
const colorCSS = colorValueToCSS(textColor);
|
|
1295
|
+
if (colorCSS) {
|
|
1296
|
+
style.color = colorCSS;
|
|
1297
|
+
}
|
|
1298
|
+
const alignmentValue = alignment ?? "left";
|
|
1299
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1300
|
+
"p",
|
|
1301
|
+
{
|
|
1302
|
+
className: cn(
|
|
1303
|
+
textSizeMap[size] || textSizeMap.base,
|
|
1304
|
+
alignmentMap[alignmentValue] || alignmentMap.left
|
|
1305
|
+
),
|
|
1306
|
+
style: Object.keys(style).length > 0 ? style : void 0,
|
|
1307
|
+
children: content
|
|
1308
|
+
}
|
|
1309
|
+
) });
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
var defaultProps9 = {
|
|
1313
|
+
content: "<p>Enter your content here...</p>",
|
|
1314
|
+
alignment: null,
|
|
1315
|
+
textColor: null,
|
|
1316
|
+
dimensions: null,
|
|
1317
|
+
animation: null,
|
|
1318
|
+
margin: null,
|
|
1319
|
+
customPadding: null
|
|
1320
|
+
};
|
|
1321
|
+
var RichTextConfig = {
|
|
1322
|
+
label: "Rich Text",
|
|
1323
|
+
defaultProps: defaultProps9,
|
|
1324
|
+
render: ({ content, alignment, textColor, dimensions, animation, margin, customPadding }) => {
|
|
1325
|
+
const dimensionsStyles = dimensions ? dimensionsValueToCSS(dimensions) : void 0;
|
|
1326
|
+
const style = {
|
|
1327
|
+
...dimensionsStyles
|
|
1328
|
+
};
|
|
1329
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1330
|
+
if (marginCSS) {
|
|
1331
|
+
style.margin = marginCSS;
|
|
1332
|
+
}
|
|
1333
|
+
const customPaddingCSS = paddingValueToCSS(customPadding);
|
|
1334
|
+
if (customPaddingCSS) {
|
|
1335
|
+
style.padding = customPaddingCSS;
|
|
1336
|
+
}
|
|
1337
|
+
const colorCSS = colorValueToCSS(textColor);
|
|
1338
|
+
if (colorCSS) {
|
|
1339
|
+
style.color = colorCSS;
|
|
1340
|
+
}
|
|
1341
|
+
const alignmentValue = alignment ?? "left";
|
|
1342
|
+
const alignmentClass = alignmentMap[alignmentValue] || alignmentMap.left;
|
|
1343
|
+
if (!content || content === "<p></p>") {
|
|
1344
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose dark:prose-invert", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("em", { children: "No content available" }) }) }) }) });
|
|
1345
|
+
}
|
|
1346
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("section", { className: cn("relative overflow-hidden px-4", alignmentClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1347
|
+
"div",
|
|
1348
|
+
{
|
|
1349
|
+
className: "prose dark:prose-invert",
|
|
1350
|
+
dangerouslySetInnerHTML: { __html: content }
|
|
1351
|
+
}
|
|
1352
|
+
) }) });
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
var idCounter7 = 0;
|
|
1356
|
+
function generateUniqueId7() {
|
|
1357
|
+
return `i${(++idCounter7).toString(36)}${Math.random().toString(36).slice(2, 6)}`;
|
|
1358
|
+
}
|
|
1359
|
+
var defaultProps10 = {
|
|
1360
|
+
image: null,
|
|
1361
|
+
alt: "",
|
|
1362
|
+
aspectRatio: "auto",
|
|
1363
|
+
link: "",
|
|
1364
|
+
openInNewTab: false,
|
|
1365
|
+
margin: null,
|
|
1366
|
+
border: null,
|
|
1367
|
+
dimensions: null,
|
|
1368
|
+
alignment: null,
|
|
1369
|
+
transform: null,
|
|
1370
|
+
animation: null,
|
|
1371
|
+
customPadding: null,
|
|
1372
|
+
visibility: null
|
|
1373
|
+
};
|
|
1374
|
+
var ImageConfig = {
|
|
1375
|
+
label: "Image",
|
|
1376
|
+
defaultProps: defaultProps10,
|
|
1377
|
+
render: ({ image, alt, aspectRatio, link, openInNewTab, dimensions, alignment, margin, border, transform, animation, customPadding, visibility }) => {
|
|
1378
|
+
const uniqueId = generateUniqueId7();
|
|
1379
|
+
const wrapperClass = `puck-image-${uniqueId}`;
|
|
1380
|
+
const visibilityCSS = visibilityValueToCSS(visibility, wrapperClass);
|
|
1381
|
+
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
1382
|
+
const style = {
|
|
1383
|
+
...dimensionsStyles
|
|
1384
|
+
};
|
|
1385
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1386
|
+
if (marginCSS) {
|
|
1387
|
+
style.margin = marginCSS;
|
|
1388
|
+
}
|
|
1389
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
1390
|
+
if (paddingCSS) {
|
|
1391
|
+
style.padding = paddingCSS;
|
|
1392
|
+
}
|
|
1393
|
+
const borderStyles = borderValueToCSS(border);
|
|
1394
|
+
if (borderStyles) {
|
|
1395
|
+
Object.assign(style, borderStyles);
|
|
1396
|
+
}
|
|
1397
|
+
const transformStyles = transformValueToCSS(transform);
|
|
1398
|
+
if (transformStyles) {
|
|
1399
|
+
Object.assign(style, transformStyles);
|
|
1400
|
+
}
|
|
1401
|
+
const alignmentValue = alignment ?? "center";
|
|
1402
|
+
const alignmentClasses = cn(
|
|
1403
|
+
"flex",
|
|
1404
|
+
alignmentValue === "left" && "justify-start",
|
|
1405
|
+
alignmentValue === "center" && "justify-center",
|
|
1406
|
+
alignmentValue === "right" && "justify-end"
|
|
1407
|
+
);
|
|
1408
|
+
if (!image?.url) {
|
|
1409
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
|
|
1410
|
+
visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
|
|
1411
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1412
|
+
"div",
|
|
1413
|
+
{
|
|
1414
|
+
className: cn(
|
|
1415
|
+
"relative overflow-hidden rounded-lg w-full max-w-md bg-muted flex items-center justify-center min-h-[200px]",
|
|
1416
|
+
aspectRatioMap[aspectRatio] || ""
|
|
1417
|
+
),
|
|
1418
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No image selected" })
|
|
1419
|
+
}
|
|
1420
|
+
) }) })
|
|
1421
|
+
] });
|
|
1422
|
+
}
|
|
1423
|
+
const imageElement = aspectRatio === "auto" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden rounded-lg w-full", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1424
|
+
"img",
|
|
1425
|
+
{
|
|
1426
|
+
src: image.url,
|
|
1427
|
+
alt: alt || image.alt || "",
|
|
1428
|
+
className: "w-full h-auto object-cover"
|
|
1429
|
+
}
|
|
1430
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative overflow-hidden rounded-lg w-full", aspectRatioMap[aspectRatio]), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1431
|
+
"img",
|
|
1432
|
+
{
|
|
1433
|
+
src: image.url,
|
|
1434
|
+
alt: alt || image.alt || "",
|
|
1435
|
+
className: "absolute inset-0 w-full h-full object-cover"
|
|
1436
|
+
}
|
|
1437
|
+
) });
|
|
1438
|
+
const content = link ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1439
|
+
"a",
|
|
1440
|
+
{
|
|
1441
|
+
href: link,
|
|
1442
|
+
target: openInNewTab ? "_blank" : void 0,
|
|
1443
|
+
rel: openInNewTab ? "noopener noreferrer" : void 0,
|
|
1444
|
+
className: "block transition-opacity hover:opacity-90",
|
|
1445
|
+
children: imageElement
|
|
1446
|
+
}
|
|
1447
|
+
) : imageElement;
|
|
1448
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(AnimatedWrapper.AnimatedWrapper, { animation, children: [
|
|
1449
|
+
visibilityCSS && /* @__PURE__ */ jsxRuntime.jsx("style", { children: visibilityCSS }),
|
|
1450
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("py-4 px-4", wrapperClass), style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: content }) })
|
|
1451
|
+
] });
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
function cn2(...inputs) {
|
|
1455
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
1456
|
+
}
|
|
1457
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
1458
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
1459
|
+
{
|
|
1460
|
+
variants: {
|
|
1461
|
+
variant: {
|
|
1462
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1463
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1464
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
1465
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
1466
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
1467
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
1468
|
+
},
|
|
1469
|
+
size: {
|
|
1470
|
+
default: "h-10 px-4 py-2",
|
|
1471
|
+
sm: "h-8 px-3 text-xs",
|
|
1472
|
+
lg: "h-11 px-8",
|
|
1473
|
+
icon: "h-10 w-10 p-2",
|
|
1474
|
+
"icon-sm": "h-8 w-8 p-1.5"
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
defaultVariants: {
|
|
1478
|
+
variant: "default",
|
|
1479
|
+
size: "default"
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
);
|
|
1483
|
+
var Button = React__namespace.forwardRef(
|
|
1484
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1485
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
1486
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1487
|
+
Comp,
|
|
1488
|
+
{
|
|
1489
|
+
className: cn2(buttonVariants({ variant, size, className })),
|
|
1490
|
+
ref,
|
|
1491
|
+
...props
|
|
1492
|
+
}
|
|
1493
|
+
);
|
|
1494
|
+
}
|
|
1495
|
+
);
|
|
1496
|
+
Button.displayName = "Button";
|
|
1497
|
+
var Input = React__namespace.forwardRef(
|
|
1498
|
+
({ className, type, ...props }, ref) => {
|
|
1499
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1500
|
+
"input",
|
|
1501
|
+
{
|
|
1502
|
+
type,
|
|
1503
|
+
className: cn2(
|
|
1504
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1505
|
+
className
|
|
1506
|
+
),
|
|
1507
|
+
ref,
|
|
1508
|
+
...props
|
|
1509
|
+
}
|
|
1510
|
+
);
|
|
1511
|
+
}
|
|
1512
|
+
);
|
|
1513
|
+
Input.displayName = "Input";
|
|
1514
|
+
var labelVariants = classVarianceAuthority.cva(
|
|
1515
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
1516
|
+
);
|
|
1517
|
+
var Label = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1518
|
+
LabelPrimitive__namespace.Root,
|
|
1519
|
+
{
|
|
1520
|
+
ref,
|
|
1521
|
+
className: cn2(labelVariants(), className),
|
|
1522
|
+
...props
|
|
1523
|
+
}
|
|
1524
|
+
));
|
|
1525
|
+
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
1526
|
+
var DEFAULT_VALUE = {
|
|
1527
|
+
mode: "default"
|
|
1528
|
+
};
|
|
1529
|
+
var CUSTOM_DEFAULTS = {
|
|
1530
|
+
height: 40,
|
|
1531
|
+
paddingX: 16,
|
|
1532
|
+
paddingY: 8,
|
|
1533
|
+
fontSize: 14,
|
|
1534
|
+
unit: "px"
|
|
1535
|
+
};
|
|
1536
|
+
function SizeFieldInner({
|
|
1537
|
+
value,
|
|
1538
|
+
onChange,
|
|
1539
|
+
label = "Size",
|
|
1540
|
+
readOnly,
|
|
1541
|
+
showHeight = true,
|
|
1542
|
+
showFontSize = true
|
|
1543
|
+
}) {
|
|
1544
|
+
const currentValue = value || DEFAULT_VALUE;
|
|
1545
|
+
const handleModeChange = React.useCallback((mode) => {
|
|
1546
|
+
if (mode === "custom") {
|
|
1547
|
+
onChange({
|
|
1548
|
+
mode,
|
|
1549
|
+
...CUSTOM_DEFAULTS
|
|
1550
|
+
});
|
|
1551
|
+
} else {
|
|
1552
|
+
onChange({ mode });
|
|
1553
|
+
}
|
|
1554
|
+
}, [onChange]);
|
|
1555
|
+
const handleValueChange = React.useCallback((field, val) => {
|
|
1556
|
+
onChange({
|
|
1557
|
+
...currentValue,
|
|
1558
|
+
[field]: val
|
|
1559
|
+
});
|
|
1560
|
+
}, [currentValue, onChange]);
|
|
1561
|
+
const handleUnitChange = React.useCallback((unit) => {
|
|
1562
|
+
onChange({
|
|
1563
|
+
...currentValue,
|
|
1564
|
+
unit
|
|
1565
|
+
});
|
|
1566
|
+
}, [currentValue, onChange]);
|
|
1567
|
+
const handleClear = React.useCallback(() => {
|
|
1568
|
+
onChange(null);
|
|
1569
|
+
}, [onChange]);
|
|
1570
|
+
const presets = [
|
|
1571
|
+
{ mode: "sm", label: "SM" },
|
|
1572
|
+
{ mode: "default", label: "Default" },
|
|
1573
|
+
{ mode: "lg", label: "LG" },
|
|
1574
|
+
{ mode: "custom", label: "Custom" }
|
|
1575
|
+
];
|
|
1576
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "puck-field space-y-3", children: [
|
|
1577
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1578
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium text-foreground", children: label }),
|
|
1579
|
+
value && !readOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1580
|
+
Button,
|
|
1581
|
+
{
|
|
1582
|
+
type: "button",
|
|
1583
|
+
variant: "ghost",
|
|
1584
|
+
size: "icon-sm",
|
|
1585
|
+
onClick: handleClear,
|
|
1586
|
+
className: "text-muted-foreground hover:text-destructive",
|
|
1587
|
+
title: "Reset to default",
|
|
1588
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsReact.IconX, { className: "h-4 w-4" })
|
|
1589
|
+
}
|
|
1590
|
+
)
|
|
1591
|
+
] }),
|
|
1592
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: presets.map(({ mode, label: modeLabel }) => {
|
|
1593
|
+
const isActive = currentValue.mode === mode;
|
|
1594
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1595
|
+
Button,
|
|
1596
|
+
{
|
|
1597
|
+
type: "button",
|
|
1598
|
+
variant: isActive ? "default" : "secondary",
|
|
1599
|
+
size: "sm",
|
|
1600
|
+
onClick: () => handleModeChange(mode),
|
|
1601
|
+
disabled: readOnly,
|
|
1602
|
+
className: cn2(
|
|
1603
|
+
"text-xs",
|
|
1604
|
+
isActive && "bg-primary hover:bg-primary/90"
|
|
1605
|
+
),
|
|
1606
|
+
children: modeLabel
|
|
1607
|
+
},
|
|
1608
|
+
mode
|
|
1609
|
+
);
|
|
1610
|
+
}) }),
|
|
1611
|
+
currentValue.mode === "custom" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 p-3 bg-muted/50 rounded-md", children: [
|
|
1612
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1613
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground flex-shrink-0", children: "Unit:" }),
|
|
1614
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-1", children: ["px", "rem"].map((unit) => {
|
|
1615
|
+
const isActive = (currentValue.unit || "px") === unit;
|
|
1616
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1617
|
+
Button,
|
|
1618
|
+
{
|
|
1619
|
+
type: "button",
|
|
1620
|
+
variant: isActive ? "default" : "outline",
|
|
1621
|
+
size: "sm",
|
|
1622
|
+
onClick: () => handleUnitChange(unit),
|
|
1623
|
+
disabled: readOnly,
|
|
1624
|
+
className: cn2(
|
|
1625
|
+
"text-xs font-mono h-7 px-2",
|
|
1626
|
+
isActive && "bg-primary hover:bg-primary/90"
|
|
1627
|
+
),
|
|
1628
|
+
children: unit
|
|
1629
|
+
},
|
|
1630
|
+
unit
|
|
1631
|
+
);
|
|
1632
|
+
}) })
|
|
1633
|
+
] }),
|
|
1634
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
1635
|
+
showHeight && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
1636
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Height" }),
|
|
1637
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1638
|
+
Input,
|
|
1639
|
+
{
|
|
1640
|
+
type: "number",
|
|
1641
|
+
min: 0,
|
|
1642
|
+
value: currentValue.height ?? CUSTOM_DEFAULTS.height,
|
|
1643
|
+
onChange: (e) => handleValueChange("height", parseInt(e.target.value, 10) || 0),
|
|
1644
|
+
disabled: readOnly,
|
|
1645
|
+
className: "h-8 text-sm font-mono"
|
|
1646
|
+
}
|
|
1647
|
+
)
|
|
1648
|
+
] }),
|
|
1649
|
+
showFontSize && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
1650
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Font Size" }),
|
|
1651
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1652
|
+
Input,
|
|
1653
|
+
{
|
|
1654
|
+
type: "number",
|
|
1655
|
+
min: 0,
|
|
1656
|
+
value: currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize,
|
|
1657
|
+
onChange: (e) => handleValueChange("fontSize", parseInt(e.target.value, 10) || 0),
|
|
1658
|
+
disabled: readOnly,
|
|
1659
|
+
className: "h-8 text-sm font-mono"
|
|
1660
|
+
}
|
|
1661
|
+
)
|
|
1662
|
+
] }),
|
|
1663
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
1664
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding X" }),
|
|
1665
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1666
|
+
Input,
|
|
1667
|
+
{
|
|
1668
|
+
type: "number",
|
|
1669
|
+
min: 0,
|
|
1670
|
+
value: currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX,
|
|
1671
|
+
onChange: (e) => handleValueChange("paddingX", parseInt(e.target.value, 10) || 0),
|
|
1672
|
+
disabled: readOnly,
|
|
1673
|
+
className: "h-8 text-sm font-mono"
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
] }),
|
|
1677
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
1678
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-[10px] uppercase tracking-wide text-muted-foreground", children: "Padding Y" }),
|
|
1679
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1680
|
+
Input,
|
|
1681
|
+
{
|
|
1682
|
+
type: "number",
|
|
1683
|
+
min: 0,
|
|
1684
|
+
value: currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY,
|
|
1685
|
+
onChange: (e) => handleValueChange("paddingY", parseInt(e.target.value, 10) || 0),
|
|
1686
|
+
disabled: readOnly,
|
|
1687
|
+
className: "h-8 text-sm font-mono"
|
|
1688
|
+
}
|
|
1689
|
+
)
|
|
1690
|
+
] })
|
|
1691
|
+
] }),
|
|
1692
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground font-mono pt-1 border-t border-border/50", children: [
|
|
1693
|
+
showHeight && `h: ${currentValue.height ?? CUSTOM_DEFAULTS.height}${currentValue.unit || "px"}`,
|
|
1694
|
+
showHeight && " | ",
|
|
1695
|
+
`p: ${currentValue.paddingY ?? CUSTOM_DEFAULTS.paddingY}${currentValue.unit || "px"} ${currentValue.paddingX ?? CUSTOM_DEFAULTS.paddingX}${currentValue.unit || "px"}`,
|
|
1696
|
+
showFontSize && ` | font: ${currentValue.fontSize ?? CUSTOM_DEFAULTS.fontSize}${currentValue.unit || "px"}`
|
|
1697
|
+
] })
|
|
1698
|
+
] })
|
|
1699
|
+
] });
|
|
1700
|
+
}
|
|
1701
|
+
React.memo(SizeFieldInner);
|
|
1702
|
+
function sizeValueToCSS(size) {
|
|
1703
|
+
if (!size || size.mode !== "custom") return void 0;
|
|
1704
|
+
const unit = size.unit || "px";
|
|
1705
|
+
const style = {};
|
|
1706
|
+
if (size.height != null) {
|
|
1707
|
+
style.height = `${size.height}${unit}`;
|
|
1708
|
+
}
|
|
1709
|
+
if (size.paddingX != null || size.paddingY != null) {
|
|
1710
|
+
const py = size.paddingY ?? 0;
|
|
1711
|
+
const px = size.paddingX ?? 0;
|
|
1712
|
+
style.padding = `${py}${unit} ${px}${unit}`;
|
|
1713
|
+
}
|
|
1714
|
+
if (size.fontSize != null) {
|
|
1715
|
+
style.fontSize = `${size.fontSize}${unit}`;
|
|
1716
|
+
}
|
|
1717
|
+
return Object.keys(style).length > 0 ? style : void 0;
|
|
1718
|
+
}
|
|
1719
|
+
function getSizeClasses(size, sizeMap) {
|
|
1720
|
+
if (!size) return sizeMap.default || "";
|
|
1721
|
+
if (size.mode === "custom") return "";
|
|
1722
|
+
return sizeMap[size.mode] || sizeMap.default || "";
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// src/theme/defaults.ts
|
|
1726
|
+
var DEFAULT_BUTTON_VARIANTS = {
|
|
1727
|
+
default: { classes: "bg-primary text-primary-foreground hover:bg-primary/90" },
|
|
1728
|
+
secondary: { classes: "bg-secondary text-secondary-foreground hover:bg-secondary/80" },
|
|
1729
|
+
outline: { classes: "border border-input bg-background hover:bg-accent hover:text-accent-foreground" },
|
|
1730
|
+
ghost: { classes: "bg-transparent hover:bg-accent hover:text-accent-foreground" },
|
|
1731
|
+
destructive: { classes: "bg-destructive text-destructive-foreground hover:bg-destructive/90" },
|
|
1732
|
+
link: { classes: "text-primary underline-offset-4 hover:underline bg-transparent" }
|
|
1733
|
+
};
|
|
1734
|
+
var DEFAULT_FOCUS_RING = "focus:ring-ring";
|
|
1735
|
+
|
|
1736
|
+
// src/theme/utils.ts
|
|
1737
|
+
function getVariantClasses(variants, variant, fallback = "default") {
|
|
1738
|
+
const config = variants[variant];
|
|
1739
|
+
if (config?.classes) {
|
|
1740
|
+
return config.classes;
|
|
1741
|
+
}
|
|
1742
|
+
const fallbackConfig = variants[fallback];
|
|
1743
|
+
return fallbackConfig?.classes ?? "";
|
|
1744
|
+
}
|
|
1745
|
+
var sizeStyles = {
|
|
1746
|
+
sm: "h-8 px-3 text-sm",
|
|
1747
|
+
default: "h-10 px-4",
|
|
1748
|
+
lg: "h-12 px-8 text-lg"
|
|
1749
|
+
};
|
|
1750
|
+
var alignmentWrapperMap = {
|
|
1751
|
+
left: "text-left",
|
|
1752
|
+
center: "text-center",
|
|
1753
|
+
right: "text-right"
|
|
1754
|
+
};
|
|
1755
|
+
var defaultProps11 = {
|
|
1756
|
+
text: "Click Me",
|
|
1757
|
+
link: "",
|
|
1758
|
+
variant: "default",
|
|
1759
|
+
size: null,
|
|
1760
|
+
openInNewTab: "no",
|
|
1761
|
+
margin: null,
|
|
1762
|
+
customBackgroundColor: null,
|
|
1763
|
+
customTextColor: null,
|
|
1764
|
+
customBorder: null,
|
|
1765
|
+
alignment: null,
|
|
1766
|
+
transform: null,
|
|
1767
|
+
animation: null,
|
|
1768
|
+
customPadding: null
|
|
1769
|
+
};
|
|
1770
|
+
var ButtonConfig = {
|
|
1771
|
+
label: "Button",
|
|
1772
|
+
defaultProps: defaultProps11,
|
|
1773
|
+
render: ({ text, link, variant, size, openInNewTab, alignment, margin, customBackgroundColor, customTextColor, customBorder, transform, animation, customPadding }) => {
|
|
1774
|
+
const hasCustomBackground = customBackgroundColor?.hex;
|
|
1775
|
+
const hasCustomTextColor = customTextColor?.hex;
|
|
1776
|
+
const hasCustomPadding = customPadding;
|
|
1777
|
+
const hasCustomSize = size?.mode === "custom";
|
|
1778
|
+
const variantClasses = getVariantClasses(DEFAULT_BUTTON_VARIANTS, variant, "default");
|
|
1779
|
+
const sizeClasses = getSizeClasses(size, sizeStyles);
|
|
1780
|
+
const buttonClasses = cn(
|
|
1781
|
+
"inline-flex items-center justify-center font-medium transition-colors",
|
|
1782
|
+
`focus:outline-none focus:ring-2 focus:ring-offset-2 ${DEFAULT_FOCUS_RING}`,
|
|
1783
|
+
"disabled:opacity-50 disabled:pointer-events-none",
|
|
1784
|
+
// Only apply variant styles if no custom background/text color
|
|
1785
|
+
!hasCustomBackground && !hasCustomTextColor && variantClasses,
|
|
1786
|
+
// Only apply background portion of variant if no custom background
|
|
1787
|
+
hasCustomBackground && !hasCustomTextColor && "hover:opacity-90",
|
|
1788
|
+
// Only apply size classes if not using custom size or custom padding
|
|
1789
|
+
!hasCustomPadding && !hasCustomSize && sizeClasses,
|
|
1790
|
+
// Apply rounded-md unless custom border has radius
|
|
1791
|
+
!customBorder?.radius && "rounded-md"
|
|
1792
|
+
);
|
|
1793
|
+
const buttonStyle = {};
|
|
1794
|
+
if (hasCustomBackground) {
|
|
1795
|
+
buttonStyle.backgroundColor = colorValueToCSS(customBackgroundColor);
|
|
1796
|
+
}
|
|
1797
|
+
if (hasCustomTextColor) {
|
|
1798
|
+
buttonStyle.color = colorValueToCSS(customTextColor);
|
|
1799
|
+
}
|
|
1800
|
+
const borderStyles = borderValueToCSS(customBorder);
|
|
1801
|
+
if (borderStyles) {
|
|
1802
|
+
Object.assign(buttonStyle, borderStyles);
|
|
1803
|
+
}
|
|
1804
|
+
const customSizeStyles = sizeValueToCSS(size);
|
|
1805
|
+
if (customSizeStyles) {
|
|
1806
|
+
Object.assign(buttonStyle, customSizeStyles);
|
|
1807
|
+
}
|
|
1808
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
1809
|
+
if (paddingCSS) {
|
|
1810
|
+
buttonStyle.padding = paddingCSS;
|
|
1811
|
+
}
|
|
1812
|
+
const transformStyles = transformValueToCSS(transform);
|
|
1813
|
+
if (transformStyles) {
|
|
1814
|
+
Object.assign(buttonStyle, transformStyles);
|
|
1815
|
+
}
|
|
1816
|
+
const buttonElement = link ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1817
|
+
"a",
|
|
1818
|
+
{
|
|
1819
|
+
href: link,
|
|
1820
|
+
target: openInNewTab === "yes" ? "_blank" : void 0,
|
|
1821
|
+
rel: openInNewTab === "yes" ? "noopener noreferrer" : void 0,
|
|
1822
|
+
className: buttonClasses,
|
|
1823
|
+
style: buttonStyle,
|
|
1824
|
+
children: text
|
|
1825
|
+
}
|
|
1826
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: buttonClasses, style: buttonStyle, children: text });
|
|
1827
|
+
const wrapperStyle = {};
|
|
1828
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1829
|
+
if (marginCSS) {
|
|
1830
|
+
wrapperStyle.margin = marginCSS;
|
|
1831
|
+
}
|
|
1832
|
+
const alignmentValue = alignment ?? "left";
|
|
1833
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1834
|
+
AnimatedWrapper.AnimatedWrapper,
|
|
1835
|
+
{
|
|
1836
|
+
animation,
|
|
1837
|
+
className: alignmentWrapperMap[alignmentValue] || alignmentWrapperMap.left,
|
|
1838
|
+
style: wrapperStyle,
|
|
1839
|
+
children: buttonElement
|
|
1840
|
+
}
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1844
|
+
var defaultProps12 = {
|
|
1845
|
+
image: null,
|
|
1846
|
+
heading: "Card Heading",
|
|
1847
|
+
text: "Card description text goes here.",
|
|
1848
|
+
link: "",
|
|
1849
|
+
openInNewTab: false,
|
|
1850
|
+
shadow: "md",
|
|
1851
|
+
margin: null,
|
|
1852
|
+
background: null,
|
|
1853
|
+
border: null,
|
|
1854
|
+
dimensions: null,
|
|
1855
|
+
alignment: null,
|
|
1856
|
+
transform: null,
|
|
1857
|
+
animation: null,
|
|
1858
|
+
customPadding: null
|
|
1859
|
+
};
|
|
1860
|
+
var CardConfig = {
|
|
1861
|
+
label: "Card",
|
|
1862
|
+
defaultProps: defaultProps12,
|
|
1863
|
+
render: ({ image, heading, text, link, openInNewTab, shadow, background, dimensions, alignment, margin, border, transform, animation, customPadding }) => {
|
|
1864
|
+
const hasBorderRadius = border?.radius && border.radius > 0;
|
|
1865
|
+
const cardClasses = cn(
|
|
1866
|
+
"overflow-hidden transition-all bg-card",
|
|
1867
|
+
!hasBorderRadius && "rounded-lg",
|
|
1868
|
+
shadowMap[shadow] || "",
|
|
1869
|
+
link && "hover:shadow-lg cursor-pointer"
|
|
1870
|
+
);
|
|
1871
|
+
const wrapperStyle = {};
|
|
1872
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1873
|
+
if (marginCSS) {
|
|
1874
|
+
wrapperStyle.margin = marginCSS;
|
|
1875
|
+
}
|
|
1876
|
+
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
1877
|
+
if (dimensionsStyles) {
|
|
1878
|
+
Object.assign(wrapperStyle, dimensionsStyles);
|
|
1879
|
+
}
|
|
1880
|
+
const transformStyles = transformValueToCSS(transform);
|
|
1881
|
+
if (transformStyles) {
|
|
1882
|
+
Object.assign(wrapperStyle, transformStyles);
|
|
1883
|
+
}
|
|
1884
|
+
const alignmentValue = alignment ?? "left";
|
|
1885
|
+
const alignmentClasses = cn(
|
|
1886
|
+
"flex",
|
|
1887
|
+
alignmentValue === "left" && "justify-start",
|
|
1888
|
+
alignmentValue === "center" && "justify-center",
|
|
1889
|
+
alignmentValue === "right" && "justify-end"
|
|
1890
|
+
);
|
|
1891
|
+
const backgroundStyles = backgroundValueToCSS(background);
|
|
1892
|
+
const cardStyle = {
|
|
1893
|
+
...backgroundStyles
|
|
1894
|
+
};
|
|
1895
|
+
const borderStyles = borderValueToCSS(border);
|
|
1896
|
+
if (borderStyles) {
|
|
1897
|
+
Object.assign(cardStyle, borderStyles);
|
|
1898
|
+
}
|
|
1899
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
1900
|
+
if (paddingCSS) {
|
|
1901
|
+
cardStyle.padding = paddingCSS;
|
|
1902
|
+
}
|
|
1903
|
+
const cardContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cardClasses, style: cardStyle, children: [
|
|
1904
|
+
image?.url ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative aspect-video w-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1905
|
+
"img",
|
|
1906
|
+
{
|
|
1907
|
+
src: image.url,
|
|
1908
|
+
alt: image.alt || heading || "",
|
|
1909
|
+
className: "w-full h-full object-cover"
|
|
1910
|
+
}
|
|
1911
|
+
) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "aspect-video w-full bg-muted flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "No image" }) }),
|
|
1912
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-4", children: [
|
|
1913
|
+
heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: heading }),
|
|
1914
|
+
text && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: text })
|
|
1915
|
+
] })
|
|
1916
|
+
] });
|
|
1917
|
+
if (link) {
|
|
1918
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1919
|
+
"a",
|
|
1920
|
+
{
|
|
1921
|
+
href: link,
|
|
1922
|
+
target: openInNewTab ? "_blank" : void 0,
|
|
1923
|
+
rel: openInNewTab ? "noopener noreferrer" : void 0,
|
|
1924
|
+
className: "block",
|
|
1925
|
+
style: wrapperStyle,
|
|
1926
|
+
children: cardContent
|
|
1927
|
+
}
|
|
1928
|
+
) }) });
|
|
1929
|
+
}
|
|
1930
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: alignmentClasses, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: wrapperStyle, children: cardContent }) }) });
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
var defaultProps13 = {
|
|
1934
|
+
style: "solid",
|
|
1935
|
+
color: null,
|
|
1936
|
+
margin: null,
|
|
1937
|
+
dimensions: null,
|
|
1938
|
+
transform: null,
|
|
1939
|
+
animation: null,
|
|
1940
|
+
customPadding: null
|
|
1941
|
+
};
|
|
1942
|
+
var DividerConfig = {
|
|
1943
|
+
label: "Divider",
|
|
1944
|
+
defaultProps: defaultProps13,
|
|
1945
|
+
render: ({ style, color, dimensions, margin, transform, animation, customPadding }) => {
|
|
1946
|
+
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
1947
|
+
const wrapperStyle = {
|
|
1948
|
+
...dimensionsStyles
|
|
1949
|
+
};
|
|
1950
|
+
const marginCSS = marginValueToCSS(margin);
|
|
1951
|
+
if (marginCSS) {
|
|
1952
|
+
wrapperStyle.margin = marginCSS;
|
|
1953
|
+
}
|
|
1954
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
1955
|
+
if (paddingCSS) {
|
|
1956
|
+
wrapperStyle.padding = paddingCSS;
|
|
1957
|
+
}
|
|
1958
|
+
const transformStyles = transformValueToCSS(transform);
|
|
1959
|
+
if (transformStyles) {
|
|
1960
|
+
Object.assign(wrapperStyle, transformStyles);
|
|
1961
|
+
}
|
|
1962
|
+
const customColor = colorValueToCSS(color);
|
|
1963
|
+
const hrStyle = customColor ? { borderColor: customColor } : void 0;
|
|
1964
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper.AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(wrapperStyle).length > 0 ? wrapperStyle : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1965
|
+
"hr",
|
|
1966
|
+
{
|
|
1967
|
+
className: cn(
|
|
1968
|
+
"border-t border-border",
|
|
1969
|
+
dividerStyleMap[style] || dividerStyleMap.solid
|
|
1970
|
+
),
|
|
1971
|
+
style: hrStyle
|
|
1972
|
+
}
|
|
1973
|
+
) }) });
|
|
1974
|
+
}
|
|
1975
|
+
};
|
|
1976
|
+
var defaultProps14 = {
|
|
1977
|
+
items: [
|
|
1978
|
+
{
|
|
1979
|
+
title: "What is this?",
|
|
1980
|
+
content: "This is an accordion component that can expand and collapse.",
|
|
1981
|
+
defaultOpen: false
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
title: "How do I use it?",
|
|
1985
|
+
content: "Click on each item to expand or collapse it.",
|
|
1986
|
+
defaultOpen: false
|
|
1987
|
+
}
|
|
1988
|
+
],
|
|
1989
|
+
allowMultiple: false,
|
|
1990
|
+
textColor: null,
|
|
1991
|
+
margin: null,
|
|
1992
|
+
background: null,
|
|
1993
|
+
dimensions: null,
|
|
1994
|
+
transform: null,
|
|
1995
|
+
animation: null,
|
|
1996
|
+
customPadding: null
|
|
1997
|
+
};
|
|
1998
|
+
var AccordionConfig = {
|
|
1999
|
+
label: "Accordion",
|
|
2000
|
+
defaultProps: defaultProps14,
|
|
2001
|
+
render: (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2002
|
+
AccordionClient.AccordionClient,
|
|
2003
|
+
{
|
|
2004
|
+
items: props.items,
|
|
2005
|
+
allowMultiple: props.allowMultiple,
|
|
2006
|
+
textColor: props.textColor,
|
|
2007
|
+
margin: props.margin,
|
|
2008
|
+
background: props.background,
|
|
2009
|
+
dimensions: props.dimensions,
|
|
2010
|
+
transform: props.transform,
|
|
2011
|
+
animation: props.animation,
|
|
2012
|
+
customPadding: props.customPadding
|
|
2013
|
+
}
|
|
2014
|
+
)
|
|
2015
|
+
};
|
|
2016
|
+
function createConfig(layouts = DEFAULT_LAYOUTS) {
|
|
2017
|
+
const layoutOptions = layoutsToOptions(layouts);
|
|
2018
|
+
return {
|
|
2019
|
+
root: {
|
|
2020
|
+
fields: {
|
|
2021
|
+
title: {
|
|
2022
|
+
type: "text",
|
|
2023
|
+
label: "Page Title"
|
|
2024
|
+
},
|
|
2025
|
+
pageLayout: {
|
|
2026
|
+
type: "select",
|
|
2027
|
+
label: "Page Layout",
|
|
2028
|
+
options: layoutOptions.map(({ value, label }) => ({ value, label }))
|
|
2029
|
+
}
|
|
2030
|
+
},
|
|
2031
|
+
defaultProps: {
|
|
2032
|
+
title: "New Page",
|
|
2033
|
+
pageLayout: "default"
|
|
2034
|
+
},
|
|
2035
|
+
render: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children })
|
|
2036
|
+
},
|
|
2037
|
+
categories: {
|
|
2038
|
+
layout: {
|
|
2039
|
+
title: "Layout",
|
|
2040
|
+
components: ["Container", "Flex", "Grid", "Section", "Spacer", "Template"],
|
|
2041
|
+
defaultExpanded: true
|
|
2042
|
+
},
|
|
2043
|
+
typography: {
|
|
2044
|
+
title: "Typography",
|
|
2045
|
+
components: ["Heading", "Text", "RichText"]
|
|
2046
|
+
},
|
|
2047
|
+
media: {
|
|
2048
|
+
title: "Media",
|
|
2049
|
+
components: ["Image"]
|
|
2050
|
+
},
|
|
2051
|
+
interactive: {
|
|
2052
|
+
title: "Interactive",
|
|
2053
|
+
components: ["Button", "Card", "Divider", "Accordion"]
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
components: {
|
|
2057
|
+
// Layout
|
|
2058
|
+
Container: ContainerConfig,
|
|
2059
|
+
Flex: FlexConfig,
|
|
2060
|
+
Grid: GridConfig,
|
|
2061
|
+
Section: SectionConfig,
|
|
2062
|
+
Spacer: SpacerConfig,
|
|
2063
|
+
Template: TemplateServerConfig,
|
|
2064
|
+
// Typography
|
|
2065
|
+
Heading: HeadingConfig,
|
|
2066
|
+
Text: TextConfig,
|
|
2067
|
+
RichText: RichTextConfig,
|
|
2068
|
+
// Media
|
|
2069
|
+
Image: ImageConfig,
|
|
2070
|
+
// Interactive
|
|
2071
|
+
Button: ButtonConfig,
|
|
2072
|
+
Card: CardConfig,
|
|
2073
|
+
Divider: DividerConfig,
|
|
2074
|
+
Accordion: AccordionConfig
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
}
|
|
2078
|
+
var baseConfig = createConfig(DEFAULT_LAYOUTS);
|
|
2079
|
+
function PageRenderer({
|
|
2080
|
+
data,
|
|
2081
|
+
config = baseConfig,
|
|
2082
|
+
wrapper: Wrapper,
|
|
2083
|
+
className,
|
|
2084
|
+
layouts = DEFAULT_LAYOUTS
|
|
2085
|
+
}) {
|
|
2086
|
+
if (!data || !data.content) {
|
|
2087
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: "No content available" }) });
|
|
2088
|
+
}
|
|
2089
|
+
const content = /* @__PURE__ */ jsxRuntime.jsx(puck.Render, { config, data });
|
|
2090
|
+
const rootProps = data.root?.props;
|
|
2091
|
+
const overrides = {
|
|
2092
|
+
showHeader: rootProps?.showHeader,
|
|
2093
|
+
showFooter: rootProps?.showFooter,
|
|
2094
|
+
background: rootProps?.pageBackground,
|
|
2095
|
+
maxWidth: rootProps?.pageMaxWidth
|
|
2096
|
+
};
|
|
2097
|
+
let result = content;
|
|
2098
|
+
if (Wrapper) {
|
|
2099
|
+
result = /* @__PURE__ */ jsxRuntime.jsx(Wrapper, { children: result });
|
|
2100
|
+
} else {
|
|
2101
|
+
const pageLayout = rootProps?.pageLayout;
|
|
2102
|
+
const layout = pageLayout ? getLayout(layouts, pageLayout) : void 0;
|
|
2103
|
+
if (layout) {
|
|
2104
|
+
result = /* @__PURE__ */ jsxRuntime.jsx(LayoutWrapper, { layout, className, overrides, children: result });
|
|
2105
|
+
} else if (className || overrides.background) {
|
|
2106
|
+
result = /* @__PURE__ */ jsxRuntime.jsx(LayoutWrapper, { className, overrides, children: result });
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
return result;
|
|
2110
|
+
}
|
|
2111
|
+
function HybridPageRenderer({
|
|
2112
|
+
page,
|
|
2113
|
+
legacyRenderer,
|
|
2114
|
+
legacyBlocksField = "layout",
|
|
2115
|
+
fallback = /* @__PURE__ */ jsxRuntime.jsx("div", { children: "No content available" }),
|
|
2116
|
+
config,
|
|
2117
|
+
layouts,
|
|
2118
|
+
wrapper,
|
|
2119
|
+
className
|
|
2120
|
+
}) {
|
|
2121
|
+
const puckData = page.puckData;
|
|
2122
|
+
const hasPuckContent = puckData?.content && Array.isArray(puckData.content) && puckData.content.length > 0;
|
|
2123
|
+
const legacyBlocks = page[legacyBlocksField];
|
|
2124
|
+
const hasLegacyContent = Array.isArray(legacyBlocks) && legacyBlocks.length > 0;
|
|
2125
|
+
if (page.editorVersion === "puck" && hasPuckContent) {
|
|
2126
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2127
|
+
PageRenderer,
|
|
2128
|
+
{
|
|
2129
|
+
data: puckData,
|
|
2130
|
+
config,
|
|
2131
|
+
layouts,
|
|
2132
|
+
wrapper,
|
|
2133
|
+
className
|
|
2134
|
+
}
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
if (hasLegacyContent) {
|
|
2138
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: legacyRenderer(legacyBlocks) });
|
|
2139
|
+
}
|
|
2140
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
exports.HybridPageRenderer = HybridPageRenderer;
|
|
2144
|
+
exports.PageRenderer = PageRenderer;
|
|
2145
|
+
//# sourceMappingURL=index.js.map
|
|
2146
|
+
//# sourceMappingURL=index.js.map
|