@fluid-app/rep-widgets 0.1.6 → 0.1.8

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.
Files changed (34) hide show
  1. package/dist/{ChartWidget-RTTBCUP5.cjs → ChartWidget-ETZEURVU.cjs} +5 -5
  2. package/dist/{ChartWidget-RTTBCUP5.cjs.map → ChartWidget-ETZEURVU.cjs.map} +1 -1
  3. package/dist/{ChartWidget-QAVE4MR6.js → ChartWidget-QTYGMAEV.js} +3 -3
  4. package/dist/{ChartWidget-QAVE4MR6.js.map → ChartWidget-QTYGMAEV.js.map} +1 -1
  5. package/dist/{ListWidget-FCMXJE5M.cjs → ListWidget-7HUFB5JZ.cjs} +5 -5
  6. package/dist/{ListWidget-FCMXJE5M.cjs.map → ListWidget-7HUFB5JZ.cjs.map} +1 -1
  7. package/dist/ListWidget-I7I7FAW5.js +6 -0
  8. package/dist/{ListWidget-EN2V55JJ.js.map → ListWidget-I7I7FAW5.js.map} +1 -1
  9. package/dist/{TableWidget-APVKJ225.js → TableWidget-VMPYQU7I.js} +3 -3
  10. package/dist/{TableWidget-APVKJ225.js.map → TableWidget-VMPYQU7I.js.map} +1 -1
  11. package/dist/{TableWidget-DXXVKRNC.cjs → TableWidget-ZX5A4IFW.cjs} +5 -5
  12. package/dist/{TableWidget-DXXVKRNC.cjs.map → TableWidget-ZX5A4IFW.cjs.map} +1 -1
  13. package/dist/{chunk-RHJWWSDK.js → chunk-7B5RPA6J.js} +26 -21
  14. package/dist/chunk-7B5RPA6J.js.map +1 -0
  15. package/dist/{chunk-RPVMJLTN.cjs → chunk-BZQW7APC.cjs} +457 -422
  16. package/dist/chunk-BZQW7APC.cjs.map +1 -0
  17. package/dist/{chunk-JDIYHCWU.cjs → chunk-MUFXAD45.cjs} +26 -21
  18. package/dist/chunk-MUFXAD45.cjs.map +1 -0
  19. package/dist/{chunk-ZCVNDXQ5.js → chunk-NYL2AQJ2.js} +5 -5
  20. package/dist/chunk-NYL2AQJ2.js.map +1 -0
  21. package/dist/{chunk-IDKYJ6OT.cjs → chunk-PHI5YY5E.cjs} +5 -5
  22. package/dist/chunk-PHI5YY5E.cjs.map +1 -0
  23. package/dist/{chunk-3KJRYFS7.js → chunk-Y657NN2D.js} +457 -422
  24. package/dist/chunk-Y657NN2D.js.map +1 -0
  25. package/dist/widgets/index.cjs +12 -12
  26. package/dist/widgets/index.js +6 -6
  27. package/package.json +3 -3
  28. package/dist/ListWidget-EN2V55JJ.js +0 -6
  29. package/dist/chunk-3KJRYFS7.js.map +0 -1
  30. package/dist/chunk-IDKYJ6OT.cjs.map +0 -1
  31. package/dist/chunk-JDIYHCWU.cjs.map +0 -1
  32. package/dist/chunk-RHJWWSDK.js.map +0 -1
  33. package/dist/chunk-RPVMJLTN.cjs.map +0 -1
  34. package/dist/chunk-ZCVNDXQ5.js.map +0 -1
@@ -1,31 +1,66 @@
1
1
  import { MediaRenderer } from './chunk-T6BC5TUS.js';
2
2
  import { ScrollArrows } from './chunk-FKDPFJHH.js';
3
3
  import { getFontSizeField, getColorField, getPaddingField, getBorderRadiusField, getGapField, gapValues } from './chunk-ZS7C474P.js';
4
- import { useRef } from 'react';
5
4
  import { jsxs, jsx } from 'react/jsx-runtime';
5
+ import { useRef } from 'react';
6
6
 
7
- var DEFAULT_ITEMS = [];
8
- var SCROLL_ITEM_WIDTH = 300;
9
- var getImageUrl = (item) => {
10
- return item.imageUrl || item.image;
11
- };
12
- function getFeaturedAssetUrl(value) {
13
- if (!value) return void 0;
14
- if (typeof value === "string") {
15
- const isVideo = /\.(mp4|webm|ogg|mov)$/i.test(value);
16
- return { url: value, isVideo };
17
- }
18
- if (typeof value === "object") {
19
- const videoUrl = value.videoUrl || value.video_url || value.url;
20
- if (videoUrl && /\.(mp4|webm|ogg|mov)$/i.test(videoUrl)) {
21
- return { url: videoUrl, isVideo: true };
22
- }
23
- const imageUrl = value.imageUrl || value.image_url || value.url;
24
- if (imageUrl) {
25
- return { url: imageUrl, isVideo: false };
7
+ function FeaturedSection({
8
+ borderRadius,
9
+ titleSize,
10
+ featuredTitle,
11
+ featuredSubtitle,
12
+ featuredButtonText,
13
+ featuredButtonUrl,
14
+ featuredSubtitleColor,
15
+ featuredSubtitleSize,
16
+ asset
17
+ }) {
18
+ return /* @__PURE__ */ jsxs(
19
+ "div",
20
+ {
21
+ className: `relative h-full min-h-[300px] w-full overflow-hidden rounded-${borderRadius}`,
22
+ children: [
23
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 h-full w-full", children: /* @__PURE__ */ jsx(
24
+ MediaRenderer,
25
+ {
26
+ src: asset.url,
27
+ mediaType: asset.isVideo ? "video" : "image",
28
+ alt: featuredTitle || "Featured",
29
+ objectFit: "cover",
30
+ autoplay: asset.isVideo,
31
+ loop: asset.isVideo,
32
+ muted: asset.isVideo,
33
+ controls: false
34
+ }
35
+ ) }),
36
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/40" }),
37
+ /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex flex-col items-start justify-end p-8", children: [
38
+ featuredTitle && /* @__PURE__ */ jsx(
39
+ "h3",
40
+ {
41
+ className: `mb-2 font-bold text-white text-${titleSize === "md" ? "base" : titleSize}`,
42
+ children: featuredTitle
43
+ }
44
+ ),
45
+ featuredSubtitle && /* @__PURE__ */ jsx(
46
+ "p",
47
+ {
48
+ className: `mb-4 text-${featuredSubtitleColor} text-${featuredSubtitleSize === "md" ? "base" : featuredSubtitleSize}`,
49
+ children: featuredSubtitle
50
+ }
51
+ ),
52
+ featuredButtonText && /* @__PURE__ */ jsx(
53
+ "a",
54
+ {
55
+ href: featuredButtonUrl || "#",
56
+ className: `bg-white px-6 py-2 font-medium text-foreground transition-opacity hover:opacity-90 rounded-${borderRadius}`,
57
+ children: featuredButtonText
58
+ }
59
+ )
60
+ ] })
61
+ ]
26
62
  }
27
- }
28
- return void 0;
63
+ );
29
64
  }
30
65
  function getTextContent(value) {
31
66
  if (!value) return "";
@@ -58,6 +93,101 @@ function getStringValue(value) {
58
93
  }
59
94
  return "";
60
95
  }
96
+ function ListItemCardContent({
97
+ item,
98
+ padding,
99
+ itemTitleColor,
100
+ itemTitleSize,
101
+ descriptionColor,
102
+ descriptionSize,
103
+ priceColor,
104
+ priceSize,
105
+ originalPriceColor,
106
+ metaTextColor,
107
+ metaTextSize,
108
+ showMetaText
109
+ }) {
110
+ return /* @__PURE__ */ jsxs("div", { className: `p-${padding}`, children: [
111
+ item.title && /* @__PURE__ */ jsx(
112
+ "h3",
113
+ {
114
+ className: `text-${itemTitleColor} text-${itemTitleSize === "md" ? "base" : itemTitleSize} mb-1 font-semibold`,
115
+ children: getTextContent(item.title)
116
+ }
117
+ ),
118
+ item.description && /* @__PURE__ */ jsx(
119
+ "p",
120
+ {
121
+ className: `text-${descriptionColor} text-${descriptionSize === "md" ? "base" : descriptionSize} mb-2`,
122
+ children: getTextContent(item.description)
123
+ }
124
+ ),
125
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
126
+ item.price && /* @__PURE__ */ jsx(
127
+ "span",
128
+ {
129
+ className: `text-${priceColor} text-${priceSize === "md" ? "base" : priceSize} font-bold`,
130
+ children: getStringValue(item.price)
131
+ }
132
+ ),
133
+ item.originalPrice && /* @__PURE__ */ jsx(
134
+ "span",
135
+ {
136
+ className: `text-${originalPriceColor} text-${descriptionSize === "md" ? "base" : descriptionSize} line-through`,
137
+ children: getStringValue(item.originalPrice)
138
+ }
139
+ )
140
+ ] }),
141
+ showMetaText && (item.qv || item.cv) && /* @__PURE__ */ jsxs(
142
+ "div",
143
+ {
144
+ className: `mt-2 flex gap-3 text-${metaTextColor} text-${metaTextSize === "md" ? "base" : metaTextSize}`,
145
+ children: [
146
+ item.qv && /* @__PURE__ */ jsxs("span", { children: [
147
+ "QV: ",
148
+ getStringValue(item.qv)
149
+ ] }),
150
+ item.cv && /* @__PURE__ */ jsxs("span", { children: [
151
+ "CV: ",
152
+ getStringValue(item.cv)
153
+ ] })
154
+ ]
155
+ }
156
+ )
157
+ ] });
158
+ }
159
+ function DiscountBadge({ discount }) {
160
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 z-10 rounded-md bg-destructive px-2 py-1 text-xs font-bold text-destructive-foreground", children: getStringValue(discount) });
161
+ }
162
+ function FavoriteButton({ className }) {
163
+ return /* @__PURE__ */ jsx(
164
+ "button",
165
+ {
166
+ className: className || "absolute top-2 left-2 z-10 rounded-full bg-background/80 p-2 backdrop-blur-sm transition-colors hover:bg-background",
167
+ children: /* @__PURE__ */ jsx(
168
+ "svg",
169
+ {
170
+ className: "h-5 w-5 text-muted-foreground",
171
+ fill: "none",
172
+ stroke: "currentColor",
173
+ viewBox: "0 0 24 24",
174
+ children: /* @__PURE__ */ jsx(
175
+ "path",
176
+ {
177
+ strokeLinecap: "round",
178
+ strokeLinejoin: "round",
179
+ strokeWidth: 2,
180
+ d: "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"
181
+ }
182
+ )
183
+ }
184
+ )
185
+ }
186
+ );
187
+ }
188
+ var getImageUrl = (item) => {
189
+ return item.imageUrl || item.image;
190
+ };
61
191
  var getAspectRatioClass = (ratio) => {
62
192
  const ratios = {
63
193
  square: "aspect-square",
@@ -77,6 +207,244 @@ var getResponsiveGridClass = (columns) => {
77
207
  };
78
208
  return responsiveClasses[columns] || "grid-cols-2 @lg:grid-cols-3";
79
209
  };
210
+ function UnorderedList({
211
+ items,
212
+ columns,
213
+ gap,
214
+ borderRadius,
215
+ imageAspectRatio,
216
+ showBadge,
217
+ showFavorite,
218
+ padding,
219
+ itemTitleColor,
220
+ itemTitleSize,
221
+ descriptionColor,
222
+ descriptionSize,
223
+ priceColor,
224
+ priceSize,
225
+ originalPriceColor,
226
+ metaTextColor,
227
+ metaTextSize,
228
+ showMetaText
229
+ }) {
230
+ const gridClass = getResponsiveGridClass(columns);
231
+ return /* @__PURE__ */ jsx("div", { className: `grid ${gridClass} gap-${gapValues[gap]}`, children: items.map((item) => {
232
+ const imageUrl = getImageUrl(item);
233
+ const aspectRatioClass = getAspectRatioClass(imageAspectRatio);
234
+ return /* @__PURE__ */ jsxs(
235
+ "div",
236
+ {
237
+ className: `relative rounded-${borderRadius} overflow-hidden bg-background shadow-sm transition-shadow hover:shadow-md`,
238
+ children: [
239
+ showBadge && item.discount && /* @__PURE__ */ jsx(DiscountBadge, { discount: item.discount }),
240
+ showFavorite && /* @__PURE__ */ jsx(FavoriteButton, {}),
241
+ imageUrl && /* @__PURE__ */ jsx("div", { className: `w-full ${aspectRatioClass} overflow-hidden`, children: /* @__PURE__ */ jsx(
242
+ "img",
243
+ {
244
+ src: imageUrl,
245
+ alt: item.title || "Product",
246
+ className: "h-full w-full object-cover"
247
+ }
248
+ ) }),
249
+ /* @__PURE__ */ jsx(
250
+ ListItemCardContent,
251
+ {
252
+ item,
253
+ padding,
254
+ itemTitleColor,
255
+ itemTitleSize,
256
+ descriptionColor,
257
+ descriptionSize,
258
+ priceColor,
259
+ priceSize,
260
+ originalPriceColor,
261
+ metaTextColor,
262
+ metaTextSize,
263
+ showMetaText
264
+ }
265
+ )
266
+ ]
267
+ },
268
+ item.id
269
+ );
270
+ }) });
271
+ }
272
+ var SCROLL_ITEM_WIDTH = 300;
273
+ var getImageUrl2 = (item) => {
274
+ return item.imageUrl || item.image;
275
+ };
276
+ var getAspectRatioClass2 = (ratio) => {
277
+ const ratios = {
278
+ square: "aspect-square",
279
+ landscape: "aspect-video",
280
+ portrait: "aspect-[3/4]"
281
+ };
282
+ return ratios[ratio];
283
+ };
284
+ var largeNumberSizes = {
285
+ xs: "8rem",
286
+ sm: "10rem",
287
+ md: "12rem",
288
+ lg: "14rem",
289
+ xl: "16rem",
290
+ "2xl": "20rem"
291
+ };
292
+ function OrderedList({
293
+ items,
294
+ scrollAxis,
295
+ gap,
296
+ borderRadius,
297
+ imageAspectRatio,
298
+ showBadge,
299
+ showFavorite,
300
+ padding,
301
+ itemTitleColor,
302
+ itemTitleSize,
303
+ descriptionColor,
304
+ descriptionSize,
305
+ priceColor,
306
+ priceSize,
307
+ originalPriceColor,
308
+ metaTextColor,
309
+ metaTextSize,
310
+ numberColor,
311
+ numberSize,
312
+ showMetaText
313
+ }) {
314
+ const scrollContainerRef = useRef(null);
315
+ const scrollByAmount = (direction) => {
316
+ const container = scrollContainerRef.current;
317
+ if (!container) return;
318
+ const computedGap = parseFloat(getComputedStyle(container).gap) || 0;
319
+ const scrollAmount = SCROLL_ITEM_WIDTH + computedGap;
320
+ container.scrollTo({
321
+ left: container.scrollLeft + (direction === "next" ? scrollAmount : -scrollAmount),
322
+ behavior: "smooth"
323
+ });
324
+ };
325
+ const contentProps = {
326
+ padding,
327
+ itemTitleColor,
328
+ itemTitleSize,
329
+ descriptionColor,
330
+ descriptionSize,
331
+ priceColor,
332
+ priceSize,
333
+ originalPriceColor,
334
+ metaTextColor,
335
+ metaTextSize,
336
+ showMetaText
337
+ };
338
+ if (scrollAxis === "horizontal") {
339
+ return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
340
+ /* @__PURE__ */ jsx(
341
+ "div",
342
+ {
343
+ ref: scrollContainerRef,
344
+ className: `flex gap-${gapValues[gap]} scrollbar-hide overflow-x-auto scroll-smooth`,
345
+ children: items.map((item, index) => {
346
+ const imageUrl = getImageUrl2(item);
347
+ const aspectRatioClass = getAspectRatioClass2(imageAspectRatio);
348
+ return /* @__PURE__ */ jsxs("div", { className: "relative w-[300px] flex-shrink-0", children: [
349
+ /* @__PURE__ */ jsx(
350
+ "div",
351
+ {
352
+ className: `absolute top-0 left-0 text-${numberColor} z-0 leading-none font-bold opacity-20`,
353
+ style: { fontSize: largeNumberSizes[numberSize] },
354
+ children: index + 1
355
+ }
356
+ ),
357
+ /* @__PURE__ */ jsxs(
358
+ "div",
359
+ {
360
+ className: `relative z-10 ml-20 rounded-${borderRadius} overflow-hidden bg-background shadow-sm transition-shadow hover:shadow-md`,
361
+ children: [
362
+ showBadge && item.discount && /* @__PURE__ */ jsx(DiscountBadge, { discount: item.discount }),
363
+ showFavorite && /* @__PURE__ */ jsx(FavoriteButton, {}),
364
+ imageUrl && /* @__PURE__ */ jsx(
365
+ "div",
366
+ {
367
+ className: `w-full ${aspectRatioClass} overflow-hidden`,
368
+ children: /* @__PURE__ */ jsx(
369
+ "img",
370
+ {
371
+ src: imageUrl,
372
+ alt: item.title || "Product",
373
+ className: "h-full w-full object-cover"
374
+ }
375
+ )
376
+ }
377
+ ),
378
+ /* @__PURE__ */ jsx(ListItemCardContent, { item, ...contentProps })
379
+ ]
380
+ }
381
+ )
382
+ ] }, item.id);
383
+ })
384
+ }
385
+ ),
386
+ /* @__PURE__ */ jsx("div", { className: "absolute inset-x-0 top-1/2 z-20 flex w-full -translate-y-1/2 items-center justify-between px-8", children: /* @__PURE__ */ jsx(
387
+ ScrollArrows,
388
+ {
389
+ onPrevious: () => scrollByAmount("prev"),
390
+ onNext: () => scrollByAmount("next")
391
+ }
392
+ ) })
393
+ ] });
394
+ }
395
+ if (scrollAxis === "vertical") {
396
+ return /* @__PURE__ */ jsx("div", { className: `flex flex-col gap-${gapValues[gap]}`, children: items.map((item, index) => {
397
+ const imageUrl = getImageUrl2(item);
398
+ return /* @__PURE__ */ jsxs(
399
+ "div",
400
+ {
401
+ className: `relative flex gap-${gapValues[gap]} rounded-${borderRadius} overflow-hidden bg-background shadow-sm transition-shadow hover:shadow-md ${`p-${padding}`}`,
402
+ children: [
403
+ /* @__PURE__ */ jsx(
404
+ "div",
405
+ {
406
+ className: `flex-shrink-0 text-${numberColor} text-${numberSize === "md" ? "base" : numberSize} flex w-16 items-center justify-center font-bold`,
407
+ children: index + 1
408
+ }
409
+ ),
410
+ imageUrl && /* @__PURE__ */ jsx("div", { className: "h-24 w-24 flex-shrink-0 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
411
+ "img",
412
+ {
413
+ src: imageUrl,
414
+ alt: item.title || "Product",
415
+ className: "h-full w-full object-cover"
416
+ }
417
+ ) }),
418
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx(ListItemCardContent, { item, ...contentProps }) }),
419
+ showBadge && item.discount && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 rounded-md bg-destructive px-2 py-1 text-xs font-bold text-destructive-foreground", children: getStringValue(item.discount) }),
420
+ showFavorite && /* @__PURE__ */ jsx(FavoriteButton, { className: "absolute top-2 right-12 rounded-full bg-background/80 p-2 backdrop-blur-sm transition-colors hover:bg-background" })
421
+ ]
422
+ },
423
+ item.id
424
+ );
425
+ }) });
426
+ }
427
+ return null;
428
+ }
429
+ var DEFAULT_ITEMS = [];
430
+ function getFeaturedAssetUrl(value) {
431
+ if (!value) return void 0;
432
+ if (typeof value === "string") {
433
+ const isVideo = /\.(mp4|webm|ogg|mov)$/i.test(value);
434
+ return { url: value, isVideo };
435
+ }
436
+ if (typeof value === "object") {
437
+ const videoUrl = value.videoUrl || value.video_url || value.url;
438
+ if (videoUrl && /\.(mp4|webm|ogg|mov)$/i.test(videoUrl)) {
439
+ return { url: videoUrl, isVideo: true };
440
+ }
441
+ const imageUrl = value.imageUrl || value.image_url || value.url;
442
+ if (imageUrl) {
443
+ return { url: imageUrl, isVideo: false };
444
+ }
445
+ }
446
+ return void 0;
447
+ }
80
448
  function ListWidget({
81
449
  listType = "unordered",
82
450
  scrollAxis = "horizontal",
@@ -117,403 +485,25 @@ function ListWidget({
117
485
  className,
118
486
  ...props
119
487
  }) {
120
- const scrollContainerRef = useRef(null);
121
488
  const displayItems = maxItems ? items.slice(0, maxItems) : items;
122
489
  const hasItems = displayItems.length > 0;
123
- const largeNumberSizes = {
124
- xs: "8rem",
125
- sm: "10rem",
126
- md: "12rem",
127
- lg: "14rem",
128
- xl: "16rem",
129
- "2xl": "20rem"
130
- };
131
- const scrollByAmount = (direction) => {
132
- const container = scrollContainerRef.current;
133
- if (!container) return;
134
- const computedGap = parseFloat(getComputedStyle(container).gap) || 0;
135
- const scrollAmount = SCROLL_ITEM_WIDTH + computedGap;
136
- container.scrollTo({
137
- left: container.scrollLeft + (direction === "next" ? scrollAmount : -scrollAmount),
138
- behavior: "smooth"
139
- });
140
- };
141
- const renderFeaturedSection = () => {
142
- if (!showFeaturedSection) return null;
143
- const asset = getFeaturedAssetUrl(featuredAsset);
144
- if (!asset) return null;
145
- return /* @__PURE__ */ jsxs(
146
- "div",
147
- {
148
- className: `relative h-full min-h-[300px] w-full overflow-hidden rounded-${borderRadius}`,
149
- children: [
150
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 h-full w-full", children: /* @__PURE__ */ jsx(
151
- MediaRenderer,
152
- {
153
- src: asset.url,
154
- mediaType: asset.isVideo ? "video" : "image",
155
- alt: featuredTitle || "Featured",
156
- objectFit: "cover",
157
- autoplay: asset.isVideo,
158
- loop: asset.isVideo,
159
- muted: asset.isVideo,
160
- controls: false
161
- }
162
- ) }),
163
- /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/40" }),
164
- /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex flex-col items-start justify-end p-8", children: [
165
- featuredTitle && /* @__PURE__ */ jsx(
166
- "h3",
167
- {
168
- className: `mb-2 font-bold text-white text-${titleSize === "md" ? "base" : titleSize}`,
169
- children: featuredTitle
170
- }
171
- ),
172
- featuredSubtitle && /* @__PURE__ */ jsx(
173
- "p",
174
- {
175
- className: `mb-4 text-${featuredSubtitleColor} text-${featuredSubtitleSize === "md" ? "base" : featuredSubtitleSize}`,
176
- children: featuredSubtitle
177
- }
178
- ),
179
- featuredButtonText && /* @__PURE__ */ jsx(
180
- "a",
181
- {
182
- href: featuredButtonUrl || "#",
183
- className: `bg-white px-6 py-2 font-medium text-foreground transition-opacity hover:opacity-90 rounded-${borderRadius}`,
184
- children: featuredButtonText
185
- }
186
- )
187
- ] })
188
- ]
189
- }
190
- );
191
- };
192
- const renderUnorderedList = () => {
193
- const gridClass = getResponsiveGridClass(columns);
194
- return /* @__PURE__ */ jsx("div", { className: `grid ${gridClass} gap-${gapValues[gap]}`, children: displayItems.map((item) => {
195
- const imageUrl = getImageUrl(item);
196
- const aspectRatioClass = getAspectRatioClass(imageAspectRatio);
197
- return /* @__PURE__ */ jsxs(
198
- "div",
199
- {
200
- className: `relative rounded-${borderRadius} overflow-hidden bg-background shadow-sm transition-shadow hover:shadow-md`,
201
- children: [
202
- showBadge && item.discount && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 z-10 rounded-md bg-destructive px-2 py-1 text-xs font-bold text-destructive-foreground", children: getStringValue(item.discount) }),
203
- showFavorite && /* @__PURE__ */ jsx("button", { className: "absolute top-2 left-2 z-10 rounded-full bg-background/80 p-2 backdrop-blur-sm transition-colors hover:bg-background", children: /* @__PURE__ */ jsx(
204
- "svg",
205
- {
206
- className: "h-5 w-5 text-muted-foreground",
207
- fill: "none",
208
- stroke: "currentColor",
209
- viewBox: "0 0 24 24",
210
- children: /* @__PURE__ */ jsx(
211
- "path",
212
- {
213
- strokeLinecap: "round",
214
- strokeLinejoin: "round",
215
- strokeWidth: 2,
216
- d: "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"
217
- }
218
- )
219
- }
220
- ) }),
221
- imageUrl && /* @__PURE__ */ jsx("div", { className: `w-full ${aspectRatioClass} overflow-hidden`, children: /* @__PURE__ */ jsx(
222
- "img",
223
- {
224
- src: imageUrl,
225
- alt: item.title || "Product",
226
- className: "h-full w-full object-cover"
227
- }
228
- ) }),
229
- /* @__PURE__ */ jsxs("div", { className: `p-${padding}`, children: [
230
- item.title && /* @__PURE__ */ jsx(
231
- "h3",
232
- {
233
- className: `text-${itemTitleColor} text-${itemTitleSize === "md" ? "base" : itemTitleSize} mb-1 font-semibold`,
234
- children: getTextContent(item.title)
235
- }
236
- ),
237
- item.description && /* @__PURE__ */ jsx(
238
- "p",
239
- {
240
- className: `text-${descriptionColor} text-${descriptionSize === "md" ? "base" : descriptionSize} mb-2`,
241
- children: getTextContent(item.description)
242
- }
243
- ),
244
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
245
- item.price && /* @__PURE__ */ jsx(
246
- "span",
247
- {
248
- className: `text-${priceColor} text-${priceSize === "md" ? "base" : priceSize} font-bold`,
249
- children: getStringValue(item.price)
250
- }
251
- ),
252
- item.originalPrice && /* @__PURE__ */ jsx(
253
- "span",
254
- {
255
- className: `text-${originalPriceColor} text-${descriptionSize === "md" ? "base" : descriptionSize} line-through`,
256
- children: getStringValue(item.originalPrice)
257
- }
258
- )
259
- ] }),
260
- showMetaText && (item.qv || item.cv) && /* @__PURE__ */ jsxs(
261
- "div",
262
- {
263
- className: `mt-2 flex gap-3 text-${metaTextColor} text-${metaTextSize === "md" ? "base" : metaTextSize}`,
264
- children: [
265
- item.qv && /* @__PURE__ */ jsxs("span", { children: [
266
- "QV: ",
267
- getStringValue(item.qv)
268
- ] }),
269
- item.cv && /* @__PURE__ */ jsxs("span", { children: [
270
- "CV: ",
271
- getStringValue(item.cv)
272
- ] })
273
- ]
274
- }
275
- )
276
- ] })
277
- ]
278
- },
279
- item.id
280
- );
281
- }) });
282
- };
283
- const renderOrderedList = () => {
284
- const isHorizontal = scrollAxis === "horizontal";
285
- const isVertical = scrollAxis === "vertical";
286
- if (isHorizontal) {
287
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
288
- /* @__PURE__ */ jsx(
289
- "div",
290
- {
291
- ref: scrollContainerRef,
292
- className: `flex gap-${gapValues[gap]} scrollbar-hide overflow-x-auto scroll-smooth`,
293
- children: displayItems.map((item, index) => {
294
- const imageUrl = getImageUrl(item);
295
- const aspectRatioClass = getAspectRatioClass(imageAspectRatio);
296
- return /* @__PURE__ */ jsxs(
297
- "div",
298
- {
299
- className: `relative w-[300px] flex-shrink-0`,
300
- children: [
301
- /* @__PURE__ */ jsx(
302
- "div",
303
- {
304
- className: `absolute top-0 left-0 text-${numberColor} z-0 leading-none font-bold opacity-20`,
305
- style: { fontSize: largeNumberSizes[numberSize] },
306
- children: index + 1
307
- }
308
- ),
309
- /* @__PURE__ */ jsxs(
310
- "div",
311
- {
312
- className: `relative z-10 ml-20 rounded-${borderRadius} overflow-hidden bg-background shadow-sm transition-shadow hover:shadow-md`,
313
- children: [
314
- showBadge && item.discount && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 z-10 rounded-md bg-destructive px-2 py-1 text-xs font-bold text-destructive-foreground", children: getStringValue(item.discount) }),
315
- showFavorite && /* @__PURE__ */ jsx("button", { className: "absolute top-2 left-2 z-10 rounded-full bg-background/80 p-2 backdrop-blur-sm transition-colors hover:bg-background", children: /* @__PURE__ */ jsx(
316
- "svg",
317
- {
318
- className: "h-5 w-5 text-muted-foreground",
319
- fill: "none",
320
- stroke: "currentColor",
321
- viewBox: "0 0 24 24",
322
- children: /* @__PURE__ */ jsx(
323
- "path",
324
- {
325
- strokeLinecap: "round",
326
- strokeLinejoin: "round",
327
- strokeWidth: 2,
328
- d: "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"
329
- }
330
- )
331
- }
332
- ) }),
333
- imageUrl && /* @__PURE__ */ jsx(
334
- "div",
335
- {
336
- className: `w-full ${aspectRatioClass} overflow-hidden`,
337
- children: /* @__PURE__ */ jsx(
338
- "img",
339
- {
340
- src: imageUrl,
341
- alt: item.title || "Product",
342
- className: "h-full w-full object-cover"
343
- }
344
- )
345
- }
346
- ),
347
- /* @__PURE__ */ jsxs("div", { className: `p-${padding}`, children: [
348
- item.title && /* @__PURE__ */ jsx(
349
- "h3",
350
- {
351
- className: `text-${itemTitleColor} text-${itemTitleSize === "md" ? "base" : itemTitleSize} mb-1 font-semibold`,
352
- children: getTextContent(item.title)
353
- }
354
- ),
355
- item.description && /* @__PURE__ */ jsx(
356
- "p",
357
- {
358
- className: `text-${descriptionColor} text-${descriptionSize === "md" ? "base" : descriptionSize} mb-2`,
359
- children: getTextContent(item.description)
360
- }
361
- ),
362
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
363
- item.price && /* @__PURE__ */ jsx(
364
- "span",
365
- {
366
- className: `text-${priceColor} text-${priceSize === "md" ? "base" : priceSize} font-bold`,
367
- children: getStringValue(item.price)
368
- }
369
- ),
370
- item.originalPrice && /* @__PURE__ */ jsx(
371
- "span",
372
- {
373
- className: `text-${originalPriceColor} text-${descriptionSize === "md" ? "base" : descriptionSize} line-through`,
374
- children: getStringValue(item.originalPrice)
375
- }
376
- )
377
- ] }),
378
- showMetaText && (item.qv || item.cv) && /* @__PURE__ */ jsxs(
379
- "div",
380
- {
381
- className: `mt-2 flex gap-3 text-${metaTextColor} text-${metaTextSize === "md" ? "base" : metaTextSize}`,
382
- children: [
383
- item.qv && /* @__PURE__ */ jsxs("span", { children: [
384
- "QV: ",
385
- getStringValue(item.qv)
386
- ] }),
387
- item.cv && /* @__PURE__ */ jsxs("span", { children: [
388
- "CV: ",
389
- getStringValue(item.cv)
390
- ] })
391
- ]
392
- }
393
- )
394
- ] })
395
- ]
396
- }
397
- )
398
- ]
399
- },
400
- item.id
401
- );
402
- })
403
- }
404
- ),
405
- /* @__PURE__ */ jsx(
406
- "div",
407
- {
408
- className: `absolute inset-x-0 top-1/2 z-20 flex w-full -translate-y-1/2 items-center justify-between px-8`,
409
- children: /* @__PURE__ */ jsx(
410
- ScrollArrows,
411
- {
412
- onPrevious: () => scrollByAmount("prev"),
413
- onNext: () => scrollByAmount("next")
414
- }
415
- )
416
- }
417
- )
418
- ] });
419
- }
420
- if (isVertical) {
421
- return /* @__PURE__ */ jsx("div", { className: `flex flex-col gap-${gapValues[gap]}`, children: displayItems.map((item, index) => {
422
- const imageUrl = getImageUrl(item);
423
- return /* @__PURE__ */ jsxs(
424
- "div",
425
- {
426
- className: `relative flex gap-${gapValues[gap]} rounded-${borderRadius} overflow-hidden bg-background shadow-sm transition-shadow hover:shadow-md ${`p-${padding}`}`,
427
- children: [
428
- /* @__PURE__ */ jsx(
429
- "div",
430
- {
431
- className: `flex-shrink-0 text-${numberColor} text-${numberSize === "md" ? "base" : numberSize} flex w-16 items-center justify-center font-bold`,
432
- children: index + 1
433
- }
434
- ),
435
- imageUrl && /* @__PURE__ */ jsx("div", { className: "h-24 w-24 flex-shrink-0 overflow-hidden rounded-md", children: /* @__PURE__ */ jsx(
436
- "img",
437
- {
438
- src: imageUrl,
439
- alt: item.title || "Product",
440
- className: "h-full w-full object-cover"
441
- }
442
- ) }),
443
- /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
444
- item.title && /* @__PURE__ */ jsx(
445
- "h3",
446
- {
447
- className: `text-${itemTitleColor} text-${itemTitleSize === "md" ? "base" : itemTitleSize} mb-1 font-semibold`,
448
- children: getTextContent(item.title)
449
- }
450
- ),
451
- item.description && /* @__PURE__ */ jsx(
452
- "p",
453
- {
454
- className: `text-${descriptionColor} text-${descriptionSize === "md" ? "base" : descriptionSize} mb-2`,
455
- children: getTextContent(item.description)
456
- }
457
- ),
458
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
459
- item.price && /* @__PURE__ */ jsx(
460
- "span",
461
- {
462
- className: `text-${priceColor} text-${priceSize === "md" ? "base" : priceSize} font-bold`,
463
- children: getStringValue(item.price)
464
- }
465
- ),
466
- item.originalPrice && /* @__PURE__ */ jsx(
467
- "span",
468
- {
469
- className: `text-${originalPriceColor} text-${descriptionSize === "md" ? "base" : descriptionSize} line-through`,
470
- children: getStringValue(item.originalPrice)
471
- }
472
- )
473
- ] }),
474
- showMetaText && (item.qv || item.cv) && /* @__PURE__ */ jsxs(
475
- "div",
476
- {
477
- className: `mt-2 flex gap-3 text-${metaTextColor} text-${metaTextSize === "md" ? "base" : metaTextSize}`,
478
- children: [
479
- item.qv && /* @__PURE__ */ jsxs("span", { children: [
480
- "QV: ",
481
- getStringValue(item.qv)
482
- ] }),
483
- item.cv && /* @__PURE__ */ jsxs("span", { children: [
484
- "CV: ",
485
- getStringValue(item.cv)
486
- ] })
487
- ]
488
- }
489
- )
490
- ] }),
491
- showBadge && item.discount && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 rounded-md bg-destructive px-2 py-1 text-xs font-bold text-destructive-foreground", children: getStringValue(item.discount) }),
492
- showFavorite && /* @__PURE__ */ jsx("button", { className: "absolute top-2 right-12 rounded-full bg-background/80 p-2 backdrop-blur-sm transition-colors hover:bg-background", children: /* @__PURE__ */ jsx(
493
- "svg",
494
- {
495
- className: "h-5 w-5 text-muted-foreground",
496
- fill: "none",
497
- stroke: "currentColor",
498
- viewBox: "0 0 24 24",
499
- children: /* @__PURE__ */ jsx(
500
- "path",
501
- {
502
- strokeLinecap: "round",
503
- strokeLinejoin: "round",
504
- strokeWidth: 2,
505
- d: "M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"
506
- }
507
- )
508
- }
509
- ) })
510
- ]
511
- },
512
- item.id
513
- );
514
- }) });
515
- }
516
- return null;
490
+ const itemStyleProps = {
491
+ padding,
492
+ itemTitleColor,
493
+ itemTitleSize,
494
+ descriptionColor,
495
+ descriptionSize,
496
+ priceColor,
497
+ priceSize,
498
+ originalPriceColor,
499
+ metaTextColor,
500
+ metaTextSize,
501
+ showMetaText,
502
+ showBadge,
503
+ showFavorite,
504
+ borderRadius,
505
+ imageAspectRatio,
506
+ gap
517
507
  };
518
508
  const hasFeaturedAsset = getFeaturedAssetUrl(featuredAsset);
519
509
  const shouldShowFeaturedSection = showFeaturedSection && hasFeaturedAsset;
@@ -534,9 +524,54 @@ function ListWidget({
534
524
  }
535
525
  ),
536
526
  !hasItems ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center rounded-md border-2 border-dashed border-border bg-muted py-12 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-muted", children: "No items to display" }) }) : shouldShowFeaturedSection ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 @lg:flex-row @lg:gap-6", children: [
537
- /* @__PURE__ */ jsx("div", { className: "w-full @lg:w-[45%]", children: renderFeaturedSection() }),
538
- /* @__PURE__ */ jsx("div", { className: "w-full @lg:w-[55%]", children: listType === "unordered" ? renderUnorderedList() : renderOrderedList() })
539
- ] }) : listType === "unordered" ? renderUnorderedList() : renderOrderedList()
527
+ /* @__PURE__ */ jsx("div", { className: "w-full @lg:w-[45%]", children: /* @__PURE__ */ jsx(
528
+ FeaturedSection,
529
+ {
530
+ borderRadius,
531
+ titleSize,
532
+ featuredTitle,
533
+ featuredSubtitle,
534
+ featuredButtonText,
535
+ featuredButtonUrl,
536
+ featuredSubtitleColor,
537
+ featuredSubtitleSize,
538
+ asset: hasFeaturedAsset
539
+ }
540
+ ) }),
541
+ /* @__PURE__ */ jsx("div", { className: "w-full @lg:w-[55%]", children: listType === "unordered" ? /* @__PURE__ */ jsx(
542
+ UnorderedList,
543
+ {
544
+ items: displayItems,
545
+ columns,
546
+ ...itemStyleProps
547
+ }
548
+ ) : /* @__PURE__ */ jsx(
549
+ OrderedList,
550
+ {
551
+ items: displayItems,
552
+ scrollAxis,
553
+ numberColor,
554
+ numberSize,
555
+ ...itemStyleProps
556
+ }
557
+ ) })
558
+ ] }) : listType === "unordered" ? /* @__PURE__ */ jsx(
559
+ UnorderedList,
560
+ {
561
+ items: displayItems,
562
+ columns,
563
+ ...itemStyleProps
564
+ }
565
+ ) : /* @__PURE__ */ jsx(
566
+ OrderedList,
567
+ {
568
+ items: displayItems,
569
+ scrollAxis,
570
+ numberColor,
571
+ numberSize,
572
+ ...itemStyleProps
573
+ }
574
+ )
540
575
  ]
541
576
  }
542
577
  );
@@ -948,5 +983,5 @@ var listWidgetPropertySchema = {
948
983
  };
949
984
 
950
985
  export { ListWidget, listWidgetPropertySchema };
951
- //# sourceMappingURL=chunk-3KJRYFS7.js.map
952
- //# sourceMappingURL=chunk-3KJRYFS7.js.map
986
+ //# sourceMappingURL=chunk-Y657NN2D.js.map
987
+ //# sourceMappingURL=chunk-Y657NN2D.js.map