@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.js
CHANGED
|
@@ -14664,7 +14664,8 @@ var DraggableTooltipComponent = ({
|
|
|
14664
14664
|
toggleHighlight,
|
|
14665
14665
|
showOnlyHighlighted,
|
|
14666
14666
|
valueFormatter,
|
|
14667
|
-
categoryFormatter
|
|
14667
|
+
categoryFormatter,
|
|
14668
|
+
seriesTypeMap
|
|
14668
14669
|
}) => {
|
|
14669
14670
|
const visibleKeys = React32.useMemo(
|
|
14670
14671
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
@@ -14675,7 +14676,9 @@ var DraggableTooltipComponent = ({
|
|
|
14675
14676
|
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
14676
14677
|
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
14677
14678
|
}, [data2, visibleKeys2]);
|
|
14678
|
-
const defaultTotalFormatted = total.toLocaleString("pt-BR"
|
|
14679
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR", {
|
|
14680
|
+
maximumFractionDigits: 0
|
|
14681
|
+
});
|
|
14679
14682
|
const displayTotal = localformatter ? localformatter({
|
|
14680
14683
|
value: total,
|
|
14681
14684
|
formattedValue: defaultTotalFormatted,
|
|
@@ -15130,7 +15133,13 @@ var DraggableTooltipComponent = ({
|
|
|
15130
15133
|
0
|
|
15131
15134
|
);
|
|
15132
15135
|
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
15133
|
-
const
|
|
15136
|
+
const isLine = seriesTypeMap?.[key] === "line";
|
|
15137
|
+
const defaultFormatted = isLine ? `${(val / 100).toLocaleString("pt-BR", {
|
|
15138
|
+
minimumFractionDigits: 2,
|
|
15139
|
+
maximumFractionDigits: 2
|
|
15140
|
+
})}%` : val.toLocaleString("pt-BR", {
|
|
15141
|
+
maximumFractionDigits: 0
|
|
15142
|
+
});
|
|
15134
15143
|
const displayValue = valueFormatter ? valueFormatter({
|
|
15135
15144
|
value,
|
|
15136
15145
|
formattedValue: defaultFormatted,
|
|
@@ -15185,7 +15194,7 @@ var DraggableTooltipComponent = ({
|
|
|
15185
15194
|
children: displayValue
|
|
15186
15195
|
}
|
|
15187
15196
|
),
|
|
15188
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.
|
|
15197
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toLocaleString("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}%` : "-" })
|
|
15189
15198
|
] })
|
|
15190
15199
|
] }),
|
|
15191
15200
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15249,7 +15258,8 @@ var RechartTooltipWithTotal = ({
|
|
|
15249
15258
|
valueFormatter,
|
|
15250
15259
|
categoryFormatter,
|
|
15251
15260
|
yAxisMap,
|
|
15252
|
-
isBiaxial = false
|
|
15261
|
+
isBiaxial = false,
|
|
15262
|
+
seriesTypeMap
|
|
15253
15263
|
}) => {
|
|
15254
15264
|
if (!active || !payload || payload.length === 0) return null;
|
|
15255
15265
|
const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
|
|
@@ -15258,18 +15268,9 @@ var RechartTooltipWithTotal = ({
|
|
|
15258
15268
|
);
|
|
15259
15269
|
const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
|
|
15260
15270
|
const isTotalNegative = total < 0;
|
|
15261
|
-
const defaultTotalFormatted = (
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
return new Intl.NumberFormat("pt-BR", {
|
|
15265
|
-
minimumFractionDigits: 2,
|
|
15266
|
-
maximumFractionDigits: 2
|
|
15267
|
-
}).format(total);
|
|
15268
|
-
}
|
|
15269
|
-
} catch {
|
|
15270
|
-
}
|
|
15271
|
-
return total.toLocaleString("pt-BR");
|
|
15272
|
-
})();
|
|
15271
|
+
const defaultTotalFormatted = total.toLocaleString("pt-BR", {
|
|
15272
|
+
maximumFractionDigits: 0
|
|
15273
|
+
});
|
|
15273
15274
|
const displayTotal = valueFormatter ? valueFormatter({
|
|
15274
15275
|
value: total,
|
|
15275
15276
|
formattedValue: defaultTotalFormatted,
|
|
@@ -15321,18 +15322,13 @@ var RechartTooltipWithTotal = ({
|
|
|
15321
15322
|
const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
|
|
15322
15323
|
const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
|
|
15323
15324
|
const isNeg = value < 0;
|
|
15324
|
-
const
|
|
15325
|
-
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
}
|
|
15332
|
-
} catch {
|
|
15333
|
-
}
|
|
15334
|
-
return value.toLocaleString("pt-BR");
|
|
15335
|
-
})();
|
|
15325
|
+
const isLine = seriesTypeMap?.[entry.dataKey] === "line";
|
|
15326
|
+
const defaultFormatted = isLine ? `${(value / 100).toLocaleString("pt-BR", {
|
|
15327
|
+
minimumFractionDigits: 2,
|
|
15328
|
+
maximumFractionDigits: 2
|
|
15329
|
+
})}%` : value.toLocaleString("pt-BR", {
|
|
15330
|
+
maximumFractionDigits: 0
|
|
15331
|
+
});
|
|
15336
15332
|
const displayValue = valueFormatter ? valueFormatter({
|
|
15337
15333
|
value: entry.value,
|
|
15338
15334
|
formattedValue: defaultFormatted,
|
|
@@ -15371,8 +15367,14 @@ var RechartTooltipWithTotal = ({
|
|
|
15371
15367
|
const axis = normalize(yAxisMap[entry.dataKey]);
|
|
15372
15368
|
const denom = axisDenominators[axis] || 0;
|
|
15373
15369
|
const p = denom > 0 ? Math.abs(value) / denom * 100 : 0;
|
|
15374
|
-
return denom > 0 ? `${p.
|
|
15375
|
-
|
|
15370
|
+
return denom > 0 ? `${p.toLocaleString("pt-BR", {
|
|
15371
|
+
minimumFractionDigits: 2,
|
|
15372
|
+
maximumFractionDigits: 2
|
|
15373
|
+
})}%` : "-";
|
|
15374
|
+
})() : absDenominator > 0 ? `${pct.toLocaleString("pt-BR", {
|
|
15375
|
+
minimumFractionDigits: 2,
|
|
15376
|
+
maximumFractionDigits: 2
|
|
15377
|
+
})}%` : "-" })
|
|
15376
15378
|
] })
|
|
15377
15379
|
] }),
|
|
15378
15380
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -15401,7 +15403,8 @@ var TooltipSimple = ({
|
|
|
15401
15403
|
valueFormatter,
|
|
15402
15404
|
categoryFormatter,
|
|
15403
15405
|
yAxisMap,
|
|
15404
|
-
isBiaxial = false
|
|
15406
|
+
isBiaxial = false,
|
|
15407
|
+
seriesTypeMap
|
|
15405
15408
|
}) => {
|
|
15406
15409
|
if (!active || !payload || payload.length === 0) return null;
|
|
15407
15410
|
const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
|
|
@@ -15434,18 +15437,13 @@ var TooltipSimple = ({
|
|
|
15434
15437
|
);
|
|
15435
15438
|
pct = axisSum > 0 ? Math.abs(value) / axisSum * 100 : 0;
|
|
15436
15439
|
}
|
|
15437
|
-
const
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
}
|
|
15445
|
-
} catch {
|
|
15446
|
-
}
|
|
15447
|
-
return value.toLocaleString("pt-BR");
|
|
15448
|
-
})();
|
|
15440
|
+
const isLine = seriesTypeMap?.[entry.dataKey] === "line";
|
|
15441
|
+
const defaultFormatted = isLine ? `${(value / 100).toLocaleString("pt-BR", {
|
|
15442
|
+
minimumFractionDigits: 2,
|
|
15443
|
+
maximumFractionDigits: 2
|
|
15444
|
+
})}%` : value.toLocaleString("pt-BR", {
|
|
15445
|
+
maximumFractionDigits: 0
|
|
15446
|
+
});
|
|
15449
15447
|
const displayValue = valueFormatter ? valueFormatter({
|
|
15450
15448
|
value: entry.value,
|
|
15451
15449
|
formattedValue: defaultFormatted,
|
|
@@ -15476,7 +15474,10 @@ var TooltipSimple = ({
|
|
|
15476
15474
|
children: displayValue
|
|
15477
15475
|
}
|
|
15478
15476
|
),
|
|
15479
|
-
isBiaxial ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: pct > 0 ? `${pct.
|
|
15477
|
+
isBiaxial ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: pct > 0 ? `${pct.toLocaleString("pt-BR", {
|
|
15478
|
+
minimumFractionDigits: 2,
|
|
15479
|
+
maximumFractionDigits: 2
|
|
15480
|
+
})}%` : "-" }) : null
|
|
15480
15481
|
] }) })
|
|
15481
15482
|
]
|
|
15482
15483
|
},
|
|
@@ -16521,7 +16522,7 @@ var NoData = ({
|
|
|
16521
16522
|
"div",
|
|
16522
16523
|
{
|
|
16523
16524
|
className: cn(
|
|
16524
|
-
"rounded-xl bg-card relative overflow-hidden w-full
|
|
16525
|
+
"rounded-xl bg-card relative overflow-hidden w-full shadow-sm h-full",
|
|
16525
16526
|
className
|
|
16526
16527
|
),
|
|
16527
16528
|
style: {
|
|
@@ -17464,6 +17465,13 @@ var Chart = ({
|
|
|
17464
17465
|
maxTooltips,
|
|
17465
17466
|
effectiveChartWidth
|
|
17466
17467
|
});
|
|
17468
|
+
const seriesTypeMap = React32.useMemo(() => {
|
|
17469
|
+
const map = {};
|
|
17470
|
+
seriesOrder.forEach((s) => {
|
|
17471
|
+
map[s.key] = s.type;
|
|
17472
|
+
});
|
|
17473
|
+
return map;
|
|
17474
|
+
}, [seriesOrder]);
|
|
17467
17475
|
if (!data && !isLoading) return null;
|
|
17468
17476
|
if (isLoading) {
|
|
17469
17477
|
return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { className, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -17702,7 +17710,8 @@ var Chart = ({
|
|
|
17702
17710
|
finalColors,
|
|
17703
17711
|
valueFormatter: finalValueFormatter,
|
|
17704
17712
|
categoryFormatter,
|
|
17705
|
-
periodLabel
|
|
17713
|
+
periodLabel,
|
|
17714
|
+
seriesTypeMap
|
|
17706
17715
|
}
|
|
17707
17716
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
17708
17717
|
TooltipSimple_default,
|
|
@@ -17710,7 +17719,8 @@ var Chart = ({
|
|
|
17710
17719
|
finalColors,
|
|
17711
17720
|
valueFormatter: finalValueFormatter,
|
|
17712
17721
|
categoryFormatter,
|
|
17713
|
-
periodLabel
|
|
17722
|
+
periodLabel,
|
|
17723
|
+
seriesTypeMap
|
|
17714
17724
|
}
|
|
17715
17725
|
),
|
|
17716
17726
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
@@ -17898,7 +17908,8 @@ var Chart = ({
|
|
|
17898
17908
|
globalTooltipCount: activeTooltips.length,
|
|
17899
17909
|
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
17900
17910
|
closeAllButtonPosition: "top-center",
|
|
17901
|
-
closeAllButtonVariant: "floating"
|
|
17911
|
+
closeAllButtonVariant: "floating",
|
|
17912
|
+
seriesTypeMap
|
|
17902
17913
|
},
|
|
17903
17914
|
tooltip.id
|
|
17904
17915
|
)),
|
|
@@ -18050,6 +18061,13 @@ var HorizontalChart = ({
|
|
|
18050
18061
|
setActiveTooltips
|
|
18051
18062
|
]
|
|
18052
18063
|
);
|
|
18064
|
+
const seriesTypeMap = React32.useMemo(() => {
|
|
18065
|
+
const map = {};
|
|
18066
|
+
seriesOrder.forEach((s) => {
|
|
18067
|
+
map[s.key] = s.type;
|
|
18068
|
+
});
|
|
18069
|
+
return map;
|
|
18070
|
+
}, [seriesOrder]);
|
|
18053
18071
|
if (!data && !isLoading) return null;
|
|
18054
18072
|
if (isLoading) {
|
|
18055
18073
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -18289,7 +18307,8 @@ var HorizontalChart = ({
|
|
|
18289
18307
|
finalColors,
|
|
18290
18308
|
valueFormatter: finalValueFormatter,
|
|
18291
18309
|
categoryFormatter,
|
|
18292
|
-
periodLabel
|
|
18310
|
+
periodLabel,
|
|
18311
|
+
seriesTypeMap
|
|
18293
18312
|
}
|
|
18294
18313
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
18295
18314
|
TooltipSimple_default,
|
|
@@ -18297,7 +18316,8 @@ var HorizontalChart = ({
|
|
|
18297
18316
|
finalColors,
|
|
18298
18317
|
valueFormatter: finalValueFormatter,
|
|
18299
18318
|
categoryFormatter,
|
|
18300
|
-
periodLabel
|
|
18319
|
+
periodLabel,
|
|
18320
|
+
seriesTypeMap
|
|
18301
18321
|
}
|
|
18302
18322
|
),
|
|
18303
18323
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
@@ -18383,7 +18403,8 @@ var HorizontalChart = ({
|
|
|
18383
18403
|
globalTooltipCount: activeTooltips.length,
|
|
18384
18404
|
onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
|
|
18385
18405
|
closeAllButtonPosition: "top-center",
|
|
18386
|
-
closeAllButtonVariant: "floating"
|
|
18406
|
+
closeAllButtonVariant: "floating",
|
|
18407
|
+
seriesTypeMap
|
|
18387
18408
|
},
|
|
18388
18409
|
tooltip.id
|
|
18389
18410
|
)),
|
|
@@ -18578,7 +18599,7 @@ function Leaderboard({
|
|
|
18578
18599
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
18579
18600
|
"div",
|
|
18580
18601
|
{
|
|
18581
|
-
className: `border rounded-xl flex flex-col max-h-80
|
|
18602
|
+
className: `border rounded-xl flex flex-col max-h-80 ${className}`,
|
|
18582
18603
|
children: [
|
|
18583
18604
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between py-2 px-4 border-b flex-shrink-0 gap-3 ", children: [
|
|
18584
18605
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-semibold px-1 whitespace-nowrap", children: title }),
|
|
@@ -18595,7 +18616,7 @@ function Leaderboard({
|
|
|
18595
18616
|
},
|
|
18596
18617
|
placeholder: "Pesquisar...",
|
|
18597
18618
|
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(react.MagnifyingGlassIcon, { size: 16 }),
|
|
18598
|
-
className: "h-8 py-1
|
|
18619
|
+
className: "h-8 py-1"
|
|
18599
18620
|
}
|
|
18600
18621
|
),
|
|
18601
18622
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -18690,11 +18711,20 @@ var ZoomImage = React32__namespace.forwardRef(
|
|
|
18690
18711
|
mouseX.set(x);
|
|
18691
18712
|
mouseY.set(y);
|
|
18692
18713
|
};
|
|
18693
|
-
const
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18714
|
+
const innerRef = React32__namespace.useRef(null);
|
|
18715
|
+
React32__namespace.useImperativeHandle(ref, () => innerRef.current);
|
|
18716
|
+
React32__namespace.useEffect(() => {
|
|
18717
|
+
const element = innerRef.current;
|
|
18718
|
+
if (!element) return;
|
|
18719
|
+
const onWheel = (e) => {
|
|
18720
|
+
e.preventDefault();
|
|
18721
|
+
const delta = -e.deltaY * 5e-3;
|
|
18722
|
+
const newZoom = Math.min(Math.max(1, zoomLevel.get() + delta), maxZoom);
|
|
18723
|
+
zoomLevel.set(newZoom);
|
|
18724
|
+
};
|
|
18725
|
+
element.addEventListener("wheel", onWheel, { passive: false });
|
|
18726
|
+
return () => element.removeEventListener("wheel", onWheel);
|
|
18727
|
+
}, [maxZoom, zoomLevel]);
|
|
18698
18728
|
const handleMouseLeave = () => {
|
|
18699
18729
|
if (!isPinching.current) {
|
|
18700
18730
|
mouseX.set(50);
|
|
@@ -18752,7 +18782,7 @@ var ZoomImage = React32__namespace.forwardRef(
|
|
|
18752
18782
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18753
18783
|
framerMotion.motion.div,
|
|
18754
18784
|
{
|
|
18755
|
-
ref,
|
|
18785
|
+
ref: innerRef,
|
|
18756
18786
|
className: cn(
|
|
18757
18787
|
"relative w-full h-full overflow-hidden touch-none",
|
|
18758
18788
|
className
|
|
@@ -18760,7 +18790,6 @@ var ZoomImage = React32__namespace.forwardRef(
|
|
|
18760
18790
|
style: { borderRadius: `${borderRadius}px` },
|
|
18761
18791
|
onMouseMove: handleMouseMove,
|
|
18762
18792
|
onMouseLeave: handleMouseLeave,
|
|
18763
|
-
onWheel: handleWheel,
|
|
18764
18793
|
onTouchStart: handleTouchStart,
|
|
18765
18794
|
onTouchMove: handleTouchMove,
|
|
18766
18795
|
onTouchEnd: handleTouchEnd,
|
|
@@ -18811,11 +18840,17 @@ var Lens = ({
|
|
|
18811
18840
|
const y = e.clientY - rect.top;
|
|
18812
18841
|
setMousePosition({ x, y });
|
|
18813
18842
|
};
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
|
|
18843
|
+
React32__namespace.default.useEffect(() => {
|
|
18844
|
+
const element = containerRef.current;
|
|
18845
|
+
if (!element || !isActivated) return;
|
|
18846
|
+
const onWheel = (e) => {
|
|
18847
|
+
e.preventDefault();
|
|
18848
|
+
const delta = -e.deltaY * 5e-3;
|
|
18849
|
+
setZoomFactor((prev) => Math.min(Math.max(1.1, prev + delta), maxZoom));
|
|
18850
|
+
};
|
|
18851
|
+
element.addEventListener("wheel", onWheel, { passive: false });
|
|
18852
|
+
return () => element.removeEventListener("wheel", onWheel);
|
|
18853
|
+
}, [isActivated, maxZoom]);
|
|
18819
18854
|
const resetZoom = () => {
|
|
18820
18855
|
setZoomFactor(initialZoom);
|
|
18821
18856
|
setIsActivated(false);
|
|
@@ -18837,7 +18872,6 @@ var Lens = ({
|
|
|
18837
18872
|
resetZoom();
|
|
18838
18873
|
},
|
|
18839
18874
|
onMouseMove: handleMouseMove,
|
|
18840
|
-
onWheel: handleWheel,
|
|
18841
18875
|
children: [
|
|
18842
18876
|
children,
|
|
18843
18877
|
isStatic ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -18876,9 +18910,9 @@ var Lens = ({
|
|
|
18876
18910
|
top: position.y - lensSize / 2,
|
|
18877
18911
|
width: lensSize,
|
|
18878
18912
|
height: lensSize,
|
|
18879
|
-
borderRadius: "
|
|
18880
|
-
boxShadow: "0 8px
|
|
18881
|
-
background: "radial-gradient(circle at center, transparent
|
|
18913
|
+
borderRadius: "10%",
|
|
18914
|
+
boxShadow: "0 8px 12px rgba(0, 0, 0, 1), 0 4px 16px rgba(5,3, 1, 1)",
|
|
18915
|
+
background: "radial-gradient(circle at center, transparent 100%, rgba(255, 255, 255, 1) 100%, rgba(255, 255, 255, 1) 100%, transparent 100%)"
|
|
18882
18916
|
}
|
|
18883
18917
|
}
|
|
18884
18918
|
)
|
|
@@ -18935,7 +18969,7 @@ var Lens = ({
|
|
|
18935
18969
|
);
|
|
18936
18970
|
};
|
|
18937
18971
|
function CarouselSkeleton({ className }) {
|
|
18938
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full h-full lg:p-10 sm:p-4 p-2", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden rounded-lg h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full bg-muted rounded-lg overflow-hidden relative", children: [
|
|
18972
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full h-full lg:p-10 sm:p-4 p-2", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative overflow-hidden rounded-lg h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full h-full min-h-[300px] bg-muted rounded-lg overflow-hidden relative", children: [
|
|
18939
18973
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18940
18974
|
framerMotion.motion.div,
|
|
18941
18975
|
{
|
|
@@ -19007,7 +19041,6 @@ function CarouselBase({
|
|
|
19007
19041
|
containerClassName,
|
|
19008
19042
|
imageClassName,
|
|
19009
19043
|
width,
|
|
19010
|
-
height,
|
|
19011
19044
|
showControls = true,
|
|
19012
19045
|
showIndicators = true,
|
|
19013
19046
|
autoPlay = false,
|
|
@@ -19018,7 +19051,8 @@ function CarouselBase({
|
|
|
19018
19051
|
}) {
|
|
19019
19052
|
const isMobile = useIsMobile();
|
|
19020
19053
|
const [index, setIndex] = React32.useState(0);
|
|
19021
|
-
const
|
|
19054
|
+
const options = React32.useMemo(() => ({ loop: true }), []);
|
|
19055
|
+
const [emblaRef, emblaApi] = useEmblaCarousel__default.default(options);
|
|
19022
19056
|
const [isDownloading, setIsDownloading] = React32.useState(false);
|
|
19023
19057
|
const [downloadSuccess, setDownloadSuccess] = React32.useState(false);
|
|
19024
19058
|
React32.useEffect(() => {
|
|
@@ -19040,11 +19074,6 @@ function CarouselBase({
|
|
|
19040
19074
|
}, autoPlayInterval);
|
|
19041
19075
|
return () => clearInterval(interval);
|
|
19042
19076
|
}, [autoPlay, autoPlayInterval, items.length, emblaApi]);
|
|
19043
|
-
React32.useEffect(() => {
|
|
19044
|
-
if (emblaApi && index !== emblaApi.selectedScrollSnap()) {
|
|
19045
|
-
emblaApi.scrollTo(index);
|
|
19046
|
-
}
|
|
19047
|
-
}, [index, emblaApi]);
|
|
19048
19077
|
const handleDownload = async () => {
|
|
19049
19078
|
if (isDownloading) return;
|
|
19050
19079
|
setIsDownloading(true);
|
|
@@ -19077,7 +19106,7 @@ function CarouselBase({
|
|
|
19077
19106
|
animate: { opacity: 1 },
|
|
19078
19107
|
exit: { opacity: 0 },
|
|
19079
19108
|
transition: { duration: 0.3 },
|
|
19080
|
-
style: { width
|
|
19109
|
+
style: { width },
|
|
19081
19110
|
className: "h-full",
|
|
19082
19111
|
children: /* @__PURE__ */ jsxRuntime.jsx(CarouselSkeleton, { className })
|
|
19083
19112
|
},
|
|
@@ -19091,17 +19120,14 @@ function CarouselBase({
|
|
|
19091
19120
|
animate: { opacity: 1 },
|
|
19092
19121
|
transition: { duration: 0.4 },
|
|
19093
19122
|
className: cn("w-full lg:p-10 sm:p-4 p-2", className),
|
|
19094
|
-
style: { width
|
|
19095
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19096
|
-
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
ref: emblaRef,
|
|
19103
|
-
children: [
|
|
19104
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 w-full h-full min-w-0", children: isMobile || zoomEffect === "scale" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19123
|
+
style: { width },
|
|
19124
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative h-full", containerClassName), children: [
|
|
19125
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19126
|
+
"div",
|
|
19127
|
+
{
|
|
19128
|
+
ref: emblaRef,
|
|
19129
|
+
className: "overflow-hidden rounded-lg h-full cursor-grab active:cursor-grabbing",
|
|
19130
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 w-full h-full min-w-0", children: isMobile || zoomEffect === "scale" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19105
19131
|
ZoomImage,
|
|
19106
19132
|
{
|
|
19107
19133
|
src: item.url,
|
|
@@ -19133,154 +19159,166 @@ function CarouselBase({
|
|
|
19133
19159
|
),
|
|
19134
19160
|
draggable: false
|
|
19135
19161
|
}
|
|
19136
|
-
) }, item.id)) })
|
|
19137
|
-
|
|
19138
|
-
|
|
19162
|
+
) }, item.id)) })
|
|
19163
|
+
}
|
|
19164
|
+
),
|
|
19165
|
+
download && /* @__PURE__ */ jsxRuntime.jsx(
|
|
19166
|
+
framerMotion.motion.button,
|
|
19167
|
+
{
|
|
19168
|
+
onClick: handleDownload,
|
|
19169
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19170
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19171
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19172
|
+
className: cn(
|
|
19173
|
+
"absolute top-4 right-4 z-50 p-2 rounded-full text-white transition-colors border border-white/10",
|
|
19174
|
+
downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70"
|
|
19175
|
+
),
|
|
19176
|
+
title: "Download image",
|
|
19177
|
+
initial: false,
|
|
19178
|
+
animate: {
|
|
19179
|
+
scale: isDownloading ? 0.9 : 1,
|
|
19180
|
+
backgroundColor: downloadSuccess ? "rgb(34, 197, 94)" : "rgba(0, 0, 0, 0.5)"
|
|
19181
|
+
},
|
|
19182
|
+
whileHover: { scale: 1.05 },
|
|
19183
|
+
whileTap: { scale: 0.95 },
|
|
19184
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", initial: false, children: isDownloading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19185
|
+
framerMotion.motion.svg,
|
|
19139
19186
|
{
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19187
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19188
|
+
width: "20",
|
|
19189
|
+
height: "20",
|
|
19190
|
+
viewBox: "0 0 24 24",
|
|
19191
|
+
fill: "none",
|
|
19192
|
+
stroke: "currentColor",
|
|
19193
|
+
strokeWidth: "2",
|
|
19194
|
+
strokeLinecap: "round",
|
|
19195
|
+
strokeLinejoin: "round",
|
|
19196
|
+
animate: { rotate: 360 },
|
|
19197
|
+
transition: {
|
|
19198
|
+
repeat: Infinity,
|
|
19199
|
+
ease: "linear",
|
|
19200
|
+
duration: 1
|
|
19150
19201
|
},
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19166
|
-
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19172
|
-
|
|
19173
|
-
|
|
19174
|
-
|
|
19175
|
-
|
|
19176
|
-
|
|
19177
|
-
|
|
19178
|
-
|
|
19179
|
-
|
|
19180
|
-
|
|
19181
|
-
|
|
19182
|
-
|
|
19183
|
-
|
|
19184
|
-
|
|
19185
|
-
|
|
19186
|
-
|
|
19187
|
-
|
|
19188
|
-
|
|
19189
|
-
|
|
19190
|
-
}
|
|
19191
|
-
|
|
19192
|
-
|
|
19193
|
-
|
|
19194
|
-
|
|
19195
|
-
|
|
19196
|
-
|
|
19197
|
-
|
|
19198
|
-
|
|
19199
|
-
|
|
19200
|
-
|
|
19201
|
-
|
|
19202
|
-
|
|
19203
|
-
|
|
19204
|
-
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
children: [
|
|
19208
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
19209
|
-
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
19210
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
19211
|
-
]
|
|
19212
|
-
},
|
|
19213
|
-
"download"
|
|
19214
|
-
) })
|
|
19215
|
-
}
|
|
19216
|
-
),
|
|
19217
|
-
showControls && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19218
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19219
|
-
framerMotion.motion.button,
|
|
19220
|
-
{
|
|
19221
|
-
disabled: !emblaApi?.canScrollPrev(),
|
|
19222
|
-
onClick: () => emblaApi?.scrollPrev(),
|
|
19223
|
-
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
|
|
19202
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
19203
|
+
},
|
|
19204
|
+
"loading"
|
|
19205
|
+
) : downloadSuccess ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
19206
|
+
framerMotion.motion.svg,
|
|
19207
|
+
{
|
|
19208
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19209
|
+
width: "20",
|
|
19210
|
+
height: "20",
|
|
19211
|
+
viewBox: "0 0 24 24",
|
|
19212
|
+
fill: "none",
|
|
19213
|
+
stroke: "currentColor",
|
|
19214
|
+
strokeWidth: "2",
|
|
19215
|
+
strokeLinecap: "round",
|
|
19216
|
+
strokeLinejoin: "round",
|
|
19217
|
+
initial: { scale: 0.5, opacity: 0 },
|
|
19218
|
+
animate: { scale: 1, opacity: 1 },
|
|
19219
|
+
exit: { scale: 0.5, opacity: 0 },
|
|
19220
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" })
|
|
19221
|
+
},
|
|
19222
|
+
"success"
|
|
19223
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
19224
|
+
framerMotion.motion.svg,
|
|
19225
|
+
{
|
|
19226
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19227
|
+
width: "20",
|
|
19228
|
+
height: "20",
|
|
19229
|
+
viewBox: "0 0 24 24",
|
|
19230
|
+
fill: "none",
|
|
19231
|
+
stroke: "currentColor",
|
|
19232
|
+
strokeWidth: "2",
|
|
19233
|
+
strokeLinecap: "round",
|
|
19234
|
+
strokeLinejoin: "round",
|
|
19235
|
+
initial: { scale: 0.5, opacity: 0 },
|
|
19236
|
+
animate: { scale: 1, opacity: 1 },
|
|
19237
|
+
exit: { scale: 0.5, opacity: 0 },
|
|
19238
|
+
children: [
|
|
19239
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
19240
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
19241
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
|
|
19242
|
+
]
|
|
19243
|
+
},
|
|
19244
|
+
"download"
|
|
19245
|
+
) })
|
|
19246
|
+
}
|
|
19247
|
+
),
|
|
19248
|
+
showControls && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
19249
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19250
|
+
framerMotion.motion.button,
|
|
19251
|
+
{
|
|
19252
|
+
disabled: !emblaApi?.canScrollPrev(),
|
|
19253
|
+
onClick: () => emblaApi?.scrollPrev(),
|
|
19254
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19255
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19256
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19257
|
+
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
|
|
19224
19258
|
${!emblaApi?.canScrollPrev() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
|
|
19259
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19260
|
+
"svg",
|
|
19261
|
+
{
|
|
19262
|
+
className: "w-6 h-6",
|
|
19263
|
+
fill: "none",
|
|
19264
|
+
stroke: "currentColor",
|
|
19265
|
+
viewBox: "0 0 24 24",
|
|
19225
19266
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19226
|
-
"
|
|
19267
|
+
"path",
|
|
19227
19268
|
{
|
|
19228
|
-
|
|
19229
|
-
|
|
19230
|
-
|
|
19231
|
-
|
|
19232
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19233
|
-
"path",
|
|
19234
|
-
{
|
|
19235
|
-
strokeLinecap: "round",
|
|
19236
|
-
strokeLinejoin: "round",
|
|
19237
|
-
strokeWidth: 2,
|
|
19238
|
-
d: "M15 19l-7-7 7-7"
|
|
19239
|
-
}
|
|
19240
|
-
)
|
|
19269
|
+
strokeLinecap: "round",
|
|
19270
|
+
strokeLinejoin: "round",
|
|
19271
|
+
strokeWidth: 2,
|
|
19272
|
+
d: "M15 19l-7-7 7-7"
|
|
19241
19273
|
}
|
|
19242
19274
|
)
|
|
19243
19275
|
}
|
|
19244
|
-
)
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19276
|
+
)
|
|
19277
|
+
}
|
|
19278
|
+
),
|
|
19279
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19280
|
+
framerMotion.motion.button,
|
|
19281
|
+
{
|
|
19282
|
+
disabled: !emblaApi?.canScrollNext(),
|
|
19283
|
+
onClick: () => emblaApi?.scrollNext(),
|
|
19284
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19285
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19286
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19287
|
+
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
|
|
19251
19288
|
${!emblaApi?.canScrollNext() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
|
|
19289
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19290
|
+
"svg",
|
|
19291
|
+
{
|
|
19292
|
+
className: "w-6 h-6",
|
|
19293
|
+
fill: "none",
|
|
19294
|
+
stroke: "currentColor",
|
|
19295
|
+
viewBox: "0 0 24 24",
|
|
19252
19296
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19253
|
-
"
|
|
19297
|
+
"path",
|
|
19254
19298
|
{
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
19260
|
-
"path",
|
|
19261
|
-
{
|
|
19262
|
-
strokeLinecap: "round",
|
|
19263
|
-
strokeLinejoin: "round",
|
|
19264
|
-
strokeWidth: 2,
|
|
19265
|
-
d: "M9 5l7 7-7 7"
|
|
19266
|
-
}
|
|
19267
|
-
)
|
|
19299
|
+
strokeLinecap: "round",
|
|
19300
|
+
strokeLinejoin: "round",
|
|
19301
|
+
strokeWidth: 2,
|
|
19302
|
+
d: "M9 5l7 7-7 7"
|
|
19268
19303
|
}
|
|
19269
19304
|
)
|
|
19270
19305
|
}
|
|
19271
19306
|
)
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
)
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19307
|
+
}
|
|
19308
|
+
)
|
|
19309
|
+
] }),
|
|
19310
|
+
showIndicators && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2 z-50", children: items.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
19311
|
+
"button",
|
|
19312
|
+
{
|
|
19313
|
+
onClick: () => emblaApi?.scrollTo(i),
|
|
19314
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
19315
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
19316
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
19317
|
+
className: `h-2 rounded-full transition-all ${i === index ? "w-8 bg-white" : "w-2 bg-white/50"}`
|
|
19318
|
+
},
|
|
19319
|
+
i
|
|
19320
|
+
)) })
|
|
19321
|
+
] }) })
|
|
19284
19322
|
},
|
|
19285
19323
|
"carousel-content"
|
|
19286
19324
|
) });
|