@mlw-packages/react-components 1.7.16 → 1.7.18

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
@@ -651,6 +651,13 @@ __export(index_exports, {
651
651
  MonthView: () => MonthView,
652
652
  MoreButton: () => MoreButton,
653
653
  MultiCombobox: () => MultiCombobox,
654
+ MultiSelectBase: () => MultiSelectBase,
655
+ MultiSelectContentBase: () => MultiSelectContentBase,
656
+ MultiSelectGroupBase: () => MultiSelectGroupBase,
657
+ MultiSelectItemBase: () => MultiSelectItemBase,
658
+ MultiSelectSeparatorBase: () => MultiSelectSeparatorBase,
659
+ MultiSelectTriggerBase: () => MultiSelectTriggerBase,
660
+ MultiSelectValueBase: () => MultiSelectValueBase,
654
661
  NavigationMenuBase: () => NavigationMenuBase,
655
662
  NavigationMenuContentBase: () => NavigationMenuContentBase,
656
663
  NavigationMenuIndicatorBase: () => NavigationMenuIndicatorBase,
@@ -2744,7 +2751,7 @@ var Highlights = ({
2744
2751
  const label = mapperConfig[k]?.label ?? k;
2745
2752
  const color = finalColors[k];
2746
2753
  const pillClasses = cn(
2747
- "inline-flex items-center gap-2 px-3 py-1 rounded-full text-sm border transition-all select-none relative overflow-hidden",
2754
+ "inline-flex items-center gap-2 px-2 rounded-lg text-xs border transition-all select-none relative overflow-hidden h-7",
2748
2755
  isHighlighted ? "pr-8" : "",
2749
2756
  isHighlighted ? "bg-card/95 border-2 text-foreground shadow-[0_6px_18px_rgba(0,0,0,0.12)]" : "bg-muted/10 border-border text-muted-foreground hover:bg-muted/5"
2750
2757
  );
@@ -2779,7 +2786,7 @@ var Highlights = ({
2779
2786
  style: {
2780
2787
  backgroundColor: color,
2781
2788
  borderColor: isHighlighted ? color : "transparent",
2782
- boxShadow: isHighlighted ? `0 6px 20px ${color}33` : void 0
2789
+ boxShadow: isHighlighted ? `0 6px 10px ${color}33` : void 0
2783
2790
  },
2784
2791
  layout: true,
2785
2792
  initial: { scale: 0.8, opacity: 0.9 },
@@ -2794,7 +2801,7 @@ var Highlights = ({
2794
2801
  showFullLabel ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2795
2802
  import_framer_motion8.motion.span,
2796
2803
  {
2797
- className: "truncate max-w-[10rem] pr-2",
2804
+ className: "truncate max-w-[10rem] mt-0.5",
2798
2805
  layout: true,
2799
2806
  children: label
2800
2807
  }
@@ -3959,13 +3966,27 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
3959
3966
  } else {
3960
3967
  centerY = 0;
3961
3968
  }
3969
+ const baseFontSize = 10;
3970
+ let fontSize = baseFontSize;
3971
+ if (typeof pWidth === "number") {
3972
+ const padding = 7;
3973
+ const approxCharWidth = 7;
3974
+ const requiredWidth = String(text).length * approxCharWidth + padding * 2;
3975
+ const widthScale = Math.min(1, pWidth / Math.max(1, requiredWidth));
3976
+ fontSize = Math.max(1, Math.round(baseFontSize * widthScale));
3977
+ }
3978
+ if (typeof pHeight === "number") {
3979
+ const heightRef = 14;
3980
+ const heightFactor = Math.max(0.8, Math.min(1.6, pHeight / heightRef));
3981
+ fontSize = Math.min(18, Math.max(8, Math.round(fontSize * heightFactor)));
3982
+ }
3962
3983
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3963
3984
  "text",
3964
3985
  {
3965
3986
  x: centerX,
3966
3987
  y: centerY,
3967
3988
  fill: "#ffffff",
3968
- fontSize: 10,
3989
+ fontSize,
3969
3990
  fontWeight: 700,
3970
3991
  textAnchor: "middle",
3971
3992
  dominantBaseline: "central",
@@ -3976,8 +3997,146 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
3976
3997
  };
3977
3998
  };
3978
3999
 
3979
- // src/components/charts/Chart.tsx
4000
+ // src/components/charts/NoData.tsx
3980
4001
  var import_jsx_runtime28 = require("react/jsx-runtime");
4002
+ var NoData = ({
4003
+ paddingLeft = 0,
4004
+ height = 360,
4005
+ message = "Sem dados para exibir",
4006
+ className
4007
+ }) => {
4008
+ const svgHeight = typeof height === "number" ? height : 360;
4009
+ const bars = [
4010
+ { x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
4011
+ { x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
4012
+ { x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
4013
+ { x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
4014
+ { x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
4015
+ ];
4016
+ const styleVars = {
4017
+ ["--pl"]: `${paddingLeft}px`,
4018
+ ["--svg-h"]: typeof height === "number" ? `${height}px` : String(height)
4019
+ };
4020
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4021
+ "div",
4022
+ {
4023
+ className: cn(
4024
+ "rounded-lg bg-card p-3 relative overflow-visible w-full",
4025
+ className
4026
+ ),
4027
+ style: styleVars,
4028
+ role: "img",
4029
+ "aria-label": message,
4030
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
4031
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4032
+ "svg",
4033
+ {
4034
+ className: "w-full h-[var(--svg-h)]",
4035
+ width: "100%",
4036
+ viewBox: `0 0 900 ${svgHeight}`,
4037
+ preserveAspectRatio: "none",
4038
+ children: [
4039
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("defs", { children: [
4040
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
4041
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("stop", { offset: "0%", stopColor: "#60a5fa", stopOpacity: "0.95" }),
4042
+ "= "
4043
+ ] }),
4044
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4045
+ "filter",
4046
+ {
4047
+ id: "softShadow",
4048
+ x: "-20%",
4049
+ y: "-20%",
4050
+ width: "140%",
4051
+ height: "140%",
4052
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4053
+ "feDropShadow",
4054
+ {
4055
+ dx: "0",
4056
+ dy: "6",
4057
+ stdDeviation: "8",
4058
+ floodColor: "#0f172a",
4059
+ floodOpacity: "0.06"
4060
+ }
4061
+ )
4062
+ }
4063
+ )
4064
+ ] }),
4065
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4066
+ "rect",
4067
+ {
4068
+ x: 0,
4069
+ y: 0,
4070
+ width: 900,
4071
+ height: svgHeight,
4072
+ fill: "transparent"
4073
+ }
4074
+ ),
4075
+ Array.from({ length: 5 }).map((_, i) => {
4076
+ const y = 40 + (svgHeight - 80) / 4 * i;
4077
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4078
+ "line",
4079
+ {
4080
+ x1: 60,
4081
+ x2: 840,
4082
+ y1: y,
4083
+ y2: y,
4084
+ stroke: "rgba(15,23,42,0.06)",
4085
+ strokeWidth: 1
4086
+ },
4087
+ `g-${i}`
4088
+ );
4089
+ }),
4090
+ bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("g", { children: [
4091
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4092
+ "rect",
4093
+ {
4094
+ x: b.x,
4095
+ y: svgHeight - 60 - b.h,
4096
+ width: b.w,
4097
+ height: b.h,
4098
+ rx: 8,
4099
+ fill: "url(#barGradient)",
4100
+ filter: "url(#softShadow)",
4101
+ opacity: 0.95
4102
+ }
4103
+ ),
4104
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4105
+ "rect",
4106
+ {
4107
+ x: b.x,
4108
+ y: svgHeight - 60 - b.h,
4109
+ width: b.w,
4110
+ height: b.h,
4111
+ rx: 8,
4112
+ fill: "none",
4113
+ stroke: "rgba(15,23,42,0.06)"
4114
+ }
4115
+ ),
4116
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4117
+ "text",
4118
+ {
4119
+ x: b.x + b.w / 2,
4120
+ y: svgHeight - 20,
4121
+ fill: "rgba(15,23,42,0.45)",
4122
+ fontSize: 12,
4123
+ textAnchor: "middle",
4124
+ children: b.label
4125
+ }
4126
+ )
4127
+ ] }, `barg-${i}`))
4128
+ ]
4129
+ }
4130
+ ),
4131
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pointer-events-auto bg-transparent px-3 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-2xl sm:text-3xl font-semibold text-black", children: message }) }) })
4132
+ ] }) })
4133
+ }
4134
+ );
4135
+ };
4136
+ var NoData_default = NoData;
4137
+
4138
+ // src/components/charts/Chart.tsx
4139
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3981
4140
  var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
3982
4141
  var Chart = ({
3983
4142
  data,
@@ -4316,7 +4475,7 @@ var Chart = ({
4316
4475
  []
4317
4476
  );
4318
4477
  const titleClassName = (0, import_react21.useMemo)(
4319
- () => "text-xl font-semibold text-foreground mb-3",
4478
+ () => "text-[1.4rem] font-semibold text-foreground mb-3",
4320
4479
  []
4321
4480
  );
4322
4481
  const finalValueFormatter = (0, import_react21.useMemo)(() => {
@@ -4387,9 +4546,18 @@ var Chart = ({
4387
4546
  const defaultChartRightMargin = 30;
4388
4547
  const defaultChartLeftMargin = 0;
4389
4548
  const axisLabelMargin = 56;
4390
- const containerPaddingLeft = 16;
4549
+ const containerPaddingLeft = -6;
4391
4550
  const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
4392
4551
  const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
4552
+ const yAxisTickWidth = (0, import_react21.useMemo)(() => {
4553
+ if (typeof chartMargin?.left === "number") return chartMargin.left;
4554
+ if (yAxisLabel) return axisLabelMargin;
4555
+ const samples = [minLeftDataValue, niceMaxLeft, Math.round((minLeftDataValue + niceMaxLeft) / 2), 0];
4556
+ const formatted = samples.map((v) => String(yTickFormatter(v)));
4557
+ const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
4558
+ const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
4559
+ return estimated;
4560
+ }, [chartMargin?.left, yAxisLabel, yTickFormatter, minLeftDataValue, niceMaxLeft]);
4393
4561
  const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
4394
4562
  const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
4395
4563
  const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
@@ -4400,7 +4568,7 @@ var Chart = ({
4400
4568
  const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
4401
4569
  const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
4402
4570
  const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
4403
- const leftYAxisLabelDx = -Math.max(12, Math.round(finalChartLeftMargin / 2));
4571
+ const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
4404
4572
  const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
4405
4573
  const openTooltipForPeriod = (0, import_react21.useCallback)(
4406
4574
  (periodName) => {
@@ -4447,25 +4615,25 @@ var Chart = ({
4447
4615
  );
4448
4616
  if (!data) return null;
4449
4617
  if (Array.isArray(data) && data.length === 0) {
4450
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4618
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4451
4619
  "div",
4452
4620
  {
4453
4621
  className: cn(
4454
4622
  "rounded-lg bg-card p-4 relative w-full text-muted-foreground"
4455
4623
  ),
4456
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4624
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4457
4625
  "div",
4458
4626
  {
4459
4627
  style: {
4460
4628
  paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
4461
4629
  },
4462
- children: "Sem dados para exibir"
4630
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NoData_default, {})
4463
4631
  }
4464
4632
  )
4465
4633
  }
4466
4634
  );
4467
4635
  }
4468
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4636
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4469
4637
  "div",
4470
4638
  {
4471
4639
  ref: wrapperRef,
@@ -4475,13 +4643,13 @@ var Chart = ({
4475
4643
  overflowY: "hidden",
4476
4644
  minWidth: 0
4477
4645
  },
4478
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4646
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4479
4647
  "div",
4480
4648
  {
4481
- className: cn("rounded-lg bg-card p-2 relative", className),
4649
+ className: cn("rounded-lg bg-card relative", className),
4482
4650
  style: { width: "100%", maxWidth: "100%", minWidth: 0 },
4483
4651
  children: [
4484
- title && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4652
+ title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4485
4653
  "div",
4486
4654
  {
4487
4655
  style: {
@@ -4490,12 +4658,12 @@ var Chart = ({
4490
4658
  display: "flex",
4491
4659
  justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
4492
4660
  alignItems: "center",
4493
- marginTop: 4
4661
+ marginTop: "19px"
4494
4662
  },
4495
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: titleClassName, children: title })
4663
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: titleClassName, children: title })
4496
4664
  }
4497
4665
  ),
4498
- allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4666
+ allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4499
4667
  "div",
4500
4668
  {
4501
4669
  className: "flex items-center w-full",
@@ -4507,7 +4675,7 @@ var Chart = ({
4507
4675
  gap: "0.5rem"
4508
4676
  },
4509
4677
  children: [
4510
- finalEnableHighlights && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4678
+ finalEnableHighlights && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4511
4679
  Highlights_default,
4512
4680
  {
4513
4681
  allKeys,
@@ -4518,7 +4686,7 @@ var Chart = ({
4518
4686
  containerWidth: chartInnerWidth
4519
4687
  }
4520
4688
  ),
4521
- finalEnableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4689
+ finalEnableShowOnly && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4522
4690
  ShowOnly_default,
4523
4691
  {
4524
4692
  showOnlyHighlighted,
@@ -4527,7 +4695,7 @@ var Chart = ({
4527
4695
  clearHighlights: () => setHighlightedSeries(/* @__PURE__ */ new Set())
4528
4696
  }
4529
4697
  ),
4530
- finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4698
+ finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4531
4699
  "div",
4532
4700
  {
4533
4701
  style: {
@@ -4535,7 +4703,7 @@ var Chart = ({
4535
4703
  display: "flex",
4536
4704
  alignItems: "center"
4537
4705
  },
4538
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4706
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4539
4707
  PeriodsDropdown_default,
4540
4708
  {
4541
4709
  processedData,
@@ -4549,7 +4717,7 @@ var Chart = ({
4549
4717
  ]
4550
4718
  }
4551
4719
  ),
4552
- !(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4720
+ !(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4553
4721
  "div",
4554
4722
  {
4555
4723
  style: {
@@ -4560,7 +4728,7 @@ var Chart = ({
4560
4728
  display: "flex",
4561
4729
  justifyContent: "flex-end"
4562
4730
  },
4563
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4731
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4564
4732
  PeriodsDropdown_default,
4565
4733
  {
4566
4734
  processedData,
@@ -4570,7 +4738,7 @@ var Chart = ({
4570
4738
  )
4571
4739
  }
4572
4740
  ),
4573
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4741
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_recharts.ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4574
4742
  import_recharts.ComposedChart,
4575
4743
  {
4576
4744
  data: processedData,
@@ -4583,7 +4751,7 @@ var Chart = ({
4583
4751
  },
4584
4752
  onClick: handleChartClick,
4585
4753
  children: [
4586
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4754
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4587
4755
  import_recharts.CartesianGrid,
4588
4756
  {
4589
4757
  strokeDasharray: "3 3",
@@ -4591,7 +4759,7 @@ var Chart = ({
4591
4759
  opacity: 0.5
4592
4760
  }
4593
4761
  ),
4594
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4762
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4595
4763
  import_recharts.XAxis,
4596
4764
  {
4597
4765
  dataKey: xAxisConfig.dataKey,
@@ -4618,11 +4786,11 @@ var Chart = ({
4618
4786
  } : void 0
4619
4787
  }
4620
4788
  ),
4621
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4789
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4622
4790
  import_recharts.YAxis,
4623
4791
  {
4624
4792
  yAxisId: "left",
4625
- width: finalChartLeftMargin,
4793
+ width: yAxisTickWidth,
4626
4794
  stroke: "hsl(var(--muted-foreground))",
4627
4795
  fontSize: 12,
4628
4796
  tickLine: false,
@@ -4644,7 +4812,7 @@ var Chart = ({
4644
4812
  } : void 0
4645
4813
  }
4646
4814
  ),
4647
- minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4815
+ minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4648
4816
  import_recharts.ReferenceLine,
4649
4817
  {
4650
4818
  y: 0,
@@ -4678,7 +4846,7 @@ var Chart = ({
4678
4846
  return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
4679
4847
  return defaultRightColor;
4680
4848
  })();
4681
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4849
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4682
4850
  import_recharts.YAxis,
4683
4851
  {
4684
4852
  yAxisId: "right",
@@ -4707,10 +4875,10 @@ var Chart = ({
4707
4875
  }
4708
4876
  );
4709
4877
  })(),
4710
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4878
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4711
4879
  import_recharts.Tooltip,
4712
4880
  {
4713
- content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4881
+ content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4714
4882
  TooltipWithTotal_default,
4715
4883
  {
4716
4884
  finalColors,
@@ -4718,7 +4886,7 @@ var Chart = ({
4718
4886
  categoryFormatter,
4719
4887
  periodLabel
4720
4888
  }
4721
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4889
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4722
4890
  TooltipSimple_default,
4723
4891
  {
4724
4892
  finalColors,
@@ -4730,7 +4898,7 @@ var Chart = ({
4730
4898
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
4731
4899
  }
4732
4900
  ),
4733
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4901
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4734
4902
  import_recharts.Legend,
4735
4903
  {
4736
4904
  wrapperStyle: {
@@ -4754,7 +4922,7 @@ var Chart = ({
4754
4922
  }
4755
4923
  }
4756
4924
  if (s.type === "bar") {
4757
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4925
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4758
4926
  import_recharts.Bar,
4759
4927
  {
4760
4928
  dataKey: key,
@@ -4767,7 +4935,7 @@ var Chart = ({
4767
4935
  cursor: "pointer",
4768
4936
  opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
4769
4937
  },
4770
- activeBar: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4938
+ activeBar: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4771
4939
  import_recharts.Rectangle,
4772
4940
  {
4773
4941
  fill: color,
@@ -4776,7 +4944,7 @@ var Chart = ({
4776
4944
  opacity: 0.8
4777
4945
  }
4778
4946
  ),
4779
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4947
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4780
4948
  import_recharts.LabelList,
4781
4949
  {
4782
4950
  dataKey: key,
@@ -4793,7 +4961,7 @@ var Chart = ({
4793
4961
  );
4794
4962
  }
4795
4963
  if (s.type === "line") {
4796
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4964
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4797
4965
  import_recharts.Line,
4798
4966
  {
4799
4967
  dataKey: key,
@@ -4809,7 +4977,7 @@ var Chart = ({
4809
4977
  pointerEvents: "all",
4810
4978
  opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
4811
4979
  },
4812
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4980
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4813
4981
  import_recharts.LabelList,
4814
4982
  {
4815
4983
  dataKey: key,
@@ -4827,7 +4995,7 @@ var Chart = ({
4827
4995
  );
4828
4996
  }
4829
4997
  if (s.type === "area") {
4830
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4998
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4831
4999
  import_recharts.Area,
4832
5000
  {
4833
5001
  dataKey: key,
@@ -4843,7 +5011,7 @@ var Chart = ({
4843
5011
  pointerEvents: "all",
4844
5012
  opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
4845
5013
  },
4846
- children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5014
+ children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4847
5015
  import_recharts.LabelList,
4848
5016
  {
4849
5017
  dataKey: key,
@@ -4865,7 +5033,7 @@ var Chart = ({
4865
5033
  ]
4866
5034
  }
4867
5035
  ) }),
4868
- enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5036
+ enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4869
5037
  DraggableTooltip_default,
4870
5038
  {
4871
5039
  id: tooltip.id,
@@ -4890,7 +5058,7 @@ var Chart = ({
4890
5058
  },
4891
5059
  tooltip.id
4892
5060
  )),
4893
- enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5061
+ enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4894
5062
  CloseAllButton_default,
4895
5063
  {
4896
5064
  count: activeTooltips.length,
@@ -4910,7 +5078,7 @@ var Chart_default = Chart;
4910
5078
  // src/components/charts/BarChart.tsx
4911
5079
  var import_react22 = require("react");
4912
5080
  var import_recharts2 = require("recharts");
4913
- var import_jsx_runtime29 = require("react/jsx-runtime");
5081
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4914
5082
  var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
4915
5083
  var BarChart = ({
4916
5084
  data,
@@ -5331,25 +5499,25 @@ var BarChart = ({
5331
5499
  label
5332
5500
  }) => {
5333
5501
  if (!active || !payload) return null;
5334
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
5335
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "font-medium text-foreground mb-2", children: label }),
5502
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
5503
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "font-medium text-foreground mb-2", children: label }),
5336
5504
  payload.map(
5337
- (entry, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
5338
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5505
+ (entry, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
5506
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5339
5507
  "div",
5340
5508
  {
5341
5509
  className: "w-3 h-3 rounded-sm",
5342
5510
  style: { backgroundColor: entry.color }
5343
5511
  }
5344
5512
  ),
5345
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "text-muted-foreground", children: [
5513
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-muted-foreground", children: [
5346
5514
  entry.name,
5347
5515
  ":"
5348
5516
  ] }),
5349
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
5517
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
5350
5518
  ] }, index)
5351
5519
  ),
5352
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
5520
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
5353
5521
  ] });
5354
5522
  };
5355
5523
  const getTitleClassName = (position) => {
@@ -5363,7 +5531,7 @@ var BarChart = ({
5363
5531
  return `${baseClasses} text-left`;
5364
5532
  }
5365
5533
  };
5366
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5534
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5367
5535
  "div",
5368
5536
  {
5369
5537
  className: cn("rounded-lg bg-card p-4 relative", className),
@@ -5372,8 +5540,8 @@ var BarChart = ({
5372
5540
  maxWidth: "100%"
5373
5541
  },
5374
5542
  children: [
5375
- title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h3", { className: getTitleClassName(titlePosition), children: title }) }),
5376
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
5543
+ title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h3", { className: getTitleClassName(titlePosition), children: title }) }),
5544
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5377
5545
  import_recharts2.BarChart,
5378
5546
  {
5379
5547
  data: processedData,
@@ -5382,7 +5550,7 @@ var BarChart = ({
5382
5550
  margin: resolveChartMargins(margins, chartMargins, showLabels),
5383
5551
  onClick: handleChartClick,
5384
5552
  children: [
5385
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5553
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5386
5554
  import_recharts2.CartesianGrid,
5387
5555
  {
5388
5556
  strokeDasharray: "3 3",
@@ -5390,7 +5558,7 @@ var BarChart = ({
5390
5558
  opacity: 0.5
5391
5559
  }
5392
5560
  ),
5393
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5561
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5394
5562
  import_recharts2.XAxis,
5395
5563
  {
5396
5564
  dataKey: xAxisConfig.dataKey,
@@ -5401,7 +5569,7 @@ var BarChart = ({
5401
5569
  tickFormatter: xAxisConfig.valueFormatter
5402
5570
  }
5403
5571
  ),
5404
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5572
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5405
5573
  import_recharts2.YAxis,
5406
5574
  {
5407
5575
  stroke: "hsl(var(--muted-foreground))",
@@ -5413,14 +5581,14 @@ var BarChart = ({
5413
5581
  tickCount: 6
5414
5582
  }
5415
5583
  ),
5416
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5584
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5417
5585
  import_recharts2.Tooltip,
5418
5586
  {
5419
- content: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CustomTooltip, {}),
5587
+ content: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CustomTooltip, {}),
5420
5588
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
5421
5589
  }
5422
5590
  ),
5423
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5591
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5424
5592
  import_recharts2.Legend,
5425
5593
  {
5426
5594
  wrapperStyle: {
@@ -5431,7 +5599,7 @@ var BarChart = ({
5431
5599
  ),
5432
5600
  dataKeys.map((key) => {
5433
5601
  const fieldConfig = mapperConfig[key];
5434
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5602
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5435
5603
  import_recharts2.Bar,
5436
5604
  {
5437
5605
  dataKey: key,
@@ -5440,7 +5608,7 @@ var BarChart = ({
5440
5608
  radius: [4, 4, 0, 0],
5441
5609
  onClick: handleBarClick,
5442
5610
  style: { cursor: "pointer" },
5443
- activeBar: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5611
+ activeBar: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5444
5612
  import_recharts2.Rectangle,
5445
5613
  {
5446
5614
  fill: finalColors[key],
@@ -5449,7 +5617,7 @@ var BarChart = ({
5449
5617
  opacity: 0.8
5450
5618
  }
5451
5619
  ),
5452
- children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5620
+ children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5453
5621
  import_recharts2.LabelList,
5454
5622
  {
5455
5623
  dataKey: key,
@@ -5486,8 +5654,8 @@ var BarChart = ({
5486
5654
  guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
5487
5655
  guide.targetTooltip.top + guide.targetTooltip.height / 2
5488
5656
  );
5489
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
5490
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5657
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
5658
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5491
5659
  "div",
5492
5660
  {
5493
5661
  className: "fixed pointer-events-none z-30",
@@ -5506,7 +5674,7 @@ var BarChart = ({
5506
5674
  }
5507
5675
  }
5508
5676
  ),
5509
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5677
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5510
5678
  "div",
5511
5679
  {
5512
5680
  className: "fixed pointer-events-none z-31",
@@ -5522,7 +5690,7 @@ var BarChart = ({
5522
5690
  }
5523
5691
  }
5524
5692
  ),
5525
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5693
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5526
5694
  "div",
5527
5695
  {
5528
5696
  className: "fixed pointer-events-none z-31",
@@ -5540,7 +5708,7 @@ var BarChart = ({
5540
5708
  )
5541
5709
  ] }, index);
5542
5710
  }),
5543
- activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5711
+ activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5544
5712
  DraggableTooltip_default,
5545
5713
  {
5546
5714
  id: tooltip.id,
@@ -5575,7 +5743,7 @@ var BarChart_default = BarChart;
5575
5743
  // src/components/charts/LineChart.tsx
5576
5744
  var import_react23 = require("react");
5577
5745
  var import_recharts3 = require("recharts");
5578
- var import_jsx_runtime30 = require("react/jsx-runtime");
5746
+ var import_jsx_runtime31 = require("react/jsx-runtime");
5579
5747
  var defaultData = [
5580
5748
  { name: "A", value: 100 },
5581
5749
  { name: "B", value: 200 },
@@ -5674,7 +5842,7 @@ var CustomLineChart = ({
5674
5842
  setActiveTooltips((prev) => [...prev, newTooltip]);
5675
5843
  }
5676
5844
  };
5677
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5845
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5678
5846
  "circle",
5679
5847
  {
5680
5848
  cx,
@@ -5957,7 +6125,7 @@ var CustomLineChart = ({
5957
6125
  return "text-left";
5958
6126
  }
5959
6127
  };
5960
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cn("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6128
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("relative", className), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
5961
6129
  "div",
5962
6130
  {
5963
6131
  className: "rounded-lg bg-card p-4 relative border border-border",
@@ -5967,8 +6135,8 @@ var CustomLineChart = ({
5967
6135
  },
5968
6136
  onClick: handleChartBackgroundClick,
5969
6137
  children: [
5970
- title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
5971
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
6138
+ title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
6139
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
5972
6140
  import_recharts3.LineChart,
5973
6141
  {
5974
6142
  data,
@@ -5977,7 +6145,7 @@ var CustomLineChart = ({
5977
6145
  margin: resolveChartMargins(margins, chartMargins, showLabels),
5978
6146
  onClick: handleChartClick,
5979
6147
  children: [
5980
- showGrid && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6148
+ showGrid && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5981
6149
  import_recharts3.CartesianGrid,
5982
6150
  {
5983
6151
  strokeDasharray: "3 3",
@@ -5985,7 +6153,7 @@ var CustomLineChart = ({
5985
6153
  opacity: 0.3
5986
6154
  }
5987
6155
  ),
5988
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6156
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5989
6157
  import_recharts3.XAxis,
5990
6158
  {
5991
6159
  dataKey: "name",
@@ -5993,7 +6161,7 @@ var CustomLineChart = ({
5993
6161
  fontSize: 12
5994
6162
  }
5995
6163
  ),
5996
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6164
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
5997
6165
  import_recharts3.YAxis,
5998
6166
  {
5999
6167
  className: "fill-muted-foreground text-xs",
@@ -6003,8 +6171,8 @@ var CustomLineChart = ({
6003
6171
  tickCount: 6
6004
6172
  }
6005
6173
  ),
6006
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_recharts3.Tooltip, { content: () => null }),
6007
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6174
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_recharts3.Tooltip, { content: () => null }),
6175
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6008
6176
  import_recharts3.Legend,
6009
6177
  {
6010
6178
  wrapperStyle: {
@@ -6013,7 +6181,7 @@ var CustomLineChart = ({
6013
6181
  }
6014
6182
  }
6015
6183
  ),
6016
- dataKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6184
+ dataKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6017
6185
  import_recharts3.Line,
6018
6186
  {
6019
6187
  type: "monotone",
@@ -6021,8 +6189,8 @@ var CustomLineChart = ({
6021
6189
  stroke: finalColors[key],
6022
6190
  strokeWidth,
6023
6191
  dot: showDots ? { r: 4, cursor: "pointer" } : false,
6024
- activeDot: (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ClickableDot, { ...props, dataKey: key }),
6025
- children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6192
+ activeDot: (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ClickableDot, { ...props, dataKey: key }),
6193
+ children: showLabels && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6026
6194
  import_recharts3.LabelList,
6027
6195
  {
6028
6196
  dataKey: key,
@@ -6059,8 +6227,8 @@ var CustomLineChart = ({
6059
6227
  guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
6060
6228
  guide.targetTooltip.top + guide.targetTooltip.height / 2
6061
6229
  );
6062
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
6063
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6230
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { children: [
6231
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6064
6232
  "div",
6065
6233
  {
6066
6234
  className: "fixed pointer-events-none z-30",
@@ -6079,7 +6247,7 @@ var CustomLineChart = ({
6079
6247
  }
6080
6248
  }
6081
6249
  ),
6082
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6250
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6083
6251
  "div",
6084
6252
  {
6085
6253
  className: "fixed pointer-events-none z-31",
@@ -6095,7 +6263,7 @@ var CustomLineChart = ({
6095
6263
  }
6096
6264
  }
6097
6265
  ),
6098
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6266
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6099
6267
  "div",
6100
6268
  {
6101
6269
  className: "fixed pointer-events-none z-31",
@@ -6113,7 +6281,7 @@ var CustomLineChart = ({
6113
6281
  )
6114
6282
  ] }, index);
6115
6283
  }),
6116
- activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
6284
+ activeTooltips.map((tooltip, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6117
6285
  DraggableTooltip_default,
6118
6286
  {
6119
6287
  id: tooltip.id,
@@ -6145,7 +6313,7 @@ var LineChart_default = CustomLineChart;
6145
6313
 
6146
6314
  // src/components/charts/PieChart.tsx
6147
6315
  var import_recharts4 = require("recharts");
6148
- var import_jsx_runtime31 = require("react/jsx-runtime");
6316
+ var import_jsx_runtime32 = require("react/jsx-runtime");
6149
6317
  var defaultData2 = [
6150
6318
  { name: "Vendas", value: 4e3 },
6151
6319
  { name: "Marketing", value: 3e3 },
@@ -6183,7 +6351,7 @@ var renderCustomizedLabel = ({
6183
6351
  const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
6184
6352
  const x = cx + radius * Math.cos(-midAngle * RADIAN);
6185
6353
  const y = cy + radius * Math.sin(-midAngle * RADIAN);
6186
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6354
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6187
6355
  "text",
6188
6356
  {
6189
6357
  x,
@@ -6212,8 +6380,8 @@ var CustomPieChart = ({
6212
6380
  centerY = "50%"
6213
6381
  }) => {
6214
6382
  const finalColors = colors2 || DEFAULT_COLORS5;
6215
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_recharts4.ResponsiveContainer, { width, height, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_recharts4.PieChart, { children: [
6216
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6383
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_recharts4.ResponsiveContainer, { width, height, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_recharts4.PieChart, { children: [
6384
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6217
6385
  import_recharts4.Pie,
6218
6386
  {
6219
6387
  data,
@@ -6225,7 +6393,7 @@ var CustomPieChart = ({
6225
6393
  innerRadius,
6226
6394
  fill: "#8884d8",
6227
6395
  dataKey: "value",
6228
- children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6396
+ children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6229
6397
  import_recharts4.Cell,
6230
6398
  {
6231
6399
  fill: finalColors[index % finalColors.length]
@@ -6234,7 +6402,7 @@ var CustomPieChart = ({
6234
6402
  ))
6235
6403
  }
6236
6404
  ),
6237
- showTooltip && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
6405
+ showTooltip && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6238
6406
  import_recharts4.Tooltip,
6239
6407
  {
6240
6408
  contentStyle: {
@@ -6245,7 +6413,7 @@ var CustomPieChart = ({
6245
6413
  }
6246
6414
  }
6247
6415
  ),
6248
- showLegend && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_recharts4.Legend, {})
6416
+ showLegend && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_recharts4.Legend, {})
6249
6417
  ] }) }) });
6250
6418
  };
6251
6419
  var PieChart_default = CustomPieChart;
@@ -6323,105 +6491,6 @@ var useChartHighlights = () => {
6323
6491
  };
6324
6492
  };
6325
6493
 
6326
- // src/components/charts/NoData.tsx
6327
- var import_jsx_runtime32 = require("react/jsx-runtime");
6328
- var NoData = ({
6329
- paddingLeft = 0,
6330
- height = 360,
6331
- message = "Sem dados para exibir",
6332
- className
6333
- }) => {
6334
- const svgHeight = typeof height === "number" ? height : 360;
6335
- const bars = [
6336
- { x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
6337
- { x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
6338
- { x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
6339
- { x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
6340
- { x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
6341
- ];
6342
- const styleVars = {
6343
- ["--pl"]: `${paddingLeft}px`,
6344
- ["--svg-h"]: typeof height === "number" ? `${height}px` : String(height)
6345
- };
6346
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6347
- "div",
6348
- {
6349
- className: cn(
6350
- "rounded-lg bg-card p-2 relative overflow-visible w-full",
6351
- className
6352
- ),
6353
- style: styleVars,
6354
- role: "img",
6355
- "aria-label": message,
6356
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
6357
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6358
- "svg",
6359
- {
6360
- className: "w-full h-[var(--svg-h)]",
6361
- width: "100%",
6362
- viewBox: `0 0 900 ${svgHeight}`,
6363
- preserveAspectRatio: "none",
6364
- children: [
6365
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6366
- "rect",
6367
- {
6368
- x: 0,
6369
- y: 0,
6370
- width: 900,
6371
- height: svgHeight,
6372
- fill: "transparent"
6373
- }
6374
- ),
6375
- Array.from({ length: 5 }).map((_, i) => {
6376
- const y = 40 + (svgHeight - 80) / 4 * i;
6377
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6378
- "line",
6379
- {
6380
- x1: 60,
6381
- x2: 840,
6382
- y1: y,
6383
- y2: y,
6384
- stroke: "rgba(0,0,0,0.06)",
6385
- strokeWidth: 1
6386
- },
6387
- `g-${i}`
6388
- );
6389
- }),
6390
- bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("g", { children: [
6391
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6392
- "rect",
6393
- {
6394
- x: b.x,
6395
- y: svgHeight - 60 - b.h,
6396
- width: b.w,
6397
- height: b.h,
6398
- rx: 6,
6399
- fill: "rgba(0,0,0,0.06)",
6400
- stroke: "rgba(0,0,0,0.04)"
6401
- }
6402
- ),
6403
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6404
- "text",
6405
- {
6406
- x: b.x + b.w / 2,
6407
- y: svgHeight - 20,
6408
- fill: "rgba(0,0,0,0.35)",
6409
- fontSize: 12,
6410
- textAnchor: "middle",
6411
- children: b.label
6412
- }
6413
- )
6414
- ] }, `barg-${i}`))
6415
- ]
6416
- }
6417
- ),
6418
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "pointer-events-auto bg-transparent px-3", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "text-2xl font-extrabold text-black/80", children: message }) }) })
6419
- ] }) })
6420
- }
6421
- );
6422
- };
6423
- var NoData_default = NoData;
6424
-
6425
6494
  // src/components/ui/data/AvatarBase.tsx
6426
6495
  var React16 = __toESM(require("react"));
6427
6496
  var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
@@ -12256,7 +12325,7 @@ var import_jsx_runtime72 = require("react/jsx-runtime");
12256
12325
  function DebouncedInput({
12257
12326
  value: initialValue,
12258
12327
  onChange,
12259
- debounce = 500,
12328
+ debounce: debounce2 = 500,
12260
12329
  label,
12261
12330
  labelClassname,
12262
12331
  leftIcon,
@@ -12278,12 +12347,12 @@ function DebouncedInput({
12278
12347
  const timeout = setTimeout(() => {
12279
12348
  onChange(value);
12280
12349
  setIsDebouncing(false);
12281
- }, debounce);
12350
+ }, debounce2);
12282
12351
  return () => {
12283
12352
  clearTimeout(timeout);
12284
12353
  setIsDebouncing(false);
12285
12354
  };
12286
- }, [debounce, initialValue, onChange, value]);
12355
+ }, [debounce2, initialValue, onChange, value]);
12287
12356
  const renderRightIcon = () => {
12288
12357
  if (showLoadingIndicator && isDebouncing) {
12289
12358
  return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react51.CircleNotchIcon, { className: "h-4 w-4 animate-spin text-muted-foreground" });
@@ -12315,8 +12384,25 @@ var import_jsx_runtime73 = require("react/jsx-runtime");
12315
12384
  function AgendaView({
12316
12385
  currentDate,
12317
12386
  events,
12318
- onEventSelect
12387
+ onEventSelect,
12388
+ showUndatedEvents = false
12319
12389
  }) {
12390
+ const isValidDate3 = (d) => {
12391
+ try {
12392
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
12393
+ return !isNaN(t);
12394
+ } catch {
12395
+ return false;
12396
+ }
12397
+ };
12398
+ const datedEvents = (0, import_react52.useMemo)(
12399
+ () => events.filter((e) => isValidDate3(e.start) && isValidDate3(e.end)),
12400
+ [events]
12401
+ );
12402
+ const undatedEvents = (0, import_react52.useMemo)(
12403
+ () => events.filter((e) => !(isValidDate3(e.start) && isValidDate3(e.end))),
12404
+ [events]
12405
+ );
12320
12406
  const days = (0, import_react52.useMemo)(() => {
12321
12407
  console.log("Agenda view updating with date:", currentDate.toISOString());
12322
12408
  return Array.from(
@@ -12327,63 +12413,81 @@ function AgendaView({
12327
12413
  const handleEventClick = (event, e) => {
12328
12414
  e.stopPropagation();
12329
12415
  console.log("Agenda view event clicked:", event);
12330
- onEventSelect(event);
12416
+ if (onEventSelect) onEventSelect(event);
12331
12417
  };
12332
12418
  const hasEvents = days.some(
12333
- (day) => getAgendaEventsForDay(events, day).length > 0
12419
+ (day) => getAgendaEventsForDay(datedEvents, day).length > 0
12334
12420
  );
12335
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
12421
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents && !(showUndatedEvents && undatedEvents.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
12336
12422
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react53.CalendarIcon, { className: "mb-2 text-muted-foreground/50", size: 32 }),
12337
12423
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
12338
12424
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
12339
- ] }) : days.map((day) => {
12340
- const dayEvents = getAgendaEventsForDay(events, day);
12341
- if (dayEvents.length === 0) return null;
12342
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
12343
- "div",
12344
- {
12345
- className: "relative my-12 border-border/70 border-t",
12346
- children: [
12347
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12348
- "span",
12349
- {
12350
- className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase data-today:font-medium sm:pe-4 sm:text-xs",
12351
- "data-today": (0, import_date_fns3.isToday)(day) || void 0,
12352
- children: (() => {
12353
- const s = (0, import_date_fns3.format)(day, "d MMM, EEEE", { locale: import_locale2.ptBR });
12354
- return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
12355
- })()
12356
- }
12357
- ),
12358
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "mt-6 space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12359
- EventItem,
12360
- {
12361
- event,
12362
- onClick: (e) => handleEventClick(event, e),
12363
- view: "agenda"
12364
- },
12365
- event.id
12366
- )) })
12367
- ]
12368
- },
12369
- day.toString()
12370
- );
12371
- }) });
12372
- }
12373
-
12374
- // src/components/event-calendar/CalendarDND.tsx
12375
- var import_core = require("@dnd-kit/core");
12376
- var import_date_fns4 = require("date-fns");
12377
- var import_react55 = require("react");
12378
-
12379
- // src/components/event-calendar/hooks.ts
12380
- var import_react54 = require("react");
12381
- var CalendarDndContext = (0, import_react54.createContext)({
12382
- activeEvent: null,
12383
- activeId: null,
12384
- activeView: null,
12385
- currentTime: null,
12386
- dragHandlePosition: null,
12425
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
12426
+ days.map((day) => {
12427
+ const dayEvents = getAgendaEventsForDay(datedEvents, day);
12428
+ if (dayEvents.length === 0) return null;
12429
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
12430
+ "div",
12431
+ {
12432
+ className: "relative my-12 border-border/70 border-t",
12433
+ children: [
12434
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12435
+ "span",
12436
+ {
12437
+ className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase data-today:font-medium sm:pe-4 sm:text-xs",
12438
+ "data-today": (0, import_date_fns3.isToday)(day) || void 0,
12439
+ children: (() => {
12440
+ const s = (0, import_date_fns3.format)(day, "d MMM, EEEE", { locale: import_locale2.ptBR });
12441
+ return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
12442
+ })()
12443
+ }
12444
+ ),
12445
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "mt-6 space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12446
+ EventItem,
12447
+ {
12448
+ event,
12449
+ onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
12450
+ view: "agenda",
12451
+ agendaOnly: showUndatedEvents,
12452
+ className: onEventSelect ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
12453
+ },
12454
+ event.id
12455
+ )) })
12456
+ ]
12457
+ },
12458
+ day.toString()
12459
+ );
12460
+ }),
12461
+ showUndatedEvents && undatedEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "relative my-12 border-border/70 border-t", children: [
12462
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase sm:pe-4 sm:text-xs", children: "Data de Atendimento n\xE3o Prevista" }),
12463
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "mt-6 space-y-2", children: undatedEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12464
+ EventItem,
12465
+ {
12466
+ event,
12467
+ onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
12468
+ view: "agenda",
12469
+ agendaOnly: showUndatedEvents,
12470
+ className: showUndatedEvents ? "cursor-default hover:shadow-none hover:scale-100 bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none " : onEventSelect ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
12471
+ },
12472
+ event.id
12473
+ )) })
12474
+ ] })
12475
+ ] }) });
12476
+ }
12477
+
12478
+ // src/components/event-calendar/CalendarDND.tsx
12479
+ var import_core = require("@dnd-kit/core");
12480
+ var import_date_fns4 = require("date-fns");
12481
+ var import_react55 = require("react");
12482
+
12483
+ // src/components/event-calendar/hooks.ts
12484
+ var import_react54 = require("react");
12485
+ var CalendarDndContext = (0, import_react54.createContext)({
12486
+ activeEvent: null,
12487
+ activeId: null,
12488
+ activeView: null,
12489
+ currentTime: null,
12490
+ dragHandlePosition: null,
12387
12491
  eventHeight: null,
12388
12492
  isMultiDay: false,
12389
12493
  multiDayWidth: null
@@ -13035,7 +13139,6 @@ function EventCalendar({
13035
13139
  case "m":
13036
13140
  changeView("month");
13037
13141
  break;
13038
- // aceitar tanto 'w' (inglês) quanto 's' (pt-BR para "semana")
13039
13142
  case "w":
13040
13143
  case "s":
13041
13144
  changeView("week");
@@ -13114,9 +13217,13 @@ function EventCalendar({
13114
13217
  if (event.id) {
13115
13218
  onEventUpdate?.(event);
13116
13219
  (0, import_sonner3.toast)(`Evento "${event.title}" atualizado`, {
13117
- description: (0, import_date_fns7.format)(new Date(event.start), "d 'de' MMMM 'de' yyyy", {
13118
- locale: import_locale3.ptBR
13119
- }),
13220
+ description: (0, import_date_fns7.format)(
13221
+ new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
13222
+ "d 'de' MMMM 'de' yyyy",
13223
+ {
13224
+ locale: import_locale3.ptBR
13225
+ }
13226
+ ),
13120
13227
  position: "bottom-left"
13121
13228
  });
13122
13229
  } else {
@@ -13125,9 +13232,11 @@ function EventCalendar({
13125
13232
  id: Math.random().toString(36).substring(2, 11)
13126
13233
  });
13127
13234
  (0, import_sonner3.toast)(`Evento "${event.title}" adicionado`, {
13128
- description: (0, import_date_fns7.format)(new Date(event.start), "d 'de' MMMM 'de' yyyy", {
13129
- locale: import_locale3.ptBR
13130
- }),
13235
+ description: (0, import_date_fns7.format)(
13236
+ new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
13237
+ "d 'de' MMMM 'de' yyyy",
13238
+ { locale: import_locale3.ptBR }
13239
+ ),
13131
13240
  position: "bottom-left"
13132
13241
  });
13133
13242
  }
@@ -13142,7 +13251,9 @@ function EventCalendar({
13142
13251
  if (deletedEvent) {
13143
13252
  (0, import_sonner3.toast)(`Evento "${deletedEvent.title}" exclu\xEDdo`, {
13144
13253
  description: (0, import_date_fns7.format)(
13145
- new Date(deletedEvent.start),
13254
+ new Date(
13255
+ deletedEvent.start ?? deletedEvent.attend_date ?? deletedEvent.end ?? Date.now()
13256
+ ),
13146
13257
  "d 'de' MMMM 'de' yyyy",
13147
13258
  { locale: import_locale3.ptBR }
13148
13259
  ),
@@ -13154,7 +13265,9 @@ function EventCalendar({
13154
13265
  onEventUpdate?.(updatedEvent);
13155
13266
  (0, import_sonner3.toast)(`Evento "${updatedEvent.title}" movido`, {
13156
13267
  description: (0, import_date_fns7.format)(
13157
- new Date(updatedEvent.start),
13268
+ new Date(
13269
+ updatedEvent.start ?? updatedEvent.attend_date ?? updatedEvent.end ?? Date.now()
13270
+ ),
13158
13271
  "d 'de' MMMM 'de' yyyy",
13159
13272
  { locale: import_locale3.ptBR }
13160
13273
  ),
@@ -13181,7 +13294,9 @@ function EventCalendar({
13181
13294
  const month = capitalize((0, import_date_fns7.format)(currentDate, "MMMM", { locale: import_locale3.ptBR }));
13182
13295
  const year = (0, import_date_fns7.format)(currentDate, "yyyy", { locale: import_locale3.ptBR });
13183
13296
  const short = `${dayNum} de ${month} de ${year}`;
13184
- const long = `${(0, import_date_fns7.format)(currentDate, "EEE", { locale: import_locale3.ptBR })}, ${dayNum} de ${month} de ${year}`;
13297
+ const long = `${(0, import_date_fns7.format)(currentDate, "EEE", {
13298
+ locale: import_locale3.ptBR
13299
+ })}, ${dayNum} de ${month} de ${year}`;
13185
13300
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13186
13301
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
13187
13302
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
@@ -13200,213 +13315,214 @@ function EventCalendar({
13200
13315
  }
13201
13316
  return capitalize((0, import_date_fns7.format)(currentDate, "MMMM yyyy", { locale: import_locale3.ptBR }));
13202
13317
  }, [currentDate, view]);
13203
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13204
- "div",
13205
- {
13206
- className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
13207
- style: {
13208
- "--event-gap": `${EventGap}px`,
13209
- "--event-height": `${EventHeight}px`,
13210
- "--week-cells-height": `${WeekCellsHeight}px`
13211
- },
13212
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: [
13213
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13214
- "div",
13215
- {
13216
- className: cn(
13217
- "flex items-center justify-between p-2 sm:p-4",
13218
- className
13219
- ),
13220
- children: [
13221
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
13222
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13223
- ButtonBase,
13224
- {
13225
- className: "max-[479px]:aspect-square max-[479px]:p-0!",
13226
- onClick: handleToday,
13227
- variant: "outline",
13228
- children: [
13229
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13230
- import_react59.CalendarIcon,
13231
- {
13232
- "aria-hidden": "true",
13233
- className: "min-[480px]:hidden",
13234
- size: 16
13235
- }
13236
- ),
13237
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
13238
- ]
13239
- }
13240
- ),
13241
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
13318
+ const calendarContent = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13319
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13320
+ "div",
13321
+ {
13322
+ className: cn(
13323
+ "flex items-center justify-between p-2 sm:p-4",
13324
+ className
13325
+ ),
13326
+ children: [
13327
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
13328
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13329
+ ButtonBase,
13330
+ {
13331
+ className: "max-[479px]:aspect-square max-[479px]:p-0!",
13332
+ onClick: handleToday,
13333
+ variant: "outline",
13334
+ children: [
13242
13335
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13243
- ButtonBase,
13336
+ import_react59.CalendarIcon,
13244
13337
  {
13245
- "aria-label": "Anterior",
13246
- onClick: handlePrevious,
13247
- size: "icon",
13248
- variant: "ghost",
13249
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretLeft, { "aria-hidden": "true", size: 16 })
13338
+ "aria-hidden": "true",
13339
+ className: "min-[480px]:hidden",
13340
+ size: 16
13250
13341
  }
13251
13342
  ),
13252
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13253
- ButtonBase,
13254
- {
13255
- "aria-label": "Pr\xF3ximo",
13256
- onClick: handleNext,
13257
- size: "icon",
13258
- variant: "ghost",
13259
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretRight, { "aria-hidden": "true", size: 16 })
13260
- }
13261
- )
13262
- ] }),
13263
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
13264
- ] }),
13265
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
13266
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuBase, { children: [
13267
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13268
- ButtonBase,
13269
- {
13270
- className: "gap-1.5 max-[479px]:h-8",
13271
- variant: "outline",
13272
- children: [
13273
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { children: [
13274
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
13275
- const labels = {
13276
- month: "M\xEAs",
13277
- week: "Semana",
13278
- day: "Dia",
13279
- agenda: "Agenda"
13280
- };
13281
- return (labels[view] || view).charAt(0).toUpperCase();
13282
- })() }),
13283
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: (() => {
13284
- const labels = {
13285
- month: "M\xEAs",
13286
- week: "Semana",
13287
- day: "Dia",
13288
- agenda: "Agenda"
13289
- };
13290
- return labels[view] || view;
13291
- })() })
13292
- ] }),
13293
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13294
- import_react59.ArrowDownIcon,
13295
- {
13296
- "aria-hidden": "true",
13297
- className: "-me-1 opacity-60",
13298
- size: 16
13299
- }
13300
- )
13301
- ]
13302
- }
13303
- ) }),
13304
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
13305
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
13306
- "M\xEAs ",
13307
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "M" })
13308
- ] }),
13309
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
13310
- "Semana ",
13311
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "S" })
13312
- ] }),
13313
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
13314
- "Dia ",
13315
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "D" })
13316
- ] }),
13317
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
13318
- "Agenda ",
13319
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "A" })
13320
- ] })
13321
- ] })
13322
- ] }),
13323
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13324
- ButtonBase,
13325
- {
13326
- className: "max-[479px]:aspect-square max-[479px]:p-0!",
13327
- onClick: () => {
13328
- setSelectedEvent(null);
13329
- setIsEventDialogOpen(true);
13330
- },
13331
- size: "sm",
13332
- children: [
13333
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13334
- import_react59.PlusIcon,
13335
- {
13336
- "aria-hidden": "true",
13337
- className: "sm:-ms-1 opacity-60",
13338
- size: 16
13339
- }
13340
- ),
13341
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-sm:sr-only", children: "Novo evento" })
13342
- ]
13343
- }
13344
- )
13345
- ] })
13346
- ]
13347
- }
13348
- ),
13349
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13350
- "div",
13351
- {
13352
- className: cn(
13353
- "flex flex-1 flex-col transition-all duration-200 ease-in-out",
13354
- isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
13343
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
13344
+ ]
13345
+ }
13355
13346
  ),
13356
- "aria-live": "polite",
13357
- children: [
13358
- view === "month" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13359
- MonthView,
13360
- {
13361
- currentDate,
13362
- events,
13363
- onEventCreate: handleEventCreate,
13364
- onEventSelect: handleEventSelect
13365
- }
13366
- ),
13367
- view === "week" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13368
- WeekView,
13347
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
13348
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13349
+ ButtonBase,
13369
13350
  {
13370
- currentDate,
13371
- events,
13372
- onEventCreate: handleEventCreate,
13373
- onEventSelect: handleEventSelect
13351
+ "aria-label": "Anterior",
13352
+ onClick: handlePrevious,
13353
+ size: "icon",
13354
+ variant: "ghost",
13355
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretLeft, { "aria-hidden": "true", size: 16 })
13374
13356
  }
13375
13357
  ),
13376
- view === "day" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13377
- DayView,
13358
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13359
+ ButtonBase,
13378
13360
  {
13379
- currentDate,
13380
- events,
13381
- onEventCreate: handleEventCreate,
13382
- onEventSelect: handleEventSelect
13361
+ "aria-label": "Pr\xF3ximo",
13362
+ onClick: handleNext,
13363
+ size: "icon",
13364
+ variant: "ghost",
13365
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretRight, { "aria-hidden": "true", size: 16 })
13383
13366
  }
13384
- ),
13385
- view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13386
- AgendaView,
13367
+ )
13368
+ ] }),
13369
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
13370
+ ] }),
13371
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13372
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuBase, { children: [
13373
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13374
+ ButtonBase,
13387
13375
  {
13388
- currentDate,
13389
- events,
13390
- onEventSelect: handleEventSelect
13376
+ className: "gap-1.5 max-[479px]:h-8",
13377
+ variant: "outline",
13378
+ children: [
13379
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { children: [
13380
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
13381
+ const labels = {
13382
+ month: "M\xEAs",
13383
+ week: "Semana",
13384
+ day: "Dia",
13385
+ agenda: "Agenda"
13386
+ };
13387
+ return (labels[view] || view).charAt(0).toUpperCase();
13388
+ })() }),
13389
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: (() => {
13390
+ const labels = {
13391
+ month: "M\xEAs",
13392
+ week: "Semana",
13393
+ day: "Dia",
13394
+ agenda: "Agenda"
13395
+ };
13396
+ return labels[view] || view;
13397
+ })() })
13398
+ ] }),
13399
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13400
+ import_react59.ArrowDownIcon,
13401
+ {
13402
+ "aria-hidden": "true",
13403
+ className: "-me-1 opacity-60",
13404
+ size: 16
13405
+ }
13406
+ )
13407
+ ]
13391
13408
  }
13392
- )
13393
- ]
13394
- }
13409
+ ) }),
13410
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
13411
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
13412
+ "M\xEAs ",
13413
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "M" })
13414
+ ] }),
13415
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
13416
+ "Semana ",
13417
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "S" })
13418
+ ] }),
13419
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
13420
+ "Dia ",
13421
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "D" })
13422
+ ] }),
13423
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
13424
+ "Agenda ",
13425
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "A" })
13426
+ ] })
13427
+ ] })
13428
+ ] }),
13429
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13430
+ ButtonBase,
13431
+ {
13432
+ className: "max-[479px]:aspect-square max-[479px]:p-0!",
13433
+ onClick: () => {
13434
+ setSelectedEvent(null);
13435
+ setIsEventDialogOpen(true);
13436
+ },
13437
+ size: "sm",
13438
+ children: [
13439
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13440
+ import_react59.PlusIcon,
13441
+ {
13442
+ "aria-hidden": "true",
13443
+ className: "sm:-ms-1 opacity-60",
13444
+ size: 16
13445
+ }
13446
+ ),
13447
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-sm:sr-only", children: "Novo evento" })
13448
+ ]
13449
+ }
13450
+ )
13451
+ ] }) })
13452
+ ]
13453
+ }
13454
+ ),
13455
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13456
+ "div",
13457
+ {
13458
+ className: cn(
13459
+ "flex flex-1 flex-col transition-all duration-200 ease-in-out",
13460
+ isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
13395
13461
  ),
13396
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13397
- EventDialog,
13398
- {
13399
- event: selectedEvent,
13400
- isOpen: isEventDialogOpen,
13401
- onClose: () => {
13402
- setIsEventDialogOpen(false);
13403
- setSelectedEvent(null);
13404
- },
13405
- onDelete: handleEventDelete,
13406
- onSave: handleEventSave
13407
- }
13408
- )
13409
- ] })
13462
+ "aria-live": "polite",
13463
+ children: [
13464
+ view === "month" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13465
+ MonthView,
13466
+ {
13467
+ currentDate,
13468
+ events,
13469
+ onEventCreate: handleEventCreate,
13470
+ onEventSelect: handleEventSelect
13471
+ }
13472
+ ),
13473
+ view === "week" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13474
+ WeekView,
13475
+ {
13476
+ currentDate,
13477
+ events,
13478
+ onEventCreate: handleEventCreate,
13479
+ onEventSelect: handleEventSelect
13480
+ }
13481
+ ),
13482
+ view === "day" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13483
+ DayView,
13484
+ {
13485
+ currentDate,
13486
+ events,
13487
+ onEventCreate: handleEventCreate,
13488
+ onEventSelect: handleEventSelect
13489
+ }
13490
+ ),
13491
+ view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13492
+ AgendaView,
13493
+ {
13494
+ currentDate,
13495
+ events,
13496
+ onEventSelect: handleEventSelect
13497
+ }
13498
+ )
13499
+ ]
13500
+ }
13501
+ ),
13502
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13503
+ EventDialog,
13504
+ {
13505
+ event: selectedEvent,
13506
+ isOpen: isEventDialogOpen,
13507
+ onClose: () => {
13508
+ setIsEventDialogOpen(false);
13509
+ setSelectedEvent(null);
13510
+ },
13511
+ onDelete: handleEventDelete,
13512
+ onSave: handleEventSave
13513
+ }
13514
+ )
13515
+ ] });
13516
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13517
+ "div",
13518
+ {
13519
+ className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
13520
+ style: {
13521
+ "--event-gap": `${EventGap}px`,
13522
+ "--event-height": `${EventHeight}px`,
13523
+ "--week-cells-height": `${WeekCellsHeight}px`
13524
+ },
13525
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
13410
13526
  }
13411
13527
  );
13412
13528
  }
@@ -13876,10 +13992,19 @@ function EventDialog({
13876
13992
  // src/components/event-calendar/EventItem.tsx
13877
13993
  var import_date_fns9 = require("date-fns");
13878
13994
  var import_react62 = require("react");
13995
+ var import_react63 = require("@phosphor-icons/react");
13879
13996
  var import_jsx_runtime80 = require("react/jsx-runtime");
13880
13997
  var formatTimeWithOptionalMinutes = (date) => {
13881
13998
  return (0, import_date_fns9.format)(date, "HH:mm");
13882
13999
  };
14000
+ var isValidDate = (d) => {
14001
+ try {
14002
+ const dt = d instanceof Date ? d : new Date(String(d));
14003
+ return !isNaN(dt.getTime());
14004
+ } catch {
14005
+ return false;
14006
+ }
14007
+ };
13883
14008
  function EventWrapper({
13884
14009
  event,
13885
14010
  isFirstDay = true,
@@ -13895,16 +14020,27 @@ function EventWrapper({
13895
14020
  onTouchStart,
13896
14021
  ariaLabel
13897
14022
  }) {
13898
- const displayEnd = currentTime ? new Date(
13899
- new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
13900
- ) : new Date(event.end);
13901
- const isEventInPast = (0, import_date_fns9.isPast)(displayEnd);
14023
+ const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
14024
+ const displayEnd = (() => {
14025
+ if (isValidDate(event.start) && isValidDate(event.end)) {
14026
+ return currentTime ? new Date(
14027
+ new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14028
+ ) : new Date(event.end);
14029
+ }
14030
+ if (isValidDate(event.attend_date)) {
14031
+ const start = new Date(event.attend_date);
14032
+ return addHoursToDate(start, 1);
14033
+ }
14034
+ return void 0;
14035
+ })();
14036
+ const isEventInPast = displayEnd ? (0, import_date_fns9.isPast)(displayEnd) : false;
14037
+ const colorClasses = hasValidTimeForWrapper ? getEventColorClasses(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
13902
14038
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
13903
14039
  "button",
13904
14040
  {
13905
14041
  className: cn(
13906
- "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md hover:scale-105",
13907
- getEventColorClasses(event.color),
14042
+ "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md ",
14043
+ colorClasses,
13908
14044
  getBorderRadiusClasses(isFirstDay, isLastDay),
13909
14045
  className
13910
14046
  ),
@@ -13924,7 +14060,6 @@ function EventWrapper({
13924
14060
  function EventItem({
13925
14061
  event,
13926
14062
  view,
13927
- isDragging,
13928
14063
  onClick,
13929
14064
  showTime,
13930
14065
  currentTime,
@@ -13935,21 +14070,39 @@ function EventItem({
13935
14070
  dndListeners,
13936
14071
  dndAttributes,
13937
14072
  onMouseDown,
13938
- onTouchStart
14073
+ onTouchStart,
14074
+ agendaOnly = false
13939
14075
  }) {
13940
14076
  const eventColor = event.color;
14077
+ const hasValidTime = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
14078
+ const colorClasses = hasValidTime ? getEventColorClasses(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
13941
14079
  const displayStart = (0, import_react62.useMemo)(() => {
13942
- return currentTime || new Date(event.start);
13943
- }, [currentTime, event.start]);
14080
+ if (!hasValidTime) return void 0;
14081
+ if (isValidDate(event.start))
14082
+ return currentTime || new Date(event.start);
14083
+ if (isValidDate(event.attend_date))
14084
+ return currentTime || new Date(event.attend_date);
14085
+ return void 0;
14086
+ }, [currentTime, event.start, event.attend_date, hasValidTime]);
13944
14087
  const displayEnd = (0, import_react62.useMemo)(() => {
13945
- return currentTime ? new Date(
13946
- new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
13947
- ) : new Date(event.end);
13948
- }, [currentTime, event.start, event.end]);
14088
+ if (!hasValidTime) return void 0;
14089
+ if (isValidDate(event.end)) {
14090
+ return currentTime ? new Date(
14091
+ new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14092
+ ) : new Date(event.end);
14093
+ }
14094
+ if (isValidDate(event.attend_date)) {
14095
+ const start = new Date(event.attend_date);
14096
+ return addHoursToDate(start, 1);
14097
+ }
14098
+ return void 0;
14099
+ }, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
13949
14100
  const durationMinutes = (0, import_react62.useMemo)(() => {
14101
+ if (!hasValidTime || !displayStart || !displayEnd) return 0;
13950
14102
  return (0, import_date_fns9.differenceInMinutes)(displayEnd, displayStart);
13951
- }, [displayStart, displayEnd]);
14103
+ }, [displayStart, displayEnd, hasValidTime]);
13952
14104
  const getEventTime = () => {
14105
+ if (!hasValidTime) return "";
13953
14106
  if (event.allDay) return "All day";
13954
14107
  if (durationMinutes < 45) {
13955
14108
  return formatTimeWithOptionalMinutes(displayStart);
@@ -13958,9 +14111,20 @@ function EventItem({
13958
14111
  displayStart
13959
14112
  )} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
13960
14113
  };
13961
- const ariaLabel = event.allDay ? `${event.title}, All day` : durationMinutes < 45 ? `${event.title}, ${formatTimeWithOptionalMinutes(displayStart)}` : `${event.title}, ${formatTimeWithOptionalMinutes(
13962
- displayStart
13963
- )} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
14114
+ let ariaLabel;
14115
+ if (!hasValidTime) {
14116
+ ariaLabel = event.title;
14117
+ } else if (event.allDay) {
14118
+ ariaLabel = `${event.title}, All day`;
14119
+ } else if (durationMinutes < 45) {
14120
+ ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
14121
+ displayStart
14122
+ )}`;
14123
+ } else {
14124
+ ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
14125
+ displayStart
14126
+ )} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
14127
+ }
13964
14128
  if (view === "month") {
13965
14129
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
13966
14130
  EventWrapper,
@@ -13974,15 +14138,21 @@ function EventItem({
13974
14138
  dndListeners,
13975
14139
  event,
13976
14140
  ariaLabel,
13977
- isDragging,
13978
14141
  isFirstDay,
13979
14142
  isLastDay,
13980
14143
  onClick,
13981
- onMouseDown,
13982
- onTouchStart,
13983
14144
  children: children || /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
13984
- !event.allDay && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: formatTimeWithOptionalMinutes(displayStart) }),
13985
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-medium", children: event.title })
14145
+ !event.allDay && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: formatTimeWithOptionalMinutes(displayStart) }),
14146
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14147
+ "span",
14148
+ {
14149
+ className: cn(
14150
+ "truncate",
14151
+ agendaOnly ? "font-bold text-lg" : "font-medium"
14152
+ ),
14153
+ children: event.title
14154
+ }
14155
+ )
13986
14156
  ] })
13987
14157
  }
13988
14158
  );
@@ -14002,28 +14172,83 @@ function EventItem({
14002
14172
  dndListeners,
14003
14173
  event,
14004
14174
  ariaLabel,
14005
- isDragging,
14006
14175
  isFirstDay,
14007
14176
  isLastDay,
14008
- onClick,
14009
- onMouseDown,
14010
- onTouchStart,
14011
14177
  children: durationMinutes < 45 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
14012
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate", children: event.title }),
14013
- showTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
14178
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("truncate text-lg"), children: event.title }),
14179
+ showTime && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
14014
14180
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
14015
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-medium", children: event.title }),
14016
- showTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[11px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-2 py-0.5 rounded-full", children: getEventTime() }) })
14181
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14182
+ "div",
14183
+ {
14184
+ className: cn(
14185
+ "truncate font-medium text-lg"
14186
+ ),
14187
+ children: event.title
14188
+ }
14189
+ ),
14190
+ showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[15px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
14017
14191
  ] })
14018
14192
  }
14019
14193
  );
14020
14194
  }
14195
+ if (!hasValidTime) {
14196
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
14197
+ "button",
14198
+ {
14199
+ className: cn(
14200
+ "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring",
14201
+ getEventColorClasses(eventColor),
14202
+ className
14203
+ ),
14204
+ "aria-label": ariaLabel,
14205
+ onClick,
14206
+ onMouseDown,
14207
+ onTouchStart,
14208
+ type: "button",
14209
+ ...dndListeners,
14210
+ ...dndAttributes,
14211
+ children: [
14212
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
14213
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14214
+ "div",
14215
+ {
14216
+ className: cn(
14217
+ "opacity-70 flex items-center gap-2",
14218
+ agendaOnly ? "text-sm" : "text-xs"
14219
+ ),
14220
+ children: event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
14221
+ "-",
14222
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
14223
+ ] })
14224
+ }
14225
+ ),
14226
+ event.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14227
+ "div",
14228
+ {
14229
+ className: cn(
14230
+ "my-1 opacity-90",
14231
+ agendaOnly ? "text-md" : "text-xs"
14232
+ ),
14233
+ style: {
14234
+ display: "-webkit-box",
14235
+ WebkitLineClamp: 2,
14236
+ WebkitBoxOrient: "vertical",
14237
+ overflow: "hidden"
14238
+ },
14239
+ children: event.description
14240
+ }
14241
+ )
14242
+ ]
14243
+ }
14244
+ );
14245
+ }
14021
14246
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
14022
14247
  "button",
14023
14248
  {
14024
14249
  className: cn(
14025
- "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90",
14026
- getEventColorClasses(eventColor),
14250
+ "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90 border-2 border-border",
14251
+ colorClasses,
14027
14252
  className
14028
14253
  ),
14029
14254
  "data-past-event": (0, import_date_fns9.isPast)(displayEnd) || void 0,
@@ -14035,23 +14260,29 @@ function EventItem({
14035
14260
  ...dndListeners,
14036
14261
  ...dndAttributes,
14037
14262
  children: [
14038
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "font-medium text-sm", children: event.title }),
14039
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "text-xs opacity-70 flex items-center gap-2", children: [
14040
- event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "uppercase", children: "All day" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase", children: [
14041
- formatTimeWithOptionalMinutes(displayStart),
14042
- " -",
14043
- " ",
14044
- formatTimeWithOptionalMinutes(displayEnd)
14045
- ] }),
14046
- event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
14047
- "-",
14048
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
14049
- ] })
14263
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex w-full justify-between border-b-2 border-black/5 ", children: [
14264
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-bold text-lg"), children: event.title }),
14265
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14266
+ "div",
14267
+ {
14268
+ className: cn(
14269
+ "opacity-90 flex items-center gap-2 text-lg"
14270
+ ),
14271
+ children: event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { children: "Dia todo" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase font-semibold flex items-center gap-2", children: [
14272
+ formatTimeWithOptionalMinutes(displayStart),
14273
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "opacity-70", children: "-" }),
14274
+ formatTimeWithOptionalMinutes(displayEnd),
14275
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_react63.ClockUserIcon, {})
14276
+ ] })
14277
+ }
14278
+ )
14050
14279
  ] }),
14051
14280
  event.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14052
14281
  "div",
14053
14282
  {
14054
- className: "my-1 text-xs opacity-90",
14283
+ className: cn(
14284
+ "my-1 opacity-90 flex text-md"
14285
+ ),
14055
14286
  style: {
14056
14287
  display: "-webkit-box",
14057
14288
  WebkitLineClamp: 2,
@@ -14069,9 +14300,9 @@ function EventItem({
14069
14300
  // src/components/event-calendar/EventsPopUp.tsx
14070
14301
  var import_date_fns10 = require("date-fns");
14071
14302
  var import_locale5 = require("date-fns/locale");
14072
- var import_react63 = require("react");
14303
+ var import_react64 = require("react");
14073
14304
  var import_framer_motion18 = require("framer-motion");
14074
- var import_react64 = require("@phosphor-icons/react");
14305
+ var import_react65 = require("@phosphor-icons/react");
14075
14306
  var import_jsx_runtime81 = require("react/jsx-runtime");
14076
14307
  function EventsPopup({
14077
14308
  date,
@@ -14080,8 +14311,8 @@ function EventsPopup({
14080
14311
  onClose,
14081
14312
  onEventSelect
14082
14313
  }) {
14083
- const popupRef = (0, import_react63.useRef)(null);
14084
- (0, import_react63.useEffect)(() => {
14314
+ const popupRef = (0, import_react64.useRef)(null);
14315
+ (0, import_react64.useEffect)(() => {
14085
14316
  const handleClickOutside = (event) => {
14086
14317
  if (popupRef.current && !popupRef.current.contains(event.target)) {
14087
14318
  onClose();
@@ -14092,7 +14323,7 @@ function EventsPopup({
14092
14323
  document.removeEventListener("mousedown", handleClickOutside);
14093
14324
  };
14094
14325
  }, [onClose]);
14095
- (0, import_react63.useEffect)(() => {
14326
+ (0, import_react64.useEffect)(() => {
14096
14327
  const handleEscKey = (event) => {
14097
14328
  if (event.key === "Escape") {
14098
14329
  onClose();
@@ -14104,10 +14335,10 @@ function EventsPopup({
14104
14335
  };
14105
14336
  }, [onClose]);
14106
14337
  const handleEventClick = (event) => {
14107
- onEventSelect(event);
14338
+ if (onEventSelect) onEventSelect(event);
14108
14339
  onClose();
14109
14340
  };
14110
- const adjustedPosition = (0, import_react63.useMemo)(() => {
14341
+ const adjustedPosition = (0, import_react64.useMemo)(() => {
14111
14342
  const positionCopy = { ...position };
14112
14343
  if (popupRef.current) {
14113
14344
  const rect = popupRef.current.getBoundingClientRect();
@@ -14151,7 +14382,7 @@ function EventsPopup({
14151
14382
  className: "rounded-full p-1 hover:bg-muted",
14152
14383
  onClick: onClose,
14153
14384
  type: "button",
14154
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react64.XIcon, { className: "h-4 w-4" })
14385
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react65.XIcon, { className: "h-4 w-4" })
14155
14386
  }
14156
14387
  )
14157
14388
  ] }),
@@ -14160,18 +14391,20 @@ function EventsPopup({
14160
14391
  const eventEnd = new Date(event.end);
14161
14392
  const isFirstDay = (0, import_date_fns10.isSameDay)(date, eventStart);
14162
14393
  const isLastDay = (0, import_date_fns10.isSameDay)(date, eventEnd);
14394
+ const clickable = Boolean(onEventSelect);
14163
14395
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14164
14396
  "div",
14165
14397
  {
14166
- className: "cursor-pointer",
14167
- onClick: () => handleEventClick(event),
14398
+ className: clickable ? "cursor-pointer" : "cursor-default",
14399
+ onClick: clickable ? () => handleEventClick(event) : void 0,
14168
14400
  children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14169
14401
  EventItem,
14170
14402
  {
14171
14403
  event,
14172
14404
  isFirstDay,
14173
14405
  isLastDay,
14174
- view: "agenda"
14406
+ view: "agenda",
14407
+ className: clickable ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
14175
14408
  }
14176
14409
  )
14177
14410
  },
@@ -14186,11 +14419,11 @@ function EventsPopup({
14186
14419
  // src/components/event-calendar/hooks/use-current-time-indicator.ts
14187
14420
  var import_date_fns11 = require("date-fns");
14188
14421
  var import_locale6 = require("date-fns/locale");
14189
- var import_react65 = require("react");
14422
+ var import_react66 = require("react");
14190
14423
  function useCurrentTimeIndicator(currentDate, view) {
14191
- const [currentTimePosition, setCurrentTimePosition] = (0, import_react65.useState)(0);
14192
- const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react65.useState)(false);
14193
- (0, import_react65.useEffect)(() => {
14424
+ const [currentTimePosition, setCurrentTimePosition] = (0, import_react66.useState)(0);
14425
+ const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react66.useState)(false);
14426
+ (0, import_react66.useEffect)(() => {
14194
14427
  const calculateTimePosition = () => {
14195
14428
  const now = /* @__PURE__ */ new Date();
14196
14429
  const hours = now.getHours();
@@ -14221,15 +14454,15 @@ function useCurrentTimeIndicator(currentDate, view) {
14221
14454
  }
14222
14455
 
14223
14456
  // src/components/event-calendar/hooks/use-event-visibility.ts
14224
- var import_react66 = require("react");
14457
+ var import_react67 = require("react");
14225
14458
  function useEventVisibility({
14226
14459
  eventHeight,
14227
14460
  eventGap
14228
14461
  }) {
14229
- const contentRef = (0, import_react66.useRef)(null);
14230
- const observerRef = (0, import_react66.useRef)(null);
14231
- const [contentHeight, setContentHeight] = (0, import_react66.useState)(null);
14232
- (0, import_react66.useLayoutEffect)(() => {
14462
+ const contentRef = (0, import_react67.useRef)(null);
14463
+ const observerRef = (0, import_react67.useRef)(null);
14464
+ const [contentHeight, setContentHeight] = (0, import_react67.useState)(null);
14465
+ (0, import_react67.useLayoutEffect)(() => {
14233
14466
  if (!contentRef.current) return;
14234
14467
  const updateHeight = () => {
14235
14468
  if (contentRef.current) {
@@ -14249,7 +14482,7 @@ function useEventVisibility({
14249
14482
  }
14250
14483
  };
14251
14484
  }, []);
14252
- const getVisibleEventCount = (0, import_react66.useMemo)(() => {
14485
+ const getVisibleEventCount = (0, import_react67.useMemo)(() => {
14253
14486
  return (totalEvents) => {
14254
14487
  if (!contentHeight) return totalEvents;
14255
14488
  const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
@@ -14269,7 +14502,7 @@ function useEventVisibility({
14269
14502
  // src/components/event-calendar/MonthView.tsx
14270
14503
  var import_date_fns12 = require("date-fns");
14271
14504
  var import_locale7 = require("date-fns/locale");
14272
- var import_react67 = require("react");
14505
+ var import_react68 = require("react");
14273
14506
  var import_jsx_runtime82 = require("react/jsx-runtime");
14274
14507
  function MonthView({
14275
14508
  currentDate,
@@ -14277,21 +14510,21 @@ function MonthView({
14277
14510
  onEventSelect,
14278
14511
  onEventCreate
14279
14512
  }) {
14280
- const days = (0, import_react67.useMemo)(() => {
14513
+ const days = (0, import_react68.useMemo)(() => {
14281
14514
  const monthStart = (0, import_date_fns12.startOfMonth)(currentDate);
14282
14515
  const monthEnd = (0, import_date_fns12.endOfMonth)(monthStart);
14283
14516
  const calendarStart = (0, import_date_fns12.startOfWeek)(monthStart, { weekStartsOn: 0 });
14284
14517
  const calendarEnd = (0, import_date_fns12.endOfWeek)(monthEnd, { weekStartsOn: 0 });
14285
14518
  return (0, import_date_fns12.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
14286
14519
  }, [currentDate]);
14287
- const weekdays = (0, import_react67.useMemo)(() => {
14520
+ const weekdays = (0, import_react68.useMemo)(() => {
14288
14521
  return Array.from({ length: 7 }).map((_, i) => {
14289
14522
  const date = (0, import_date_fns12.addDays)((0, import_date_fns12.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
14290
14523
  const short = (0, import_date_fns12.format)(date, "EEE", { locale: import_locale7.ptBR });
14291
14524
  return short.charAt(0).toUpperCase() + short.slice(1);
14292
14525
  });
14293
14526
  }, []);
14294
- const weeks = (0, import_react67.useMemo)(() => {
14527
+ const weeks = (0, import_react68.useMemo)(() => {
14295
14528
  const result = [];
14296
14529
  let week = [];
14297
14530
  for (let i = 0; i < days.length; i++) {
@@ -14307,12 +14540,12 @@ function MonthView({
14307
14540
  e.stopPropagation();
14308
14541
  onEventSelect(event);
14309
14542
  };
14310
- const [isMounted, setIsMounted] = (0, import_react67.useState)(false);
14543
+ const [isMounted, setIsMounted] = (0, import_react68.useState)(false);
14311
14544
  const { contentRef, getVisibleEventCount } = useEventVisibility({
14312
14545
  eventGap: EventGap,
14313
14546
  eventHeight: EventHeight
14314
14547
  });
14315
- (0, import_react67.useEffect)(() => {
14548
+ (0, import_react68.useEffect)(() => {
14316
14549
  setIsMounted(true);
14317
14550
  }, []);
14318
14551
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
@@ -14487,6 +14720,7 @@ function MonthView({
14487
14720
 
14488
14721
  // src/components/event-calendar/utils.ts
14489
14722
  var import_date_fns13 = require("date-fns");
14723
+ var import_date_fns14 = require("date-fns");
14490
14724
  function getEventColorClasses(color) {
14491
14725
  const eventColor = color || "sky";
14492
14726
  switch (eventColor) {
@@ -14519,15 +14753,16 @@ function getBorderRadiusClasses(isFirstDay, isLastDay) {
14519
14753
  return "rounded-none";
14520
14754
  }
14521
14755
  function isMultiDayEvent(event) {
14522
- const eventStart = new Date(event.start);
14523
- const eventEnd = new Date(event.end);
14756
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
14757
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
14758
+ if (!eventStart || !eventEnd) return !!event.allDay;
14524
14759
  return event.allDay || eventStart.getDate() !== eventEnd.getDate();
14525
14760
  }
14526
14761
  function getEventsForDay(events, day) {
14527
14762
  return events.filter((event) => {
14528
- const eventStart = new Date(event.start);
14529
- return (0, import_date_fns13.isSameDay)(day, eventStart);
14530
- }).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
14763
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
14764
+ return eventStart ? (0, import_date_fns13.isSameDay)(day, eventStart) : false;
14765
+ }).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
14531
14766
  }
14532
14767
  function sortEvents(events) {
14533
14768
  return [...events].sort((a, b) => {
@@ -14535,30 +14770,47 @@ function sortEvents(events) {
14535
14770
  const bIsMultiDay = isMultiDayEvent(b);
14536
14771
  if (aIsMultiDay && !bIsMultiDay) return -1;
14537
14772
  if (!aIsMultiDay && bIsMultiDay) return 1;
14538
- return new Date(a.start).getTime() - new Date(b.start).getTime();
14773
+ return getEventStartTimestamp(a) - getEventStartTimestamp(b);
14539
14774
  });
14540
14775
  }
14541
14776
  function getSpanningEventsForDay(events, day) {
14542
14777
  return events.filter((event) => {
14543
14778
  if (!isMultiDayEvent(event)) return false;
14544
- const eventStart = new Date(event.start);
14545
- const eventEnd = new Date(event.end);
14779
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
14780
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
14781
+ if (!eventStart || !eventEnd) return false;
14546
14782
  return !(0, import_date_fns13.isSameDay)(day, eventStart) && ((0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd);
14547
14783
  });
14548
14784
  }
14549
14785
  function getAllEventsForDay(events, day) {
14550
14786
  return events.filter((event) => {
14551
- const eventStart = new Date(event.start);
14552
- const eventEnd = new Date(event.end);
14553
- return (0, import_date_fns13.isSameDay)(day, eventStart) || (0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd;
14787
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
14788
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
14789
+ if (!eventStart) return false;
14790
+ return (0, import_date_fns13.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns13.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
14554
14791
  });
14555
14792
  }
14556
14793
  function getAgendaEventsForDay(events, day) {
14557
14794
  return events.filter((event) => {
14558
- const eventStart = new Date(event.start);
14559
- const eventEnd = new Date(event.end);
14560
- return (0, import_date_fns13.isSameDay)(day, eventStart) || (0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd;
14561
- }).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
14795
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
14796
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : isValidDate2(event.attend_date) ? (0, import_date_fns14.addHours)(new Date(event.attend_date), 1) : void 0;
14797
+ if (!eventStart) return false;
14798
+ return (0, import_date_fns13.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns13.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
14799
+ }).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
14800
+ }
14801
+ function isValidDate2(d) {
14802
+ try {
14803
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
14804
+ return !isNaN(t);
14805
+ } catch {
14806
+ return false;
14807
+ }
14808
+ }
14809
+ function getEventStartTimestamp(e) {
14810
+ if (isValidDate2(e.start)) return new Date(e.start).getTime();
14811
+ if (isValidDate2(e.attend_date))
14812
+ return new Date(e.attend_date).getTime();
14813
+ return Number.MAX_SAFE_INTEGER;
14562
14814
  }
14563
14815
  function addHoursToDate(date, hours) {
14564
14816
  const result = new Date(date);
@@ -14567,9 +14819,9 @@ function addHoursToDate(date, hours) {
14567
14819
  }
14568
14820
 
14569
14821
  // src/components/event-calendar/WeekView.tsx
14570
- var import_date_fns14 = require("date-fns");
14822
+ var import_date_fns15 = require("date-fns");
14571
14823
  var import_locale8 = require("date-fns/locale");
14572
- var import_react68 = require("react");
14824
+ var import_react69 = require("react");
14573
14825
  var import_jsx_runtime83 = require("react/jsx-runtime");
14574
14826
  function WeekView({
14575
14827
  currentDate,
@@ -14577,40 +14829,40 @@ function WeekView({
14577
14829
  onEventSelect,
14578
14830
  onEventCreate
14579
14831
  }) {
14580
- const days = (0, import_react68.useMemo)(() => {
14581
- const weekStart2 = (0, import_date_fns14.startOfWeek)(currentDate, { weekStartsOn: 0 });
14582
- const weekEnd = (0, import_date_fns14.endOfWeek)(currentDate, { weekStartsOn: 0 });
14583
- return (0, import_date_fns14.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
14832
+ const days = (0, import_react69.useMemo)(() => {
14833
+ const weekStart2 = (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 });
14834
+ const weekEnd = (0, import_date_fns15.endOfWeek)(currentDate, { weekStartsOn: 0 });
14835
+ return (0, import_date_fns15.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
14584
14836
  }, [currentDate]);
14585
- const weekStart = (0, import_react68.useMemo)(
14586
- () => (0, import_date_fns14.startOfWeek)(currentDate, { weekStartsOn: 0 }),
14837
+ const weekStart = (0, import_react69.useMemo)(
14838
+ () => (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 }),
14587
14839
  [currentDate]
14588
14840
  );
14589
- const hours = (0, import_react68.useMemo)(() => {
14590
- const dayStart = (0, import_date_fns14.startOfDay)(currentDate);
14591
- return (0, import_date_fns14.eachHourOfInterval)({
14592
- end: (0, import_date_fns14.addHours)(dayStart, EndHour - 1),
14593
- start: (0, import_date_fns14.addHours)(dayStart, StartHour)
14841
+ const hours = (0, import_react69.useMemo)(() => {
14842
+ const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
14843
+ return (0, import_date_fns15.eachHourOfInterval)({
14844
+ end: (0, import_date_fns15.addHours)(dayStart, EndHour - 1),
14845
+ start: (0, import_date_fns15.addHours)(dayStart, StartHour)
14594
14846
  });
14595
14847
  }, [currentDate]);
14596
- const allDayEvents = (0, import_react68.useMemo)(() => {
14848
+ const allDayEvents = (0, import_react69.useMemo)(() => {
14597
14849
  return events.filter((event) => {
14598
14850
  return event.allDay || isMultiDayEvent(event);
14599
14851
  }).filter((event) => {
14600
14852
  const eventStart = new Date(event.start);
14601
14853
  const eventEnd = new Date(event.end);
14602
14854
  return days.some(
14603
- (day) => (0, import_date_fns14.isSameDay)(day, eventStart) || (0, import_date_fns14.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd
14855
+ (day) => (0, import_date_fns15.isSameDay)(day, eventStart) || (0, import_date_fns15.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd
14604
14856
  );
14605
14857
  });
14606
14858
  }, [events, days]);
14607
- const processedDayEvents = (0, import_react68.useMemo)(() => {
14859
+ const processedDayEvents = (0, import_react69.useMemo)(() => {
14608
14860
  const result = days.map((day) => {
14609
14861
  const dayEvents = events.filter((event) => {
14610
14862
  if (event.allDay || isMultiDayEvent(event)) return false;
14611
14863
  const eventStart = new Date(event.start);
14612
14864
  const eventEnd = new Date(event.end);
14613
- return (0, import_date_fns14.isSameDay)(day, eventStart) || (0, import_date_fns14.isSameDay)(day, eventEnd) || eventStart < day && eventEnd > day;
14865
+ return (0, import_date_fns15.isSameDay)(day, eventStart) || (0, import_date_fns15.isSameDay)(day, eventEnd) || eventStart < day && eventEnd > day;
14614
14866
  });
14615
14867
  const sortedEvents = [...dayEvents].sort((a, b) => {
14616
14868
  const aStart = new Date(a.start);
@@ -14619,20 +14871,20 @@ function WeekView({
14619
14871
  const bEnd = new Date(b.end);
14620
14872
  if (aStart < bStart) return -1;
14621
14873
  if (aStart > bStart) return 1;
14622
- const aDuration = (0, import_date_fns14.differenceInMinutes)(aEnd, aStart);
14623
- const bDuration = (0, import_date_fns14.differenceInMinutes)(bEnd, bStart);
14874
+ const aDuration = (0, import_date_fns15.differenceInMinutes)(aEnd, aStart);
14875
+ const bDuration = (0, import_date_fns15.differenceInMinutes)(bEnd, bStart);
14624
14876
  return bDuration - aDuration;
14625
14877
  });
14626
14878
  const positionedEvents = [];
14627
- const dayStart = (0, import_date_fns14.startOfDay)(day);
14879
+ const dayStart = (0, import_date_fns15.startOfDay)(day);
14628
14880
  const columns = [];
14629
14881
  for (const event of sortedEvents) {
14630
14882
  const eventStart = new Date(event.start);
14631
14883
  const eventEnd = new Date(event.end);
14632
- const adjustedStart = (0, import_date_fns14.isSameDay)(day, eventStart) ? eventStart : dayStart;
14633
- const adjustedEnd = (0, import_date_fns14.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns14.addHours)(dayStart, 24);
14634
- const startHour = (0, import_date_fns14.getHours)(adjustedStart) + (0, import_date_fns14.getMinutes)(adjustedStart) / 60;
14635
- const endHour = (0, import_date_fns14.getHours)(adjustedEnd) + (0, import_date_fns14.getMinutes)(adjustedEnd) / 60;
14884
+ const adjustedStart = (0, import_date_fns15.isSameDay)(day, eventStart) ? eventStart : dayStart;
14885
+ const adjustedEnd = (0, import_date_fns15.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns15.addHours)(dayStart, 24);
14886
+ const startHour = (0, import_date_fns15.getHours)(adjustedStart) + (0, import_date_fns15.getMinutes)(adjustedStart) / 60;
14887
+ const endHour = (0, import_date_fns15.getHours)(adjustedEnd) + (0, import_date_fns15.getMinutes)(adjustedEnd) / 60;
14636
14888
  const top = (startHour - StartHour) * WeekCellsHeight;
14637
14889
  const height = (endHour - startHour) * WeekCellsHeight;
14638
14890
  let columnIndex = 0;
@@ -14644,7 +14896,7 @@ function WeekView({
14644
14896
  placed = true;
14645
14897
  } else {
14646
14898
  const overlaps = col.some(
14647
- (c) => (0, import_date_fns14.areIntervalsOverlapping)(
14899
+ (c) => (0, import_date_fns15.areIntervalsOverlapping)(
14648
14900
  { end: adjustedEnd, start: adjustedStart },
14649
14901
  {
14650
14902
  end: new Date(c.event.end),
@@ -14689,19 +14941,19 @@ function WeekView({
14689
14941
  );
14690
14942
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
14691
14943
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background/80 backdrop-blur-md", children: [
14692
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-[479px]:sr-only", children: (0, import_date_fns14.format)(/* @__PURE__ */ new Date(), "O") }) }),
14944
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-[479px]:sr-only", children: (0, import_date_fns15.format)(/* @__PURE__ */ new Date(), "O") }) }),
14693
14945
  days.map((day) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
14694
14946
  "div",
14695
14947
  {
14696
14948
  className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
14697
- "data-today": (0, import_date_fns14.isToday)(day) || void 0,
14949
+ "data-today": (0, import_date_fns15.isToday)(day) || void 0,
14698
14950
  children: [
14699
14951
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
14700
- (0, import_date_fns14.format)(day, "EEE", { locale: import_locale8.ptBR })[0],
14952
+ (0, import_date_fns15.format)(day, "EEE", { locale: import_locale8.ptBR })[0],
14701
14953
  " ",
14702
- (0, import_date_fns14.format)(day, "d", { locale: import_locale8.ptBR })
14954
+ (0, import_date_fns15.format)(day, "d", { locale: import_locale8.ptBR })
14703
14955
  ] }),
14704
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns14.format)(day, "EEE dd", { locale: import_locale8.ptBR }) })
14956
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns15.format)(day, "EEE dd", { locale: import_locale8.ptBR }) })
14705
14957
  ]
14706
14958
  },
14707
14959
  day.toString()
@@ -14713,19 +14965,19 @@ function WeekView({
14713
14965
  const dayAllDayEvents = allDayEvents.filter((event) => {
14714
14966
  const eventStart = new Date(event.start);
14715
14967
  const eventEnd = new Date(event.end);
14716
- return (0, import_date_fns14.isSameDay)(day, eventStart) || day > eventStart && day < eventEnd || (0, import_date_fns14.isSameDay)(day, eventEnd);
14968
+ return (0, import_date_fns15.isSameDay)(day, eventStart) || day > eventStart && day < eventEnd || (0, import_date_fns15.isSameDay)(day, eventEnd);
14717
14969
  });
14718
14970
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14719
14971
  "div",
14720
14972
  {
14721
14973
  className: "relative border-border/70 border-r p-1 last:border-r-0",
14722
- "data-today": (0, import_date_fns14.isToday)(day) || void 0,
14974
+ "data-today": (0, import_date_fns15.isToday)(day) || void 0,
14723
14975
  children: dayAllDayEvents.map((event) => {
14724
14976
  const eventStart = new Date(event.start);
14725
14977
  const eventEnd = new Date(event.end);
14726
- const isFirstDay = (0, import_date_fns14.isSameDay)(day, eventStart);
14727
- const isLastDay = (0, import_date_fns14.isSameDay)(day, eventEnd);
14728
- const isFirstVisibleDay = dayIndex === 0 && (0, import_date_fns14.isBefore)(eventStart, weekStart);
14978
+ const isFirstDay = (0, import_date_fns15.isSameDay)(day, eventStart);
14979
+ const isLastDay = (0, import_date_fns15.isSameDay)(day, eventEnd);
14980
+ const isFirstVisibleDay = dayIndex === 0 && (0, import_date_fns15.isBefore)(eventStart, weekStart);
14729
14981
  const shouldShowTitle = isFirstDay || isFirstVisibleDay;
14730
14982
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14731
14983
  EventItem,
@@ -14760,7 +15012,7 @@ function WeekView({
14760
15012
  "div",
14761
15013
  {
14762
15014
  className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
14763
- children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns14.format)(hour, "HH:mm") })
15015
+ children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns15.format)(hour, "HH:mm") })
14764
15016
  },
14765
15017
  hour.toString()
14766
15018
  )) }),
@@ -14768,7 +15020,7 @@ function WeekView({
14768
15020
  "div",
14769
15021
  {
14770
15022
  className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
14771
- "data-today": (0, import_date_fns14.isToday)(day) || void 0,
15023
+ "data-today": (0, import_date_fns15.isToday)(day) || void 0,
14772
15024
  children: [
14773
15025
  (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14774
15026
  "div",
@@ -14795,7 +15047,7 @@ function WeekView({
14795
15047
  },
14796
15048
  positionedEvent.event.id
14797
15049
  )),
14798
- currentTimeVisible && (0, import_date_fns14.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
15050
+ currentTimeVisible && (0, import_date_fns15.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14799
15051
  "div",
14800
15052
  {
14801
15053
  className: "pointer-events-none absolute right-0 left-0 z-20",
@@ -14807,7 +15059,7 @@ function WeekView({
14807
15059
  }
14808
15060
  ),
14809
15061
  hours.map((hour) => {
14810
- const hourValue = (0, import_date_fns14.getHours)(hour);
15062
+ const hourValue = (0, import_date_fns15.getHours)(hour);
14811
15063
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14812
15064
  "div",
14813
15065
  {
@@ -14850,11 +15102,11 @@ function WeekView({
14850
15102
  }
14851
15103
 
14852
15104
  // src/components/ui/form/CheckBoxThree.tsx
14853
- var import_react69 = require("react");
15105
+ var import_react70 = require("react");
14854
15106
  var import_framer_motion19 = require("framer-motion");
14855
15107
  var import_jsx_runtime84 = require("react/jsx-runtime");
14856
15108
  function useCheckboxTree(initialTree) {
14857
- const initialCheckedNodes = (0, import_react69.useMemo)(() => {
15109
+ const initialCheckedNodes = (0, import_react70.useMemo)(() => {
14858
15110
  const checkedSet = /* @__PURE__ */ new Set();
14859
15111
  const initializeCheckedNodes = (node) => {
14860
15112
  if (node.defaultChecked) {
@@ -14865,8 +15117,8 @@ function useCheckboxTree(initialTree) {
14865
15117
  initializeCheckedNodes(initialTree);
14866
15118
  return checkedSet;
14867
15119
  }, [initialTree]);
14868
- const [checkedNodes, setCheckedNodes] = (0, import_react69.useState)(initialCheckedNodes);
14869
- const isChecked = (0, import_react69.useCallback)(
15120
+ const [checkedNodes, setCheckedNodes] = (0, import_react70.useState)(initialCheckedNodes);
15121
+ const isChecked = (0, import_react70.useCallback)(
14870
15122
  (node) => {
14871
15123
  if (!node.children) {
14872
15124
  return checkedNodes.has(node.id);
@@ -14884,7 +15136,7 @@ function useCheckboxTree(initialTree) {
14884
15136
  },
14885
15137
  [checkedNodes]
14886
15138
  );
14887
- const handleCheck = (0, import_react69.useCallback)(
15139
+ const handleCheck = (0, import_react70.useCallback)(
14888
15140
  (node) => {
14889
15141
  const newCheckedNodes = new Set(checkedNodes);
14890
15142
  const toggleNode = (n, check) => {
@@ -14914,9 +15166,9 @@ function CheckboxTree({ tree, renderNode }) {
14914
15166
  onCheckedChange,
14915
15167
  children
14916
15168
  }) => {
14917
- const [open, setOpen] = (0, import_react69.useState)(() => !!node.children && status !== false);
14918
- const checkboxRef = (0, import_react69.useRef)(null);
14919
- (0, import_react69.useEffect)(() => {
15169
+ const [open, setOpen] = (0, import_react70.useState)(() => !!node.children && status !== false);
15170
+ const checkboxRef = (0, import_react70.useRef)(null);
15171
+ (0, import_react70.useEffect)(() => {
14920
15172
  if (checkboxRef.current) {
14921
15173
  checkboxRef.current.indeterminate = status === "indeterminate";
14922
15174
  }
@@ -14999,14 +15251,328 @@ function CheckboxTree({ tree, renderNode }) {
14999
15251
  return renderTreeNode(tree);
15000
15252
  }
15001
15253
 
15254
+ // src/components/selects/MultiSelectBase.tsx
15255
+ var import_react71 = require("@phosphor-icons/react");
15256
+ var import_react72 = require("react");
15257
+ var import_framer_motion20 = require("framer-motion");
15258
+ var import_jsx_runtime85 = require("react/jsx-runtime");
15259
+ var MultiSelectContext = (0, import_react72.createContext)(null);
15260
+ function MultiSelectBase({
15261
+ children,
15262
+ values,
15263
+ defaultValues,
15264
+ onValuesChange,
15265
+ disabled,
15266
+ empty,
15267
+ error
15268
+ }) {
15269
+ const [open, setOpen] = (0, import_react72.useState)(false);
15270
+ const [internalValues, setInternalValues] = (0, import_react72.useState)(
15271
+ new Set(values ?? defaultValues)
15272
+ );
15273
+ const selectedValues = values ? new Set(values) : internalValues;
15274
+ const [items, setItems] = (0, import_react72.useState)(/* @__PURE__ */ new Map());
15275
+ function toggleValue(value) {
15276
+ if (disabled) return;
15277
+ const getNewSet = (prev) => {
15278
+ const newSet = new Set(prev);
15279
+ if (newSet.has(value)) {
15280
+ newSet.delete(value);
15281
+ } else {
15282
+ newSet.add(value);
15283
+ }
15284
+ return newSet;
15285
+ };
15286
+ setInternalValues(getNewSet);
15287
+ onValuesChange?.([...getNewSet(selectedValues)]);
15288
+ }
15289
+ const onItemAdded = (0, import_react72.useCallback)((value, label) => {
15290
+ setItems((prev) => {
15291
+ if (prev.get(value) === label) return prev;
15292
+ return new Map(prev).set(value, label);
15293
+ });
15294
+ }, []);
15295
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15296
+ MultiSelectContext.Provider,
15297
+ {
15298
+ value: {
15299
+ open,
15300
+ setOpen,
15301
+ selectedValues,
15302
+ toggleValue,
15303
+ items,
15304
+ onItemAdded,
15305
+ disabled,
15306
+ emptyMessage: empty,
15307
+ error
15308
+ },
15309
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15310
+ PopoverBase,
15311
+ {
15312
+ open,
15313
+ onOpenChange: (v) => !disabled && setOpen(v),
15314
+ modal: true,
15315
+ children
15316
+ }
15317
+ )
15318
+ }
15319
+ );
15320
+ }
15321
+ function MultiSelectTriggerBase({
15322
+ className,
15323
+ children,
15324
+ error: propError,
15325
+ ...props
15326
+ }) {
15327
+ const { open, disabled, error: contextError } = useMultiSelectContext();
15328
+ const error = propError ?? contextError;
15329
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: cn("w-full", error && "mb-0"), children: [
15330
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15331
+ ButtonBase,
15332
+ {
15333
+ ...props,
15334
+ variant: props.variant ?? "outline",
15335
+ role: props.role ?? "combobox",
15336
+ "aria-expanded": props["aria-expanded"] ?? open,
15337
+ "aria-disabled": disabled || void 0,
15338
+ disabled,
15339
+ className: cn(
15340
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 min-w-[150px]",
15341
+ error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring",
15342
+ className
15343
+ ),
15344
+ children: [
15345
+ children,
15346
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react71.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
15347
+ ]
15348
+ }
15349
+ ) }),
15350
+ error ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ErrorMessage_default, { error }) : null
15351
+ ] });
15352
+ }
15353
+ function MultiSelectValueBase({
15354
+ placeholder,
15355
+ clickToRemove = true,
15356
+ className,
15357
+ overflowBehavior = "wrap-when-open",
15358
+ ...props
15359
+ }) {
15360
+ const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
15361
+ const [overflowAmount, setOverflowAmount] = (0, import_react72.useState)(0);
15362
+ const valueRef = (0, import_react72.useRef)(null);
15363
+ const overflowRef = (0, import_react72.useRef)(null);
15364
+ const mutationObserverRef = (0, import_react72.useRef)(null);
15365
+ const resizeObserverRef = (0, import_react72.useRef)(null);
15366
+ const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
15367
+ const checkOverflow = (0, import_react72.useCallback)(() => {
15368
+ if (valueRef.current == null) return;
15369
+ const containerElement = valueRef.current;
15370
+ const overflowElement = overflowRef.current;
15371
+ const items2 = containerElement.querySelectorAll(
15372
+ "[data-selected-item]"
15373
+ );
15374
+ if (overflowElement != null) overflowElement.style.display = "none";
15375
+ items2.forEach((child) => child.style.removeProperty("display"));
15376
+ let amount = 0;
15377
+ for (let i = items2.length - 1; i >= 0; i--) {
15378
+ const child = items2[i];
15379
+ if (containerElement.scrollWidth <= containerElement.clientWidth) {
15380
+ break;
15381
+ }
15382
+ amount = items2.length - i;
15383
+ child.style.display = "none";
15384
+ overflowElement?.style.removeProperty("display");
15385
+ }
15386
+ setOverflowAmount(amount);
15387
+ }, []);
15388
+ const handleResize = (0, import_react72.useCallback)(
15389
+ (node) => {
15390
+ if (node == null) {
15391
+ valueRef.current = null;
15392
+ if (resizeObserverRef.current) {
15393
+ resizeObserverRef.current.disconnect();
15394
+ resizeObserverRef.current = null;
15395
+ }
15396
+ if (mutationObserverRef.current) {
15397
+ mutationObserverRef.current.disconnect();
15398
+ mutationObserverRef.current = null;
15399
+ }
15400
+ return;
15401
+ }
15402
+ valueRef.current = node;
15403
+ if (resizeObserverRef.current) {
15404
+ resizeObserverRef.current.disconnect();
15405
+ resizeObserverRef.current = null;
15406
+ }
15407
+ if (mutationObserverRef.current) {
15408
+ mutationObserverRef.current.disconnect();
15409
+ mutationObserverRef.current = null;
15410
+ }
15411
+ const mo = new MutationObserver(checkOverflow);
15412
+ const ro = new ResizeObserver(debounce(checkOverflow, 100));
15413
+ mutationObserverRef.current = mo;
15414
+ resizeObserverRef.current = ro;
15415
+ mo.observe(node, {
15416
+ childList: true,
15417
+ attributes: true,
15418
+ attributeFilter: ["class", "style"]
15419
+ });
15420
+ ro.observe(node);
15421
+ checkOverflow();
15422
+ },
15423
+ [checkOverflow]
15424
+ );
15425
+ if (selectedValues.size === 0 && placeholder) {
15426
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "min-w-0 overflow-hidden font-normal text-muted-foreground ", children: placeholder });
15427
+ }
15428
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15429
+ "div",
15430
+ {
15431
+ ...props,
15432
+ ref: handleResize,
15433
+ className: cn(
15434
+ "flex w-full gap-1.5 overflow-hidden",
15435
+ shouldWrap && "h-full flex-wrap",
15436
+ className
15437
+ ),
15438
+ children: [
15439
+ [...selectedValues].filter((value) => items.has(value)).map((value) => /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15440
+ Badge,
15441
+ {
15442
+ "data-selected-item": true,
15443
+ size: "sm",
15444
+ className: "group flex items-center gap-1",
15445
+ onClick: clickToRemove ? (e) => {
15446
+ e.stopPropagation();
15447
+ toggleValue(value);
15448
+ } : void 0,
15449
+ children: [
15450
+ items.get(value),
15451
+ clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react71.XIcon, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
15452
+ ]
15453
+ },
15454
+ value
15455
+ )),
15456
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15457
+ Badge,
15458
+ {
15459
+ style: {
15460
+ display: overflowAmount > 0 && !shouldWrap ? "block" : "none"
15461
+ },
15462
+ ref: overflowRef,
15463
+ children: [
15464
+ "+",
15465
+ overflowAmount
15466
+ ]
15467
+ }
15468
+ )
15469
+ ]
15470
+ }
15471
+ );
15472
+ }
15473
+ function MultiSelectContentBase({
15474
+ search = true,
15475
+ children,
15476
+ ...props
15477
+ }) {
15478
+ const canSearch = typeof search === "object" ? true : search;
15479
+ const { emptyMessage } = useMultiSelectContext();
15480
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_jsx_runtime85.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PopoverContentBase, { className: "w-[--radix-popover-trigger-width] relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md p-0", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15481
+ import_framer_motion20.motion.div,
15482
+ {
15483
+ initial: { opacity: 0, scale: 0.95 },
15484
+ animate: { opacity: 1, scale: 1 },
15485
+ exit: { opacity: 0, scale: 0.95 },
15486
+ transition: { duration: 0.2 },
15487
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(CommandBase, { ...props, children: [
15488
+ canSearch ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15489
+ CommandInputBase,
15490
+ {
15491
+ placeholder: typeof search === "object" ? search.placeholder : void 0
15492
+ }
15493
+ ) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { autoFocus: true, className: "sr-only" }),
15494
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(CommandListBase, { children: [
15495
+ canSearch && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
15496
+ children
15497
+ ] })
15498
+ ] }) })
15499
+ }
15500
+ ) }) });
15501
+ }
15502
+ function MultiSelectItemBase({
15503
+ value,
15504
+ children,
15505
+ badgeLabel,
15506
+ onSelect,
15507
+ ...props
15508
+ }) {
15509
+ const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
15510
+ const isSelected = selectedValues.has(value);
15511
+ (0, import_react72.useEffect)(() => {
15512
+ onItemAdded(value, badgeLabel ?? children);
15513
+ }, [value, children, onItemAdded, badgeLabel]);
15514
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15515
+ CommandItemBase,
15516
+ {
15517
+ ...props,
15518
+ onSelect: () => {
15519
+ toggleValue(value);
15520
+ onSelect?.(value);
15521
+ },
15522
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15523
+ import_framer_motion20.motion.div,
15524
+ {
15525
+ whileHover: { scale: 1.02 },
15526
+ whileTap: { scale: 0.98 },
15527
+ transition: { duration: 0.1 },
15528
+ children: [
15529
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15530
+ import_framer_motion20.motion.div,
15531
+ {
15532
+ initial: { scale: 0 },
15533
+ animate: { scale: isSelected ? 1 : 0 },
15534
+ transition: { type: "spring", stiffness: 500, damping: 30 },
15535
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react71.CheckIcon, { className: "size-4" })
15536
+ }
15537
+ ) }),
15538
+ children
15539
+ ]
15540
+ }
15541
+ )
15542
+ }
15543
+ );
15544
+ }
15545
+ function MultiSelectGroupBase(props) {
15546
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandGroupBase, { ...props });
15547
+ }
15548
+ function MultiSelectSeparatorBase(props) {
15549
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandSeparatorBase, { ...props });
15550
+ }
15551
+ function useMultiSelectContext() {
15552
+ const context = (0, import_react72.useContext)(MultiSelectContext);
15553
+ if (context == null) {
15554
+ throw new Error(
15555
+ "useMultiSelectContext must be used within a MultiSelectContext"
15556
+ );
15557
+ }
15558
+ return context;
15559
+ }
15560
+ function debounce(func, wait) {
15561
+ let timeout = null;
15562
+ return function(...args) {
15563
+ if (timeout) clearTimeout(timeout);
15564
+ timeout = setTimeout(() => func.apply(this, args), wait);
15565
+ };
15566
+ }
15567
+
15002
15568
  // src/hooks/use-drag.tsx
15003
- var import_react70 = require("react");
15569
+ var import_react73 = require("react");
15004
15570
  var useDrag = (options = {}) => {
15005
- const [isDragging, setIsDragging] = (0, import_react70.useState)(null);
15006
- const [positions, setPositions] = (0, import_react70.useState)({});
15007
- const dragStartPos = (0, import_react70.useRef)(null);
15008
- const dragId = (0, import_react70.useRef)(null);
15009
- const handleMouseDown = (0, import_react70.useCallback)((id, e) => {
15571
+ const [isDragging, setIsDragging] = (0, import_react73.useState)(null);
15572
+ const [positions, setPositions] = (0, import_react73.useState)({});
15573
+ const dragStartPos = (0, import_react73.useRef)(null);
15574
+ const dragId = (0, import_react73.useRef)(null);
15575
+ const handleMouseDown = (0, import_react73.useCallback)((id, e) => {
15010
15576
  e.preventDefault();
15011
15577
  const currentPosition = positions[id] || { top: 0, left: 0 };
15012
15578
  dragStartPos.current = {
@@ -15019,7 +15585,7 @@ var useDrag = (options = {}) => {
15019
15585
  setIsDragging(id);
15020
15586
  options.onDragStart?.(id);
15021
15587
  }, [positions, options]);
15022
- const handleMouseMove = (0, import_react70.useCallback)((e) => {
15588
+ const handleMouseMove = (0, import_react73.useCallback)((e) => {
15023
15589
  if (!isDragging || !dragStartPos.current || !dragId.current) return;
15024
15590
  const deltaX = e.clientX - dragStartPos.current.x;
15025
15591
  const deltaY = e.clientY - dragStartPos.current.y;
@@ -15035,7 +15601,7 @@ var useDrag = (options = {}) => {
15035
15601
  }));
15036
15602
  options.onDrag?.(dragId.current, newPosition);
15037
15603
  }, [isDragging, options]);
15038
- const handleMouseUp = (0, import_react70.useCallback)(() => {
15604
+ const handleMouseUp = (0, import_react73.useCallback)(() => {
15039
15605
  if (dragId.current) {
15040
15606
  options.onDragEnd?.(dragId.current);
15041
15607
  }
@@ -15043,7 +15609,7 @@ var useDrag = (options = {}) => {
15043
15609
  dragStartPos.current = null;
15044
15610
  dragId.current = null;
15045
15611
  }, [options]);
15046
- (0, import_react70.useEffect)(() => {
15612
+ (0, import_react73.useEffect)(() => {
15047
15613
  if (isDragging) {
15048
15614
  document.addEventListener("mousemove", handleMouseMove);
15049
15615
  document.addEventListener("mouseup", handleMouseUp);
@@ -15055,16 +15621,16 @@ var useDrag = (options = {}) => {
15055
15621
  };
15056
15622
  }
15057
15623
  }, [isDragging, handleMouseMove, handleMouseUp]);
15058
- const setPosition = (0, import_react70.useCallback)((id, position) => {
15624
+ const setPosition = (0, import_react73.useCallback)((id, position) => {
15059
15625
  setPositions((prev) => ({
15060
15626
  ...prev,
15061
15627
  [id]: position
15062
15628
  }));
15063
15629
  }, []);
15064
- const getPosition = (0, import_react70.useCallback)((id) => {
15630
+ const getPosition = (0, import_react73.useCallback)((id) => {
15065
15631
  return positions[id] || { top: 0, left: 0 };
15066
15632
  }, [positions]);
15067
- const isElementDragging = (0, import_react70.useCallback)((id) => {
15633
+ const isElementDragging = (0, import_react73.useCallback)((id) => {
15068
15634
  return isDragging === id;
15069
15635
  }, [isDragging]);
15070
15636
  return {