@mlw-packages/react-components 1.9.11 → 1.9.13

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: {
@@ -14662,7 +14664,8 @@ var DraggableTooltipComponent = ({
14662
14664
  toggleHighlight,
14663
14665
  showOnlyHighlighted,
14664
14666
  valueFormatter,
14665
- categoryFormatter
14667
+ categoryFormatter,
14668
+ seriesTypeMap
14666
14669
  }) => {
14667
14670
  const visibleKeys = React32.useMemo(
14668
14671
  () => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
@@ -14673,7 +14676,9 @@ var DraggableTooltipComponent = ({
14673
14676
  const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
14674
14677
  return numeric.reduce((s, v) => s + (v || 0), 0);
14675
14678
  }, [data2, visibleKeys2]);
14676
- const defaultTotalFormatted = total.toLocaleString("pt-BR");
14679
+ const defaultTotalFormatted = total.toLocaleString("pt-BR", {
14680
+ maximumFractionDigits: 0
14681
+ });
14677
14682
  const displayTotal = localformatter ? localformatter({
14678
14683
  value: total,
14679
14684
  formattedValue: defaultTotalFormatted,
@@ -15128,7 +15133,13 @@ var DraggableTooltipComponent = ({
15128
15133
  0
15129
15134
  );
15130
15135
  const val = typeof value === "number" ? value : Number(value) || 0;
15131
- const defaultFormatted = val.toLocaleString("pt-BR");
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
+ });
15132
15143
  const displayValue = valueFormatter ? valueFormatter({
15133
15144
  value,
15134
15145
  formattedValue: defaultFormatted,
@@ -15183,7 +15194,7 @@ var DraggableTooltipComponent = ({
15183
15194
  children: displayValue
15184
15195
  }
15185
15196
  ),
15186
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
15197
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toLocaleString("pt-BR", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}%` : "-" })
15187
15198
  ] })
15188
15199
  ] }),
15189
15200
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -15247,7 +15258,8 @@ var RechartTooltipWithTotal = ({
15247
15258
  valueFormatter,
15248
15259
  categoryFormatter,
15249
15260
  yAxisMap,
15250
- isBiaxial = false
15261
+ isBiaxial = false,
15262
+ seriesTypeMap
15251
15263
  }) => {
15252
15264
  if (!active || !payload || payload.length === 0) return null;
15253
15265
  const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
@@ -15256,18 +15268,9 @@ var RechartTooltipWithTotal = ({
15256
15268
  );
15257
15269
  const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
15258
15270
  const isTotalNegative = total < 0;
15259
- const defaultTotalFormatted = (() => {
15260
- try {
15261
- if (Math.abs(total) < 1e3) {
15262
- return new Intl.NumberFormat("pt-BR", {
15263
- minimumFractionDigits: 2,
15264
- maximumFractionDigits: 2
15265
- }).format(total);
15266
- }
15267
- } catch {
15268
- }
15269
- return total.toLocaleString("pt-BR");
15270
- })();
15271
+ const defaultTotalFormatted = total.toLocaleString("pt-BR", {
15272
+ maximumFractionDigits: 0
15273
+ });
15271
15274
  const displayTotal = valueFormatter ? valueFormatter({
15272
15275
  value: total,
15273
15276
  formattedValue: defaultTotalFormatted,
@@ -15319,18 +15322,13 @@ var RechartTooltipWithTotal = ({
15319
15322
  const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
15320
15323
  const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
15321
15324
  const isNeg = value < 0;
15322
- const defaultFormatted = (() => {
15323
- try {
15324
- if (Math.abs(value) < 1e3) {
15325
- return new Intl.NumberFormat("pt-BR", {
15326
- minimumFractionDigits: 2,
15327
- maximumFractionDigits: 2
15328
- }).format(value);
15329
- }
15330
- } catch {
15331
- }
15332
- return value.toLocaleString("pt-BR");
15333
- })();
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
+ });
15334
15332
  const displayValue = valueFormatter ? valueFormatter({
15335
15333
  value: entry.value,
15336
15334
  formattedValue: defaultFormatted,
@@ -15369,8 +15367,14 @@ var RechartTooltipWithTotal = ({
15369
15367
  const axis = normalize(yAxisMap[entry.dataKey]);
15370
15368
  const denom = axisDenominators[axis] || 0;
15371
15369
  const p = denom > 0 ? Math.abs(value) / denom * 100 : 0;
15372
- return denom > 0 ? `${p.toFixed(1)}%` : "-";
15373
- })() : absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
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
+ })}%` : "-" })
15374
15378
  ] })
15375
15379
  ] }),
15376
15380
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -15399,7 +15403,8 @@ var TooltipSimple = ({
15399
15403
  valueFormatter,
15400
15404
  categoryFormatter,
15401
15405
  yAxisMap,
15402
- isBiaxial = false
15406
+ isBiaxial = false,
15407
+ seriesTypeMap
15403
15408
  }) => {
15404
15409
  if (!active || !payload || payload.length === 0) return null;
15405
15410
  const displayLabel = categoryFormatter ? categoryFormatter(String(label ?? "")) : label;
@@ -15432,18 +15437,13 @@ var TooltipSimple = ({
15432
15437
  );
15433
15438
  pct = axisSum > 0 ? Math.abs(value) / axisSum * 100 : 0;
15434
15439
  }
15435
- const defaultFormatted = (() => {
15436
- try {
15437
- if (Math.abs(value) < 1e3) {
15438
- return new Intl.NumberFormat("pt-BR", {
15439
- minimumFractionDigits: 2,
15440
- maximumFractionDigits: 2
15441
- }).format(value);
15442
- }
15443
- } catch {
15444
- }
15445
- return value.toLocaleString("pt-BR");
15446
- })();
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
+ });
15447
15447
  const displayValue = valueFormatter ? valueFormatter({
15448
15448
  value: entry.value,
15449
15449
  formattedValue: defaultFormatted,
@@ -15474,7 +15474,10 @@ var TooltipSimple = ({
15474
15474
  children: displayValue
15475
15475
  }
15476
15476
  ),
15477
- isBiaxial ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: pct > 0 ? `${pct.toFixed(1)}%` : "-" }) : null
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
15478
15481
  ] }) })
15479
15482
  ]
15480
15483
  },
@@ -16519,16 +16522,16 @@ var NoData = ({
16519
16522
  "div",
16520
16523
  {
16521
16524
  className: cn(
16522
- "rounded-xl bg-card relative overflow-hidden w-full border border-border/50 shadow-sm h-full",
16525
+ "rounded-xl bg-card relative overflow-hidden w-full shadow-sm h-full",
16523
16526
  className
16524
16527
  ),
16525
16528
  style: {
16526
16529
  "--pl": `${paddingLeft}px`,
16527
- "--svg-h": typeof height === "number" ? `${height}px` : String(height)
16530
+ ...typeof height === "number" ? { height } : {}
16528
16531
  },
16529
16532
  role: "img",
16530
16533
  "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: [
16534
+ 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
16535
  /* @__PURE__ */ jsxRuntime.jsxs(
16533
16536
  "svg",
16534
16537
  {
@@ -17263,11 +17266,30 @@ function useOpenTooltipForPeriod({
17263
17266
  );
17264
17267
  }
17265
17268
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
17269
+ function ChartWrapper({
17270
+ className,
17271
+ children,
17272
+ wrapperRef
17273
+ }) {
17274
+ const cls = className ?? "";
17275
+ const hasExplicitSizing = /\bh-/.test(cls) || /\bflex-1\b/.test(cls);
17276
+ return /* @__PURE__ */ jsxRuntime.jsx(
17277
+ "div",
17278
+ {
17279
+ ref: wrapperRef,
17280
+ className: cn(
17281
+ "w-full overflow-hidden min-w-0 rounded-lg border-border",
17282
+ !hasExplicitSizing && "h-[550px]",
17283
+ className
17284
+ ),
17285
+ children
17286
+ }
17287
+ );
17288
+ }
17266
17289
  var Chart = ({
17267
17290
  data,
17268
17291
  series,
17269
17292
  className,
17270
- height = 350,
17271
17293
  width = "100%",
17272
17294
  colors: colors2 = DEFAULT_COLORS2,
17273
17295
  gridColor,
@@ -17299,19 +17321,7 @@ var Chart = ({
17299
17321
  timeSeries,
17300
17322
  timeSeriesLegend,
17301
17323
  customLegend
17302
- // horizontal removido
17303
- // orderBy removido
17304
17324
  }) => {
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
17325
  const { xAxisConfig, mapperConfig } = React32.useMemo(() => {
17316
17326
  return fnSmartConfig({ xAxis, data, labelMap });
17317
17327
  }, [data, xAxis, labelMap]);
@@ -17455,417 +17465,453 @@ var Chart = ({
17455
17465
  maxTooltips,
17456
17466
  effectiveChartWidth
17457
17467
  });
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;
17468
+ const seriesTypeMap = React32.useMemo(() => {
17469
+ const map = {};
17470
+ seriesOrder.forEach((s) => {
17471
+ map[s.key] = s.type;
17472
+ });
17473
+ return map;
17474
+ }, [seriesOrder]);
17462
17475
  if (!data && !isLoading) return null;
17463
17476
  if (isLoading) {
17464
- return /* @__PURE__ */ jsxRuntime.jsx(
17477
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { className, children: /* @__PURE__ */ jsxRuntime.jsx(
17465
17478
  NoData_default,
17466
17479
  {
17467
17480
  title,
17468
17481
  isLoading: true,
17469
17482
  loadingMessage: typeof title === "string" ? `${title} \u2014 Carregando` : "Carregando",
17470
17483
  paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17471
- height
17484
+ height: "100%"
17472
17485
  }
17473
- );
17486
+ ) });
17474
17487
  }
17475
17488
  if (Array.isArray(data) && data.length === 0) {
17476
- return /* @__PURE__ */ jsxRuntime.jsx(
17489
+ return /* @__PURE__ */ jsxRuntime.jsx(ChartWrapper, { className, children: /* @__PURE__ */ jsxRuntime.jsx(
17477
17490
  NoData_default,
17478
17491
  {
17479
17492
  title,
17480
17493
  paddingLeft: CONTAINER_PADDING_LEFT + finalChartLeftMargin,
17481
- height
17494
+ height: "100%"
17482
17495
  }
17483
- );
17496
+ ) });
17484
17497
  }
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
- }
17498
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17499
+ /* @__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: [
17500
+ /* @__PURE__ */ jsxRuntime.jsx(
17501
+ ChartHeader,
17502
+ {
17503
+ title,
17504
+ titlePosition,
17505
+ HORIZONTAL_PADDING_CLASS,
17506
+ customLegend,
17507
+ data,
17508
+ allKeys,
17509
+ processedData,
17510
+ finalColors,
17511
+ mapperConfig,
17512
+ finalValueFormatter,
17513
+ formatBR
17514
+ }
17515
+ ),
17516
+ allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsx(
17517
+ ChartControls,
17518
+ {
17519
+ allKeys,
17520
+ mapperConfig,
17521
+ finalColors,
17522
+ highlightedSeries,
17523
+ toggleHighlight,
17524
+ showOnlyHighlighted,
17525
+ setShowOnlyHighlighted,
17526
+ highlightedSeriesSize: highlightedSeries.size,
17527
+ clearHighlights,
17528
+ enableHighlights,
17529
+ enableShowOnly,
17530
+ enablePeriodsDropdown,
17531
+ enableDraggableTooltips,
17532
+ processedData,
17533
+ onOpenPeriod: openTooltipForPeriod,
17534
+ rightOffset: finalChartRightMargin,
17535
+ activePeriods,
17536
+ containerClass: cn("flex items-center gap-2", teste),
17537
+ containerWidth: chartInnerWidth
17538
+ }
17539
+ ),
17540
+ !(allKeys.length > 0 && (enableHighlights || enableShowOnly)) && enablePeriodsDropdown && enableDraggableTooltips && /* @__PURE__ */ jsxRuntime.jsx(
17541
+ "div",
17542
+ {
17543
+ className: cn(
17544
+ "w-full flex justify-end mb-2",
17545
+ HORIZONTAL_PADDING_CLASS
17507
17546
  ),
17508
- allKeys.length > 0 && (enableHighlights || enableShowOnly) && /* @__PURE__ */ jsxRuntime.jsx(
17509
- ChartControls,
17547
+ style: {
17548
+ paddingRight: `${finalChartRightMargin}px`,
17549
+ maxWidth: `${chartInnerWidth}px`
17550
+ },
17551
+ children: /* @__PURE__ */ jsxRuntime.jsx(
17552
+ PeriodsDropdown_default,
17510
17553
  {
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
17554
  processedData,
17525
17555
  onOpenPeriod: openTooltipForPeriod,
17526
- rightOffset: finalChartRightMargin,
17527
- activePeriods,
17528
- containerClass: cn("flex items-center gap-2", teste),
17529
- containerWidth: chartInnerWidth
17556
+ rightOffset: finalChartRightMargin
17530
17557
  }
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,
17558
+ )
17559
+ }
17560
+ ),
17561
+ /* @__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(
17562
+ recharts.ComposedChart,
17563
+ {
17564
+ data: processedData,
17565
+ margin: {
17566
+ top: 10,
17567
+ right: finalChartRightMargin,
17568
+ left: finalChartLeftMargin,
17569
+ bottom: 10
17570
+ },
17571
+ onClick: handleChartClick,
17572
+ children: [
17573
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: seriesOrder.filter((s) => s.type === "area").map((s) => {
17574
+ const key = s.key;
17575
+ const color = finalColors[key];
17576
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17577
+ "linearGradient",
17545
17578
  {
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
17579
+ id: `gradient-${key}`,
17580
+ x1: "0",
17581
+ y1: "0",
17582
+ x2: "0",
17583
+ y2: "0.8",
17584
+ children: [
17585
+ /* @__PURE__ */ jsxRuntime.jsx(
17586
+ "stop",
17587
+ {
17588
+ offset: "0%",
17589
+ stopColor: color,
17590
+ stopOpacity: 0.8
17615
17591
  }
17616
- } : void 0
17592
+ ),
17593
+ /* @__PURE__ */ jsxRuntime.jsx(
17594
+ "stop",
17595
+ {
17596
+ offset: "90%",
17597
+ stopColor: color,
17598
+ stopOpacity: 0.1
17599
+ }
17600
+ )
17601
+ ]
17602
+ },
17603
+ `gradient-${key}`
17604
+ );
17605
+ }) }),
17606
+ showGrid && /* @__PURE__ */ jsxRuntime.jsx(
17607
+ recharts.CartesianGrid,
17608
+ {
17609
+ strokeDasharray: "3 3",
17610
+ stroke: gridColor || "hsl(var(--muted-foreground))",
17611
+ opacity: 0.5
17612
+ }
17613
+ ),
17614
+ /* @__PURE__ */ jsxRuntime.jsx(
17615
+ recharts.XAxis,
17616
+ {
17617
+ dataKey: xAxisConfig.dataKey,
17618
+ stroke: "hsl(var(--muted-foreground))",
17619
+ fontSize: 12,
17620
+ tickLine: false,
17621
+ axisLine: false,
17622
+ tickFormatter: (value) => {
17623
+ if (categoryFormatter)
17624
+ return categoryFormatter(value);
17625
+ if (xAxisConfig.valueFormatter)
17626
+ return xAxisConfig.valueFormatter(
17627
+ value
17628
+ );
17629
+ return String(value ?? "");
17630
+ },
17631
+ label: xAxisLabel ? {
17632
+ value: xAxisLabel,
17633
+ position: "insideBottomRight",
17634
+ offset: -5,
17635
+ style: {
17636
+ fontSize: 12,
17637
+ fill: "hsl(var(--muted-foreground))",
17638
+ fontWeight: 500
17617
17639
  }
17618
- ),
17619
- /* @__PURE__ */ jsxRuntime.jsx(
17620
- recharts.YAxis,
17621
- {
17622
- yAxisId: "left",
17623
- width: yAxisTickWidth,
17624
- stroke: "hsl(var(--muted-foreground))",
17640
+ } : void 0
17641
+ }
17642
+ ),
17643
+ /* @__PURE__ */ jsxRuntime.jsx(
17644
+ recharts.YAxis,
17645
+ {
17646
+ yAxisId: "left",
17647
+ width: yAxisTickWidth,
17648
+ stroke: "hsl(var(--muted-foreground))",
17649
+ fontSize: 12,
17650
+ tickLine: false,
17651
+ axisLine: false,
17652
+ tickFormatter: yTickFormatter,
17653
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
17654
+ tickCount: 6,
17655
+ label: yAxisLabel ? {
17656
+ value: yAxisLabel,
17657
+ angle: -90,
17658
+ position: "left",
17659
+ dx: leftYAxisLabelDx,
17660
+ style: {
17625
17661
  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
17662
+ fill: "hsl(var(--muted-foreground))",
17663
+ fontWeight: 500,
17664
+ textAnchor: "middle"
17643
17665
  }
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))",
17666
+ } : void 0
17667
+ }
17668
+ ),
17669
+ rightKeys.length > 0 && (() => {
17670
+ const { rightAxisColor, rightTickFormatter } = fnConfigRightKeys(
17671
+ biaxialConfigNormalized,
17672
+ yTickFormatter,
17673
+ finalColors
17674
+ );
17675
+ return /* @__PURE__ */ jsxRuntime.jsx(
17676
+ recharts.YAxis,
17677
+ {
17678
+ yAxisId: "right",
17679
+ width: finalChartRightMargin,
17680
+ orientation: "right",
17681
+ stroke: "hsl(var(--muted-foreground))",
17682
+ fontSize: 12,
17683
+ tickLine: false,
17684
+ axisLine: false,
17685
+ tick: { fill: rightAxisColor },
17686
+ tickFormatter: rightTickFormatter,
17687
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
17688
+ tickCount: 6,
17689
+ label: biaxialConfigNormalized?.label ? {
17690
+ value: biaxialConfigNormalized.label,
17691
+ angle: -90,
17692
+ position: "right",
17693
+ dx: rightYAxisLabelDx,
17694
+ style: {
17658
17695
  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
17696
+ fill: "hsl(var(--muted-foreground))",
17697
+ fontWeight: 500,
17698
+ textAnchor: "middle"
17677
17699
  }
17678
- );
17679
- })(),
17680
- showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17681
- recharts.Tooltip,
17700
+ } : void 0
17701
+ }
17702
+ );
17703
+ })(),
17704
+ showTooltip && /* @__PURE__ */ jsxRuntime.jsx(
17705
+ recharts.Tooltip,
17706
+ {
17707
+ content: showTooltipTotal ? /* @__PURE__ */ jsxRuntime.jsx(
17708
+ TooltipWithTotal_default,
17682
17709
  {
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 }
17710
+ finalColors,
17711
+ valueFormatter: finalValueFormatter,
17712
+ categoryFormatter,
17713
+ periodLabel,
17714
+ seriesTypeMap
17701
17715
  }
17702
- ),
17703
- showLegend && /* @__PURE__ */ jsxRuntime.jsx(
17704
- recharts.Legend,
17716
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
17717
+ TooltipSimple_default,
17705
17718
  {
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
- }
17719
+ finalColors,
17720
+ valueFormatter: finalValueFormatter,
17721
+ categoryFormatter,
17722
+ periodLabel,
17723
+ seriesTypeMap
17715
17724
  }
17716
17725
  ),
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,
17726
+ cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
17727
+ }
17728
+ ),
17729
+ showLegend && /* @__PURE__ */ jsxRuntime.jsx(
17730
+ recharts.Legend,
17731
+ {
17732
+ iconSize: 12,
17733
+ formatter: (value) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tracking-[0] rounded-sm", children: fnFormatterValueLegend(
17734
+ value,
17735
+ mapperConfig,
17736
+ labelMap,
17737
+ legendUppercase
17738
+ ) })
17739
+ }
17740
+ ),
17741
+ seriesOrder.map((s) => {
17742
+ if (showOnlyHighlighted && !highlightedSeries.has(s.key))
17743
+ return null;
17744
+ const { label, color, key } = fnBuildConfigData(
17745
+ s,
17746
+ mapperConfig,
17747
+ labelMap,
17748
+ finalColors,
17749
+ rightKeys,
17750
+ biaxialConfigNormalized
17751
+ );
17752
+ if (s.type === "bar") {
17753
+ return /* @__PURE__ */ jsxRuntime.jsx(
17754
+ recharts.Bar,
17755
+ {
17756
+ dataKey: key,
17757
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17758
+ name: label,
17759
+ fill: color,
17760
+ radius: [4, 4, 0, 0],
17761
+ onClick: handleBarClick,
17762
+ className: "cursor-pointer",
17763
+ style: { opacity: getSeriesOpacity(key) },
17764
+ activeBar: /* @__PURE__ */ jsxRuntime.jsx(
17765
+ recharts.Rectangle,
17731
17766
  {
17732
- dataKey: key,
17733
- yAxisId: rightKeys.includes(key) ? "right" : "left",
17734
- name: label,
17735
17767
  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
17768
  stroke: color,
17776
17769
  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,
17770
+ opacity: 0.8
17771
+ }
17772
+ ),
17773
+ children: showLabels && labelsVisibility.bar !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17774
+ recharts.LabelList,
17802
17775
  {
17803
- type: "monotone",
17804
17776
  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
17777
+ content: (props) => {
17778
+ if (!fnContentLabelList(props)) return null;
17779
+ const inside = renderInsideBarLabel(
17780
+ color,
17781
+ finalValueFormatter
17782
+ );
17783
+ return inside(props);
17819
17784
  },
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
- ),
17845
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
17846
- DraggableTooltip_default,
17847
- {
17848
- id: tooltip.id,
17849
- data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17850
- position: tooltip.position,
17851
- title,
17852
- dataKeys: allKeys,
17853
- finalColors,
17854
- highlightedSeries,
17855
- toggleHighlight,
17856
- showOnlyHighlighted,
17857
- onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17858
- onPositionChange: onTooltipPositionChange,
17859
- periodLabel,
17860
- dataLabel: "Dados do Per\xEDodo",
17861
- valueFormatter: finalValueFormatter,
17862
- categoryFormatter,
17863
- globalTooltipCount: activeTooltips.length,
17864
- onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17865
- closeAllButtonPosition: "top-center",
17866
- closeAllButtonVariant: "floating"
17867
- },
17868
- tooltip.id
17785
+ offset: 0
17786
+ }
17787
+ ) : null
17788
+ },
17789
+ `bar-${key}`
17790
+ );
17791
+ }
17792
+ if (s.type === "line") {
17793
+ return /* @__PURE__ */ jsxRuntime.jsx(
17794
+ recharts.Line,
17795
+ {
17796
+ dataKey: key,
17797
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17798
+ name: label,
17799
+ stroke: color,
17800
+ strokeWidth: 2,
17801
+ dot: { r: 3 },
17802
+ activeDot: { r: 6 },
17803
+ onClick: handleSeriesClick,
17804
+ className: "cursor-pointer pointer-events-auto",
17805
+ style: { opacity: getSeriesOpacity(key) },
17806
+ children: showLabels && labelsVisibility.line !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17807
+ recharts.LabelList,
17808
+ {
17809
+ dataKey: key,
17810
+ position: "top",
17811
+ content: pillLabelRenderer_default(
17812
+ color,
17813
+ "filled",
17814
+ (props) => formatLinePercentage(props.value)
17815
+ ),
17816
+ offset: 14
17817
+ }
17818
+ ) : null
17819
+ },
17820
+ `line-${key}`
17821
+ );
17822
+ }
17823
+ if (s.type === "area") {
17824
+ return /* @__PURE__ */ jsxRuntime.jsx(
17825
+ recharts.Area,
17826
+ {
17827
+ type: "monotone",
17828
+ dataKey: key,
17829
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
17830
+ name: label,
17831
+ stroke: color,
17832
+ fill: `url(#gradient-${key})`,
17833
+ fillOpacity: 1,
17834
+ strokeWidth: 2,
17835
+ onClick: handleSeriesClick,
17836
+ className: "cursor-pointer pointer-events-auto",
17837
+ style: { opacity: getSeriesOpacity(key) },
17838
+ activeDot: {
17839
+ r: 6,
17840
+ fill: color,
17841
+ stroke: "hsl(var(--background))",
17842
+ strokeWidth: 2
17843
+ },
17844
+ children: showLabels && labelsVisibility.area !== false && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsxRuntime.jsx(
17845
+ recharts.LabelList,
17846
+ {
17847
+ dataKey: key,
17848
+ position: "top",
17849
+ content: pillLabelRenderer_default(
17850
+ color,
17851
+ "soft",
17852
+ finalValueFormatter
17853
+ ),
17854
+ offset: 12
17855
+ }
17856
+ ) : null
17857
+ },
17858
+ `area-${key}`
17859
+ );
17860
+ }
17861
+ return null;
17862
+ })
17863
+ ]
17864
+ }
17865
+ ) }) }),
17866
+ timeSeriesConfig && /* @__PURE__ */ jsxRuntime.jsx(
17867
+ Brush_default,
17868
+ {
17869
+ legend: timeSeriesLegend,
17870
+ data,
17871
+ startIndex,
17872
+ endIndex,
17873
+ onMouseDown: handleMouseDown,
17874
+ brushRef,
17875
+ xAxisKey: xAxisConfig.dataKey,
17876
+ seriesOrder,
17877
+ finalColors,
17878
+ brushHeight: timeSeriesConfig.height,
17879
+ brushColor: timeSeriesConfig.brushColor,
17880
+ miniChartOpacity: timeSeriesConfig.miniChartOpacity,
17881
+ showGrid,
17882
+ gridColor,
17883
+ margin: {
17884
+ left: finalChartLeftMargin,
17885
+ right: finalChartRightMargin
17886
+ }
17887
+ }
17888
+ )
17889
+ ] }) }),
17890
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsxRuntime.jsx(
17891
+ DraggableTooltip_default,
17892
+ {
17893
+ id: tooltip.id,
17894
+ data: adaptDataForTooltip(tooltip.data, xAxisConfig.dataKey),
17895
+ position: tooltip.position,
17896
+ title,
17897
+ dataKeys: allKeys,
17898
+ finalColors,
17899
+ highlightedSeries,
17900
+ toggleHighlight,
17901
+ showOnlyHighlighted,
17902
+ onClose: (id) => setActiveTooltips((prev) => prev.filter((t) => t.id !== id)),
17903
+ onPositionChange: onTooltipPositionChange,
17904
+ periodLabel,
17905
+ dataLabel: "Dados do Per\xEDodo",
17906
+ valueFormatter: finalValueFormatter,
17907
+ categoryFormatter,
17908
+ globalTooltipCount: activeTooltips.length,
17909
+ onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
17910
+ closeAllButtonPosition: "top-center",
17911
+ closeAllButtonVariant: "floating",
17912
+ seriesTypeMap
17913
+ },
17914
+ tooltip.id
17869
17915
  )),
17870
17916
  enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
17871
17917
  CloseAllButton_default,
@@ -17875,29 +17921,6 @@ var Chart = ({
17875
17921
  position: "top-center",
17876
17922
  variant: "floating"
17877
17923
  }
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
17924
  )
17902
17925
  ] });
17903
17926
  };
@@ -18038,6 +18061,13 @@ var HorizontalChart = ({
18038
18061
  setActiveTooltips
18039
18062
  ]
18040
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]);
18041
18071
  if (!data && !isLoading) return null;
18042
18072
  if (isLoading) {
18043
18073
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -18277,7 +18307,8 @@ var HorizontalChart = ({
18277
18307
  finalColors,
18278
18308
  valueFormatter: finalValueFormatter,
18279
18309
  categoryFormatter,
18280
- periodLabel
18310
+ periodLabel,
18311
+ seriesTypeMap
18281
18312
  }
18282
18313
  ) : /* @__PURE__ */ jsxRuntime.jsx(
18283
18314
  TooltipSimple_default,
@@ -18285,7 +18316,8 @@ var HorizontalChart = ({
18285
18316
  finalColors,
18286
18317
  valueFormatter: finalValueFormatter,
18287
18318
  categoryFormatter,
18288
- periodLabel
18319
+ periodLabel,
18320
+ seriesTypeMap
18289
18321
  }
18290
18322
  ),
18291
18323
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
@@ -18371,7 +18403,8 @@ var HorizontalChart = ({
18371
18403
  globalTooltipCount: activeTooltips.length,
18372
18404
  onCloseAll: () => window.dispatchEvent(new Event("closeAllTooltips")),
18373
18405
  closeAllButtonPosition: "top-center",
18374
- closeAllButtonVariant: "floating"
18406
+ closeAllButtonVariant: "floating",
18407
+ seriesTypeMap
18375
18408
  },
18376
18409
  tooltip.id
18377
18410
  )),
@@ -18392,9 +18425,7 @@ var HorizontalChart_default = HorizontalChart;
18392
18425
  var TimeSeries = ({
18393
18426
  data,
18394
18427
  xAxis,
18395
- chartHeight = 350,
18396
- height,
18397
- brushHeight,
18428
+ brushHeight = 60,
18398
18429
  className,
18399
18430
  start,
18400
18431
  end,
@@ -18406,21 +18437,21 @@ var TimeSeries = ({
18406
18437
  miniChartOpacity = 0.2,
18407
18438
  ...rest
18408
18439
  }) => {
18409
- const brushHeightValue = brushHeight ?? height ?? 60;
18410
18440
  const startIndex = defaultStartIndex ?? start ?? 0;
18411
18441
  const endIndex = defaultEndIndex ?? end;
18412
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full flex flex-col", className), children: /* @__PURE__ */ jsxRuntime.jsx(
18442
+ const hasExplicitHeight = /\bh-/.test(className ?? "");
18443
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full flex flex-col overflow-hidden", className), children: /* @__PURE__ */ jsxRuntime.jsx(
18413
18444
  Chart_default,
18414
18445
  {
18415
18446
  ...rest,
18416
18447
  data,
18417
18448
  xAxis,
18418
- height: chartHeight + brushHeightValue + 40,
18449
+ className: hasExplicitHeight ? "flex-1 min-h-0" : void 0,
18419
18450
  timeSeries: {
18420
18451
  start: startIndex,
18421
18452
  end: endIndex,
18422
18453
  onRangeChange,
18423
- height: brushHeightValue,
18454
+ height: brushHeight,
18424
18455
  brushColor,
18425
18456
  brushStroke,
18426
18457
  miniChartOpacity
@@ -18647,6 +18678,145 @@ function Leaderboard({
18647
18678
  }
18648
18679
  );
18649
18680
  }
18681
+ var ZoomImage = React32__namespace.forwardRef(
18682
+ ({
18683
+ className,
18684
+ src,
18685
+ alt,
18686
+ maxZoom = 2,
18687
+ transitionDuration = 0.3,
18688
+ borderRadius = 12,
18689
+ imageClassName,
18690
+ ...props
18691
+ }, ref) => {
18692
+ const mouseX = framerMotion.useMotionValue(50);
18693
+ const mouseY = framerMotion.useMotionValue(50);
18694
+ const zoomLevel = framerMotion.useMotionValue(1);
18695
+ const springConfig = { damping: 20, stiffness: 150, mass: 0.5 };
18696
+ const smoothMouseX = framerMotion.useSpring(mouseX, springConfig);
18697
+ const smoothMouseY = framerMotion.useSpring(mouseY, springConfig);
18698
+ const smoothZoomLevel = framerMotion.useSpring(zoomLevel, springConfig);
18699
+ const transformOrigin = framerMotion.useTransform(
18700
+ [smoothMouseX, smoothMouseY],
18701
+ ([latestX, latestY]) => `${latestX}% ${latestY}%`
18702
+ );
18703
+ const touchStartDist = React32__namespace.useRef(0);
18704
+ const touchStartZoom = React32__namespace.useRef(1);
18705
+ const isPinching = React32__namespace.useRef(false);
18706
+ const handleMouseMove = (e) => {
18707
+ if (isPinching.current) return;
18708
+ const { left, top, width, height } = e.currentTarget.getBoundingClientRect();
18709
+ const x = (e.clientX - left) / width * 100;
18710
+ const y = (e.clientY - top) / height * 100;
18711
+ mouseX.set(x);
18712
+ mouseY.set(y);
18713
+ };
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]);
18728
+ const handleMouseLeave = () => {
18729
+ if (!isPinching.current) {
18730
+ mouseX.set(50);
18731
+ mouseY.set(50);
18732
+ zoomLevel.set(1);
18733
+ }
18734
+ };
18735
+ const getDistance = (touches) => {
18736
+ const dx = touches[0].clientX - touches[1].clientX;
18737
+ const dy = touches[0].clientY - touches[1].clientY;
18738
+ return Math.sqrt(dx * dx + dy * dy);
18739
+ };
18740
+ const getCenter = (touches, rect) => {
18741
+ const x = (touches[0].clientX + touches[1].clientX) / 2;
18742
+ const y = (touches[0].clientY + touches[1].clientY) / 2;
18743
+ return {
18744
+ x: (x - rect.left) / rect.width * 100,
18745
+ y: (y - rect.top) / rect.height * 100
18746
+ };
18747
+ };
18748
+ const handleTouchStart = (e) => {
18749
+ if (e.touches.length === 2) {
18750
+ isPinching.current = true;
18751
+ touchStartDist.current = getDistance(e.touches);
18752
+ touchStartZoom.current = zoomLevel.get();
18753
+ const rect = e.currentTarget.getBoundingClientRect();
18754
+ const center = getCenter(e.touches, rect);
18755
+ mouseX.set(center.x);
18756
+ mouseY.set(center.y);
18757
+ }
18758
+ };
18759
+ const handleTouchMove = (e) => {
18760
+ if (e.touches.length === 2 && isPinching.current) {
18761
+ e.preventDefault();
18762
+ const dist = getDistance(e.touches);
18763
+ const rect = e.currentTarget.getBoundingClientRect();
18764
+ const scaleChange = dist / touchStartDist.current;
18765
+ const newZoom = Math.min(
18766
+ Math.max(1, touchStartZoom.current * scaleChange),
18767
+ maxZoom
18768
+ );
18769
+ zoomLevel.set(newZoom);
18770
+ const center = getCenter(e.touches, rect);
18771
+ mouseX.set(center.x);
18772
+ mouseY.set(center.y);
18773
+ }
18774
+ };
18775
+ const handleTouchEnd = (e) => {
18776
+ if (e.touches.length < 2) {
18777
+ if (isPinching.current) {
18778
+ isPinching.current = false;
18779
+ }
18780
+ }
18781
+ };
18782
+ return /* @__PURE__ */ jsxRuntime.jsx(
18783
+ framerMotion.motion.div,
18784
+ {
18785
+ ref: innerRef,
18786
+ className: cn(
18787
+ "relative w-full h-full overflow-hidden touch-none",
18788
+ className
18789
+ ),
18790
+ style: { borderRadius: `${borderRadius}px` },
18791
+ onMouseMove: handleMouseMove,
18792
+ onMouseLeave: handleMouseLeave,
18793
+ onTouchStart: handleTouchStart,
18794
+ onTouchMove: handleTouchMove,
18795
+ onTouchEnd: handleTouchEnd,
18796
+ ...props,
18797
+ children: /* @__PURE__ */ jsxRuntime.jsx(
18798
+ framerMotion.motion.img,
18799
+ {
18800
+ src,
18801
+ alt,
18802
+ className: cn("w-full h-full object-cover", imageClassName),
18803
+ style: {
18804
+ borderRadius: `${borderRadius}px`,
18805
+ transformOrigin,
18806
+ scale: smoothZoomLevel
18807
+ },
18808
+ transition: {
18809
+ type: "spring",
18810
+ duration: transitionDuration,
18811
+ bounce: 0
18812
+ }
18813
+ }
18814
+ )
18815
+ }
18816
+ );
18817
+ }
18818
+ );
18819
+ ZoomImage.displayName = "ZoomImage";
18650
18820
  var Lens = ({
18651
18821
  children,
18652
18822
  initialZoom = 1.5,
@@ -18670,11 +18840,17 @@ var Lens = ({
18670
18840
  const y = e.clientY - rect.top;
18671
18841
  setMousePosition({ x, y });
18672
18842
  };
18673
- const handleWheel = (e) => {
18674
- if (!isActivated) return;
18675
- const delta = -e.deltaY * 5e-3;
18676
- setZoomFactor((prev) => Math.min(Math.max(1.1, prev + delta), maxZoom));
18677
- };
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]);
18678
18854
  const resetZoom = () => {
18679
18855
  setZoomFactor(initialZoom);
18680
18856
  setIsActivated(false);
@@ -18696,7 +18872,6 @@ var Lens = ({
18696
18872
  resetZoom();
18697
18873
  },
18698
18874
  onMouseMove: handleMouseMove,
18699
- onWheel: handleWheel,
18700
18875
  children: [
18701
18876
  children,
18702
18877
  isStatic ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -18735,9 +18910,9 @@ var Lens = ({
18735
18910
  top: position.y - lensSize / 2,
18736
18911
  width: lensSize,
18737
18912
  height: lensSize,
18738
- borderRadius: "50%",
18739
- boxShadow: "0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2)",
18740
- background: "radial-gradient(circle at center, transparent 60%, rgba(255, 255, 255, 0.1) 70%, rgba(255, 255, 255, 0.2) 80%, transparent 100%)"
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%)"
18741
18916
  }
18742
18917
  }
18743
18918
  )
@@ -18793,137 +18968,73 @@ var Lens = ({
18793
18968
  }
18794
18969
  );
18795
18970
  };
18796
- var ZoomImage = React32__namespace.forwardRef(
18797
- ({
18798
- className,
18799
- src,
18800
- alt,
18801
- maxZoom = 2,
18802
- transitionDuration = 0.3,
18803
- borderRadius = 12,
18804
- imageClassName,
18805
- ...props
18806
- }, ref) => {
18807
- const mouseX = framerMotion.useMotionValue(50);
18808
- const mouseY = framerMotion.useMotionValue(50);
18809
- const zoomLevel = framerMotion.useMotionValue(1);
18810
- const springConfig = { damping: 20, stiffness: 150, mass: 0.5 };
18811
- const smoothMouseX = framerMotion.useSpring(mouseX, springConfig);
18812
- const smoothMouseY = framerMotion.useSpring(mouseY, springConfig);
18813
- const smoothZoomLevel = framerMotion.useSpring(zoomLevel, springConfig);
18814
- const transformOrigin = framerMotion.useTransform(
18815
- [smoothMouseX, smoothMouseY],
18816
- ([latestX, latestY]) => `${latestX}% ${latestY}%`
18817
- );
18818
- const touchStartDist = React32__namespace.useRef(0);
18819
- const touchStartZoom = React32__namespace.useRef(1);
18820
- const isPinching = React32__namespace.useRef(false);
18821
- const handleMouseMove = (e) => {
18822
- if (isPinching.current) return;
18823
- const { left, top, width, height } = e.currentTarget.getBoundingClientRect();
18824
- const x = (e.clientX - left) / width * 100;
18825
- const y = (e.clientY - top) / height * 100;
18826
- mouseX.set(x);
18827
- mouseY.set(y);
18828
- };
18829
- const handleWheel = (e) => {
18830
- const delta = -e.deltaY * 5e-3;
18831
- const newZoom = Math.min(Math.max(1, zoomLevel.get() + delta), maxZoom);
18832
- zoomLevel.set(newZoom);
18833
- };
18834
- const handleMouseLeave = () => {
18835
- if (!isPinching.current) {
18836
- mouseX.set(50);
18837
- mouseY.set(50);
18838
- zoomLevel.set(1);
18971
+ function CarouselSkeleton({ className }) {
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 bg-muted rounded-lg overflow-hidden relative", children: [
18973
+ /* @__PURE__ */ jsxRuntime.jsx(
18974
+ framerMotion.motion.div,
18975
+ {
18976
+ className: "absolute inset-0",
18977
+ style: {
18978
+ background: "linear-gradient(105deg, transparent 30%, hsl(var(--muted-foreground) / 0.08) 50%, transparent 70%)",
18979
+ backgroundSize: "200% 100%"
18980
+ },
18981
+ animate: { backgroundPositionX: ["200%", "-200%"] },
18982
+ transition: {
18983
+ duration: 1.6,
18984
+ ease: "linear",
18985
+ repeat: Infinity
18986
+ }
18839
18987
  }
18840
- };
18841
- const getDistance = (touches) => {
18842
- const dx = touches[0].clientX - touches[1].clientX;
18843
- const dy = touches[0].clientY - touches[1].clientY;
18844
- return Math.sqrt(dx * dx + dy * dy);
18845
- };
18846
- const getCenter = (touches, rect) => {
18847
- const x = (touches[0].clientX + touches[1].clientX) / 2;
18848
- const y = (touches[0].clientY + touches[1].clientY) / 2;
18849
- return {
18850
- x: (x - rect.left) / rect.width * 100,
18851
- y: (y - rect.top) / rect.height * 100
18852
- };
18853
- };
18854
- const handleTouchStart = (e) => {
18855
- if (e.touches.length === 2) {
18856
- isPinching.current = true;
18857
- touchStartDist.current = getDistance(e.touches);
18858
- touchStartZoom.current = zoomLevel.get();
18859
- const rect = e.currentTarget.getBoundingClientRect();
18860
- const center = getCenter(e.touches, rect);
18861
- mouseX.set(center.x);
18862
- mouseY.set(center.y);
18863
- }
18864
- };
18865
- const handleTouchMove = (e) => {
18866
- if (e.touches.length === 2 && isPinching.current) {
18867
- e.preventDefault();
18868
- const dist = getDistance(e.touches);
18869
- const rect = e.currentTarget.getBoundingClientRect();
18870
- const scaleChange = dist / touchStartDist.current;
18871
- const newZoom = Math.min(
18872
- Math.max(1, touchStartZoom.current * scaleChange),
18873
- maxZoom
18874
- );
18875
- zoomLevel.set(newZoom);
18876
- const center = getCenter(e.touches, rect);
18877
- mouseX.set(center.x);
18878
- mouseY.set(center.y);
18879
- }
18880
- };
18881
- const handleTouchEnd = (e) => {
18882
- if (e.touches.length < 2) {
18883
- if (isPinching.current) {
18884
- isPinching.current = false;
18885
- }
18886
- }
18887
- };
18888
- return /* @__PURE__ */ jsxRuntime.jsx(
18988
+ ),
18989
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
18889
18990
  framerMotion.motion.div,
18890
18991
  {
18891
- ref,
18892
- className: cn(
18893
- "relative w-full h-full overflow-hidden touch-none",
18894
- className
18895
- ),
18896
- style: { borderRadius: `${borderRadius}px` },
18897
- onMouseMove: handleMouseMove,
18898
- onMouseLeave: handleMouseLeave,
18899
- onWheel: handleWheel,
18900
- onTouchStart: handleTouchStart,
18901
- onTouchMove: handleTouchMove,
18902
- onTouchEnd: handleTouchEnd,
18903
- ...props,
18904
- children: /* @__PURE__ */ jsxRuntime.jsx(
18905
- framerMotion.motion.img,
18992
+ animate: { opacity: [0.3, 0.6, 0.3] },
18993
+ transition: {
18994
+ duration: 2,
18995
+ repeat: Infinity,
18996
+ ease: "easeInOut"
18997
+ },
18998
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
18999
+ "svg",
18906
19000
  {
18907
- src,
18908
- alt,
18909
- className: cn("w-full h-full object-cover", imageClassName),
18910
- style: {
18911
- borderRadius: `${borderRadius}px`,
18912
- transformOrigin,
18913
- scale: smoothZoomLevel
18914
- },
18915
- transition: {
18916
- type: "spring",
18917
- duration: transitionDuration,
18918
- bounce: 0
18919
- }
19001
+ width: "48",
19002
+ height: "48",
19003
+ viewBox: "0 0 24 24",
19004
+ fill: "none",
19005
+ stroke: "currentColor",
19006
+ strokeWidth: "1",
19007
+ strokeLinecap: "round",
19008
+ strokeLinejoin: "round",
19009
+ className: "text-muted-foreground/30",
19010
+ children: [
19011
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
19012
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
19013
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "21 15 16 10 5 21" })
19014
+ ]
18920
19015
  }
18921
19016
  )
18922
19017
  }
18923
- );
18924
- }
18925
- );
18926
- ZoomImage.displayName = "ZoomImage";
19018
+ ) }),
19019
+ /* @__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" }),
19020
+ /* @__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" }),
19021
+ /* @__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(
19022
+ framerMotion.motion.div,
19023
+ {
19024
+ className: "h-2 rounded-full bg-muted-foreground/20",
19025
+ style: { width: w },
19026
+ animate: { opacity: [0.4, 0.7, 0.4] },
19027
+ transition: {
19028
+ duration: 1.8,
19029
+ repeat: Infinity,
19030
+ ease: "easeInOut",
19031
+ delay: i * 0.15
19032
+ }
19033
+ },
19034
+ i
19035
+ )) })
19036
+ ] }) }) }) });
19037
+ }
18927
19038
  function CarouselBase({
18928
19039
  items,
18929
19040
  className,
@@ -18935,37 +19046,35 @@ function CarouselBase({
18935
19046
  showIndicators = true,
18936
19047
  autoPlay = false,
18937
19048
  autoPlayInterval = 3e3,
18938
- springConfig = {
18939
- stiffness: 300,
18940
- damping: 30
18941
- },
18942
19049
  zoomEffect = null,
18943
- download = false
19050
+ download = false,
19051
+ isLoading = false
18944
19052
  }) {
18945
19053
  const isMobile = useIsMobile();
18946
19054
  const [index, setIndex] = React32.useState(0);
18947
- const containerRef = React32.useRef(null);
18948
- const x = framerMotion.useMotionValue(0);
19055
+ const options = React32.useMemo(() => ({ loop: true }), []);
19056
+ const [emblaRef, emblaApi] = useEmblaCarousel__default.default(options);
18949
19057
  const [isDownloading, setIsDownloading] = React32.useState(false);
18950
19058
  const [downloadSuccess, setDownloadSuccess] = React32.useState(false);
18951
19059
  React32.useEffect(() => {
18952
- if (containerRef.current) {
18953
- const containerWidth = containerRef.current.offsetWidth || 1;
18954
- const targetX = -index * containerWidth;
18955
- framerMotion.animate(x, targetX, {
18956
- type: "spring",
18957
- stiffness: springConfig.stiffness,
18958
- damping: springConfig.damping
18959
- });
18960
- }
18961
- }, [index, x, springConfig.stiffness, springConfig.damping]);
19060
+ if (!emblaApi) return;
19061
+ const onSelect = () => {
19062
+ setIndex(emblaApi.selectedScrollSnap());
19063
+ };
19064
+ emblaApi.on("select", onSelect);
19065
+ emblaApi.on("reInit", onSelect);
19066
+ return () => {
19067
+ emblaApi.off("select", onSelect);
19068
+ emblaApi.off("reInit", onSelect);
19069
+ };
19070
+ }, [emblaApi]);
18962
19071
  React32.useEffect(() => {
18963
- if (!autoPlay || items.length <= 1) return;
19072
+ if (!autoPlay || items.length <= 1 || !emblaApi) return;
18964
19073
  const interval = setInterval(() => {
18965
- setIndex((i) => (i + 1) % items.length);
19074
+ emblaApi.scrollNext();
18966
19075
  }, autoPlayInterval);
18967
19076
  return () => clearInterval(interval);
18968
- }, [autoPlay, autoPlayInterval, items.length]);
19077
+ }, [autoPlay, autoPlayInterval, items.length, emblaApi]);
18969
19078
  const handleDownload = async () => {
18970
19079
  if (isDownloading) return;
18971
19080
  setIsDownloading(true);
@@ -18990,21 +19099,36 @@ function CarouselBase({
18990
19099
  setIsDownloading(false);
18991
19100
  }
18992
19101
  };
18993
- return /* @__PURE__ */ jsxRuntime.jsx(
18994
- "div",
19102
+ if (isLoading) {
19103
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
19104
+ framerMotion.motion.div,
19105
+ {
19106
+ initial: { opacity: 0 },
19107
+ animate: { opacity: 1 },
19108
+ exit: { opacity: 0 },
19109
+ transition: { duration: 0.3 },
19110
+ style: { width, height },
19111
+ className: "h-full",
19112
+ children: /* @__PURE__ */ jsxRuntime.jsx(CarouselSkeleton, { className })
19113
+ },
19114
+ "carousel-skeleton"
19115
+ ) });
19116
+ }
19117
+ return /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: /* @__PURE__ */ jsxRuntime.jsx(
19118
+ framerMotion.motion.div,
18995
19119
  {
19120
+ initial: { opacity: 0 },
19121
+ animate: { opacity: 1 },
19122
+ transition: { duration: 0.4 },
18996
19123
  className: cn("w-full lg:p-10 sm:p-4 p-2", className),
18997
19124
  style: { width, height },
18998
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-3 h-full", children: /* @__PURE__ */ jsxRuntime.jsxs(
18999
- "div",
19000
- {
19001
- className: cn(
19002
- "relative overflow-hidden rounded-lg h-full",
19003
- containerClassName
19004
- ),
19005
- ref: containerRef,
19006
- children: [
19007
- /* @__PURE__ */ jsxRuntime.jsx(framerMotion.motion.div, { className: "flex h-full", style: { x }, children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 w-full h-full", children: isMobile || zoomEffect === "scale" ? /* @__PURE__ */ jsxRuntime.jsx(
19125
+ 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: [
19126
+ /* @__PURE__ */ jsxRuntime.jsx(
19127
+ "div",
19128
+ {
19129
+ ref: emblaRef,
19130
+ className: "overflow-hidden rounded-lg h-full cursor-grab active:cursor-grabbing",
19131
+ 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(
19008
19132
  ZoomImage,
19009
19133
  {
19010
19134
  src: item.url,
@@ -19036,156 +19160,400 @@ function CarouselBase({
19036
19160
  ),
19037
19161
  draggable: false
19038
19162
  }
19039
- ) }, item.id)) }),
19040
- download && /* @__PURE__ */ jsxRuntime.jsx(
19041
- framerMotion.motion.button,
19163
+ ) }, item.id)) })
19164
+ }
19165
+ ),
19166
+ download && /* @__PURE__ */ jsxRuntime.jsx(
19167
+ framerMotion.motion.button,
19168
+ {
19169
+ onClick: handleDownload,
19170
+ onPointerDown: (e) => e.stopPropagation(),
19171
+ onTouchStart: (e) => e.stopPropagation(),
19172
+ onMouseDown: (e) => e.stopPropagation(),
19173
+ className: cn(
19174
+ "absolute top-4 right-4 z-50 p-2 rounded-full text-white transition-colors border border-white/10",
19175
+ downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70"
19176
+ ),
19177
+ title: "Download image",
19178
+ initial: false,
19179
+ animate: {
19180
+ scale: isDownloading ? 0.9 : 1,
19181
+ backgroundColor: downloadSuccess ? "rgb(34, 197, 94)" : "rgba(0, 0, 0, 0.5)"
19182
+ },
19183
+ whileHover: { scale: 1.05 },
19184
+ whileTap: { scale: 0.95 },
19185
+ children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", initial: false, children: isDownloading ? /* @__PURE__ */ jsxRuntime.jsx(
19186
+ framerMotion.motion.svg,
19042
19187
  {
19043
- onClick: handleDownload,
19044
- className: cn(
19045
- "absolute top-4 right-4 z-30 p-2 rounded-full text-white transition-colors border border-white/10",
19046
- downloadSuccess ? "bg-green-500 hover:bg-green-600" : "bg-black/50 hover:bg-black/70"
19047
- ),
19048
- title: "Download image",
19049
- initial: false,
19050
- animate: {
19051
- scale: isDownloading ? 0.9 : 1,
19052
- backgroundColor: downloadSuccess ? "rgb(34, 197, 94)" : "rgba(0, 0, 0, 0.5)"
19188
+ xmlns: "http://www.w3.org/2000/svg",
19189
+ width: "20",
19190
+ height: "20",
19191
+ viewBox: "0 0 24 24",
19192
+ fill: "none",
19193
+ stroke: "currentColor",
19194
+ strokeWidth: "2",
19195
+ strokeLinecap: "round",
19196
+ strokeLinejoin: "round",
19197
+ animate: { rotate: 360 },
19198
+ transition: {
19199
+ repeat: Infinity,
19200
+ ease: "linear",
19201
+ duration: 1
19053
19202
  },
19054
- whileHover: { scale: 1.05 },
19055
- whileTap: { scale: 0.95 },
19056
- children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", initial: false, children: isDownloading ? /* @__PURE__ */ jsxRuntime.jsx(
19057
- framerMotion.motion.svg,
19058
- {
19059
- xmlns: "http://www.w3.org/2000/svg",
19060
- width: "20",
19061
- height: "20",
19062
- viewBox: "0 0 24 24",
19063
- fill: "none",
19064
- stroke: "currentColor",
19065
- strokeWidth: "2",
19066
- strokeLinecap: "round",
19067
- strokeLinejoin: "round",
19068
- animate: { rotate: 360 },
19069
- transition: {
19070
- repeat: Infinity,
19071
- ease: "linear",
19072
- duration: 1
19073
- },
19074
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
19075
- },
19076
- "loading"
19077
- ) : downloadSuccess ? /* @__PURE__ */ jsxRuntime.jsx(
19078
- framerMotion.motion.svg,
19079
- {
19080
- xmlns: "http://www.w3.org/2000/svg",
19081
- width: "20",
19082
- height: "20",
19083
- viewBox: "0 0 24 24",
19084
- fill: "none",
19085
- stroke: "currentColor",
19086
- strokeWidth: "2",
19087
- strokeLinecap: "round",
19088
- strokeLinejoin: "round",
19089
- initial: { scale: 0.5, opacity: 0 },
19090
- animate: { scale: 1, opacity: 1 },
19091
- exit: { scale: 0.5, opacity: 0 },
19092
- children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" })
19093
- },
19094
- "success"
19095
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
19096
- framerMotion.motion.svg,
19097
- {
19098
- xmlns: "http://www.w3.org/2000/svg",
19099
- width: "20",
19100
- height: "20",
19101
- viewBox: "0 0 24 24",
19102
- fill: "none",
19103
- stroke: "currentColor",
19104
- strokeWidth: "2",
19105
- strokeLinecap: "round",
19106
- strokeLinejoin: "round",
19107
- initial: { scale: 0.5, opacity: 0 },
19108
- animate: { scale: 1, opacity: 1 },
19109
- exit: { scale: 0.5, opacity: 0 },
19110
- children: [
19111
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
19112
- /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 10 12 15 17 10" }),
19113
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
19114
- ]
19115
- },
19116
- "download"
19117
- ) })
19118
- }
19119
- ),
19120
- showControls && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19121
- /* @__PURE__ */ jsxRuntime.jsx(
19122
- framerMotion.motion.button,
19203
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
19204
+ },
19205
+ "loading"
19206
+ ) : downloadSuccess ? /* @__PURE__ */ jsxRuntime.jsx(
19207
+ framerMotion.motion.svg,
19208
+ {
19209
+ xmlns: "http://www.w3.org/2000/svg",
19210
+ width: "20",
19211
+ height: "20",
19212
+ viewBox: "0 0 24 24",
19213
+ fill: "none",
19214
+ stroke: "currentColor",
19215
+ strokeWidth: "2",
19216
+ strokeLinecap: "round",
19217
+ strokeLinejoin: "round",
19218
+ initial: { scale: 0.5, opacity: 0 },
19219
+ animate: { scale: 1, opacity: 1 },
19220
+ exit: { scale: 0.5, opacity: 0 },
19221
+ children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" })
19222
+ },
19223
+ "success"
19224
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
19225
+ framerMotion.motion.svg,
19226
+ {
19227
+ xmlns: "http://www.w3.org/2000/svg",
19228
+ width: "20",
19229
+ height: "20",
19230
+ viewBox: "0 0 24 24",
19231
+ fill: "none",
19232
+ stroke: "currentColor",
19233
+ strokeWidth: "2",
19234
+ strokeLinecap: "round",
19235
+ strokeLinejoin: "round",
19236
+ initial: { scale: 0.5, opacity: 0 },
19237
+ animate: { scale: 1, opacity: 1 },
19238
+ exit: { scale: 0.5, opacity: 0 },
19239
+ children: [
19240
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
19241
+ /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 10 12 15 17 10" }),
19242
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
19243
+ ]
19244
+ },
19245
+ "download"
19246
+ ) })
19247
+ }
19248
+ ),
19249
+ showControls && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19250
+ /* @__PURE__ */ jsxRuntime.jsx(
19251
+ framerMotion.motion.button,
19252
+ {
19253
+ disabled: !emblaApi?.canScrollPrev(),
19254
+ onClick: () => emblaApi?.scrollPrev(),
19255
+ onPointerDown: (e) => e.stopPropagation(),
19256
+ onTouchStart: (e) => e.stopPropagation(),
19257
+ onMouseDown: (e) => e.stopPropagation(),
19258
+ 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
19259
+ ${!emblaApi?.canScrollPrev() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
19260
+ children: /* @__PURE__ */ jsxRuntime.jsx(
19261
+ "svg",
19123
19262
  {
19124
- disabled: index === 0,
19125
- onClick: () => setIndex((i) => Math.max(0, i - 1)),
19126
- 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
19127
- ${index === 0 ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
19263
+ className: "w-6 h-6",
19264
+ fill: "none",
19265
+ stroke: "currentColor",
19266
+ viewBox: "0 0 24 24",
19128
19267
  children: /* @__PURE__ */ jsxRuntime.jsx(
19129
- "svg",
19268
+ "path",
19130
19269
  {
19131
- className: "w-6 h-6",
19132
- fill: "none",
19133
- stroke: "currentColor",
19134
- viewBox: "0 0 24 24",
19135
- children: /* @__PURE__ */ jsxRuntime.jsx(
19136
- "path",
19137
- {
19138
- strokeLinecap: "round",
19139
- strokeLinejoin: "round",
19140
- strokeWidth: 2,
19141
- d: "M15 19l-7-7 7-7"
19142
- }
19143
- )
19270
+ strokeLinecap: "round",
19271
+ strokeLinejoin: "round",
19272
+ strokeWidth: 2,
19273
+ d: "M15 19l-7-7 7-7"
19144
19274
  }
19145
19275
  )
19146
19276
  }
19147
- ),
19148
- /* @__PURE__ */ jsxRuntime.jsx(
19149
- framerMotion.motion.button,
19277
+ )
19278
+ }
19279
+ ),
19280
+ /* @__PURE__ */ jsxRuntime.jsx(
19281
+ framerMotion.motion.button,
19282
+ {
19283
+ disabled: !emblaApi?.canScrollNext(),
19284
+ onClick: () => emblaApi?.scrollNext(),
19285
+ onPointerDown: (e) => e.stopPropagation(),
19286
+ onTouchStart: (e) => e.stopPropagation(),
19287
+ onMouseDown: (e) => e.stopPropagation(),
19288
+ 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
19289
+ ${!emblaApi?.canScrollNext() ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
19290
+ children: /* @__PURE__ */ jsxRuntime.jsx(
19291
+ "svg",
19150
19292
  {
19151
- disabled: index === items.length - 1,
19152
- onClick: () => setIndex((i) => Math.min(items.length - 1, i + 1)),
19153
- 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
19154
- ${index === items.length - 1 ? "opacity-40 cursor-not-allowed" : "bg-secondary hover:scale-110 hover:opacity-100 opacity-70"}`,
19293
+ className: "w-6 h-6",
19294
+ fill: "none",
19295
+ stroke: "currentColor",
19296
+ viewBox: "0 0 24 24",
19155
19297
  children: /* @__PURE__ */ jsxRuntime.jsx(
19156
- "svg",
19298
+ "path",
19157
19299
  {
19158
- className: "w-6 h-6",
19159
- fill: "none",
19160
- stroke: "currentColor",
19161
- viewBox: "0 0 24 24",
19162
- children: /* @__PURE__ */ jsxRuntime.jsx(
19163
- "path",
19164
- {
19165
- strokeLinecap: "round",
19166
- strokeLinejoin: "round",
19167
- strokeWidth: 2,
19168
- d: "M9 5l7 7-7 7"
19169
- }
19170
- )
19300
+ strokeLinecap: "round",
19301
+ strokeLinejoin: "round",
19302
+ strokeWidth: 2,
19303
+ d: "M9 5l7 7-7 7"
19171
19304
  }
19172
19305
  )
19173
19306
  }
19174
19307
  )
19175
- ] }),
19176
- 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(
19177
- "button",
19178
- {
19179
- onClick: () => setIndex(i),
19180
- className: `h-2 rounded-full transition-all ${i === index ? "w-8 bg-white" : "w-2 bg-white/50"}`
19181
- },
19182
- i
19183
- )) })
19184
- ]
19185
- }
19186
- ) })
19308
+ }
19309
+ )
19310
+ ] }),
19311
+ 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(
19312
+ "button",
19313
+ {
19314
+ onClick: () => emblaApi?.scrollTo(i),
19315
+ onPointerDown: (e) => e.stopPropagation(),
19316
+ onTouchStart: (e) => e.stopPropagation(),
19317
+ onMouseDown: (e) => e.stopPropagation(),
19318
+ className: `h-2 rounded-full transition-all ${i === index ? "w-8 bg-white" : "w-2 bg-white/50"}`
19319
+ },
19320
+ i
19321
+ )) })
19322
+ ] }) })
19323
+ },
19324
+ "carousel-content"
19325
+ ) });
19326
+ }
19327
+ function useMediaQuery(query) {
19328
+ const [value, setValue] = React32__namespace.useState(false);
19329
+ React32__namespace.useEffect(() => {
19330
+ function onChange(event) {
19331
+ setValue(event.matches);
19332
+ }
19333
+ const result = window.matchMedia(query);
19334
+ result.addEventListener("change", onChange);
19335
+ setValue(result.matches);
19336
+ return () => result.removeEventListener("change", onChange);
19337
+ }, [query]);
19338
+ return value;
19339
+ }
19340
+ var FULL_CIRCLE = 360;
19341
+ var START_ANGLE = -90;
19342
+ function degToRad(deg) {
19343
+ return deg * Math.PI / 180;
19344
+ }
19345
+ function polarToCartesian(radius, angleDeg) {
19346
+ const rad = degToRad(angleDeg);
19347
+ return { x: Math.cos(rad) * radius, y: Math.sin(rad) * radius };
19348
+ }
19349
+ function slicePath(index, total, wedgeRadius, innerRadius) {
19350
+ if (total <= 0) return "";
19351
+ const anglePerSlice = FULL_CIRCLE / total;
19352
+ const midDeg = START_ANGLE + anglePerSlice * index;
19353
+ const halfSlice = anglePerSlice / 2;
19354
+ const startDeg = midDeg - halfSlice;
19355
+ const endDeg = midDeg + halfSlice;
19356
+ const outerStart = polarToCartesian(wedgeRadius, startDeg);
19357
+ const outerEnd = polarToCartesian(wedgeRadius, endDeg);
19358
+ const innerStart = polarToCartesian(innerRadius, startDeg);
19359
+ const innerEnd = polarToCartesian(innerRadius, endDeg);
19360
+ const largeArcFlag = anglePerSlice > 180 ? 1 : 0;
19361
+ 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`;
19362
+ }
19363
+ function RadialMenu({
19364
+ children,
19365
+ menuItems,
19366
+ size = 240,
19367
+ iconSize = 24,
19368
+ bandWidth = 60,
19369
+ innerGap = 16,
19370
+ outerGap = 12,
19371
+ outerRingWidth = 8,
19372
+ onSelect
19373
+ }) {
19374
+ const isMobile = useMediaQuery("(max-width: 768px)");
19375
+ const radius = size / 2;
19376
+ const outerRingOuterRadius = radius;
19377
+ const outerRingInnerRadius = outerRingOuterRadius - outerRingWidth;
19378
+ const wedgeOuterRadius = outerRingInnerRadius - outerGap;
19379
+ const wedgeInnerRadius = wedgeOuterRadius - bandWidth;
19380
+ const iconRingRadius = (wedgeOuterRadius + wedgeInnerRadius) / 2;
19381
+ const centerRadius = Math.max(wedgeInnerRadius - innerGap, 0);
19382
+ const slice = 360 / menuItems.length;
19383
+ const [activeIndex, setActiveIndex] = React32__namespace.useState(null);
19384
+ const timerRef = React32__namespace.useRef(null);
19385
+ const isLongPress = React32__namespace.useRef(false);
19386
+ const handleTouchStart = (e) => {
19387
+ isLongPress.current = false;
19388
+ const touch = e.touches[0];
19389
+ const { clientX, clientY } = touch;
19390
+ timerRef.current = setTimeout(() => {
19391
+ isLongPress.current = true;
19392
+ const event = new MouseEvent("contextmenu", {
19393
+ bubbles: true,
19394
+ cancelable: true,
19395
+ view: window,
19396
+ clientX,
19397
+ clientY,
19398
+ button: 2,
19399
+ buttons: 2
19400
+ });
19401
+ e.target.dispatchEvent(event);
19402
+ }, 1e3);
19403
+ };
19404
+ const handleTouchEnd = () => {
19405
+ if (timerRef.current) {
19406
+ clearTimeout(timerRef.current);
19187
19407
  }
19188
- );
19408
+ };
19409
+ const handleTouchMove = () => {
19410
+ if (timerRef.current) {
19411
+ clearTimeout(timerRef.current);
19412
+ }
19413
+ };
19414
+ const containerVariants = {
19415
+ hidden: { opacity: 0, scale: 0.8 },
19416
+ visible: {
19417
+ opacity: 1,
19418
+ scale: 1,
19419
+ transition: isMobile ? { duration: 0 } : {
19420
+ delayChildren: 0.05,
19421
+ staggerChildren: 0.03,
19422
+ type: "spring",
19423
+ stiffness: 300,
19424
+ damping: 24
19425
+ }
19426
+ },
19427
+ exit: {
19428
+ opacity: 0,
19429
+ scale: 0.8,
19430
+ transition: isMobile ? { duration: 0 } : { duration: 0.15 }
19431
+ }
19432
+ };
19433
+ const itemVariants2 = {
19434
+ hidden: { opacity: 0, scale: 0, rotate: -20 },
19435
+ visible: {
19436
+ opacity: 1,
19437
+ scale: 1,
19438
+ rotate: 0,
19439
+ transition: isMobile ? { duration: 0 } : { type: "spring", stiffness: 400, damping: 20 }
19440
+ }
19441
+ };
19442
+ return /* @__PURE__ */ jsxRuntime.jsxs(ContextMenuBase, { children: [
19443
+ /* @__PURE__ */ jsxRuntime.jsx(ContextMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
19444
+ "div",
19445
+ {
19446
+ className: "select-none outline-none group touch-none",
19447
+ onTouchStart: handleTouchStart,
19448
+ onTouchEnd: handleTouchEnd,
19449
+ onTouchMove: handleTouchMove,
19450
+ 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)" })
19451
+ }
19452
+ ) }),
19453
+ /* @__PURE__ */ jsxRuntime.jsx(
19454
+ ContextMenuContentBase,
19455
+ {
19456
+ className: "p-0 border-none bg-transparent shadow-none overflow-visible -translate-x-1/2 -translate-y-1/2",
19457
+ style: { width: size, height: size },
19458
+ children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsxs(
19459
+ framerMotion.motion.div,
19460
+ {
19461
+ className: "relative size-full drop-shadow-xl will-change-transform",
19462
+ variants: containerVariants,
19463
+ initial: "hidden",
19464
+ animate: "visible",
19465
+ exit: "exit",
19466
+ children: [
19467
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 rounded-full bg-background/5 blur-2xl -z-10" }),
19468
+ /* @__PURE__ */ jsxRuntime.jsxs(
19469
+ "svg",
19470
+ {
19471
+ className: "absolute inset-0 size-full overflow-visible",
19472
+ viewBox: `${-radius} ${-radius} ${radius * 2} ${radius * 2}`,
19473
+ children: [
19474
+ /* @__PURE__ */ jsxRuntime.jsx(
19475
+ framerMotion.motion.circle,
19476
+ {
19477
+ r: centerRadius,
19478
+ initial: { scale: 0 },
19479
+ animate: { scale: 1 },
19480
+ transition: isMobile ? { duration: 0 } : {
19481
+ type: "spring",
19482
+ stiffness: 300,
19483
+ delay: 0.2
19484
+ },
19485
+ className: "fill-background stroke-border stroke-1 shadow-inner"
19486
+ }
19487
+ ),
19488
+ menuItems.map((item, index) => {
19489
+ const Icon = item.icon;
19490
+ const midDeg = START_ANGLE + slice * index;
19491
+ const { x: iconX, y: iconY } = polarToCartesian(
19492
+ iconRingRadius,
19493
+ midDeg
19494
+ );
19495
+ const isActive = activeIndex === index;
19496
+ const ICON_BOX = iconSize * 2.5;
19497
+ return /* @__PURE__ */ jsxRuntime.jsxs(
19498
+ framerMotion.motion.g,
19499
+ {
19500
+ variants: itemVariants2,
19501
+ className: "cursor-pointer outline-none",
19502
+ onMouseEnter: () => setActiveIndex(index),
19503
+ onMouseLeave: () => setActiveIndex(null),
19504
+ onClick: () => onSelect?.(item),
19505
+ style: { originX: "0px", originY: "0px" },
19506
+ children: [
19507
+ /* @__PURE__ */ jsxRuntime.jsx(
19508
+ "path",
19509
+ {
19510
+ d: slicePath(
19511
+ index,
19512
+ menuItems.length,
19513
+ wedgeOuterRadius,
19514
+ wedgeInnerRadius
19515
+ ),
19516
+ className: cn(
19517
+ "transition-colors duration-200 stroke-1",
19518
+ isActive ? "fill-primary stroke-primary-foreground/20" : "fill-background/90 stroke-border/50 hover:fill-accent"
19519
+ )
19520
+ }
19521
+ ),
19522
+ /* @__PURE__ */ jsxRuntime.jsx(
19523
+ "foreignObject",
19524
+ {
19525
+ x: iconX - ICON_BOX / 2,
19526
+ y: iconY - ICON_BOX / 2,
19527
+ width: ICON_BOX,
19528
+ height: ICON_BOX,
19529
+ className: "pointer-events-none",
19530
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "size-full flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
19531
+ Icon,
19532
+ {
19533
+ size: iconSize,
19534
+ weight: isActive ? "fill" : "regular",
19535
+ className: cn(
19536
+ "transition-all duration-200",
19537
+ isActive ? "text-primary-foreground " : "text-muted-foreground"
19538
+ )
19539
+ }
19540
+ ) })
19541
+ }
19542
+ )
19543
+ ]
19544
+ },
19545
+ item.id
19546
+ );
19547
+ })
19548
+ ]
19549
+ }
19550
+ )
19551
+ ]
19552
+ }
19553
+ ) })
19554
+ }
19555
+ )
19556
+ ] });
19189
19557
  }
19190
19558
 
19191
19559
  exports.AddButton = AddButton;
@@ -19399,6 +19767,7 @@ exports.ProgressBase = ProgressBase;
19399
19767
  exports.ProgressCirclesBase = ProgressCirclesBase;
19400
19768
  exports.ProgressPanelsBase = ProgressPanelsBase;
19401
19769
  exports.ProgressSegmentsBase = ProgressSegmentsBase;
19770
+ exports.RadialMenu = RadialMenu;
19402
19771
  exports.RangePicker = RangePicker;
19403
19772
  exports.RefreshButton = RefreshButton;
19404
19773
  exports.SaveButton = SaveButton;