@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,786 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var iconsReact = require('@tabler/icons-react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/fields/shared.ts
|
|
9
|
+
function cn(...classes) {
|
|
10
|
+
return classes.filter(Boolean).join(" ");
|
|
11
|
+
}
|
|
12
|
+
function isLegacyWidthValue(value) {
|
|
13
|
+
if (!value || typeof value !== "object") return false;
|
|
14
|
+
const v = value;
|
|
15
|
+
return typeof v.maxWidth === "number" && typeof v.unit === "string" && typeof v.mode === "string" && !("minWidth" in v) && !("minHeight" in v) && !("maxHeight" in v);
|
|
16
|
+
}
|
|
17
|
+
function hexToRgb(hex) {
|
|
18
|
+
const clean = hex.replace(/^#/, "");
|
|
19
|
+
if (clean.length !== 6) return null;
|
|
20
|
+
const r = parseInt(clean.substring(0, 2), 16);
|
|
21
|
+
const g = parseInt(clean.substring(2, 4), 16);
|
|
22
|
+
const b = parseInt(clean.substring(4, 6), 16);
|
|
23
|
+
if (isNaN(r) || isNaN(g) || isNaN(b)) return null;
|
|
24
|
+
return { r, g, b };
|
|
25
|
+
}
|
|
26
|
+
function colorValueToCSS(color) {
|
|
27
|
+
if (!color?.hex) return void 0;
|
|
28
|
+
const rgb = hexToRgb(color.hex);
|
|
29
|
+
if (!rgb) return color.hex;
|
|
30
|
+
const opacity = (color.opacity ?? 100) / 100;
|
|
31
|
+
if (opacity === 1) {
|
|
32
|
+
return color.hex;
|
|
33
|
+
}
|
|
34
|
+
return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${opacity})`;
|
|
35
|
+
}
|
|
36
|
+
function paddingValueToCSS(padding) {
|
|
37
|
+
if (!padding) return void 0;
|
|
38
|
+
const { top, right, bottom, left, unit } = padding;
|
|
39
|
+
if (top === right && right === bottom && bottom === left) {
|
|
40
|
+
return `${top}${unit}`;
|
|
41
|
+
}
|
|
42
|
+
if (top === bottom && left === right) {
|
|
43
|
+
return `${top}${unit} ${right}${unit}`;
|
|
44
|
+
}
|
|
45
|
+
if (left === right) {
|
|
46
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
|
|
47
|
+
}
|
|
48
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
|
|
49
|
+
}
|
|
50
|
+
function marginValueToCSS(margin) {
|
|
51
|
+
if (!margin) return void 0;
|
|
52
|
+
const { top, right, bottom, left, unit } = margin;
|
|
53
|
+
if (top === right && right === bottom && bottom === left) {
|
|
54
|
+
return `${top}${unit}`;
|
|
55
|
+
}
|
|
56
|
+
if (top === bottom && left === right) {
|
|
57
|
+
return `${top}${unit} ${right}${unit}`;
|
|
58
|
+
}
|
|
59
|
+
if (left === right) {
|
|
60
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit}`;
|
|
61
|
+
}
|
|
62
|
+
return `${top}${unit} ${right}${unit} ${bottom}${unit} ${left}${unit}`;
|
|
63
|
+
}
|
|
64
|
+
function widthValueToCSS(width) {
|
|
65
|
+
if (!width) return void 0;
|
|
66
|
+
const style = {};
|
|
67
|
+
if (width.mode === "full") {
|
|
68
|
+
style.width = "100%";
|
|
69
|
+
style.maxWidth = "100%";
|
|
70
|
+
} else {
|
|
71
|
+
style.maxWidth = `${width.maxWidth}${width.unit}`;
|
|
72
|
+
style.width = "100%";
|
|
73
|
+
}
|
|
74
|
+
switch (width.alignment) {
|
|
75
|
+
case "left":
|
|
76
|
+
style.marginLeft = "0";
|
|
77
|
+
style.marginRight = "auto";
|
|
78
|
+
break;
|
|
79
|
+
case "center":
|
|
80
|
+
style.marginLeft = "auto";
|
|
81
|
+
style.marginRight = "auto";
|
|
82
|
+
break;
|
|
83
|
+
case "right":
|
|
84
|
+
style.marginLeft = "auto";
|
|
85
|
+
style.marginRight = "0";
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return style;
|
|
89
|
+
}
|
|
90
|
+
function dimensionsValueToCSS(dimensions) {
|
|
91
|
+
if (!dimensions) return void 0;
|
|
92
|
+
if (isLegacyWidthValue(dimensions)) {
|
|
93
|
+
return widthValueToCSS(dimensions);
|
|
94
|
+
}
|
|
95
|
+
const dim = dimensions;
|
|
96
|
+
const style = {};
|
|
97
|
+
if (dim.mode === "full") {
|
|
98
|
+
style.width = "100%";
|
|
99
|
+
style.maxWidth = "100%";
|
|
100
|
+
} else {
|
|
101
|
+
style.width = "100%";
|
|
102
|
+
if (dim.maxWidth?.enabled !== false && dim.maxWidth?.value > 0) {
|
|
103
|
+
style.maxWidth = `${dim.maxWidth.value}${dim.maxWidth.unit}`;
|
|
104
|
+
}
|
|
105
|
+
if (dim.minWidth?.enabled && dim.minWidth.value > 0) {
|
|
106
|
+
style.minWidth = `${dim.minWidth.value}${dim.minWidth.unit}`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (dim.minHeight?.enabled && dim.minHeight.value > 0) {
|
|
110
|
+
style.minHeight = `${dim.minHeight.value}${dim.minHeight.unit}`;
|
|
111
|
+
}
|
|
112
|
+
if (dim.maxHeight?.enabled && dim.maxHeight.value > 0) {
|
|
113
|
+
style.maxHeight = `${dim.maxHeight.value}${dim.maxHeight.unit}`;
|
|
114
|
+
}
|
|
115
|
+
switch (dim.alignment) {
|
|
116
|
+
case "left":
|
|
117
|
+
style.marginLeft = "0";
|
|
118
|
+
style.marginRight = "auto";
|
|
119
|
+
break;
|
|
120
|
+
case "center":
|
|
121
|
+
style.marginLeft = "auto";
|
|
122
|
+
style.marginRight = "auto";
|
|
123
|
+
break;
|
|
124
|
+
case "right":
|
|
125
|
+
style.marginLeft = "auto";
|
|
126
|
+
style.marginRight = "0";
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
return style;
|
|
130
|
+
}
|
|
131
|
+
function gradientValueToCSS(gradient) {
|
|
132
|
+
if (!gradient?.stops || gradient.stops.length === 0) {
|
|
133
|
+
return "transparent";
|
|
134
|
+
}
|
|
135
|
+
const sortedStops = [...gradient.stops].sort((a, b) => a.position - b.position);
|
|
136
|
+
const stopsCSS = sortedStops.map((stop) => {
|
|
137
|
+
const color = colorValueToCSS(stop.color) || "transparent";
|
|
138
|
+
return `${color} ${stop.position}%`;
|
|
139
|
+
}).join(", ");
|
|
140
|
+
if (gradient.type === "radial") {
|
|
141
|
+
const shape = gradient.radialShape || "circle";
|
|
142
|
+
const position = gradient.radialPosition || "center";
|
|
143
|
+
return `radial-gradient(${shape} at ${position}, ${stopsCSS})`;
|
|
144
|
+
}
|
|
145
|
+
return `linear-gradient(${gradient.angle}deg, ${stopsCSS})`;
|
|
146
|
+
}
|
|
147
|
+
function positionToCSS(position) {
|
|
148
|
+
const positionMap = {
|
|
149
|
+
center: "center",
|
|
150
|
+
top: "top",
|
|
151
|
+
bottom: "bottom",
|
|
152
|
+
left: "left",
|
|
153
|
+
right: "right",
|
|
154
|
+
"top-left": "top left",
|
|
155
|
+
"top-right": "top right",
|
|
156
|
+
"bottom-left": "bottom left",
|
|
157
|
+
"bottom-right": "bottom right"
|
|
158
|
+
};
|
|
159
|
+
return position ? positionMap[position] || "center" : "center";
|
|
160
|
+
}
|
|
161
|
+
function maskDirectionToCSS(direction) {
|
|
162
|
+
const directionMap = {
|
|
163
|
+
"to-top": "to top",
|
|
164
|
+
"to-bottom": "to bottom",
|
|
165
|
+
"to-left": "to left",
|
|
166
|
+
"to-right": "to right",
|
|
167
|
+
"to-top-left": "to top left",
|
|
168
|
+
"to-top-right": "to top right",
|
|
169
|
+
"to-bottom-left": "to bottom left",
|
|
170
|
+
"to-bottom-right": "to bottom right",
|
|
171
|
+
"from-center": "radial"
|
|
172
|
+
// Not used for linear, handled separately in maskToCSS
|
|
173
|
+
};
|
|
174
|
+
return directionMap[direction] || "to bottom";
|
|
175
|
+
}
|
|
176
|
+
function maskToCSS(mask) {
|
|
177
|
+
const startAlpha = (mask.startOpacity ?? 100) / 100;
|
|
178
|
+
const endAlpha = (mask.endOpacity ?? 0) / 100;
|
|
179
|
+
if (mask.direction === "from-center") {
|
|
180
|
+
return `radial-gradient(circle at center, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
181
|
+
}
|
|
182
|
+
const direction = maskDirectionToCSS(mask.direction);
|
|
183
|
+
return `linear-gradient(${direction}, rgba(0,0,0,${startAlpha}) ${mask.startPosition}%, rgba(0,0,0,${endAlpha}) ${mask.endPosition}%)`;
|
|
184
|
+
}
|
|
185
|
+
function backgroundValueToCSS(bg) {
|
|
186
|
+
if (!bg || bg.type === "none") {
|
|
187
|
+
return {};
|
|
188
|
+
}
|
|
189
|
+
const style = {};
|
|
190
|
+
switch (bg.type) {
|
|
191
|
+
case "solid":
|
|
192
|
+
if (bg.solid?.hex) {
|
|
193
|
+
style.backgroundColor = colorValueToCSS(bg.solid);
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
case "gradient":
|
|
197
|
+
if (bg.gradient && bg.gradient.stops && bg.gradient.stops.length > 0) {
|
|
198
|
+
style.background = gradientValueToCSS(bg.gradient);
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
case "image":
|
|
202
|
+
if (bg.image?.media?.url) {
|
|
203
|
+
const imageUrl = bg.image.media.url;
|
|
204
|
+
const size = bg.image.size || "cover";
|
|
205
|
+
const position = positionToCSS(bg.image.position);
|
|
206
|
+
const repeat = bg.image.repeat || "no-repeat";
|
|
207
|
+
const attachment = bg.image.attachment || "scroll";
|
|
208
|
+
if (bg.overlay?.enabled) {
|
|
209
|
+
const overlayCSS = bg.overlay.type === "solid" ? colorValueToCSS(bg.overlay.solid) : gradientValueToCSS(bg.overlay.gradient);
|
|
210
|
+
if (bg.overlay.type === "solid" && overlayCSS) {
|
|
211
|
+
style.backgroundImage = `linear-gradient(${overlayCSS}, ${overlayCSS}), url(${imageUrl})`;
|
|
212
|
+
} else {
|
|
213
|
+
style.backgroundImage = `${overlayCSS}, url(${imageUrl})`;
|
|
214
|
+
}
|
|
215
|
+
style.backgroundSize = `auto, ${size}`;
|
|
216
|
+
style.backgroundPosition = `center, ${position}`;
|
|
217
|
+
style.backgroundRepeat = `no-repeat, ${repeat}`;
|
|
218
|
+
style.backgroundAttachment = `scroll, ${attachment}`;
|
|
219
|
+
} else {
|
|
220
|
+
style.backgroundImage = `url(${imageUrl})`;
|
|
221
|
+
style.backgroundSize = size;
|
|
222
|
+
style.backgroundPosition = position;
|
|
223
|
+
style.backgroundRepeat = repeat;
|
|
224
|
+
style.backgroundAttachment = attachment;
|
|
225
|
+
}
|
|
226
|
+
if (bg.image.mask?.enabled) {
|
|
227
|
+
const maskCSS = maskToCSS(bg.image.mask);
|
|
228
|
+
style.maskImage = maskCSS;
|
|
229
|
+
style.WebkitMaskImage = maskCSS;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
return style;
|
|
235
|
+
}
|
|
236
|
+
function transformOriginToCSS(origin) {
|
|
237
|
+
const originMap = {
|
|
238
|
+
center: "center",
|
|
239
|
+
top: "top",
|
|
240
|
+
bottom: "bottom",
|
|
241
|
+
left: "left",
|
|
242
|
+
right: "right",
|
|
243
|
+
"top-left": "top left",
|
|
244
|
+
"top-right": "top right",
|
|
245
|
+
"bottom-left": "bottom left",
|
|
246
|
+
"bottom-right": "bottom right"
|
|
247
|
+
};
|
|
248
|
+
return originMap[origin] || "center";
|
|
249
|
+
}
|
|
250
|
+
function transformValueToCSS(transform) {
|
|
251
|
+
if (!transform) return void 0;
|
|
252
|
+
const style = {};
|
|
253
|
+
const transforms = [];
|
|
254
|
+
if (transform.enable3D && transform.perspective) {
|
|
255
|
+
style.perspective = `${transform.perspective}px`;
|
|
256
|
+
}
|
|
257
|
+
if (transform.translateX !== 0 || transform.translateY !== 0) {
|
|
258
|
+
transforms.push(
|
|
259
|
+
`translate(${transform.translateX}${transform.translateUnit}, ${transform.translateY}${transform.translateUnit})`
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
if (transform.rotate !== 0) {
|
|
263
|
+
transforms.push(`rotate(${transform.rotate}deg)`);
|
|
264
|
+
}
|
|
265
|
+
if (transform.enable3D) {
|
|
266
|
+
if (transform.rotateX && transform.rotateX !== 0) {
|
|
267
|
+
transforms.push(`rotateX(${transform.rotateX}deg)`);
|
|
268
|
+
}
|
|
269
|
+
if (transform.rotateY && transform.rotateY !== 0) {
|
|
270
|
+
transforms.push(`rotateY(${transform.rotateY}deg)`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (transform.scaleX !== 1 || transform.scaleY !== 1) {
|
|
274
|
+
if (transform.scaleX === transform.scaleY) {
|
|
275
|
+
transforms.push(`scale(${transform.scaleX})`);
|
|
276
|
+
} else {
|
|
277
|
+
transforms.push(`scale(${transform.scaleX}, ${transform.scaleY})`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (transform.skewX !== 0 || transform.skewY !== 0) {
|
|
281
|
+
if (transform.skewX !== 0 && transform.skewY !== 0) {
|
|
282
|
+
transforms.push(`skew(${transform.skewX}deg, ${transform.skewY}deg)`);
|
|
283
|
+
} else if (transform.skewX !== 0) {
|
|
284
|
+
transforms.push(`skewX(${transform.skewX}deg)`);
|
|
285
|
+
} else {
|
|
286
|
+
transforms.push(`skewY(${transform.skewY}deg)`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (transforms.length > 0) {
|
|
290
|
+
style.transform = transforms.join(" ");
|
|
291
|
+
}
|
|
292
|
+
if (transform.origin !== "center") {
|
|
293
|
+
style.transformOrigin = transformOriginToCSS(transform.origin);
|
|
294
|
+
}
|
|
295
|
+
if (transform.enable3D) {
|
|
296
|
+
style.transformStyle = "preserve-3d";
|
|
297
|
+
}
|
|
298
|
+
return Object.keys(style).length > 0 ? style : void 0;
|
|
299
|
+
}
|
|
300
|
+
var EASING_CSS_MAP = {
|
|
301
|
+
linear: "linear",
|
|
302
|
+
ease: "ease",
|
|
303
|
+
"ease-in": "ease-in",
|
|
304
|
+
"ease-out": "ease-out",
|
|
305
|
+
"ease-in-out": "ease-in-out",
|
|
306
|
+
spring: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
307
|
+
"spring-gentle": "cubic-bezier(0.34, 1.56, 0.64, 1)",
|
|
308
|
+
bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
309
|
+
"bounce-in": "cubic-bezier(0.6, -0.28, 0.735, 0.045)",
|
|
310
|
+
"bounce-out": "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
311
|
+
"back-in": "cubic-bezier(0.6, -0.28, 0.735, 0.045)",
|
|
312
|
+
"back-out": "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
|
|
313
|
+
"back-in-out": "cubic-bezier(0.68, -0.55, 0.265, 1.55)",
|
|
314
|
+
elastic: "cubic-bezier(0.68, -0.6, 0.32, 1.6)"
|
|
315
|
+
};
|
|
316
|
+
function animationOriginToCSS(origin) {
|
|
317
|
+
if (!origin) return "center";
|
|
318
|
+
const originMap = {
|
|
319
|
+
center: "center",
|
|
320
|
+
top: "top",
|
|
321
|
+
bottom: "bottom",
|
|
322
|
+
left: "left",
|
|
323
|
+
right: "right",
|
|
324
|
+
"top-left": "top left",
|
|
325
|
+
"top-right": "top right",
|
|
326
|
+
"bottom-left": "bottom left",
|
|
327
|
+
"bottom-right": "bottom right"
|
|
328
|
+
};
|
|
329
|
+
return originMap[origin] || "center";
|
|
330
|
+
}
|
|
331
|
+
function animationValueToCSS(anim) {
|
|
332
|
+
if (!anim || anim.mode !== "custom") return void 0;
|
|
333
|
+
const duration = anim.duration ?? 300;
|
|
334
|
+
const delay = anim.delay ?? 0;
|
|
335
|
+
const easing = anim.easing ?? "ease";
|
|
336
|
+
const easingCSS = EASING_CSS_MAP[easing] || "ease";
|
|
337
|
+
return {
|
|
338
|
+
transition: `all ${duration}ms ${easingCSS} ${delay}ms`,
|
|
339
|
+
transitionProperty: "opacity, transform, filter, background-color, color, border-color, box-shadow"
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function getEntranceAnimationStyles(anim) {
|
|
343
|
+
const defaultResult = {
|
|
344
|
+
initial: {},
|
|
345
|
+
animate: {},
|
|
346
|
+
duration: 500,
|
|
347
|
+
delay: 0,
|
|
348
|
+
easing: "ease",
|
|
349
|
+
origin: "center"
|
|
350
|
+
};
|
|
351
|
+
if (!anim || anim.mode !== "preset" || anim.entrance === "none") {
|
|
352
|
+
return defaultResult;
|
|
353
|
+
}
|
|
354
|
+
const duration = anim.entranceDuration ?? 500;
|
|
355
|
+
const delay = anim.entranceDelay ?? 0;
|
|
356
|
+
const easing = EASING_CSS_MAP[anim.easing ?? "ease"] || "ease";
|
|
357
|
+
const origin = animationOriginToCSS(anim.origin);
|
|
358
|
+
const distance = anim.distance ?? 24;
|
|
359
|
+
const scaleFrom = anim.scaleFrom ?? 0.9;
|
|
360
|
+
const rotateAngle = anim.rotateAngle ?? 15;
|
|
361
|
+
const blurAmount = anim.blurAmount ?? 8;
|
|
362
|
+
const entrance = anim.entrance ?? "none";
|
|
363
|
+
let initial = {};
|
|
364
|
+
let animate = {};
|
|
365
|
+
switch (entrance) {
|
|
366
|
+
// ==================== FADE (6) ====================
|
|
367
|
+
case "fade-in":
|
|
368
|
+
initial = { opacity: 0 };
|
|
369
|
+
animate = { opacity: 1 };
|
|
370
|
+
break;
|
|
371
|
+
case "fade-up":
|
|
372
|
+
initial = { opacity: 0, transform: `translateY(${distance}px)` };
|
|
373
|
+
animate = { opacity: 1, transform: "translateY(0)" };
|
|
374
|
+
break;
|
|
375
|
+
case "fade-down":
|
|
376
|
+
initial = { opacity: 0, transform: `translateY(-${distance}px)` };
|
|
377
|
+
animate = { opacity: 1, transform: "translateY(0)" };
|
|
378
|
+
break;
|
|
379
|
+
case "fade-left":
|
|
380
|
+
initial = { opacity: 0, transform: `translateX(${distance}px)` };
|
|
381
|
+
animate = { opacity: 1, transform: "translateX(0)" };
|
|
382
|
+
break;
|
|
383
|
+
case "fade-right":
|
|
384
|
+
initial = { opacity: 0, transform: `translateX(-${distance}px)` };
|
|
385
|
+
animate = { opacity: 1, transform: "translateX(0)" };
|
|
386
|
+
break;
|
|
387
|
+
case "fade-scale":
|
|
388
|
+
initial = { opacity: 0, transform: `scale(${scaleFrom})` };
|
|
389
|
+
animate = { opacity: 1, transform: "scale(1)" };
|
|
390
|
+
break;
|
|
391
|
+
// ==================== SCALE (4) ====================
|
|
392
|
+
case "scale-in":
|
|
393
|
+
initial = { opacity: 0, transform: `scale(${scaleFrom})` };
|
|
394
|
+
animate = { opacity: 1, transform: "scale(1)" };
|
|
395
|
+
break;
|
|
396
|
+
case "scale-up":
|
|
397
|
+
initial = { opacity: 0, transform: `scale(${scaleFrom}) translateY(${distance}px)` };
|
|
398
|
+
animate = { opacity: 1, transform: "scale(1) translateY(0)" };
|
|
399
|
+
break;
|
|
400
|
+
case "scale-down":
|
|
401
|
+
initial = { opacity: 0, transform: `scale(${scaleFrom}) translateY(-${distance}px)` };
|
|
402
|
+
animate = { opacity: 1, transform: "scale(1) translateY(0)" };
|
|
403
|
+
break;
|
|
404
|
+
case "scale-out":
|
|
405
|
+
initial = { opacity: 0, transform: `scale(${2 - scaleFrom})` };
|
|
406
|
+
animate = { opacity: 1, transform: "scale(1)" };
|
|
407
|
+
break;
|
|
408
|
+
// ==================== SLIDE (4) ====================
|
|
409
|
+
case "slide-up":
|
|
410
|
+
initial = { transform: `translateY(${distance}px)` };
|
|
411
|
+
animate = { transform: "translateY(0)" };
|
|
412
|
+
break;
|
|
413
|
+
case "slide-down":
|
|
414
|
+
initial = { transform: `translateY(-${distance}px)` };
|
|
415
|
+
animate = { transform: "translateY(0)" };
|
|
416
|
+
break;
|
|
417
|
+
case "slide-left":
|
|
418
|
+
initial = { transform: `translateX(${distance}px)` };
|
|
419
|
+
animate = { transform: "translateX(0)" };
|
|
420
|
+
break;
|
|
421
|
+
case "slide-right":
|
|
422
|
+
initial = { transform: `translateX(-${distance}px)` };
|
|
423
|
+
animate = { transform: "translateX(0)" };
|
|
424
|
+
break;
|
|
425
|
+
// ==================== BLUR (3) ====================
|
|
426
|
+
case "blur-in":
|
|
427
|
+
initial = { opacity: 0, filter: `blur(${blurAmount}px)` };
|
|
428
|
+
animate = { opacity: 1, filter: "blur(0)" };
|
|
429
|
+
break;
|
|
430
|
+
case "blur-up":
|
|
431
|
+
initial = { opacity: 0, filter: `blur(${blurAmount}px)`, transform: `translateY(${distance}px)` };
|
|
432
|
+
animate = { opacity: 1, filter: "blur(0)", transform: "translateY(0)" };
|
|
433
|
+
break;
|
|
434
|
+
case "blur-down":
|
|
435
|
+
initial = { opacity: 0, filter: `blur(${blurAmount}px)`, transform: `translateY(-${distance}px)` };
|
|
436
|
+
animate = { opacity: 1, filter: "blur(0)", transform: "translateY(0)" };
|
|
437
|
+
break;
|
|
438
|
+
// ==================== ROTATE (3) ====================
|
|
439
|
+
case "rotate-in":
|
|
440
|
+
initial = { opacity: 0, transform: `rotate(${rotateAngle}deg) scale(${scaleFrom})` };
|
|
441
|
+
animate = { opacity: 1, transform: "rotate(0) scale(1)" };
|
|
442
|
+
break;
|
|
443
|
+
case "rotate-up":
|
|
444
|
+
initial = { opacity: 0, transform: `rotate(${rotateAngle}deg) translateY(${distance}px)` };
|
|
445
|
+
animate = { opacity: 1, transform: "rotate(0) translateY(0)" };
|
|
446
|
+
break;
|
|
447
|
+
case "rotate-down":
|
|
448
|
+
initial = { opacity: 0, transform: `rotate(-${rotateAngle}deg) translateY(-${distance}px)` };
|
|
449
|
+
animate = { opacity: 1, transform: "rotate(0) translateY(0)" };
|
|
450
|
+
break;
|
|
451
|
+
// ==================== BOUNCE (3) ====================
|
|
452
|
+
// These use spring/bounce easing by default for the effect
|
|
453
|
+
case "bounce-in":
|
|
454
|
+
initial = { opacity: 0, transform: `scale(${scaleFrom * 0.8})` };
|
|
455
|
+
animate = { opacity: 1, transform: "scale(1)" };
|
|
456
|
+
break;
|
|
457
|
+
case "bounce-up":
|
|
458
|
+
initial = { opacity: 0, transform: `translateY(${distance * 1.5}px)` };
|
|
459
|
+
animate = { opacity: 1, transform: "translateY(0)" };
|
|
460
|
+
break;
|
|
461
|
+
case "bounce-down":
|
|
462
|
+
initial = { opacity: 0, transform: `translateY(-${distance * 1.5}px)` };
|
|
463
|
+
animate = { opacity: 1, transform: "translateY(0)" };
|
|
464
|
+
break;
|
|
465
|
+
// ==================== FLIP (2) ====================
|
|
466
|
+
// Flip uses perspective in transform for proper 3D effect
|
|
467
|
+
// Starts from -90deg (tilted back) so the flip motion is visible
|
|
468
|
+
case "flip-x":
|
|
469
|
+
initial = {
|
|
470
|
+
transform: "perspective(1000px) rotateX(-90deg)",
|
|
471
|
+
opacity: 0.2,
|
|
472
|
+
backfaceVisibility: "hidden"
|
|
473
|
+
};
|
|
474
|
+
animate = {
|
|
475
|
+
transform: "perspective(1000px) rotateX(0deg)",
|
|
476
|
+
opacity: 1,
|
|
477
|
+
backfaceVisibility: "hidden"
|
|
478
|
+
};
|
|
479
|
+
break;
|
|
480
|
+
case "flip-y":
|
|
481
|
+
initial = {
|
|
482
|
+
transform: "perspective(1000px) rotateY(-90deg)",
|
|
483
|
+
opacity: 0.2,
|
|
484
|
+
backfaceVisibility: "hidden"
|
|
485
|
+
};
|
|
486
|
+
animate = {
|
|
487
|
+
transform: "perspective(1000px) rotateY(0deg)",
|
|
488
|
+
opacity: 1,
|
|
489
|
+
backfaceVisibility: "hidden"
|
|
490
|
+
};
|
|
491
|
+
break;
|
|
492
|
+
// ==================== ZOOM (2) ====================
|
|
493
|
+
case "zoom-in":
|
|
494
|
+
initial = { opacity: 0, transform: `scale(${scaleFrom * 0.5})` };
|
|
495
|
+
animate = { opacity: 1, transform: "scale(1)" };
|
|
496
|
+
break;
|
|
497
|
+
case "zoom-out":
|
|
498
|
+
initial = { opacity: 0, transform: `scale(${2.5 - scaleFrom})` };
|
|
499
|
+
animate = { opacity: 1, transform: "scale(1)" };
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
initial,
|
|
504
|
+
animate,
|
|
505
|
+
duration,
|
|
506
|
+
delay,
|
|
507
|
+
easing,
|
|
508
|
+
origin
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
function useScrollAnimation(options = {}) {
|
|
512
|
+
const {
|
|
513
|
+
triggerOnScroll = true,
|
|
514
|
+
threshold = 0.1,
|
|
515
|
+
once = true,
|
|
516
|
+
rootMargin = "0px",
|
|
517
|
+
delay = 0
|
|
518
|
+
} = options;
|
|
519
|
+
const ref = react.useRef(null);
|
|
520
|
+
const [isInView, setIsInView] = react.useState(false);
|
|
521
|
+
const [hasAnimated, setHasAnimated] = react.useState(false);
|
|
522
|
+
const timeoutRef = react.useRef(null);
|
|
523
|
+
const hasMountedRef = react.useRef(false);
|
|
524
|
+
const reset = react.useCallback(() => {
|
|
525
|
+
setIsInView(false);
|
|
526
|
+
setHasAnimated(false);
|
|
527
|
+
hasMountedRef.current = false;
|
|
528
|
+
if (timeoutRef.current) {
|
|
529
|
+
clearTimeout(timeoutRef.current);
|
|
530
|
+
timeoutRef.current = null;
|
|
531
|
+
}
|
|
532
|
+
}, []);
|
|
533
|
+
react.useEffect(() => {
|
|
534
|
+
if (!triggerOnScroll) {
|
|
535
|
+
if (hasMountedRef.current) return;
|
|
536
|
+
hasMountedRef.current = true;
|
|
537
|
+
requestAnimationFrame(() => {
|
|
538
|
+
requestAnimationFrame(() => {
|
|
539
|
+
if (delay > 0) {
|
|
540
|
+
timeoutRef.current = setTimeout(() => {
|
|
541
|
+
setIsInView(true);
|
|
542
|
+
setHasAnimated(true);
|
|
543
|
+
}, delay);
|
|
544
|
+
} else {
|
|
545
|
+
setIsInView(true);
|
|
546
|
+
setHasAnimated(true);
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
if (once && hasAnimated) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const element = ref.current;
|
|
556
|
+
if (!element) return;
|
|
557
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
558
|
+
setIsInView(true);
|
|
559
|
+
setHasAnimated(true);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const observer = new IntersectionObserver(
|
|
563
|
+
(entries) => {
|
|
564
|
+
const [entry] = entries;
|
|
565
|
+
const inView = entry.isIntersecting;
|
|
566
|
+
if (inView) {
|
|
567
|
+
if (delay > 0) {
|
|
568
|
+
timeoutRef.current = setTimeout(() => {
|
|
569
|
+
setIsInView(true);
|
|
570
|
+
setHasAnimated(true);
|
|
571
|
+
}, delay);
|
|
572
|
+
} else {
|
|
573
|
+
setIsInView(true);
|
|
574
|
+
setHasAnimated(true);
|
|
575
|
+
}
|
|
576
|
+
if (once) {
|
|
577
|
+
observer.disconnect();
|
|
578
|
+
}
|
|
579
|
+
} else if (!once) {
|
|
580
|
+
if (timeoutRef.current) {
|
|
581
|
+
clearTimeout(timeoutRef.current);
|
|
582
|
+
timeoutRef.current = null;
|
|
583
|
+
}
|
|
584
|
+
setIsInView(false);
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
threshold,
|
|
589
|
+
rootMargin
|
|
590
|
+
}
|
|
591
|
+
);
|
|
592
|
+
observer.observe(element);
|
|
593
|
+
return () => {
|
|
594
|
+
observer.disconnect();
|
|
595
|
+
if (timeoutRef.current) {
|
|
596
|
+
clearTimeout(timeoutRef.current);
|
|
597
|
+
timeoutRef.current = null;
|
|
598
|
+
}
|
|
599
|
+
};
|
|
600
|
+
}, [triggerOnScroll, threshold, once, rootMargin, delay, hasAnimated]);
|
|
601
|
+
return {
|
|
602
|
+
ref,
|
|
603
|
+
isInView,
|
|
604
|
+
hasAnimated,
|
|
605
|
+
reset
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function AnimatedWrapper({
|
|
609
|
+
animation,
|
|
610
|
+
children,
|
|
611
|
+
className,
|
|
612
|
+
style,
|
|
613
|
+
as: Component = "div"
|
|
614
|
+
}) {
|
|
615
|
+
const hasAnimation = animation && (animation.mode === "preset" && animation.entrance && animation.entrance !== "none" || animation.mode === "custom");
|
|
616
|
+
if (!hasAnimation) {
|
|
617
|
+
if (className || style) {
|
|
618
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { className, style, children });
|
|
619
|
+
}
|
|
620
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
621
|
+
}
|
|
622
|
+
const { ref, isInView } = useScrollAnimation({
|
|
623
|
+
triggerOnScroll: animation.triggerOnScroll ?? true,
|
|
624
|
+
threshold: animation.triggerThreshold ?? 0.1,
|
|
625
|
+
once: animation.triggerOnce ?? true,
|
|
626
|
+
rootMargin: animation.triggerMargin
|
|
627
|
+
});
|
|
628
|
+
if (animation.mode === "preset") {
|
|
629
|
+
const { initial, animate, duration, delay, easing, origin } = getEntranceAnimationStyles(animation);
|
|
630
|
+
const animationStyles = isInView ? animate : initial;
|
|
631
|
+
const transitionProperties = [
|
|
632
|
+
`opacity ${duration}ms ${easing} ${delay}ms`,
|
|
633
|
+
`transform ${duration}ms ${easing} ${delay}ms`,
|
|
634
|
+
`filter ${duration}ms ${easing} ${delay}ms`
|
|
635
|
+
].join(", ");
|
|
636
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
637
|
+
Component,
|
|
638
|
+
{
|
|
639
|
+
ref,
|
|
640
|
+
className,
|
|
641
|
+
style: {
|
|
642
|
+
...style,
|
|
643
|
+
...animationStyles,
|
|
644
|
+
transition: transitionProperties,
|
|
645
|
+
transformOrigin: origin
|
|
646
|
+
},
|
|
647
|
+
children
|
|
648
|
+
}
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
const customStyles = animationValueToCSS(animation);
|
|
652
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
653
|
+
Component,
|
|
654
|
+
{
|
|
655
|
+
ref,
|
|
656
|
+
className,
|
|
657
|
+
style: {
|
|
658
|
+
...style,
|
|
659
|
+
...customStyles,
|
|
660
|
+
// Apply opacity for visibility-based transitions
|
|
661
|
+
opacity: isInView ? 1 : 0
|
|
662
|
+
},
|
|
663
|
+
children
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
function AccordionItem({
|
|
668
|
+
item,
|
|
669
|
+
isOpen,
|
|
670
|
+
onToggle,
|
|
671
|
+
textColorCSS
|
|
672
|
+
}) {
|
|
673
|
+
const textStyle = textColorCSS ? { color: textColorCSS } : {};
|
|
674
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border last:border-b-0", children: [
|
|
675
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
676
|
+
"button",
|
|
677
|
+
{
|
|
678
|
+
type: "button",
|
|
679
|
+
onClick: onToggle,
|
|
680
|
+
className: "flex w-full items-center justify-between py-4 px-4 text-left font-medium transition-all hover:bg-muted/50 text-foreground",
|
|
681
|
+
style: textStyle,
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title }),
|
|
684
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
685
|
+
iconsReact.IconChevronDown,
|
|
686
|
+
{
|
|
687
|
+
className: cn(
|
|
688
|
+
"h-4 w-4 shrink-0 transition-transform duration-200",
|
|
689
|
+
isOpen && "rotate-180"
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
"div",
|
|
698
|
+
{
|
|
699
|
+
className: cn(
|
|
700
|
+
"overflow-hidden transition-all duration-200",
|
|
701
|
+
isOpen ? "max-h-[1000px] opacity-100" : "max-h-0 opacity-0"
|
|
702
|
+
),
|
|
703
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
704
|
+
"div",
|
|
705
|
+
{
|
|
706
|
+
className: "px-4 pb-4 text-muted-foreground",
|
|
707
|
+
style: textColorCSS ? { color: textColorCSS } : void 0,
|
|
708
|
+
children: item.content
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
] });
|
|
714
|
+
}
|
|
715
|
+
function AccordionClient({
|
|
716
|
+
items,
|
|
717
|
+
allowMultiple,
|
|
718
|
+
textColor,
|
|
719
|
+
margin,
|
|
720
|
+
background,
|
|
721
|
+
dimensions,
|
|
722
|
+
transform,
|
|
723
|
+
animation,
|
|
724
|
+
customPadding
|
|
725
|
+
}) {
|
|
726
|
+
const [openItems, setOpenItems] = react.useState(() => {
|
|
727
|
+
const initialOpen = /* @__PURE__ */ new Set();
|
|
728
|
+
items?.forEach((item, index) => {
|
|
729
|
+
if (item.defaultOpen) {
|
|
730
|
+
initialOpen.add(index);
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
return initialOpen;
|
|
734
|
+
});
|
|
735
|
+
const handleToggle = (index) => {
|
|
736
|
+
setOpenItems((prev) => {
|
|
737
|
+
const newSet = new Set(prev);
|
|
738
|
+
if (newSet.has(index)) {
|
|
739
|
+
newSet.delete(index);
|
|
740
|
+
} else {
|
|
741
|
+
if (!allowMultiple) {
|
|
742
|
+
newSet.clear();
|
|
743
|
+
}
|
|
744
|
+
newSet.add(index);
|
|
745
|
+
}
|
|
746
|
+
return newSet;
|
|
747
|
+
});
|
|
748
|
+
};
|
|
749
|
+
const textColorCSS = colorValueToCSS(textColor);
|
|
750
|
+
const dimensionsStyles = dimensionsValueToCSS(dimensions);
|
|
751
|
+
const accordionClasses = "rounded-lg border border-border overflow-hidden bg-card";
|
|
752
|
+
const backgroundStyles = backgroundValueToCSS(background);
|
|
753
|
+
const accordionStyle = backgroundStyles && Object.keys(backgroundStyles).length > 0 ? backgroundStyles : {};
|
|
754
|
+
const style = {
|
|
755
|
+
...dimensionsStyles
|
|
756
|
+
};
|
|
757
|
+
const marginCSS = marginValueToCSS(margin);
|
|
758
|
+
if (marginCSS) {
|
|
759
|
+
style.margin = marginCSS;
|
|
760
|
+
}
|
|
761
|
+
const paddingCSS = paddingValueToCSS(customPadding);
|
|
762
|
+
if (paddingCSS) {
|
|
763
|
+
style.padding = paddingCSS;
|
|
764
|
+
}
|
|
765
|
+
const transformStyles = transformValueToCSS(transform);
|
|
766
|
+
if (transformStyles) {
|
|
767
|
+
Object.assign(style, transformStyles);
|
|
768
|
+
}
|
|
769
|
+
if (!items || items.length === 0) {
|
|
770
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: accordionClasses, style: accordionStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-muted-foreground", children: "No accordion items. Add items in the editor." }) }) }) });
|
|
771
|
+
}
|
|
772
|
+
return /* @__PURE__ */ jsxRuntime.jsx(AnimatedWrapper, { animation, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4", style: Object.keys(style).length > 0 ? style : void 0, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: accordionClasses, style: accordionStyle, children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
773
|
+
AccordionItem,
|
|
774
|
+
{
|
|
775
|
+
item,
|
|
776
|
+
isOpen: openItems.has(index),
|
|
777
|
+
onToggle: () => handleToggle(index),
|
|
778
|
+
textColorCSS
|
|
779
|
+
},
|
|
780
|
+
index
|
|
781
|
+
)) }) }) });
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
exports.AccordionClient = AccordionClient;
|
|
785
|
+
//# sourceMappingURL=AccordionClient.js.map
|
|
786
|
+
//# sourceMappingURL=AccordionClient.js.map
|