@mlw-packages/react-components 1.7.16 → 1.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +49 -3
- package/dist/index.d.mts +43 -13
- package/dist/index.d.ts +43 -13
- package/dist/index.js +1117 -548
- package/dist/index.mjs +1100 -524
- package/package.json +1 -1
package/dist/index.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,21 +12893,26 @@ 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,
|
|
12803
12900
|
onEventUpdate,
|
|
12804
12901
|
onEventDelete,
|
|
12805
12902
|
className,
|
|
12806
|
-
initialView = "month"
|
|
12903
|
+
initialView = "month",
|
|
12904
|
+
mode = "default"
|
|
12807
12905
|
}) {
|
|
12906
|
+
const isAgendaOnly = mode === "agenda-only";
|
|
12808
12907
|
const [currentDate, setCurrentDate] = useState24(/* @__PURE__ */ new Date());
|
|
12809
|
-
const [view, setView] = useState24(
|
|
12908
|
+
const [view, setView] = useState24(
|
|
12909
|
+
isAgendaOnly ? "agenda" : initialView
|
|
12910
|
+
);
|
|
12810
12911
|
const [isFading, setIsFading] = useState24(false);
|
|
12811
12912
|
const FADE_DURATION = 220;
|
|
12812
12913
|
const changeView = useCallback12(
|
|
12813
12914
|
(next) => {
|
|
12915
|
+
if (isAgendaOnly) return;
|
|
12814
12916
|
if (next === view) return;
|
|
12815
12917
|
setIsFading(true);
|
|
12816
12918
|
window.setTimeout(() => {
|
|
@@ -12818,7 +12920,7 @@ function EventCalendar({
|
|
|
12818
12920
|
requestAnimationFrame(() => setIsFading(false));
|
|
12819
12921
|
}, FADE_DURATION);
|
|
12820
12922
|
},
|
|
12821
|
-
[view]
|
|
12923
|
+
[view, isAgendaOnly]
|
|
12822
12924
|
);
|
|
12823
12925
|
const [isPaging, setIsPaging] = useState24(false);
|
|
12824
12926
|
const [pageDirection, setPageDirection] = useState24(
|
|
@@ -12848,11 +12950,11 @@ function EventCalendar({
|
|
|
12848
12950
|
if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
|
|
12849
12951
|
return;
|
|
12850
12952
|
}
|
|
12953
|
+
if (isAgendaOnly) return;
|
|
12851
12954
|
switch (e.key.toLowerCase()) {
|
|
12852
12955
|
case "m":
|
|
12853
12956
|
changeView("month");
|
|
12854
12957
|
break;
|
|
12855
|
-
// aceitar tanto 'w' (inglês) quanto 's' (pt-BR para "semana")
|
|
12856
12958
|
case "w":
|
|
12857
12959
|
case "s":
|
|
12858
12960
|
changeView("week");
|
|
@@ -12869,7 +12971,7 @@ function EventCalendar({
|
|
|
12869
12971
|
return () => {
|
|
12870
12972
|
window.removeEventListener("keydown", handleKeyDown);
|
|
12871
12973
|
};
|
|
12872
|
-
}, [isEventDialogOpen, changeView]);
|
|
12974
|
+
}, [isEventDialogOpen, changeView, isAgendaOnly]);
|
|
12873
12975
|
const handlePrevious = () => {
|
|
12874
12976
|
pageTransition(() => {
|
|
12875
12977
|
if (view === "month") {
|
|
@@ -12900,11 +13002,13 @@ function EventCalendar({
|
|
|
12900
13002
|
setCurrentDate(/* @__PURE__ */ new Date());
|
|
12901
13003
|
};
|
|
12902
13004
|
const handleEventSelect = (event) => {
|
|
13005
|
+
if (isAgendaOnly) return;
|
|
12903
13006
|
console.log("Event selected:", event);
|
|
12904
13007
|
setSelectedEvent(event);
|
|
12905
13008
|
setIsEventDialogOpen(true);
|
|
12906
13009
|
};
|
|
12907
13010
|
const handleEventCreate = (startTime) => {
|
|
13011
|
+
if (isAgendaOnly) return;
|
|
12908
13012
|
console.log("Creating new event at:", startTime);
|
|
12909
13013
|
const minutes = startTime.getMinutes();
|
|
12910
13014
|
const remainder = minutes % 15;
|
|
@@ -12998,8 +13102,10 @@ function EventCalendar({
|
|
|
12998
13102
|
const month = capitalize(format5(currentDate, "MMMM", { locale: ptBR4 }));
|
|
12999
13103
|
const year = format5(currentDate, "yyyy", { locale: ptBR4 });
|
|
13000
13104
|
const short = `${dayNum} de ${month} de ${year}`;
|
|
13001
|
-
const long = `${format5(currentDate, "EEE", {
|
|
13002
|
-
|
|
13105
|
+
const long = `${format5(currentDate, "EEE", {
|
|
13106
|
+
locale: ptBR4
|
|
13107
|
+
})}, ${dayNum} de ${month} de ${year}`;
|
|
13108
|
+
return /* @__PURE__ */ jsxs58(Fragment11, { children: [
|
|
13003
13109
|
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
|
|
13004
13110
|
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
|
|
13005
13111
|
/* @__PURE__ */ jsx78("span", { className: "max-md:hidden", children: long })
|
|
@@ -13017,213 +13123,217 @@ function EventCalendar({
|
|
|
13017
13123
|
}
|
|
13018
13124
|
return capitalize(format5(currentDate, "MMMM yyyy", { locale: ptBR4 }));
|
|
13019
13125
|
}, [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: [
|
|
13126
|
+
const calendarContent = /* @__PURE__ */ jsxs58(Fragment11, { children: [
|
|
13127
|
+
/* @__PURE__ */ jsxs58(
|
|
13128
|
+
"div",
|
|
13129
|
+
{
|
|
13130
|
+
className: cn(
|
|
13131
|
+
"flex items-center justify-between p-2 sm:p-4",
|
|
13132
|
+
className
|
|
13133
|
+
),
|
|
13134
|
+
children: [
|
|
13135
|
+
/* @__PURE__ */ jsxs58("div", { className: "flex items-center gap-1 sm:gap-4", children: [
|
|
13136
|
+
!isAgendaOnly && /* @__PURE__ */ jsxs58(
|
|
13137
|
+
ButtonBase,
|
|
13138
|
+
{
|
|
13139
|
+
className: "max-[479px]:aspect-square max-[479px]:p-0!",
|
|
13140
|
+
onClick: handleToday,
|
|
13141
|
+
variant: "outline",
|
|
13142
|
+
children: [
|
|
13059
13143
|
/* @__PURE__ */ jsx78(
|
|
13060
|
-
|
|
13144
|
+
CalendarIcon3,
|
|
13061
13145
|
{
|
|
13062
|
-
"aria-
|
|
13063
|
-
|
|
13064
|
-
size:
|
|
13065
|
-
variant: "ghost",
|
|
13066
|
-
children: /* @__PURE__ */ jsx78(CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
13146
|
+
"aria-hidden": "true",
|
|
13147
|
+
className: "min-[480px]:hidden",
|
|
13148
|
+
size: 16
|
|
13067
13149
|
}
|
|
13068
13150
|
),
|
|
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"
|
|
13151
|
+
/* @__PURE__ */ jsx78("span", { className: "max-[479px]:sr-only", children: "Hoje" })
|
|
13152
|
+
]
|
|
13153
|
+
}
|
|
13172
13154
|
),
|
|
13173
|
-
"
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
MonthView,
|
|
13177
|
-
{
|
|
13178
|
-
currentDate,
|
|
13179
|
-
events,
|
|
13180
|
-
onEventCreate: handleEventCreate,
|
|
13181
|
-
onEventSelect: handleEventSelect
|
|
13182
|
-
}
|
|
13183
|
-
),
|
|
13184
|
-
view === "week" && /* @__PURE__ */ jsx78(
|
|
13185
|
-
WeekView,
|
|
13155
|
+
/* @__PURE__ */ jsxs58("div", { className: "flex items-center sm:gap-2", children: [
|
|
13156
|
+
/* @__PURE__ */ jsx78(
|
|
13157
|
+
ButtonBase,
|
|
13186
13158
|
{
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13159
|
+
"aria-label": "Anterior",
|
|
13160
|
+
onClick: handlePrevious,
|
|
13161
|
+
size: "icon",
|
|
13162
|
+
variant: "ghost",
|
|
13163
|
+
children: /* @__PURE__ */ jsx78(CaretLeft, { "aria-hidden": "true", size: 16 })
|
|
13191
13164
|
}
|
|
13192
13165
|
),
|
|
13193
|
-
|
|
13194
|
-
|
|
13166
|
+
/* @__PURE__ */ jsx78(
|
|
13167
|
+
ButtonBase,
|
|
13195
13168
|
{
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13169
|
+
"aria-label": "Pr\xF3ximo",
|
|
13170
|
+
onClick: handleNext,
|
|
13171
|
+
size: "icon",
|
|
13172
|
+
variant: "ghost",
|
|
13173
|
+
children: /* @__PURE__ */ jsx78(CaretRight, { "aria-hidden": "true", size: 16 })
|
|
13200
13174
|
}
|
|
13201
|
-
)
|
|
13202
|
-
|
|
13203
|
-
|
|
13175
|
+
)
|
|
13176
|
+
] }),
|
|
13177
|
+
/* @__PURE__ */ jsx78("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
|
|
13178
|
+
] }),
|
|
13179
|
+
/* @__PURE__ */ jsx78("div", { className: "flex items-center gap-2", children: !isAgendaOnly && /* @__PURE__ */ jsxs58(Fragment11, { children: [
|
|
13180
|
+
/* @__PURE__ */ jsxs58(DropDownMenuBase, { children: [
|
|
13181
|
+
/* @__PURE__ */ jsx78(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs58(
|
|
13182
|
+
ButtonBase,
|
|
13204
13183
|
{
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13184
|
+
className: "gap-1.5 max-[479px]:h-8",
|
|
13185
|
+
variant: "outline",
|
|
13186
|
+
children: [
|
|
13187
|
+
/* @__PURE__ */ jsxs58("span", { children: [
|
|
13188
|
+
/* @__PURE__ */ jsx78("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
|
|
13189
|
+
const labels = {
|
|
13190
|
+
month: "M\xEAs",
|
|
13191
|
+
week: "Semana",
|
|
13192
|
+
day: "Dia",
|
|
13193
|
+
agenda: "Agenda"
|
|
13194
|
+
};
|
|
13195
|
+
return (labels[view] || view).charAt(0).toUpperCase();
|
|
13196
|
+
})() }),
|
|
13197
|
+
/* @__PURE__ */ jsx78("span", { className: "max-[479px]:sr-only", children: (() => {
|
|
13198
|
+
const labels = {
|
|
13199
|
+
month: "M\xEAs",
|
|
13200
|
+
week: "Semana",
|
|
13201
|
+
day: "Dia",
|
|
13202
|
+
agenda: "Agenda"
|
|
13203
|
+
};
|
|
13204
|
+
return labels[view] || view;
|
|
13205
|
+
})() })
|
|
13206
|
+
] }),
|
|
13207
|
+
/* @__PURE__ */ jsx78(
|
|
13208
|
+
ArrowDownIcon,
|
|
13209
|
+
{
|
|
13210
|
+
"aria-hidden": "true",
|
|
13211
|
+
className: "-me-1 opacity-60",
|
|
13212
|
+
size: 16
|
|
13213
|
+
}
|
|
13214
|
+
)
|
|
13215
|
+
]
|
|
13208
13216
|
}
|
|
13209
|
-
)
|
|
13210
|
-
|
|
13211
|
-
|
|
13217
|
+
) }),
|
|
13218
|
+
/* @__PURE__ */ jsxs58(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
|
|
13219
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
|
|
13220
|
+
"M\xEAs ",
|
|
13221
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "M" })
|
|
13222
|
+
] }),
|
|
13223
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
|
|
13224
|
+
"Semana",
|
|
13225
|
+
" ",
|
|
13226
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "S" })
|
|
13227
|
+
] }),
|
|
13228
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
|
|
13229
|
+
"Dia ",
|
|
13230
|
+
/* @__PURE__ */ jsx78(DropDownMenuShortcutBase, { children: "D" })
|
|
13231
|
+
] }),
|
|
13232
|
+
/* @__PURE__ */ jsxs58(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
|
|
13233
|
+
"Agenda",
|
|
13234
|
+
" ",
|
|
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: isAgendaOnly ? void 0 : handleEventSelect,
|
|
13307
|
+
showUndatedEvents: isAgendaOnly
|
|
13308
|
+
}
|
|
13309
|
+
)
|
|
13310
|
+
]
|
|
13311
|
+
}
|
|
13312
|
+
),
|
|
13313
|
+
/* @__PURE__ */ jsx78(
|
|
13314
|
+
EventDialog,
|
|
13315
|
+
{
|
|
13316
|
+
event: selectedEvent,
|
|
13317
|
+
isOpen: isEventDialogOpen,
|
|
13318
|
+
onClose: () => {
|
|
13319
|
+
setIsEventDialogOpen(false);
|
|
13320
|
+
setSelectedEvent(null);
|
|
13321
|
+
},
|
|
13322
|
+
onDelete: handleEventDelete,
|
|
13323
|
+
onSave: handleEventSave
|
|
13324
|
+
}
|
|
13325
|
+
)
|
|
13326
|
+
] });
|
|
13327
|
+
return /* @__PURE__ */ jsx78(
|
|
13328
|
+
"div",
|
|
13329
|
+
{
|
|
13330
|
+
className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
|
|
13331
|
+
style: {
|
|
13332
|
+
"--event-gap": `${EventGap}px`,
|
|
13333
|
+
"--event-height": `${EventHeight}px`,
|
|
13334
|
+
"--week-cells-height": `${WeekCellsHeight}px`
|
|
13335
|
+
},
|
|
13336
|
+
children: isAgendaOnly ? calendarContent : /* @__PURE__ */ jsx78(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
|
|
13227
13337
|
}
|
|
13228
13338
|
);
|
|
13229
13339
|
}
|
|
@@ -13693,10 +13803,18 @@ function EventDialog({
|
|
|
13693
13803
|
// src/components/event-calendar/EventItem.tsx
|
|
13694
13804
|
import { differenceInMinutes as differenceInMinutes3, format as format7, isPast } from "date-fns";
|
|
13695
13805
|
import { useMemo as useMemo13 } from "react";
|
|
13696
|
-
import { Fragment as
|
|
13806
|
+
import { Fragment as Fragment12, jsx as jsx80, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
13697
13807
|
var formatTimeWithOptionalMinutes = (date) => {
|
|
13698
13808
|
return format7(date, "HH:mm");
|
|
13699
13809
|
};
|
|
13810
|
+
var isValidDate = (d) => {
|
|
13811
|
+
try {
|
|
13812
|
+
const dt = d instanceof Date ? d : new Date(String(d));
|
|
13813
|
+
return !isNaN(dt.getTime());
|
|
13814
|
+
} catch {
|
|
13815
|
+
return false;
|
|
13816
|
+
}
|
|
13817
|
+
};
|
|
13700
13818
|
function EventWrapper({
|
|
13701
13819
|
event,
|
|
13702
13820
|
isFirstDay = true,
|
|
@@ -13712,16 +13830,18 @@ function EventWrapper({
|
|
|
13712
13830
|
onTouchStart,
|
|
13713
13831
|
ariaLabel
|
|
13714
13832
|
}) {
|
|
13715
|
-
const
|
|
13833
|
+
const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end);
|
|
13834
|
+
const displayEnd = hasValidTimeForWrapper ? currentTime ? new Date(
|
|
13716
13835
|
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
13717
|
-
) : new Date(event.end);
|
|
13718
|
-
const isEventInPast = isPast(displayEnd);
|
|
13836
|
+
) : new Date(event.end) : void 0;
|
|
13837
|
+
const isEventInPast = displayEnd ? isPast(displayEnd) : false;
|
|
13838
|
+
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
13839
|
return /* @__PURE__ */ jsx80(
|
|
13720
13840
|
"button",
|
|
13721
13841
|
{
|
|
13722
13842
|
className: cn(
|
|
13723
13843
|
"flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md hover:scale-105",
|
|
13724
|
-
|
|
13844
|
+
colorClasses,
|
|
13725
13845
|
getBorderRadiusClasses(isFirstDay, isLastDay),
|
|
13726
13846
|
className
|
|
13727
13847
|
),
|
|
@@ -13752,21 +13872,39 @@ function EventItem({
|
|
|
13752
13872
|
dndListeners,
|
|
13753
13873
|
dndAttributes,
|
|
13754
13874
|
onMouseDown,
|
|
13755
|
-
onTouchStart
|
|
13875
|
+
onTouchStart,
|
|
13876
|
+
agendaOnly = false
|
|
13756
13877
|
}) {
|
|
13757
13878
|
const eventColor = event.color;
|
|
13879
|
+
const hasValidTime = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
|
|
13880
|
+
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
13881
|
const displayStart = useMemo13(() => {
|
|
13759
|
-
|
|
13760
|
-
|
|
13882
|
+
if (!hasValidTime) return void 0;
|
|
13883
|
+
if (isValidDate(event.start))
|
|
13884
|
+
return currentTime || new Date(event.start);
|
|
13885
|
+
if (isValidDate(event.attend_date))
|
|
13886
|
+
return currentTime || new Date(event.attend_date);
|
|
13887
|
+
return void 0;
|
|
13888
|
+
}, [currentTime, event.start, event.attend_date, hasValidTime]);
|
|
13761
13889
|
const displayEnd = useMemo13(() => {
|
|
13762
|
-
|
|
13763
|
-
|
|
13764
|
-
|
|
13765
|
-
|
|
13890
|
+
if (!hasValidTime) return void 0;
|
|
13891
|
+
if (isValidDate(event.end)) {
|
|
13892
|
+
return currentTime ? new Date(
|
|
13893
|
+
new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
|
|
13894
|
+
) : new Date(event.end);
|
|
13895
|
+
}
|
|
13896
|
+
if (isValidDate(event.attend_date)) {
|
|
13897
|
+
const start = new Date(event.attend_date);
|
|
13898
|
+
return addHoursToDate(start, 1);
|
|
13899
|
+
}
|
|
13900
|
+
return void 0;
|
|
13901
|
+
}, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
|
|
13766
13902
|
const durationMinutes = useMemo13(() => {
|
|
13903
|
+
if (!hasValidTime || !displayStart || !displayEnd) return 0;
|
|
13767
13904
|
return differenceInMinutes3(displayEnd, displayStart);
|
|
13768
|
-
}, [displayStart, displayEnd]);
|
|
13905
|
+
}, [displayStart, displayEnd, hasValidTime]);
|
|
13769
13906
|
const getEventTime = () => {
|
|
13907
|
+
if (!hasValidTime) return "";
|
|
13770
13908
|
if (event.allDay) return "All day";
|
|
13771
13909
|
if (durationMinutes < 45) {
|
|
13772
13910
|
return formatTimeWithOptionalMinutes(displayStart);
|
|
@@ -13775,9 +13913,20 @@ function EventItem({
|
|
|
13775
13913
|
displayStart
|
|
13776
13914
|
)} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
|
|
13777
13915
|
};
|
|
13778
|
-
|
|
13779
|
-
|
|
13780
|
-
|
|
13916
|
+
let ariaLabel;
|
|
13917
|
+
if (!hasValidTime) {
|
|
13918
|
+
ariaLabel = event.title;
|
|
13919
|
+
} else if (event.allDay) {
|
|
13920
|
+
ariaLabel = `${event.title}, All day`;
|
|
13921
|
+
} else if (durationMinutes < 45) {
|
|
13922
|
+
ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
|
|
13923
|
+
displayStart
|
|
13924
|
+
)}`;
|
|
13925
|
+
} else {
|
|
13926
|
+
ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
|
|
13927
|
+
displayStart
|
|
13928
|
+
)} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
|
|
13929
|
+
}
|
|
13781
13930
|
if (view === "month") {
|
|
13782
13931
|
return /* @__PURE__ */ jsx80(
|
|
13783
13932
|
EventWrapper,
|
|
@@ -13798,8 +13947,17 @@ function EventItem({
|
|
|
13798
13947
|
onMouseDown,
|
|
13799
13948
|
onTouchStart,
|
|
13800
13949
|
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(
|
|
13950
|
+
!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) }),
|
|
13951
|
+
/* @__PURE__ */ jsx80(
|
|
13952
|
+
"span",
|
|
13953
|
+
{
|
|
13954
|
+
className: cn(
|
|
13955
|
+
"truncate",
|
|
13956
|
+
agendaOnly ? "font-bold text-lg" : "font-medium"
|
|
13957
|
+
),
|
|
13958
|
+
children: event.title
|
|
13959
|
+
}
|
|
13960
|
+
)
|
|
13803
13961
|
] })
|
|
13804
13962
|
}
|
|
13805
13963
|
);
|
|
@@ -13826,21 +13984,81 @@ function EventItem({
|
|
|
13826
13984
|
onMouseDown,
|
|
13827
13985
|
onTouchStart,
|
|
13828
13986
|
children: durationMinutes < 45 ? /* @__PURE__ */ jsxs60("div", { className: "flex items-center justify-between w-full", children: [
|
|
13829
|
-
/* @__PURE__ */ jsx80("div", { className: "truncate", children: event.title }),
|
|
13830
|
-
showTime && /* @__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) })
|
|
13831
|
-
] }) : /* @__PURE__ */ jsxs60(
|
|
13832
|
-
/* @__PURE__ */ jsx80(
|
|
13833
|
-
|
|
13987
|
+
/* @__PURE__ */ jsx80("div", { className: cn("truncate", agendaOnly ? "text-lg" : ""), children: event.title }),
|
|
13988
|
+
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) })
|
|
13989
|
+
] }) : /* @__PURE__ */ jsxs60(Fragment12, { children: [
|
|
13990
|
+
/* @__PURE__ */ jsx80(
|
|
13991
|
+
"div",
|
|
13992
|
+
{
|
|
13993
|
+
className: cn(
|
|
13994
|
+
"truncate font-medium",
|
|
13995
|
+
agendaOnly ? "text-lg" : ""
|
|
13996
|
+
),
|
|
13997
|
+
children: event.title
|
|
13998
|
+
}
|
|
13999
|
+
),
|
|
14000
|
+
showTime && hasValidTime && /* @__PURE__ */ jsx80("div", { className: "truncate font-normal opacity-70 sm:text-[11px]", children: /* @__PURE__ */ jsx80("span", { className: "inline-block bg-white/5 px-2 py-0.5 rounded-full", children: getEventTime() }) })
|
|
13834
14001
|
] })
|
|
13835
14002
|
}
|
|
13836
14003
|
);
|
|
13837
14004
|
}
|
|
14005
|
+
if (!hasValidTime) {
|
|
14006
|
+
return /* @__PURE__ */ jsxs60(
|
|
14007
|
+
"button",
|
|
14008
|
+
{
|
|
14009
|
+
className: cn(
|
|
14010
|
+
"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",
|
|
14011
|
+
getEventColorClasses(eventColor),
|
|
14012
|
+
className
|
|
14013
|
+
),
|
|
14014
|
+
"aria-label": ariaLabel,
|
|
14015
|
+
onClick,
|
|
14016
|
+
onMouseDown,
|
|
14017
|
+
onTouchStart,
|
|
14018
|
+
type: "button",
|
|
14019
|
+
...dndListeners,
|
|
14020
|
+
...dndAttributes,
|
|
14021
|
+
children: [
|
|
14022
|
+
/* @__PURE__ */ jsx80("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
|
|
14023
|
+
/* @__PURE__ */ jsx80(
|
|
14024
|
+
"div",
|
|
14025
|
+
{
|
|
14026
|
+
className: cn(
|
|
14027
|
+
"opacity-70 flex items-center gap-2",
|
|
14028
|
+
agendaOnly ? "text-sm" : "text-xs"
|
|
14029
|
+
),
|
|
14030
|
+
children: event.location && /* @__PURE__ */ jsxs60("span", { className: "opacity-80 flex items-center gap-1", children: [
|
|
14031
|
+
"-",
|
|
14032
|
+
/* @__PURE__ */ jsx80("span", { className: "truncate", children: event.location })
|
|
14033
|
+
] })
|
|
14034
|
+
}
|
|
14035
|
+
),
|
|
14036
|
+
event.description && /* @__PURE__ */ jsx80(
|
|
14037
|
+
"div",
|
|
14038
|
+
{
|
|
14039
|
+
className: cn(
|
|
14040
|
+
"my-1 opacity-90",
|
|
14041
|
+
agendaOnly ? "text-sm" : "text-xs"
|
|
14042
|
+
),
|
|
14043
|
+
style: {
|
|
14044
|
+
display: "-webkit-box",
|
|
14045
|
+
WebkitLineClamp: 2,
|
|
14046
|
+
WebkitBoxOrient: "vertical",
|
|
14047
|
+
overflow: "hidden"
|
|
14048
|
+
},
|
|
14049
|
+
children: event.description
|
|
14050
|
+
}
|
|
14051
|
+
)
|
|
14052
|
+
]
|
|
14053
|
+
}
|
|
14054
|
+
);
|
|
14055
|
+
}
|
|
13838
14056
|
return /* @__PURE__ */ jsxs60(
|
|
13839
14057
|
"button",
|
|
13840
14058
|
{
|
|
13841
14059
|
className: cn(
|
|
13842
14060
|
"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
|
-
|
|
14061
|
+
colorClasses,
|
|
13844
14062
|
className
|
|
13845
14063
|
),
|
|
13846
14064
|
"data-past-event": isPast(displayEnd) || void 0,
|
|
@@ -13852,23 +14070,32 @@ function EventItem({
|
|
|
13852
14070
|
...dndListeners,
|
|
13853
14071
|
...dndAttributes,
|
|
13854
14072
|
children: [
|
|
13855
|
-
/* @__PURE__ */ jsx80("div", { className: "font-medium text-sm", children: event.title }),
|
|
13856
|
-
/* @__PURE__ */ jsxs60(
|
|
13857
|
-
|
|
13858
|
-
|
|
13859
|
-
|
|
13860
|
-
|
|
13861
|
-
|
|
13862
|
-
|
|
13863
|
-
|
|
13864
|
-
|
|
13865
|
-
|
|
13866
|
-
|
|
13867
|
-
|
|
14073
|
+
/* @__PURE__ */ jsx80("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
|
|
14074
|
+
/* @__PURE__ */ jsxs60(
|
|
14075
|
+
"div",
|
|
14076
|
+
{
|
|
14077
|
+
className: cn(
|
|
14078
|
+
"opacity-70 flex items-center gap-2",
|
|
14079
|
+
agendaOnly ? "text-sm" : "text-xs"
|
|
14080
|
+
),
|
|
14081
|
+
children: [
|
|
14082
|
+
event.allDay ? /* @__PURE__ */ jsx80("span", { className: "uppercase", children: "All day" }) : /* @__PURE__ */ jsxs60("span", { className: "uppercase", children: [
|
|
14083
|
+
formatTimeWithOptionalMinutes(displayStart),
|
|
14084
|
+
" -",
|
|
14085
|
+
" ",
|
|
14086
|
+
formatTimeWithOptionalMinutes(displayEnd)
|
|
14087
|
+
] }),
|
|
14088
|
+
event.location && /* @__PURE__ */ jsxs60("span", { className: "opacity-80 flex items-center gap-1", children: [
|
|
14089
|
+
"-",
|
|
14090
|
+
/* @__PURE__ */ jsx80("span", { className: "truncate", children: event.location })
|
|
14091
|
+
] })
|
|
14092
|
+
]
|
|
14093
|
+
}
|
|
14094
|
+
),
|
|
13868
14095
|
event.description && /* @__PURE__ */ jsx80(
|
|
13869
14096
|
"div",
|
|
13870
14097
|
{
|
|
13871
|
-
className: "my-1 text-
|
|
14098
|
+
className: cn("my-1 opacity-90", agendaOnly ? "text-sm" : "text-xs"),
|
|
13872
14099
|
style: {
|
|
13873
14100
|
display: "-webkit-box",
|
|
13874
14101
|
WebkitLineClamp: 2,
|
|
@@ -13921,7 +14148,7 @@ function EventsPopup({
|
|
|
13921
14148
|
};
|
|
13922
14149
|
}, [onClose]);
|
|
13923
14150
|
const handleEventClick = (event) => {
|
|
13924
|
-
onEventSelect(event);
|
|
14151
|
+
if (onEventSelect) onEventSelect(event);
|
|
13925
14152
|
onClose();
|
|
13926
14153
|
};
|
|
13927
14154
|
const adjustedPosition = useMemo14(() => {
|
|
@@ -13977,18 +14204,20 @@ function EventsPopup({
|
|
|
13977
14204
|
const eventEnd = new Date(event.end);
|
|
13978
14205
|
const isFirstDay = isSameDay2(date, eventStart);
|
|
13979
14206
|
const isLastDay = isSameDay2(date, eventEnd);
|
|
14207
|
+
const clickable = Boolean(onEventSelect);
|
|
13980
14208
|
return /* @__PURE__ */ jsx81(
|
|
13981
14209
|
"div",
|
|
13982
14210
|
{
|
|
13983
|
-
className: "cursor-pointer",
|
|
13984
|
-
onClick: () => handleEventClick(event),
|
|
14211
|
+
className: clickable ? "cursor-pointer" : "cursor-default",
|
|
14212
|
+
onClick: clickable ? () => handleEventClick(event) : void 0,
|
|
13985
14213
|
children: /* @__PURE__ */ jsx81(
|
|
13986
14214
|
EventItem,
|
|
13987
14215
|
{
|
|
13988
14216
|
event,
|
|
13989
14217
|
isFirstDay,
|
|
13990
14218
|
isLastDay,
|
|
13991
|
-
view: "agenda"
|
|
14219
|
+
view: "agenda",
|
|
14220
|
+
className: clickable ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
|
|
13992
14221
|
}
|
|
13993
14222
|
)
|
|
13994
14223
|
},
|
|
@@ -14315,6 +14544,7 @@ function MonthView({
|
|
|
14315
14544
|
|
|
14316
14545
|
// src/components/event-calendar/utils.ts
|
|
14317
14546
|
import { isSameDay as isSameDay5 } from "date-fns";
|
|
14547
|
+
import { addHours as addHours2 } from "date-fns";
|
|
14318
14548
|
function getEventColorClasses(color) {
|
|
14319
14549
|
const eventColor = color || "sky";
|
|
14320
14550
|
switch (eventColor) {
|
|
@@ -14347,15 +14577,16 @@ function getBorderRadiusClasses(isFirstDay, isLastDay) {
|
|
|
14347
14577
|
return "rounded-none";
|
|
14348
14578
|
}
|
|
14349
14579
|
function isMultiDayEvent(event) {
|
|
14350
|
-
const eventStart = new Date(event.start);
|
|
14351
|
-
const eventEnd = new Date(event.end);
|
|
14580
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14581
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14582
|
+
if (!eventStart || !eventEnd) return !!event.allDay;
|
|
14352
14583
|
return event.allDay || eventStart.getDate() !== eventEnd.getDate();
|
|
14353
14584
|
}
|
|
14354
14585
|
function getEventsForDay(events, day) {
|
|
14355
14586
|
return events.filter((event) => {
|
|
14356
|
-
const eventStart = new Date(event.start);
|
|
14357
|
-
return isSameDay5(day, eventStart);
|
|
14358
|
-
}).sort((a, b) =>
|
|
14587
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
|
|
14588
|
+
return eventStart ? isSameDay5(day, eventStart) : false;
|
|
14589
|
+
}).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
|
|
14359
14590
|
}
|
|
14360
14591
|
function sortEvents(events) {
|
|
14361
14592
|
return [...events].sort((a, b) => {
|
|
@@ -14363,30 +14594,47 @@ function sortEvents(events) {
|
|
|
14363
14594
|
const bIsMultiDay = isMultiDayEvent(b);
|
|
14364
14595
|
if (aIsMultiDay && !bIsMultiDay) return -1;
|
|
14365
14596
|
if (!aIsMultiDay && bIsMultiDay) return 1;
|
|
14366
|
-
return
|
|
14597
|
+
return getEventStartTimestamp(a) - getEventStartTimestamp(b);
|
|
14367
14598
|
});
|
|
14368
14599
|
}
|
|
14369
14600
|
function getSpanningEventsForDay(events, day) {
|
|
14370
14601
|
return events.filter((event) => {
|
|
14371
14602
|
if (!isMultiDayEvent(event)) return false;
|
|
14372
|
-
const eventStart = new Date(event.start);
|
|
14373
|
-
const eventEnd = new Date(event.end);
|
|
14603
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14604
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14605
|
+
if (!eventStart || !eventEnd) return false;
|
|
14374
14606
|
return !isSameDay5(day, eventStart) && (isSameDay5(day, eventEnd) || day > eventStart && day < eventEnd);
|
|
14375
14607
|
});
|
|
14376
14608
|
}
|
|
14377
14609
|
function getAllEventsForDay(events, day) {
|
|
14378
14610
|
return events.filter((event) => {
|
|
14379
|
-
const eventStart = new Date(event.start);
|
|
14380
|
-
const eventEnd = new Date(event.end);
|
|
14381
|
-
|
|
14611
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
|
|
14612
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
|
|
14613
|
+
if (!eventStart) return false;
|
|
14614
|
+
return isSameDay5(day, eventStart) || (eventEnd ? isSameDay5(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
14382
14615
|
});
|
|
14383
14616
|
}
|
|
14384
14617
|
function getAgendaEventsForDay(events, day) {
|
|
14385
14618
|
return events.filter((event) => {
|
|
14386
|
-
const eventStart = new Date(event.start);
|
|
14387
|
-
const eventEnd = new Date(event.end);
|
|
14388
|
-
|
|
14389
|
-
|
|
14619
|
+
const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
|
|
14620
|
+
const eventEnd = isValidDate2(event.end) ? new Date(event.end) : isValidDate2(event.attend_date) ? addHours2(new Date(event.attend_date), 1) : void 0;
|
|
14621
|
+
if (!eventStart) return false;
|
|
14622
|
+
return isSameDay5(day, eventStart) || (eventEnd ? isSameDay5(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
|
|
14623
|
+
}).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
|
|
14624
|
+
}
|
|
14625
|
+
function isValidDate2(d) {
|
|
14626
|
+
try {
|
|
14627
|
+
const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
|
|
14628
|
+
return !isNaN(t);
|
|
14629
|
+
} catch {
|
|
14630
|
+
return false;
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14633
|
+
function getEventStartTimestamp(e) {
|
|
14634
|
+
if (isValidDate2(e.start)) return new Date(e.start).getTime();
|
|
14635
|
+
if (isValidDate2(e.attend_date))
|
|
14636
|
+
return new Date(e.attend_date).getTime();
|
|
14637
|
+
return Number.MAX_SAFE_INTEGER;
|
|
14390
14638
|
}
|
|
14391
14639
|
function addHoursToDate(date, hours) {
|
|
14392
14640
|
const result = new Date(date);
|
|
@@ -14396,7 +14644,7 @@ function addHoursToDate(date, hours) {
|
|
|
14396
14644
|
|
|
14397
14645
|
// src/components/event-calendar/WeekView.tsx
|
|
14398
14646
|
import {
|
|
14399
|
-
addHours as
|
|
14647
|
+
addHours as addHours3,
|
|
14400
14648
|
areIntervalsOverlapping as areIntervalsOverlapping2,
|
|
14401
14649
|
differenceInMinutes as differenceInMinutes4,
|
|
14402
14650
|
eachDayOfInterval as eachDayOfInterval2,
|
|
@@ -14432,8 +14680,8 @@ function WeekView({
|
|
|
14432
14680
|
const hours = useMemo17(() => {
|
|
14433
14681
|
const dayStart = startOfDay2(currentDate);
|
|
14434
14682
|
return eachHourOfInterval2({
|
|
14435
|
-
end:
|
|
14436
|
-
start:
|
|
14683
|
+
end: addHours3(dayStart, EndHour - 1),
|
|
14684
|
+
start: addHours3(dayStart, StartHour)
|
|
14437
14685
|
});
|
|
14438
14686
|
}, [currentDate]);
|
|
14439
14687
|
const allDayEvents = useMemo17(() => {
|
|
@@ -14473,7 +14721,7 @@ function WeekView({
|
|
|
14473
14721
|
const eventStart = new Date(event.start);
|
|
14474
14722
|
const eventEnd = new Date(event.end);
|
|
14475
14723
|
const adjustedStart = isSameDay6(day, eventStart) ? eventStart : dayStart;
|
|
14476
|
-
const adjustedEnd = isSameDay6(day, eventEnd) ? eventEnd :
|
|
14724
|
+
const adjustedEnd = isSameDay6(day, eventEnd) ? eventEnd : addHours3(dayStart, 24);
|
|
14477
14725
|
const startHour = getHours2(adjustedStart) + getMinutes2(adjustedStart) / 60;
|
|
14478
14726
|
const endHour = getHours2(adjustedEnd) + getMinutes2(adjustedEnd) / 60;
|
|
14479
14727
|
const top = (startHour - StartHour) * WeekCellsHeight;
|
|
@@ -14842,14 +15090,335 @@ function CheckboxTree({ tree, renderNode }) {
|
|
|
14842
15090
|
return renderTreeNode(tree);
|
|
14843
15091
|
}
|
|
14844
15092
|
|
|
15093
|
+
// src/components/selects/MultiSelectBase.tsx
|
|
15094
|
+
import { CaretUpDownIcon as CaretUpDownIcon2, CheckIcon as CheckIcon12, XIcon as XIcon12 } from "@phosphor-icons/react";
|
|
15095
|
+
import {
|
|
15096
|
+
createContext as createContext6,
|
|
15097
|
+
useCallback as useCallback15,
|
|
15098
|
+
useContext as useContext7,
|
|
15099
|
+
useEffect as useEffect25,
|
|
15100
|
+
useRef as useRef14,
|
|
15101
|
+
useState as useState30
|
|
15102
|
+
} from "react";
|
|
15103
|
+
import { motion as motion19 } from "framer-motion";
|
|
15104
|
+
import { Fragment as Fragment13, jsx as jsx85, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
15105
|
+
var MultiSelectContext = createContext6(null);
|
|
15106
|
+
function MultiSelectBase({
|
|
15107
|
+
children,
|
|
15108
|
+
values,
|
|
15109
|
+
defaultValues,
|
|
15110
|
+
onValuesChange,
|
|
15111
|
+
disabled,
|
|
15112
|
+
empty,
|
|
15113
|
+
error
|
|
15114
|
+
}) {
|
|
15115
|
+
const [open, setOpen] = useState30(false);
|
|
15116
|
+
const [internalValues, setInternalValues] = useState30(
|
|
15117
|
+
new Set(values ?? defaultValues)
|
|
15118
|
+
);
|
|
15119
|
+
const selectedValues = values ? new Set(values) : internalValues;
|
|
15120
|
+
const [items, setItems] = useState30(/* @__PURE__ */ new Map());
|
|
15121
|
+
function toggleValue(value) {
|
|
15122
|
+
if (disabled) return;
|
|
15123
|
+
const getNewSet = (prev) => {
|
|
15124
|
+
const newSet = new Set(prev);
|
|
15125
|
+
if (newSet.has(value)) {
|
|
15126
|
+
newSet.delete(value);
|
|
15127
|
+
} else {
|
|
15128
|
+
newSet.add(value);
|
|
15129
|
+
}
|
|
15130
|
+
return newSet;
|
|
15131
|
+
};
|
|
15132
|
+
setInternalValues(getNewSet);
|
|
15133
|
+
onValuesChange?.([...getNewSet(selectedValues)]);
|
|
15134
|
+
}
|
|
15135
|
+
const onItemAdded = useCallback15((value, label) => {
|
|
15136
|
+
setItems((prev) => {
|
|
15137
|
+
if (prev.get(value) === label) return prev;
|
|
15138
|
+
return new Map(prev).set(value, label);
|
|
15139
|
+
});
|
|
15140
|
+
}, []);
|
|
15141
|
+
return /* @__PURE__ */ jsx85(
|
|
15142
|
+
MultiSelectContext.Provider,
|
|
15143
|
+
{
|
|
15144
|
+
value: {
|
|
15145
|
+
open,
|
|
15146
|
+
setOpen,
|
|
15147
|
+
selectedValues,
|
|
15148
|
+
toggleValue,
|
|
15149
|
+
items,
|
|
15150
|
+
onItemAdded,
|
|
15151
|
+
disabled,
|
|
15152
|
+
emptyMessage: empty,
|
|
15153
|
+
error
|
|
15154
|
+
},
|
|
15155
|
+
children: /* @__PURE__ */ jsx85(
|
|
15156
|
+
PopoverBase,
|
|
15157
|
+
{
|
|
15158
|
+
open,
|
|
15159
|
+
onOpenChange: (v) => !disabled && setOpen(v),
|
|
15160
|
+
modal: true,
|
|
15161
|
+
children
|
|
15162
|
+
}
|
|
15163
|
+
)
|
|
15164
|
+
}
|
|
15165
|
+
);
|
|
15166
|
+
}
|
|
15167
|
+
function MultiSelectTriggerBase({
|
|
15168
|
+
className,
|
|
15169
|
+
children,
|
|
15170
|
+
error: propError,
|
|
15171
|
+
...props
|
|
15172
|
+
}) {
|
|
15173
|
+
const { open, disabled, error: contextError } = useMultiSelectContext();
|
|
15174
|
+
const error = propError ?? contextError;
|
|
15175
|
+
return /* @__PURE__ */ jsxs65("div", { className: cn("w-full", error && "mb-0"), children: [
|
|
15176
|
+
/* @__PURE__ */ jsx85(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs65(
|
|
15177
|
+
ButtonBase,
|
|
15178
|
+
{
|
|
15179
|
+
...props,
|
|
15180
|
+
variant: props.variant ?? "outline",
|
|
15181
|
+
role: props.role ?? "combobox",
|
|
15182
|
+
"aria-expanded": props["aria-expanded"] ?? open,
|
|
15183
|
+
"aria-disabled": disabled || void 0,
|
|
15184
|
+
disabled,
|
|
15185
|
+
className: cn(
|
|
15186
|
+
"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]",
|
|
15187
|
+
error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring",
|
|
15188
|
+
className
|
|
15189
|
+
),
|
|
15190
|
+
children: [
|
|
15191
|
+
children,
|
|
15192
|
+
/* @__PURE__ */ jsx85(CaretUpDownIcon2, { className: "size-4 shrink-0 opacity-50" })
|
|
15193
|
+
]
|
|
15194
|
+
}
|
|
15195
|
+
) }),
|
|
15196
|
+
error ? /* @__PURE__ */ jsx85(ErrorMessage_default, { error }) : null
|
|
15197
|
+
] });
|
|
15198
|
+
}
|
|
15199
|
+
function MultiSelectValueBase({
|
|
15200
|
+
placeholder,
|
|
15201
|
+
clickToRemove = true,
|
|
15202
|
+
className,
|
|
15203
|
+
overflowBehavior = "wrap-when-open",
|
|
15204
|
+
...props
|
|
15205
|
+
}) {
|
|
15206
|
+
const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
|
|
15207
|
+
const [overflowAmount, setOverflowAmount] = useState30(0);
|
|
15208
|
+
const valueRef = useRef14(null);
|
|
15209
|
+
const overflowRef = useRef14(null);
|
|
15210
|
+
const mutationObserverRef = useRef14(null);
|
|
15211
|
+
const resizeObserverRef = useRef14(null);
|
|
15212
|
+
const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
|
|
15213
|
+
const checkOverflow = useCallback15(() => {
|
|
15214
|
+
if (valueRef.current == null) return;
|
|
15215
|
+
const containerElement = valueRef.current;
|
|
15216
|
+
const overflowElement = overflowRef.current;
|
|
15217
|
+
const items2 = containerElement.querySelectorAll(
|
|
15218
|
+
"[data-selected-item]"
|
|
15219
|
+
);
|
|
15220
|
+
if (overflowElement != null) overflowElement.style.display = "none";
|
|
15221
|
+
items2.forEach((child) => child.style.removeProperty("display"));
|
|
15222
|
+
let amount = 0;
|
|
15223
|
+
for (let i = items2.length - 1; i >= 0; i--) {
|
|
15224
|
+
const child = items2[i];
|
|
15225
|
+
if (containerElement.scrollWidth <= containerElement.clientWidth) {
|
|
15226
|
+
break;
|
|
15227
|
+
}
|
|
15228
|
+
amount = items2.length - i;
|
|
15229
|
+
child.style.display = "none";
|
|
15230
|
+
overflowElement?.style.removeProperty("display");
|
|
15231
|
+
}
|
|
15232
|
+
setOverflowAmount(amount);
|
|
15233
|
+
}, []);
|
|
15234
|
+
const handleResize = useCallback15(
|
|
15235
|
+
(node) => {
|
|
15236
|
+
if (node == null) {
|
|
15237
|
+
valueRef.current = null;
|
|
15238
|
+
if (resizeObserverRef.current) {
|
|
15239
|
+
resizeObserverRef.current.disconnect();
|
|
15240
|
+
resizeObserverRef.current = null;
|
|
15241
|
+
}
|
|
15242
|
+
if (mutationObserverRef.current) {
|
|
15243
|
+
mutationObserverRef.current.disconnect();
|
|
15244
|
+
mutationObserverRef.current = null;
|
|
15245
|
+
}
|
|
15246
|
+
return;
|
|
15247
|
+
}
|
|
15248
|
+
valueRef.current = node;
|
|
15249
|
+
if (resizeObserverRef.current) {
|
|
15250
|
+
resizeObserverRef.current.disconnect();
|
|
15251
|
+
resizeObserverRef.current = null;
|
|
15252
|
+
}
|
|
15253
|
+
if (mutationObserverRef.current) {
|
|
15254
|
+
mutationObserverRef.current.disconnect();
|
|
15255
|
+
mutationObserverRef.current = null;
|
|
15256
|
+
}
|
|
15257
|
+
const mo = new MutationObserver(checkOverflow);
|
|
15258
|
+
const ro = new ResizeObserver(debounce(checkOverflow, 100));
|
|
15259
|
+
mutationObserverRef.current = mo;
|
|
15260
|
+
resizeObserverRef.current = ro;
|
|
15261
|
+
mo.observe(node, {
|
|
15262
|
+
childList: true,
|
|
15263
|
+
attributes: true,
|
|
15264
|
+
attributeFilter: ["class", "style"]
|
|
15265
|
+
});
|
|
15266
|
+
ro.observe(node);
|
|
15267
|
+
checkOverflow();
|
|
15268
|
+
},
|
|
15269
|
+
[checkOverflow]
|
|
15270
|
+
);
|
|
15271
|
+
if (selectedValues.size === 0 && placeholder) {
|
|
15272
|
+
return /* @__PURE__ */ jsx85("span", { className: "min-w-0 overflow-hidden font-normal text-muted-foreground ", children: placeholder });
|
|
15273
|
+
}
|
|
15274
|
+
return /* @__PURE__ */ jsxs65(
|
|
15275
|
+
"div",
|
|
15276
|
+
{
|
|
15277
|
+
...props,
|
|
15278
|
+
ref: handleResize,
|
|
15279
|
+
className: cn(
|
|
15280
|
+
"flex w-full gap-1.5 overflow-hidden",
|
|
15281
|
+
shouldWrap && "h-full flex-wrap",
|
|
15282
|
+
className
|
|
15283
|
+
),
|
|
15284
|
+
children: [
|
|
15285
|
+
[...selectedValues].filter((value) => items.has(value)).map((value) => /* @__PURE__ */ jsxs65(
|
|
15286
|
+
Badge,
|
|
15287
|
+
{
|
|
15288
|
+
"data-selected-item": true,
|
|
15289
|
+
size: "sm",
|
|
15290
|
+
className: "group flex items-center gap-1",
|
|
15291
|
+
onClick: clickToRemove ? (e) => {
|
|
15292
|
+
e.stopPropagation();
|
|
15293
|
+
toggleValue(value);
|
|
15294
|
+
} : void 0,
|
|
15295
|
+
children: [
|
|
15296
|
+
items.get(value),
|
|
15297
|
+
clickToRemove && /* @__PURE__ */ jsx85(XIcon12, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
|
|
15298
|
+
]
|
|
15299
|
+
},
|
|
15300
|
+
value
|
|
15301
|
+
)),
|
|
15302
|
+
/* @__PURE__ */ jsxs65(
|
|
15303
|
+
Badge,
|
|
15304
|
+
{
|
|
15305
|
+
style: {
|
|
15306
|
+
display: overflowAmount > 0 && !shouldWrap ? "block" : "none"
|
|
15307
|
+
},
|
|
15308
|
+
ref: overflowRef,
|
|
15309
|
+
children: [
|
|
15310
|
+
"+",
|
|
15311
|
+
overflowAmount
|
|
15312
|
+
]
|
|
15313
|
+
}
|
|
15314
|
+
)
|
|
15315
|
+
]
|
|
15316
|
+
}
|
|
15317
|
+
);
|
|
15318
|
+
}
|
|
15319
|
+
function MultiSelectContentBase({
|
|
15320
|
+
search = true,
|
|
15321
|
+
children,
|
|
15322
|
+
...props
|
|
15323
|
+
}) {
|
|
15324
|
+
const canSearch = typeof search === "object" ? true : search;
|
|
15325
|
+
const { emptyMessage } = useMultiSelectContext();
|
|
15326
|
+
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(
|
|
15327
|
+
motion19.div,
|
|
15328
|
+
{
|
|
15329
|
+
initial: { opacity: 0, scale: 0.95 },
|
|
15330
|
+
animate: { opacity: 1, scale: 1 },
|
|
15331
|
+
exit: { opacity: 0, scale: 0.95 },
|
|
15332
|
+
transition: { duration: 0.2 },
|
|
15333
|
+
children: /* @__PURE__ */ jsx85("div", { className: cn(" "), children: /* @__PURE__ */ jsxs65(CommandBase, { ...props, children: [
|
|
15334
|
+
canSearch ? /* @__PURE__ */ jsx85(
|
|
15335
|
+
CommandInputBase,
|
|
15336
|
+
{
|
|
15337
|
+
placeholder: typeof search === "object" ? search.placeholder : void 0
|
|
15338
|
+
}
|
|
15339
|
+
) : /* @__PURE__ */ jsx85("button", { autoFocus: true, className: "sr-only" }),
|
|
15340
|
+
/* @__PURE__ */ jsxs65(CommandListBase, { children: [
|
|
15341
|
+
canSearch && /* @__PURE__ */ jsx85(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
|
|
15342
|
+
children
|
|
15343
|
+
] })
|
|
15344
|
+
] }) })
|
|
15345
|
+
}
|
|
15346
|
+
) }) });
|
|
15347
|
+
}
|
|
15348
|
+
function MultiSelectItemBase({
|
|
15349
|
+
value,
|
|
15350
|
+
children,
|
|
15351
|
+
badgeLabel,
|
|
15352
|
+
onSelect,
|
|
15353
|
+
...props
|
|
15354
|
+
}) {
|
|
15355
|
+
const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
|
|
15356
|
+
const isSelected = selectedValues.has(value);
|
|
15357
|
+
useEffect25(() => {
|
|
15358
|
+
onItemAdded(value, badgeLabel ?? children);
|
|
15359
|
+
}, [value, children, onItemAdded, badgeLabel]);
|
|
15360
|
+
return /* @__PURE__ */ jsx85(
|
|
15361
|
+
CommandItemBase,
|
|
15362
|
+
{
|
|
15363
|
+
...props,
|
|
15364
|
+
onSelect: () => {
|
|
15365
|
+
toggleValue(value);
|
|
15366
|
+
onSelect?.(value);
|
|
15367
|
+
},
|
|
15368
|
+
children: /* @__PURE__ */ jsxs65(
|
|
15369
|
+
motion19.div,
|
|
15370
|
+
{
|
|
15371
|
+
whileHover: { scale: 1.02 },
|
|
15372
|
+
whileTap: { scale: 0.98 },
|
|
15373
|
+
transition: { duration: 0.1 },
|
|
15374
|
+
children: [
|
|
15375
|
+
/* @__PURE__ */ jsx85("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx85(
|
|
15376
|
+
motion19.div,
|
|
15377
|
+
{
|
|
15378
|
+
initial: { scale: 0 },
|
|
15379
|
+
animate: { scale: isSelected ? 1 : 0 },
|
|
15380
|
+
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
15381
|
+
children: /* @__PURE__ */ jsx85(CheckIcon12, { className: "size-4" })
|
|
15382
|
+
}
|
|
15383
|
+
) }),
|
|
15384
|
+
children
|
|
15385
|
+
]
|
|
15386
|
+
}
|
|
15387
|
+
)
|
|
15388
|
+
}
|
|
15389
|
+
);
|
|
15390
|
+
}
|
|
15391
|
+
function MultiSelectGroupBase(props) {
|
|
15392
|
+
return /* @__PURE__ */ jsx85(CommandGroupBase, { ...props });
|
|
15393
|
+
}
|
|
15394
|
+
function MultiSelectSeparatorBase(props) {
|
|
15395
|
+
return /* @__PURE__ */ jsx85(CommandSeparatorBase, { ...props });
|
|
15396
|
+
}
|
|
15397
|
+
function useMultiSelectContext() {
|
|
15398
|
+
const context = useContext7(MultiSelectContext);
|
|
15399
|
+
if (context == null) {
|
|
15400
|
+
throw new Error(
|
|
15401
|
+
"useMultiSelectContext must be used within a MultiSelectContext"
|
|
15402
|
+
);
|
|
15403
|
+
}
|
|
15404
|
+
return context;
|
|
15405
|
+
}
|
|
15406
|
+
function debounce(func, wait) {
|
|
15407
|
+
let timeout = null;
|
|
15408
|
+
return function(...args) {
|
|
15409
|
+
if (timeout) clearTimeout(timeout);
|
|
15410
|
+
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
15411
|
+
};
|
|
15412
|
+
}
|
|
15413
|
+
|
|
14845
15414
|
// src/hooks/use-drag.tsx
|
|
14846
|
-
import { useState as
|
|
15415
|
+
import { useState as useState31, useCallback as useCallback16, useRef as useRef15, useEffect as useEffect26 } from "react";
|
|
14847
15416
|
var useDrag = (options = {}) => {
|
|
14848
|
-
const [isDragging, setIsDragging] =
|
|
14849
|
-
const [positions, setPositions] =
|
|
14850
|
-
const dragStartPos =
|
|
14851
|
-
const dragId =
|
|
14852
|
-
const handleMouseDown =
|
|
15417
|
+
const [isDragging, setIsDragging] = useState31(null);
|
|
15418
|
+
const [positions, setPositions] = useState31({});
|
|
15419
|
+
const dragStartPos = useRef15(null);
|
|
15420
|
+
const dragId = useRef15(null);
|
|
15421
|
+
const handleMouseDown = useCallback16((id, e) => {
|
|
14853
15422
|
e.preventDefault();
|
|
14854
15423
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
14855
15424
|
dragStartPos.current = {
|
|
@@ -14862,7 +15431,7 @@ var useDrag = (options = {}) => {
|
|
|
14862
15431
|
setIsDragging(id);
|
|
14863
15432
|
options.onDragStart?.(id);
|
|
14864
15433
|
}, [positions, options]);
|
|
14865
|
-
const handleMouseMove =
|
|
15434
|
+
const handleMouseMove = useCallback16((e) => {
|
|
14866
15435
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
14867
15436
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
14868
15437
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -14878,7 +15447,7 @@ var useDrag = (options = {}) => {
|
|
|
14878
15447
|
}));
|
|
14879
15448
|
options.onDrag?.(dragId.current, newPosition);
|
|
14880
15449
|
}, [isDragging, options]);
|
|
14881
|
-
const handleMouseUp =
|
|
15450
|
+
const handleMouseUp = useCallback16(() => {
|
|
14882
15451
|
if (dragId.current) {
|
|
14883
15452
|
options.onDragEnd?.(dragId.current);
|
|
14884
15453
|
}
|
|
@@ -14886,7 +15455,7 @@ var useDrag = (options = {}) => {
|
|
|
14886
15455
|
dragStartPos.current = null;
|
|
14887
15456
|
dragId.current = null;
|
|
14888
15457
|
}, [options]);
|
|
14889
|
-
|
|
15458
|
+
useEffect26(() => {
|
|
14890
15459
|
if (isDragging) {
|
|
14891
15460
|
document.addEventListener("mousemove", handleMouseMove);
|
|
14892
15461
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -14898,16 +15467,16 @@ var useDrag = (options = {}) => {
|
|
|
14898
15467
|
};
|
|
14899
15468
|
}
|
|
14900
15469
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
14901
|
-
const setPosition =
|
|
15470
|
+
const setPosition = useCallback16((id, position) => {
|
|
14902
15471
|
setPositions((prev) => ({
|
|
14903
15472
|
...prev,
|
|
14904
15473
|
[id]: position
|
|
14905
15474
|
}));
|
|
14906
15475
|
}, []);
|
|
14907
|
-
const getPosition =
|
|
15476
|
+
const getPosition = useCallback16((id) => {
|
|
14908
15477
|
return positions[id] || { top: 0, left: 0 };
|
|
14909
15478
|
}, [positions]);
|
|
14910
|
-
const isElementDragging =
|
|
15479
|
+
const isElementDragging = useCallback16((id) => {
|
|
14911
15480
|
return isDragging === id;
|
|
14912
15481
|
}, [isDragging]);
|
|
14913
15482
|
return {
|
|
@@ -15085,6 +15654,13 @@ export {
|
|
|
15085
15654
|
MonthView,
|
|
15086
15655
|
MoreButton,
|
|
15087
15656
|
MultiCombobox,
|
|
15657
|
+
MultiSelectBase,
|
|
15658
|
+
MultiSelectContentBase,
|
|
15659
|
+
MultiSelectGroupBase,
|
|
15660
|
+
MultiSelectItemBase,
|
|
15661
|
+
MultiSelectSeparatorBase,
|
|
15662
|
+
MultiSelectTriggerBase,
|
|
15663
|
+
MultiSelectValueBase,
|
|
15088
15664
|
NavigationMenuBase,
|
|
15089
15665
|
NavigationMenuContentBase,
|
|
15090
15666
|
NavigationMenuIndicatorBase,
|