@mlw-packages/react-components 1.7.16 → 1.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +49 -3
- package/dist/index.d.mts +43 -13
- package/dist/index.d.ts +43 -13
- package/dist/index.js +1117 -548
- package/dist/index.mjs +1100 -524
- package/package.json +1 -1
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-
|
|
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
|
|
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]
|
|
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
|
|
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/
|
|
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-
|
|
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 =
|
|
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(
|
|
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,
|
|
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,
|
|
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:
|
|
4630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NoData_default, {})
|
|
4463
4631
|
}
|
|
4464
4632
|
)
|
|
4465
4633
|
}
|
|
4466
4634
|
);
|
|
4467
4635
|
}
|
|
4468
|
-
return /* @__PURE__ */ (0,
|
|
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,
|
|
4646
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4479
4647
|
"div",
|
|
4480
4648
|
{
|
|
4481
|
-
className: cn("rounded-lg bg-card
|
|
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,
|
|
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:
|
|
4661
|
+
marginTop: "19px"
|
|
4494
4662
|
},
|
|
4495
|
-
children: /* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4622
4790
|
import_recharts.YAxis,
|
|
4623
4791
|
{
|
|
4624
4792
|
yAxisId: "left",
|
|
4625
|
-
width:
|
|
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,
|
|
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,
|
|
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,
|
|
4878
|
+
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4711
4879
|
import_recharts.Tooltip,
|
|
4712
4880
|
{
|
|
4713
|
-
content: showTooltipTotal ? /* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
5346
5514
|
entry.name,
|
|
5347
5515
|
":"
|
|
5348
5516
|
] }),
|
|
5349
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
5376
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
5584
|
+
showTooltip && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5417
5585
|
import_recharts2.Tooltip,
|
|
5418
5586
|
{
|
|
5419
|
-
content: /* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
5490
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
5971
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
6007
|
-
showLegend && /* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
6025
|
-
children: showLabels && /* @__PURE__ */ (0,
|
|
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,
|
|
6063
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
6216
|
-
/* @__PURE__ */ (0,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
},
|
|
12350
|
+
}, debounce2);
|
|
12282
12351
|
return () => {
|
|
12283
12352
|
clearTimeout(timeout);
|
|
12284
12353
|
setIsDebouncing(false);
|
|
12285
12354
|
};
|
|
12286
|
-
}, [
|
|
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(
|
|
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
|
-
] }) :
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
|
|
12357
|
-
|
|
12358
|
-
|
|
12359
|
-
|
|
12360
|
-
|
|
12361
|
-
|
|
12362
|
-
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
|
|
12374
|
-
|
|
12375
|
-
|
|
12376
|
-
|
|
12377
|
-
|
|
12378
|
-
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
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
|
|
@@ -12986,14 +13090,19 @@ function EventCalendar({
|
|
|
12986
13090
|
onEventUpdate,
|
|
12987
13091
|
onEventDelete,
|
|
12988
13092
|
className,
|
|
12989
|
-
initialView = "month"
|
|
13093
|
+
initialView = "month",
|
|
13094
|
+
mode = "default"
|
|
12990
13095
|
}) {
|
|
13096
|
+
const isAgendaOnly = mode === "agenda-only";
|
|
12991
13097
|
const [currentDate, setCurrentDate] = (0, import_react58.useState)(/* @__PURE__ */ new Date());
|
|
12992
|
-
const [view, setView] = (0, import_react58.useState)(
|
|
13098
|
+
const [view, setView] = (0, import_react58.useState)(
|
|
13099
|
+
isAgendaOnly ? "agenda" : initialView
|
|
13100
|
+
);
|
|
12993
13101
|
const [isFading, setIsFading] = (0, import_react58.useState)(false);
|
|
12994
13102
|
const FADE_DURATION = 220;
|
|
12995
13103
|
const changeView = (0, import_react58.useCallback)(
|
|
12996
13104
|
(next) => {
|
|
13105
|
+
if (isAgendaOnly) return;
|
|
12997
13106
|
if (next === view) return;
|
|
12998
13107
|
setIsFading(true);
|
|
12999
13108
|
window.setTimeout(() => {
|
|
@@ -13001,7 +13110,7 @@ function EventCalendar({
|
|
|
13001
13110
|
requestAnimationFrame(() => setIsFading(false));
|
|
13002
13111
|
}, FADE_DURATION);
|
|
13003
13112
|
},
|
|
13004
|
-
[view]
|
|
13113
|
+
[view, isAgendaOnly]
|
|
13005
13114
|
);
|
|
13006
13115
|
const [isPaging, setIsPaging] = (0, import_react58.useState)(false);
|
|
13007
13116
|
const [pageDirection, setPageDirection] = (0, import_react58.useState)(
|
|
@@ -13031,11 +13140,11 @@ function EventCalendar({
|
|
|
13031
13140
|
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
13032
13141
|
return;
|
|
13033
13142
|
}
|
|
13143
|
+
if (isAgendaOnly) return;
|
|
13034
13144
|
switch (e.key.toLowerCase()) {
|
|
13035
13145
|
case "m":
|
|
13036
13146
|
changeView("month");
|
|
13037
13147
|
break;
|
|
13038
|
-
// aceitar tanto 'w' (inglês) quanto 's' (pt-BR para "semana")
|
|
13039
13148
|
case "w":
|
|
13040
13149
|
case "s":
|
|
13041
13150
|
changeView("week");
|
|
@@ -13052,7 +13161,7 @@ function EventCalendar({
|
|
|
13052
13161
|
return () => {
|
|
13053
13162
|
window.removeEventListener("keydown", handleKeyDown);
|
|
13054
13163
|
};
|
|
13055
|
-
}, [isEventDialogOpen, changeView]);
|
|
13164
|
+
}, [isEventDialogOpen, changeView, isAgendaOnly]);
|
|
13056
13165
|
const handlePrevious = () => {
|
|
13057
13166
|
pageTransition(() => {
|
|
13058
13167
|
if (view === "month") {
|
|
@@ -13083,11 +13192,13 @@ function EventCalendar({
|
|
|
13083
13192
|
setCurrentDate(/* @__PURE__ */ new Date());
|
|
13084
13193
|
};
|
|
13085
13194
|
const handleEventSelect = (event) => {
|
|
13195
|
+
if (isAgendaOnly) return;
|
|
13086
13196
|
console.log("Event selected:", event);
|
|
13087
13197
|
setSelectedEvent(event);
|
|
13088
13198
|
setIsEventDialogOpen(true);
|
|
13089
13199
|
};
|
|
13090
13200
|
const handleEventCreate = (startTime) => {
|
|
13201
|
+
if (isAgendaOnly) return;
|
|
13091
13202
|
console.log("Creating new event at:", startTime);
|
|
13092
13203
|
const minutes = startTime.getMinutes();
|
|
13093
13204
|
const remainder = minutes % 15;
|
|
@@ -13181,7 +13292,9 @@ function EventCalendar({
|
|
|
13181
13292
|
const month = capitalize((0, import_date_fns7.format)(currentDate, "MMMM", { locale: import_locale3.ptBR }));
|
|
13182
13293
|
const year = (0, import_date_fns7.format)(currentDate, "yyyy", { locale: import_locale3.ptBR });
|
|
13183
13294
|
const short = `${dayNum} de ${month} de ${year}`;
|
|
13184
|
-
const long = `${(0, import_date_fns7.format)(currentDate, "EEE", {
|
|
13295
|
+
const long = `${(0, import_date_fns7.format)(currentDate, "EEE", {
|
|
13296
|
+
locale: import_locale3.ptBR
|
|
13297
|
+
})}, ${dayNum} de ${month} de ${year}`;
|
|
13185
13298
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
13186
13299
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
13187
13300
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
|
|
@@ -13200,213 +13313,217 @@ function EventCalendar({
|
|
|
13200
13313
|
}
|
|
13201
13314
|
return capitalize((0, import_date_fns7.format)(currentDate, "MMMM yyyy", { locale: import_locale3.ptBR }));
|
|
13202
13315
|
}, [currentDate, view]);
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
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: [
|
|
13316
|
+
const calendarContent = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
13317
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
13318
|
+
"div",
|
|
13319
|
+
{
|
|
13320
|
+
className: cn(
|
|
13321
|
+
"flex items-center justify-between p-2 sm:p-4",
|
|
13322
|
+
className
|
|
13323
|
+
),
|
|
13324
|
+
children: [
|
|
13325
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
|
|
13326
|
+
!isAgendaOnly && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
13327
|
+
ButtonBase,
|
|
13328
|
+
{
|
|
13329
|
+
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
13330
|
+
onClick: handleToday,
|
|
13331
|
+
variant: "outline",
|
|
13332
|
+
children: [
|
|
13242
13333
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13243
|
-
|
|
13334
|
+
import_react59.CalendarIcon,
|
|
13244
13335
|
{
|
|
13245
|
-
"aria-
|
|
13246
|
-
|
|
13247
|
-
size:
|
|
13248
|
-
variant: "ghost",
|
|
13249
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
13336
|
+
"aria-hidden": "true",
|
|
13337
|
+
className: "min-[480px]:hidden",
|
|
13338
|
+
size: 16
|
|
13250
13339
|
}
|
|
13251
13340
|
),
|
|
13252
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13253
|
-
|
|
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"
|
|
13341
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
|
|
13342
|
+
]
|
|
13343
|
+
}
|
|
13355
13344
|
),
|
|
13356
|
-
"
|
|
13357
|
-
|
|
13358
|
-
|
|
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,
|
|
13345
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
|
|
13346
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13347
|
+
ButtonBase,
|
|
13369
13348
|
{
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13349
|
+
"aria-label": "Anterior",
|
|
13350
|
+
onClick: handlePrevious,
|
|
13351
|
+
size: "icon",
|
|
13352
|
+
variant: "ghost",
|
|
13353
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
13374
13354
|
}
|
|
13375
13355
|
),
|
|
13376
|
-
|
|
13377
|
-
|
|
13356
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13357
|
+
ButtonBase,
|
|
13378
13358
|
{
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13359
|
+
"aria-label": "Pr\xF3ximo",
|
|
13360
|
+
onClick: handleNext,
|
|
13361
|
+
size: "icon",
|
|
13362
|
+
variant: "ghost",
|
|
13363
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretRight, { "aria-hidden": "true", size: 16 })
|
|
13383
13364
|
}
|
|
13384
|
-
)
|
|
13385
|
-
|
|
13386
|
-
|
|
13365
|
+
)
|
|
13366
|
+
] }),
|
|
13367
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
|
|
13368
|
+
] }),
|
|
13369
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex items-center gap-2", children: !isAgendaOnly && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
13370
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuBase, { children: [
|
|
13371
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
13372
|
+
ButtonBase,
|
|
13387
13373
|
{
|
|
13388
|
-
|
|
13389
|
-
|
|
13390
|
-
|
|
13374
|
+
className: "gap-1.5 max-[479px]:h-8",
|
|
13375
|
+
variant: "outline",
|
|
13376
|
+
children: [
|
|
13377
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { children: [
|
|
13378
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
|
|
13379
|
+
const labels = {
|
|
13380
|
+
month: "M\xEAs",
|
|
13381
|
+
week: "Semana",
|
|
13382
|
+
day: "Dia",
|
|
13383
|
+
agenda: "Agenda"
|
|
13384
|
+
};
|
|
13385
|
+
return (labels[view] || view).charAt(0).toUpperCase();
|
|
13386
|
+
})() }),
|
|
13387
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: (() => {
|
|
13388
|
+
const labels = {
|
|
13389
|
+
month: "M\xEAs",
|
|
13390
|
+
week: "Semana",
|
|
13391
|
+
day: "Dia",
|
|
13392
|
+
agenda: "Agenda"
|
|
13393
|
+
};
|
|
13394
|
+
return labels[view] || view;
|
|
13395
|
+
})() })
|
|
13396
|
+
] }),
|
|
13397
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13398
|
+
import_react59.ArrowDownIcon,
|
|
13399
|
+
{
|
|
13400
|
+
"aria-hidden": "true",
|
|
13401
|
+
className: "-me-1 opacity-60",
|
|
13402
|
+
size: 16
|
|
13403
|
+
}
|
|
13404
|
+
)
|
|
13405
|
+
]
|
|
13391
13406
|
}
|
|
13392
|
-
)
|
|
13393
|
-
|
|
13394
|
-
|
|
13407
|
+
) }),
|
|
13408
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
|
|
13409
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
|
|
13410
|
+
"M\xEAs ",
|
|
13411
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "M" })
|
|
13412
|
+
] }),
|
|
13413
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
|
|
13414
|
+
"Semana",
|
|
13415
|
+
" ",
|
|
13416
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "S" })
|
|
13417
|
+
] }),
|
|
13418
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
|
|
13419
|
+
"Dia ",
|
|
13420
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "D" })
|
|
13421
|
+
] }),
|
|
13422
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
|
|
13423
|
+
"Agenda",
|
|
13424
|
+
" ",
|
|
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
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
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: isAgendaOnly ? void 0 : handleEventSelect,
|
|
13497
|
+
showUndatedEvents: isAgendaOnly
|
|
13498
|
+
}
|
|
13499
|
+
)
|
|
13500
|
+
]
|
|
13501
|
+
}
|
|
13502
|
+
),
|
|
13503
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13504
|
+
EventDialog,
|
|
13505
|
+
{
|
|
13506
|
+
event: selectedEvent,
|
|
13507
|
+
isOpen: isEventDialogOpen,
|
|
13508
|
+
onClose: () => {
|
|
13509
|
+
setIsEventDialogOpen(false);
|
|
13510
|
+
setSelectedEvent(null);
|
|
13511
|
+
},
|
|
13512
|
+
onDelete: handleEventDelete,
|
|
13513
|
+
onSave: handleEventSave
|
|
13514
|
+
}
|
|
13515
|
+
)
|
|
13516
|
+
] });
|
|
13517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
13518
|
+
"div",
|
|
13519
|
+
{
|
|
13520
|
+
className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
|
|
13521
|
+
style: {
|
|
13522
|
+
"--event-gap": `${EventGap}px`,
|
|
13523
|
+
"--event-height": `${EventHeight}px`,
|
|
13524
|
+
"--week-cells-height": `${WeekCellsHeight}px`
|
|
13525
|
+
},
|
|
13526
|
+
children: isAgendaOnly ? calendarContent : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
|
|
13410
13527
|
}
|
|
13411
13528
|
);
|
|
13412
13529
|
}
|
|
@@ -13880,6 +13997,14 @@ 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,18 @@ function EventWrapper({
|
|
|
13895
14020
|
onTouchStart,
|
|
13896
14021
|
ariaLabel
|
|
13897
14022
|
}) {
|
|
13898
|
-
const
|
|
14023
|
+
const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end);
|
|
14024
|
+
const displayEnd = hasValidTimeForWrapper ? currentTime ? new Date(
|
|
13899
14025
|
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);
|
|
14026
|
+
) : new Date(event.end) : void 0;
|
|
14027
|
+
const isEventInPast = displayEnd ? (0, import_date_fns9.isPast)(displayEnd) : false;
|
|
14028
|
+
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
14029
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
13903
14030
|
"button",
|
|
13904
14031
|
{
|
|
13905
14032
|
className: cn(
|
|
13906
14033
|
"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
|
-
|
|
14034
|
+
colorClasses,
|
|
13908
14035
|
getBorderRadiusClasses(isFirstDay, isLastDay),
|
|
13909
14036
|
className
|
|
13910
14037
|
),
|
|
@@ -13935,21 +14062,39 @@ function EventItem({
|
|
|
13935
14062
|
dndListeners,
|
|
13936
14063
|
dndAttributes,
|
|
13937
14064
|
onMouseDown,
|
|
13938
|
-
onTouchStart
|
|
14065
|
+
onTouchStart,
|
|
14066
|
+
agendaOnly = false
|
|
13939
14067
|
}) {
|
|
13940
14068
|
const eventColor = event.color;
|
|
14069
|
+
const hasValidTime = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
|
|
14070
|
+
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
14071
|
const displayStart = (0, import_react62.useMemo)(() => {
|
|
13942
|
-
|
|
13943
|
-
|
|
14072
|
+
if (!hasValidTime) return void 0;
|
|
14073
|
+
if (isValidDate(event.start))
|
|
14074
|
+
return currentTime || new Date(event.start);
|
|
14075
|
+
if (isValidDate(event.attend_date))
|
|
14076
|
+
return currentTime || new Date(event.attend_date);
|
|
14077
|
+
return void 0;
|
|
14078
|
+
}, [currentTime, event.start, event.attend_date, hasValidTime]);
|
|
13944
14079
|
const displayEnd = (0, import_react62.useMemo)(() => {
|
|
13945
|
-
|
|
13946
|
-
|
|
13947
|
-
|
|
13948
|
-
|
|
14080
|
+
if (!hasValidTime) return void 0;
|
|
14081
|
+
if (isValidDate(event.end)) {
|
|
14082
|
+
return currentTime ? new Date(
|
|
14083
|
+
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
14084
|
+
) : new Date(event.end);
|
|
14085
|
+
}
|
|
14086
|
+
if (isValidDate(event.attend_date)) {
|
|
14087
|
+
const start = new Date(event.attend_date);
|
|
14088
|
+
return addHoursToDate(start, 1);
|
|
14089
|
+
}
|
|
14090
|
+
return void 0;
|
|
14091
|
+
}, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
|
|
13949
14092
|
const durationMinutes = (0, import_react62.useMemo)(() => {
|
|
14093
|
+
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
13950
14094
|
return (0, import_date_fns9.differenceInMinutes)(displayEnd, displayStart);
|
|
13951
|
-
}, [displayStart, displayEnd]);
|
|
14095
|
+
}, [displayStart, displayEnd, hasValidTime]);
|
|
13952
14096
|
const getEventTime = () => {
|
|
14097
|
+
if (!hasValidTime) return "";
|
|
13953
14098
|
if (event.allDay) return "All day";
|
|
13954
14099
|
if (durationMinutes < 45) {
|
|
13955
14100
|
return formatTimeWithOptionalMinutes(displayStart);
|
|
@@ -13958,9 +14103,20 @@ function EventItem({
|
|
|
13958
14103
|
displayStart
|
|
13959
14104
|
)} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
|
|
13960
14105
|
};
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
|
|
14106
|
+
let ariaLabel;
|
|
14107
|
+
if (!hasValidTime) {
|
|
14108
|
+
ariaLabel = event.title;
|
|
14109
|
+
} else if (event.allDay) {
|
|
14110
|
+
ariaLabel = `${event.title}, All day`;
|
|
14111
|
+
} else if (durationMinutes < 45) {
|
|
14112
|
+
ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
|
|
14113
|
+
displayStart
|
|
14114
|
+
)}`;
|
|
14115
|
+
} else {
|
|
14116
|
+
ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
|
|
14117
|
+
displayStart
|
|
14118
|
+
)} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
|
|
14119
|
+
}
|
|
13964
14120
|
if (view === "month") {
|
|
13965
14121
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
13966
14122
|
EventWrapper,
|
|
@@ -13981,8 +14137,17 @@ function EventItem({
|
|
|
13981
14137
|
onMouseDown,
|
|
13982
14138
|
onTouchStart,
|
|
13983
14139
|
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)(
|
|
14140
|
+
!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) }),
|
|
14141
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14142
|
+
"span",
|
|
14143
|
+
{
|
|
14144
|
+
className: cn(
|
|
14145
|
+
"truncate",
|
|
14146
|
+
agendaOnly ? "font-bold text-lg" : "font-medium"
|
|
14147
|
+
),
|
|
14148
|
+
children: event.title
|
|
14149
|
+
}
|
|
14150
|
+
)
|
|
13986
14151
|
] })
|
|
13987
14152
|
}
|
|
13988
14153
|
);
|
|
@@ -14009,21 +14174,81 @@ function EventItem({
|
|
|
14009
14174
|
onMouseDown,
|
|
14010
14175
|
onTouchStart,
|
|
14011
14176
|
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) })
|
|
14177
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("truncate", agendaOnly ? "text-lg" : ""), children: event.title }),
|
|
14178
|
+
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
14179
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
14015
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14016
|
-
|
|
14180
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14181
|
+
"div",
|
|
14182
|
+
{
|
|
14183
|
+
className: cn(
|
|
14184
|
+
"truncate font-medium",
|
|
14185
|
+
agendaOnly ? "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-[11px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-2 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-sm" : "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
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",
|
|
14026
|
-
|
|
14251
|
+
colorClasses,
|
|
14027
14252
|
className
|
|
14028
14253
|
),
|
|
14029
14254
|
"data-past-event": (0, import_date_fns9.isPast)(displayEnd) || void 0,
|
|
@@ -14035,23 +14260,32 @@ 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)(
|
|
14040
|
-
|
|
14041
|
-
|
|
14042
|
-
|
|
14043
|
-
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14263
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
|
|
14264
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
14265
|
+
"div",
|
|
14266
|
+
{
|
|
14267
|
+
className: cn(
|
|
14268
|
+
"opacity-70 flex items-center gap-2",
|
|
14269
|
+
agendaOnly ? "text-sm" : "text-xs"
|
|
14270
|
+
),
|
|
14271
|
+
children: [
|
|
14272
|
+
event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "uppercase", children: "All day" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase", children: [
|
|
14273
|
+
formatTimeWithOptionalMinutes(displayStart),
|
|
14274
|
+
" -",
|
|
14275
|
+
" ",
|
|
14276
|
+
formatTimeWithOptionalMinutes(displayEnd)
|
|
14277
|
+
] }),
|
|
14278
|
+
event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
|
|
14279
|
+
"-",
|
|
14280
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
|
|
14281
|
+
] })
|
|
14282
|
+
]
|
|
14283
|
+
}
|
|
14284
|
+
),
|
|
14051
14285
|
event.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14052
14286
|
"div",
|
|
14053
14287
|
{
|
|
14054
|
-
className: "my-1 text-
|
|
14288
|
+
className: cn("my-1 opacity-90", agendaOnly ? "text-sm" : "text-xs"),
|
|
14055
14289
|
style: {
|
|
14056
14290
|
display: "-webkit-box",
|
|
14057
14291
|
WebkitLineClamp: 2,
|
|
@@ -14104,7 +14338,7 @@ function EventsPopup({
|
|
|
14104
14338
|
};
|
|
14105
14339
|
}, [onClose]);
|
|
14106
14340
|
const handleEventClick = (event) => {
|
|
14107
|
-
onEventSelect(event);
|
|
14341
|
+
if (onEventSelect) onEventSelect(event);
|
|
14108
14342
|
onClose();
|
|
14109
14343
|
};
|
|
14110
14344
|
const adjustedPosition = (0, import_react63.useMemo)(() => {
|
|
@@ -14160,18 +14394,20 @@ function EventsPopup({
|
|
|
14160
14394
|
const eventEnd = new Date(event.end);
|
|
14161
14395
|
const isFirstDay = (0, import_date_fns10.isSameDay)(date, eventStart);
|
|
14162
14396
|
const isLastDay = (0, import_date_fns10.isSameDay)(date, eventEnd);
|
|
14397
|
+
const clickable = Boolean(onEventSelect);
|
|
14163
14398
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14164
14399
|
"div",
|
|
14165
14400
|
{
|
|
14166
|
-
className: "cursor-pointer",
|
|
14167
|
-
onClick: () => handleEventClick(event),
|
|
14401
|
+
className: clickable ? "cursor-pointer" : "cursor-default",
|
|
14402
|
+
onClick: clickable ? () => handleEventClick(event) : void 0,
|
|
14168
14403
|
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14169
14404
|
EventItem,
|
|
14170
14405
|
{
|
|
14171
14406
|
event,
|
|
14172
14407
|
isFirstDay,
|
|
14173
14408
|
isLastDay,
|
|
14174
|
-
view: "agenda"
|
|
14409
|
+
view: "agenda",
|
|
14410
|
+
className: clickable ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
|
|
14175
14411
|
}
|
|
14176
14412
|
)
|
|
14177
14413
|
},
|
|
@@ -14487,6 +14723,7 @@ function MonthView({
|
|
|
14487
14723
|
|
|
14488
14724
|
// src/components/event-calendar/utils.ts
|
|
14489
14725
|
var import_date_fns13 = require("date-fns");
|
|
14726
|
+
var import_date_fns14 = require("date-fns");
|
|
14490
14727
|
function getEventColorClasses(color) {
|
|
14491
14728
|
const eventColor = color || "sky";
|
|
14492
14729
|
switch (eventColor) {
|
|
@@ -14519,15 +14756,16 @@ function getBorderRadiusClasses(isFirstDay, isLastDay) {
|
|
|
14519
14756
|
return "rounded-none";
|
|
14520
14757
|
}
|
|
14521
14758
|
function isMultiDayEvent(event) {
|
|
14522
|
-
const eventStart = new Date(event.start);
|
|
14523
|
-
const eventEnd = new Date(event.end);
|
|
14759
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14760
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14761
|
+
if (!eventStart || !eventEnd) return !!event.allDay;
|
|
14524
14762
|
return event.allDay || eventStart.getDate() !== eventEnd.getDate();
|
|
14525
14763
|
}
|
|
14526
14764
|
function getEventsForDay(events, day) {
|
|
14527
14765
|
return events.filter((event) => {
|
|
14528
|
-
const eventStart = new Date(event.start);
|
|
14529
|
-
return (0, import_date_fns13.isSameDay)(day, eventStart);
|
|
14530
|
-
}).sort((a, b) =>
|
|
14766
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
|
|
14767
|
+
return eventStart ? (0, import_date_fns13.isSameDay)(day, eventStart) : false;
|
|
14768
|
+
}).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
|
|
14531
14769
|
}
|
|
14532
14770
|
function sortEvents(events) {
|
|
14533
14771
|
return [...events].sort((a, b) => {
|
|
@@ -14535,30 +14773,47 @@ function sortEvents(events) {
|
|
|
14535
14773
|
const bIsMultiDay = isMultiDayEvent(b);
|
|
14536
14774
|
if (aIsMultiDay && !bIsMultiDay) return -1;
|
|
14537
14775
|
if (!aIsMultiDay && bIsMultiDay) return 1;
|
|
14538
|
-
return
|
|
14776
|
+
return getEventStartTimestamp(a) - getEventStartTimestamp(b);
|
|
14539
14777
|
});
|
|
14540
14778
|
}
|
|
14541
14779
|
function getSpanningEventsForDay(events, day) {
|
|
14542
14780
|
return events.filter((event) => {
|
|
14543
14781
|
if (!isMultiDayEvent(event)) return false;
|
|
14544
|
-
const eventStart = new Date(event.start);
|
|
14545
|
-
const eventEnd = new Date(event.end);
|
|
14782
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14783
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14784
|
+
if (!eventStart || !eventEnd) return false;
|
|
14546
14785
|
return !(0, import_date_fns13.isSameDay)(day, eventStart) && ((0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd);
|
|
14547
14786
|
});
|
|
14548
14787
|
}
|
|
14549
14788
|
function getAllEventsForDay(events, day) {
|
|
14550
14789
|
return events.filter((event) => {
|
|
14551
|
-
const eventStart = new Date(event.start);
|
|
14552
|
-
const eventEnd = new Date(event.end);
|
|
14553
|
-
|
|
14790
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14791
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14792
|
+
if (!eventStart) return false;
|
|
14793
|
+
return (0, import_date_fns13.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns13.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
14554
14794
|
});
|
|
14555
14795
|
}
|
|
14556
14796
|
function getAgendaEventsForDay(events, day) {
|
|
14557
14797
|
return events.filter((event) => {
|
|
14558
|
-
const eventStart = new Date(event.start);
|
|
14559
|
-
const eventEnd = new Date(event.end);
|
|
14560
|
-
|
|
14561
|
-
|
|
14798
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
|
|
14799
|
+
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;
|
|
14800
|
+
if (!eventStart) return false;
|
|
14801
|
+
return (0, import_date_fns13.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns13.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
14802
|
+
}).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
|
|
14803
|
+
}
|
|
14804
|
+
function isValidDate2(d) {
|
|
14805
|
+
try {
|
|
14806
|
+
const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
|
|
14807
|
+
return !isNaN(t);
|
|
14808
|
+
} catch {
|
|
14809
|
+
return false;
|
|
14810
|
+
}
|
|
14811
|
+
}
|
|
14812
|
+
function getEventStartTimestamp(e) {
|
|
14813
|
+
if (isValidDate2(e.start)) return new Date(e.start).getTime();
|
|
14814
|
+
if (isValidDate2(e.attend_date))
|
|
14815
|
+
return new Date(e.attend_date).getTime();
|
|
14816
|
+
return Number.MAX_SAFE_INTEGER;
|
|
14562
14817
|
}
|
|
14563
14818
|
function addHoursToDate(date, hours) {
|
|
14564
14819
|
const result = new Date(date);
|
|
@@ -14567,7 +14822,7 @@ function addHoursToDate(date, hours) {
|
|
|
14567
14822
|
}
|
|
14568
14823
|
|
|
14569
14824
|
// src/components/event-calendar/WeekView.tsx
|
|
14570
|
-
var
|
|
14825
|
+
var import_date_fns15 = require("date-fns");
|
|
14571
14826
|
var import_locale8 = require("date-fns/locale");
|
|
14572
14827
|
var import_react68 = require("react");
|
|
14573
14828
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
@@ -14578,19 +14833,19 @@ function WeekView({
|
|
|
14578
14833
|
onEventCreate
|
|
14579
14834
|
}) {
|
|
14580
14835
|
const days = (0, import_react68.useMemo)(() => {
|
|
14581
|
-
const weekStart2 = (0,
|
|
14582
|
-
const weekEnd = (0,
|
|
14583
|
-
return (0,
|
|
14836
|
+
const weekStart2 = (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
14837
|
+
const weekEnd = (0, import_date_fns15.endOfWeek)(currentDate, { weekStartsOn: 0 });
|
|
14838
|
+
return (0, import_date_fns15.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
|
|
14584
14839
|
}, [currentDate]);
|
|
14585
14840
|
const weekStart = (0, import_react68.useMemo)(
|
|
14586
|
-
() => (0,
|
|
14841
|
+
() => (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 }),
|
|
14587
14842
|
[currentDate]
|
|
14588
14843
|
);
|
|
14589
14844
|
const hours = (0, import_react68.useMemo)(() => {
|
|
14590
|
-
const dayStart = (0,
|
|
14591
|
-
return (0,
|
|
14592
|
-
end: (0,
|
|
14593
|
-
start: (0,
|
|
14845
|
+
const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
|
|
14846
|
+
return (0, import_date_fns15.eachHourOfInterval)({
|
|
14847
|
+
end: (0, import_date_fns15.addHours)(dayStart, EndHour - 1),
|
|
14848
|
+
start: (0, import_date_fns15.addHours)(dayStart, StartHour)
|
|
14594
14849
|
});
|
|
14595
14850
|
}, [currentDate]);
|
|
14596
14851
|
const allDayEvents = (0, import_react68.useMemo)(() => {
|
|
@@ -14600,7 +14855,7 @@ function WeekView({
|
|
|
14600
14855
|
const eventStart = new Date(event.start);
|
|
14601
14856
|
const eventEnd = new Date(event.end);
|
|
14602
14857
|
return days.some(
|
|
14603
|
-
(day) => (0,
|
|
14858
|
+
(day) => (0, import_date_fns15.isSameDay)(day, eventStart) || (0, import_date_fns15.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd
|
|
14604
14859
|
);
|
|
14605
14860
|
});
|
|
14606
14861
|
}, [events, days]);
|
|
@@ -14610,7 +14865,7 @@ function WeekView({
|
|
|
14610
14865
|
if (event.allDay || isMultiDayEvent(event)) return false;
|
|
14611
14866
|
const eventStart = new Date(event.start);
|
|
14612
14867
|
const eventEnd = new Date(event.end);
|
|
14613
|
-
return (0,
|
|
14868
|
+
return (0, import_date_fns15.isSameDay)(day, eventStart) || (0, import_date_fns15.isSameDay)(day, eventEnd) || eventStart < day && eventEnd > day;
|
|
14614
14869
|
});
|
|
14615
14870
|
const sortedEvents = [...dayEvents].sort((a, b) => {
|
|
14616
14871
|
const aStart = new Date(a.start);
|
|
@@ -14619,20 +14874,20 @@ function WeekView({
|
|
|
14619
14874
|
const bEnd = new Date(b.end);
|
|
14620
14875
|
if (aStart < bStart) return -1;
|
|
14621
14876
|
if (aStart > bStart) return 1;
|
|
14622
|
-
const aDuration = (0,
|
|
14623
|
-
const bDuration = (0,
|
|
14877
|
+
const aDuration = (0, import_date_fns15.differenceInMinutes)(aEnd, aStart);
|
|
14878
|
+
const bDuration = (0, import_date_fns15.differenceInMinutes)(bEnd, bStart);
|
|
14624
14879
|
return bDuration - aDuration;
|
|
14625
14880
|
});
|
|
14626
14881
|
const positionedEvents = [];
|
|
14627
|
-
const dayStart = (0,
|
|
14882
|
+
const dayStart = (0, import_date_fns15.startOfDay)(day);
|
|
14628
14883
|
const columns = [];
|
|
14629
14884
|
for (const event of sortedEvents) {
|
|
14630
14885
|
const eventStart = new Date(event.start);
|
|
14631
14886
|
const eventEnd = new Date(event.end);
|
|
14632
|
-
const adjustedStart = (0,
|
|
14633
|
-
const adjustedEnd = (0,
|
|
14634
|
-
const startHour = (0,
|
|
14635
|
-
const endHour = (0,
|
|
14887
|
+
const adjustedStart = (0, import_date_fns15.isSameDay)(day, eventStart) ? eventStart : dayStart;
|
|
14888
|
+
const adjustedEnd = (0, import_date_fns15.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns15.addHours)(dayStart, 24);
|
|
14889
|
+
const startHour = (0, import_date_fns15.getHours)(adjustedStart) + (0, import_date_fns15.getMinutes)(adjustedStart) / 60;
|
|
14890
|
+
const endHour = (0, import_date_fns15.getHours)(adjustedEnd) + (0, import_date_fns15.getMinutes)(adjustedEnd) / 60;
|
|
14636
14891
|
const top = (startHour - StartHour) * WeekCellsHeight;
|
|
14637
14892
|
const height = (endHour - startHour) * WeekCellsHeight;
|
|
14638
14893
|
let columnIndex = 0;
|
|
@@ -14644,7 +14899,7 @@ function WeekView({
|
|
|
14644
14899
|
placed = true;
|
|
14645
14900
|
} else {
|
|
14646
14901
|
const overlaps = col.some(
|
|
14647
|
-
(c) => (0,
|
|
14902
|
+
(c) => (0, import_date_fns15.areIntervalsOverlapping)(
|
|
14648
14903
|
{ end: adjustedEnd, start: adjustedStart },
|
|
14649
14904
|
{
|
|
14650
14905
|
end: new Date(c.event.end),
|
|
@@ -14689,19 +14944,19 @@ function WeekView({
|
|
|
14689
14944
|
);
|
|
14690
14945
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
|
|
14691
14946
|
/* @__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,
|
|
14947
|
+
/* @__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
14948
|
days.map((day) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
14694
14949
|
"div",
|
|
14695
14950
|
{
|
|
14696
14951
|
className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
|
|
14697
|
-
"data-today": (0,
|
|
14952
|
+
"data-today": (0, import_date_fns15.isToday)(day) || void 0,
|
|
14698
14953
|
children: [
|
|
14699
14954
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
|
|
14700
|
-
(0,
|
|
14955
|
+
(0, import_date_fns15.format)(day, "EEE", { locale: import_locale8.ptBR })[0],
|
|
14701
14956
|
" ",
|
|
14702
|
-
(0,
|
|
14957
|
+
(0, import_date_fns15.format)(day, "d", { locale: import_locale8.ptBR })
|
|
14703
14958
|
] }),
|
|
14704
|
-
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0,
|
|
14959
|
+
/* @__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
14960
|
]
|
|
14706
14961
|
},
|
|
14707
14962
|
day.toString()
|
|
@@ -14713,19 +14968,19 @@ function WeekView({
|
|
|
14713
14968
|
const dayAllDayEvents = allDayEvents.filter((event) => {
|
|
14714
14969
|
const eventStart = new Date(event.start);
|
|
14715
14970
|
const eventEnd = new Date(event.end);
|
|
14716
|
-
return (0,
|
|
14971
|
+
return (0, import_date_fns15.isSameDay)(day, eventStart) || day > eventStart && day < eventEnd || (0, import_date_fns15.isSameDay)(day, eventEnd);
|
|
14717
14972
|
});
|
|
14718
14973
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14719
14974
|
"div",
|
|
14720
14975
|
{
|
|
14721
14976
|
className: "relative border-border/70 border-r p-1 last:border-r-0",
|
|
14722
|
-
"data-today": (0,
|
|
14977
|
+
"data-today": (0, import_date_fns15.isToday)(day) || void 0,
|
|
14723
14978
|
children: dayAllDayEvents.map((event) => {
|
|
14724
14979
|
const eventStart = new Date(event.start);
|
|
14725
14980
|
const eventEnd = new Date(event.end);
|
|
14726
|
-
const isFirstDay = (0,
|
|
14727
|
-
const isLastDay = (0,
|
|
14728
|
-
const isFirstVisibleDay = dayIndex === 0 && (0,
|
|
14981
|
+
const isFirstDay = (0, import_date_fns15.isSameDay)(day, eventStart);
|
|
14982
|
+
const isLastDay = (0, import_date_fns15.isSameDay)(day, eventEnd);
|
|
14983
|
+
const isFirstVisibleDay = dayIndex === 0 && (0, import_date_fns15.isBefore)(eventStart, weekStart);
|
|
14729
14984
|
const shouldShowTitle = isFirstDay || isFirstVisibleDay;
|
|
14730
14985
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14731
14986
|
EventItem,
|
|
@@ -14760,7 +15015,7 @@ function WeekView({
|
|
|
14760
15015
|
"div",
|
|
14761
15016
|
{
|
|
14762
15017
|
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,
|
|
15018
|
+
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
15019
|
},
|
|
14765
15020
|
hour.toString()
|
|
14766
15021
|
)) }),
|
|
@@ -14768,7 +15023,7 @@ function WeekView({
|
|
|
14768
15023
|
"div",
|
|
14769
15024
|
{
|
|
14770
15025
|
className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
|
|
14771
|
-
"data-today": (0,
|
|
15026
|
+
"data-today": (0, import_date_fns15.isToday)(day) || void 0,
|
|
14772
15027
|
children: [
|
|
14773
15028
|
(processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14774
15029
|
"div",
|
|
@@ -14795,7 +15050,7 @@ function WeekView({
|
|
|
14795
15050
|
},
|
|
14796
15051
|
positionedEvent.event.id
|
|
14797
15052
|
)),
|
|
14798
|
-
currentTimeVisible && (0,
|
|
15053
|
+
currentTimeVisible && (0, import_date_fns15.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14799
15054
|
"div",
|
|
14800
15055
|
{
|
|
14801
15056
|
className: "pointer-events-none absolute right-0 left-0 z-20",
|
|
@@ -14807,7 +15062,7 @@ function WeekView({
|
|
|
14807
15062
|
}
|
|
14808
15063
|
),
|
|
14809
15064
|
hours.map((hour) => {
|
|
14810
|
-
const hourValue = (0,
|
|
15065
|
+
const hourValue = (0, import_date_fns15.getHours)(hour);
|
|
14811
15066
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14812
15067
|
"div",
|
|
14813
15068
|
{
|
|
@@ -14999,14 +15254,328 @@ function CheckboxTree({ tree, renderNode }) {
|
|
|
14999
15254
|
return renderTreeNode(tree);
|
|
15000
15255
|
}
|
|
15001
15256
|
|
|
15257
|
+
// src/components/selects/MultiSelectBase.tsx
|
|
15258
|
+
var import_react70 = require("@phosphor-icons/react");
|
|
15259
|
+
var import_react71 = require("react");
|
|
15260
|
+
var import_framer_motion20 = require("framer-motion");
|
|
15261
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
15262
|
+
var MultiSelectContext = (0, import_react71.createContext)(null);
|
|
15263
|
+
function MultiSelectBase({
|
|
15264
|
+
children,
|
|
15265
|
+
values,
|
|
15266
|
+
defaultValues,
|
|
15267
|
+
onValuesChange,
|
|
15268
|
+
disabled,
|
|
15269
|
+
empty,
|
|
15270
|
+
error
|
|
15271
|
+
}) {
|
|
15272
|
+
const [open, setOpen] = (0, import_react71.useState)(false);
|
|
15273
|
+
const [internalValues, setInternalValues] = (0, import_react71.useState)(
|
|
15274
|
+
new Set(values ?? defaultValues)
|
|
15275
|
+
);
|
|
15276
|
+
const selectedValues = values ? new Set(values) : internalValues;
|
|
15277
|
+
const [items, setItems] = (0, import_react71.useState)(/* @__PURE__ */ new Map());
|
|
15278
|
+
function toggleValue(value) {
|
|
15279
|
+
if (disabled) return;
|
|
15280
|
+
const getNewSet = (prev) => {
|
|
15281
|
+
const newSet = new Set(prev);
|
|
15282
|
+
if (newSet.has(value)) {
|
|
15283
|
+
newSet.delete(value);
|
|
15284
|
+
} else {
|
|
15285
|
+
newSet.add(value);
|
|
15286
|
+
}
|
|
15287
|
+
return newSet;
|
|
15288
|
+
};
|
|
15289
|
+
setInternalValues(getNewSet);
|
|
15290
|
+
onValuesChange?.([...getNewSet(selectedValues)]);
|
|
15291
|
+
}
|
|
15292
|
+
const onItemAdded = (0, import_react71.useCallback)((value, label) => {
|
|
15293
|
+
setItems((prev) => {
|
|
15294
|
+
if (prev.get(value) === label) return prev;
|
|
15295
|
+
return new Map(prev).set(value, label);
|
|
15296
|
+
});
|
|
15297
|
+
}, []);
|
|
15298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15299
|
+
MultiSelectContext.Provider,
|
|
15300
|
+
{
|
|
15301
|
+
value: {
|
|
15302
|
+
open,
|
|
15303
|
+
setOpen,
|
|
15304
|
+
selectedValues,
|
|
15305
|
+
toggleValue,
|
|
15306
|
+
items,
|
|
15307
|
+
onItemAdded,
|
|
15308
|
+
disabled,
|
|
15309
|
+
emptyMessage: empty,
|
|
15310
|
+
error
|
|
15311
|
+
},
|
|
15312
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15313
|
+
PopoverBase,
|
|
15314
|
+
{
|
|
15315
|
+
open,
|
|
15316
|
+
onOpenChange: (v) => !disabled && setOpen(v),
|
|
15317
|
+
modal: true,
|
|
15318
|
+
children
|
|
15319
|
+
}
|
|
15320
|
+
)
|
|
15321
|
+
}
|
|
15322
|
+
);
|
|
15323
|
+
}
|
|
15324
|
+
function MultiSelectTriggerBase({
|
|
15325
|
+
className,
|
|
15326
|
+
children,
|
|
15327
|
+
error: propError,
|
|
15328
|
+
...props
|
|
15329
|
+
}) {
|
|
15330
|
+
const { open, disabled, error: contextError } = useMultiSelectContext();
|
|
15331
|
+
const error = propError ?? contextError;
|
|
15332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: cn("w-full", error && "mb-0"), children: [
|
|
15333
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15334
|
+
ButtonBase,
|
|
15335
|
+
{
|
|
15336
|
+
...props,
|
|
15337
|
+
variant: props.variant ?? "outline",
|
|
15338
|
+
role: props.role ?? "combobox",
|
|
15339
|
+
"aria-expanded": props["aria-expanded"] ?? open,
|
|
15340
|
+
"aria-disabled": disabled || void 0,
|
|
15341
|
+
disabled,
|
|
15342
|
+
className: cn(
|
|
15343
|
+
"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]",
|
|
15344
|
+
error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring",
|
|
15345
|
+
className
|
|
15346
|
+
),
|
|
15347
|
+
children: [
|
|
15348
|
+
children,
|
|
15349
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
|
|
15350
|
+
]
|
|
15351
|
+
}
|
|
15352
|
+
) }),
|
|
15353
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ErrorMessage_default, { error }) : null
|
|
15354
|
+
] });
|
|
15355
|
+
}
|
|
15356
|
+
function MultiSelectValueBase({
|
|
15357
|
+
placeholder,
|
|
15358
|
+
clickToRemove = true,
|
|
15359
|
+
className,
|
|
15360
|
+
overflowBehavior = "wrap-when-open",
|
|
15361
|
+
...props
|
|
15362
|
+
}) {
|
|
15363
|
+
const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
|
|
15364
|
+
const [overflowAmount, setOverflowAmount] = (0, import_react71.useState)(0);
|
|
15365
|
+
const valueRef = (0, import_react71.useRef)(null);
|
|
15366
|
+
const overflowRef = (0, import_react71.useRef)(null);
|
|
15367
|
+
const mutationObserverRef = (0, import_react71.useRef)(null);
|
|
15368
|
+
const resizeObserverRef = (0, import_react71.useRef)(null);
|
|
15369
|
+
const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
|
|
15370
|
+
const checkOverflow = (0, import_react71.useCallback)(() => {
|
|
15371
|
+
if (valueRef.current == null) return;
|
|
15372
|
+
const containerElement = valueRef.current;
|
|
15373
|
+
const overflowElement = overflowRef.current;
|
|
15374
|
+
const items2 = containerElement.querySelectorAll(
|
|
15375
|
+
"[data-selected-item]"
|
|
15376
|
+
);
|
|
15377
|
+
if (overflowElement != null) overflowElement.style.display = "none";
|
|
15378
|
+
items2.forEach((child) => child.style.removeProperty("display"));
|
|
15379
|
+
let amount = 0;
|
|
15380
|
+
for (let i = items2.length - 1; i >= 0; i--) {
|
|
15381
|
+
const child = items2[i];
|
|
15382
|
+
if (containerElement.scrollWidth <= containerElement.clientWidth) {
|
|
15383
|
+
break;
|
|
15384
|
+
}
|
|
15385
|
+
amount = items2.length - i;
|
|
15386
|
+
child.style.display = "none";
|
|
15387
|
+
overflowElement?.style.removeProperty("display");
|
|
15388
|
+
}
|
|
15389
|
+
setOverflowAmount(amount);
|
|
15390
|
+
}, []);
|
|
15391
|
+
const handleResize = (0, import_react71.useCallback)(
|
|
15392
|
+
(node) => {
|
|
15393
|
+
if (node == null) {
|
|
15394
|
+
valueRef.current = null;
|
|
15395
|
+
if (resizeObserverRef.current) {
|
|
15396
|
+
resizeObserverRef.current.disconnect();
|
|
15397
|
+
resizeObserverRef.current = null;
|
|
15398
|
+
}
|
|
15399
|
+
if (mutationObserverRef.current) {
|
|
15400
|
+
mutationObserverRef.current.disconnect();
|
|
15401
|
+
mutationObserverRef.current = null;
|
|
15402
|
+
}
|
|
15403
|
+
return;
|
|
15404
|
+
}
|
|
15405
|
+
valueRef.current = node;
|
|
15406
|
+
if (resizeObserverRef.current) {
|
|
15407
|
+
resizeObserverRef.current.disconnect();
|
|
15408
|
+
resizeObserverRef.current = null;
|
|
15409
|
+
}
|
|
15410
|
+
if (mutationObserverRef.current) {
|
|
15411
|
+
mutationObserverRef.current.disconnect();
|
|
15412
|
+
mutationObserverRef.current = null;
|
|
15413
|
+
}
|
|
15414
|
+
const mo = new MutationObserver(checkOverflow);
|
|
15415
|
+
const ro = new ResizeObserver(debounce(checkOverflow, 100));
|
|
15416
|
+
mutationObserverRef.current = mo;
|
|
15417
|
+
resizeObserverRef.current = ro;
|
|
15418
|
+
mo.observe(node, {
|
|
15419
|
+
childList: true,
|
|
15420
|
+
attributes: true,
|
|
15421
|
+
attributeFilter: ["class", "style"]
|
|
15422
|
+
});
|
|
15423
|
+
ro.observe(node);
|
|
15424
|
+
checkOverflow();
|
|
15425
|
+
},
|
|
15426
|
+
[checkOverflow]
|
|
15427
|
+
);
|
|
15428
|
+
if (selectedValues.size === 0 && placeholder) {
|
|
15429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "min-w-0 overflow-hidden font-normal text-muted-foreground ", children: placeholder });
|
|
15430
|
+
}
|
|
15431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15432
|
+
"div",
|
|
15433
|
+
{
|
|
15434
|
+
...props,
|
|
15435
|
+
ref: handleResize,
|
|
15436
|
+
className: cn(
|
|
15437
|
+
"flex w-full gap-1.5 overflow-hidden",
|
|
15438
|
+
shouldWrap && "h-full flex-wrap",
|
|
15439
|
+
className
|
|
15440
|
+
),
|
|
15441
|
+
children: [
|
|
15442
|
+
[...selectedValues].filter((value) => items.has(value)).map((value) => /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15443
|
+
Badge,
|
|
15444
|
+
{
|
|
15445
|
+
"data-selected-item": true,
|
|
15446
|
+
size: "sm",
|
|
15447
|
+
className: "group flex items-center gap-1",
|
|
15448
|
+
onClick: clickToRemove ? (e) => {
|
|
15449
|
+
e.stopPropagation();
|
|
15450
|
+
toggleValue(value);
|
|
15451
|
+
} : void 0,
|
|
15452
|
+
children: [
|
|
15453
|
+
items.get(value),
|
|
15454
|
+
clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.XIcon, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
|
|
15455
|
+
]
|
|
15456
|
+
},
|
|
15457
|
+
value
|
|
15458
|
+
)),
|
|
15459
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15460
|
+
Badge,
|
|
15461
|
+
{
|
|
15462
|
+
style: {
|
|
15463
|
+
display: overflowAmount > 0 && !shouldWrap ? "block" : "none"
|
|
15464
|
+
},
|
|
15465
|
+
ref: overflowRef,
|
|
15466
|
+
children: [
|
|
15467
|
+
"+",
|
|
15468
|
+
overflowAmount
|
|
15469
|
+
]
|
|
15470
|
+
}
|
|
15471
|
+
)
|
|
15472
|
+
]
|
|
15473
|
+
}
|
|
15474
|
+
);
|
|
15475
|
+
}
|
|
15476
|
+
function MultiSelectContentBase({
|
|
15477
|
+
search = true,
|
|
15478
|
+
children,
|
|
15479
|
+
...props
|
|
15480
|
+
}) {
|
|
15481
|
+
const canSearch = typeof search === "object" ? true : search;
|
|
15482
|
+
const { emptyMessage } = useMultiSelectContext();
|
|
15483
|
+
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)(
|
|
15484
|
+
import_framer_motion20.motion.div,
|
|
15485
|
+
{
|
|
15486
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
15487
|
+
animate: { opacity: 1, scale: 1 },
|
|
15488
|
+
exit: { opacity: 0, scale: 0.95 },
|
|
15489
|
+
transition: { duration: 0.2 },
|
|
15490
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(CommandBase, { ...props, children: [
|
|
15491
|
+
canSearch ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15492
|
+
CommandInputBase,
|
|
15493
|
+
{
|
|
15494
|
+
placeholder: typeof search === "object" ? search.placeholder : void 0
|
|
15495
|
+
}
|
|
15496
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { autoFocus: true, className: "sr-only" }),
|
|
15497
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(CommandListBase, { children: [
|
|
15498
|
+
canSearch && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
|
|
15499
|
+
children
|
|
15500
|
+
] })
|
|
15501
|
+
] }) })
|
|
15502
|
+
}
|
|
15503
|
+
) }) });
|
|
15504
|
+
}
|
|
15505
|
+
function MultiSelectItemBase({
|
|
15506
|
+
value,
|
|
15507
|
+
children,
|
|
15508
|
+
badgeLabel,
|
|
15509
|
+
onSelect,
|
|
15510
|
+
...props
|
|
15511
|
+
}) {
|
|
15512
|
+
const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
|
|
15513
|
+
const isSelected = selectedValues.has(value);
|
|
15514
|
+
(0, import_react71.useEffect)(() => {
|
|
15515
|
+
onItemAdded(value, badgeLabel ?? children);
|
|
15516
|
+
}, [value, children, onItemAdded, badgeLabel]);
|
|
15517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15518
|
+
CommandItemBase,
|
|
15519
|
+
{
|
|
15520
|
+
...props,
|
|
15521
|
+
onSelect: () => {
|
|
15522
|
+
toggleValue(value);
|
|
15523
|
+
onSelect?.(value);
|
|
15524
|
+
},
|
|
15525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15526
|
+
import_framer_motion20.motion.div,
|
|
15527
|
+
{
|
|
15528
|
+
whileHover: { scale: 1.02 },
|
|
15529
|
+
whileTap: { scale: 0.98 },
|
|
15530
|
+
transition: { duration: 0.1 },
|
|
15531
|
+
children: [
|
|
15532
|
+
/* @__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)(
|
|
15533
|
+
import_framer_motion20.motion.div,
|
|
15534
|
+
{
|
|
15535
|
+
initial: { scale: 0 },
|
|
15536
|
+
animate: { scale: isSelected ? 1 : 0 },
|
|
15537
|
+
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
15538
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.CheckIcon, { className: "size-4" })
|
|
15539
|
+
}
|
|
15540
|
+
) }),
|
|
15541
|
+
children
|
|
15542
|
+
]
|
|
15543
|
+
}
|
|
15544
|
+
)
|
|
15545
|
+
}
|
|
15546
|
+
);
|
|
15547
|
+
}
|
|
15548
|
+
function MultiSelectGroupBase(props) {
|
|
15549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandGroupBase, { ...props });
|
|
15550
|
+
}
|
|
15551
|
+
function MultiSelectSeparatorBase(props) {
|
|
15552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandSeparatorBase, { ...props });
|
|
15553
|
+
}
|
|
15554
|
+
function useMultiSelectContext() {
|
|
15555
|
+
const context = (0, import_react71.useContext)(MultiSelectContext);
|
|
15556
|
+
if (context == null) {
|
|
15557
|
+
throw new Error(
|
|
15558
|
+
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
15559
|
+
);
|
|
15560
|
+
}
|
|
15561
|
+
return context;
|
|
15562
|
+
}
|
|
15563
|
+
function debounce(func, wait) {
|
|
15564
|
+
let timeout = null;
|
|
15565
|
+
return function(...args) {
|
|
15566
|
+
if (timeout) clearTimeout(timeout);
|
|
15567
|
+
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
15568
|
+
};
|
|
15569
|
+
}
|
|
15570
|
+
|
|
15002
15571
|
// src/hooks/use-drag.tsx
|
|
15003
|
-
var
|
|
15572
|
+
var import_react72 = require("react");
|
|
15004
15573
|
var useDrag = (options = {}) => {
|
|
15005
|
-
const [isDragging, setIsDragging] = (0,
|
|
15006
|
-
const [positions, setPositions] = (0,
|
|
15007
|
-
const dragStartPos = (0,
|
|
15008
|
-
const dragId = (0,
|
|
15009
|
-
const handleMouseDown = (0,
|
|
15574
|
+
const [isDragging, setIsDragging] = (0, import_react72.useState)(null);
|
|
15575
|
+
const [positions, setPositions] = (0, import_react72.useState)({});
|
|
15576
|
+
const dragStartPos = (0, import_react72.useRef)(null);
|
|
15577
|
+
const dragId = (0, import_react72.useRef)(null);
|
|
15578
|
+
const handleMouseDown = (0, import_react72.useCallback)((id, e) => {
|
|
15010
15579
|
e.preventDefault();
|
|
15011
15580
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
15012
15581
|
dragStartPos.current = {
|
|
@@ -15019,7 +15588,7 @@ var useDrag = (options = {}) => {
|
|
|
15019
15588
|
setIsDragging(id);
|
|
15020
15589
|
options.onDragStart?.(id);
|
|
15021
15590
|
}, [positions, options]);
|
|
15022
|
-
const handleMouseMove = (0,
|
|
15591
|
+
const handleMouseMove = (0, import_react72.useCallback)((e) => {
|
|
15023
15592
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
15024
15593
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
15025
15594
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -15035,7 +15604,7 @@ var useDrag = (options = {}) => {
|
|
|
15035
15604
|
}));
|
|
15036
15605
|
options.onDrag?.(dragId.current, newPosition);
|
|
15037
15606
|
}, [isDragging, options]);
|
|
15038
|
-
const handleMouseUp = (0,
|
|
15607
|
+
const handleMouseUp = (0, import_react72.useCallback)(() => {
|
|
15039
15608
|
if (dragId.current) {
|
|
15040
15609
|
options.onDragEnd?.(dragId.current);
|
|
15041
15610
|
}
|
|
@@ -15043,7 +15612,7 @@ var useDrag = (options = {}) => {
|
|
|
15043
15612
|
dragStartPos.current = null;
|
|
15044
15613
|
dragId.current = null;
|
|
15045
15614
|
}, [options]);
|
|
15046
|
-
(0,
|
|
15615
|
+
(0, import_react72.useEffect)(() => {
|
|
15047
15616
|
if (isDragging) {
|
|
15048
15617
|
document.addEventListener("mousemove", handleMouseMove);
|
|
15049
15618
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -15055,16 +15624,16 @@ var useDrag = (options = {}) => {
|
|
|
15055
15624
|
};
|
|
15056
15625
|
}
|
|
15057
15626
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
15058
|
-
const setPosition = (0,
|
|
15627
|
+
const setPosition = (0, import_react72.useCallback)((id, position) => {
|
|
15059
15628
|
setPositions((prev) => ({
|
|
15060
15629
|
...prev,
|
|
15061
15630
|
[id]: position
|
|
15062
15631
|
}));
|
|
15063
15632
|
}, []);
|
|
15064
|
-
const getPosition = (0,
|
|
15633
|
+
const getPosition = (0, import_react72.useCallback)((id) => {
|
|
15065
15634
|
return positions[id] || { top: 0, left: 0 };
|
|
15066
15635
|
}, [positions]);
|
|
15067
|
-
const isElementDragging = (0,
|
|
15636
|
+
const isElementDragging = (0, import_react72.useCallback)((id) => {
|
|
15068
15637
|
return isDragging === id;
|
|
15069
15638
|
}, [isDragging]);
|
|
15070
15639
|
return {
|