@mlw-packages/react-components 1.9.10 → 1.9.12

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.js CHANGED
@@ -43,6 +43,7 @@ var core = require('@dnd-kit/core');
43
43
  var utilities = require('@dnd-kit/utilities');
44
44
  var reactRadioGroup = require('@radix-ui/react-radio-group');
45
45
  var recharts = require('recharts');
46
+ var useEmblaCarousel = require('embla-carousel-react');
46
47
 
47
48
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
48
49
 
@@ -84,6 +85,7 @@ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
84
85
  var NavigationMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(NavigationMenuPrimitive);
85
86
  var ContextMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(ContextMenuPrimitive);
86
87
  var ptBR3__default = /*#__PURE__*/_interopDefault(ptBR3);
88
+ var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
87
89
 
88
90
  var __create = Object.create;
89
91
  var __defProp = Object.defineProperty;
@@ -3755,7 +3757,7 @@ var FileUploader = React32__namespace.forwardRef(
3755
3757
  showPreview = true,
3756
3758
  dropzoneText = "Arraste arquivos aqui ou clique para selecionar",
3757
3759
  dropzoneSubtext,
3758
- animate: animate2 = true,
3760
+ animate = true,
3759
3761
  ...props
3760
3762
  }, ref) => {
3761
3763
  const [isDragging, setIsDragging] = React32__namespace.useState(false);
@@ -3963,7 +3965,7 @@ var FileUploader = React32__namespace.forwardRef(
3963
3965
  framerMotion.motion.p,
3964
3966
  {
3965
3967
  className: "mb-2 text-base font-semibold text-foreground",
3966
- initial: animate2 ? { opacity: 0, y: -10 } : false,
3968
+ initial: animate ? { opacity: 0, y: -10 } : false,
3967
3969
  animate: { opacity: 1, y: 0 },
3968
3970
  transition: { delay: 0.1 },
3969
3971
  children: dropzoneText
@@ -3973,7 +3975,7 @@ var FileUploader = React32__namespace.forwardRef(
3973
3975
  framerMotion.motion.p,
3974
3976
  {
3975
3977
  className: "text-sm text-muted-foreground",
3976
- initial: animate2 ? { opacity: 0, y: -10 } : false,
3978
+ initial: animate ? { opacity: 0, y: -10 } : false,
3977
3979
  animate: { opacity: 1, y: 0 },
3978
3980
  transition: { delay: 0.2 },
3979
3981
  children: defaultSubtext
@@ -4017,7 +4019,7 @@ var FileUploader = React32__namespace.forwardRef(
4017
4019
  framerMotion.motion.div,
4018
4020
  {
4019
4021
  className: "mt-6 w-full",
4020
- initial: animate2 ? { opacity: 0, y: 10 } : false,
4022
+ initial: animate ? { opacity: 0, y: 10 } : false,
4021
4023
  animate: { opacity: 1, y: 0 },
4022
4024
  transition: { delay: 0.3 },
4023
4025
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -4032,7 +4034,7 @@ var FileUploader = React32__namespace.forwardRef(
4032
4034
  framerMotion.motion.div,
4033
4035
  {
4034
4036
  layout: true,
4035
- initial: animate2 ? { opacity: 0, x: -20 } : false,
4037
+ initial: animate ? { opacity: 0, x: -20 } : false,
4036
4038
  animate: { opacity: 1, x: 0 },
4037
4039
  exit: {
4038
4040
  opacity: 0,
@@ -4040,7 +4042,7 @@ var FileUploader = React32__namespace.forwardRef(
4040
4042
  transition: { duration: 0.2 }
4041
4043
  },
4042
4044
  transition: {
4043
- delay: animate2 ? index * 0.05 : 0,
4045
+ delay: animate ? index * 0.05 : 0,
4044
4046
  layout: { duration: 0.2 }
4045
4047
  },
4046
4048
  className: cn(
@@ -5738,7 +5740,7 @@ var sheetVariants = classVarianceAuthority.cva(
5738
5740
  top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
5739
5741
  bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
5740
5742
  left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
5741
- right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
5743
+ right: "inset-y-0 right-0 h-full w-3/4 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
5742
5744
  }
5743
5745
  },
5744
5746
  defaultVariants: {
@@ -16524,11 +16526,11 @@ var NoData = ({
16524
16526
  ),
16525
16527
  style: {
16526
16528
  "--pl": `${paddingLeft}px`,
16527
- "--svg-h": typeof height === "number" ? `${height}px` : String(height)
16529
+ ...typeof height === "number" ? { height } : {}
16528
16530
  },
16529
16531
  role: "img",
16530
16532
  "aria-label": message,
16531
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-[900px] relative", children: [
16533
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] p-6 h-full", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-[900px] relative", children: [
16532
16534
  /* @__PURE__ */ jsxRuntime.jsxs(
16533
16535
  "svg",
16534
16536
  {
@@ -17263,11 +17265,30 @@ function useOpenTooltipForPeriod({
17263
17265
  );
17264
17266
  }
17265
17267
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
17268
+ function ChartWrapper({
17269
+ className,
17270
+ children,
17271
+ wrapperRef
17272
+ }) {
17273
+ const cls = className ?? "";
17274
+ const hasExplicitSizing = /\bh-/.test(cls) || /\bflex-1\b/.test(cls);
17275
+ return /* @__PURE__ */ jsxRuntime.jsx(
17276
+ "div",
17277
+ {
17278
+ ref: wrapperRef,
17279
+ className: cn(
17280
+ "w-full overflow-hidden min-w-0 rounded-lg border-border",
17281
+ !hasExplicitSizing && "h-[550px]",
17282
+ className
17283
+ ),
17284
+ children
17285
+ }
17286
+ );
17287
+ }
17266
17288
  var Chart = ({
17267
17289
  data,
17268
17290
  series,
17269
17291
  className,
17270
- height = 350,
17271
17292
  width = "100%",
17272
17293
  colors: colors2 = DEFAULT_COLORS2,
17273
17294
  gridColor,
@@ -17299,19 +17320,7 @@ var Chart = ({
17299
17320
  timeSeries,
17300
17321
  timeSeriesLegend,
17301
17322
  customLegend
17302
- // horizontal removido
17303
- // orderBy removido
17304
17323
  }) => {
17305
- const usesFullHeight = typeof height === "string" && (height === "100%" || height === "100vh") || typeof className === "string" && /\bh-full\b/.test(className || "");
17306
- const responsiveHeight = usesFullHeight ? "100%" : height;
17307
- const wrapperClass = cn(
17308
- "w-full min-w-0 rounded-lg border-border",
17309
- className,
17310
- "overflow-hidden"
17311
- );
17312
- const wrapperStyle = usesFullHeight ? void 0 : {
17313
- height: typeof responsiveHeight === "number" ? `${responsiveHeight}px` : responsiveHeight
17314
- };
17315
17324
  const { xAxisConfig, mapperConfig } = React32.useMemo(() => {
17316
17325
  return fnSmartConfig({ xAxis, data, labelMap });
17317
17326
  }, [data, xAxis, labelMap]);
@@ -17455,393 +17464,419 @@ var Chart = ({
17455
17464
  maxTooltips,
17456
17465
  effectiveChartWidth
17457
17466
  });
17458
- const legendSpace = showLegend ? 44 : 0;
17459
- const xAxisLabelSpace = xAxisLabel ? 18 : 0;
17460
- const brushSpace = timeSeriesConfig?.height ? 200 : 0;
17461
- const bottomMargin = 10 + legendSpace + xAxisLabelSpace + brushSpace;
17462
17467
  if (!data && !isLoading) return null;
17463
17468
  if (isLoading) {
17464
- return /* @__PURE__ */ jsxRuntime.jsx(
17469
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { className, children: /* @__PURE__ */ jsxRuntime.jsx(
17465
17470
  NoData_default,
17466
17471
  {
17467
17472
  title,
17468
17473
  isLoading: true,
17469
17474
  loadingMessage: typeof title === "string" ? `${title} \u2014 Carregando` : "Carregando",
17470
17475
  paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17471
- height
17476
+ height: "100%"
17472
17477
  }
17473
- );
17478
+ ) });
17474
17479
  }
17475
17480
  if (Array.isArray(data) && data.length === 0) {
17476
- return /* @__PURE__ */ jsxRuntime.jsx(
17481
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { className, children: /* @__PURE__ */ jsxRuntime.jsx(
17477
17482
  NoData_default,
17478
17483
  {
17479
17484
  title,
17480
17485
  paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17481
- height
17486
+ height: "100%"
17482
17487
  }
17483
- );
17488
+ ) });
17484
17489
  }
17485
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrapperRef, className: wrapperClass, style: wrapperStyle, children: [
17486
- /* @__PURE__ */ jsxRuntime.jsxs(
17487
- "div",
17488
- {
17489
- className: "rounded-lg bg-card relative w-full max-w-full min-w-0 py-1",
17490
- style: usesFullHeight ? { height: "100%" } : void 0,
17491
- children: [
17492
- /* @__PURE__ */ jsxRuntime.jsx(
17493
- ChartHeader,
17494
- {
17495
- title,
17496
- titlePosition,
17497
- HORIZONTAL_PADDING_CLASS,
17498
- customLegend,
17499
- data,
17500
- allKeys,
17501
- processedData,
17502
- finalColors,
17503
- mapperConfig,
17504
- finalValueFormatter,
17505
- formatBR
17506
- }
17490
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17491
+ /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { className, wrapperRef, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full w-full flex flex-col rounded-lg bg-card py-1 overflow-hidden", children: [
17492
+ /* @__PURE__ */ jsxRuntime.jsx(
17493
+ ChartHeader,
17494
+ {
17495
+ title,
17496
+ titlePosition,
17497
+ HORIZONTAL_PADDING_CLASS,
17498
+ customLegend,
17499
+ data,
17500
+ allKeys,
17501
+ processedData,
17502
+ finalColors,
17503
+ mapperConfig,
17504
+ finalValueFormatter,
17505
+ formatBR
17506
+ }
17507
+ ),
17508
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsx(
17509
+ ChartControls,
17510
+ {
17511
+ allKeys,
17512
+ mapperConfig,
17513
+ finalColors,
17514
+ highlightedSeries,
17515
+ toggleHighlight,
17516
+ showOnlyHighlighted,
17517
+ setShowOnlyHighlighted,
17518
+ highlightedSeriesSize: highlightedSeries.size,
17519
+ clearHighlights,
17520
+ enableHighlights,
17521
+ enableShowOnly,
17522
+ enablePeriodsDropdown,
17523
+ enableDraggableTooltips,
17524
+ processedData,
17525
+ onOpenPeriod: openTooltipForPeriod,
17526
+ rightOffset: finalChartRightMargin,
17527
+ activePeriods,
17528
+ containerClass: cn("flex items-center gap-2", teste),
17529
+ containerWidth: chartInnerWidth
17530
+ }
17531
+ ),
17532
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx(
17533
+ "div",
17534
+ {
17535
+ className: cn(
17536
+ "w-full flex justify-end mb-2",
17537
+ HORIZONTAL_PADDING_CLASS
17507
17538
  ),
17508
- allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsx(
17509
- ChartControls,
17539
+ style: {
17540
+ paddingRight: `${finalChartRightMargin}px`,
17541
+ maxWidth: `${chartInnerWidth}px`
17542
+ },
17543
+ children: /* @__PURE__ */ jsxRuntime.jsx(
17544
+ PeriodsDropdown_default,
17510
17545
  {
17511
- allKeys,
17512
- mapperConfig,
17513
- finalColors,
17514
- highlightedSeries,
17515
- toggleHighlight,
17516
- showOnlyHighlighted,
17517
- setShowOnlyHighlighted,
17518
- highlightedSeriesSize: highlightedSeries.size,
17519
- clearHighlights,
17520
- enableHighlights,
17521
- enableShowOnly,
17522
- enablePeriodsDropdown,
17523
- enableDraggableTooltips,
17524
17546
  processedData,
17525
17547
  onOpenPeriod: openTooltipForPeriod,
17526
- rightOffset: finalChartRightMargin,
17527
- activePeriods,
17528
- containerClass: cn("flex items-center gap-2", teste),
17529
- containerWidth: chartInnerWidth
17548
+ rightOffset: finalChartRightMargin
17530
17549
  }
17531
- ),
17532
- !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx(
17533
- "div",
17534
- {
17535
- className: cn(
17536
- "w-full flex justify-end mb-2",
17537
- HORIZONTAL_PADDING_CLASS
17538
- ),
17539
- style: {
17540
- paddingRight: `${finalChartRightMargin}px`,
17541
- maxWidth: `${chartInnerWidth}px`
17542
- },
17543
- children: /* @__PURE__ */ jsxRuntime.jsx(
17544
- PeriodsDropdown_default,
17550
+ )
17551
+ }
17552
+ ),
17553
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 relative overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(
17554
+ recharts.ComposedChart,
17555
+ {
17556
+ data: processedData,
17557
+ margin: {
17558
+ top: 10,
17559
+ right: finalChartRightMargin,
17560
+ left: finalChartLeftMargin,
17561
+ bottom: 10
17562
+ },
17563
+ onClick: handleChartClick,
17564
+ children: [
17565
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17566
+ const key = s.key;
17567
+ const color = finalColors[key];
17568
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17569
+ "linearGradient",
17545
17570
  {
17546
- processedData,
17547
- onOpenPeriod: openTooltipForPeriod,
17548
- rightOffset: finalChartRightMargin
17549
- }
17550
- )
17551
- }
17552
- ),
17553
- /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: responsiveHeight, children: /* @__PURE__ */ jsxRuntime.jsxs(
17554
- recharts.ComposedChart,
17555
- {
17556
- data: processedData,
17557
- margin: {
17558
- top: 10,
17559
- right: finalChartRightMargin,
17560
- left: finalChartLeftMargin,
17561
- bottom: bottomMargin
17562
- },
17563
- onClick: handleChartClick,
17564
- children: [
17565
- /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17566
- const key = s.key;
17567
- const color = finalColors[key];
17568
- return /* @__PURE__ */ jsxRuntime.jsxs(
17569
- "linearGradient",
17570
- {
17571
- id: `gradient-${key}`,
17572
- x1: "0",
17573
- y1: "0",
17574
- x2: "0",
17575
- y2: "0.8",
17576
- children: [
17577
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.8 }),
17578
- /* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "90%", stopColor: color, stopOpacity: 0.1 })
17579
- ]
17580
- },
17581
- `gradient-${key}`
17582
- );
17583
- }) }),
17584
- showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17585
- recharts.CartesianGrid,
17586
- {
17587
- strokeDasharray: "3 3",
17588
- stroke: gridColor || "hsl(var(--muted-foreground))",
17589
- opacity: 0.5
17590
- }
17591
- ),
17592
- /* @__PURE__ */ jsxRuntime.jsx(
17593
- recharts.XAxis,
17594
- {
17595
- dataKey: xAxisConfig.dataKey,
17596
- stroke: "hsl(var(--muted-foreground))",
17597
- fontSize: 12,
17598
- tickLine: false,
17599
- axisLine: false,
17600
- tickFormatter: (value) => {
17601
- if (categoryFormatter)
17602
- return categoryFormatter(value);
17603
- if (xAxisConfig.valueFormatter)
17604
- return xAxisConfig.valueFormatter(value);
17605
- return String(value ?? "");
17606
- },
17607
- label: xAxisLabel ? {
17608
- value: xAxisLabel,
17609
- position: "insideBottomRight",
17610
- offset: -5,
17611
- style: {
17612
- fontSize: 12,
17613
- fill: "hsl(var(--muted-foreground))",
17614
- fontWeight: 500
17571
+ id: `gradient-${key}`,
17572
+ x1: "0",
17573
+ y1: "0",
17574
+ x2: "0",
17575
+ y2: "0.8",
17576
+ children: [
17577
+ /* @__PURE__ */ jsxRuntime.jsx(
17578
+ "stop",
17579
+ {
17580
+ offset: "0%",
17581
+ stopColor: color,
17582
+ stopOpacity: 0.8
17583
+ }
17584
+ ),
17585
+ /* @__PURE__ */ jsxRuntime.jsx(
17586
+ "stop",
17587
+ {
17588
+ offset: "90%",
17589
+ stopColor: color,
17590
+ stopOpacity: 0.1
17615
17591
  }
17616
- } : void 0
17592
+ )
17593
+ ]
17594
+ },
17595
+ `gradient-${key}`
17596
+ );
17597
+ }) }),
17598
+ showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17599
+ recharts.CartesianGrid,
17600
+ {
17601
+ strokeDasharray: "3 3",
17602
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17603
+ opacity: 0.5
17604
+ }
17605
+ ),
17606
+ /* @__PURE__ */ jsxRuntime.jsx(
17607
+ recharts.XAxis,
17608
+ {
17609
+ dataKey: xAxisConfig.dataKey,
17610
+ stroke: "hsl(var(--muted-foreground))",
17611
+ fontSize: 12,
17612
+ tickLine: false,
17613
+ axisLine: false,
17614
+ tickFormatter: (value) => {
17615
+ if (categoryFormatter)
17616
+ return categoryFormatter(value);
17617
+ if (xAxisConfig.valueFormatter)
17618
+ return xAxisConfig.valueFormatter(
17619
+ value
17620
+ );
17621
+ return String(value ?? "");
17622
+ },
17623
+ label: xAxisLabel ? {
17624
+ value: xAxisLabel,
17625
+ position: "insideBottomRight",
17626
+ offset: -5,
17627
+ style: {
17628
+ fontSize: 12,
17629
+ fill: "hsl(var(--muted-foreground))",
17630
+ fontWeight: 500
17617
17631
  }
17618
- ),
17619
- /* @__PURE__ */ jsxRuntime.jsx(
17620
- recharts.YAxis,
17621
- {
17622
- yAxisId: "left",
17623
- width: yAxisTickWidth,
17624
- stroke: "hsl(var(--muted-foreground))",
17632
+ } : void 0
17633
+ }
17634
+ ),
17635
+ /* @__PURE__ */ jsxRuntime.jsx(
17636
+ recharts.YAxis,
17637
+ {
17638
+ yAxisId: "left",
17639
+ width: yAxisTickWidth,
17640
+ stroke: "hsl(var(--muted-foreground))",
17641
+ fontSize: 12,
17642
+ tickLine: false,
17643
+ axisLine: false,
17644
+ tickFormatter: yTickFormatter,
17645
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17646
+ tickCount: 6,
17647
+ label: yAxisLabel ? {
17648
+ value: yAxisLabel,
17649
+ angle: -90,
17650
+ position: "left",
17651
+ dx: leftYAxisLabelDx,
17652
+ style: {
17625
17653
  fontSize: 12,
17626
- tickLine: false,
17627
- axisLine: false,
17628
- tickFormatter: yTickFormatter,
17629
- domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17630
- tickCount: 6,
17631
- label: yAxisLabel ? {
17632
- value: yAxisLabel,
17633
- angle: -90,
17634
- position: "left",
17635
- dx: leftYAxisLabelDx,
17636
- style: {
17637
- fontSize: 12,
17638
- fill: "hsl(var(--muted-foreground))",
17639
- fontWeight: 500,
17640
- textAnchor: "middle"
17641
- }
17642
- } : void 0
17654
+ fill: "hsl(var(--muted-foreground))",
17655
+ fontWeight: 500,
17656
+ textAnchor: "middle"
17643
17657
  }
17644
- ),
17645
- rightKeys.length > 0 && (() => {
17646
- const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17647
- biaxialConfigNormalized,
17648
- yTickFormatter,
17649
- finalColors
17650
- );
17651
- return /* @__PURE__ */ jsxRuntime.jsx(
17652
- recharts.YAxis,
17653
- {
17654
- yAxisId: "right",
17655
- width: finalChartRightMargin,
17656
- orientation: "right",
17657
- stroke: "hsl(var(--muted-foreground))",
17658
+ } : void 0
17659
+ }
17660
+ ),
17661
+ rightKeys.length > 0 && (() => {
17662
+ const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17663
+ biaxialConfigNormalized,
17664
+ yTickFormatter,
17665
+ finalColors
17666
+ );
17667
+ return /* @__PURE__ */ jsxRuntime.jsx(
17668
+ recharts.YAxis,
17669
+ {
17670
+ yAxisId: "right",
17671
+ width: finalChartRightMargin,
17672
+ orientation: "right",
17673
+ stroke: "hsl(var(--muted-foreground))",
17674
+ fontSize: 12,
17675
+ tickLine: false,
17676
+ axisLine: false,
17677
+ tick: { fill: rightAxisColor },
17678
+ tickFormatter: rightTickFormatter,
17679
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17680
+ tickCount: 6,
17681
+ label: biaxialConfigNormalized?.label ? {
17682
+ value: biaxialConfigNormalized.label,
17683
+ angle: -90,
17684
+ position: "right",
17685
+ dx: rightYAxisLabelDx,
17686
+ style: {
17658
17687
  fontSize: 12,
17659
- tickLine: false,
17660
- axisLine: false,
17661
- tick: { fill: rightAxisColor },
17662
- tickFormatter: rightTickFormatter,
17663
- domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17664
- tickCount: 6,
17665
- label: biaxialConfigNormalized?.label ? {
17666
- value: biaxialConfigNormalized.label,
17667
- angle: -90,
17668
- position: "right",
17669
- dx: rightYAxisLabelDx,
17670
- style: {
17671
- fontSize: 12,
17672
- fill: "hsl(var(--muted-foreground))",
17673
- fontWeight: 500,
17674
- textAnchor: "middle"
17675
- }
17676
- } : void 0
17688
+ fill: "hsl(var(--muted-foreground))",
17689
+ fontWeight: 500,
17690
+ textAnchor: "middle"
17677
17691
  }
17678
- );
17679
- })(),
17680
- showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17681
- recharts.Tooltip,
17692
+ } : void 0
17693
+ }
17694
+ );
17695
+ })(),
17696
+ showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17697
+ recharts.Tooltip,
17698
+ {
17699
+ content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17700
+ TooltipWithTotal_default,
17682
17701
  {
17683
- content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17684
- TooltipWithTotal_default,
17685
- {
17686
- finalColors,
17687
- valueFormatter: finalValueFormatter,
17688
- categoryFormatter,
17689
- periodLabel
17690
- }
17691
- ) : /* @__PURE__ */ jsxRuntime.jsx(
17692
- TooltipSimple_default,
17693
- {
17694
- finalColors,
17695
- valueFormatter: finalValueFormatter,
17696
- categoryFormatter,
17697
- periodLabel
17698
- }
17699
- ),
17700
- cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17702
+ finalColors,
17703
+ valueFormatter: finalValueFormatter,
17704
+ categoryFormatter,
17705
+ periodLabel
17701
17706
  }
17702
- ),
17703
- showLegend && /* @__PURE__ */ jsxRuntime.jsx(
17704
- recharts.Legend,
17707
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
17708
+ TooltipSimple_default,
17705
17709
  {
17706
- iconSize: 12,
17707
- formatter: (value) => {
17708
- return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17709
- value,
17710
- mapperConfig,
17711
- labelMap,
17712
- legendUppercase
17713
- ) });
17714
- }
17710
+ finalColors,
17711
+ valueFormatter: finalValueFormatter,
17712
+ categoryFormatter,
17713
+ periodLabel
17715
17714
  }
17716
17715
  ),
17717
- seriesOrder.map((s) => {
17718
- if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17719
- return null;
17720
- const { label, color, key } = fnBuildConfigData(
17721
- s,
17722
- mapperConfig,
17723
- labelMap,
17724
- finalColors,
17725
- rightKeys,
17726
- biaxialConfigNormalized
17727
- );
17728
- if (s.type === "bar") {
17729
- return /* @__PURE__ */ jsxRuntime.jsx(
17730
- recharts.Bar,
17716
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17717
+ }
17718
+ ),
17719
+ showLegend && /* @__PURE__ */ jsxRuntime.jsx(
17720
+ recharts.Legend,
17721
+ {
17722
+ iconSize: 12,
17723
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17724
+ value,
17725
+ mapperConfig,
17726
+ labelMap,
17727
+ legendUppercase
17728
+ ) })
17729
+ }
17730
+ ),
17731
+ seriesOrder.map((s) => {
17732
+ if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17733
+ return null;
17734
+ const { label, color, key } = fnBuildConfigData(
17735
+ s,
17736
+ mapperConfig,
17737
+ labelMap,
17738
+ finalColors,
17739
+ rightKeys,
17740
+ biaxialConfigNormalized
17741
+ );
17742
+ if (s.type === "bar") {
17743
+ return /* @__PURE__ */ jsxRuntime.jsx(
17744
+ recharts.Bar,
17745
+ {
17746
+ dataKey: key,
17747
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17748
+ name: label,
17749
+ fill: color,
17750
+ radius: [4, 4, 0, 0],
17751
+ onClick: handleBarClick,
17752
+ className: "cursor-pointer",
17753
+ style: { opacity: getSeriesOpacity(key) },
17754
+ activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17755
+ recharts.Rectangle,
17731
17756
  {
17732
- dataKey: key,
17733
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17734
- name: label,
17735
17757
  fill: color,
17736
- radius: [4, 4, 0, 0],
17737
- onClick: handleBarClick,
17738
- className: "cursor-pointer",
17739
- style: { opacity: getSeriesOpacity(key) },
17740
- activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17741
- recharts.Rectangle,
17742
- {
17743
- fill: color,
17744
- stroke: color,
17745
- strokeWidth: 2,
17746
- opacity: 0.8
17747
- }
17748
- ),
17749
- children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17750
- recharts.LabelList,
17751
- {
17752
- dataKey: key,
17753
- content: (props) => {
17754
- if (!fnContentLabelList(props)) return null;
17755
- const inside = renderInsideBarLabel(
17756
- color,
17757
- finalValueFormatter
17758
- );
17759
- return inside(props);
17760
- },
17761
- offset: 0
17762
- }
17763
- ) : null
17764
- },
17765
- `bar-${key}`
17766
- );
17767
- }
17768
- if (s.type === "line") {
17769
- return /* @__PURE__ */ jsxRuntime.jsx(
17770
- recharts.Line,
17771
- {
17772
- dataKey: key,
17773
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17774
- name: label,
17775
17758
  stroke: color,
17776
17759
  strokeWidth: 2,
17777
- dot: { r: 3 },
17778
- activeDot: { r: 6 },
17779
- onClick: handleSeriesClick,
17780
- className: "cursor-pointer pointer-events-auto",
17781
- style: { opacity: getSeriesOpacity(key) },
17782
- children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17783
- recharts.LabelList,
17784
- {
17785
- dataKey: key,
17786
- position: "top",
17787
- content: pillLabelRenderer_default(
17788
- color,
17789
- "filled",
17790
- (props) => formatLinePercentage(props.value)
17791
- ),
17792
- offset: 14
17793
- }
17794
- ) : null
17795
- },
17796
- `line-${key}`
17797
- );
17798
- }
17799
- if (s.type === "area") {
17800
- return /* @__PURE__ */ jsxRuntime.jsx(
17801
- recharts.Area,
17760
+ opacity: 0.8
17761
+ }
17762
+ ),
17763
+ children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17764
+ recharts.LabelList,
17802
17765
  {
17803
- type: "monotone",
17804
17766
  dataKey: key,
17805
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17806
- name: label,
17807
- stroke: color,
17808
- fill: `url(#gradient-${key})`,
17809
- fillOpacity: 1,
17810
- strokeWidth: 2,
17811
- onClick: handleSeriesClick,
17812
- className: "cursor-pointer pointer-events-auto",
17813
- style: { opacity: getSeriesOpacity(key) },
17814
- activeDot: {
17815
- r: 6,
17816
- fill: color,
17817
- stroke: "hsl(var(--background))",
17818
- strokeWidth: 2
17767
+ content: (props) => {
17768
+ if (!fnContentLabelList(props)) return null;
17769
+ const inside = renderInsideBarLabel(
17770
+ color,
17771
+ finalValueFormatter
17772
+ );
17773
+ return inside(props);
17819
17774
  },
17820
- children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17821
- recharts.LabelList,
17822
- {
17823
- dataKey: key,
17824
- position: "top",
17825
- content: pillLabelRenderer_default(
17826
- color,
17827
- "soft",
17828
- finalValueFormatter
17829
- ),
17830
- offset: 12
17831
- }
17832
- ) : null
17833
- },
17834
- `area-${key}`
17835
- );
17836
- }
17837
- return null;
17838
- })
17839
- ]
17840
- }
17841
- ) })
17842
- ]
17843
- }
17844
- ),
17775
+ offset: 0
17776
+ }
17777
+ ) : null
17778
+ },
17779
+ `bar-${key}`
17780
+ );
17781
+ }
17782
+ if (s.type === "line") {
17783
+ return /* @__PURE__ */ jsxRuntime.jsx(
17784
+ recharts.Line,
17785
+ {
17786
+ dataKey: key,
17787
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17788
+ name: label,
17789
+ stroke: color,
17790
+ strokeWidth: 2,
17791
+ dot: { r: 3 },
17792
+ activeDot: { r: 6 },
17793
+ onClick: handleSeriesClick,
17794
+ className: "cursor-pointer pointer-events-auto",
17795
+ style: { opacity: getSeriesOpacity(key) },
17796
+ children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17797
+ recharts.LabelList,
17798
+ {
17799
+ dataKey: key,
17800
+ position: "top",
17801
+ content: pillLabelRenderer_default(
17802
+ color,
17803
+ "filled",
17804
+ (props) => formatLinePercentage(props.value)
17805
+ ),
17806
+ offset: 14
17807
+ }
17808
+ ) : null
17809
+ },
17810
+ `line-${key}`
17811
+ );
17812
+ }
17813
+ if (s.type === "area") {
17814
+ return /* @__PURE__ */ jsxRuntime.jsx(
17815
+ recharts.Area,
17816
+ {
17817
+ type: "monotone",
17818
+ dataKey: key,
17819
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17820
+ name: label,
17821
+ stroke: color,
17822
+ fill: `url(#gradient-${key})`,
17823
+ fillOpacity: 1,
17824
+ strokeWidth: 2,
17825
+ onClick: handleSeriesClick,
17826
+ className: "cursor-pointer pointer-events-auto",
17827
+ style: { opacity: getSeriesOpacity(key) },
17828
+ activeDot: {
17829
+ r: 6,
17830
+ fill: color,
17831
+ stroke: "hsl(var(--background))",
17832
+ strokeWidth: 2
17833
+ },
17834
+ children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17835
+ recharts.LabelList,
17836
+ {
17837
+ dataKey: key,
17838
+ position: "top",
17839
+ content: pillLabelRenderer_default(
17840
+ color,
17841
+ "soft",
17842
+ finalValueFormatter
17843
+ ),
17844
+ offset: 12
17845
+ }
17846
+ ) : null
17847
+ },
17848
+ `area-${key}`
17849
+ );
17850
+ }
17851
+ return null;
17852
+ })
17853
+ ]
17854
+ }
17855
+ ) }) }),
17856
+ timeSeriesConfig && /* @__PURE__ */ jsxRuntime.jsx(
17857
+ Brush_default,
17858
+ {
17859
+ legend: timeSeriesLegend,
17860
+ data,
17861
+ startIndex,
17862
+ endIndex,
17863
+ onMouseDown: handleMouseDown,
17864
+ brushRef,
17865
+ xAxisKey: xAxisConfig.dataKey,
17866
+ seriesOrder,
17867
+ finalColors,
17868
+ brushHeight: timeSeriesConfig.height,
17869
+ brushColor: timeSeriesConfig.brushColor,
17870
+ miniChartOpacity: timeSeriesConfig.miniChartOpacity,
17871
+ showGrid,
17872
+ gridColor,
17873
+ margin: {
17874
+ left: finalChartLeftMargin,
17875
+ right: finalChartRightMargin
17876
+ }
17877
+ }
17878
+ )
17879
+ ] }) }),
17845
17880
  enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
17846
17881
  DraggableTooltip_default,
17847
17882
  {
@@ -17875,29 +17910,6 @@ var Chart = ({
17875
17910
  position: "top-center",
17876
17911
  variant: "floating"
17877
17912
  }
17878
- ),
17879
- timeSeriesConfig && /* @__PURE__ */ jsxRuntime.jsx(
17880
- Brush_default,
17881
- {
17882
- legend: timeSeriesLegend,
17883
- data,
17884
- startIndex,
17885
- endIndex,
17886
- onMouseDown: handleMouseDown,
17887
- brushRef,
17888
- xAxisKey: xAxisConfig.dataKey,
17889
- seriesOrder,
17890
- finalColors,
17891
- brushHeight: timeSeriesConfig.height,
17892
- brushColor: timeSeriesConfig.brushColor,
17893
- miniChartOpacity: timeSeriesConfig.miniChartOpacity,
17894
- showGrid,
17895
- gridColor,
17896
- margin: {
17897
- left: finalChartLeftMargin,
17898
- right: finalChartRightMargin
17899
- }
17900
- }
17901
17913
  )
17902
17914
  ] });
17903
17915
  };
@@ -18392,9 +18404,7 @@ var HorizontalChart_default = HorizontalChart;
18392
18404
  var TimeSeries = ({
18393
18405
  data,
18394
18406
  xAxis,
18395
- chartHeight = 350,
18396
- height,
18397
- brushHeight,
18407
+ brushHeight = 60,
18398
18408
  className,
18399
18409
  start,
18400
18410
  end,
@@ -18406,21 +18416,21 @@ var TimeSeries = ({
18406
18416
  miniChartOpacity = 0.2,
18407
18417
  ...rest
18408
18418
  }) => {
18409
- const brushHeightValue = brushHeight ?? height ?? 60;
18410
18419
  const startIndex = defaultStartIndex ?? start ?? 0;
18411
18420
  const endIndex = defaultEndIndex ?? end;
18412
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full flex flex-col", className), children: /* @__PURE__ */ jsxRuntime.jsx(
18421
+ const hasExplicitHeight = /\bh-/.test(className ?? "");
18422
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full flex flex-col overflow-hidden", className), children: /* @__PURE__ */ jsxRuntime.jsx(
18413
18423
  Chart_default,
18414
18424
  {
18415
18425
  ...rest,
18416
18426
  data,
18417
18427
  xAxis,
18418
- height: chartHeight + brushHeightValue + 40,
18428
+ className: hasExplicitHeight ? "flex-1 min-h-0" : void 0,
18419
18429
  timeSeries: {
18420
18430
  start: startIndex,
18421
18431
  end: endIndex,
18422
18432
  onRangeChange,
18423
- height: brushHeightValue,
18433
+ height: brushHeight,
18424
18434
  brushColor,
18425
18435
  brushStroke,
18426
18436
  miniChartOpacity
@@ -18647,58 +18657,472 @@ function Leaderboard({
18647
18657
  }
18648
18658
  );
18649
18659
  }
18650
- function CarouselBase({
18651
- items,
18652
- className,
18653
- containerClassName,
18654
- imageClassName,
18655
- width,
18656
- height = "400px",
18657
- showControls = true,
18658
- showIndicators = true,
18659
- autoPlay = false,
18660
- autoPlayInterval = 3e3,
18661
- springConfig = {
18662
- stiffness: 300,
18663
- damping: 30
18660
+ var ZoomImage = React32__namespace.forwardRef(
18661
+ ({
18662
+ className,
18663
+ src,
18664
+ alt,
18665
+ maxZoom = 2,
18666
+ transitionDuration = 0.3,
18667
+ borderRadius = 12,
18668
+ imageClassName,
18669
+ ...props
18670
+ }, ref) => {
18671
+ const mouseX = framerMotion.useMotionValue(50);
18672
+ const mouseY = framerMotion.useMotionValue(50);
18673
+ const zoomLevel = framerMotion.useMotionValue(1);
18674
+ const springConfig = { damping: 20, stiffness: 150, mass: 0.5 };
18675
+ const smoothMouseX = framerMotion.useSpring(mouseX, springConfig);
18676
+ const smoothMouseY = framerMotion.useSpring(mouseY, springConfig);
18677
+ const smoothZoomLevel = framerMotion.useSpring(zoomLevel, springConfig);
18678
+ const transformOrigin = framerMotion.useTransform(
18679
+ [smoothMouseX, smoothMouseY],
18680
+ ([latestX, latestY]) => `${latestX}% ${latestY}%`
18681
+ );
18682
+ const touchStartDist = React32__namespace.useRef(0);
18683
+ const touchStartZoom = React32__namespace.useRef(1);
18684
+ const isPinching = React32__namespace.useRef(false);
18685
+ const handleMouseMove = (e) => {
18686
+ if (isPinching.current) return;
18687
+ const { left, top, width, height } = e.currentTarget.getBoundingClientRect();
18688
+ const x = (e.clientX - left) / width * 100;
18689
+ const y = (e.clientY - top) / height * 100;
18690
+ mouseX.set(x);
18691
+ mouseY.set(y);
18692
+ };
18693
+ const handleWheel = (e) => {
18694
+ const delta = -e.deltaY * 5e-3;
18695
+ const newZoom = Math.min(Math.max(1, zoomLevel.get() + delta), maxZoom);
18696
+ zoomLevel.set(newZoom);
18697
+ };
18698
+ const handleMouseLeave = () => {
18699
+ if (!isPinching.current) {
18700
+ mouseX.set(50);
18701
+ mouseY.set(50);
18702
+ zoomLevel.set(1);
18703
+ }
18704
+ };
18705
+ const getDistance = (touches) => {
18706
+ const dx = touches[0].clientX - touches[1].clientX;
18707
+ const dy = touches[0].clientY - touches[1].clientY;
18708
+ return Math.sqrt(dx * dx + dy * dy);
18709
+ };
18710
+ const getCenter = (touches, rect) => {
18711
+ const x = (touches[0].clientX + touches[1].clientX) / 2;
18712
+ const y = (touches[0].clientY + touches[1].clientY) / 2;
18713
+ return {
18714
+ x: (x - rect.left) / rect.width * 100,
18715
+ y: (y - rect.top) / rect.height * 100
18716
+ };
18717
+ };
18718
+ const handleTouchStart = (e) => {
18719
+ if (e.touches.length === 2) {
18720
+ isPinching.current = true;
18721
+ touchStartDist.current = getDistance(e.touches);
18722
+ touchStartZoom.current = zoomLevel.get();
18723
+ const rect = e.currentTarget.getBoundingClientRect();
18724
+ const center = getCenter(e.touches, rect);
18725
+ mouseX.set(center.x);
18726
+ mouseY.set(center.y);
18727
+ }
18728
+ };
18729
+ const handleTouchMove = (e) => {
18730
+ if (e.touches.length === 2 && isPinching.current) {
18731
+ e.preventDefault();
18732
+ const dist = getDistance(e.touches);
18733
+ const rect = e.currentTarget.getBoundingClientRect();
18734
+ const scaleChange = dist / touchStartDist.current;
18735
+ const newZoom = Math.min(
18736
+ Math.max(1, touchStartZoom.current * scaleChange),
18737
+ maxZoom
18738
+ );
18739
+ zoomLevel.set(newZoom);
18740
+ const center = getCenter(e.touches, rect);
18741
+ mouseX.set(center.x);
18742
+ mouseY.set(center.y);
18743
+ }
18744
+ };
18745
+ const handleTouchEnd = (e) => {
18746
+ if (e.touches.length < 2) {
18747
+ if (isPinching.current) {
18748
+ isPinching.current = false;
18749
+ }
18750
+ }
18751
+ };
18752
+ return /* @__PURE__ */ jsxRuntime.jsx(
18753
+ framerMotion.motion.div,
18754
+ {
18755
+ ref,
18756
+ className: cn(
18757
+ "relative w-full h-full overflow-hidden touch-none",
18758
+ className
18759
+ ),
18760
+ style: { borderRadius: `${borderRadius}px` },
18761
+ onMouseMove: handleMouseMove,
18762
+ onMouseLeave: handleMouseLeave,
18763
+ onWheel: handleWheel,
18764
+ onTouchStart: handleTouchStart,
18765
+ onTouchMove: handleTouchMove,
18766
+ onTouchEnd: handleTouchEnd,
18767
+ ...props,
18768
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18769
+ framerMotion.motion.img,
18770
+ {
18771
+ src,
18772
+ alt,
18773
+ className: cn("w-full h-full object-cover", imageClassName),
18774
+ style: {
18775
+ borderRadius: `${borderRadius}px`,
18776
+ transformOrigin,
18777
+ scale: smoothZoomLevel
18778
+ },
18779
+ transition: {
18780
+ type: "spring",
18781
+ duration: transitionDuration,
18782
+ bounce: 0
18783
+ }
18784
+ }
18785
+ )
18786
+ }
18787
+ );
18664
18788
  }
18789
+ );
18790
+ ZoomImage.displayName = "ZoomImage";
18791
+ var Lens = ({
18792
+ children,
18793
+ initialZoom = 1.5,
18794
+ maxZoom = 4,
18795
+ lensSize = 150,
18796
+ isStatic = false,
18797
+ position = { x: 200, y: 150 },
18798
+ hovering,
18799
+ setHovering
18800
+ }) => {
18801
+ const containerRef = React32.useRef(null);
18802
+ const [localIsHovering, setLocalIsHovering] = React32.useState(false);
18803
+ const isHovering = hovering !== void 0 ? hovering : localIsHovering;
18804
+ const setIsHovering = setHovering || setLocalIsHovering;
18805
+ const [mousePosition, setMousePosition] = React32.useState({ x: 100, y: 100 });
18806
+ const [zoomFactor, setZoomFactor] = React32.useState(initialZoom);
18807
+ const [isActivated, setIsActivated] = React32.useState(false);
18808
+ const handleMouseMove = (e) => {
18809
+ const rect = e.currentTarget.getBoundingClientRect();
18810
+ const x = e.clientX - rect.left;
18811
+ const y = e.clientY - rect.top;
18812
+ setMousePosition({ x, y });
18813
+ };
18814
+ const handleWheel = (e) => {
18815
+ if (!isActivated) return;
18816
+ const delta = -e.deltaY * 5e-3;
18817
+ setZoomFactor((prev) => Math.min(Math.max(1.1, prev + delta), maxZoom));
18818
+ };
18819
+ const resetZoom = () => {
18820
+ setZoomFactor(initialZoom);
18821
+ setIsActivated(false);
18822
+ };
18823
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18824
+ "div",
18825
+ {
18826
+ ref: containerRef,
18827
+ className: cn(
18828
+ "relative overflow-hidden rounded-lg z-20 h-full",
18829
+ isActivated ? "cursor-none" : "cursor-pointer"
18830
+ ),
18831
+ onClick: () => setIsActivated(!isActivated),
18832
+ onMouseEnter: () => {
18833
+ setIsHovering(true);
18834
+ },
18835
+ onMouseLeave: () => {
18836
+ setIsHovering(false);
18837
+ resetZoom();
18838
+ },
18839
+ onMouseMove: handleMouseMove,
18840
+ onWheel: handleWheel,
18841
+ children: [
18842
+ children,
18843
+ isStatic ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
18844
+ /* @__PURE__ */ jsxRuntime.jsx(
18845
+ framerMotion.motion.div,
18846
+ {
18847
+ initial: { opacity: 0, scale: 0.58 },
18848
+ animate: { opacity: 1, scale: 1 },
18849
+ exit: { opacity: 0, scale: 0.8 },
18850
+ transition: { duration: 0.3, ease: "easeOut" },
18851
+ className: "absolute inset-0 overflow-hidden",
18852
+ style: {
18853
+ maskImage: `radial-gradient(circle ${lensSize / 2}px at ${position.x}px ${position.y}px, black 100%, transparent 100%)`,
18854
+ WebkitMaskImage: `radial-gradient(circle ${lensSize / 2}px at ${position.x}px ${position.y}px, black 100%, transparent 100%)`,
18855
+ transformOrigin: `${position.x}px ${position.y}px`
18856
+ },
18857
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18858
+ "div",
18859
+ {
18860
+ className: "absolute inset-0",
18861
+ style: {
18862
+ transform: `scale(${zoomFactor})`,
18863
+ transformOrigin: `${position.x}px ${position.y}px`
18864
+ },
18865
+ children
18866
+ }
18867
+ )
18868
+ }
18869
+ ),
18870
+ /* @__PURE__ */ jsxRuntime.jsx(
18871
+ "div",
18872
+ {
18873
+ className: "absolute pointer-events-none",
18874
+ style: {
18875
+ left: position.x - lensSize / 2,
18876
+ top: position.y - lensSize / 2,
18877
+ width: lensSize,
18878
+ height: lensSize,
18879
+ borderRadius: "50%",
18880
+ boxShadow: "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2)",
18881
+ background: "radial-gradient(circle at center, transparent 60%, rgba(255, 255, 255, 0.1) 70%, rgba(255, 255, 255, 0.2) 80%, transparent 100%)"
18882
+ }
18883
+ }
18884
+ )
18885
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isHovering && isActivated && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
18886
+ /* @__PURE__ */ jsxRuntime.jsx(
18887
+ framerMotion.motion.div,
18888
+ {
18889
+ initial: { opacity: 0, scale: 0.58 },
18890
+ animate: { opacity: 1, scale: 1 },
18891
+ exit: { opacity: 0, scale: 0.8 },
18892
+ transition: { duration: 0.3, ease: "easeOut" },
18893
+ className: "absolute inset-0 overflow-hidden",
18894
+ style: {
18895
+ maskImage: `radial-gradient(circle ${lensSize / 2}px at ${mousePosition.x}px ${mousePosition.y}px, black 100%, transparent 100%)`,
18896
+ WebkitMaskImage: `radial-gradient(circle ${lensSize / 2}px at ${mousePosition.x}px ${mousePosition.y}px, black 100%, transparent 100%)`,
18897
+ transformOrigin: `${mousePosition.x}px ${mousePosition.y}px`,
18898
+ zIndex: 50
18899
+ },
18900
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18901
+ "div",
18902
+ {
18903
+ className: "absolute inset-0",
18904
+ style: {
18905
+ transform: `scale(${zoomFactor})`,
18906
+ transformOrigin: `${mousePosition.x}px ${mousePosition.y}px`
18907
+ },
18908
+ children
18909
+ }
18910
+ )
18911
+ }
18912
+ ),
18913
+ /* @__PURE__ */ jsxRuntime.jsx(
18914
+ framerMotion.motion.div,
18915
+ {
18916
+ initial: { opacity: 0, scale: 0.58 },
18917
+ animate: { opacity: 1, scale: 1 },
18918
+ exit: { opacity: 0, scale: 0.8 },
18919
+ transition: { duration: 0.3, ease: "easeOut" },
18920
+ className: "absolute pointer-events-none z-[60]",
18921
+ style: {
18922
+ left: mousePosition.x - lensSize / 2,
18923
+ top: mousePosition.y - lensSize / 2,
18924
+ width: lensSize,
18925
+ height: lensSize,
18926
+ borderRadius: "50%",
18927
+ boxShadow: "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2)",
18928
+ background: "radial-gradient(circle at center, transparent 60%, rgba(255, 255, 255, 0.1) 70%, rgba(255, 255, 255, 0.2) 80%, transparent 100%)"
18929
+ }
18930
+ }
18931
+ )
18932
+ ] }) })
18933
+ ]
18934
+ }
18935
+ );
18936
+ };
18937
+ 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: [
18939
+ /* @__PURE__ */ jsxRuntime.jsx(
18940
+ framerMotion.motion.div,
18941
+ {
18942
+ className: "absolute inset-0",
18943
+ style: {
18944
+ background: "linear-gradient(105deg, transparent 30%, hsl(var(--muted-foreground) / 0.08) 50%, transparent 70%)",
18945
+ backgroundSize: "200% 100%"
18946
+ },
18947
+ animate: { backgroundPositionX: ["200%", "-200%"] },
18948
+ transition: {
18949
+ duration: 1.6,
18950
+ ease: "linear",
18951
+ repeat: Infinity
18952
+ }
18953
+ }
18954
+ ),
18955
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
18956
+ framerMotion.motion.div,
18957
+ {
18958
+ animate: { opacity: [0.3, 0.6, 0.3] },
18959
+ transition: {
18960
+ duration: 2,
18961
+ repeat: Infinity,
18962
+ ease: "easeInOut"
18963
+ },
18964
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
18965
+ "svg",
18966
+ {
18967
+ width: "48",
18968
+ height: "48",
18969
+ viewBox: "0 0 24 24",
18970
+ fill: "none",
18971
+ stroke: "currentColor",
18972
+ strokeWidth: "1",
18973
+ strokeLinecap: "round",
18974
+ strokeLinejoin: "round",
18975
+ className: "text-muted-foreground/30",
18976
+ children: [
18977
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
18978
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
18979
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "21 15 16 10 5 21" })
18980
+ ]
18981
+ }
18982
+ )
18983
+ }
18984
+ ) }),
18985
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-muted-foreground/10 border border-muted-foreground/10" }),
18986
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-muted-foreground/10 border border-muted-foreground/10" }),
18987
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2 items-center", children: [8, 32, 8, 8].map((w, i) => /* @__PURE__ */ jsxRuntime.jsx(
18988
+ framerMotion.motion.div,
18989
+ {
18990
+ className: "h-2 rounded-full bg-muted-foreground/20",
18991
+ style: { width: w },
18992
+ animate: { opacity: [0.4, 0.7, 0.4] },
18993
+ transition: {
18994
+ duration: 1.8,
18995
+ repeat: Infinity,
18996
+ ease: "easeInOut",
18997
+ delay: i * 0.15
18998
+ }
18999
+ },
19000
+ i
19001
+ )) })
19002
+ ] }) }) }) });
19003
+ }
19004
+ function CarouselBase({
19005
+ items,
19006
+ className,
19007
+ containerClassName,
19008
+ imageClassName,
19009
+ width,
19010
+ height,
19011
+ showControls = true,
19012
+ showIndicators = true,
19013
+ autoPlay = false,
19014
+ autoPlayInterval = 3e3,
19015
+ zoomEffect = null,
19016
+ download = false,
19017
+ isLoading = false
18665
19018
  }) {
19019
+ const isMobile = useIsMobile();
18666
19020
  const [index, setIndex] = React32.useState(0);
18667
- const containerRef = React32.useRef(null);
18668
- const x = framerMotion.useMotionValue(0);
19021
+ const [emblaRef, emblaApi] = useEmblaCarousel__default.default({ loop: true });
19022
+ const [isDownloading, setIsDownloading] = React32.useState(false);
19023
+ const [downloadSuccess, setDownloadSuccess] = React32.useState(false);
18669
19024
  React32.useEffect(() => {
18670
- if (containerRef.current) {
18671
- const containerWidth = containerRef.current.offsetWidth || 1;
18672
- const targetX = -index * containerWidth;
18673
- framerMotion.animate(x, targetX, {
18674
- type: "spring",
18675
- stiffness: springConfig.stiffness,
18676
- damping: springConfig.damping
18677
- });
18678
- }
18679
- }, [index, x, springConfig.stiffness, springConfig.damping]);
19025
+ if (!emblaApi) return;
19026
+ const onSelect = () => {
19027
+ setIndex(emblaApi.selectedScrollSnap());
19028
+ };
19029
+ emblaApi.on("select", onSelect);
19030
+ emblaApi.on("reInit", onSelect);
19031
+ return () => {
19032
+ emblaApi.off("select", onSelect);
19033
+ emblaApi.off("reInit", onSelect);
19034
+ };
19035
+ }, [emblaApi]);
18680
19036
  React32.useEffect(() => {
18681
- if (!autoPlay || items.length <= 1) return;
19037
+ if (!autoPlay || items.length <= 1 || !emblaApi) return;
18682
19038
  const interval = setInterval(() => {
18683
- setIndex((i) => (i + 1) % items.length);
19039
+ emblaApi.scrollNext();
18684
19040
  }, autoPlayInterval);
18685
19041
  return () => clearInterval(interval);
18686
- }, [autoPlay, autoPlayInterval, items.length]);
18687
- return /* @__PURE__ */ jsxRuntime.jsx(
18688
- "div",
19042
+ }, [autoPlay, autoPlayInterval, items.length, emblaApi]);
19043
+ React32.useEffect(() => {
19044
+ if (emblaApi && index !== emblaApi.selectedScrollSnap()) {
19045
+ emblaApi.scrollTo(index);
19046
+ }
19047
+ }, [index, emblaApi]);
19048
+ const handleDownload = async () => {
19049
+ if (isDownloading) return;
19050
+ setIsDownloading(true);
19051
+ setDownloadSuccess(false);
19052
+ const currentItem = items[index];
19053
+ try {
19054
+ const response = await fetch(currentItem.url);
19055
+ const blob = await response.blob();
19056
+ const url = window.URL.createObjectURL(blob);
19057
+ const link = document.createElement("a");
19058
+ link.href = url;
19059
+ link.download = currentItem.title || "image";
19060
+ document.body.appendChild(link);
19061
+ link.click();
19062
+ document.body.removeChild(link);
19063
+ window.URL.revokeObjectURL(url);
19064
+ setIsDownloading(false);
19065
+ setDownloadSuccess(true);
19066
+ setTimeout(() => setDownloadSuccess(false), 2e3);
19067
+ } catch (error) {
19068
+ console.error("Error downloading image:", error);
19069
+ setIsDownloading(false);
19070
+ }
19071
+ };
19072
+ if (isLoading) {
19073
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
19074
+ framerMotion.motion.div,
19075
+ {
19076
+ initial: { opacity: 0 },
19077
+ animate: { opacity: 1 },
19078
+ exit: { opacity: 0 },
19079
+ transition: { duration: 0.3 },
19080
+ style: { width, height },
19081
+ className: "h-full",
19082
+ children: /* @__PURE__ */ jsxRuntime.jsx(CarouselSkeleton, { className })
19083
+ },
19084
+ "carousel-skeleton"
19085
+ ) });
19086
+ }
19087
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
19088
+ framerMotion.motion.div,
18689
19089
  {
19090
+ initial: { opacity: 0 },
19091
+ animate: { opacity: 1 },
19092
+ transition: { duration: 0.4 },
18690
19093
  className: cn("w-full lg:p-10 sm:p-4 p-2", className),
18691
- style: { width },
18692
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
19094
+ style: { width, height },
19095
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
18693
19096
  "div",
18694
19097
  {
18695
19098
  className: cn(
18696
- "relative overflow-hidden rounded-lg",
19099
+ "relative overflow-hidden rounded-lg h-full cursor-grab active:cursor-grabbing",
18697
19100
  containerClassName
18698
19101
  ),
18699
- ref: containerRef,
19102
+ ref: emblaRef,
18700
19103
  children: [
18701
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { className: "flex", style: { x }, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 w-full", style: { height }, children: /* @__PURE__ */ jsxRuntime.jsx(
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(
19105
+ ZoomImage,
19106
+ {
19107
+ src: item.url,
19108
+ alt: item.title,
19109
+ className: cn("w-full h-full select-none"),
19110
+ imageClassName,
19111
+ borderRadius: 8,
19112
+ maxZoom: 3
19113
+ }
19114
+ ) : zoomEffect === "lens" ? /* @__PURE__ */ jsxRuntime.jsx(Lens, { children: /* @__PURE__ */ jsxRuntime.jsx(
19115
+ "img",
19116
+ {
19117
+ src: item.url,
19118
+ alt: item.title,
19119
+ className: cn(
19120
+ "w-full h-full object-cover rounded-lg select-none pointer-events-none",
19121
+ imageClassName
19122
+ ),
19123
+ draggable: false
19124
+ }
19125
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(
18702
19126
  "img",
18703
19127
  {
18704
19128
  src: item.url,
@@ -18710,14 +19134,94 @@ function CarouselBase({
18710
19134
  draggable: false
18711
19135
  }
18712
19136
  ) }, item.id)) }),
19137
+ download && /* @__PURE__ */ jsxRuntime.jsx(
19138
+ framerMotion.motion.button,
19139
+ {
19140
+ onClick: handleDownload,
19141
+ className: cn(
19142
+ "absolute top-4 right-4 z-30 p-2 rounded-full text-white transition-colors border border-white/10",
19143
+ downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70"
19144
+ ),
19145
+ title: "Download image",
19146
+ initial: false,
19147
+ animate: {
19148
+ scale: isDownloading ? 0.9 : 1,
19149
+ backgroundColor: downloadSuccess ? "rgb(34, 197, 94)" : "rgba(0, 0, 0, 0.5)"
19150
+ },
19151
+ whileHover: { scale: 1.05 },
19152
+ whileTap: { scale: 0.95 },
19153
+ children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", initial: false, children: isDownloading ? /* @__PURE__ */ jsxRuntime.jsx(
19154
+ framerMotion.motion.svg,
19155
+ {
19156
+ xmlns: "http://www.w3.org/2000/svg",
19157
+ width: "20",
19158
+ height: "20",
19159
+ viewBox: "0 0 24 24",
19160
+ fill: "none",
19161
+ stroke: "currentColor",
19162
+ strokeWidth: "2",
19163
+ strokeLinecap: "round",
19164
+ strokeLinejoin: "round",
19165
+ animate: { rotate: 360 },
19166
+ transition: {
19167
+ repeat: Infinity,
19168
+ ease: "linear",
19169
+ duration: 1
19170
+ },
19171
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
19172
+ },
19173
+ "loading"
19174
+ ) : downloadSuccess ? /* @__PURE__ */ jsxRuntime.jsx(
19175
+ framerMotion.motion.svg,
19176
+ {
19177
+ xmlns: "http://www.w3.org/2000/svg",
19178
+ width: "20",
19179
+ height: "20",
19180
+ viewBox: "0 0 24 24",
19181
+ fill: "none",
19182
+ stroke: "currentColor",
19183
+ strokeWidth: "2",
19184
+ strokeLinecap: "round",
19185
+ strokeLinejoin: "round",
19186
+ initial: { scale: 0.5, opacity: 0 },
19187
+ animate: { scale: 1, opacity: 1 },
19188
+ exit: { scale: 0.5, opacity: 0 },
19189
+ children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" })
19190
+ },
19191
+ "success"
19192
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
19193
+ framerMotion.motion.svg,
19194
+ {
19195
+ xmlns: "http://www.w3.org/2000/svg",
19196
+ width: "20",
19197
+ height: "20",
19198
+ viewBox: "0 0 24 24",
19199
+ fill: "none",
19200
+ stroke: "currentColor",
19201
+ strokeWidth: "2",
19202
+ strokeLinecap: "round",
19203
+ strokeLinejoin: "round",
19204
+ initial: { scale: 0.5, opacity: 0 },
19205
+ animate: { scale: 1, opacity: 1 },
19206
+ exit: { scale: 0.5, opacity: 0 },
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
+ ),
18713
19217
  showControls && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
18714
19218
  /* @__PURE__ */ jsxRuntime.jsx(
18715
19219
  framerMotion.motion.button,
18716
19220
  {
18717
- disabled: index === 0,
18718
- onClick: () => setIndex((i) => Math.max(0, i - 1)),
18719
- 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-10
18720
- ${index === 0 ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
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
19224
+ ${!emblaApi?.canScrollPrev() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
18721
19225
  children: /* @__PURE__ */ jsxRuntime.jsx(
18722
19226
  "svg",
18723
19227
  {
@@ -18741,10 +19245,10 @@ function CarouselBase({
18741
19245
  /* @__PURE__ */ jsxRuntime.jsx(
18742
19246
  framerMotion.motion.button,
18743
19247
  {
18744
- disabled: index === items.length - 1,
18745
- onClick: () => setIndex((i) => Math.min(items.length - 1, i + 1)),
18746
- 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-10
18747
- ${index === items.length - 1 ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
19248
+ disabled: !emblaApi?.canScrollNext(),
19249
+ onClick: () => emblaApi?.scrollNext(),
19250
+ 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-30
19251
+ ${!emblaApi?.canScrollNext() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
18748
19252
  children: /* @__PURE__ */ jsxRuntime.jsx(
18749
19253
  "svg",
18750
19254
  {
@@ -18769,7 +19273,7 @@ function CarouselBase({
18769
19273
  showIndicators && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2", children: items.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
18770
19274
  "button",
18771
19275
  {
18772
- onClick: () => setIndex(i),
19276
+ onClick: () => emblaApi?.scrollTo(i),
18773
19277
  className: `h-2 rounded-full transition-all ${i === index ? "w-8 bg-white" : "w-2 bg-white/50"}`
18774
19278
  },
18775
19279
  i
@@ -18777,8 +19281,240 @@ function CarouselBase({
18777
19281
  ]
18778
19282
  }
18779
19283
  ) })
19284
+ },
19285
+ "carousel-content"
19286
+ ) });
19287
+ }
19288
+ function useMediaQuery(query) {
19289
+ const [value, setValue] = React32__namespace.useState(false);
19290
+ React32__namespace.useEffect(() => {
19291
+ function onChange(event) {
19292
+ setValue(event.matches);
18780
19293
  }
18781
- );
19294
+ const result = window.matchMedia(query);
19295
+ result.addEventListener("change", onChange);
19296
+ setValue(result.matches);
19297
+ return () => result.removeEventListener("change", onChange);
19298
+ }, [query]);
19299
+ return value;
19300
+ }
19301
+ var FULL_CIRCLE = 360;
19302
+ var START_ANGLE = -90;
19303
+ function degToRad(deg) {
19304
+ return deg * Math.PI / 180;
19305
+ }
19306
+ function polarToCartesian(radius, angleDeg) {
19307
+ const rad = degToRad(angleDeg);
19308
+ return { x: Math.cos(rad) * radius, y: Math.sin(rad) * radius };
19309
+ }
19310
+ function slicePath(index, total, wedgeRadius, innerRadius) {
19311
+ if (total <= 0) return "";
19312
+ const anglePerSlice = FULL_CIRCLE / total;
19313
+ const midDeg = START_ANGLE + anglePerSlice * index;
19314
+ const halfSlice = anglePerSlice / 2;
19315
+ const startDeg = midDeg - halfSlice;
19316
+ const endDeg = midDeg + halfSlice;
19317
+ const outerStart = polarToCartesian(wedgeRadius, startDeg);
19318
+ const outerEnd = polarToCartesian(wedgeRadius, endDeg);
19319
+ const innerStart = polarToCartesian(innerRadius, startDeg);
19320
+ const innerEnd = polarToCartesian(innerRadius, endDeg);
19321
+ const largeArcFlag = anglePerSlice > 180 ? 1 : 0;
19322
+ return `M ${outerStart.x} ${outerStart.y} A ${wedgeRadius} ${wedgeRadius} 0 ${largeArcFlag} 1 ${outerEnd.x} ${outerEnd.y} L ${innerEnd.x} ${innerEnd.y} A ${innerRadius} ${innerRadius} 0 ${largeArcFlag} 0 ${innerStart.x} ${innerStart.y} Z`;
19323
+ }
19324
+ function RadialMenu({
19325
+ children,
19326
+ menuItems,
19327
+ size = 240,
19328
+ iconSize = 24,
19329
+ bandWidth = 60,
19330
+ innerGap = 16,
19331
+ outerGap = 12,
19332
+ outerRingWidth = 8,
19333
+ onSelect
19334
+ }) {
19335
+ const isMobile = useMediaQuery("(max-width: 768px)");
19336
+ const radius = size / 2;
19337
+ const outerRingOuterRadius = radius;
19338
+ const outerRingInnerRadius = outerRingOuterRadius - outerRingWidth;
19339
+ const wedgeOuterRadius = outerRingInnerRadius - outerGap;
19340
+ const wedgeInnerRadius = wedgeOuterRadius - bandWidth;
19341
+ const iconRingRadius = (wedgeOuterRadius + wedgeInnerRadius) / 2;
19342
+ const centerRadius = Math.max(wedgeInnerRadius - innerGap, 0);
19343
+ const slice = 360 / menuItems.length;
19344
+ const [activeIndex, setActiveIndex] = React32__namespace.useState(null);
19345
+ const timerRef = React32__namespace.useRef(null);
19346
+ const isLongPress = React32__namespace.useRef(false);
19347
+ const handleTouchStart = (e) => {
19348
+ isLongPress.current = false;
19349
+ const touch = e.touches[0];
19350
+ const { clientX, clientY } = touch;
19351
+ timerRef.current = setTimeout(() => {
19352
+ isLongPress.current = true;
19353
+ const event = new MouseEvent("contextmenu", {
19354
+ bubbles: true,
19355
+ cancelable: true,
19356
+ view: window,
19357
+ clientX,
19358
+ clientY,
19359
+ button: 2,
19360
+ buttons: 2
19361
+ });
19362
+ e.target.dispatchEvent(event);
19363
+ }, 1e3);
19364
+ };
19365
+ const handleTouchEnd = () => {
19366
+ if (timerRef.current) {
19367
+ clearTimeout(timerRef.current);
19368
+ }
19369
+ };
19370
+ const handleTouchMove = () => {
19371
+ if (timerRef.current) {
19372
+ clearTimeout(timerRef.current);
19373
+ }
19374
+ };
19375
+ const containerVariants = {
19376
+ hidden: { opacity: 0, scale: 0.8 },
19377
+ visible: {
19378
+ opacity: 1,
19379
+ scale: 1,
19380
+ transition: isMobile ? { duration: 0 } : {
19381
+ delayChildren: 0.05,
19382
+ staggerChildren: 0.03,
19383
+ type: "spring",
19384
+ stiffness: 300,
19385
+ damping: 24
19386
+ }
19387
+ },
19388
+ exit: {
19389
+ opacity: 0,
19390
+ scale: 0.8,
19391
+ transition: isMobile ? { duration: 0 } : { duration: 0.15 }
19392
+ }
19393
+ };
19394
+ const itemVariants2 = {
19395
+ hidden: { opacity: 0, scale: 0, rotate: -20 },
19396
+ visible: {
19397
+ opacity: 1,
19398
+ scale: 1,
19399
+ rotate: 0,
19400
+ transition: isMobile ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 20 }
19401
+ }
19402
+ };
19403
+ return /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuBase, { children: [
19404
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
19405
+ "div",
19406
+ {
19407
+ className: "select-none outline-none group touch-none",
19408
+ onTouchStart: handleTouchStart,
19409
+ onTouchEnd: handleTouchEnd,
19410
+ onTouchMove: handleTouchMove,
19411
+ children: children || /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-80 flex justify-center items-center border-2 border-dashed border-muted-foreground/20 rounded-xl bg-muted/5 text-muted-foreground hover:bg-muted/10 transition-colors", children: "Right-click or Long-press here (1s)" })
19412
+ }
19413
+ ) }),
19414
+ /* @__PURE__ */ jsxRuntime.jsx(
19415
+ ContextMenuContentBase,
19416
+ {
19417
+ className: "p-0 border-none bg-transparent shadow-none overflow-visible -translate-x-1/2 -translate-y-1/2",
19418
+ style: { width: size, height: size },
19419
+ children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsxs(
19420
+ framerMotion.motion.div,
19421
+ {
19422
+ className: "relative size-full drop-shadow-xl will-change-transform",
19423
+ variants: containerVariants,
19424
+ initial: "hidden",
19425
+ animate: "visible",
19426
+ exit: "exit",
19427
+ children: [
19428
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-background/5 blur-2xl -z-10" }),
19429
+ /* @__PURE__ */ jsxRuntime.jsxs(
19430
+ "svg",
19431
+ {
19432
+ className: "absolute inset-0 size-full overflow-visible",
19433
+ viewBox: `${-radius} ${-radius} ${radius * 2} ${radius * 2}`,
19434
+ children: [
19435
+ /* @__PURE__ */ jsxRuntime.jsx(
19436
+ framerMotion.motion.circle,
19437
+ {
19438
+ r: centerRadius,
19439
+ initial: { scale: 0 },
19440
+ animate: { scale: 1 },
19441
+ transition: isMobile ? { duration: 0 } : {
19442
+ type: "spring",
19443
+ stiffness: 300,
19444
+ delay: 0.2
19445
+ },
19446
+ className: "fill-background stroke-border stroke-1 shadow-inner"
19447
+ }
19448
+ ),
19449
+ menuItems.map((item, index) => {
19450
+ const Icon = item.icon;
19451
+ const midDeg = START_ANGLE + slice * index;
19452
+ const { x: iconX, y: iconY } = polarToCartesian(
19453
+ iconRingRadius,
19454
+ midDeg
19455
+ );
19456
+ const isActive = activeIndex === index;
19457
+ const ICON_BOX = iconSize * 2.5;
19458
+ return /* @__PURE__ */ jsxRuntime.jsxs(
19459
+ framerMotion.motion.g,
19460
+ {
19461
+ variants: itemVariants2,
19462
+ className: "cursor-pointer outline-none",
19463
+ onMouseEnter: () => setActiveIndex(index),
19464
+ onMouseLeave: () => setActiveIndex(null),
19465
+ onClick: () => onSelect?.(item),
19466
+ style: { originX: "0px", originY: "0px" },
19467
+ children: [
19468
+ /* @__PURE__ */ jsxRuntime.jsx(
19469
+ "path",
19470
+ {
19471
+ d: slicePath(
19472
+ index,
19473
+ menuItems.length,
19474
+ wedgeOuterRadius,
19475
+ wedgeInnerRadius
19476
+ ),
19477
+ className: cn(
19478
+ "transition-colors duration-200 stroke-1",
19479
+ isActive ? "fill-primary stroke-primary-foreground/20" : "fill-background/90 stroke-border/50 hover:fill-accent"
19480
+ )
19481
+ }
19482
+ ),
19483
+ /* @__PURE__ */ jsxRuntime.jsx(
19484
+ "foreignObject",
19485
+ {
19486
+ x: iconX - ICON_BOX / 2,
19487
+ y: iconY - ICON_BOX / 2,
19488
+ width: ICON_BOX,
19489
+ height: ICON_BOX,
19490
+ className: "pointer-events-none",
19491
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
19492
+ Icon,
19493
+ {
19494
+ size: iconSize,
19495
+ weight: isActive ? "fill" : "regular",
19496
+ className: cn(
19497
+ "transition-all duration-200",
19498
+ isActive ? "text-primary-foreground " : "text-muted-foreground"
19499
+ )
19500
+ }
19501
+ ) })
19502
+ }
19503
+ )
19504
+ ]
19505
+ },
19506
+ item.id
19507
+ );
19508
+ })
19509
+ ]
19510
+ }
19511
+ )
19512
+ ]
19513
+ }
19514
+ ) })
19515
+ }
19516
+ )
19517
+ ] });
18782
19518
  }
18783
19519
 
18784
19520
  exports.AddButton = AddButton;
@@ -18992,6 +19728,7 @@ exports.ProgressBase = ProgressBase;
18992
19728
  exports.ProgressCirclesBase = ProgressCirclesBase;
18993
19729
  exports.ProgressPanelsBase = ProgressPanelsBase;
18994
19730
  exports.ProgressSegmentsBase = ProgressSegmentsBase;
19731
+ exports.RadialMenu = RadialMenu;
18995
19732
  exports.RangePicker = RangePicker;
18996
19733
  exports.RefreshButton = RefreshButton;
18997
19734
  exports.SaveButton = SaveButton;