@mlw-packages/react-components 1.7.16 → 1.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +64 -3
- package/dist/index.d.mts +41 -12
- package/dist/index.d.ts +41 -12
- package/dist/index.js +1165 -599
- package/dist/index.mjs +1112 -537
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2429,7 +2429,7 @@ var Highlights = ({
|
|
|
2429
2429
|
const label = mapperConfig[k]?.label ?? k;
|
|
2430
2430
|
const color = finalColors[k];
|
|
2431
2431
|
const pillClasses = cn(
|
|
2432
|
-
"inline-flex items-center gap-2 px-
|
|
2432
|
+
"inline-flex items-center gap-2 px-2 rounded-lg text-xs border transition-all select-none relative overflow-hidden h-7",
|
|
2433
2433
|
isHighlighted ? "pr-8" : "",
|
|
2434
2434
|
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"
|
|
2435
2435
|
);
|
|
@@ -2464,7 +2464,7 @@ var Highlights = ({
|
|
|
2464
2464
|
style: {
|
|
2465
2465
|
backgroundColor: color,
|
|
2466
2466
|
borderColor: isHighlighted ? color : "transparent",
|
|
2467
|
-
boxShadow: isHighlighted ? `0 6px
|
|
2467
|
+
boxShadow: isHighlighted ? `0 6px 10px ${color}33` : void 0
|
|
2468
2468
|
},
|
|
2469
2469
|
layout: true,
|
|
2470
2470
|
initial: { scale: 0.8, opacity: 0.9 },
|
|
@@ -2479,7 +2479,7 @@ var Highlights = ({
|
|
|
2479
2479
|
showFullLabel ? /* @__PURE__ */ jsx22(
|
|
2480
2480
|
motion8.span,
|
|
2481
2481
|
{
|
|
2482
|
-
className: "truncate max-w-[10rem]
|
|
2482
|
+
className: "truncate max-w-[10rem] mt-0.5",
|
|
2483
2483
|
layout: true,
|
|
2484
2484
|
children: label
|
|
2485
2485
|
}
|
|
@@ -3650,13 +3650,27 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
3650
3650
|
} else {
|
|
3651
3651
|
centerY = 0;
|
|
3652
3652
|
}
|
|
3653
|
+
const baseFontSize = 10;
|
|
3654
|
+
let fontSize = baseFontSize;
|
|
3655
|
+
if (typeof pWidth === "number") {
|
|
3656
|
+
const padding = 7;
|
|
3657
|
+
const approxCharWidth = 7;
|
|
3658
|
+
const requiredWidth = String(text).length * approxCharWidth + padding * 2;
|
|
3659
|
+
const widthScale = Math.min(1, pWidth / Math.max(1, requiredWidth));
|
|
3660
|
+
fontSize = Math.max(1, Math.round(baseFontSize * widthScale));
|
|
3661
|
+
}
|
|
3662
|
+
if (typeof pHeight === "number") {
|
|
3663
|
+
const heightRef = 14;
|
|
3664
|
+
const heightFactor = Math.max(0.8, Math.min(1.6, pHeight / heightRef));
|
|
3665
|
+
fontSize = Math.min(18, Math.max(8, Math.round(fontSize * heightFactor)));
|
|
3666
|
+
}
|
|
3653
3667
|
return /* @__PURE__ */ jsx27(
|
|
3654
3668
|
"text",
|
|
3655
3669
|
{
|
|
3656
3670
|
x: centerX,
|
|
3657
3671
|
y: centerY,
|
|
3658
3672
|
fill: "#ffffff",
|
|
3659
|
-
fontSize
|
|
3673
|
+
fontSize,
|
|
3660
3674
|
fontWeight: 700,
|
|
3661
3675
|
textAnchor: "middle",
|
|
3662
3676
|
dominantBaseline: "central",
|
|
@@ -3667,8 +3681,146 @@ var renderInsideBarLabel = (color, valueFormatter2) => {
|
|
|
3667
3681
|
};
|
|
3668
3682
|
};
|
|
3669
3683
|
|
|
3670
|
-
// src/components/charts/
|
|
3684
|
+
// src/components/charts/NoData.tsx
|
|
3671
3685
|
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3686
|
+
var NoData = ({
|
|
3687
|
+
paddingLeft = 0,
|
|
3688
|
+
height = 360,
|
|
3689
|
+
message = "Sem dados para exibir",
|
|
3690
|
+
className
|
|
3691
|
+
}) => {
|
|
3692
|
+
const svgHeight = typeof height === "number" ? height : 360;
|
|
3693
|
+
const bars = [
|
|
3694
|
+
{ x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
|
|
3695
|
+
{ x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
|
|
3696
|
+
{ x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
|
|
3697
|
+
{ x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
|
|
3698
|
+
{ x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
|
|
3699
|
+
];
|
|
3700
|
+
const styleVars = {
|
|
3701
|
+
["--pl"]: `${paddingLeft}px`,
|
|
3702
|
+
["--svg-h"]: typeof height === "number" ? `${height}px` : String(height)
|
|
3703
|
+
};
|
|
3704
|
+
return /* @__PURE__ */ jsx28(
|
|
3705
|
+
"div",
|
|
3706
|
+
{
|
|
3707
|
+
className: cn(
|
|
3708
|
+
"rounded-lg bg-card p-3 relative overflow-visible w-full",
|
|
3709
|
+
className
|
|
3710
|
+
),
|
|
3711
|
+
style: styleVars,
|
|
3712
|
+
role: "img",
|
|
3713
|
+
"aria-label": message,
|
|
3714
|
+
children: /* @__PURE__ */ jsx28("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs23("div", { className: "w-full max-w-[900px] relative", children: [
|
|
3715
|
+
/* @__PURE__ */ jsxs23(
|
|
3716
|
+
"svg",
|
|
3717
|
+
{
|
|
3718
|
+
className: "w-full h-[var(--svg-h)]",
|
|
3719
|
+
width: "100%",
|
|
3720
|
+
viewBox: `0 0 900 ${svgHeight}`,
|
|
3721
|
+
preserveAspectRatio: "none",
|
|
3722
|
+
children: [
|
|
3723
|
+
/* @__PURE__ */ jsxs23("defs", { children: [
|
|
3724
|
+
/* @__PURE__ */ jsxs23("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
|
|
3725
|
+
/* @__PURE__ */ jsx28("stop", { offset: "0%", stopColor: "#60a5fa", stopOpacity: "0.95" }),
|
|
3726
|
+
"= "
|
|
3727
|
+
] }),
|
|
3728
|
+
/* @__PURE__ */ jsx28(
|
|
3729
|
+
"filter",
|
|
3730
|
+
{
|
|
3731
|
+
id: "softShadow",
|
|
3732
|
+
x: "-20%",
|
|
3733
|
+
y: "-20%",
|
|
3734
|
+
width: "140%",
|
|
3735
|
+
height: "140%",
|
|
3736
|
+
children: /* @__PURE__ */ jsx28(
|
|
3737
|
+
"feDropShadow",
|
|
3738
|
+
{
|
|
3739
|
+
dx: "0",
|
|
3740
|
+
dy: "6",
|
|
3741
|
+
stdDeviation: "8",
|
|
3742
|
+
floodColor: "#0f172a",
|
|
3743
|
+
floodOpacity: "0.06"
|
|
3744
|
+
}
|
|
3745
|
+
)
|
|
3746
|
+
}
|
|
3747
|
+
)
|
|
3748
|
+
] }),
|
|
3749
|
+
/* @__PURE__ */ jsx28(
|
|
3750
|
+
"rect",
|
|
3751
|
+
{
|
|
3752
|
+
x: 0,
|
|
3753
|
+
y: 0,
|
|
3754
|
+
width: 900,
|
|
3755
|
+
height: svgHeight,
|
|
3756
|
+
fill: "transparent"
|
|
3757
|
+
}
|
|
3758
|
+
),
|
|
3759
|
+
Array.from({ length: 5 }).map((_, i) => {
|
|
3760
|
+
const y = 40 + (svgHeight - 80) / 4 * i;
|
|
3761
|
+
return /* @__PURE__ */ jsx28(
|
|
3762
|
+
"line",
|
|
3763
|
+
{
|
|
3764
|
+
x1: 60,
|
|
3765
|
+
x2: 840,
|
|
3766
|
+
y1: y,
|
|
3767
|
+
y2: y,
|
|
3768
|
+
stroke: "rgba(15,23,42,0.06)",
|
|
3769
|
+
strokeWidth: 1
|
|
3770
|
+
},
|
|
3771
|
+
`g-${i}`
|
|
3772
|
+
);
|
|
3773
|
+
}),
|
|
3774
|
+
bars.map((b, i) => /* @__PURE__ */ jsxs23("g", { children: [
|
|
3775
|
+
/* @__PURE__ */ jsx28(
|
|
3776
|
+
"rect",
|
|
3777
|
+
{
|
|
3778
|
+
x: b.x,
|
|
3779
|
+
y: svgHeight - 60 - b.h,
|
|
3780
|
+
width: b.w,
|
|
3781
|
+
height: b.h,
|
|
3782
|
+
rx: 8,
|
|
3783
|
+
fill: "url(#barGradient)",
|
|
3784
|
+
filter: "url(#softShadow)",
|
|
3785
|
+
opacity: 0.95
|
|
3786
|
+
}
|
|
3787
|
+
),
|
|
3788
|
+
/* @__PURE__ */ jsx28(
|
|
3789
|
+
"rect",
|
|
3790
|
+
{
|
|
3791
|
+
x: b.x,
|
|
3792
|
+
y: svgHeight - 60 - b.h,
|
|
3793
|
+
width: b.w,
|
|
3794
|
+
height: b.h,
|
|
3795
|
+
rx: 8,
|
|
3796
|
+
fill: "none",
|
|
3797
|
+
stroke: "rgba(15,23,42,0.06)"
|
|
3798
|
+
}
|
|
3799
|
+
),
|
|
3800
|
+
/* @__PURE__ */ jsx28(
|
|
3801
|
+
"text",
|
|
3802
|
+
{
|
|
3803
|
+
x: b.x + b.w / 2,
|
|
3804
|
+
y: svgHeight - 20,
|
|
3805
|
+
fill: "rgba(15,23,42,0.45)",
|
|
3806
|
+
fontSize: 12,
|
|
3807
|
+
textAnchor: "middle",
|
|
3808
|
+
children: b.label
|
|
3809
|
+
}
|
|
3810
|
+
)
|
|
3811
|
+
] }, `barg-${i}`))
|
|
3812
|
+
]
|
|
3813
|
+
}
|
|
3814
|
+
),
|
|
3815
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ jsx28("div", { className: "pointer-events-auto bg-transparent px-3 text-center", children: /* @__PURE__ */ jsx28("div", { className: "text-2xl sm:text-3xl font-semibold text-black", children: message }) }) })
|
|
3816
|
+
] }) })
|
|
3817
|
+
}
|
|
3818
|
+
);
|
|
3819
|
+
};
|
|
3820
|
+
var NoData_default = NoData;
|
|
3821
|
+
|
|
3822
|
+
// src/components/charts/Chart.tsx
|
|
3823
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3672
3824
|
var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
3673
3825
|
var Chart = ({
|
|
3674
3826
|
data,
|
|
@@ -4007,7 +4159,7 @@ var Chart = ({
|
|
|
4007
4159
|
[]
|
|
4008
4160
|
);
|
|
4009
4161
|
const titleClassName = useMemo5(
|
|
4010
|
-
() => "text-
|
|
4162
|
+
() => "text-[1.4rem] font-semibold text-foreground mb-3",
|
|
4011
4163
|
[]
|
|
4012
4164
|
);
|
|
4013
4165
|
const finalValueFormatter = useMemo5(() => {
|
|
@@ -4078,9 +4230,18 @@ var Chart = ({
|
|
|
4078
4230
|
const defaultChartRightMargin = 30;
|
|
4079
4231
|
const defaultChartLeftMargin = 0;
|
|
4080
4232
|
const axisLabelMargin = 56;
|
|
4081
|
-
const containerPaddingLeft =
|
|
4233
|
+
const containerPaddingLeft = -6;
|
|
4082
4234
|
const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
|
|
4083
4235
|
const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
|
|
4236
|
+
const yAxisTickWidth = useMemo5(() => {
|
|
4237
|
+
if (typeof chartMargin?.left === "number") return chartMargin.left;
|
|
4238
|
+
if (yAxisLabel) return axisLabelMargin;
|
|
4239
|
+
const samples = [minLeftDataValue, niceMaxLeft, Math.round((minLeftDataValue + niceMaxLeft) / 2), 0];
|
|
4240
|
+
const formatted = samples.map((v) => String(yTickFormatter(v)));
|
|
4241
|
+
const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
|
|
4242
|
+
const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
|
|
4243
|
+
return estimated;
|
|
4244
|
+
}, [chartMargin?.left, yAxisLabel, yTickFormatter, minLeftDataValue, niceMaxLeft]);
|
|
4084
4245
|
const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
|
|
4085
4246
|
const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
|
|
4086
4247
|
const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
|
|
@@ -4091,7 +4252,7 @@ var Chart = ({
|
|
|
4091
4252
|
const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
|
|
4092
4253
|
const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
|
|
4093
4254
|
const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
|
|
4094
|
-
const leftYAxisLabelDx = -Math.max(12, Math.round(
|
|
4255
|
+
const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
|
|
4095
4256
|
const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
|
|
4096
4257
|
const openTooltipForPeriod = useCallback5(
|
|
4097
4258
|
(periodName) => {
|
|
@@ -4138,25 +4299,25 @@ var Chart = ({
|
|
|
4138
4299
|
);
|
|
4139
4300
|
if (!data) return null;
|
|
4140
4301
|
if (Array.isArray(data) && data.length === 0) {
|
|
4141
|
-
return /* @__PURE__ */
|
|
4302
|
+
return /* @__PURE__ */ jsx29(
|
|
4142
4303
|
"div",
|
|
4143
4304
|
{
|
|
4144
4305
|
className: cn(
|
|
4145
4306
|
"rounded-lg bg-card p-4 relative w-full text-muted-foreground"
|
|
4146
4307
|
),
|
|
4147
|
-
children: /* @__PURE__ */
|
|
4308
|
+
children: /* @__PURE__ */ jsx29(
|
|
4148
4309
|
"div",
|
|
4149
4310
|
{
|
|
4150
4311
|
style: {
|
|
4151
4312
|
paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
|
|
4152
4313
|
},
|
|
4153
|
-
children:
|
|
4314
|
+
children: /* @__PURE__ */ jsx29(NoData_default, {})
|
|
4154
4315
|
}
|
|
4155
4316
|
)
|
|
4156
4317
|
}
|
|
4157
4318
|
);
|
|
4158
4319
|
}
|
|
4159
|
-
return /* @__PURE__ */
|
|
4320
|
+
return /* @__PURE__ */ jsx29(
|
|
4160
4321
|
"div",
|
|
4161
4322
|
{
|
|
4162
4323
|
ref: wrapperRef,
|
|
@@ -4166,13 +4327,13 @@ var Chart = ({
|
|
|
4166
4327
|
overflowY: "hidden",
|
|
4167
4328
|
minWidth: 0
|
|
4168
4329
|
},
|
|
4169
|
-
children: /* @__PURE__ */
|
|
4330
|
+
children: /* @__PURE__ */ jsxs24(
|
|
4170
4331
|
"div",
|
|
4171
4332
|
{
|
|
4172
|
-
className: cn("rounded-lg bg-card
|
|
4333
|
+
className: cn("rounded-lg bg-card relative", className),
|
|
4173
4334
|
style: { width: "100%", maxWidth: "100%", minWidth: 0 },
|
|
4174
4335
|
children: [
|
|
4175
|
-
title && /* @__PURE__ */
|
|
4336
|
+
title && /* @__PURE__ */ jsx29(
|
|
4176
4337
|
"div",
|
|
4177
4338
|
{
|
|
4178
4339
|
style: {
|
|
@@ -4181,12 +4342,12 @@ var Chart = ({
|
|
|
4181
4342
|
display: "flex",
|
|
4182
4343
|
justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
|
|
4183
4344
|
alignItems: "center",
|
|
4184
|
-
marginTop:
|
|
4345
|
+
marginTop: "19px"
|
|
4185
4346
|
},
|
|
4186
|
-
children: /* @__PURE__ */
|
|
4347
|
+
children: /* @__PURE__ */ jsx29("div", { className: titleClassName, children: title })
|
|
4187
4348
|
}
|
|
4188
4349
|
),
|
|
4189
|
-
allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */
|
|
4350
|
+
allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ jsxs24(
|
|
4190
4351
|
"div",
|
|
4191
4352
|
{
|
|
4192
4353
|
className: "flex items-center w-full",
|
|
@@ -4198,7 +4359,7 @@ var Chart = ({
|
|
|
4198
4359
|
gap: "0.5rem"
|
|
4199
4360
|
},
|
|
4200
4361
|
children: [
|
|
4201
|
-
finalEnableHighlights && /* @__PURE__ */
|
|
4362
|
+
finalEnableHighlights && /* @__PURE__ */ jsx29(
|
|
4202
4363
|
Highlights_default,
|
|
4203
4364
|
{
|
|
4204
4365
|
allKeys,
|
|
@@ -4209,7 +4370,7 @@ var Chart = ({
|
|
|
4209
4370
|
containerWidth: chartInnerWidth
|
|
4210
4371
|
}
|
|
4211
4372
|
),
|
|
4212
|
-
finalEnableShowOnly && /* @__PURE__ */
|
|
4373
|
+
finalEnableShowOnly && /* @__PURE__ */ jsx29(
|
|
4213
4374
|
ShowOnly_default,
|
|
4214
4375
|
{
|
|
4215
4376
|
showOnlyHighlighted,
|
|
@@ -4218,7 +4379,7 @@ var Chart = ({
|
|
|
4218
4379
|
clearHighlights: () => setHighlightedSeries(/* @__PURE__ */ new Set())
|
|
4219
4380
|
}
|
|
4220
4381
|
),
|
|
4221
|
-
finalEnablePeriodsDropdown && /* @__PURE__ */
|
|
4382
|
+
finalEnablePeriodsDropdown && /* @__PURE__ */ jsx29(
|
|
4222
4383
|
"div",
|
|
4223
4384
|
{
|
|
4224
4385
|
style: {
|
|
@@ -4226,7 +4387,7 @@ var Chart = ({
|
|
|
4226
4387
|
display: "flex",
|
|
4227
4388
|
alignItems: "center"
|
|
4228
4389
|
},
|
|
4229
|
-
children: /* @__PURE__ */
|
|
4390
|
+
children: /* @__PURE__ */ jsx29(
|
|
4230
4391
|
PeriodsDropdown_default,
|
|
4231
4392
|
{
|
|
4232
4393
|
processedData,
|
|
@@ -4240,7 +4401,7 @@ var Chart = ({
|
|
|
4240
4401
|
]
|
|
4241
4402
|
}
|
|
4242
4403
|
),
|
|
4243
|
-
!(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */
|
|
4404
|
+
!(allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly)) && finalEnablePeriodsDropdown && /* @__PURE__ */ jsx29(
|
|
4244
4405
|
"div",
|
|
4245
4406
|
{
|
|
4246
4407
|
style: {
|
|
@@ -4251,7 +4412,7 @@ var Chart = ({
|
|
|
4251
4412
|
display: "flex",
|
|
4252
4413
|
justifyContent: "flex-end"
|
|
4253
4414
|
},
|
|
4254
|
-
children: /* @__PURE__ */
|
|
4415
|
+
children: /* @__PURE__ */ jsx29(
|
|
4255
4416
|
PeriodsDropdown_default,
|
|
4256
4417
|
{
|
|
4257
4418
|
processedData,
|
|
@@ -4261,7 +4422,7 @@ var Chart = ({
|
|
|
4261
4422
|
)
|
|
4262
4423
|
}
|
|
4263
4424
|
),
|
|
4264
|
-
/* @__PURE__ */
|
|
4425
|
+
/* @__PURE__ */ jsx29(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs24(
|
|
4265
4426
|
ComposedChart,
|
|
4266
4427
|
{
|
|
4267
4428
|
data: processedData,
|
|
@@ -4274,7 +4435,7 @@ var Chart = ({
|
|
|
4274
4435
|
},
|
|
4275
4436
|
onClick: handleChartClick,
|
|
4276
4437
|
children: [
|
|
4277
|
-
showGrid && /* @__PURE__ */
|
|
4438
|
+
showGrid && /* @__PURE__ */ jsx29(
|
|
4278
4439
|
CartesianGrid,
|
|
4279
4440
|
{
|
|
4280
4441
|
strokeDasharray: "3 3",
|
|
@@ -4282,7 +4443,7 @@ var Chart = ({
|
|
|
4282
4443
|
opacity: 0.5
|
|
4283
4444
|
}
|
|
4284
4445
|
),
|
|
4285
|
-
/* @__PURE__ */
|
|
4446
|
+
/* @__PURE__ */ jsx29(
|
|
4286
4447
|
XAxis,
|
|
4287
4448
|
{
|
|
4288
4449
|
dataKey: xAxisConfig.dataKey,
|
|
@@ -4309,11 +4470,11 @@ var Chart = ({
|
|
|
4309
4470
|
} : void 0
|
|
4310
4471
|
}
|
|
4311
4472
|
),
|
|
4312
|
-
/* @__PURE__ */
|
|
4473
|
+
/* @__PURE__ */ jsx29(
|
|
4313
4474
|
YAxis,
|
|
4314
4475
|
{
|
|
4315
4476
|
yAxisId: "left",
|
|
4316
|
-
width:
|
|
4477
|
+
width: yAxisTickWidth,
|
|
4317
4478
|
stroke: "hsl(var(--muted-foreground))",
|
|
4318
4479
|
fontSize: 12,
|
|
4319
4480
|
tickLine: false,
|
|
@@ -4335,7 +4496,7 @@ var Chart = ({
|
|
|
4335
4496
|
} : void 0
|
|
4336
4497
|
}
|
|
4337
4498
|
),
|
|
4338
|
-
minLeftDataValue < 0 && /* @__PURE__ */
|
|
4499
|
+
minLeftDataValue < 0 && /* @__PURE__ */ jsx29(
|
|
4339
4500
|
ReferenceLine,
|
|
4340
4501
|
{
|
|
4341
4502
|
y: 0,
|
|
@@ -4369,7 +4530,7 @@ var Chart = ({
|
|
|
4369
4530
|
return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
|
|
4370
4531
|
return defaultRightColor;
|
|
4371
4532
|
})();
|
|
4372
|
-
return /* @__PURE__ */
|
|
4533
|
+
return /* @__PURE__ */ jsx29(
|
|
4373
4534
|
YAxis,
|
|
4374
4535
|
{
|
|
4375
4536
|
yAxisId: "right",
|
|
@@ -4398,10 +4559,10 @@ var Chart = ({
|
|
|
4398
4559
|
}
|
|
4399
4560
|
);
|
|
4400
4561
|
})(),
|
|
4401
|
-
showTooltip && /* @__PURE__ */
|
|
4562
|
+
showTooltip && /* @__PURE__ */ jsx29(
|
|
4402
4563
|
Tooltip,
|
|
4403
4564
|
{
|
|
4404
|
-
content: showTooltipTotal ? /* @__PURE__ */
|
|
4565
|
+
content: showTooltipTotal ? /* @__PURE__ */ jsx29(
|
|
4405
4566
|
TooltipWithTotal_default,
|
|
4406
4567
|
{
|
|
4407
4568
|
finalColors,
|
|
@@ -4409,7 +4570,7 @@ var Chart = ({
|
|
|
4409
4570
|
categoryFormatter,
|
|
4410
4571
|
periodLabel
|
|
4411
4572
|
}
|
|
4412
|
-
) : /* @__PURE__ */
|
|
4573
|
+
) : /* @__PURE__ */ jsx29(
|
|
4413
4574
|
TooltipSimple_default,
|
|
4414
4575
|
{
|
|
4415
4576
|
finalColors,
|
|
@@ -4421,7 +4582,7 @@ var Chart = ({
|
|
|
4421
4582
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
4422
4583
|
}
|
|
4423
4584
|
),
|
|
4424
|
-
showLegend && /* @__PURE__ */
|
|
4585
|
+
showLegend && /* @__PURE__ */ jsx29(
|
|
4425
4586
|
Legend,
|
|
4426
4587
|
{
|
|
4427
4588
|
wrapperStyle: {
|
|
@@ -4445,7 +4606,7 @@ var Chart = ({
|
|
|
4445
4606
|
}
|
|
4446
4607
|
}
|
|
4447
4608
|
if (s.type === "bar") {
|
|
4448
|
-
return /* @__PURE__ */
|
|
4609
|
+
return /* @__PURE__ */ jsx29(
|
|
4449
4610
|
Bar,
|
|
4450
4611
|
{
|
|
4451
4612
|
dataKey: key,
|
|
@@ -4458,7 +4619,7 @@ var Chart = ({
|
|
|
4458
4619
|
cursor: "pointer",
|
|
4459
4620
|
opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
|
|
4460
4621
|
},
|
|
4461
|
-
activeBar: /* @__PURE__ */
|
|
4622
|
+
activeBar: /* @__PURE__ */ jsx29(
|
|
4462
4623
|
Rectangle,
|
|
4463
4624
|
{
|
|
4464
4625
|
fill: color,
|
|
@@ -4467,7 +4628,7 @@ var Chart = ({
|
|
|
4467
4628
|
opacity: 0.8
|
|
4468
4629
|
}
|
|
4469
4630
|
),
|
|
4470
|
-
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */
|
|
4631
|
+
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx29(
|
|
4471
4632
|
LabelList,
|
|
4472
4633
|
{
|
|
4473
4634
|
dataKey: key,
|
|
@@ -4484,7 +4645,7 @@ var Chart = ({
|
|
|
4484
4645
|
);
|
|
4485
4646
|
}
|
|
4486
4647
|
if (s.type === "line") {
|
|
4487
|
-
return /* @__PURE__ */
|
|
4648
|
+
return /* @__PURE__ */ jsx29(
|
|
4488
4649
|
Line,
|
|
4489
4650
|
{
|
|
4490
4651
|
dataKey: key,
|
|
@@ -4500,7 +4661,7 @@ var Chart = ({
|
|
|
4500
4661
|
pointerEvents: "all",
|
|
4501
4662
|
opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
|
|
4502
4663
|
},
|
|
4503
|
-
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */
|
|
4664
|
+
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx29(
|
|
4504
4665
|
LabelList,
|
|
4505
4666
|
{
|
|
4506
4667
|
dataKey: key,
|
|
@@ -4518,7 +4679,7 @@ var Chart = ({
|
|
|
4518
4679
|
);
|
|
4519
4680
|
}
|
|
4520
4681
|
if (s.type === "area") {
|
|
4521
|
-
return /* @__PURE__ */
|
|
4682
|
+
return /* @__PURE__ */ jsx29(
|
|
4522
4683
|
Area,
|
|
4523
4684
|
{
|
|
4524
4685
|
dataKey: key,
|
|
@@ -4534,7 +4695,7 @@ var Chart = ({
|
|
|
4534
4695
|
pointerEvents: "all",
|
|
4535
4696
|
opacity: highlightedSeries.size > 0 ? highlightedSeries.has(key) ? 1 : 0.25 : 1
|
|
4536
4697
|
},
|
|
4537
|
-
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */
|
|
4698
|
+
children: showLabels && highlightedSeries.size === 0 || highlightedSeries.has(key) ? /* @__PURE__ */ jsx29(
|
|
4538
4699
|
LabelList,
|
|
4539
4700
|
{
|
|
4540
4701
|
dataKey: key,
|
|
@@ -4556,7 +4717,7 @@ var Chart = ({
|
|
|
4556
4717
|
]
|
|
4557
4718
|
}
|
|
4558
4719
|
) }),
|
|
4559
|
-
enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */
|
|
4720
|
+
enableDraggableTooltips && activeTooltips.map((tooltip) => /* @__PURE__ */ jsx29(
|
|
4560
4721
|
DraggableTooltip_default,
|
|
4561
4722
|
{
|
|
4562
4723
|
id: tooltip.id,
|
|
@@ -4581,7 +4742,7 @@ var Chart = ({
|
|
|
4581
4742
|
},
|
|
4582
4743
|
tooltip.id
|
|
4583
4744
|
)),
|
|
4584
|
-
enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */
|
|
4745
|
+
enableDraggableTooltips && activeTooltips.length > 1 && /* @__PURE__ */ jsx29(
|
|
4585
4746
|
CloseAllButton_default,
|
|
4586
4747
|
{
|
|
4587
4748
|
count: activeTooltips.length,
|
|
@@ -4611,7 +4772,7 @@ import {
|
|
|
4611
4772
|
Legend as Legend2,
|
|
4612
4773
|
LabelList as LabelList2
|
|
4613
4774
|
} from "recharts";
|
|
4614
|
-
import { jsx as
|
|
4775
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4615
4776
|
var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
4616
4777
|
var BarChart = ({
|
|
4617
4778
|
data,
|
|
@@ -5032,25 +5193,25 @@ var BarChart = ({
|
|
|
5032
5193
|
label
|
|
5033
5194
|
}) => {
|
|
5034
5195
|
if (!active || !payload) return null;
|
|
5035
|
-
return /* @__PURE__ */
|
|
5036
|
-
/* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsxs25("div", { className: "bg-card border border-border rounded-lg p-3 shadow-lg", children: [
|
|
5197
|
+
/* @__PURE__ */ jsx30("p", { className: "font-medium text-foreground mb-2", children: label }),
|
|
5037
5198
|
payload.map(
|
|
5038
|
-
(entry, index) => /* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5199
|
+
(entry, index) => /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
5200
|
+
/* @__PURE__ */ jsx30(
|
|
5040
5201
|
"div",
|
|
5041
5202
|
{
|
|
5042
5203
|
className: "w-3 h-3 rounded-sm",
|
|
5043
5204
|
style: { backgroundColor: entry.color }
|
|
5044
5205
|
}
|
|
5045
5206
|
),
|
|
5046
|
-
/* @__PURE__ */
|
|
5207
|
+
/* @__PURE__ */ jsxs25("span", { className: "text-muted-foreground", children: [
|
|
5047
5208
|
entry.name,
|
|
5048
5209
|
":"
|
|
5049
5210
|
] }),
|
|
5050
|
-
/* @__PURE__ */
|
|
5211
|
+
/* @__PURE__ */ jsx30("span", { className: "text-foreground font-medium", children: entry.value?.toLocaleString("pt-BR") })
|
|
5051
5212
|
] }, index)
|
|
5052
5213
|
),
|
|
5053
|
-
/* @__PURE__ */
|
|
5214
|
+
/* @__PURE__ */ jsx30("p", { className: "text-xs text-muted-foreground mt-1", children: "Clique para fixar este tooltip" })
|
|
5054
5215
|
] });
|
|
5055
5216
|
};
|
|
5056
5217
|
const getTitleClassName = (position) => {
|
|
@@ -5064,7 +5225,7 @@ var BarChart = ({
|
|
|
5064
5225
|
return `${baseClasses} text-left`;
|
|
5065
5226
|
}
|
|
5066
5227
|
};
|
|
5067
|
-
return /* @__PURE__ */
|
|
5228
|
+
return /* @__PURE__ */ jsxs25(
|
|
5068
5229
|
"div",
|
|
5069
5230
|
{
|
|
5070
5231
|
className: cn("rounded-lg bg-card p-4 relative", className),
|
|
@@ -5073,8 +5234,8 @@ var BarChart = ({
|
|
|
5073
5234
|
maxWidth: "100%"
|
|
5074
5235
|
},
|
|
5075
5236
|
children: [
|
|
5076
|
-
title && /* @__PURE__ */
|
|
5077
|
-
/* @__PURE__ */
|
|
5237
|
+
title && /* @__PURE__ */ jsx30("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ jsx30("h3", { className: getTitleClassName(titlePosition), children: title }) }),
|
|
5238
|
+
/* @__PURE__ */ jsxs25(
|
|
5078
5239
|
RechartsBarChart,
|
|
5079
5240
|
{
|
|
5080
5241
|
data: processedData,
|
|
@@ -5083,7 +5244,7 @@ var BarChart = ({
|
|
|
5083
5244
|
margin: resolveChartMargins(margins, chartMargins, showLabels),
|
|
5084
5245
|
onClick: handleChartClick,
|
|
5085
5246
|
children: [
|
|
5086
|
-
showGrid && /* @__PURE__ */
|
|
5247
|
+
showGrid && /* @__PURE__ */ jsx30(
|
|
5087
5248
|
CartesianGrid2,
|
|
5088
5249
|
{
|
|
5089
5250
|
strokeDasharray: "3 3",
|
|
@@ -5091,7 +5252,7 @@ var BarChart = ({
|
|
|
5091
5252
|
opacity: 0.5
|
|
5092
5253
|
}
|
|
5093
5254
|
),
|
|
5094
|
-
/* @__PURE__ */
|
|
5255
|
+
/* @__PURE__ */ jsx30(
|
|
5095
5256
|
XAxis2,
|
|
5096
5257
|
{
|
|
5097
5258
|
dataKey: xAxisConfig.dataKey,
|
|
@@ -5102,7 +5263,7 @@ var BarChart = ({
|
|
|
5102
5263
|
tickFormatter: xAxisConfig.valueFormatter
|
|
5103
5264
|
}
|
|
5104
5265
|
),
|
|
5105
|
-
/* @__PURE__ */
|
|
5266
|
+
/* @__PURE__ */ jsx30(
|
|
5106
5267
|
YAxis2,
|
|
5107
5268
|
{
|
|
5108
5269
|
stroke: "hsl(var(--muted-foreground))",
|
|
@@ -5114,14 +5275,14 @@ var BarChart = ({
|
|
|
5114
5275
|
tickCount: 6
|
|
5115
5276
|
}
|
|
5116
5277
|
),
|
|
5117
|
-
showTooltip && /* @__PURE__ */
|
|
5278
|
+
showTooltip && /* @__PURE__ */ jsx30(
|
|
5118
5279
|
Tooltip2,
|
|
5119
5280
|
{
|
|
5120
|
-
content: /* @__PURE__ */
|
|
5281
|
+
content: /* @__PURE__ */ jsx30(CustomTooltip, {}),
|
|
5121
5282
|
cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
|
|
5122
5283
|
}
|
|
5123
5284
|
),
|
|
5124
|
-
showLegend && /* @__PURE__ */
|
|
5285
|
+
showLegend && /* @__PURE__ */ jsx30(
|
|
5125
5286
|
Legend2,
|
|
5126
5287
|
{
|
|
5127
5288
|
wrapperStyle: {
|
|
@@ -5132,7 +5293,7 @@ var BarChart = ({
|
|
|
5132
5293
|
),
|
|
5133
5294
|
dataKeys.map((key) => {
|
|
5134
5295
|
const fieldConfig = mapperConfig[key];
|
|
5135
|
-
return /* @__PURE__ */
|
|
5296
|
+
return /* @__PURE__ */ jsx30(
|
|
5136
5297
|
Bar2,
|
|
5137
5298
|
{
|
|
5138
5299
|
dataKey: key,
|
|
@@ -5141,7 +5302,7 @@ var BarChart = ({
|
|
|
5141
5302
|
radius: [4, 4, 0, 0],
|
|
5142
5303
|
onClick: handleBarClick,
|
|
5143
5304
|
style: { cursor: "pointer" },
|
|
5144
|
-
activeBar: /* @__PURE__ */
|
|
5305
|
+
activeBar: /* @__PURE__ */ jsx30(
|
|
5145
5306
|
Rectangle2,
|
|
5146
5307
|
{
|
|
5147
5308
|
fill: finalColors[key],
|
|
@@ -5150,7 +5311,7 @@ var BarChart = ({
|
|
|
5150
5311
|
opacity: 0.8
|
|
5151
5312
|
}
|
|
5152
5313
|
),
|
|
5153
|
-
children: showLabels && /* @__PURE__ */
|
|
5314
|
+
children: showLabels && /* @__PURE__ */ jsx30(
|
|
5154
5315
|
LabelList2,
|
|
5155
5316
|
{
|
|
5156
5317
|
dataKey: key,
|
|
@@ -5187,8 +5348,8 @@ var BarChart = ({
|
|
|
5187
5348
|
guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
|
|
5188
5349
|
guide.targetTooltip.top + guide.targetTooltip.height / 2
|
|
5189
5350
|
);
|
|
5190
|
-
return /* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5351
|
+
return /* @__PURE__ */ jsxs25("div", { children: [
|
|
5352
|
+
/* @__PURE__ */ jsx30(
|
|
5192
5353
|
"div",
|
|
5193
5354
|
{
|
|
5194
5355
|
className: "fixed pointer-events-none z-30",
|
|
@@ -5207,7 +5368,7 @@ var BarChart = ({
|
|
|
5207
5368
|
}
|
|
5208
5369
|
}
|
|
5209
5370
|
),
|
|
5210
|
-
/* @__PURE__ */
|
|
5371
|
+
/* @__PURE__ */ jsx30(
|
|
5211
5372
|
"div",
|
|
5212
5373
|
{
|
|
5213
5374
|
className: "fixed pointer-events-none z-31",
|
|
@@ -5223,7 +5384,7 @@ var BarChart = ({
|
|
|
5223
5384
|
}
|
|
5224
5385
|
}
|
|
5225
5386
|
),
|
|
5226
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsx30(
|
|
5227
5388
|
"div",
|
|
5228
5389
|
{
|
|
5229
5390
|
className: "fixed pointer-events-none z-31",
|
|
@@ -5241,7 +5402,7 @@ var BarChart = ({
|
|
|
5241
5402
|
)
|
|
5242
5403
|
] }, index);
|
|
5243
5404
|
}),
|
|
5244
|
-
activeTooltips.map((tooltip, index) => /* @__PURE__ */
|
|
5405
|
+
activeTooltips.map((tooltip, index) => /* @__PURE__ */ jsx30(
|
|
5245
5406
|
DraggableTooltip_default,
|
|
5246
5407
|
{
|
|
5247
5408
|
id: tooltip.id,
|
|
@@ -5285,7 +5446,7 @@ import {
|
|
|
5285
5446
|
Legend as Legend3,
|
|
5286
5447
|
LabelList as LabelList3
|
|
5287
5448
|
} from "recharts";
|
|
5288
|
-
import { jsx as
|
|
5449
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
5289
5450
|
var defaultData = [
|
|
5290
5451
|
{ name: "A", value: 100 },
|
|
5291
5452
|
{ name: "B", value: 200 },
|
|
@@ -5384,7 +5545,7 @@ var CustomLineChart = ({
|
|
|
5384
5545
|
setActiveTooltips((prev) => [...prev, newTooltip]);
|
|
5385
5546
|
}
|
|
5386
5547
|
};
|
|
5387
|
-
return /* @__PURE__ */
|
|
5548
|
+
return /* @__PURE__ */ jsx31(
|
|
5388
5549
|
"circle",
|
|
5389
5550
|
{
|
|
5390
5551
|
cx,
|
|
@@ -5667,7 +5828,7 @@ var CustomLineChart = ({
|
|
|
5667
5828
|
return "text-left";
|
|
5668
5829
|
}
|
|
5669
5830
|
};
|
|
5670
|
-
return /* @__PURE__ */
|
|
5831
|
+
return /* @__PURE__ */ jsx31("div", { className: cn("relative", className), children: /* @__PURE__ */ jsxs26(
|
|
5671
5832
|
"div",
|
|
5672
5833
|
{
|
|
5673
5834
|
className: "rounded-lg bg-card p-4 relative border border-border",
|
|
@@ -5677,8 +5838,8 @@ var CustomLineChart = ({
|
|
|
5677
5838
|
},
|
|
5678
5839
|
onClick: handleChartBackgroundClick,
|
|
5679
5840
|
children: [
|
|
5680
|
-
title && /* @__PURE__ */
|
|
5681
|
-
/* @__PURE__ */
|
|
5841
|
+
title && /* @__PURE__ */ jsx31("div", { style: { paddingLeft: `${resolvedContainerPaddingLeft}px` }, children: /* @__PURE__ */ jsx31("div", { className: cn("mb-4", getTitleClass()), children: /* @__PURE__ */ jsx31("h3", { className: "text-lg font-semibold text-foreground", children: title }) }) }),
|
|
5842
|
+
/* @__PURE__ */ jsxs26(
|
|
5682
5843
|
RechartsLineChart,
|
|
5683
5844
|
{
|
|
5684
5845
|
data,
|
|
@@ -5687,7 +5848,7 @@ var CustomLineChart = ({
|
|
|
5687
5848
|
margin: resolveChartMargins(margins, chartMargins, showLabels),
|
|
5688
5849
|
onClick: handleChartClick,
|
|
5689
5850
|
children: [
|
|
5690
|
-
showGrid && /* @__PURE__ */
|
|
5851
|
+
showGrid && /* @__PURE__ */ jsx31(
|
|
5691
5852
|
CartesianGrid3,
|
|
5692
5853
|
{
|
|
5693
5854
|
strokeDasharray: "3 3",
|
|
@@ -5695,7 +5856,7 @@ var CustomLineChart = ({
|
|
|
5695
5856
|
opacity: 0.3
|
|
5696
5857
|
}
|
|
5697
5858
|
),
|
|
5698
|
-
/* @__PURE__ */
|
|
5859
|
+
/* @__PURE__ */ jsx31(
|
|
5699
5860
|
XAxis3,
|
|
5700
5861
|
{
|
|
5701
5862
|
dataKey: "name",
|
|
@@ -5703,7 +5864,7 @@ var CustomLineChart = ({
|
|
|
5703
5864
|
fontSize: 12
|
|
5704
5865
|
}
|
|
5705
5866
|
),
|
|
5706
|
-
/* @__PURE__ */
|
|
5867
|
+
/* @__PURE__ */ jsx31(
|
|
5707
5868
|
YAxis3,
|
|
5708
5869
|
{
|
|
5709
5870
|
className: "fill-muted-foreground text-xs",
|
|
@@ -5713,8 +5874,8 @@ var CustomLineChart = ({
|
|
|
5713
5874
|
tickCount: 6
|
|
5714
5875
|
}
|
|
5715
5876
|
),
|
|
5716
|
-
showTooltip && /* @__PURE__ */
|
|
5717
|
-
showLegend && /* @__PURE__ */
|
|
5877
|
+
showTooltip && /* @__PURE__ */ jsx31(Tooltip3, { content: () => null }),
|
|
5878
|
+
showLegend && /* @__PURE__ */ jsx31(
|
|
5718
5879
|
Legend3,
|
|
5719
5880
|
{
|
|
5720
5881
|
wrapperStyle: {
|
|
@@ -5723,7 +5884,7 @@ var CustomLineChart = ({
|
|
|
5723
5884
|
}
|
|
5724
5885
|
}
|
|
5725
5886
|
),
|
|
5726
|
-
dataKeys.map((key) => /* @__PURE__ */
|
|
5887
|
+
dataKeys.map((key) => /* @__PURE__ */ jsx31(
|
|
5727
5888
|
Line2,
|
|
5728
5889
|
{
|
|
5729
5890
|
type: "monotone",
|
|
@@ -5731,8 +5892,8 @@ var CustomLineChart = ({
|
|
|
5731
5892
|
stroke: finalColors[key],
|
|
5732
5893
|
strokeWidth,
|
|
5733
5894
|
dot: showDots ? { r: 4, cursor: "pointer" } : false,
|
|
5734
|
-
activeDot: (props) => /* @__PURE__ */
|
|
5735
|
-
children: showLabels && /* @__PURE__ */
|
|
5895
|
+
activeDot: (props) => /* @__PURE__ */ jsx31(ClickableDot, { ...props, dataKey: key }),
|
|
5896
|
+
children: showLabels && /* @__PURE__ */ jsx31(
|
|
5736
5897
|
LabelList3,
|
|
5737
5898
|
{
|
|
5738
5899
|
dataKey: key,
|
|
@@ -5769,8 +5930,8 @@ var CustomLineChart = ({
|
|
|
5769
5930
|
guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
|
|
5770
5931
|
guide.targetTooltip.top + guide.targetTooltip.height / 2
|
|
5771
5932
|
);
|
|
5772
|
-
return /* @__PURE__ */
|
|
5773
|
-
/* @__PURE__ */
|
|
5933
|
+
return /* @__PURE__ */ jsxs26("div", { children: [
|
|
5934
|
+
/* @__PURE__ */ jsx31(
|
|
5774
5935
|
"div",
|
|
5775
5936
|
{
|
|
5776
5937
|
className: "fixed pointer-events-none z-30",
|
|
@@ -5789,7 +5950,7 @@ var CustomLineChart = ({
|
|
|
5789
5950
|
}
|
|
5790
5951
|
}
|
|
5791
5952
|
),
|
|
5792
|
-
/* @__PURE__ */
|
|
5953
|
+
/* @__PURE__ */ jsx31(
|
|
5793
5954
|
"div",
|
|
5794
5955
|
{
|
|
5795
5956
|
className: "fixed pointer-events-none z-31",
|
|
@@ -5805,7 +5966,7 @@ var CustomLineChart = ({
|
|
|
5805
5966
|
}
|
|
5806
5967
|
}
|
|
5807
5968
|
),
|
|
5808
|
-
/* @__PURE__ */
|
|
5969
|
+
/* @__PURE__ */ jsx31(
|
|
5809
5970
|
"div",
|
|
5810
5971
|
{
|
|
5811
5972
|
className: "fixed pointer-events-none z-31",
|
|
@@ -5823,7 +5984,7 @@ var CustomLineChart = ({
|
|
|
5823
5984
|
)
|
|
5824
5985
|
] }, index);
|
|
5825
5986
|
}),
|
|
5826
|
-
activeTooltips.map((tooltip, index) => /* @__PURE__ */
|
|
5987
|
+
activeTooltips.map((tooltip, index) => /* @__PURE__ */ jsx31(
|
|
5827
5988
|
DraggableTooltip_default,
|
|
5828
5989
|
{
|
|
5829
5990
|
id: tooltip.id,
|
|
@@ -5862,7 +6023,7 @@ import {
|
|
|
5862
6023
|
Tooltip as Tooltip4,
|
|
5863
6024
|
Legend as Legend4
|
|
5864
6025
|
} from "recharts";
|
|
5865
|
-
import { jsx as
|
|
6026
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5866
6027
|
var defaultData2 = [
|
|
5867
6028
|
{ name: "Vendas", value: 4e3 },
|
|
5868
6029
|
{ name: "Marketing", value: 3e3 },
|
|
@@ -5900,7 +6061,7 @@ var renderCustomizedLabel = ({
|
|
|
5900
6061
|
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
|
|
5901
6062
|
const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
|
5902
6063
|
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
5903
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ jsx32(
|
|
5904
6065
|
"text",
|
|
5905
6066
|
{
|
|
5906
6067
|
x,
|
|
@@ -5929,8 +6090,8 @@ var CustomPieChart = ({
|
|
|
5929
6090
|
centerY = "50%"
|
|
5930
6091
|
}) => {
|
|
5931
6092
|
const finalColors = colors2 || DEFAULT_COLORS5;
|
|
5932
|
-
return /* @__PURE__ */
|
|
5933
|
-
/* @__PURE__ */
|
|
6093
|
+
return /* @__PURE__ */ jsx32("div", { className: cn("w-full rounded-lg bg-card p-4", className), children: /* @__PURE__ */ jsx32(ResponsiveContainer2, { width, height, children: /* @__PURE__ */ jsxs27(RechartsPieChart, { children: [
|
|
6094
|
+
/* @__PURE__ */ jsx32(
|
|
5934
6095
|
Pie,
|
|
5935
6096
|
{
|
|
5936
6097
|
data,
|
|
@@ -5942,7 +6103,7 @@ var CustomPieChart = ({
|
|
|
5942
6103
|
innerRadius,
|
|
5943
6104
|
fill: "#8884d8",
|
|
5944
6105
|
dataKey: "value",
|
|
5945
|
-
children: data.map((entry, index) => /* @__PURE__ */
|
|
6106
|
+
children: data.map((entry, index) => /* @__PURE__ */ jsx32(
|
|
5946
6107
|
Cell,
|
|
5947
6108
|
{
|
|
5948
6109
|
fill: finalColors[index % finalColors.length]
|
|
@@ -5951,7 +6112,7 @@ var CustomPieChart = ({
|
|
|
5951
6112
|
))
|
|
5952
6113
|
}
|
|
5953
6114
|
),
|
|
5954
|
-
showTooltip && /* @__PURE__ */
|
|
6115
|
+
showTooltip && /* @__PURE__ */ jsx32(
|
|
5955
6116
|
Tooltip4,
|
|
5956
6117
|
{
|
|
5957
6118
|
contentStyle: {
|
|
@@ -5962,7 +6123,7 @@ var CustomPieChart = ({
|
|
|
5962
6123
|
}
|
|
5963
6124
|
}
|
|
5964
6125
|
),
|
|
5965
|
-
showLegend && /* @__PURE__ */
|
|
6126
|
+
showLegend && /* @__PURE__ */ jsx32(Legend4, {})
|
|
5966
6127
|
] }) }) });
|
|
5967
6128
|
};
|
|
5968
6129
|
var PieChart_default = CustomPieChart;
|
|
@@ -6040,105 +6201,6 @@ var useChartHighlights = () => {
|
|
|
6040
6201
|
};
|
|
6041
6202
|
};
|
|
6042
6203
|
|
|
6043
|
-
// src/components/charts/NoData.tsx
|
|
6044
|
-
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6045
|
-
var NoData = ({
|
|
6046
|
-
paddingLeft = 0,
|
|
6047
|
-
height = 360,
|
|
6048
|
-
message = "Sem dados para exibir",
|
|
6049
|
-
className
|
|
6050
|
-
}) => {
|
|
6051
|
-
const svgHeight = typeof height === "number" ? height : 360;
|
|
6052
|
-
const bars = [
|
|
6053
|
-
{ x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
|
|
6054
|
-
{ x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
|
|
6055
|
-
{ x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
|
|
6056
|
-
{ x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
|
|
6057
|
-
{ x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
|
|
6058
|
-
];
|
|
6059
|
-
const styleVars = {
|
|
6060
|
-
["--pl"]: `${paddingLeft}px`,
|
|
6061
|
-
["--svg-h"]: typeof height === "number" ? `${height}px` : String(height)
|
|
6062
|
-
};
|
|
6063
|
-
return /* @__PURE__ */ jsx32(
|
|
6064
|
-
"div",
|
|
6065
|
-
{
|
|
6066
|
-
className: cn(
|
|
6067
|
-
"rounded-lg bg-card p-2 relative overflow-visible w-full",
|
|
6068
|
-
className
|
|
6069
|
-
),
|
|
6070
|
-
style: styleVars,
|
|
6071
|
-
role: "img",
|
|
6072
|
-
"aria-label": message,
|
|
6073
|
-
children: /* @__PURE__ */ jsx32("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ jsxs27("div", { className: "w-full max-w-[900px] relative", children: [
|
|
6074
|
-
/* @__PURE__ */ jsxs27(
|
|
6075
|
-
"svg",
|
|
6076
|
-
{
|
|
6077
|
-
className: "w-full h-[var(--svg-h)]",
|
|
6078
|
-
width: "100%",
|
|
6079
|
-
viewBox: `0 0 900 ${svgHeight}`,
|
|
6080
|
-
preserveAspectRatio: "none",
|
|
6081
|
-
children: [
|
|
6082
|
-
/* @__PURE__ */ jsx32(
|
|
6083
|
-
"rect",
|
|
6084
|
-
{
|
|
6085
|
-
x: 0,
|
|
6086
|
-
y: 0,
|
|
6087
|
-
width: 900,
|
|
6088
|
-
height: svgHeight,
|
|
6089
|
-
fill: "transparent"
|
|
6090
|
-
}
|
|
6091
|
-
),
|
|
6092
|
-
Array.from({ length: 5 }).map((_, i) => {
|
|
6093
|
-
const y = 40 + (svgHeight - 80) / 4 * i;
|
|
6094
|
-
return /* @__PURE__ */ jsx32(
|
|
6095
|
-
"line",
|
|
6096
|
-
{
|
|
6097
|
-
x1: 60,
|
|
6098
|
-
x2: 840,
|
|
6099
|
-
y1: y,
|
|
6100
|
-
y2: y,
|
|
6101
|
-
stroke: "rgba(0,0,0,0.06)",
|
|
6102
|
-
strokeWidth: 1
|
|
6103
|
-
},
|
|
6104
|
-
`g-${i}`
|
|
6105
|
-
);
|
|
6106
|
-
}),
|
|
6107
|
-
bars.map((b, i) => /* @__PURE__ */ jsxs27("g", { children: [
|
|
6108
|
-
/* @__PURE__ */ jsx32(
|
|
6109
|
-
"rect",
|
|
6110
|
-
{
|
|
6111
|
-
x: b.x,
|
|
6112
|
-
y: svgHeight - 60 - b.h,
|
|
6113
|
-
width: b.w,
|
|
6114
|
-
height: b.h,
|
|
6115
|
-
rx: 6,
|
|
6116
|
-
fill: "rgba(0,0,0,0.06)",
|
|
6117
|
-
stroke: "rgba(0,0,0,0.04)"
|
|
6118
|
-
}
|
|
6119
|
-
),
|
|
6120
|
-
/* @__PURE__ */ jsx32(
|
|
6121
|
-
"text",
|
|
6122
|
-
{
|
|
6123
|
-
x: b.x + b.w / 2,
|
|
6124
|
-
y: svgHeight - 20,
|
|
6125
|
-
fill: "rgba(0,0,0,0.35)",
|
|
6126
|
-
fontSize: 12,
|
|
6127
|
-
textAnchor: "middle",
|
|
6128
|
-
children: b.label
|
|
6129
|
-
}
|
|
6130
|
-
)
|
|
6131
|
-
] }, `barg-${i}`))
|
|
6132
|
-
]
|
|
6133
|
-
}
|
|
6134
|
-
),
|
|
6135
|
-
/* @__PURE__ */ jsx32("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ jsx32("div", { className: "pointer-events-auto bg-transparent px-3", children: /* @__PURE__ */ jsx32("div", { className: "text-2xl font-extrabold text-black/80", children: message }) }) })
|
|
6136
|
-
] }) })
|
|
6137
|
-
}
|
|
6138
|
-
);
|
|
6139
|
-
};
|
|
6140
|
-
var NoData_default = NoData;
|
|
6141
|
-
|
|
6142
6204
|
// src/components/ui/data/AvatarBase.tsx
|
|
6143
6205
|
import * as React16 from "react";
|
|
6144
6206
|
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
@@ -12039,7 +12101,7 @@ import { jsx as jsx72 } from "react/jsx-runtime";
|
|
|
12039
12101
|
function DebouncedInput({
|
|
12040
12102
|
value: initialValue,
|
|
12041
12103
|
onChange,
|
|
12042
|
-
debounce = 500,
|
|
12104
|
+
debounce: debounce2 = 500,
|
|
12043
12105
|
label,
|
|
12044
12106
|
labelClassname,
|
|
12045
12107
|
leftIcon,
|
|
@@ -12061,12 +12123,12 @@ function DebouncedInput({
|
|
|
12061
12123
|
const timeout = setTimeout(() => {
|
|
12062
12124
|
onChange(value);
|
|
12063
12125
|
setIsDebouncing(false);
|
|
12064
|
-
},
|
|
12126
|
+
}, debounce2);
|
|
12065
12127
|
return () => {
|
|
12066
12128
|
clearTimeout(timeout);
|
|
12067
12129
|
setIsDebouncing(false);
|
|
12068
12130
|
};
|
|
12069
|
-
}, [
|
|
12131
|
+
}, [debounce2, initialValue, onChange, value]);
|
|
12070
12132
|
const renderRightIcon = () => {
|
|
12071
12133
|
if (showLoadingIndicator && isDebouncing) {
|
|
12072
12134
|
return /* @__PURE__ */ jsx72(CircleNotchIcon2, { className: "h-4 w-4 animate-spin text-muted-foreground" });
|
|
@@ -12094,12 +12156,29 @@ import { addDays, format as format3, isToday } from "date-fns";
|
|
|
12094
12156
|
import { ptBR as ptBR3 } from "date-fns/locale";
|
|
12095
12157
|
import { useMemo as useMemo9 } from "react";
|
|
12096
12158
|
import { CalendarIcon as CalendarIcon2 } from "@phosphor-icons/react";
|
|
12097
|
-
import { jsx as jsx73, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
12159
|
+
import { Fragment as Fragment10, jsx as jsx73, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
12098
12160
|
function AgendaView({
|
|
12099
12161
|
currentDate,
|
|
12100
12162
|
events,
|
|
12101
|
-
onEventSelect
|
|
12163
|
+
onEventSelect,
|
|
12164
|
+
showUndatedEvents = false
|
|
12102
12165
|
}) {
|
|
12166
|
+
const isValidDate3 = (d) => {
|
|
12167
|
+
try {
|
|
12168
|
+
const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
|
|
12169
|
+
return !isNaN(t);
|
|
12170
|
+
} catch {
|
|
12171
|
+
return false;
|
|
12172
|
+
}
|
|
12173
|
+
};
|
|
12174
|
+
const datedEvents = useMemo9(
|
|
12175
|
+
() => events.filter((e) => isValidDate3(e.start) && isValidDate3(e.end)),
|
|
12176
|
+
[events]
|
|
12177
|
+
);
|
|
12178
|
+
const undatedEvents = useMemo9(
|
|
12179
|
+
() => events.filter((e) => !(isValidDate3(e.start) && isValidDate3(e.end))),
|
|
12180
|
+
[events]
|
|
12181
|
+
);
|
|
12103
12182
|
const days = useMemo9(() => {
|
|
12104
12183
|
console.log("Agenda view updating with date:", currentDate.toISOString());
|
|
12105
12184
|
return Array.from(
|
|
@@ -12110,63 +12189,81 @@ function AgendaView({
|
|
|
12110
12189
|
const handleEventClick = (event, e) => {
|
|
12111
12190
|
e.stopPropagation();
|
|
12112
12191
|
console.log("Agenda view event clicked:", event);
|
|
12113
|
-
onEventSelect(event);
|
|
12192
|
+
if (onEventSelect) onEventSelect(event);
|
|
12114
12193
|
};
|
|
12115
12194
|
const hasEvents = days.some(
|
|
12116
|
-
(day) => getAgendaEventsForDay(
|
|
12195
|
+
(day) => getAgendaEventsForDay(datedEvents, day).length > 0
|
|
12117
12196
|
);
|
|
12118
|
-
return /* @__PURE__ */ jsx73("div", { className: "border-border/70 border-t px-4", children: !hasEvents ? /* @__PURE__ */ jsxs55("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
|
|
12197
|
+
return /* @__PURE__ */ jsx73("div", { className: "border-border/70 border-t px-4", children: !hasEvents && !(showUndatedEvents && undatedEvents.length > 0) ? /* @__PURE__ */ jsxs55("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
|
|
12119
12198
|
/* @__PURE__ */ jsx73(CalendarIcon2, { className: "mb-2 text-muted-foreground/50", size: 32 }),
|
|
12120
12199
|
/* @__PURE__ */ jsx73("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
|
|
12121
12200
|
/* @__PURE__ */ jsx73("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
|
|
12122
|
-
] }) :
|
|
12123
|
-
|
|
12124
|
-
|
|
12125
|
-
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
|
|
12149
|
-
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12201
|
+
] }) : /* @__PURE__ */ jsxs55(Fragment10, { children: [
|
|
12202
|
+
days.map((day) => {
|
|
12203
|
+
const dayEvents = getAgendaEventsForDay(datedEvents, day);
|
|
12204
|
+
if (dayEvents.length === 0) return null;
|
|
12205
|
+
return /* @__PURE__ */ jsxs55(
|
|
12206
|
+
"div",
|
|
12207
|
+
{
|
|
12208
|
+
className: "relative my-12 border-border/70 border-t",
|
|
12209
|
+
children: [
|
|
12210
|
+
/* @__PURE__ */ jsx73(
|
|
12211
|
+
"span",
|
|
12212
|
+
{
|
|
12213
|
+
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",
|
|
12214
|
+
"data-today": isToday(day) || void 0,
|
|
12215
|
+
children: (() => {
|
|
12216
|
+
const s = format3(day, "d MMM, EEEE", { locale: ptBR3 });
|
|
12217
|
+
return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
|
|
12218
|
+
})()
|
|
12219
|
+
}
|
|
12220
|
+
),
|
|
12221
|
+
/* @__PURE__ */ jsx73("div", { className: "mt-6 space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ jsx73(
|
|
12222
|
+
EventItem,
|
|
12223
|
+
{
|
|
12224
|
+
event,
|
|
12225
|
+
onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
|
|
12226
|
+
view: "agenda",
|
|
12227
|
+
agendaOnly: showUndatedEvents,
|
|
12228
|
+
className: onEventSelect ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
|
|
12229
|
+
},
|
|
12230
|
+
event.id
|
|
12231
|
+
)) })
|
|
12232
|
+
]
|
|
12233
|
+
},
|
|
12234
|
+
day.toString()
|
|
12235
|
+
);
|
|
12236
|
+
}),
|
|
12237
|
+
showUndatedEvents && undatedEvents.length > 0 && /* @__PURE__ */ jsxs55("div", { className: "relative my-12 border-border/70 border-t", children: [
|
|
12238
|
+
/* @__PURE__ */ jsx73("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" }),
|
|
12239
|
+
/* @__PURE__ */ jsx73("div", { className: "mt-6 space-y-2", children: undatedEvents.map((event) => /* @__PURE__ */ jsx73(
|
|
12240
|
+
EventItem,
|
|
12241
|
+
{
|
|
12242
|
+
event,
|
|
12243
|
+
onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
|
|
12244
|
+
view: "agenda",
|
|
12245
|
+
agendaOnly: showUndatedEvents,
|
|
12246
|
+
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"
|
|
12247
|
+
},
|
|
12248
|
+
event.id
|
|
12249
|
+
)) })
|
|
12250
|
+
] })
|
|
12251
|
+
] }) });
|
|
12252
|
+
}
|
|
12253
|
+
|
|
12254
|
+
// src/components/event-calendar/CalendarDND.tsx
|
|
12255
|
+
import {
|
|
12256
|
+
DndContext,
|
|
12257
|
+
DragOverlay,
|
|
12258
|
+
MouseSensor,
|
|
12259
|
+
PointerSensor,
|
|
12260
|
+
TouchSensor,
|
|
12261
|
+
useSensor,
|
|
12262
|
+
useSensors
|
|
12263
|
+
} from "@dnd-kit/core";
|
|
12264
|
+
import { addMinutes, differenceInMinutes } from "date-fns";
|
|
12265
|
+
import { useId as useId2, useRef as useRef9, useState as useState22 } from "react";
|
|
12266
|
+
|
|
12170
12267
|
// src/components/event-calendar/hooks.ts
|
|
12171
12268
|
import { createContext as createContext5, useContext as useContext6 } from "react";
|
|
12172
12269
|
var CalendarDndContext = createContext5({
|
|
@@ -12796,7 +12893,7 @@ import {
|
|
|
12796
12893
|
CalendarIcon as CalendarIcon3,
|
|
12797
12894
|
PlusIcon as PlusIcon3
|
|
12798
12895
|
} from "@phosphor-icons/react";
|
|
12799
|
-
import { Fragment as
|
|
12896
|
+
import { Fragment as Fragment11, jsx as jsx78, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
12800
12897
|
function EventCalendar({
|
|
12801
12898
|
events = [],
|
|
12802
12899
|
onEventAdd,
|
|
@@ -12852,7 +12949,6 @@ function EventCalendar({
|
|
|
12852
12949
|
case "m":
|
|
12853
12950
|
changeView("month");
|
|
12854
12951
|
break;
|
|
12855
|
-
// aceitar tanto 'w' (inglês) quanto 's' (pt-BR para "semana")
|
|
12856
12952
|
case "w":
|
|
12857
12953
|
case "s":
|
|
12858
12954
|
changeView("week");
|
|
@@ -12931,9 +13027,13 @@ function EventCalendar({
|
|
|
12931
13027
|
if (event.id) {
|
|
12932
13028
|
onEventUpdate?.(event);
|
|
12933
13029
|
toast3(`Evento "${event.title}" atualizado`, {
|
|
12934
|
-
description: format5(
|
|
12935
|
-
|
|
12936
|
-
|
|
13030
|
+
description: format5(
|
|
13031
|
+
new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
|
|
13032
|
+
"d 'de' MMMM 'de' yyyy",
|
|
13033
|
+
{
|
|
13034
|
+
locale: ptBR4
|
|
13035
|
+
}
|
|
13036
|
+
),
|
|
12937
13037
|
position: "bottom-left"
|
|
12938
13038
|
});
|
|
12939
13039
|
} else {
|
|
@@ -12942,9 +13042,11 @@ function EventCalendar({
|
|
|
12942
13042
|
id: Math.random().toString(36).substring(2, 11)
|
|
12943
13043
|
});
|
|
12944
13044
|
toast3(`Evento "${event.title}" adicionado`, {
|
|
12945
|
-
description: format5(
|
|
12946
|
-
|
|
12947
|
-
|
|
13045
|
+
description: format5(
|
|
13046
|
+
new Date(event.start ?? event.attend_date ?? event.end ?? Date.now()),
|
|
13047
|
+
"d 'de' MMMM 'de' yyyy",
|
|
13048
|
+
{ locale: ptBR4 }
|
|
13049
|
+
),
|
|
12948
13050
|
position: "bottom-left"
|
|
12949
13051
|
});
|
|
12950
13052
|
}
|
|
@@ -12959,7 +13061,9 @@ function EventCalendar({
|
|
|
12959
13061
|
if (deletedEvent) {
|
|
12960
13062
|
toast3(`Evento "${deletedEvent.title}" exclu\xEDdo`, {
|
|
12961
13063
|
description: format5(
|
|
12962
|
-
new Date(
|
|
13064
|
+
new Date(
|
|
13065
|
+
deletedEvent.start ?? deletedEvent.attend_date ?? deletedEvent.end ?? Date.now()
|
|
13066
|
+
),
|
|
12963
13067
|
"d 'de' MMMM 'de' yyyy",
|
|
12964
13068
|
{ locale: ptBR4 }
|
|
12965
13069
|
),
|
|
@@ -12971,7 +13075,9 @@ function EventCalendar({
|
|
|
12971
13075
|
onEventUpdate?.(updatedEvent);
|
|
12972
13076
|
toast3(`Evento "${updatedEvent.title}" movido`, {
|
|
12973
13077
|
description: format5(
|
|
12974
|
-
new Date(
|
|
13078
|
+
new Date(
|
|
13079
|
+
updatedEvent.start ?? updatedEvent.attend_date ?? updatedEvent.end ?? Date.now()
|
|
13080
|
+
),
|
|
12975
13081
|
"d 'de' MMMM 'de' yyyy",
|
|
12976
13082
|
{ locale: ptBR4 }
|
|
12977
13083
|
),
|
|
@@ -12998,8 +13104,10 @@ function EventCalendar({
|
|
|
12998
13104
|
const month = capitalize(format5(currentDate, "MMMM", { locale: ptBR4 }));
|
|
12999
13105
|
const year = format5(currentDate, "yyyy", { locale: ptBR4 });
|
|
13000
13106
|
const short = `${dayNum} de ${month} de ${year}`;
|
|
13001
|
-
const long = `${format5(currentDate, "EEE", {
|
|
13002
|
-
|
|
13107
|
+
const long = `${format5(currentDate, "EEE", {
|
|
13108
|
+
locale: ptBR4
|
|
13109
|
+
})}, ${dayNum} de ${month} de ${year}`;
|
|
13110
|
+
return /* @__PURE__ */ jsxs58(Fragment11, { children: [
|
|
13003
13111
|
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
13004
13112
|
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
|
|
13005
13113
|
/* @__PURE__ */ jsx78("span", { className: "max-md:hidden", children: long })
|
|
@@ -13017,213 +13125,214 @@ function EventCalendar({
|
|
|
13017
13125
|
}
|
|
13018
13126
|
return capitalize(format5(currentDate, "MMMM yyyy", { locale: ptBR4 }));
|
|
13019
13127
|
}, [currentDate, view]);
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
children: [
|
|
13038
|
-
/* @__PURE__ */ jsxs58("div", { className: "flex items-center gap-1 sm:gap-4", children: [
|
|
13039
|
-
/* @__PURE__ */ jsxs58(
|
|
13040
|
-
ButtonBase,
|
|
13041
|
-
{
|
|
13042
|
-
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
13043
|
-
onClick: handleToday,
|
|
13044
|
-
variant: "outline",
|
|
13045
|
-
children: [
|
|
13046
|
-
/* @__PURE__ */ jsx78(
|
|
13047
|
-
CalendarIcon3,
|
|
13048
|
-
{
|
|
13049
|
-
"aria-hidden": "true",
|
|
13050
|
-
className: "min-[480px]:hidden",
|
|
13051
|
-
size: 16
|
|
13052
|
-
}
|
|
13053
|
-
),
|
|
13054
|
-
/* @__PURE__ */ jsx78("span", { className: "max-[479px]:sr-only", children: "Hoje" })
|
|
13055
|
-
]
|
|
13056
|
-
}
|
|
13057
|
-
),
|
|
13058
|
-
/* @__PURE__ */ jsxs58("div", { className: "flex items-center sm:gap-2", children: [
|
|
13128
|
+
const calendarContent = /* @__PURE__ */ jsxs58(Fragment11, { children: [
|
|
13129
|
+
/* @__PURE__ */ jsxs58(
|
|
13130
|
+
"div",
|
|
13131
|
+
{
|
|
13132
|
+
className: cn(
|
|
13133
|
+
"flex items-center justify-between p-2 sm:p-4",
|
|
13134
|
+
className
|
|
13135
|
+
),
|
|
13136
|
+
children: [
|
|
13137
|
+
/* @__PURE__ */ jsxs58("div", { className: "flex items-center gap-1 sm:gap-4", children: [
|
|
13138
|
+
/* @__PURE__ */ jsxs58(
|
|
13139
|
+
ButtonBase,
|
|
13140
|
+
{
|
|
13141
|
+
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
13142
|
+
onClick: handleToday,
|
|
13143
|
+
variant: "outline",
|
|
13144
|
+
children: [
|
|
13059
13145
|
/* @__PURE__ */ jsx78(
|
|
13060
|
-
|
|
13146
|
+
CalendarIcon3,
|
|
13061
13147
|
{
|
|
13062
|
-
"aria-
|
|
13063
|
-
|
|
13064
|
-
size:
|
|
13065
|
-
variant: "ghost",
|
|
13066
|
-
children: /* @__PURE__ */ jsx78(CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
13148
|
+
"aria-hidden": "true",
|
|
13149
|
+
className: "min-[480px]:hidden",
|
|
13150
|
+
size: 16
|
|
13067
13151
|
}
|
|
13068
13152
|
),
|
|
13069
|
-
/* @__PURE__ */ jsx78(
|
|
13070
|
-
|
|
13071
|
-
|
|
13072
|
-
"aria-label": "Pr\xF3ximo",
|
|
13073
|
-
onClick: handleNext,
|
|
13074
|
-
size: "icon",
|
|
13075
|
-
variant: "ghost",
|
|
13076
|
-
children: /* @__PURE__ */ jsx78(CaretRight, { "aria-hidden": "true", size: 16 })
|
|
13077
|
-
}
|
|
13078
|
-
)
|
|
13079
|
-
] }),
|
|
13080
|
-
/* @__PURE__ */ jsx78("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
|
|
13081
|
-
] }),
|
|
13082
|
-
/* @__PURE__ */ jsxs58("div", { className: "flex items-center gap-2", children: [
|
|
13083
|
-
/* @__PURE__ */ jsxs58(DropDownMenuBase, { children: [
|
|
13084
|
-
/* @__PURE__ */ jsx78(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs58(
|
|
13085
|
-
ButtonBase,
|
|
13086
|
-
{
|
|
13087
|
-
className: "gap-1.5 max-[479px]:h-8",
|
|
13088
|
-
variant: "outline",
|
|
13089
|
-
children: [
|
|
13090
|
-
/* @__PURE__ */ jsxs58("span", { children: [
|
|
13091
|
-
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
|
|
13092
|
-
const labels = {
|
|
13093
|
-
month: "M\xEAs",
|
|
13094
|
-
week: "Semana",
|
|
13095
|
-
day: "Dia",
|
|
13096
|
-
agenda: "Agenda"
|
|
13097
|
-
};
|
|
13098
|
-
return (labels[view] || view).charAt(0).toUpperCase();
|
|
13099
|
-
})() }),
|
|
13100
|
-
/* @__PURE__ */ jsx78("span", { className: "max-[479px]:sr-only", children: (() => {
|
|
13101
|
-
const labels = {
|
|
13102
|
-
month: "M\xEAs",
|
|
13103
|
-
week: "Semana",
|
|
13104
|
-
day: "Dia",
|
|
13105
|
-
agenda: "Agenda"
|
|
13106
|
-
};
|
|
13107
|
-
return labels[view] || view;
|
|
13108
|
-
})() })
|
|
13109
|
-
] }),
|
|
13110
|
-
/* @__PURE__ */ jsx78(
|
|
13111
|
-
ArrowDownIcon,
|
|
13112
|
-
{
|
|
13113
|
-
"aria-hidden": "true",
|
|
13114
|
-
className: "-me-1 opacity-60",
|
|
13115
|
-
size: 16
|
|
13116
|
-
}
|
|
13117
|
-
)
|
|
13118
|
-
]
|
|
13119
|
-
}
|
|
13120
|
-
) }),
|
|
13121
|
-
/* @__PURE__ */ jsxs58(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
|
|
13122
|
-
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
|
|
13123
|
-
"M\xEAs ",
|
|
13124
|
-
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "M" })
|
|
13125
|
-
] }),
|
|
13126
|
-
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
|
|
13127
|
-
"Semana ",
|
|
13128
|
-
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "S" })
|
|
13129
|
-
] }),
|
|
13130
|
-
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
|
|
13131
|
-
"Dia ",
|
|
13132
|
-
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "D" })
|
|
13133
|
-
] }),
|
|
13134
|
-
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
|
|
13135
|
-
"Agenda ",
|
|
13136
|
-
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "A" })
|
|
13137
|
-
] })
|
|
13138
|
-
] })
|
|
13139
|
-
] }),
|
|
13140
|
-
/* @__PURE__ */ jsxs58(
|
|
13141
|
-
ButtonBase,
|
|
13142
|
-
{
|
|
13143
|
-
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
13144
|
-
onClick: () => {
|
|
13145
|
-
setSelectedEvent(null);
|
|
13146
|
-
setIsEventDialogOpen(true);
|
|
13147
|
-
},
|
|
13148
|
-
size: "sm",
|
|
13149
|
-
children: [
|
|
13150
|
-
/* @__PURE__ */ jsx78(
|
|
13151
|
-
PlusIcon3,
|
|
13152
|
-
{
|
|
13153
|
-
"aria-hidden": "true",
|
|
13154
|
-
className: "sm:-ms-1 opacity-60",
|
|
13155
|
-
size: 16
|
|
13156
|
-
}
|
|
13157
|
-
),
|
|
13158
|
-
/* @__PURE__ */ jsx78("span", { className: "max-sm:sr-only", children: "Novo evento" })
|
|
13159
|
-
]
|
|
13160
|
-
}
|
|
13161
|
-
)
|
|
13162
|
-
] })
|
|
13163
|
-
]
|
|
13164
|
-
}
|
|
13165
|
-
),
|
|
13166
|
-
/* @__PURE__ */ jsxs58(
|
|
13167
|
-
"div",
|
|
13168
|
-
{
|
|
13169
|
-
className: cn(
|
|
13170
|
-
"flex flex-1 flex-col transition-all duration-200 ease-in-out",
|
|
13171
|
-
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"
|
|
13153
|
+
/* @__PURE__ */ jsx78("span", { className: "max-[479px]:sr-only", children: "Hoje" })
|
|
13154
|
+
]
|
|
13155
|
+
}
|
|
13172
13156
|
),
|
|
13173
|
-
"
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
MonthView,
|
|
13157
|
+
/* @__PURE__ */ jsxs58("div", { className: "flex items-center sm:gap-2", children: [
|
|
13158
|
+
/* @__PURE__ */ jsx78(
|
|
13159
|
+
ButtonBase,
|
|
13177
13160
|
{
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
),
|
|
13184
|
-
view === "week" && /* @__PURE__ */ jsx78(
|
|
13185
|
-
WeekView,
|
|
13186
|
-
{
|
|
13187
|
-
currentDate,
|
|
13188
|
-
events,
|
|
13189
|
-
onEventCreate: handleEventCreate,
|
|
13190
|
-
onEventSelect: handleEventSelect
|
|
13161
|
+
"aria-label": "Anterior",
|
|
13162
|
+
onClick: handlePrevious,
|
|
13163
|
+
size: "icon",
|
|
13164
|
+
variant: "ghost",
|
|
13165
|
+
children: /* @__PURE__ */ jsx78(CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
13191
13166
|
}
|
|
13192
13167
|
),
|
|
13193
|
-
|
|
13194
|
-
|
|
13168
|
+
/* @__PURE__ */ jsx78(
|
|
13169
|
+
ButtonBase,
|
|
13195
13170
|
{
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13171
|
+
"aria-label": "Pr\xF3ximo",
|
|
13172
|
+
onClick: handleNext,
|
|
13173
|
+
size: "icon",
|
|
13174
|
+
variant: "ghost",
|
|
13175
|
+
children: /* @__PURE__ */ jsx78(CaretRight, { "aria-hidden": "true", size: 16 })
|
|
13200
13176
|
}
|
|
13201
|
-
)
|
|
13202
|
-
|
|
13203
|
-
|
|
13177
|
+
)
|
|
13178
|
+
] }),
|
|
13179
|
+
/* @__PURE__ */ jsx78("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
|
|
13180
|
+
] }),
|
|
13181
|
+
/* @__PURE__ */ jsx78("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs58(Fragment11, { children: [
|
|
13182
|
+
/* @__PURE__ */ jsxs58(DropDownMenuBase, { children: [
|
|
13183
|
+
/* @__PURE__ */ jsx78(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs58(
|
|
13184
|
+
ButtonBase,
|
|
13204
13185
|
{
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13186
|
+
className: "gap-1.5 max-[479px]:h-8",
|
|
13187
|
+
variant: "outline",
|
|
13188
|
+
children: [
|
|
13189
|
+
/* @__PURE__ */ jsxs58("span", { children: [
|
|
13190
|
+
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
|
|
13191
|
+
const labels = {
|
|
13192
|
+
month: "M\xEAs",
|
|
13193
|
+
week: "Semana",
|
|
13194
|
+
day: "Dia",
|
|
13195
|
+
agenda: "Agenda"
|
|
13196
|
+
};
|
|
13197
|
+
return (labels[view] || view).charAt(0).toUpperCase();
|
|
13198
|
+
})() }),
|
|
13199
|
+
/* @__PURE__ */ jsx78("span", { className: "max-[479px]:sr-only", children: (() => {
|
|
13200
|
+
const labels = {
|
|
13201
|
+
month: "M\xEAs",
|
|
13202
|
+
week: "Semana",
|
|
13203
|
+
day: "Dia",
|
|
13204
|
+
agenda: "Agenda"
|
|
13205
|
+
};
|
|
13206
|
+
return labels[view] || view;
|
|
13207
|
+
})() })
|
|
13208
|
+
] }),
|
|
13209
|
+
/* @__PURE__ */ jsx78(
|
|
13210
|
+
ArrowDownIcon,
|
|
13211
|
+
{
|
|
13212
|
+
"aria-hidden": "true",
|
|
13213
|
+
className: "-me-1 opacity-60",
|
|
13214
|
+
size: 16
|
|
13215
|
+
}
|
|
13216
|
+
)
|
|
13217
|
+
]
|
|
13208
13218
|
}
|
|
13209
|
-
)
|
|
13210
|
-
|
|
13211
|
-
|
|
13219
|
+
) }),
|
|
13220
|
+
/* @__PURE__ */ jsxs58(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
|
|
13221
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
|
|
13222
|
+
"M\xEAs ",
|
|
13223
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "M" })
|
|
13224
|
+
] }),
|
|
13225
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
|
|
13226
|
+
"Semana ",
|
|
13227
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "S" })
|
|
13228
|
+
] }),
|
|
13229
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
|
|
13230
|
+
"Dia ",
|
|
13231
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "D" })
|
|
13232
|
+
] }),
|
|
13233
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
|
|
13234
|
+
"Agenda ",
|
|
13235
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "A" })
|
|
13236
|
+
] })
|
|
13237
|
+
] })
|
|
13238
|
+
] }),
|
|
13239
|
+
/* @__PURE__ */ jsxs58(
|
|
13240
|
+
ButtonBase,
|
|
13241
|
+
{
|
|
13242
|
+
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
13243
|
+
onClick: () => {
|
|
13244
|
+
setSelectedEvent(null);
|
|
13245
|
+
setIsEventDialogOpen(true);
|
|
13246
|
+
},
|
|
13247
|
+
size: "sm",
|
|
13248
|
+
children: [
|
|
13249
|
+
/* @__PURE__ */ jsx78(
|
|
13250
|
+
PlusIcon3,
|
|
13251
|
+
{
|
|
13252
|
+
"aria-hidden": "true",
|
|
13253
|
+
className: "sm:-ms-1 opacity-60",
|
|
13254
|
+
size: 16
|
|
13255
|
+
}
|
|
13256
|
+
),
|
|
13257
|
+
/* @__PURE__ */ jsx78("span", { className: "max-sm:sr-only", children: "Novo evento" })
|
|
13258
|
+
]
|
|
13259
|
+
}
|
|
13260
|
+
)
|
|
13261
|
+
] }) })
|
|
13262
|
+
]
|
|
13263
|
+
}
|
|
13264
|
+
),
|
|
13265
|
+
/* @__PURE__ */ jsxs58(
|
|
13266
|
+
"div",
|
|
13267
|
+
{
|
|
13268
|
+
className: cn(
|
|
13269
|
+
"flex flex-1 flex-col transition-all duration-200 ease-in-out",
|
|
13270
|
+
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"
|
|
13212
13271
|
),
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13272
|
+
"aria-live": "polite",
|
|
13273
|
+
children: [
|
|
13274
|
+
view === "month" && /* @__PURE__ */ jsx78(
|
|
13275
|
+
MonthView,
|
|
13276
|
+
{
|
|
13277
|
+
currentDate,
|
|
13278
|
+
events,
|
|
13279
|
+
onEventCreate: handleEventCreate,
|
|
13280
|
+
onEventSelect: handleEventSelect
|
|
13281
|
+
}
|
|
13282
|
+
),
|
|
13283
|
+
view === "week" && /* @__PURE__ */ jsx78(
|
|
13284
|
+
WeekView,
|
|
13285
|
+
{
|
|
13286
|
+
currentDate,
|
|
13287
|
+
events,
|
|
13288
|
+
onEventCreate: handleEventCreate,
|
|
13289
|
+
onEventSelect: handleEventSelect
|
|
13290
|
+
}
|
|
13291
|
+
),
|
|
13292
|
+
view === "day" && /* @__PURE__ */ jsx78(
|
|
13293
|
+
DayView,
|
|
13294
|
+
{
|
|
13295
|
+
currentDate,
|
|
13296
|
+
events,
|
|
13297
|
+
onEventCreate: handleEventCreate,
|
|
13298
|
+
onEventSelect: handleEventSelect
|
|
13299
|
+
}
|
|
13300
|
+
),
|
|
13301
|
+
view === "agenda" && /* @__PURE__ */ jsx78(
|
|
13302
|
+
AgendaView,
|
|
13303
|
+
{
|
|
13304
|
+
currentDate,
|
|
13305
|
+
events,
|
|
13306
|
+
onEventSelect: handleEventSelect
|
|
13307
|
+
}
|
|
13308
|
+
)
|
|
13309
|
+
]
|
|
13310
|
+
}
|
|
13311
|
+
),
|
|
13312
|
+
/* @__PURE__ */ jsx78(
|
|
13313
|
+
EventDialog,
|
|
13314
|
+
{
|
|
13315
|
+
event: selectedEvent,
|
|
13316
|
+
isOpen: isEventDialogOpen,
|
|
13317
|
+
onClose: () => {
|
|
13318
|
+
setIsEventDialogOpen(false);
|
|
13319
|
+
setSelectedEvent(null);
|
|
13320
|
+
},
|
|
13321
|
+
onDelete: handleEventDelete,
|
|
13322
|
+
onSave: handleEventSave
|
|
13323
|
+
}
|
|
13324
|
+
)
|
|
13325
|
+
] });
|
|
13326
|
+
return /* @__PURE__ */ jsx78(
|
|
13327
|
+
"div",
|
|
13328
|
+
{
|
|
13329
|
+
className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
|
|
13330
|
+
style: {
|
|
13331
|
+
"--event-gap": `${EventGap}px`,
|
|
13332
|
+
"--event-height": `${EventHeight}px`,
|
|
13333
|
+
"--week-cells-height": `${WeekCellsHeight}px`
|
|
13334
|
+
},
|
|
13335
|
+
children: /* @__PURE__ */ jsx78(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
|
|
13227
13336
|
}
|
|
13228
13337
|
);
|
|
13229
13338
|
}
|
|
@@ -13693,10 +13802,21 @@ function EventDialog({
|
|
|
13693
13802
|
// src/components/event-calendar/EventItem.tsx
|
|
13694
13803
|
import { differenceInMinutes as differenceInMinutes3, format as format7, isPast } from "date-fns";
|
|
13695
13804
|
import { useMemo as useMemo13 } from "react";
|
|
13696
|
-
import {
|
|
13805
|
+
import {
|
|
13806
|
+
ClockUserIcon
|
|
13807
|
+
} from "@phosphor-icons/react";
|
|
13808
|
+
import { Fragment as Fragment12, jsx as jsx80, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
13697
13809
|
var formatTimeWithOptionalMinutes = (date) => {
|
|
13698
13810
|
return format7(date, "HH:mm");
|
|
13699
13811
|
};
|
|
13812
|
+
var isValidDate = (d) => {
|
|
13813
|
+
try {
|
|
13814
|
+
const dt = d instanceof Date ? d : new Date(String(d));
|
|
13815
|
+
return !isNaN(dt.getTime());
|
|
13816
|
+
} catch {
|
|
13817
|
+
return false;
|
|
13818
|
+
}
|
|
13819
|
+
};
|
|
13700
13820
|
function EventWrapper({
|
|
13701
13821
|
event,
|
|
13702
13822
|
isFirstDay = true,
|
|
@@ -13712,16 +13832,27 @@ function EventWrapper({
|
|
|
13712
13832
|
onTouchStart,
|
|
13713
13833
|
ariaLabel
|
|
13714
13834
|
}) {
|
|
13715
|
-
const
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13835
|
+
const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
|
|
13836
|
+
const displayEnd = (() => {
|
|
13837
|
+
if (isValidDate(event.start) && isValidDate(event.end)) {
|
|
13838
|
+
return currentTime ? new Date(
|
|
13839
|
+
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
13840
|
+
) : new Date(event.end);
|
|
13841
|
+
}
|
|
13842
|
+
if (isValidDate(event.attend_date)) {
|
|
13843
|
+
const start = new Date(event.attend_date);
|
|
13844
|
+
return addHoursToDate(start, 1);
|
|
13845
|
+
}
|
|
13846
|
+
return void 0;
|
|
13847
|
+
})();
|
|
13848
|
+
const isEventInPast = displayEnd ? isPast(displayEnd) : false;
|
|
13849
|
+
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";
|
|
13719
13850
|
return /* @__PURE__ */ jsx80(
|
|
13720
13851
|
"button",
|
|
13721
13852
|
{
|
|
13722
13853
|
className: cn(
|
|
13723
|
-
"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
|
|
13724
|
-
|
|
13854
|
+
"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 ",
|
|
13855
|
+
colorClasses,
|
|
13725
13856
|
getBorderRadiusClasses(isFirstDay, isLastDay),
|
|
13726
13857
|
className
|
|
13727
13858
|
),
|
|
@@ -13741,7 +13872,6 @@ function EventWrapper({
|
|
|
13741
13872
|
function EventItem({
|
|
13742
13873
|
event,
|
|
13743
13874
|
view,
|
|
13744
|
-
isDragging,
|
|
13745
13875
|
onClick,
|
|
13746
13876
|
showTime,
|
|
13747
13877
|
currentTime,
|
|
@@ -13752,21 +13882,39 @@ function EventItem({
|
|
|
13752
13882
|
dndListeners,
|
|
13753
13883
|
dndAttributes,
|
|
13754
13884
|
onMouseDown,
|
|
13755
|
-
onTouchStart
|
|
13885
|
+
onTouchStart,
|
|
13886
|
+
agendaOnly = false
|
|
13756
13887
|
}) {
|
|
13757
13888
|
const eventColor = event.color;
|
|
13889
|
+
const hasValidTime = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
|
|
13890
|
+
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";
|
|
13758
13891
|
const displayStart = useMemo13(() => {
|
|
13759
|
-
|
|
13760
|
-
|
|
13892
|
+
if (!hasValidTime) return void 0;
|
|
13893
|
+
if (isValidDate(event.start))
|
|
13894
|
+
return currentTime || new Date(event.start);
|
|
13895
|
+
if (isValidDate(event.attend_date))
|
|
13896
|
+
return currentTime || new Date(event.attend_date);
|
|
13897
|
+
return void 0;
|
|
13898
|
+
}, [currentTime, event.start, event.attend_date, hasValidTime]);
|
|
13761
13899
|
const displayEnd = useMemo13(() => {
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13900
|
+
if (!hasValidTime) return void 0;
|
|
13901
|
+
if (isValidDate(event.end)) {
|
|
13902
|
+
return currentTime ? new Date(
|
|
13903
|
+
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
13904
|
+
) : new Date(event.end);
|
|
13905
|
+
}
|
|
13906
|
+
if (isValidDate(event.attend_date)) {
|
|
13907
|
+
const start = new Date(event.attend_date);
|
|
13908
|
+
return addHoursToDate(start, 1);
|
|
13909
|
+
}
|
|
13910
|
+
return void 0;
|
|
13911
|
+
}, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
|
|
13766
13912
|
const durationMinutes = useMemo13(() => {
|
|
13913
|
+
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
13767
13914
|
return differenceInMinutes3(displayEnd, displayStart);
|
|
13768
|
-
}, [displayStart, displayEnd]);
|
|
13915
|
+
}, [displayStart, displayEnd, hasValidTime]);
|
|
13769
13916
|
const getEventTime = () => {
|
|
13917
|
+
if (!hasValidTime) return "";
|
|
13770
13918
|
if (event.allDay) return "All day";
|
|
13771
13919
|
if (durationMinutes < 45) {
|
|
13772
13920
|
return formatTimeWithOptionalMinutes(displayStart);
|
|
@@ -13775,9 +13923,20 @@ function EventItem({
|
|
|
13775
13923
|
displayStart
|
|
13776
13924
|
)} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
|
|
13777
13925
|
};
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13926
|
+
let ariaLabel;
|
|
13927
|
+
if (!hasValidTime) {
|
|
13928
|
+
ariaLabel = event.title;
|
|
13929
|
+
} else if (event.allDay) {
|
|
13930
|
+
ariaLabel = `${event.title}, All day`;
|
|
13931
|
+
} else if (durationMinutes < 45) {
|
|
13932
|
+
ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
|
|
13933
|
+
displayStart
|
|
13934
|
+
)}`;
|
|
13935
|
+
} else {
|
|
13936
|
+
ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
|
|
13937
|
+
displayStart
|
|
13938
|
+
)} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
|
|
13939
|
+
}
|
|
13781
13940
|
if (view === "month") {
|
|
13782
13941
|
return /* @__PURE__ */ jsx80(
|
|
13783
13942
|
EventWrapper,
|
|
@@ -13791,15 +13950,21 @@ function EventItem({
|
|
|
13791
13950
|
dndListeners,
|
|
13792
13951
|
event,
|
|
13793
13952
|
ariaLabel,
|
|
13794
|
-
isDragging,
|
|
13795
13953
|
isFirstDay,
|
|
13796
13954
|
isLastDay,
|
|
13797
13955
|
onClick,
|
|
13798
|
-
onMouseDown,
|
|
13799
|
-
onTouchStart,
|
|
13800
13956
|
children: children || /* @__PURE__ */ jsxs60("span", { className: "flex items-center gap-2 truncate", children: [
|
|
13801
|
-
!event.allDay && /* @__PURE__ */ jsx80("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) }),
|
|
13802
|
-
/* @__PURE__ */ jsx80(
|
|
13957
|
+
!event.allDay && hasValidTime && displayStart && /* @__PURE__ */ jsx80("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) }),
|
|
13958
|
+
/* @__PURE__ */ jsx80(
|
|
13959
|
+
"span",
|
|
13960
|
+
{
|
|
13961
|
+
className: cn(
|
|
13962
|
+
"truncate",
|
|
13963
|
+
agendaOnly ? "font-bold text-lg" : "font-medium"
|
|
13964
|
+
),
|
|
13965
|
+
children: event.title
|
|
13966
|
+
}
|
|
13967
|
+
)
|
|
13803
13968
|
] })
|
|
13804
13969
|
}
|
|
13805
13970
|
);
|
|
@@ -13819,19 +13984,74 @@ function EventItem({
|
|
|
13819
13984
|
dndListeners,
|
|
13820
13985
|
event,
|
|
13821
13986
|
ariaLabel,
|
|
13822
|
-
isDragging,
|
|
13823
13987
|
isFirstDay,
|
|
13824
13988
|
isLastDay,
|
|
13989
|
+
children: durationMinutes < 45 ? /* @__PURE__ */ jsxs60("div", { className: "flex items-center justify-between w-full", children: [
|
|
13990
|
+
/* @__PURE__ */ jsx80("div", { className: cn("truncate text-lg"), children: event.title }),
|
|
13991
|
+
showTime && hasValidTime && displayStart && /* @__PURE__ */ jsx80("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
|
|
13992
|
+
] }) : /* @__PURE__ */ jsxs60(Fragment12, { children: [
|
|
13993
|
+
/* @__PURE__ */ jsx80(
|
|
13994
|
+
"div",
|
|
13995
|
+
{
|
|
13996
|
+
className: cn(
|
|
13997
|
+
"truncate font-medium text-lg"
|
|
13998
|
+
),
|
|
13999
|
+
children: event.title
|
|
14000
|
+
}
|
|
14001
|
+
),
|
|
14002
|
+
showTime && hasValidTime && /* @__PURE__ */ jsx80("div", { className: "truncate font-normal opacity-70 sm:text-[15px]", children: /* @__PURE__ */ jsx80("span", { className: "inline-block bg-white/5 px-0.5 py-0.5 rounded-full", children: getEventTime() }) })
|
|
14003
|
+
] })
|
|
14004
|
+
}
|
|
14005
|
+
);
|
|
14006
|
+
}
|
|
14007
|
+
if (!hasValidTime) {
|
|
14008
|
+
return /* @__PURE__ */ jsxs60(
|
|
14009
|
+
"button",
|
|
14010
|
+
{
|
|
14011
|
+
className: cn(
|
|
14012
|
+
"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",
|
|
14013
|
+
getEventColorClasses(eventColor),
|
|
14014
|
+
className
|
|
14015
|
+
),
|
|
14016
|
+
"aria-label": ariaLabel,
|
|
13825
14017
|
onClick,
|
|
13826
14018
|
onMouseDown,
|
|
13827
14019
|
onTouchStart,
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
/* @__PURE__ */ jsx80("div", { className: "
|
|
13833
|
-
|
|
13834
|
-
|
|
14020
|
+
type: "button",
|
|
14021
|
+
...dndListeners,
|
|
14022
|
+
...dndAttributes,
|
|
14023
|
+
children: [
|
|
14024
|
+
/* @__PURE__ */ jsx80("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
|
|
14025
|
+
/* @__PURE__ */ jsx80(
|
|
14026
|
+
"div",
|
|
14027
|
+
{
|
|
14028
|
+
className: cn(
|
|
14029
|
+
"opacity-70 flex items-center gap-2",
|
|
14030
|
+
agendaOnly ? "text-sm" : "text-xs"
|
|
14031
|
+
),
|
|
14032
|
+
children: event.location && /* @__PURE__ */ jsxs60("span", { className: "opacity-80 flex items-center gap-1", children: [
|
|
14033
|
+
"-",
|
|
14034
|
+
/* @__PURE__ */ jsx80("span", { className: "truncate", children: event.location })
|
|
14035
|
+
] })
|
|
14036
|
+
}
|
|
14037
|
+
),
|
|
14038
|
+
event.description && /* @__PURE__ */ jsx80(
|
|
14039
|
+
"div",
|
|
14040
|
+
{
|
|
14041
|
+
className: cn(
|
|
14042
|
+
"my-1 opacity-90",
|
|
14043
|
+
agendaOnly ? "text-md" : "text-xs"
|
|
14044
|
+
),
|
|
14045
|
+
style: {
|
|
14046
|
+
display: "-webkit-box",
|
|
14047
|
+
WebkitLineClamp: 2,
|
|
14048
|
+
WebkitBoxOrient: "vertical",
|
|
14049
|
+
overflow: "hidden"
|
|
14050
|
+
},
|
|
14051
|
+
children: event.description
|
|
14052
|
+
}
|
|
14053
|
+
)
|
|
14054
|
+
]
|
|
13835
14055
|
}
|
|
13836
14056
|
);
|
|
13837
14057
|
}
|
|
@@ -13839,8 +14059,8 @@ function EventItem({
|
|
|
13839
14059
|
"button",
|
|
13840
14060
|
{
|
|
13841
14061
|
className: cn(
|
|
13842
|
-
"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",
|
|
13843
|
-
|
|
14062
|
+
"flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90 border-2 border-border",
|
|
14063
|
+
colorClasses,
|
|
13844
14064
|
className
|
|
13845
14065
|
),
|
|
13846
14066
|
"data-past-event": isPast(displayEnd) || void 0,
|
|
@@ -13852,23 +14072,29 @@ function EventItem({
|
|
|
13852
14072
|
...dndListeners,
|
|
13853
14073
|
...dndAttributes,
|
|
13854
14074
|
children: [
|
|
13855
|
-
/* @__PURE__ */
|
|
13856
|
-
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
14075
|
+
/* @__PURE__ */ jsxs60("div", { className: "flex w-full justify-between border-b-2 border-black/5 ", children: [
|
|
14076
|
+
/* @__PURE__ */ jsx80("div", { className: cn("font-bold text-lg"), children: event.title }),
|
|
14077
|
+
/* @__PURE__ */ jsx80(
|
|
14078
|
+
"div",
|
|
14079
|
+
{
|
|
14080
|
+
className: cn(
|
|
14081
|
+
"opacity-90 flex items-center gap-2 text-lg"
|
|
14082
|
+
),
|
|
14083
|
+
children: event.allDay ? /* @__PURE__ */ jsx80("span", { children: "Dia todo" }) : /* @__PURE__ */ jsxs60("span", { className: "uppercase font-semibold flex items-center gap-2", children: [
|
|
14084
|
+
formatTimeWithOptionalMinutes(displayStart),
|
|
14085
|
+
/* @__PURE__ */ jsx80("span", { className: "opacity-70", children: "-" }),
|
|
14086
|
+
formatTimeWithOptionalMinutes(displayEnd),
|
|
14087
|
+
/* @__PURE__ */ jsx80(ClockUserIcon, {})
|
|
14088
|
+
] })
|
|
14089
|
+
}
|
|
14090
|
+
)
|
|
13867
14091
|
] }),
|
|
13868
14092
|
event.description && /* @__PURE__ */ jsx80(
|
|
13869
14093
|
"div",
|
|
13870
14094
|
{
|
|
13871
|
-
className:
|
|
14095
|
+
className: cn(
|
|
14096
|
+
"my-1 opacity-90 flex text-md"
|
|
14097
|
+
),
|
|
13872
14098
|
style: {
|
|
13873
14099
|
display: "-webkit-box",
|
|
13874
14100
|
WebkitLineClamp: 2,
|
|
@@ -13921,7 +14147,7 @@ function EventsPopup({
|
|
|
13921
14147
|
};
|
|
13922
14148
|
}, [onClose]);
|
|
13923
14149
|
const handleEventClick = (event) => {
|
|
13924
|
-
onEventSelect(event);
|
|
14150
|
+
if (onEventSelect) onEventSelect(event);
|
|
13925
14151
|
onClose();
|
|
13926
14152
|
};
|
|
13927
14153
|
const adjustedPosition = useMemo14(() => {
|
|
@@ -13977,18 +14203,20 @@ function EventsPopup({
|
|
|
13977
14203
|
const eventEnd = new Date(event.end);
|
|
13978
14204
|
const isFirstDay = isSameDay2(date, eventStart);
|
|
13979
14205
|
const isLastDay = isSameDay2(date, eventEnd);
|
|
14206
|
+
const clickable = Boolean(onEventSelect);
|
|
13980
14207
|
return /* @__PURE__ */ jsx81(
|
|
13981
14208
|
"div",
|
|
13982
14209
|
{
|
|
13983
|
-
className: "cursor-pointer",
|
|
13984
|
-
onClick: () => handleEventClick(event),
|
|
14210
|
+
className: clickable ? "cursor-pointer" : "cursor-default",
|
|
14211
|
+
onClick: clickable ? () => handleEventClick(event) : void 0,
|
|
13985
14212
|
children: /* @__PURE__ */ jsx81(
|
|
13986
14213
|
EventItem,
|
|
13987
14214
|
{
|
|
13988
14215
|
event,
|
|
13989
14216
|
isFirstDay,
|
|
13990
14217
|
isLastDay,
|
|
13991
|
-
view: "agenda"
|
|
14218
|
+
view: "agenda",
|
|
14219
|
+
className: clickable ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
|
|
13992
14220
|
}
|
|
13993
14221
|
)
|
|
13994
14222
|
},
|
|
@@ -14315,6 +14543,7 @@ function MonthView({
|
|
|
14315
14543
|
|
|
14316
14544
|
// src/components/event-calendar/utils.ts
|
|
14317
14545
|
import { isSameDay as isSameDay5 } from "date-fns";
|
|
14546
|
+
import { addHours as addHours2 } from "date-fns";
|
|
14318
14547
|
function getEventColorClasses(color) {
|
|
14319
14548
|
const eventColor = color || "sky";
|
|
14320
14549
|
switch (eventColor) {
|
|
@@ -14347,15 +14576,16 @@ function getBorderRadiusClasses(isFirstDay, isLastDay) {
|
|
|
14347
14576
|
return "rounded-none";
|
|
14348
14577
|
}
|
|
14349
14578
|
function isMultiDayEvent(event) {
|
|
14350
|
-
const eventStart = new Date(event.start);
|
|
14351
|
-
const eventEnd = new Date(event.end);
|
|
14579
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14580
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14581
|
+
if (!eventStart || !eventEnd) return !!event.allDay;
|
|
14352
14582
|
return event.allDay || eventStart.getDate() !== eventEnd.getDate();
|
|
14353
14583
|
}
|
|
14354
14584
|
function getEventsForDay(events, day) {
|
|
14355
14585
|
return events.filter((event) => {
|
|
14356
|
-
const eventStart = new Date(event.start);
|
|
14357
|
-
return isSameDay5(day, eventStart);
|
|
14358
|
-
}).sort((a, b) =>
|
|
14586
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
|
|
14587
|
+
return eventStart ? isSameDay5(day, eventStart) : false;
|
|
14588
|
+
}).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
|
|
14359
14589
|
}
|
|
14360
14590
|
function sortEvents(events) {
|
|
14361
14591
|
return [...events].sort((a, b) => {
|
|
@@ -14363,30 +14593,47 @@ function sortEvents(events) {
|
|
|
14363
14593
|
const bIsMultiDay = isMultiDayEvent(b);
|
|
14364
14594
|
if (aIsMultiDay && !bIsMultiDay) return -1;
|
|
14365
14595
|
if (!aIsMultiDay && bIsMultiDay) return 1;
|
|
14366
|
-
return
|
|
14596
|
+
return getEventStartTimestamp(a) - getEventStartTimestamp(b);
|
|
14367
14597
|
});
|
|
14368
14598
|
}
|
|
14369
14599
|
function getSpanningEventsForDay(events, day) {
|
|
14370
14600
|
return events.filter((event) => {
|
|
14371
14601
|
if (!isMultiDayEvent(event)) return false;
|
|
14372
|
-
const eventStart = new Date(event.start);
|
|
14373
|
-
const eventEnd = new Date(event.end);
|
|
14602
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14603
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14604
|
+
if (!eventStart || !eventEnd) return false;
|
|
14374
14605
|
return !isSameDay5(day, eventStart) && (isSameDay5(day, eventEnd) || day > eventStart && day < eventEnd);
|
|
14375
14606
|
});
|
|
14376
14607
|
}
|
|
14377
14608
|
function getAllEventsForDay(events, day) {
|
|
14378
14609
|
return events.filter((event) => {
|
|
14379
|
-
const eventStart = new Date(event.start);
|
|
14380
|
-
const eventEnd = new Date(event.end);
|
|
14381
|
-
|
|
14610
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14611
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14612
|
+
if (!eventStart) return false;
|
|
14613
|
+
return isSameDay5(day, eventStart) || (eventEnd ? isSameDay5(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
14382
14614
|
});
|
|
14383
14615
|
}
|
|
14384
14616
|
function getAgendaEventsForDay(events, day) {
|
|
14385
14617
|
return events.filter((event) => {
|
|
14386
|
-
const eventStart = new Date(event.start);
|
|
14387
|
-
const eventEnd = new Date(event.end);
|
|
14388
|
-
|
|
14389
|
-
|
|
14618
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
|
|
14619
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : isValidDate2(event.attend_date) ? addHours2(new Date(event.attend_date), 1) : void 0;
|
|
14620
|
+
if (!eventStart) return false;
|
|
14621
|
+
return isSameDay5(day, eventStart) || (eventEnd ? isSameDay5(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
14622
|
+
}).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
|
|
14623
|
+
}
|
|
14624
|
+
function isValidDate2(d) {
|
|
14625
|
+
try {
|
|
14626
|
+
const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
|
|
14627
|
+
return !isNaN(t);
|
|
14628
|
+
} catch {
|
|
14629
|
+
return false;
|
|
14630
|
+
}
|
|
14631
|
+
}
|
|
14632
|
+
function getEventStartTimestamp(e) {
|
|
14633
|
+
if (isValidDate2(e.start)) return new Date(e.start).getTime();
|
|
14634
|
+
if (isValidDate2(e.attend_date))
|
|
14635
|
+
return new Date(e.attend_date).getTime();
|
|
14636
|
+
return Number.MAX_SAFE_INTEGER;
|
|
14390
14637
|
}
|
|
14391
14638
|
function addHoursToDate(date, hours) {
|
|
14392
14639
|
const result = new Date(date);
|
|
@@ -14396,7 +14643,7 @@ function addHoursToDate(date, hours) {
|
|
|
14396
14643
|
|
|
14397
14644
|
// src/components/event-calendar/WeekView.tsx
|
|
14398
14645
|
import {
|
|
14399
|
-
addHours as
|
|
14646
|
+
addHours as addHours3,
|
|
14400
14647
|
areIntervalsOverlapping as areIntervalsOverlapping2,
|
|
14401
14648
|
differenceInMinutes as differenceInMinutes4,
|
|
14402
14649
|
eachDayOfInterval as eachDayOfInterval2,
|
|
@@ -14432,8 +14679,8 @@ function WeekView({
|
|
|
14432
14679
|
const hours = useMemo17(() => {
|
|
14433
14680
|
const dayStart = startOfDay2(currentDate);
|
|
14434
14681
|
return eachHourOfInterval2({
|
|
14435
|
-
end:
|
|
14436
|
-
start:
|
|
14682
|
+
end: addHours3(dayStart, EndHour - 1),
|
|
14683
|
+
start: addHours3(dayStart, StartHour)
|
|
14437
14684
|
});
|
|
14438
14685
|
}, [currentDate]);
|
|
14439
14686
|
const allDayEvents = useMemo17(() => {
|
|
@@ -14473,7 +14720,7 @@ function WeekView({
|
|
|
14473
14720
|
const eventStart = new Date(event.start);
|
|
14474
14721
|
const eventEnd = new Date(event.end);
|
|
14475
14722
|
const adjustedStart = isSameDay6(day, eventStart) ? eventStart : dayStart;
|
|
14476
|
-
const adjustedEnd = isSameDay6(day, eventEnd) ? eventEnd :
|
|
14723
|
+
const adjustedEnd = isSameDay6(day, eventEnd) ? eventEnd : addHours3(dayStart, 24);
|
|
14477
14724
|
const startHour = getHours2(adjustedStart) + getMinutes2(adjustedStart) / 60;
|
|
14478
14725
|
const endHour = getHours2(adjustedEnd) + getMinutes2(adjustedEnd) / 60;
|
|
14479
14726
|
const top = (startHour - StartHour) * WeekCellsHeight;
|
|
@@ -14842,14 +15089,335 @@ function CheckboxTree({ tree, renderNode }) {
|
|
|
14842
15089
|
return renderTreeNode(tree);
|
|
14843
15090
|
}
|
|
14844
15091
|
|
|
15092
|
+
// src/components/selects/MultiSelectBase.tsx
|
|
15093
|
+
import { CaretUpDownIcon as CaretUpDownIcon2, CheckIcon as CheckIcon12, XIcon as XIcon12 } from "@phosphor-icons/react";
|
|
15094
|
+
import {
|
|
15095
|
+
createContext as createContext6,
|
|
15096
|
+
useCallback as useCallback15,
|
|
15097
|
+
useContext as useContext7,
|
|
15098
|
+
useEffect as useEffect25,
|
|
15099
|
+
useRef as useRef14,
|
|
15100
|
+
useState as useState30
|
|
15101
|
+
} from "react";
|
|
15102
|
+
import { motion as motion19 } from "framer-motion";
|
|
15103
|
+
import { Fragment as Fragment13, jsx as jsx85, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
15104
|
+
var MultiSelectContext = createContext6(null);
|
|
15105
|
+
function MultiSelectBase({
|
|
15106
|
+
children,
|
|
15107
|
+
values,
|
|
15108
|
+
defaultValues,
|
|
15109
|
+
onValuesChange,
|
|
15110
|
+
disabled,
|
|
15111
|
+
empty,
|
|
15112
|
+
error
|
|
15113
|
+
}) {
|
|
15114
|
+
const [open, setOpen] = useState30(false);
|
|
15115
|
+
const [internalValues, setInternalValues] = useState30(
|
|
15116
|
+
new Set(values ?? defaultValues)
|
|
15117
|
+
);
|
|
15118
|
+
const selectedValues = values ? new Set(values) : internalValues;
|
|
15119
|
+
const [items, setItems] = useState30(/* @__PURE__ */ new Map());
|
|
15120
|
+
function toggleValue(value) {
|
|
15121
|
+
if (disabled) return;
|
|
15122
|
+
const getNewSet = (prev) => {
|
|
15123
|
+
const newSet = new Set(prev);
|
|
15124
|
+
if (newSet.has(value)) {
|
|
15125
|
+
newSet.delete(value);
|
|
15126
|
+
} else {
|
|
15127
|
+
newSet.add(value);
|
|
15128
|
+
}
|
|
15129
|
+
return newSet;
|
|
15130
|
+
};
|
|
15131
|
+
setInternalValues(getNewSet);
|
|
15132
|
+
onValuesChange?.([...getNewSet(selectedValues)]);
|
|
15133
|
+
}
|
|
15134
|
+
const onItemAdded = useCallback15((value, label) => {
|
|
15135
|
+
setItems((prev) => {
|
|
15136
|
+
if (prev.get(value) === label) return prev;
|
|
15137
|
+
return new Map(prev).set(value, label);
|
|
15138
|
+
});
|
|
15139
|
+
}, []);
|
|
15140
|
+
return /* @__PURE__ */ jsx85(
|
|
15141
|
+
MultiSelectContext.Provider,
|
|
15142
|
+
{
|
|
15143
|
+
value: {
|
|
15144
|
+
open,
|
|
15145
|
+
setOpen,
|
|
15146
|
+
selectedValues,
|
|
15147
|
+
toggleValue,
|
|
15148
|
+
items,
|
|
15149
|
+
onItemAdded,
|
|
15150
|
+
disabled,
|
|
15151
|
+
emptyMessage: empty,
|
|
15152
|
+
error
|
|
15153
|
+
},
|
|
15154
|
+
children: /* @__PURE__ */ jsx85(
|
|
15155
|
+
PopoverBase,
|
|
15156
|
+
{
|
|
15157
|
+
open,
|
|
15158
|
+
onOpenChange: (v) => !disabled && setOpen(v),
|
|
15159
|
+
modal: true,
|
|
15160
|
+
children
|
|
15161
|
+
}
|
|
15162
|
+
)
|
|
15163
|
+
}
|
|
15164
|
+
);
|
|
15165
|
+
}
|
|
15166
|
+
function MultiSelectTriggerBase({
|
|
15167
|
+
className,
|
|
15168
|
+
children,
|
|
15169
|
+
error: propError,
|
|
15170
|
+
...props
|
|
15171
|
+
}) {
|
|
15172
|
+
const { open, disabled, error: contextError } = useMultiSelectContext();
|
|
15173
|
+
const error = propError ?? contextError;
|
|
15174
|
+
return /* @__PURE__ */ jsxs65("div", { className: cn("w-full", error && "mb-0"), children: [
|
|
15175
|
+
/* @__PURE__ */ jsx85(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs65(
|
|
15176
|
+
ButtonBase,
|
|
15177
|
+
{
|
|
15178
|
+
...props,
|
|
15179
|
+
variant: props.variant ?? "outline",
|
|
15180
|
+
role: props.role ?? "combobox",
|
|
15181
|
+
"aria-expanded": props["aria-expanded"] ?? open,
|
|
15182
|
+
"aria-disabled": disabled || void 0,
|
|
15183
|
+
disabled,
|
|
15184
|
+
className: cn(
|
|
15185
|
+
"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]",
|
|
15186
|
+
error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring",
|
|
15187
|
+
className
|
|
15188
|
+
),
|
|
15189
|
+
children: [
|
|
15190
|
+
children,
|
|
15191
|
+
/* @__PURE__ */ jsx85(CaretUpDownIcon2, { className: "size-4 shrink-0 opacity-50" })
|
|
15192
|
+
]
|
|
15193
|
+
}
|
|
15194
|
+
) }),
|
|
15195
|
+
error ? /* @__PURE__ */ jsx85(ErrorMessage_default, { error }) : null
|
|
15196
|
+
] });
|
|
15197
|
+
}
|
|
15198
|
+
function MultiSelectValueBase({
|
|
15199
|
+
placeholder,
|
|
15200
|
+
clickToRemove = true,
|
|
15201
|
+
className,
|
|
15202
|
+
overflowBehavior = "wrap-when-open",
|
|
15203
|
+
...props
|
|
15204
|
+
}) {
|
|
15205
|
+
const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
|
|
15206
|
+
const [overflowAmount, setOverflowAmount] = useState30(0);
|
|
15207
|
+
const valueRef = useRef14(null);
|
|
15208
|
+
const overflowRef = useRef14(null);
|
|
15209
|
+
const mutationObserverRef = useRef14(null);
|
|
15210
|
+
const resizeObserverRef = useRef14(null);
|
|
15211
|
+
const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
|
|
15212
|
+
const checkOverflow = useCallback15(() => {
|
|
15213
|
+
if (valueRef.current == null) return;
|
|
15214
|
+
const containerElement = valueRef.current;
|
|
15215
|
+
const overflowElement = overflowRef.current;
|
|
15216
|
+
const items2 = containerElement.querySelectorAll(
|
|
15217
|
+
"[data-selected-item]"
|
|
15218
|
+
);
|
|
15219
|
+
if (overflowElement != null) overflowElement.style.display = "none";
|
|
15220
|
+
items2.forEach((child) => child.style.removeProperty("display"));
|
|
15221
|
+
let amount = 0;
|
|
15222
|
+
for (let i = items2.length - 1; i >= 0; i--) {
|
|
15223
|
+
const child = items2[i];
|
|
15224
|
+
if (containerElement.scrollWidth <= containerElement.clientWidth) {
|
|
15225
|
+
break;
|
|
15226
|
+
}
|
|
15227
|
+
amount = items2.length - i;
|
|
15228
|
+
child.style.display = "none";
|
|
15229
|
+
overflowElement?.style.removeProperty("display");
|
|
15230
|
+
}
|
|
15231
|
+
setOverflowAmount(amount);
|
|
15232
|
+
}, []);
|
|
15233
|
+
const handleResize = useCallback15(
|
|
15234
|
+
(node) => {
|
|
15235
|
+
if (node == null) {
|
|
15236
|
+
valueRef.current = null;
|
|
15237
|
+
if (resizeObserverRef.current) {
|
|
15238
|
+
resizeObserverRef.current.disconnect();
|
|
15239
|
+
resizeObserverRef.current = null;
|
|
15240
|
+
}
|
|
15241
|
+
if (mutationObserverRef.current) {
|
|
15242
|
+
mutationObserverRef.current.disconnect();
|
|
15243
|
+
mutationObserverRef.current = null;
|
|
15244
|
+
}
|
|
15245
|
+
return;
|
|
15246
|
+
}
|
|
15247
|
+
valueRef.current = node;
|
|
15248
|
+
if (resizeObserverRef.current) {
|
|
15249
|
+
resizeObserverRef.current.disconnect();
|
|
15250
|
+
resizeObserverRef.current = null;
|
|
15251
|
+
}
|
|
15252
|
+
if (mutationObserverRef.current) {
|
|
15253
|
+
mutationObserverRef.current.disconnect();
|
|
15254
|
+
mutationObserverRef.current = null;
|
|
15255
|
+
}
|
|
15256
|
+
const mo = new MutationObserver(checkOverflow);
|
|
15257
|
+
const ro = new ResizeObserver(debounce(checkOverflow, 100));
|
|
15258
|
+
mutationObserverRef.current = mo;
|
|
15259
|
+
resizeObserverRef.current = ro;
|
|
15260
|
+
mo.observe(node, {
|
|
15261
|
+
childList: true,
|
|
15262
|
+
attributes: true,
|
|
15263
|
+
attributeFilter: ["class", "style"]
|
|
15264
|
+
});
|
|
15265
|
+
ro.observe(node);
|
|
15266
|
+
checkOverflow();
|
|
15267
|
+
},
|
|
15268
|
+
[checkOverflow]
|
|
15269
|
+
);
|
|
15270
|
+
if (selectedValues.size === 0 && placeholder) {
|
|
15271
|
+
return /* @__PURE__ */ jsx85("span", { className: "min-w-0 overflow-hidden font-normal text-muted-foreground ", children: placeholder });
|
|
15272
|
+
}
|
|
15273
|
+
return /* @__PURE__ */ jsxs65(
|
|
15274
|
+
"div",
|
|
15275
|
+
{
|
|
15276
|
+
...props,
|
|
15277
|
+
ref: handleResize,
|
|
15278
|
+
className: cn(
|
|
15279
|
+
"flex w-full gap-1.5 overflow-hidden",
|
|
15280
|
+
shouldWrap && "h-full flex-wrap",
|
|
15281
|
+
className
|
|
15282
|
+
),
|
|
15283
|
+
children: [
|
|
15284
|
+
[...selectedValues].filter((value) => items.has(value)).map((value) => /* @__PURE__ */ jsxs65(
|
|
15285
|
+
Badge,
|
|
15286
|
+
{
|
|
15287
|
+
"data-selected-item": true,
|
|
15288
|
+
size: "sm",
|
|
15289
|
+
className: "group flex items-center gap-1",
|
|
15290
|
+
onClick: clickToRemove ? (e) => {
|
|
15291
|
+
e.stopPropagation();
|
|
15292
|
+
toggleValue(value);
|
|
15293
|
+
} : void 0,
|
|
15294
|
+
children: [
|
|
15295
|
+
items.get(value),
|
|
15296
|
+
clickToRemove && /* @__PURE__ */ jsx85(XIcon12, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
|
|
15297
|
+
]
|
|
15298
|
+
},
|
|
15299
|
+
value
|
|
15300
|
+
)),
|
|
15301
|
+
/* @__PURE__ */ jsxs65(
|
|
15302
|
+
Badge,
|
|
15303
|
+
{
|
|
15304
|
+
style: {
|
|
15305
|
+
display: overflowAmount > 0 && !shouldWrap ? "block" : "none"
|
|
15306
|
+
},
|
|
15307
|
+
ref: overflowRef,
|
|
15308
|
+
children: [
|
|
15309
|
+
"+",
|
|
15310
|
+
overflowAmount
|
|
15311
|
+
]
|
|
15312
|
+
}
|
|
15313
|
+
)
|
|
15314
|
+
]
|
|
15315
|
+
}
|
|
15316
|
+
);
|
|
15317
|
+
}
|
|
15318
|
+
function MultiSelectContentBase({
|
|
15319
|
+
search = true,
|
|
15320
|
+
children,
|
|
15321
|
+
...props
|
|
15322
|
+
}) {
|
|
15323
|
+
const canSearch = typeof search === "object" ? true : search;
|
|
15324
|
+
const { emptyMessage } = useMultiSelectContext();
|
|
15325
|
+
return /* @__PURE__ */ jsx85(Fragment13, { children: /* @__PURE__ */ jsx85(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__ */ jsx85(
|
|
15326
|
+
motion19.div,
|
|
15327
|
+
{
|
|
15328
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
15329
|
+
animate: { opacity: 1, scale: 1 },
|
|
15330
|
+
exit: { opacity: 0, scale: 0.95 },
|
|
15331
|
+
transition: { duration: 0.2 },
|
|
15332
|
+
children: /* @__PURE__ */ jsx85("div", { className: cn(" "), children: /* @__PURE__ */ jsxs65(CommandBase, { ...props, children: [
|
|
15333
|
+
canSearch ? /* @__PURE__ */ jsx85(
|
|
15334
|
+
CommandInputBase,
|
|
15335
|
+
{
|
|
15336
|
+
placeholder: typeof search === "object" ? search.placeholder : void 0
|
|
15337
|
+
}
|
|
15338
|
+
) : /* @__PURE__ */ jsx85("button", { autoFocus: true, className: "sr-only" }),
|
|
15339
|
+
/* @__PURE__ */ jsxs65(CommandListBase, { children: [
|
|
15340
|
+
canSearch && /* @__PURE__ */ jsx85(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
|
|
15341
|
+
children
|
|
15342
|
+
] })
|
|
15343
|
+
] }) })
|
|
15344
|
+
}
|
|
15345
|
+
) }) });
|
|
15346
|
+
}
|
|
15347
|
+
function MultiSelectItemBase({
|
|
15348
|
+
value,
|
|
15349
|
+
children,
|
|
15350
|
+
badgeLabel,
|
|
15351
|
+
onSelect,
|
|
15352
|
+
...props
|
|
15353
|
+
}) {
|
|
15354
|
+
const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
|
|
15355
|
+
const isSelected = selectedValues.has(value);
|
|
15356
|
+
useEffect25(() => {
|
|
15357
|
+
onItemAdded(value, badgeLabel ?? children);
|
|
15358
|
+
}, [value, children, onItemAdded, badgeLabel]);
|
|
15359
|
+
return /* @__PURE__ */ jsx85(
|
|
15360
|
+
CommandItemBase,
|
|
15361
|
+
{
|
|
15362
|
+
...props,
|
|
15363
|
+
onSelect: () => {
|
|
15364
|
+
toggleValue(value);
|
|
15365
|
+
onSelect?.(value);
|
|
15366
|
+
},
|
|
15367
|
+
children: /* @__PURE__ */ jsxs65(
|
|
15368
|
+
motion19.div,
|
|
15369
|
+
{
|
|
15370
|
+
whileHover: { scale: 1.02 },
|
|
15371
|
+
whileTap: { scale: 0.98 },
|
|
15372
|
+
transition: { duration: 0.1 },
|
|
15373
|
+
children: [
|
|
15374
|
+
/* @__PURE__ */ jsx85("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx85(
|
|
15375
|
+
motion19.div,
|
|
15376
|
+
{
|
|
15377
|
+
initial: { scale: 0 },
|
|
15378
|
+
animate: { scale: isSelected ? 1 : 0 },
|
|
15379
|
+
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
15380
|
+
children: /* @__PURE__ */ jsx85(CheckIcon12, { className: "size-4" })
|
|
15381
|
+
}
|
|
15382
|
+
) }),
|
|
15383
|
+
children
|
|
15384
|
+
]
|
|
15385
|
+
}
|
|
15386
|
+
)
|
|
15387
|
+
}
|
|
15388
|
+
);
|
|
15389
|
+
}
|
|
15390
|
+
function MultiSelectGroupBase(props) {
|
|
15391
|
+
return /* @__PURE__ */ jsx85(CommandGroupBase, { ...props });
|
|
15392
|
+
}
|
|
15393
|
+
function MultiSelectSeparatorBase(props) {
|
|
15394
|
+
return /* @__PURE__ */ jsx85(CommandSeparatorBase, { ...props });
|
|
15395
|
+
}
|
|
15396
|
+
function useMultiSelectContext() {
|
|
15397
|
+
const context = useContext7(MultiSelectContext);
|
|
15398
|
+
if (context == null) {
|
|
15399
|
+
throw new Error(
|
|
15400
|
+
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
15401
|
+
);
|
|
15402
|
+
}
|
|
15403
|
+
return context;
|
|
15404
|
+
}
|
|
15405
|
+
function debounce(func, wait) {
|
|
15406
|
+
let timeout = null;
|
|
15407
|
+
return function(...args) {
|
|
15408
|
+
if (timeout) clearTimeout(timeout);
|
|
15409
|
+
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
15410
|
+
};
|
|
15411
|
+
}
|
|
15412
|
+
|
|
14845
15413
|
// src/hooks/use-drag.tsx
|
|
14846
|
-
import { useState as
|
|
15414
|
+
import { useState as useState31, useCallback as useCallback16, useRef as useRef15, useEffect as useEffect26 } from "react";
|
|
14847
15415
|
var useDrag = (options = {}) => {
|
|
14848
|
-
const [isDragging, setIsDragging] =
|
|
14849
|
-
const [positions, setPositions] =
|
|
14850
|
-
const dragStartPos =
|
|
14851
|
-
const dragId =
|
|
14852
|
-
const handleMouseDown =
|
|
15416
|
+
const [isDragging, setIsDragging] = useState31(null);
|
|
15417
|
+
const [positions, setPositions] = useState31({});
|
|
15418
|
+
const dragStartPos = useRef15(null);
|
|
15419
|
+
const dragId = useRef15(null);
|
|
15420
|
+
const handleMouseDown = useCallback16((id, e) => {
|
|
14853
15421
|
e.preventDefault();
|
|
14854
15422
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
14855
15423
|
dragStartPos.current = {
|
|
@@ -14862,7 +15430,7 @@ var useDrag = (options = {}) => {
|
|
|
14862
15430
|
setIsDragging(id);
|
|
14863
15431
|
options.onDragStart?.(id);
|
|
14864
15432
|
}, [positions, options]);
|
|
14865
|
-
const handleMouseMove =
|
|
15433
|
+
const handleMouseMove = useCallback16((e) => {
|
|
14866
15434
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
14867
15435
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
14868
15436
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -14878,7 +15446,7 @@ var useDrag = (options = {}) => {
|
|
|
14878
15446
|
}));
|
|
14879
15447
|
options.onDrag?.(dragId.current, newPosition);
|
|
14880
15448
|
}, [isDragging, options]);
|
|
14881
|
-
const handleMouseUp =
|
|
15449
|
+
const handleMouseUp = useCallback16(() => {
|
|
14882
15450
|
if (dragId.current) {
|
|
14883
15451
|
options.onDragEnd?.(dragId.current);
|
|
14884
15452
|
}
|
|
@@ -14886,7 +15454,7 @@ var useDrag = (options = {}) => {
|
|
|
14886
15454
|
dragStartPos.current = null;
|
|
14887
15455
|
dragId.current = null;
|
|
14888
15456
|
}, [options]);
|
|
14889
|
-
|
|
15457
|
+
useEffect26(() => {
|
|
14890
15458
|
if (isDragging) {
|
|
14891
15459
|
document.addEventListener("mousemove", handleMouseMove);
|
|
14892
15460
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -14898,16 +15466,16 @@ var useDrag = (options = {}) => {
|
|
|
14898
15466
|
};
|
|
14899
15467
|
}
|
|
14900
15468
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
14901
|
-
const setPosition =
|
|
15469
|
+
const setPosition = useCallback16((id, position) => {
|
|
14902
15470
|
setPositions((prev) => ({
|
|
14903
15471
|
...prev,
|
|
14904
15472
|
[id]: position
|
|
14905
15473
|
}));
|
|
14906
15474
|
}, []);
|
|
14907
|
-
const getPosition =
|
|
15475
|
+
const getPosition = useCallback16((id) => {
|
|
14908
15476
|
return positions[id] || { top: 0, left: 0 };
|
|
14909
15477
|
}, [positions]);
|
|
14910
|
-
const isElementDragging =
|
|
15478
|
+
const isElementDragging = useCallback16((id) => {
|
|
14911
15479
|
return isDragging === id;
|
|
14912
15480
|
}, [isDragging]);
|
|
14913
15481
|
return {
|
|
@@ -15085,6 +15653,13 @@ export {
|
|
|
15085
15653
|
MonthView,
|
|
15086
15654
|
MoreButton,
|
|
15087
15655
|
MultiCombobox,
|
|
15656
|
+
MultiSelectBase,
|
|
15657
|
+
MultiSelectContentBase,
|
|
15658
|
+
MultiSelectGroupBase,
|
|
15659
|
+
MultiSelectItemBase,
|
|
15660
|
+
MultiSelectSeparatorBase,
|
|
15661
|
+
MultiSelectTriggerBase,
|
|
15662
|
+
MultiSelectValueBase,
|
|
15088
15663
|
NavigationMenuBase,
|
|
15089
15664
|
NavigationMenuContentBase,
|
|
15090
15665
|
NavigationMenuIndicatorBase,
|