@mlw-packages/react-components 1.9.12 → 1.9.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +0 -31
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +261 -223
- package/dist/index.mjs +261 -223
- package/package.json +9 -4
package/dist/index.mjs
CHANGED
|
@@ -14621,7 +14621,8 @@ var DraggableTooltipComponent = ({
|
|
|
14621
14621
|
toggleHighlight,
|
|
14622
14622
|
showOnlyHighlighted,
|
|
14623
14623
|
valueFormatter,
|
|
14624
|
-
categoryFormatter
|
|
14624
|
+
categoryFormatter,
|
|
14625
|
+
seriesTypeMap
|
|
14625
14626
|
}) => {
|
|
14626
14627
|
const visibleKeys = useMemo(
|
|
14627
14628
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
@@ -14632,7 +14633,9 @@ var DraggableTooltipComponent = ({
|
|
|
14632
14633
|
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
14633
14634
|
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
14634
14635
|
}, [data2, visibleKeys2]);
|
|
14635
|
-
const defaultTotalFormatted = total.toLocaleString("pt-BR"
|
|
14636
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR", {
|
|
14637
|
+
maximumFractionDigits: 0
|
|
14638
|
+
});
|
|
14636
14639
|
const displayTotal = localformatter ? localformatter({
|
|
14637
14640
|
value: total,
|
|
14638
14641
|
formattedValue: defaultTotalFormatted,
|
|
@@ -15087,7 +15090,13 @@ var DraggableTooltipComponent = ({
|
|
|
15087
15090
|
0
|
|
15088
15091
|
);
|
|
15089
15092
|
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
15090
|
-
const
|
|
15093
|
+
const isLine = seriesTypeMap?.[key] === "line";
|
|
15094
|
+
const defaultFormatted = isLine ? `${(val / 100).toLocaleString("pt-BR", {
|
|
15095
|
+
minimumFractionDigits: 2,
|
|
15096
|
+
maximumFractionDigits: 2
|
|
15097
|
+
})}%` : val.toLocaleString("pt-BR", {
|
|
15098
|
+
maximumFractionDigits: 0
|
|
15099
|
+
});
|
|
15091
15100
|
const displayValue = valueFormatter ? valueFormatter({
|
|
15092
15101
|
value,
|
|
15093
15102
|
formattedValue: defaultFormatted,
|
|
@@ -15142,7 +15151,7 @@ var DraggableTooltipComponent = ({
|
|
|
15142
15151
|
children: displayValue
|
|
15143
15152
|
}
|
|
15144
15153
|
),
|
|
15145
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.
|
|
15154
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toLocaleString("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}%` : "-" })
|
|
15146
15155
|
] })
|
|
15147
15156
|
] }),
|
|
15148
15157
|
/* @__PURE__ */ jsx("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
@@ -15206,7 +15215,8 @@ var RechartTooltipWithTotal = ({
|
|
|
15206
15215
|
valueFormatter,
|
|
15207
15216
|
categoryFormatter,
|
|
15208
15217
|
yAxisMap,
|
|
15209
|
-
isBiaxial = false
|
|
15218
|
+
isBiaxial = false,
|
|
15219
|
+
seriesTypeMap
|
|
15210
15220
|
}) => {
|
|
15211
15221
|
if (!active || !payload || payload.length === 0) return null;
|
|
15212
15222
|
const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
|
|
@@ -15215,18 +15225,9 @@ var RechartTooltipWithTotal = ({
|
|
|
15215
15225
|
);
|
|
15216
15226
|
const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
|
|
15217
15227
|
const isTotalNegative = total < 0;
|
|
15218
|
-
const defaultTotalFormatted = (
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
return new Intl.NumberFormat("pt-BR", {
|
|
15222
|
-
minimumFractionDigits: 2,
|
|
15223
|
-
maximumFractionDigits: 2
|
|
15224
|
-
}).format(total);
|
|
15225
|
-
}
|
|
15226
|
-
} catch {
|
|
15227
|
-
}
|
|
15228
|
-
return total.toLocaleString("pt-BR");
|
|
15229
|
-
})();
|
|
15228
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR", {
|
|
15229
|
+
maximumFractionDigits: 0
|
|
15230
|
+
});
|
|
15230
15231
|
const displayTotal = valueFormatter ? valueFormatter({
|
|
15231
15232
|
value: total,
|
|
15232
15233
|
formattedValue: defaultTotalFormatted,
|
|
@@ -15278,18 +15279,13 @@ var RechartTooltipWithTotal = ({
|
|
|
15278
15279
|
const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
|
|
15279
15280
|
const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
|
|
15280
15281
|
const isNeg = value < 0;
|
|
15281
|
-
const
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
}
|
|
15289
|
-
} catch {
|
|
15290
|
-
}
|
|
15291
|
-
return value.toLocaleString("pt-BR");
|
|
15292
|
-
})();
|
|
15282
|
+
const isLine = seriesTypeMap?.[entry.dataKey] === "line";
|
|
15283
|
+
const defaultFormatted = isLine ? `${(value / 100).toLocaleString("pt-BR", {
|
|
15284
|
+
minimumFractionDigits: 2,
|
|
15285
|
+
maximumFractionDigits: 2
|
|
15286
|
+
})}%` : value.toLocaleString("pt-BR", {
|
|
15287
|
+
maximumFractionDigits: 0
|
|
15288
|
+
});
|
|
15293
15289
|
const displayValue = valueFormatter ? valueFormatter({
|
|
15294
15290
|
value: entry.value,
|
|
15295
15291
|
formattedValue: defaultFormatted,
|
|
@@ -15328,8 +15324,14 @@ var RechartTooltipWithTotal = ({
|
|
|
15328
15324
|
const axis = normalize(yAxisMap[entry.dataKey]);
|
|
15329
15325
|
const denom = axisDenominators[axis] || 0;
|
|
15330
15326
|
const p = denom > 0 ? Math.abs(value) / denom * 100 : 0;
|
|
15331
|
-
return denom > 0 ? `${p.
|
|
15332
|
-
|
|
15327
|
+
return denom > 0 ? `${p.toLocaleString("pt-BR", {
|
|
15328
|
+
minimumFractionDigits: 2,
|
|
15329
|
+
maximumFractionDigits: 2
|
|
15330
|
+
})}%` : "-";
|
|
15331
|
+
})() : absDenominator > 0 ? `${pct.toLocaleString("pt-BR", {
|
|
15332
|
+
minimumFractionDigits: 2,
|
|
15333
|
+
maximumFractionDigits: 2
|
|
15334
|
+
})}%` : "-" })
|
|
15333
15335
|
] })
|
|
15334
15336
|
] }),
|
|
15335
15337
|
/* @__PURE__ */ jsx("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
@@ -15358,7 +15360,8 @@ var TooltipSimple = ({
|
|
|
15358
15360
|
valueFormatter,
|
|
15359
15361
|
categoryFormatter,
|
|
15360
15362
|
yAxisMap,
|
|
15361
|
-
isBiaxial = false
|
|
15363
|
+
isBiaxial = false,
|
|
15364
|
+
seriesTypeMap
|
|
15362
15365
|
}) => {
|
|
15363
15366
|
if (!active || !payload || payload.length === 0) return null;
|
|
15364
15367
|
const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
|
|
@@ -15391,18 +15394,13 @@ var TooltipSimple = ({
|
|
|
15391
15394
|
);
|
|
15392
15395
|
pct = axisSum > 0 ? Math.abs(value) / axisSum * 100 : 0;
|
|
15393
15396
|
}
|
|
15394
|
-
const
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
}
|
|
15402
|
-
} catch {
|
|
15403
|
-
}
|
|
15404
|
-
return value.toLocaleString("pt-BR");
|
|
15405
|
-
})();
|
|
15397
|
+
const isLine = seriesTypeMap?.[entry.dataKey] === "line";
|
|
15398
|
+
const defaultFormatted = isLine ? `${(value / 100).toLocaleString("pt-BR", {
|
|
15399
|
+
minimumFractionDigits: 2,
|
|
15400
|
+
maximumFractionDigits: 2
|
|
15401
|
+
})}%` : value.toLocaleString("pt-BR", {
|
|
15402
|
+
maximumFractionDigits: 0
|
|
15403
|
+
});
|
|
15406
15404
|
const displayValue = valueFormatter ? valueFormatter({
|
|
15407
15405
|
value: entry.value,
|
|
15408
15406
|
formattedValue: defaultFormatted,
|
|
@@ -15433,7 +15431,10 @@ var TooltipSimple = ({
|
|
|
15433
15431
|
children: displayValue
|
|
15434
15432
|
}
|
|
15435
15433
|
),
|
|
15436
|
-
isBiaxial ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: pct > 0 ? `${pct.
|
|
15434
|
+
isBiaxial ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: pct > 0 ? `${pct.toLocaleString("pt-BR", {
|
|
15435
|
+
minimumFractionDigits: 2,
|
|
15436
|
+
maximumFractionDigits: 2
|
|
15437
|
+
})}%` : "-" }) : null
|
|
15437
15438
|
] }) })
|
|
15438
15439
|
]
|
|
15439
15440
|
},
|
|
@@ -16478,7 +16479,7 @@ var NoData = ({
|
|
|
16478
16479
|
"div",
|
|
16479
16480
|
{
|
|
16480
16481
|
className: cn(
|
|
16481
|
-
"rounded-xl bg-card relative overflow-hidden w-full
|
|
16482
|
+
"rounded-xl bg-card relative overflow-hidden w-full shadow-sm h-full",
|
|
16482
16483
|
className
|
|
16483
16484
|
),
|
|
16484
16485
|
style: {
|
|
@@ -17421,6 +17422,13 @@ var Chart = ({
|
|
|
17421
17422
|
maxTooltips,
|
|
17422
17423
|
effectiveChartWidth
|
|
17423
17424
|
});
|
|
17425
|
+
const seriesTypeMap = useMemo(() => {
|
|
17426
|
+
const map = {};
|
|
17427
|
+
seriesOrder.forEach((s) => {
|
|
17428
|
+
map[s.key] = s.type;
|
|
17429
|
+
});
|
|
17430
|
+
return map;
|
|
17431
|
+
}, [seriesOrder]);
|
|
17424
17432
|
if (!data && !isLoading) return null;
|
|
17425
17433
|
if (isLoading) {
|
|
17426
17434
|
return /* @__PURE__ */ jsx(ChartWrapper, { className, children: /* @__PURE__ */ jsx(
|
|
@@ -17659,7 +17667,8 @@ var Chart = ({
|
|
|
17659
17667
|
finalColors,
|
|
17660
17668
|
valueFormatter: finalValueFormatter,
|
|
17661
17669
|
categoryFormatter,
|
|
17662
|
-
periodLabel
|
|
17670
|
+
periodLabel,
|
|
17671
|
+
seriesTypeMap
|
|
17663
17672
|
}
|
|
17664
17673
|
) : /* @__PURE__ */ jsx(
|
|
17665
17674
|
TooltipSimple_default,
|
|
@@ -17667,7 +17676,8 @@ var Chart = ({
|
|
|
17667
17676
|
finalColors,
|
|
17668
17677
|
valueFormatter: finalValueFormatter,
|
|
17669
17678
|
categoryFormatter,
|
|
17670
|
-
periodLabel
|
|
17679
|
+
periodLabel,
|
|
17680
|
+
seriesTypeMap
|
|
17671
17681
|
}
|
|
17672
17682
|
),
|
|
17673
17683
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
@@ -17855,7 +17865,8 @@ var Chart = ({
|
|
|
17855
17865
|
globalTooltipCount: activeTooltips.length,
|
|
17856
17866
|
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
17857
17867
|
closeAllButtonPosition: "top-center",
|
|
17858
|
-
closeAllButtonVariant: "floating"
|
|
17868
|
+
closeAllButtonVariant: "floating",
|
|
17869
|
+
seriesTypeMap
|
|
17859
17870
|
},
|
|
17860
17871
|
tooltip.id
|
|
17861
17872
|
)),
|
|
@@ -18007,6 +18018,13 @@ var HorizontalChart = ({
|
|
|
18007
18018
|
setActiveTooltips
|
|
18008
18019
|
]
|
|
18009
18020
|
);
|
|
18021
|
+
const seriesTypeMap = useMemo(() => {
|
|
18022
|
+
const map = {};
|
|
18023
|
+
seriesOrder.forEach((s) => {
|
|
18024
|
+
map[s.key] = s.type;
|
|
18025
|
+
});
|
|
18026
|
+
return map;
|
|
18027
|
+
}, [seriesOrder]);
|
|
18010
18028
|
if (!data && !isLoading) return null;
|
|
18011
18029
|
if (isLoading) {
|
|
18012
18030
|
return /* @__PURE__ */ jsx(
|
|
@@ -18246,7 +18264,8 @@ var HorizontalChart = ({
|
|
|
18246
18264
|
finalColors,
|
|
18247
18265
|
valueFormatter: finalValueFormatter,
|
|
18248
18266
|
categoryFormatter,
|
|
18249
|
-
periodLabel
|
|
18267
|
+
periodLabel,
|
|
18268
|
+
seriesTypeMap
|
|
18250
18269
|
}
|
|
18251
18270
|
) : /* @__PURE__ */ jsx(
|
|
18252
18271
|
TooltipSimple_default,
|
|
@@ -18254,7 +18273,8 @@ var HorizontalChart = ({
|
|
|
18254
18273
|
finalColors,
|
|
18255
18274
|
valueFormatter: finalValueFormatter,
|
|
18256
18275
|
categoryFormatter,
|
|
18257
|
-
periodLabel
|
|
18276
|
+
periodLabel,
|
|
18277
|
+
seriesTypeMap
|
|
18258
18278
|
}
|
|
18259
18279
|
),
|
|
18260
18280
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
@@ -18340,7 +18360,8 @@ var HorizontalChart = ({
|
|
|
18340
18360
|
globalTooltipCount: activeTooltips.length,
|
|
18341
18361
|
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
18342
18362
|
closeAllButtonPosition: "top-center",
|
|
18343
|
-
closeAllButtonVariant: "floating"
|
|
18363
|
+
closeAllButtonVariant: "floating",
|
|
18364
|
+
seriesTypeMap
|
|
18344
18365
|
},
|
|
18345
18366
|
tooltip.id
|
|
18346
18367
|
)),
|
|
@@ -18535,7 +18556,7 @@ function Leaderboard({
|
|
|
18535
18556
|
return /* @__PURE__ */ jsxs(
|
|
18536
18557
|
"div",
|
|
18537
18558
|
{
|
|
18538
|
-
className: `border rounded-xl flex flex-col max-h-80
|
|
18559
|
+
className: `border rounded-xl flex flex-col max-h-80 ${className}`,
|
|
18539
18560
|
children: [
|
|
18540
18561
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3 ", children: [
|
|
18541
18562
|
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold px-1 whitespace-nowrap", children: title }),
|
|
@@ -18552,7 +18573,7 @@ function Leaderboard({
|
|
|
18552
18573
|
},
|
|
18553
18574
|
placeholder: "Pesquisar...",
|
|
18554
18575
|
leftIcon: /* @__PURE__ */ jsx(MagnifyingGlassIcon, { size: 16 }),
|
|
18555
|
-
className: "h-8 py-1
|
|
18576
|
+
className: "h-8 py-1"
|
|
18556
18577
|
}
|
|
18557
18578
|
),
|
|
18558
18579
|
/* @__PURE__ */ jsx(
|
|
@@ -18647,11 +18668,20 @@ var ZoomImage = React32.forwardRef(
|
|
|
18647
18668
|
mouseX.set(x);
|
|
18648
18669
|
mouseY.set(y);
|
|
18649
18670
|
};
|
|
18650
|
-
const
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18671
|
+
const innerRef = React32.useRef(null);
|
|
18672
|
+
React32.useImperativeHandle(ref, () => innerRef.current);
|
|
18673
|
+
React32.useEffect(() => {
|
|
18674
|
+
const element = innerRef.current;
|
|
18675
|
+
if (!element) return;
|
|
18676
|
+
const onWheel = (e) => {
|
|
18677
|
+
e.preventDefault();
|
|
18678
|
+
const delta = -e.deltaY * 5e-3;
|
|
18679
|
+
const newZoom = Math.min(Math.max(1, zoomLevel.get() + delta), maxZoom);
|
|
18680
|
+
zoomLevel.set(newZoom);
|
|
18681
|
+
};
|
|
18682
|
+
element.addEventListener("wheel", onWheel, { passive: false });
|
|
18683
|
+
return () => element.removeEventListener("wheel", onWheel);
|
|
18684
|
+
}, [maxZoom, zoomLevel]);
|
|
18655
18685
|
const handleMouseLeave = () => {
|
|
18656
18686
|
if (!isPinching.current) {
|
|
18657
18687
|
mouseX.set(50);
|
|
@@ -18709,7 +18739,7 @@ var ZoomImage = React32.forwardRef(
|
|
|
18709
18739
|
return /* @__PURE__ */ jsx(
|
|
18710
18740
|
motion.div,
|
|
18711
18741
|
{
|
|
18712
|
-
ref,
|
|
18742
|
+
ref: innerRef,
|
|
18713
18743
|
className: cn(
|
|
18714
18744
|
"relative w-full h-full overflow-hidden touch-none",
|
|
18715
18745
|
className
|
|
@@ -18717,7 +18747,6 @@ var ZoomImage = React32.forwardRef(
|
|
|
18717
18747
|
style: { borderRadius: `${borderRadius}px` },
|
|
18718
18748
|
onMouseMove: handleMouseMove,
|
|
18719
18749
|
onMouseLeave: handleMouseLeave,
|
|
18720
|
-
onWheel: handleWheel,
|
|
18721
18750
|
onTouchStart: handleTouchStart,
|
|
18722
18751
|
onTouchMove: handleTouchMove,
|
|
18723
18752
|
onTouchEnd: handleTouchEnd,
|
|
@@ -18768,11 +18797,17 @@ var Lens = ({
|
|
|
18768
18797
|
const y = e.clientY - rect.top;
|
|
18769
18798
|
setMousePosition({ x, y });
|
|
18770
18799
|
};
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18800
|
+
React32__default.useEffect(() => {
|
|
18801
|
+
const element = containerRef.current;
|
|
18802
|
+
if (!element || !isActivated) return;
|
|
18803
|
+
const onWheel = (e) => {
|
|
18804
|
+
e.preventDefault();
|
|
18805
|
+
const delta = -e.deltaY * 5e-3;
|
|
18806
|
+
setZoomFactor((prev) => Math.min(Math.max(1.1, prev + delta), maxZoom));
|
|
18807
|
+
};
|
|
18808
|
+
element.addEventListener("wheel", onWheel, { passive: false });
|
|
18809
|
+
return () => element.removeEventListener("wheel", onWheel);
|
|
18810
|
+
}, [isActivated, maxZoom]);
|
|
18776
18811
|
const resetZoom = () => {
|
|
18777
18812
|
setZoomFactor(initialZoom);
|
|
18778
18813
|
setIsActivated(false);
|
|
@@ -18794,7 +18829,6 @@ var Lens = ({
|
|
|
18794
18829
|
resetZoom();
|
|
18795
18830
|
},
|
|
18796
18831
|
onMouseMove: handleMouseMove,
|
|
18797
|
-
onWheel: handleWheel,
|
|
18798
18832
|
children: [
|
|
18799
18833
|
children,
|
|
18800
18834
|
isStatic ? /* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -18833,9 +18867,9 @@ var Lens = ({
|
|
|
18833
18867
|
top: position.y - lensSize / 2,
|
|
18834
18868
|
width: lensSize,
|
|
18835
18869
|
height: lensSize,
|
|
18836
|
-
borderRadius: "
|
|
18837
|
-
boxShadow: "0 8px
|
|
18838
|
-
background: "radial-gradient(circle at center, transparent
|
|
18870
|
+
borderRadius: "10%",
|
|
18871
|
+
boxShadow: "0 8px 12px rgba(0, 0, 0, 1), 0 4px 16px rgba(5,3, 1, 1)",
|
|
18872
|
+
background: "radial-gradient(circle at center, transparent 100%, rgba(255, 255, 255, 1) 100%, rgba(255, 255, 255, 1) 100%, transparent 100%)"
|
|
18839
18873
|
}
|
|
18840
18874
|
}
|
|
18841
18875
|
)
|
|
@@ -18892,7 +18926,7 @@ var Lens = ({
|
|
|
18892
18926
|
);
|
|
18893
18927
|
};
|
|
18894
18928
|
function CarouselSkeleton({ className }) {
|
|
18895
|
-
return /* @__PURE__ */ jsx("div", { className: cn("w-full h-full lg:p-10 sm:p-4 p-2", className), children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-lg h-full", children: /* @__PURE__ */ jsxs("div", { className: "w-full h-full bg-muted rounded-lg overflow-hidden relative", children: [
|
|
18929
|
+
return /* @__PURE__ */ jsx("div", { className: cn("w-full h-full lg:p-10 sm:p-4 p-2", className), children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-lg h-full", children: /* @__PURE__ */ jsxs("div", { className: "w-full h-full min-h-[300px] bg-muted rounded-lg overflow-hidden relative", children: [
|
|
18896
18930
|
/* @__PURE__ */ jsx(
|
|
18897
18931
|
motion.div,
|
|
18898
18932
|
{
|
|
@@ -18964,7 +18998,6 @@ function CarouselBase({
|
|
|
18964
18998
|
containerClassName,
|
|
18965
18999
|
imageClassName,
|
|
18966
19000
|
width,
|
|
18967
|
-
height,
|
|
18968
19001
|
showControls = true,
|
|
18969
19002
|
showIndicators = true,
|
|
18970
19003
|
autoPlay = false,
|
|
@@ -18975,7 +19008,8 @@ function CarouselBase({
|
|
|
18975
19008
|
}) {
|
|
18976
19009
|
const isMobile = useIsMobile();
|
|
18977
19010
|
const [index, setIndex] = useState(0);
|
|
18978
|
-
const
|
|
19011
|
+
const options = useMemo(() => ({ loop: true }), []);
|
|
19012
|
+
const [emblaRef, emblaApi] = useEmblaCarousel(options);
|
|
18979
19013
|
const [isDownloading, setIsDownloading] = useState(false);
|
|
18980
19014
|
const [downloadSuccess, setDownloadSuccess] = useState(false);
|
|
18981
19015
|
useEffect(() => {
|
|
@@ -18997,11 +19031,6 @@ function CarouselBase({
|
|
|
18997
19031
|
}, autoPlayInterval);
|
|
18998
19032
|
return () => clearInterval(interval);
|
|
18999
19033
|
}, [autoPlay, autoPlayInterval, items.length, emblaApi]);
|
|
19000
|
-
useEffect(() => {
|
|
19001
|
-
if (emblaApi && index !== emblaApi.selectedScrollSnap()) {
|
|
19002
|
-
emblaApi.scrollTo(index);
|
|
19003
|
-
}
|
|
19004
|
-
}, [index, emblaApi]);
|
|
19005
19034
|
const handleDownload = async () => {
|
|
19006
19035
|
if (isDownloading) return;
|
|
19007
19036
|
setIsDownloading(true);
|
|
@@ -19034,7 +19063,7 @@ function CarouselBase({
|
|
|
19034
19063
|
animate: { opacity: 1 },
|
|
19035
19064
|
exit: { opacity: 0 },
|
|
19036
19065
|
transition: { duration: 0.3 },
|
|
19037
|
-
style: { width
|
|
19066
|
+
style: { width },
|
|
19038
19067
|
className: "h-full",
|
|
19039
19068
|
children: /* @__PURE__ */ jsx(CarouselSkeleton, { className })
|
|
19040
19069
|
},
|
|
@@ -19048,17 +19077,14 @@ function CarouselBase({
|
|
|
19048
19077
|
animate: { opacity: 1 },
|
|
19049
19078
|
transition: { duration: 0.4 },
|
|
19050
19079
|
className: cn("w-full lg:p-10 sm:p-4 p-2", className),
|
|
19051
|
-
style: { width
|
|
19052
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxs(
|
|
19053
|
-
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
ref: emblaRef,
|
|
19060
|
-
children: [
|
|
19061
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-full", children: items.map((item) => /* @__PURE__ */ jsx("div", { className: "shrink-0 w-full h-full min-w-0", children: isMobile || zoomEffect === "scale" ? /* @__PURE__ */ jsx(
|
|
19080
|
+
style: { width },
|
|
19081
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxs("div", { className: cn("relative h-full", containerClassName), children: [
|
|
19082
|
+
/* @__PURE__ */ jsx(
|
|
19083
|
+
"div",
|
|
19084
|
+
{
|
|
19085
|
+
ref: emblaRef,
|
|
19086
|
+
className: "overflow-hidden rounded-lg h-full cursor-grab active:cursor-grabbing",
|
|
19087
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex h-full", children: items.map((item) => /* @__PURE__ */ jsx("div", { className: "shrink-0 w-full h-full min-w-0", children: isMobile || zoomEffect === "scale" ? /* @__PURE__ */ jsx(
|
|
19062
19088
|
ZoomImage,
|
|
19063
19089
|
{
|
|
19064
19090
|
src: item.url,
|
|
@@ -19090,154 +19116,166 @@ function CarouselBase({
|
|
|
19090
19116
|
),
|
|
19091
19117
|
draggable: false
|
|
19092
19118
|
}
|
|
19093
|
-
) }, item.id)) })
|
|
19094
|
-
|
|
19095
|
-
|
|
19119
|
+
) }, item.id)) })
|
|
19120
|
+
}
|
|
19121
|
+
),
|
|
19122
|
+
download && /* @__PURE__ */ jsx(
|
|
19123
|
+
motion.button,
|
|
19124
|
+
{
|
|
19125
|
+
onClick: handleDownload,
|
|
19126
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19127
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19128
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19129
|
+
className: cn(
|
|
19130
|
+
"absolute top-4 right-4 z-50 p-2 rounded-full text-white transition-colors border border-white/10",
|
|
19131
|
+
downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70"
|
|
19132
|
+
),
|
|
19133
|
+
title: "Download image",
|
|
19134
|
+
initial: false,
|
|
19135
|
+
animate: {
|
|
19136
|
+
scale: isDownloading ? 0.9 : 1,
|
|
19137
|
+
backgroundColor: downloadSuccess ? "rgb(34, 197, 94)" : "rgba(0, 0, 0, 0.5)"
|
|
19138
|
+
},
|
|
19139
|
+
whileHover: { scale: 1.05 },
|
|
19140
|
+
whileTap: { scale: 0.95 },
|
|
19141
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", initial: false, children: isDownloading ? /* @__PURE__ */ jsx(
|
|
19142
|
+
motion.svg,
|
|
19096
19143
|
{
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
|
|
19144
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19145
|
+
width: "20",
|
|
19146
|
+
height: "20",
|
|
19147
|
+
viewBox: "0 0 24 24",
|
|
19148
|
+
fill: "none",
|
|
19149
|
+
stroke: "currentColor",
|
|
19150
|
+
strokeWidth: "2",
|
|
19151
|
+
strokeLinecap: "round",
|
|
19152
|
+
strokeLinejoin: "round",
|
|
19153
|
+
animate: { rotate: 360 },
|
|
19154
|
+
transition: {
|
|
19155
|
+
repeat: Infinity,
|
|
19156
|
+
ease: "linear",
|
|
19157
|
+
duration: 1
|
|
19107
19158
|
},
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19120
|
-
|
|
19121
|
-
|
|
19122
|
-
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
|
|
19139
|
-
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
}
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
children: [
|
|
19165
|
-
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
19166
|
-
/* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
19167
|
-
/* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
19168
|
-
]
|
|
19169
|
-
},
|
|
19170
|
-
"download"
|
|
19171
|
-
) })
|
|
19172
|
-
}
|
|
19173
|
-
),
|
|
19174
|
-
showControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19175
|
-
/* @__PURE__ */ jsx(
|
|
19176
|
-
motion.button,
|
|
19177
|
-
{
|
|
19178
|
-
disabled: !emblaApi?.canScrollPrev(),
|
|
19179
|
-
onClick: () => emblaApi?.scrollPrev(),
|
|
19180
|
-
className: `absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full flex items-center justify-center shadow-lg transition-transform z-30
|
|
19159
|
+
children: /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
19160
|
+
},
|
|
19161
|
+
"loading"
|
|
19162
|
+
) : downloadSuccess ? /* @__PURE__ */ jsx(
|
|
19163
|
+
motion.svg,
|
|
19164
|
+
{
|
|
19165
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19166
|
+
width: "20",
|
|
19167
|
+
height: "20",
|
|
19168
|
+
viewBox: "0 0 24 24",
|
|
19169
|
+
fill: "none",
|
|
19170
|
+
stroke: "currentColor",
|
|
19171
|
+
strokeWidth: "2",
|
|
19172
|
+
strokeLinecap: "round",
|
|
19173
|
+
strokeLinejoin: "round",
|
|
19174
|
+
initial: { scale: 0.5, opacity: 0 },
|
|
19175
|
+
animate: { scale: 1, opacity: 1 },
|
|
19176
|
+
exit: { scale: 0.5, opacity: 0 },
|
|
19177
|
+
children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
|
|
19178
|
+
},
|
|
19179
|
+
"success"
|
|
19180
|
+
) : /* @__PURE__ */ jsxs(
|
|
19181
|
+
motion.svg,
|
|
19182
|
+
{
|
|
19183
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19184
|
+
width: "20",
|
|
19185
|
+
height: "20",
|
|
19186
|
+
viewBox: "0 0 24 24",
|
|
19187
|
+
fill: "none",
|
|
19188
|
+
stroke: "currentColor",
|
|
19189
|
+
strokeWidth: "2",
|
|
19190
|
+
strokeLinecap: "round",
|
|
19191
|
+
strokeLinejoin: "round",
|
|
19192
|
+
initial: { scale: 0.5, opacity: 0 },
|
|
19193
|
+
animate: { scale: 1, opacity: 1 },
|
|
19194
|
+
exit: { scale: 0.5, opacity: 0 },
|
|
19195
|
+
children: [
|
|
19196
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
19197
|
+
/* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
19198
|
+
/* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
19199
|
+
]
|
|
19200
|
+
},
|
|
19201
|
+
"download"
|
|
19202
|
+
) })
|
|
19203
|
+
}
|
|
19204
|
+
),
|
|
19205
|
+
showControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19206
|
+
/* @__PURE__ */ jsx(
|
|
19207
|
+
motion.button,
|
|
19208
|
+
{
|
|
19209
|
+
disabled: !emblaApi?.canScrollPrev(),
|
|
19210
|
+
onClick: () => emblaApi?.scrollPrev(),
|
|
19211
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19212
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19213
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19214
|
+
className: `absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full flex items-center justify-center shadow-lg transition-transform z-50
|
|
19181
19215
|
${!emblaApi?.canScrollPrev() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
|
|
19216
|
+
children: /* @__PURE__ */ jsx(
|
|
19217
|
+
"svg",
|
|
19218
|
+
{
|
|
19219
|
+
className: "w-6 h-6",
|
|
19220
|
+
fill: "none",
|
|
19221
|
+
stroke: "currentColor",
|
|
19222
|
+
viewBox: "0 0 24 24",
|
|
19182
19223
|
children: /* @__PURE__ */ jsx(
|
|
19183
|
-
"
|
|
19224
|
+
"path",
|
|
19184
19225
|
{
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
children: /* @__PURE__ */ jsx(
|
|
19190
|
-
"path",
|
|
19191
|
-
{
|
|
19192
|
-
strokeLinecap: "round",
|
|
19193
|
-
strokeLinejoin: "round",
|
|
19194
|
-
strokeWidth: 2,
|
|
19195
|
-
d: "M15 19l-7-7 7-7"
|
|
19196
|
-
}
|
|
19197
|
-
)
|
|
19226
|
+
strokeLinecap: "round",
|
|
19227
|
+
strokeLinejoin: "round",
|
|
19228
|
+
strokeWidth: 2,
|
|
19229
|
+
d: "M15 19l-7-7 7-7"
|
|
19198
19230
|
}
|
|
19199
19231
|
)
|
|
19200
19232
|
}
|
|
19201
|
-
)
|
|
19202
|
-
|
|
19203
|
-
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
|
|
19233
|
+
)
|
|
19234
|
+
}
|
|
19235
|
+
),
|
|
19236
|
+
/* @__PURE__ */ jsx(
|
|
19237
|
+
motion.button,
|
|
19238
|
+
{
|
|
19239
|
+
disabled: !emblaApi?.canScrollNext(),
|
|
19240
|
+
onClick: () => emblaApi?.scrollNext(),
|
|
19241
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19242
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19243
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19244
|
+
className: `absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full flex items-center justify-center shadow-lg transition-transform z-50
|
|
19208
19245
|
${!emblaApi?.canScrollNext() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
|
|
19246
|
+
children: /* @__PURE__ */ jsx(
|
|
19247
|
+
"svg",
|
|
19248
|
+
{
|
|
19249
|
+
className: "w-6 h-6",
|
|
19250
|
+
fill: "none",
|
|
19251
|
+
stroke: "currentColor",
|
|
19252
|
+
viewBox: "0 0 24 24",
|
|
19209
19253
|
children: /* @__PURE__ */ jsx(
|
|
19210
|
-
"
|
|
19254
|
+
"path",
|
|
19211
19255
|
{
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
|
|
19215
|
-
|
|
19216
|
-
children: /* @__PURE__ */ jsx(
|
|
19217
|
-
"path",
|
|
19218
|
-
{
|
|
19219
|
-
strokeLinecap: "round",
|
|
19220
|
-
strokeLinejoin: "round",
|
|
19221
|
-
strokeWidth: 2,
|
|
19222
|
-
d: "M9 5l7 7-7 7"
|
|
19223
|
-
}
|
|
19224
|
-
)
|
|
19256
|
+
strokeLinecap: "round",
|
|
19257
|
+
strokeLinejoin: "round",
|
|
19258
|
+
strokeWidth: 2,
|
|
19259
|
+
d: "M9 5l7 7-7 7"
|
|
19225
19260
|
}
|
|
19226
19261
|
)
|
|
19227
19262
|
}
|
|
19228
19263
|
)
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
|
|
19233
|
-
|
|
19234
|
-
|
|
19235
|
-
|
|
19236
|
-
|
|
19237
|
-
)
|
|
19238
|
-
|
|
19239
|
-
|
|
19240
|
-
|
|
19264
|
+
}
|
|
19265
|
+
)
|
|
19266
|
+
] }),
|
|
19267
|
+
showIndicators && /* @__PURE__ */ jsx("div", { className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2 z-50", children: items.map((_, i) => /* @__PURE__ */ jsx(
|
|
19268
|
+
"button",
|
|
19269
|
+
{
|
|
19270
|
+
onClick: () => emblaApi?.scrollTo(i),
|
|
19271
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19272
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19273
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19274
|
+
className: `h-2 rounded-full transition-all ${i === index ? "w-8 bg-white" : "w-2 bg-white/50"}`
|
|
19275
|
+
},
|
|
19276
|
+
i
|
|
19277
|
+
)) })
|
|
19278
|
+
] }) })
|
|
19241
19279
|
},
|
|
19242
19280
|
"carousel-content"
|
|
19243
19281
|
) });
|