@vasttrader/puck-config 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 +22 -0
- package/README.md +130 -0
- package/dist/index.d.mts +164 -0
- package/dist/index.d.ts +164 -0
- package/dist/index.js +783 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +753 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +68 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
// src/components/Accordion/index.tsx
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var Accordion = {
|
|
5
|
+
label: "Accordion",
|
|
6
|
+
fields: {
|
|
7
|
+
items: {
|
|
8
|
+
type: "array",
|
|
9
|
+
label: "Accordion Items",
|
|
10
|
+
arrayFields: {
|
|
11
|
+
id: {
|
|
12
|
+
type: "text",
|
|
13
|
+
label: "ID (unique identifier)"
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
type: "text",
|
|
17
|
+
label: "Title"
|
|
18
|
+
},
|
|
19
|
+
content: {
|
|
20
|
+
type: "textarea",
|
|
21
|
+
label: "Content (supports HTML)"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultItemProps: {
|
|
25
|
+
id: "",
|
|
26
|
+
title: "New Item",
|
|
27
|
+
content: "<p>Enter content here...</p>"
|
|
28
|
+
},
|
|
29
|
+
getItemSummary: (item) => item.title || "Untitled"
|
|
30
|
+
},
|
|
31
|
+
allowMultiple: {
|
|
32
|
+
type: "radio",
|
|
33
|
+
label: "Allow Multiple Open",
|
|
34
|
+
options: [
|
|
35
|
+
{ label: "Yes", value: true },
|
|
36
|
+
{ label: "No", value: false }
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
defaultOpenFirst: {
|
|
40
|
+
type: "radio",
|
|
41
|
+
label: "Open First Item by Default",
|
|
42
|
+
options: [
|
|
43
|
+
{ label: "Yes", value: true },
|
|
44
|
+
{ label: "No", value: false }
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
type: "select",
|
|
49
|
+
label: "Style Variant",
|
|
50
|
+
options: [
|
|
51
|
+
{ label: "Default", value: "default" },
|
|
52
|
+
{ label: "Bordered", value: "bordered" },
|
|
53
|
+
{ label: "Separated", value: "separated" },
|
|
54
|
+
{ label: "Minimal", value: "minimal" }
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
iconPosition: {
|
|
58
|
+
type: "radio",
|
|
59
|
+
label: "Icon Position",
|
|
60
|
+
options: [
|
|
61
|
+
{ label: "Left", value: "left" },
|
|
62
|
+
{ label: "Right", value: "right" }
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
icon: {
|
|
66
|
+
type: "select",
|
|
67
|
+
label: "Icon Type",
|
|
68
|
+
options: [
|
|
69
|
+
{ label: "Chevron", value: "chevron" },
|
|
70
|
+
{ label: "Plus/Minus", value: "plus" },
|
|
71
|
+
{ label: "Arrow", value: "arrow" }
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
animationDuration: {
|
|
75
|
+
type: "number",
|
|
76
|
+
label: "Animation Duration (ms)",
|
|
77
|
+
min: 0,
|
|
78
|
+
max: 1e3
|
|
79
|
+
},
|
|
80
|
+
className: {
|
|
81
|
+
type: "text",
|
|
82
|
+
label: "Custom CSS Class"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
defaultProps: {
|
|
86
|
+
items: [
|
|
87
|
+
{
|
|
88
|
+
id: "item-1",
|
|
89
|
+
title: "What is this accordion?",
|
|
90
|
+
content: "<p>This is a flexible accordion component that can be customized to fit your needs. You can add multiple items, customize the styling, and control the behavior.</p>"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
allowMultiple: false,
|
|
94
|
+
defaultOpenFirst: true,
|
|
95
|
+
variant: "default",
|
|
96
|
+
iconPosition: "right",
|
|
97
|
+
icon: "chevron",
|
|
98
|
+
animationDuration: 300,
|
|
99
|
+
className: ""
|
|
100
|
+
},
|
|
101
|
+
render: ({
|
|
102
|
+
items,
|
|
103
|
+
allowMultiple = false,
|
|
104
|
+
defaultOpenFirst = false,
|
|
105
|
+
variant = "default",
|
|
106
|
+
iconPosition = "right",
|
|
107
|
+
icon = "chevron",
|
|
108
|
+
animationDuration = 300,
|
|
109
|
+
className = ""
|
|
110
|
+
}) => {
|
|
111
|
+
const [openItems, setOpenItems] = useState(() => {
|
|
112
|
+
if (defaultOpenFirst && items.length > 0) {
|
|
113
|
+
return /* @__PURE__ */ new Set([items[0].id]);
|
|
114
|
+
}
|
|
115
|
+
return /* @__PURE__ */ new Set();
|
|
116
|
+
});
|
|
117
|
+
const toggleItem = (id) => {
|
|
118
|
+
setOpenItems((prev) => {
|
|
119
|
+
const newSet = new Set(prev);
|
|
120
|
+
if (newSet.has(id)) {
|
|
121
|
+
newSet.delete(id);
|
|
122
|
+
} else {
|
|
123
|
+
if (!allowMultiple) {
|
|
124
|
+
newSet.clear();
|
|
125
|
+
}
|
|
126
|
+
newSet.add(id);
|
|
127
|
+
}
|
|
128
|
+
return newSet;
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
const getIcon = (isOpen) => {
|
|
132
|
+
switch (icon) {
|
|
133
|
+
case "chevron":
|
|
134
|
+
return /* @__PURE__ */ jsx(
|
|
135
|
+
"svg",
|
|
136
|
+
{
|
|
137
|
+
className: `puck-accordion-icon ${isOpen ? "puck-accordion-icon-open" : ""}`,
|
|
138
|
+
width: "20",
|
|
139
|
+
height: "20",
|
|
140
|
+
viewBox: "0 0 20 20",
|
|
141
|
+
fill: "none",
|
|
142
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
143
|
+
role: "img",
|
|
144
|
+
"aria-label": "Toggle accordion",
|
|
145
|
+
children: /* @__PURE__ */ jsx(
|
|
146
|
+
"path",
|
|
147
|
+
{
|
|
148
|
+
d: "M5 7.5L10 12.5L15 7.5",
|
|
149
|
+
stroke: "currentColor",
|
|
150
|
+
strokeWidth: "2",
|
|
151
|
+
strokeLinecap: "round",
|
|
152
|
+
strokeLinejoin: "round"
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
case "plus":
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
"svg",
|
|
160
|
+
{
|
|
161
|
+
className: `puck-accordion-icon ${isOpen ? "puck-accordion-icon-open" : ""}`,
|
|
162
|
+
width: "20",
|
|
163
|
+
height: "20",
|
|
164
|
+
viewBox: "0 0 20 20",
|
|
165
|
+
fill: "none",
|
|
166
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
167
|
+
role: "img",
|
|
168
|
+
"aria-label": "Toggle accordion",
|
|
169
|
+
children: isOpen ? /* @__PURE__ */ jsx("path", { d: "M5 10H15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx("path", { d: "M10 5V15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }),
|
|
171
|
+
/* @__PURE__ */ jsx("path", { d: "M5 10H15", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })
|
|
172
|
+
] })
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
case "arrow":
|
|
176
|
+
return /* @__PURE__ */ jsx(
|
|
177
|
+
"svg",
|
|
178
|
+
{
|
|
179
|
+
className: `puck-accordion-icon ${isOpen ? "puck-accordion-icon-open" : ""}`,
|
|
180
|
+
width: "20",
|
|
181
|
+
height: "20",
|
|
182
|
+
viewBox: "0 0 20 20",
|
|
183
|
+
fill: "none",
|
|
184
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
185
|
+
role: "img",
|
|
186
|
+
"aria-label": "Toggle accordion",
|
|
187
|
+
children: /* @__PURE__ */ jsx(
|
|
188
|
+
"path",
|
|
189
|
+
{
|
|
190
|
+
d: "M7.5 5L12.5 10L7.5 15",
|
|
191
|
+
stroke: "currentColor",
|
|
192
|
+
strokeWidth: "2",
|
|
193
|
+
strokeLinecap: "round",
|
|
194
|
+
strokeLinejoin: "round"
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
202
|
+
/* @__PURE__ */ jsx("div", { className: `puck-accordion puck-accordion-${variant} ${className}`, children: items.map((item) => {
|
|
203
|
+
const isOpen = openItems.has(item.id);
|
|
204
|
+
return /* @__PURE__ */ jsxs(
|
|
205
|
+
"div",
|
|
206
|
+
{
|
|
207
|
+
className: `puck-accordion-item ${isOpen ? "puck-accordion-item-open" : ""}`,
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsxs(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
className: `puck-accordion-trigger ${iconPosition === "left" ? "puck-accordion-trigger-icon-left" : ""}`,
|
|
213
|
+
onClick: () => toggleItem(item.id),
|
|
214
|
+
"aria-expanded": isOpen,
|
|
215
|
+
type: "button",
|
|
216
|
+
children: [
|
|
217
|
+
iconPosition === "left" && /* @__PURE__ */ jsx("span", { className: "puck-accordion-icon-wrapper", children: getIcon(isOpen) }),
|
|
218
|
+
/* @__PURE__ */ jsx("span", { className: "puck-accordion-title", children: item.title }),
|
|
219
|
+
iconPosition === "right" && /* @__PURE__ */ jsx("span", { className: "puck-accordion-icon-wrapper", children: getIcon(isOpen) })
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
/* @__PURE__ */ jsx(
|
|
224
|
+
"div",
|
|
225
|
+
{
|
|
226
|
+
className: `puck-accordion-content ${isOpen ? "puck-accordion-content-open" : ""}`,
|
|
227
|
+
style: {
|
|
228
|
+
maxHeight: isOpen ? "1000px" : "0",
|
|
229
|
+
transition: `max-height ${animationDuration}ms ease-in-out, opacity ${animationDuration}ms ease-in-out`
|
|
230
|
+
},
|
|
231
|
+
children: /* @__PURE__ */ jsx("div", { className: "puck-accordion-content-inner", children: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: item.content } }) })
|
|
232
|
+
}
|
|
233
|
+
)
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
item.id
|
|
237
|
+
);
|
|
238
|
+
}) }),
|
|
239
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
240
|
+
.puck-accordion {
|
|
241
|
+
width: 100%;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.puck-accordion-default {
|
|
245
|
+
border: 1px solid #e5e7eb;
|
|
246
|
+
border-radius: 8px;
|
|
247
|
+
overflow: hidden;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.puck-accordion-default .puck-accordion-item:not(:last-child) {
|
|
251
|
+
border-bottom: 1px solid #e5e7eb;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.puck-accordion-bordered .puck-accordion-item {
|
|
255
|
+
border: 1px solid #e5e7eb;
|
|
256
|
+
border-radius: 8px;
|
|
257
|
+
margin-bottom: 8px;
|
|
258
|
+
overflow: hidden;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.puck-accordion-bordered .puck-accordion-item:last-child {
|
|
262
|
+
margin-bottom: 0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.puck-accordion-separated .puck-accordion-item {
|
|
266
|
+
border-radius: 8px;
|
|
267
|
+
margin-bottom: 12px;
|
|
268
|
+
padding: 4px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.puck-accordion-separated .puck-accordion-item:last-child {
|
|
272
|
+
margin-bottom: 0;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.puck-accordion-minimal .puck-accordion-item:not(:last-child) {
|
|
276
|
+
border-bottom: 1px solid #f3f4f6;
|
|
277
|
+
padding: 8px 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.puck-accordion-trigger {
|
|
281
|
+
background-color: transparent;
|
|
282
|
+
width: 100%;
|
|
283
|
+
display: flex;
|
|
284
|
+
align-items: center;
|
|
285
|
+
justify-content: space-between;
|
|
286
|
+
padding: 16px 20px;
|
|
287
|
+
border: none;
|
|
288
|
+
cursor: pointer;
|
|
289
|
+
text-align: left;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.puck-accordion-trigger-icon-left {
|
|
293
|
+
flex-direction: row-reverse;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.puck-accordion-title {
|
|
297
|
+
font-size: 16px;
|
|
298
|
+
font-weight: 600;
|
|
299
|
+
color: #111827;
|
|
300
|
+
flex: 1;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.puck-accordion-icon-wrapper {
|
|
304
|
+
display: flex;
|
|
305
|
+
align-items: center;
|
|
306
|
+
justify-content: center;
|
|
307
|
+
margin-left: 12px;
|
|
308
|
+
color: #6b7280;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.puck-accordion-trigger-icon-left .puck-accordion-icon-wrapper {
|
|
312
|
+
margin-left: 0;
|
|
313
|
+
margin-right: 12px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.puck-accordion-icon {
|
|
317
|
+
transition: transform ${animationDuration}ms ease;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.puck-accordion-icon-open {
|
|
321
|
+
transform: rotate(180deg);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.puck-accordion-trigger-icon-left .puck-accordion-icon-open {
|
|
325
|
+
transform: rotate(90deg);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.puck-accordion-content {
|
|
329
|
+
overflow: hidden;
|
|
330
|
+
opacity: 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.puck-accordion-content-open {
|
|
334
|
+
opacity: 1;
|
|
335
|
+
border-top: 1px solid #e4e4e4;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.puck-accordion-content-inner {
|
|
339
|
+
padding: 0 20px;
|
|
340
|
+
color: #4b5563;
|
|
341
|
+
font-size: 14px;
|
|
342
|
+
line-height: 1.6;
|
|
343
|
+
}
|
|
344
|
+
` })
|
|
345
|
+
] });
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
// src/components/Editor/index.tsx
|
|
350
|
+
import { FieldLabel } from "@measured/puck";
|
|
351
|
+
import { Editor as TinyMCE } from "@tinymce/tinymce-react";
|
|
352
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
353
|
+
var Editor = {
|
|
354
|
+
fields: {
|
|
355
|
+
text: {
|
|
356
|
+
type: "custom",
|
|
357
|
+
render: ({ value, onChange }) => {
|
|
358
|
+
return /* @__PURE__ */ jsx2(FieldLabel, { label: "Editor", children: /* @__PURE__ */ jsx2(
|
|
359
|
+
TinyMCE,
|
|
360
|
+
{
|
|
361
|
+
licenseKey: "gpl",
|
|
362
|
+
tinymceScriptSrc: "https://cdnjs.cloudflare.com/ajax/libs/tinymce/8.1.2/tinymce.min.js",
|
|
363
|
+
init: {
|
|
364
|
+
height: 200,
|
|
365
|
+
menubar: false,
|
|
366
|
+
statusbar: false,
|
|
367
|
+
branding: false,
|
|
368
|
+
plugins: "link lists table",
|
|
369
|
+
toolbar: "bold italic | bullist numlist | link | table"
|
|
370
|
+
},
|
|
371
|
+
initialValue: value,
|
|
372
|
+
onBlur: (_, editor) => {
|
|
373
|
+
onChange(editor.getContent());
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
) });
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
},
|
|
380
|
+
defaultProps: {
|
|
381
|
+
text: ""
|
|
382
|
+
},
|
|
383
|
+
render: ({ text }) => /* @__PURE__ */ jsx2("div", { dangerouslySetInnerHTML: { __html: text ?? "" } })
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
// src/components/Image/index.tsx
|
|
387
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
388
|
+
var shadowClasses = {
|
|
389
|
+
none: "",
|
|
390
|
+
sm: "shadow-sm",
|
|
391
|
+
md: "shadow-md",
|
|
392
|
+
lg: "shadow-lg",
|
|
393
|
+
xl: "shadow-xl"
|
|
394
|
+
};
|
|
395
|
+
var aspectRatioValues = {
|
|
396
|
+
"16:9": "16 / 9",
|
|
397
|
+
"4:3": "4 / 3",
|
|
398
|
+
"1:1": "1 / 1",
|
|
399
|
+
"21:9": "21 / 9",
|
|
400
|
+
custom: void 0,
|
|
401
|
+
none: void 0
|
|
402
|
+
};
|
|
403
|
+
var Image = {
|
|
404
|
+
label: "Image",
|
|
405
|
+
fields: {
|
|
406
|
+
src: {
|
|
407
|
+
type: "text",
|
|
408
|
+
label: "Image URL"
|
|
409
|
+
},
|
|
410
|
+
alt: {
|
|
411
|
+
type: "text",
|
|
412
|
+
label: "Alt Text (for accessibility)"
|
|
413
|
+
},
|
|
414
|
+
width: {
|
|
415
|
+
type: "number",
|
|
416
|
+
label: "Width (px)",
|
|
417
|
+
min: 1,
|
|
418
|
+
max: 4e3
|
|
419
|
+
},
|
|
420
|
+
height: {
|
|
421
|
+
type: "number",
|
|
422
|
+
label: "Height (px)",
|
|
423
|
+
min: 1,
|
|
424
|
+
max: 4e3
|
|
425
|
+
},
|
|
426
|
+
aspectRatio: {
|
|
427
|
+
type: "select",
|
|
428
|
+
label: "Aspect Ratio",
|
|
429
|
+
options: [
|
|
430
|
+
{ label: "None", value: "none" },
|
|
431
|
+
{ label: "16:9 (Widescreen)", value: "16:9" },
|
|
432
|
+
{ label: "4:3 (Standard)", value: "4:3" },
|
|
433
|
+
{ label: "1:1 (Square)", value: "1:1" },
|
|
434
|
+
{ label: "21:9 (Ultrawide)", value: "21:9" },
|
|
435
|
+
{ label: "Custom", value: "custom" }
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
customAspectRatio: {
|
|
439
|
+
type: "text",
|
|
440
|
+
label: "Custom Aspect Ratio (e.g., 3/2)"
|
|
441
|
+
},
|
|
442
|
+
objectFit: {
|
|
443
|
+
type: "select",
|
|
444
|
+
label: "Object Fit",
|
|
445
|
+
options: [
|
|
446
|
+
{ label: "Cover", value: "cover" },
|
|
447
|
+
{ label: "Contain", value: "contain" },
|
|
448
|
+
{ label: "Fill", value: "fill" },
|
|
449
|
+
{ label: "None", value: "none" },
|
|
450
|
+
{ label: "Scale Down", value: "scale-down" }
|
|
451
|
+
]
|
|
452
|
+
},
|
|
453
|
+
objectPosition: {
|
|
454
|
+
type: "text",
|
|
455
|
+
label: "Object Position (e.g., center, top, bottom)"
|
|
456
|
+
},
|
|
457
|
+
alignment: {
|
|
458
|
+
type: "radio",
|
|
459
|
+
label: "Alignment",
|
|
460
|
+
options: [
|
|
461
|
+
{ label: "Left", value: "left" },
|
|
462
|
+
{ label: "Center", value: "center" },
|
|
463
|
+
{ label: "Right", value: "right" }
|
|
464
|
+
]
|
|
465
|
+
},
|
|
466
|
+
maxWidth: {
|
|
467
|
+
type: "number",
|
|
468
|
+
label: "Max Width (px, 0 = no limit)",
|
|
469
|
+
min: 0,
|
|
470
|
+
max: 2e3
|
|
471
|
+
},
|
|
472
|
+
caption: {
|
|
473
|
+
type: "textarea",
|
|
474
|
+
label: "Caption (optional)"
|
|
475
|
+
},
|
|
476
|
+
link: {
|
|
477
|
+
type: "text",
|
|
478
|
+
label: "Link URL (optional)"
|
|
479
|
+
},
|
|
480
|
+
openInNewTab: {
|
|
481
|
+
type: "radio",
|
|
482
|
+
label: "Open Link in New Tab",
|
|
483
|
+
options: [
|
|
484
|
+
{ label: "Yes", value: true },
|
|
485
|
+
{ label: "No", value: false }
|
|
486
|
+
]
|
|
487
|
+
},
|
|
488
|
+
borderRadius: {
|
|
489
|
+
type: "number",
|
|
490
|
+
label: "Border Radius (px)",
|
|
491
|
+
min: 0,
|
|
492
|
+
max: 100
|
|
493
|
+
},
|
|
494
|
+
shadow: {
|
|
495
|
+
type: "select",
|
|
496
|
+
label: "Shadow",
|
|
497
|
+
options: [
|
|
498
|
+
{ label: "None", value: "none" },
|
|
499
|
+
{ label: "Small", value: "sm" },
|
|
500
|
+
{ label: "Medium", value: "md" },
|
|
501
|
+
{ label: "Large", value: "lg" },
|
|
502
|
+
{ label: "Extra Large", value: "xl" }
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
loading: {
|
|
506
|
+
type: "radio",
|
|
507
|
+
label: "Loading Strategy",
|
|
508
|
+
options: [
|
|
509
|
+
{ label: "Lazy", value: "lazy" },
|
|
510
|
+
{ label: "Eager", value: "eager" }
|
|
511
|
+
]
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
defaultProps: {
|
|
515
|
+
src: "https://images.unsplash.com/photo-1506905925346-21bda4d32df4",
|
|
516
|
+
alt: "Beautiful landscape",
|
|
517
|
+
width: 800,
|
|
518
|
+
height: 600,
|
|
519
|
+
objectFit: "cover",
|
|
520
|
+
objectPosition: "center",
|
|
521
|
+
alignment: "center",
|
|
522
|
+
caption: "",
|
|
523
|
+
link: "",
|
|
524
|
+
openInNewTab: true,
|
|
525
|
+
borderRadius: 0,
|
|
526
|
+
shadow: "none",
|
|
527
|
+
aspectRatio: "none",
|
|
528
|
+
customAspectRatio: "",
|
|
529
|
+
maxWidth: 0,
|
|
530
|
+
loading: "lazy"
|
|
531
|
+
},
|
|
532
|
+
render: (props) => {
|
|
533
|
+
const {
|
|
534
|
+
src,
|
|
535
|
+
alt,
|
|
536
|
+
width = 800,
|
|
537
|
+
height = 600,
|
|
538
|
+
objectFit = "cover",
|
|
539
|
+
objectPosition = "center",
|
|
540
|
+
alignment = "center",
|
|
541
|
+
caption,
|
|
542
|
+
link,
|
|
543
|
+
openInNewTab = true,
|
|
544
|
+
borderRadius = 0,
|
|
545
|
+
shadow = "none",
|
|
546
|
+
aspectRatio = "none",
|
|
547
|
+
customAspectRatio,
|
|
548
|
+
maxWidth,
|
|
549
|
+
loading = "lazy"
|
|
550
|
+
} = props;
|
|
551
|
+
const aspectValue = aspectRatio === "custom" && customAspectRatio ? customAspectRatio : aspectRatioValues[aspectRatio];
|
|
552
|
+
const alignmentStyles = {
|
|
553
|
+
left: "flex-start",
|
|
554
|
+
center: "center",
|
|
555
|
+
right: "flex-end"
|
|
556
|
+
};
|
|
557
|
+
const imageElement = /* @__PURE__ */ jsx3(
|
|
558
|
+
"div",
|
|
559
|
+
{
|
|
560
|
+
className: "external-image-wrapper",
|
|
561
|
+
style: {
|
|
562
|
+
position: "relative",
|
|
563
|
+
width: "100%",
|
|
564
|
+
maxWidth: maxWidth ? `${maxWidth}px` : "100%",
|
|
565
|
+
aspectRatio: aspectValue,
|
|
566
|
+
borderRadius: `${borderRadius}px`,
|
|
567
|
+
overflow: "hidden"
|
|
568
|
+
},
|
|
569
|
+
children: /* @__PURE__ */ jsx3(
|
|
570
|
+
"img",
|
|
571
|
+
{
|
|
572
|
+
src,
|
|
573
|
+
alt,
|
|
574
|
+
width,
|
|
575
|
+
height,
|
|
576
|
+
style: {
|
|
577
|
+
display: "block",
|
|
578
|
+
objectFit,
|
|
579
|
+
objectPosition,
|
|
580
|
+
width: "100%",
|
|
581
|
+
height: "100%"
|
|
582
|
+
},
|
|
583
|
+
loading,
|
|
584
|
+
className: shadowClasses[shadow]
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
const content = /* @__PURE__ */ jsxs2(
|
|
590
|
+
"figure",
|
|
591
|
+
{
|
|
592
|
+
className: "external-image-container",
|
|
593
|
+
style: {
|
|
594
|
+
margin: 0,
|
|
595
|
+
display: "flex",
|
|
596
|
+
flexDirection: "column",
|
|
597
|
+
alignItems: alignmentStyles[alignment],
|
|
598
|
+
width: "100%"
|
|
599
|
+
},
|
|
600
|
+
children: [
|
|
601
|
+
link ? /* @__PURE__ */ jsx3(
|
|
602
|
+
"a",
|
|
603
|
+
{
|
|
604
|
+
href: link,
|
|
605
|
+
target: openInNewTab ? "_blank" : "_self",
|
|
606
|
+
rel: openInNewTab ? "noopener noreferrer" : void 0,
|
|
607
|
+
style: {
|
|
608
|
+
display: "block",
|
|
609
|
+
width: "100%",
|
|
610
|
+
maxWidth: maxWidth ? `${maxWidth}px` : "100%"
|
|
611
|
+
},
|
|
612
|
+
children: imageElement
|
|
613
|
+
}
|
|
614
|
+
) : imageElement,
|
|
615
|
+
caption && /* @__PURE__ */ jsx3(
|
|
616
|
+
"figcaption",
|
|
617
|
+
{
|
|
618
|
+
style: {
|
|
619
|
+
marginTop: "0.5rem",
|
|
620
|
+
fontSize: "0.875rem",
|
|
621
|
+
color: "#6b7280",
|
|
622
|
+
textAlign: alignment,
|
|
623
|
+
maxWidth: maxWidth ? `${maxWidth}px` : "100%",
|
|
624
|
+
width: "100%"
|
|
625
|
+
},
|
|
626
|
+
children: caption
|
|
627
|
+
}
|
|
628
|
+
)
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
return content;
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
// src/components/Space/index.tsx
|
|
637
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
638
|
+
var Space = {
|
|
639
|
+
label: "Space",
|
|
640
|
+
fields: {
|
|
641
|
+
height: {
|
|
642
|
+
type: "number",
|
|
643
|
+
label: "Height (Desktop)",
|
|
644
|
+
min: 0,
|
|
645
|
+
max: 500
|
|
646
|
+
},
|
|
647
|
+
mobileHeight: {
|
|
648
|
+
type: "number",
|
|
649
|
+
label: "Height (Mobile)",
|
|
650
|
+
min: 0,
|
|
651
|
+
max: 300
|
|
652
|
+
},
|
|
653
|
+
width: {
|
|
654
|
+
type: "number",
|
|
655
|
+
label: "Width (0 = full width)",
|
|
656
|
+
min: 0,
|
|
657
|
+
max: 2e3
|
|
658
|
+
},
|
|
659
|
+
mobileWidth: {
|
|
660
|
+
type: "number",
|
|
661
|
+
label: "Width Mobile (0 = full width)",
|
|
662
|
+
min: 0,
|
|
663
|
+
max: 1e3
|
|
664
|
+
},
|
|
665
|
+
backgroundColor: {
|
|
666
|
+
type: "text",
|
|
667
|
+
label: "Background Color"
|
|
668
|
+
},
|
|
669
|
+
showDivider: {
|
|
670
|
+
type: "radio",
|
|
671
|
+
label: "Show Divider Line",
|
|
672
|
+
options: [
|
|
673
|
+
{ label: "Yes", value: true },
|
|
674
|
+
{ label: "No", value: false }
|
|
675
|
+
]
|
|
676
|
+
},
|
|
677
|
+
dividerColor: {
|
|
678
|
+
type: "text",
|
|
679
|
+
label: "Divider Color"
|
|
680
|
+
},
|
|
681
|
+
dividerStyle: {
|
|
682
|
+
type: "select",
|
|
683
|
+
label: "Divider Style",
|
|
684
|
+
options: [
|
|
685
|
+
{ label: "Solid", value: "solid" },
|
|
686
|
+
{ label: "Dashed", value: "dashed" },
|
|
687
|
+
{ label: "Dotted", value: "dotted" }
|
|
688
|
+
]
|
|
689
|
+
},
|
|
690
|
+
dividerThickness: {
|
|
691
|
+
type: "number",
|
|
692
|
+
label: "Divider Thickness (px)",
|
|
693
|
+
min: 1,
|
|
694
|
+
max: 10
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
defaultProps: {
|
|
698
|
+
height: 40,
|
|
699
|
+
width: 0,
|
|
700
|
+
mobileHeight: 20,
|
|
701
|
+
mobileWidth: 0,
|
|
702
|
+
backgroundColor: "transparent",
|
|
703
|
+
showDivider: false,
|
|
704
|
+
dividerColor: "#e5e7eb",
|
|
705
|
+
dividerStyle: "solid",
|
|
706
|
+
dividerThickness: 1
|
|
707
|
+
},
|
|
708
|
+
render: ({
|
|
709
|
+
height = 40,
|
|
710
|
+
width = 0,
|
|
711
|
+
mobileHeight = 20,
|
|
712
|
+
mobileWidth = 0,
|
|
713
|
+
backgroundColor = "transparent",
|
|
714
|
+
showDivider = false,
|
|
715
|
+
dividerColor = "#e5e7eb",
|
|
716
|
+
dividerStyle = "solid",
|
|
717
|
+
dividerThickness = 1
|
|
718
|
+
}) => {
|
|
719
|
+
const dividerStyles = showDivider ? {
|
|
720
|
+
borderTop: `${dividerThickness}px ${dividerStyle} ${dividerColor}`
|
|
721
|
+
} : {};
|
|
722
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
723
|
+
/* @__PURE__ */ jsx4(
|
|
724
|
+
"div",
|
|
725
|
+
{
|
|
726
|
+
className: "puck-space",
|
|
727
|
+
style: {
|
|
728
|
+
height: `${height}px`,
|
|
729
|
+
width: width ? `${width}px` : "100%",
|
|
730
|
+
backgroundColor,
|
|
731
|
+
...dividerStyles
|
|
732
|
+
},
|
|
733
|
+
"aria-hidden": "true"
|
|
734
|
+
}
|
|
735
|
+
),
|
|
736
|
+
/* @__PURE__ */ jsx4("style", { children: `
|
|
737
|
+
@media (max-width: 768px) {
|
|
738
|
+
.puck-space {
|
|
739
|
+
height: ${mobileHeight}px !important;
|
|
740
|
+
width: ${mobileWidth ? `${mobileWidth}px` : "100%"} !important;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
` })
|
|
744
|
+
] });
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
export {
|
|
748
|
+
Accordion,
|
|
749
|
+
Editor,
|
|
750
|
+
Image,
|
|
751
|
+
Space
|
|
752
|
+
};
|
|
753
|
+
//# sourceMappingURL=index.mjs.map
|