@mlw-packages/react-components 1.5.8 → 1.5.9
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 +88 -38
- package/dist/index.d.mts +18 -2
- package/dist/index.d.ts +18 -2
- package/dist/index.js +433 -230
- package/dist/index.mjs +444 -241
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -734,19 +734,19 @@ var import_react_slot = require("@radix-ui/react-slot");
|
|
|
734
734
|
var import_class_variance_authority = require("class-variance-authority");
|
|
735
735
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
736
736
|
var buttonVariantsBase = (0, import_class_variance_authority.cva)(
|
|
737
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
737
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive active:scale-95",
|
|
738
738
|
{
|
|
739
739
|
variants: {
|
|
740
740
|
variant: {
|
|
741
741
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
742
742
|
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
743
|
-
outline: "bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-
|
|
743
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-background dark:border-input dark:hover:bg-background/95",
|
|
744
744
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
745
745
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
746
746
|
link: "text-primary underline-offset-4 hover:underline"
|
|
747
747
|
},
|
|
748
748
|
size: {
|
|
749
|
-
default: "
|
|
749
|
+
default: "h-9 py-2 px-4 has-[>svg]:px-3",
|
|
750
750
|
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
751
751
|
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
752
752
|
icon: "size-9"
|
|
@@ -2372,7 +2372,7 @@ var InputBase = React12.forwardRef(
|
|
|
2372
2372
|
"div",
|
|
2373
2373
|
{
|
|
2374
2374
|
className: cn(
|
|
2375
|
-
"flex items-center rounded-md transition focus-within:ring-1 focus-within:ring-ring focus-within:border-ring bg-background overflow-hidden",
|
|
2375
|
+
"flex items-center rounded-md transition h-9 focus-within:ring-1 focus-within:ring-ring focus-within:border-ring bg-background overflow-hidden",
|
|
2376
2376
|
type !== "file" && "border border-input"
|
|
2377
2377
|
),
|
|
2378
2378
|
children: [
|
|
@@ -2382,7 +2382,7 @@ var InputBase = React12.forwardRef(
|
|
|
2382
2382
|
{
|
|
2383
2383
|
type,
|
|
2384
2384
|
className: cn(
|
|
2385
|
-
"w-full flex-1 text-sm
|
|
2385
|
+
"w-full flex-1 text-sm p-1.5 px-3 focus:outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 bg-background text-foreground",
|
|
2386
2386
|
className
|
|
2387
2387
|
),
|
|
2388
2388
|
ref,
|
|
@@ -2457,7 +2457,7 @@ function ComboboxBase({
|
|
|
2457
2457
|
role: "combobox",
|
|
2458
2458
|
"aria-expanded": open,
|
|
2459
2459
|
className: cn(
|
|
2460
|
-
"flex items-start gap-2 justify-between
|
|
2460
|
+
"flex items-start gap-2 justify-between",
|
|
2461
2461
|
errorMessage && "border-red-500"
|
|
2462
2462
|
),
|
|
2463
2463
|
"data-testid": testIds.trigger ?? "combobox-trigger",
|
|
@@ -3128,34 +3128,78 @@ function NavigationMenuIndicatorBase({
|
|
|
3128
3128
|
var React17 = __toESM(require("react"));
|
|
3129
3129
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"));
|
|
3130
3130
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3131
|
-
var ProgressBase = React17.forwardRef(
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3131
|
+
var ProgressBase = React17.forwardRef(
|
|
3132
|
+
({
|
|
3133
|
+
className,
|
|
3134
|
+
value,
|
|
3135
|
+
label,
|
|
3136
|
+
leftIcon,
|
|
3137
|
+
rightIcon,
|
|
3138
|
+
variant = "bar",
|
|
3139
|
+
segments = 5,
|
|
3140
|
+
steps = [],
|
|
3141
|
+
currentStep = 0,
|
|
3142
|
+
...props
|
|
3143
|
+
}, ref) => {
|
|
3144
|
+
switch (variant) {
|
|
3145
|
+
case "segments":
|
|
3146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3147
|
+
ProgressSegmentsBase,
|
|
3148
|
+
{
|
|
3149
|
+
label,
|
|
3150
|
+
segments,
|
|
3151
|
+
value: value || 0
|
|
3152
|
+
}
|
|
3153
|
+
);
|
|
3154
|
+
case "panels":
|
|
3155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3156
|
+
ProgressPanelsBase,
|
|
3157
|
+
{
|
|
3158
|
+
label,
|
|
3159
|
+
steps,
|
|
3160
|
+
currentStep
|
|
3161
|
+
}
|
|
3162
|
+
);
|
|
3163
|
+
case "circles":
|
|
3164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3165
|
+
ProgressCirclesBase,
|
|
3166
|
+
{
|
|
3167
|
+
label,
|
|
3168
|
+
steps,
|
|
3169
|
+
currentStep
|
|
3170
|
+
}
|
|
3171
|
+
);
|
|
3172
|
+
case "bar":
|
|
3173
|
+
default:
|
|
3174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
|
|
3175
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LabelBase_default, { className: "py-2", children: label }),
|
|
3176
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3177
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-center", children: leftIcon }),
|
|
3178
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3179
|
+
ProgressPrimitive.Root,
|
|
3180
|
+
{
|
|
3181
|
+
ref,
|
|
3182
|
+
className: cn(
|
|
3183
|
+
"relative h-3 w-full overflow-hidden rounded-full bg-zinc-200 dark:bg-zinc-800 shadow-inner transition-all",
|
|
3184
|
+
className
|
|
3185
|
+
),
|
|
3186
|
+
value,
|
|
3187
|
+
...props,
|
|
3188
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3189
|
+
ProgressPrimitive.Indicator,
|
|
3190
|
+
{
|
|
3191
|
+
className: "h-full w-full flex-1 bg-primary transition-all duration-500 ease-in-out",
|
|
3192
|
+
style: { transform: `translateX(-${100 - (value || 0)}%)` }
|
|
3193
|
+
}
|
|
3194
|
+
)
|
|
3195
|
+
}
|
|
3196
|
+
),
|
|
3197
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-center", children: rightIcon })
|
|
3198
|
+
] })
|
|
3199
|
+
] });
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
);
|
|
3159
3203
|
ProgressBase.displayName = "ProgressBase";
|
|
3160
3204
|
var ProgressSegmentsBase = ({
|
|
3161
3205
|
label,
|
|
@@ -4458,7 +4502,8 @@ var TabsListBase = React27.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4458
4502
|
{
|
|
4459
4503
|
ref,
|
|
4460
4504
|
className: cn(
|
|
4461
|
-
"relative flex w-full items-center justify-start gap-
|
|
4505
|
+
"relative flex w-full items-center justify-start gap-2 border-b border-border",
|
|
4506
|
+
"bg-transparent",
|
|
4462
4507
|
className
|
|
4463
4508
|
),
|
|
4464
4509
|
...props
|
|
@@ -4470,13 +4515,15 @@ var TabsTriggerBase = React27.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4470
4515
|
{
|
|
4471
4516
|
ref,
|
|
4472
4517
|
className: cn(
|
|
4473
|
-
"relative inline-flex items-center justify-center whitespace-nowrap px-
|
|
4474
|
-
"
|
|
4518
|
+
"relative inline-flex items-center justify-center whitespace-nowrap px-4 py-2 text-sm font-medium",
|
|
4519
|
+
"text-muted-foreground hover:text-foreground",
|
|
4520
|
+
"transition-colors duration-300 ease-in-out",
|
|
4521
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
4475
4522
|
"disabled:pointer-events-none disabled:opacity-50",
|
|
4476
4523
|
"data-[state=active]:text-primary",
|
|
4477
|
-
"after:absolute after:bottom-0 after:left-0 after:h-[
|
|
4524
|
+
"after:absolute after:bottom-0 after:left-0 after:h-[2px] after:w-full",
|
|
4478
4525
|
"after:scale-x-0 after:bg-primary after:origin-left",
|
|
4479
|
-
"after:transition-transform after:duration-
|
|
4526
|
+
"after:transition-transform after:duration-500 after:ease-[cubic-bezier(0.34,1.56,0.64,1)]",
|
|
4480
4527
|
"data-[state=active]:after:scale-x-100",
|
|
4481
4528
|
className
|
|
4482
4529
|
),
|
|
@@ -4488,8 +4535,8 @@ var TabsContentBase = React27.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4488
4535
|
{
|
|
4489
4536
|
ref,
|
|
4490
4537
|
className: cn(
|
|
4491
|
-
"mt-
|
|
4492
|
-
"animate-fade-in",
|
|
4538
|
+
"mt-4 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
4539
|
+
"animate-in fade-in-0 duration-500 ease-in-out",
|
|
4493
4540
|
className
|
|
4494
4541
|
),
|
|
4495
4542
|
...props
|
|
@@ -4499,41 +4546,198 @@ TabsContentBase.displayName = TabsPrimitive.Content.displayName;
|
|
|
4499
4546
|
|
|
4500
4547
|
// src/components/ui/TextAreaBase.tsx
|
|
4501
4548
|
var React28 = __toESM(require("react"));
|
|
4549
|
+
var import_framer_motion6 = require("framer-motion");
|
|
4550
|
+
var import_react23 = require("@phosphor-icons/react");
|
|
4502
4551
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4503
|
-
var TextAreaBase = React28.forwardRef(
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4552
|
+
var TextAreaBase = React28.forwardRef(
|
|
4553
|
+
({ className, clearable = false, onClear, ...props }, ref) => {
|
|
4554
|
+
const [isFocused, setIsFocused] = React28.useState(false);
|
|
4555
|
+
const [hasContent, setHasContent] = React28.useState(
|
|
4556
|
+
!!props.value || !!props.defaultValue
|
|
4557
|
+
);
|
|
4558
|
+
const [showConfirmTooltip, setShowConfirmTooltip] = React28.useState(false);
|
|
4559
|
+
const textareaRef = React28.useRef(null);
|
|
4560
|
+
const handleFocus = (e) => {
|
|
4561
|
+
setIsFocused(true);
|
|
4562
|
+
props.onFocus?.(e);
|
|
4563
|
+
};
|
|
4564
|
+
const handleBlur = (e) => {
|
|
4565
|
+
setIsFocused(false);
|
|
4566
|
+
props.onBlur?.(e);
|
|
4567
|
+
};
|
|
4568
|
+
const handleChange = (e) => {
|
|
4569
|
+
setHasContent(e.target.value.length > 0);
|
|
4570
|
+
props.onChange?.(e);
|
|
4571
|
+
};
|
|
4572
|
+
const handleClearClick = () => {
|
|
4573
|
+
setShowConfirmTooltip(true);
|
|
4574
|
+
};
|
|
4575
|
+
const handleConfirmClear = () => {
|
|
4576
|
+
if (textareaRef.current) {
|
|
4577
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
4578
|
+
window.HTMLTextAreaElement.prototype,
|
|
4579
|
+
"value"
|
|
4580
|
+
)?.set;
|
|
4581
|
+
if (nativeInputValueSetter) {
|
|
4582
|
+
nativeInputValueSetter.call(textareaRef.current, "");
|
|
4583
|
+
const event = new Event("input", { bubbles: true });
|
|
4584
|
+
textareaRef.current.dispatchEvent(event);
|
|
4585
|
+
}
|
|
4586
|
+
setHasContent(false);
|
|
4587
|
+
setShowConfirmTooltip(false);
|
|
4588
|
+
textareaRef.current.focus();
|
|
4589
|
+
onClear?.();
|
|
4590
|
+
}
|
|
4591
|
+
};
|
|
4592
|
+
const handleCancelClear = () => {
|
|
4593
|
+
setShowConfirmTooltip(false);
|
|
4594
|
+
};
|
|
4595
|
+
React28.useImperativeHandle(ref, () => textareaRef.current);
|
|
4596
|
+
React28.useEffect(() => {
|
|
4597
|
+
setHasContent(!!props.value || !!props.defaultValue);
|
|
4598
|
+
}, [props.value, props.defaultValue]);
|
|
4599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "relative", children: [
|
|
4600
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4601
|
+
"textarea",
|
|
4602
|
+
{
|
|
4603
|
+
className: cn(
|
|
4604
|
+
"peer flex min-h-[80px] min-w-[200px] w-full rounded-lg border border-input bg-background/50 backdrop-blur-sm",
|
|
4605
|
+
"px-4 py-3 text-base shadow-sm placeholder:text-muted-foreground/60",
|
|
4606
|
+
"transition-all duration-300 ease-out",
|
|
4607
|
+
"hover:border-input/80 hover:shadow-md",
|
|
4608
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/30 focus-visible:border-ring",
|
|
4609
|
+
"focus-visible:shadow-lg focus-visible:bg-background",
|
|
4610
|
+
"disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted/30",
|
|
4611
|
+
"resize",
|
|
4612
|
+
"md:text-sm",
|
|
4613
|
+
clearable && hasContent && "pr-10",
|
|
4614
|
+
className
|
|
4615
|
+
),
|
|
4616
|
+
ref: textareaRef,
|
|
4617
|
+
onFocus: handleFocus,
|
|
4618
|
+
onBlur: handleBlur,
|
|
4619
|
+
onChange: handleChange,
|
|
4620
|
+
...props
|
|
4621
|
+
}
|
|
4510
4622
|
),
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4623
|
+
clearable && hasContent && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipProviderBase, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4624
|
+
TooltipBase,
|
|
4625
|
+
{
|
|
4626
|
+
open: showConfirmTooltip,
|
|
4627
|
+
onOpenChange: setShowConfirmTooltip,
|
|
4628
|
+
children: [
|
|
4629
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(TooltipTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4630
|
+
import_framer_motion6.motion.button,
|
|
4631
|
+
{
|
|
4632
|
+
type: "button",
|
|
4633
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
4634
|
+
animate: { opacity: 1, scale: 1 },
|
|
4635
|
+
exit: { opacity: 0, scale: 0.8 },
|
|
4636
|
+
transition: { duration: 0.2 },
|
|
4637
|
+
onClick: handleClearClick,
|
|
4638
|
+
className: cn(
|
|
4639
|
+
"absolute top-3 right-3 p-1.5 rounded-md",
|
|
4640
|
+
"text-muted-foreground/50 hover:text-destructive hover:bg-destructive/10",
|
|
4641
|
+
"transition-all duration-200",
|
|
4642
|
+
"focus:outline-none focus:ring-2 focus:ring-destructive/30",
|
|
4643
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
4644
|
+
),
|
|
4645
|
+
disabled: props.disabled,
|
|
4646
|
+
"aria-label": "Limpar texto",
|
|
4647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react23.TrashIcon, { size: 16, weight: "regular" })
|
|
4648
|
+
}
|
|
4649
|
+
) }),
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4651
|
+
TooltipContentBase,
|
|
4652
|
+
{
|
|
4653
|
+
side: "left",
|
|
4654
|
+
className: "bg-background border border-border shadow-lg p-3 flex flex-col gap-2",
|
|
4655
|
+
children: [
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-sm text-foreground font-medium mb-1", children: "Limpar todo o texto?" }),
|
|
4657
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-2", children: [
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4659
|
+
"button",
|
|
4660
|
+
{
|
|
4661
|
+
type: "button",
|
|
4662
|
+
onClick: handleConfirmClear,
|
|
4663
|
+
className: cn(
|
|
4664
|
+
"px-3 py-1.5 text-xs rounded-md font-medium",
|
|
4665
|
+
"bg-destructive text-destructive-foreground",
|
|
4666
|
+
"hover:bg-destructive/90",
|
|
4667
|
+
"transition-colors"
|
|
4668
|
+
),
|
|
4669
|
+
children: "Confirmar"
|
|
4670
|
+
}
|
|
4671
|
+
),
|
|
4672
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4673
|
+
"button",
|
|
4674
|
+
{
|
|
4675
|
+
type: "button",
|
|
4676
|
+
onClick: handleCancelClear,
|
|
4677
|
+
className: cn(
|
|
4678
|
+
"px-3 py-1.5 text-xs rounded-md font-medium",
|
|
4679
|
+
"bg-secondary text-secondary-foreground",
|
|
4680
|
+
"hover:bg-secondary/80",
|
|
4681
|
+
"transition-colors"
|
|
4682
|
+
),
|
|
4683
|
+
children: "Cancelar"
|
|
4684
|
+
}
|
|
4685
|
+
)
|
|
4686
|
+
] })
|
|
4687
|
+
]
|
|
4688
|
+
}
|
|
4689
|
+
)
|
|
4690
|
+
]
|
|
4691
|
+
}
|
|
4692
|
+
) }),
|
|
4693
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4694
|
+
import_framer_motion6.motion.div,
|
|
4695
|
+
{
|
|
4696
|
+
className: "pointer-events-none absolute inset-0 rounded-lg",
|
|
4697
|
+
initial: { opacity: 0 },
|
|
4698
|
+
animate: { opacity: isFocused ? 1 : 0 },
|
|
4699
|
+
transition: { duration: 0.3 },
|
|
4700
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "absolute inset-0 rounded-lg bg-gradient-to-r from-ring/20 via-ring/10 to-ring/20 blur-sm" })
|
|
4701
|
+
}
|
|
4702
|
+
),
|
|
4703
|
+
isFocused && hasContent && props.maxLength && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4704
|
+
import_framer_motion6.motion.div,
|
|
4705
|
+
{
|
|
4706
|
+
initial: { opacity: 0, y: -10 },
|
|
4707
|
+
animate: { opacity: 1, y: 0 },
|
|
4708
|
+
exit: { opacity: 0, y: -10 },
|
|
4709
|
+
className: "absolute bottom-2 right-3 text-xs text-muted-foreground/70 font-medium",
|
|
4710
|
+
children: [
|
|
4711
|
+
props.value?.length || 0,
|
|
4712
|
+
" / ",
|
|
4713
|
+
props.maxLength
|
|
4714
|
+
]
|
|
4715
|
+
}
|
|
4716
|
+
)
|
|
4717
|
+
] });
|
|
4718
|
+
}
|
|
4719
|
+
);
|
|
4516
4720
|
TextAreaBase.displayName = "TextAreaBase";
|
|
4517
4721
|
|
|
4518
4722
|
// src/components/mode-toggle.tsx
|
|
4519
|
-
var
|
|
4723
|
+
var import_react25 = require("@phosphor-icons/react");
|
|
4520
4724
|
|
|
4521
4725
|
// src/components/theme-provider.tsx
|
|
4522
|
-
var
|
|
4726
|
+
var import_react24 = require("react");
|
|
4523
4727
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4524
4728
|
var initialState = {
|
|
4525
4729
|
theme: "system",
|
|
4526
4730
|
setTheme: () => null
|
|
4527
4731
|
};
|
|
4528
|
-
var ThemeProviderContext = (0,
|
|
4732
|
+
var ThemeProviderContext = (0, import_react24.createContext)(initialState);
|
|
4529
4733
|
function ThemeProviderBase({
|
|
4530
4734
|
children,
|
|
4531
4735
|
defaultTheme = "system",
|
|
4532
4736
|
storageKey = "app-ui-theme",
|
|
4533
4737
|
...props
|
|
4534
4738
|
}) {
|
|
4535
|
-
const [theme, setThemeState] = (0,
|
|
4536
|
-
(0,
|
|
4739
|
+
const [theme, setThemeState] = (0, import_react24.useState)(defaultTheme);
|
|
4740
|
+
(0, import_react24.useEffect)(() => {
|
|
4537
4741
|
const root = window.document.documentElement;
|
|
4538
4742
|
root.classList.remove(
|
|
4539
4743
|
"light",
|
|
@@ -4559,7 +4763,7 @@ function ThemeProviderBase({
|
|
|
4559
4763
|
document.body.style.color = "";
|
|
4560
4764
|
}
|
|
4561
4765
|
}, [theme]);
|
|
4562
|
-
(0,
|
|
4766
|
+
(0, import_react24.useEffect)(() => {
|
|
4563
4767
|
const stored = localStorage.getItem(storageKey);
|
|
4564
4768
|
if (stored) setThemeState(stored);
|
|
4565
4769
|
}, [storageKey]);
|
|
@@ -4573,7 +4777,7 @@ function ThemeProviderBase({
|
|
|
4573
4777
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThemeProviderContext.Provider, { ...props, value, children });
|
|
4574
4778
|
}
|
|
4575
4779
|
var useTheme = () => {
|
|
4576
|
-
const context = (0,
|
|
4780
|
+
const context = (0, import_react24.useContext)(ThemeProviderContext);
|
|
4577
4781
|
if (context === void 0)
|
|
4578
4782
|
throw new Error("useTheme must be used within a ThemeProvider");
|
|
4579
4783
|
return context;
|
|
@@ -4606,8 +4810,8 @@ function ModeToggleBase({
|
|
|
4606
4810
|
className: "relative overflow-hidden border-transparent",
|
|
4607
4811
|
children: [
|
|
4608
4812
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
4609
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4610
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4813
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react25.SunIcon, { className: `h-[1.2rem] w-[1.2rem] transition-transform duration-300 ${isDark ? "rotate-90 scale-0" : "rotate-0 scale-100"}` }),
|
|
4814
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react25.MoonIcon, { className: `absolute h-[1.2rem] w-[1.2rem] transition-transform duration-300 ${isDark ? "rotate-0 scale-100" : "rotate-90 scale-0"}` })
|
|
4611
4815
|
] }),
|
|
4612
4816
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "sr-only", children: "Toggle theme" })
|
|
4613
4817
|
]
|
|
@@ -4620,7 +4824,7 @@ function ModeToggleBase({
|
|
|
4620
4824
|
className: "flex items-center justify-between hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
|
|
4621
4825
|
children: [
|
|
4622
4826
|
themeLabels[theme],
|
|
4623
|
-
currentTheme === theme && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4827
|
+
currentTheme === theme && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react25.CheckIcon, { className: "h-4 w-4 opacity-100" })
|
|
4624
4828
|
]
|
|
4625
4829
|
},
|
|
4626
4830
|
theme
|
|
@@ -4630,7 +4834,7 @@ function ModeToggleBase({
|
|
|
4630
4834
|
|
|
4631
4835
|
// src/components/ui/DestructiveDialog.tsx
|
|
4632
4836
|
var React29 = __toESM(require("react"));
|
|
4633
|
-
var
|
|
4837
|
+
var import_react26 = require("@phosphor-icons/react");
|
|
4634
4838
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4635
4839
|
var DestructiveDialog = ({
|
|
4636
4840
|
title,
|
|
@@ -4655,7 +4859,7 @@ var DestructiveDialog = ({
|
|
|
4655
4859
|
className: cn("border border-destructive bg-background"),
|
|
4656
4860
|
children: [
|
|
4657
4861
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-start gap-4", children: [
|
|
4658
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex items-center justify-center w-10 h-10 rounded-full ring-1 ring-destructive/30", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex items-center justify-center w-10 h-10 rounded-full ring-1 ring-destructive/30", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react26.XCircleIcon, { className: "w-6 h-6 text-destructive" }) }),
|
|
4659
4863
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex-1", children: [
|
|
4660
4864
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
4661
4865
|
AlertDialogTitleBase,
|
|
@@ -4710,8 +4914,8 @@ var import_date_fns = require("date-fns");
|
|
|
4710
4914
|
// src/components/date-time-picker/calendar.tsx
|
|
4711
4915
|
var React30 = __toESM(require("react"));
|
|
4712
4916
|
var import_react_day_picker2 = require("react-day-picker");
|
|
4713
|
-
var
|
|
4714
|
-
var
|
|
4917
|
+
var import_react27 = require("@phosphor-icons/react");
|
|
4918
|
+
var import_framer_motion7 = require("framer-motion");
|
|
4715
4919
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
4716
4920
|
function CalendarBase2({
|
|
4717
4921
|
className,
|
|
@@ -4733,10 +4937,10 @@ function CalendarBase2({
|
|
|
4733
4937
|
"div",
|
|
4734
4938
|
{
|
|
4735
4939
|
className: cn(
|
|
4736
|
-
"rounded-
|
|
4940
|
+
"rounded-md border bg-background p-4 shadow-lg overflow-hidden w-full h-full flex flex-col",
|
|
4737
4941
|
className
|
|
4738
4942
|
),
|
|
4739
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_framer_motion7.AnimatePresence, { initial: false, mode: "wait", custom: direction, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4740
4944
|
"div",
|
|
4741
4945
|
{
|
|
4742
4946
|
className: "w-full h-full flex flex-col",
|
|
@@ -4789,8 +4993,8 @@ function CalendarBase2({
|
|
|
4789
4993
|
...classNames
|
|
4790
4994
|
},
|
|
4791
4995
|
components: {
|
|
4792
|
-
IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4793
|
-
IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4996
|
+
IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react27.CaretLeftIcon, { className: "h-4 w-4" }),
|
|
4997
|
+
IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react27.CaretRightIcon, { className: "h-4 w-4" })
|
|
4794
4998
|
},
|
|
4795
4999
|
...props
|
|
4796
5000
|
}
|
|
@@ -4805,15 +5009,15 @@ CalendarBase2.displayName = "CalendarBase";
|
|
|
4805
5009
|
|
|
4806
5010
|
// src/components/date-time-picker/DateTimePicker.tsx
|
|
4807
5011
|
var import_locale = require("date-fns/locale");
|
|
4808
|
-
var
|
|
5012
|
+
var import_react30 = require("react");
|
|
4809
5013
|
|
|
4810
5014
|
// src/components/date-time-picker/TimePicker.tsx
|
|
4811
|
-
var
|
|
5015
|
+
var import_framer_motion8 = require("framer-motion");
|
|
4812
5016
|
var React32 = __toESM(require("react"));
|
|
4813
5017
|
|
|
4814
5018
|
// src/components/date-time-picker/TimePickerInput.tsx
|
|
4815
|
-
var
|
|
4816
|
-
var
|
|
5019
|
+
var import_react28 = require("@phosphor-icons/react");
|
|
5020
|
+
var import_react29 = __toESM(require("react"));
|
|
4817
5021
|
|
|
4818
5022
|
// src/components/date-time-picker/time-picker-utils.ts
|
|
4819
5023
|
function isValidHour(value) {
|
|
@@ -4956,7 +5160,7 @@ function display12HourValue(hours) {
|
|
|
4956
5160
|
|
|
4957
5161
|
// src/components/date-time-picker/TimePickerInput.tsx
|
|
4958
5162
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
4959
|
-
var TimePickerInput =
|
|
5163
|
+
var TimePickerInput = import_react29.default.forwardRef(
|
|
4960
5164
|
({
|
|
4961
5165
|
className,
|
|
4962
5166
|
type = "tel",
|
|
@@ -4975,10 +5179,10 @@ var TimePickerInput = import_react28.default.forwardRef(
|
|
|
4975
5179
|
label,
|
|
4976
5180
|
...props
|
|
4977
5181
|
}, ref) => {
|
|
4978
|
-
const [flag, setFlag] =
|
|
4979
|
-
const [prevIntKey, setPrevIntKey] =
|
|
4980
|
-
const [isFocused, setIsFocused] =
|
|
4981
|
-
|
|
5182
|
+
const [flag, setFlag] = import_react29.default.useState(false);
|
|
5183
|
+
const [prevIntKey, setPrevIntKey] = import_react29.default.useState("0");
|
|
5184
|
+
const [isFocused, setIsFocused] = import_react29.default.useState(false);
|
|
5185
|
+
import_react29.default.useEffect(() => {
|
|
4982
5186
|
if (flag) {
|
|
4983
5187
|
const timer = setTimeout(() => {
|
|
4984
5188
|
setFlag(false);
|
|
@@ -4986,7 +5190,7 @@ var TimePickerInput = import_react28.default.forwardRef(
|
|
|
4986
5190
|
return () => clearTimeout(timer);
|
|
4987
5191
|
}
|
|
4988
5192
|
}, [flag]);
|
|
4989
|
-
const calculatedValue =
|
|
5193
|
+
const calculatedValue = import_react29.default.useMemo(() => {
|
|
4990
5194
|
return getDateByType(date, picker);
|
|
4991
5195
|
}, [date, picker]);
|
|
4992
5196
|
const calculateNewValue = (key) => {
|
|
@@ -5075,7 +5279,7 @@ var TimePickerInput = import_react28.default.forwardRef(
|
|
|
5075
5279
|
),
|
|
5076
5280
|
tabIndex: -1,
|
|
5077
5281
|
"aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
|
|
5078
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react28.CaretUpIcon, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
5079
5283
|
}
|
|
5080
5284
|
),
|
|
5081
5285
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "relative", children: [
|
|
@@ -5142,7 +5346,7 @@ var TimePickerInput = import_react28.default.forwardRef(
|
|
|
5142
5346
|
),
|
|
5143
5347
|
tabIndex: -1,
|
|
5144
5348
|
"aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
|
|
5145
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react28.CaretDownIcon, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
5146
5350
|
}
|
|
5147
5351
|
)
|
|
5148
5352
|
]
|
|
@@ -5180,7 +5384,7 @@ function TimePicker({
|
|
|
5180
5384
|
visible: { opacity: 1, y: 0 }
|
|
5181
5385
|
};
|
|
5182
5386
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
5183
|
-
|
|
5387
|
+
import_framer_motion8.motion.div,
|
|
5184
5388
|
{
|
|
5185
5389
|
variants: containerVariants,
|
|
5186
5390
|
initial: "hidden",
|
|
@@ -5188,7 +5392,7 @@ function TimePicker({
|
|
|
5188
5392
|
className: "flex items-end justify-center gap-2 sm:gap-3 p-2 sm:p-3 md:p-4 rounded-lg bg-muted/20 border border-border/50 w-full max-w-full overflow-hidden",
|
|
5189
5393
|
children: [
|
|
5190
5394
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5191
|
-
|
|
5395
|
+
import_framer_motion8.motion.div,
|
|
5192
5396
|
{
|
|
5193
5397
|
variants: itemVariants2,
|
|
5194
5398
|
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
@@ -5206,7 +5410,7 @@ function TimePicker({
|
|
|
5206
5410
|
}
|
|
5207
5411
|
),
|
|
5208
5412
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5209
|
-
|
|
5413
|
+
import_framer_motion8.motion.div,
|
|
5210
5414
|
{
|
|
5211
5415
|
variants: itemVariants2,
|
|
5212
5416
|
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
@@ -5224,8 +5428,8 @@ function TimePicker({
|
|
|
5224
5428
|
)
|
|
5225
5429
|
}
|
|
5226
5430
|
),
|
|
5227
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5228
|
-
|
|
5431
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_framer_motion8.AnimatePresence, { children: !hideSeconds && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5432
|
+
import_framer_motion8.motion.div,
|
|
5229
5433
|
{
|
|
5230
5434
|
variants: itemVariants2,
|
|
5231
5435
|
initial: "hidden",
|
|
@@ -5251,7 +5455,7 @@ function TimePicker({
|
|
|
5251
5455
|
}
|
|
5252
5456
|
|
|
5253
5457
|
// src/components/date-time-picker/DateTimePicker.tsx
|
|
5254
|
-
var
|
|
5458
|
+
var import_react31 = require("@phosphor-icons/react");
|
|
5255
5459
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5256
5460
|
function DateTimePicker({
|
|
5257
5461
|
label,
|
|
@@ -5265,9 +5469,9 @@ function DateTimePicker({
|
|
|
5265
5469
|
disabled,
|
|
5266
5470
|
className
|
|
5267
5471
|
}) {
|
|
5268
|
-
const [internalDate, setInternalDate] = (0,
|
|
5269
|
-
const [open, setOpen] = (0,
|
|
5270
|
-
const [timePickerOpen, setTimePickerOpen] = (0,
|
|
5472
|
+
const [internalDate, setInternalDate] = (0, import_react30.useState)(date);
|
|
5473
|
+
const [open, setOpen] = (0, import_react30.useState)(false);
|
|
5474
|
+
const [timePickerOpen, setTimePickerOpen] = (0, import_react30.useState)(false);
|
|
5271
5475
|
const handleSelect = (newDay) => {
|
|
5272
5476
|
if (!newDay) return;
|
|
5273
5477
|
if (!internalDate) {
|
|
@@ -5296,7 +5500,7 @@ function DateTimePicker({
|
|
|
5296
5500
|
if (!timeFormat) return "PPP";
|
|
5297
5501
|
return `PPP - ${timeFormat}`;
|
|
5298
5502
|
};
|
|
5299
|
-
(0,
|
|
5503
|
+
(0, import_react30.useEffect)(() => {
|
|
5300
5504
|
if (date) {
|
|
5301
5505
|
setInternalDate(date);
|
|
5302
5506
|
}
|
|
@@ -5308,16 +5512,15 @@ function DateTimePicker({
|
|
|
5308
5512
|
ButtonBase,
|
|
5309
5513
|
{
|
|
5310
5514
|
variant: "outline",
|
|
5311
|
-
size: "lg",
|
|
5312
5515
|
className: cn(
|
|
5313
5516
|
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
5314
|
-
"
|
|
5517
|
+
"",
|
|
5315
5518
|
"text-sm sm:text-base",
|
|
5316
5519
|
!date && "text-muted-foreground"
|
|
5317
5520
|
),
|
|
5318
5521
|
children: [
|
|
5319
5522
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "truncate flex-1", children: date ? (0, import_date_fns.format)(date, getDisplayFormat(), { locale: import_locale.ptBR }) : "Pick a date" }),
|
|
5320
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5523
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react31.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
5321
5524
|
]
|
|
5322
5525
|
}
|
|
5323
5526
|
) }),
|
|
@@ -5360,13 +5563,13 @@ function DateTimePicker({
|
|
|
5360
5563
|
"px-2 sm:px-3 py-1.5 sm:py-2",
|
|
5361
5564
|
"text-sm sm:text-base font-semibold w-full max-w-xs",
|
|
5362
5565
|
"border-2 border-primary/20 rounded-lg",
|
|
5363
|
-
"bg-
|
|
5566
|
+
"bg-background hover:bg-primary/10 hover:border-primary/30",
|
|
5364
5567
|
"transition-all duration-200",
|
|
5365
5568
|
"shadow-sm hover:shadow-md active:scale-[0.98]",
|
|
5366
5569
|
"min-h-[36px] sm:min-h-[40px]"
|
|
5367
5570
|
),
|
|
5368
5571
|
children: [
|
|
5369
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react31.ClockIcon, { className: "text-primary flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
|
|
5370
5573
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "text-foreground truncate", children: internalDate ? (0, import_date_fns.format)(internalDate, getTimeFormat() || "HH:mm", {
|
|
5371
5574
|
locale: import_locale.ptBR
|
|
5372
5575
|
}) : "00:00" })
|
|
@@ -5477,7 +5680,7 @@ function Select({
|
|
|
5477
5680
|
}
|
|
5478
5681
|
|
|
5479
5682
|
// src/components/charts/Chart.tsx
|
|
5480
|
-
var
|
|
5683
|
+
var import_react36 = require("react");
|
|
5481
5684
|
var import_recharts = require("recharts");
|
|
5482
5685
|
|
|
5483
5686
|
// src/components/charts/utils/helpers.ts
|
|
@@ -5624,8 +5827,8 @@ var resolveChartMargins = (margins, chartMargins, showLabels) => {
|
|
|
5624
5827
|
var import_sonner2 = require("sonner");
|
|
5625
5828
|
|
|
5626
5829
|
// src/components/charts/components/controls/PeriodsDropdown.tsx
|
|
5627
|
-
var
|
|
5628
|
-
var
|
|
5830
|
+
var import_react32 = require("react");
|
|
5831
|
+
var import_framer_motion9 = require("framer-motion");
|
|
5629
5832
|
var import_ssr = require("@phosphor-icons/react/dist/ssr");
|
|
5630
5833
|
var import_ssr2 = require("@phosphor-icons/react/dist/ssr");
|
|
5631
5834
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
@@ -5647,11 +5850,11 @@ function PeriodsDropdown({
|
|
|
5647
5850
|
activePeriods
|
|
5648
5851
|
}) {
|
|
5649
5852
|
const periods = processedData.map((d) => String(d.name));
|
|
5650
|
-
const [open, setOpen] = (0,
|
|
5651
|
-
const wrapperRef = (0,
|
|
5652
|
-
const firstItemRef = (0,
|
|
5653
|
-
const listRef = (0,
|
|
5654
|
-
(0,
|
|
5853
|
+
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
5854
|
+
const wrapperRef = (0, import_react32.useRef)(null);
|
|
5855
|
+
const firstItemRef = (0, import_react32.useRef)(null);
|
|
5856
|
+
const listRef = (0, import_react32.useRef)(null);
|
|
5857
|
+
(0, import_react32.useEffect)(() => {
|
|
5655
5858
|
const handleClickOutside = (e) => {
|
|
5656
5859
|
if (!wrapperRef.current) return;
|
|
5657
5860
|
if (!wrapperRef.current.contains(e.target)) setOpen(false);
|
|
@@ -5666,7 +5869,7 @@ function PeriodsDropdown({
|
|
|
5666
5869
|
document.removeEventListener("keydown", handleEscape);
|
|
5667
5870
|
};
|
|
5668
5871
|
}, []);
|
|
5669
|
-
(0,
|
|
5872
|
+
(0, import_react32.useEffect)(() => {
|
|
5670
5873
|
if (open && firstItemRef.current) {
|
|
5671
5874
|
firstItemRef.current.focus();
|
|
5672
5875
|
}
|
|
@@ -5700,8 +5903,8 @@ function PeriodsDropdown({
|
|
|
5700
5903
|
]
|
|
5701
5904
|
}
|
|
5702
5905
|
),
|
|
5703
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5704
|
-
|
|
5906
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_framer_motion9.AnimatePresence, { children: open && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5907
|
+
import_framer_motion9.motion.div,
|
|
5705
5908
|
{
|
|
5706
5909
|
initial: "hidden",
|
|
5707
5910
|
animate: "visible",
|
|
@@ -5730,7 +5933,7 @@ function PeriodsDropdown({
|
|
|
5730
5933
|
className: "flex flex-col p-2 gap-1",
|
|
5731
5934
|
style: { maxHeight: 200, overflowY: "auto" },
|
|
5732
5935
|
children: periods.map((p, idx) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
5733
|
-
|
|
5936
|
+
import_framer_motion9.motion.button,
|
|
5734
5937
|
{
|
|
5735
5938
|
className: "flex items-center justify-between w-full text-left px-3 py-2.5 rounded focus:outline-none transition-colors " + (activePeriods && activePeriods.includes(p) || p === activePeriod ? "bg-accent/10 font-medium" : "hover:bg-accent/15 focus-visible:ring-2 focus-visible:ring-accent/30"),
|
|
5736
5939
|
variants: itemVariants,
|
|
@@ -5758,8 +5961,8 @@ function PeriodsDropdown({
|
|
|
5758
5961
|
var PeriodsDropdown_default = PeriodsDropdown;
|
|
5759
5962
|
|
|
5760
5963
|
// src/components/charts/components/controls/ShowOnly.tsx
|
|
5761
|
-
var
|
|
5762
|
-
var
|
|
5964
|
+
var import_framer_motion10 = require("framer-motion");
|
|
5965
|
+
var import_react33 = require("@phosphor-icons/react");
|
|
5763
5966
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5764
5967
|
var ShowOnly = ({
|
|
5765
5968
|
showOnlyHighlighted,
|
|
@@ -5769,7 +5972,7 @@ var ShowOnly = ({
|
|
|
5769
5972
|
const hasHighlights = highlightedSeriesSize > 0;
|
|
5770
5973
|
if (!hasHighlights) return null;
|
|
5771
5974
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5772
|
-
|
|
5975
|
+
import_framer_motion10.motion.div,
|
|
5773
5976
|
{
|
|
5774
5977
|
whileTap: { scale: hasHighlights ? 0.985 : 1 },
|
|
5775
5978
|
whileHover: { y: hasHighlights ? -2 : 0 },
|
|
@@ -5788,10 +5991,10 @@ var ShowOnly = ({
|
|
|
5788
5991
|
!hasHighlights ? "opacity-60 cursor-not-allowed pointer-events-none" : showOnlyHighlighted ? "bg-primary/10 text-primary shadow-sm border border-primary/20" : "bg-transparent text-muted-foreground border border-transparent hover:bg-muted/10 hover:text-foreground"
|
|
5789
5992
|
),
|
|
5790
5993
|
children: showOnlyHighlighted ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5791
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5994
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react33.EyeSlash, { size: 16, weight: "regular" }),
|
|
5792
5995
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sr-only", children: "Exibir todos" })
|
|
5793
5996
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5794
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5997
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react33.Eye, { size: 16, weight: "bold" }),
|
|
5795
5998
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "sr-only", children: "Mostrar somente destacados" })
|
|
5796
5999
|
] })
|
|
5797
6000
|
}
|
|
@@ -5802,7 +6005,7 @@ var ShowOnly = ({
|
|
|
5802
6005
|
var ShowOnly_default = ShowOnly;
|
|
5803
6006
|
|
|
5804
6007
|
// src/components/charts/components/controls/Highlights.tsx
|
|
5805
|
-
var
|
|
6008
|
+
var import_framer_motion11 = require("framer-motion");
|
|
5806
6009
|
var import_ssr3 = require("@phosphor-icons/react/dist/ssr");
|
|
5807
6010
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5808
6011
|
var Highlights = ({
|
|
@@ -5823,13 +6026,13 @@ var Highlights = ({
|
|
|
5823
6026
|
visible: { opacity: 1, transition: { staggerChildren: 0.03 } }
|
|
5824
6027
|
};
|
|
5825
6028
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5826
|
-
|
|
6029
|
+
import_framer_motion11.motion.div,
|
|
5827
6030
|
{
|
|
5828
6031
|
className: "flex-1 flex items-center gap-2 flex-wrap",
|
|
5829
6032
|
initial: "hidden",
|
|
5830
6033
|
animate: "visible",
|
|
5831
6034
|
variants: containerVariants,
|
|
5832
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6035
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_framer_motion11.AnimatePresence, { initial: false, mode: "popLayout", children: allKeys.map((k) => {
|
|
5833
6036
|
const isHighlighted = highlightedSeries.has(k);
|
|
5834
6037
|
const label = mapperConfig[k]?.label ?? k;
|
|
5835
6038
|
const color = finalColors[k];
|
|
@@ -5839,7 +6042,7 @@ var Highlights = ({
|
|
|
5839
6042
|
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"
|
|
5840
6043
|
);
|
|
5841
6044
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5842
|
-
|
|
6045
|
+
import_framer_motion11.motion.div,
|
|
5843
6046
|
{
|
|
5844
6047
|
layout: true,
|
|
5845
6048
|
initial: "hidden",
|
|
@@ -5856,7 +6059,7 @@ var Highlights = ({
|
|
|
5856
6059
|
style: { minWidth: showFullLabel ? void 0 : 36 },
|
|
5857
6060
|
"aria-pressed": isHighlighted,
|
|
5858
6061
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
5859
|
-
|
|
6062
|
+
import_framer_motion11.motion.button,
|
|
5860
6063
|
{
|
|
5861
6064
|
whileHover: { scale: isHighlighted ? 1.04 : 1.03 },
|
|
5862
6065
|
whileTap: { scale: 0.96 },
|
|
@@ -5864,7 +6067,7 @@ var Highlights = ({
|
|
|
5864
6067
|
className: "flex items-center gap-2 min-w-0 pr-2",
|
|
5865
6068
|
children: [
|
|
5866
6069
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5867
|
-
|
|
6070
|
+
import_framer_motion11.motion.span,
|
|
5868
6071
|
{
|
|
5869
6072
|
className: cn("w-3 h-3 rounded-sm flex-shrink-0 border"),
|
|
5870
6073
|
style: {
|
|
@@ -5878,8 +6081,8 @@ var Highlights = ({
|
|
|
5878
6081
|
transition: { type: "spring", stiffness: 400, damping: 30 }
|
|
5879
6082
|
}
|
|
5880
6083
|
),
|
|
5881
|
-
showFullLabel ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5882
|
-
|
|
6084
|
+
showFullLabel ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_framer_motion11.motion.span, { className: "truncate max-w-[10rem] pr-2", layout: true, children: label }) : showShortLabel ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
6085
|
+
import_framer_motion11.motion.span,
|
|
5883
6086
|
{
|
|
5884
6087
|
className: "truncate max-w-[6rem] text-xs pr-2",
|
|
5885
6088
|
layout: true,
|
|
@@ -5887,7 +6090,7 @@ var Highlights = ({
|
|
|
5887
6090
|
}
|
|
5888
6091
|
) : null,
|
|
5889
6092
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5890
|
-
|
|
6093
|
+
import_framer_motion11.motion.span,
|
|
5891
6094
|
{
|
|
5892
6095
|
"aria-hidden": true,
|
|
5893
6096
|
initial: { opacity: 0, scale: 0.6 },
|
|
@@ -5996,9 +6199,9 @@ var CloseAllButton = ({
|
|
|
5996
6199
|
var CloseAllButton_default = CloseAllButton;
|
|
5997
6200
|
|
|
5998
6201
|
// src/components/charts/components/tooltips/DraggableTooltip.tsx
|
|
5999
|
-
var
|
|
6000
|
-
var
|
|
6001
|
-
var
|
|
6202
|
+
var import_react34 = __toESM(require("react"));
|
|
6203
|
+
var import_framer_motion12 = require("framer-motion");
|
|
6204
|
+
var import_react35 = require("@phosphor-icons/react");
|
|
6002
6205
|
var import_ssr5 = require("@phosphor-icons/react/dist/ssr");
|
|
6003
6206
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
6004
6207
|
var ALIGNMENT_THRESHOLD = 25;
|
|
@@ -6075,13 +6278,13 @@ var DraggableTooltipComponent = ({
|
|
|
6075
6278
|
toggleHighlight,
|
|
6076
6279
|
showOnlyHighlighted
|
|
6077
6280
|
}) => {
|
|
6078
|
-
const visibleKeys = (0,
|
|
6281
|
+
const visibleKeys = (0, import_react34.useMemo)(
|
|
6079
6282
|
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
6080
6283
|
[showOnlyHighlighted, highlightedSeries, dataKeys]
|
|
6081
6284
|
);
|
|
6082
|
-
const TotalDisplay =
|
|
6285
|
+
const TotalDisplay = import_react34.default.memo(
|
|
6083
6286
|
({ data: data2, visibleKeys: visibleKeys2 }) => {
|
|
6084
|
-
const total = (0,
|
|
6287
|
+
const total = (0, import_react34.useMemo)(() => {
|
|
6085
6288
|
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
6086
6289
|
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
6087
6290
|
}, [data2, visibleKeys2]);
|
|
@@ -6097,14 +6300,14 @@ var DraggableTooltipComponent = ({
|
|
|
6097
6300
|
] });
|
|
6098
6301
|
}
|
|
6099
6302
|
);
|
|
6100
|
-
const [localPos, setLocalPos] = (0,
|
|
6101
|
-
const [dragging, setDragging] = (0,
|
|
6102
|
-
const offsetRef = (0,
|
|
6103
|
-
const lastMouse = (0,
|
|
6104
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
6105
|
-
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = (0,
|
|
6106
|
-
(0,
|
|
6107
|
-
const getAllTooltips = (0,
|
|
6303
|
+
const [localPos, setLocalPos] = (0, import_react34.useState)(position);
|
|
6304
|
+
const [dragging, setDragging] = (0, import_react34.useState)(false);
|
|
6305
|
+
const offsetRef = (0, import_react34.useRef)({ x: 0, y: 0 });
|
|
6306
|
+
const lastMouse = (0, import_react34.useRef)({ x: 0, y: 0 });
|
|
6307
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react34.useState)([]);
|
|
6308
|
+
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = (0, import_react34.useState)(0);
|
|
6309
|
+
(0, import_react34.useEffect)(() => setLocalPos(position), [position]);
|
|
6310
|
+
const getAllTooltips = (0, import_react34.useCallback)(() => {
|
|
6108
6311
|
const response = [];
|
|
6109
6312
|
const ev = new CustomEvent("requestGlobalTooltips", {
|
|
6110
6313
|
detail: { requesterId: id, response }
|
|
@@ -6112,7 +6315,7 @@ var DraggableTooltipComponent = ({
|
|
|
6112
6315
|
window.dispatchEvent(ev);
|
|
6113
6316
|
return response;
|
|
6114
6317
|
}, [id]);
|
|
6115
|
-
const updateAlignmentGuides = (0,
|
|
6318
|
+
const updateAlignmentGuides = (0, import_react34.useCallback)(
|
|
6116
6319
|
(currentPosition) => {
|
|
6117
6320
|
const allTooltips = getAllTooltips();
|
|
6118
6321
|
const otherTooltips = allTooltips.filter((t) => t.id !== id);
|
|
@@ -6161,7 +6364,7 @@ var DraggableTooltipComponent = ({
|
|
|
6161
6364
|
},
|
|
6162
6365
|
[getAllTooltips, id]
|
|
6163
6366
|
);
|
|
6164
|
-
const snapToGuides = (0,
|
|
6367
|
+
const snapToGuides = (0, import_react34.useCallback)(
|
|
6165
6368
|
(position2) => {
|
|
6166
6369
|
const snappedPosition = { ...position2 };
|
|
6167
6370
|
let hasSnapped = false;
|
|
@@ -6208,7 +6411,7 @@ var DraggableTooltipComponent = ({
|
|
|
6208
6411
|
},
|
|
6209
6412
|
[alignmentGuides]
|
|
6210
6413
|
);
|
|
6211
|
-
(0,
|
|
6414
|
+
(0, import_react34.useEffect)(() => {
|
|
6212
6415
|
let rafId = null;
|
|
6213
6416
|
const handleMouseMove = (e) => {
|
|
6214
6417
|
if (!dragging) return;
|
|
@@ -6250,7 +6453,7 @@ var DraggableTooltipComponent = ({
|
|
|
6250
6453
|
document.body.style.userSelect = "";
|
|
6251
6454
|
};
|
|
6252
6455
|
}, [dragging, snapToGuides, updateAlignmentGuides, id, onPositionChange]);
|
|
6253
|
-
(0,
|
|
6456
|
+
(0, import_react34.useEffect)(() => {
|
|
6254
6457
|
const handleCloseAll = () => onClose(id);
|
|
6255
6458
|
const handleRequestTooltipCount = () => {
|
|
6256
6459
|
window.dispatchEvent(
|
|
@@ -6281,7 +6484,7 @@ var DraggableTooltipComponent = ({
|
|
|
6281
6484
|
});
|
|
6282
6485
|
};
|
|
6283
6486
|
}, [id, localPos, onClose]);
|
|
6284
|
-
(0,
|
|
6487
|
+
(0, import_react34.useEffect)(() => {
|
|
6285
6488
|
if (dragging) return;
|
|
6286
6489
|
let total = 0;
|
|
6287
6490
|
const timeoutId = setTimeout(() => {
|
|
@@ -6299,7 +6502,7 @@ var DraggableTooltipComponent = ({
|
|
|
6299
6502
|
}, 0);
|
|
6300
6503
|
return () => clearTimeout(timeoutId);
|
|
6301
6504
|
}, [localPos, dragging]);
|
|
6302
|
-
(0,
|
|
6505
|
+
(0, import_react34.useEffect)(() => {
|
|
6303
6506
|
const recount = () => {
|
|
6304
6507
|
if (dragging) return;
|
|
6305
6508
|
let total = 0;
|
|
@@ -6317,7 +6520,7 @@ var DraggableTooltipComponent = ({
|
|
|
6317
6520
|
window.addEventListener("recountTooltips", recount);
|
|
6318
6521
|
return () => window.removeEventListener("recountTooltips", recount);
|
|
6319
6522
|
}, [dragging]);
|
|
6320
|
-
const handleMouseDownLocal = (0,
|
|
6523
|
+
const handleMouseDownLocal = (0, import_react34.useCallback)(
|
|
6321
6524
|
(e) => {
|
|
6322
6525
|
e.preventDefault();
|
|
6323
6526
|
e.stopPropagation();
|
|
@@ -6328,7 +6531,7 @@ var DraggableTooltipComponent = ({
|
|
|
6328
6531
|
},
|
|
6329
6532
|
[id, onMouseDown]
|
|
6330
6533
|
);
|
|
6331
|
-
const handleTouchStartLocal = (0,
|
|
6534
|
+
const handleTouchStartLocal = (0, import_react34.useCallback)(
|
|
6332
6535
|
(e) => {
|
|
6333
6536
|
e.stopPropagation();
|
|
6334
6537
|
const touch = e.touches[0];
|
|
@@ -6343,7 +6546,7 @@ var DraggableTooltipComponent = ({
|
|
|
6343
6546
|
},
|
|
6344
6547
|
[id, onMouseDown]
|
|
6345
6548
|
);
|
|
6346
|
-
const handleCloseClick = (0,
|
|
6549
|
+
const handleCloseClick = (0, import_react34.useCallback)(
|
|
6347
6550
|
(e) => {
|
|
6348
6551
|
e.stopPropagation();
|
|
6349
6552
|
onClose(id);
|
|
@@ -6372,7 +6575,7 @@ var DraggableTooltipComponent = ({
|
|
|
6372
6575
|
);
|
|
6373
6576
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { children: [
|
|
6374
6577
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6375
|
-
|
|
6578
|
+
import_framer_motion12.motion.div,
|
|
6376
6579
|
{
|
|
6377
6580
|
className: "fixed pointer-events-none z-30",
|
|
6378
6581
|
variants: guideVariants,
|
|
@@ -6394,7 +6597,7 @@ var DraggableTooltipComponent = ({
|
|
|
6394
6597
|
}
|
|
6395
6598
|
),
|
|
6396
6599
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6397
|
-
|
|
6600
|
+
import_framer_motion12.motion.div,
|
|
6398
6601
|
{
|
|
6399
6602
|
className: "fixed pointer-events-none z-31",
|
|
6400
6603
|
variants: guideDotVariants,
|
|
@@ -6413,7 +6616,7 @@ var DraggableTooltipComponent = ({
|
|
|
6413
6616
|
}
|
|
6414
6617
|
),
|
|
6415
6618
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6416
|
-
|
|
6619
|
+
import_framer_motion12.motion.div,
|
|
6417
6620
|
{
|
|
6418
6621
|
className: "fixed pointer-events-none z-31",
|
|
6419
6622
|
variants: guideDotVariants,
|
|
@@ -6433,8 +6636,8 @@ var DraggableTooltipComponent = ({
|
|
|
6433
6636
|
)
|
|
6434
6637
|
] }, index);
|
|
6435
6638
|
}),
|
|
6436
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6437
|
-
|
|
6639
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_framer_motion12.AnimatePresence, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
6640
|
+
import_framer_motion12.motion.div,
|
|
6438
6641
|
{
|
|
6439
6642
|
className: "fixed bg-card border border-border rounded-lg shadow-lg z-50 min-w-80 select-none",
|
|
6440
6643
|
variants: tooltipVariants,
|
|
@@ -6459,7 +6662,7 @@ var DraggableTooltipComponent = ({
|
|
|
6459
6662
|
onTouchStart: handleTouchStartLocal,
|
|
6460
6663
|
style: { touchAction: "none" },
|
|
6461
6664
|
children: [
|
|
6462
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6665
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react35.DotsSixVerticalIcon, { size: 16 }),
|
|
6463
6666
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex flex-col gap-1", children: title && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-center gap-2 pb-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "font-bold text-foreground text-base", children: title }) }) }),
|
|
6464
6667
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
6465
6668
|
"button",
|
|
@@ -6482,7 +6685,7 @@ var DraggableTooltipComponent = ({
|
|
|
6482
6685
|
] }) }),
|
|
6483
6686
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "p-3 pt-2 space-y-2", children: [
|
|
6484
6687
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
|
|
6485
|
-
(0,
|
|
6688
|
+
(0, import_react34.useMemo)(
|
|
6486
6689
|
() => visibleKeys.map((key) => {
|
|
6487
6690
|
const value = data[key];
|
|
6488
6691
|
if (value === void 0) return null;
|
|
@@ -6592,7 +6795,7 @@ var DraggableTooltipComponent = ({
|
|
|
6592
6795
|
)
|
|
6593
6796
|
] });
|
|
6594
6797
|
};
|
|
6595
|
-
var DraggableTooltip =
|
|
6798
|
+
var DraggableTooltip = import_react34.default.memo(DraggableTooltipComponent);
|
|
6596
6799
|
DraggableTooltip.displayName = "DraggableTooltip";
|
|
6597
6800
|
var DraggableTooltip_default = DraggableTooltip;
|
|
6598
6801
|
|
|
@@ -6888,7 +7091,7 @@ var Chart = ({
|
|
|
6888
7091
|
maxTooltips = 5,
|
|
6889
7092
|
chartMargin
|
|
6890
7093
|
}) => {
|
|
6891
|
-
const smartConfig = (0,
|
|
7094
|
+
const smartConfig = (0, import_react36.useMemo)(() => {
|
|
6892
7095
|
const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
|
|
6893
7096
|
const xAxisConfig2 = typeof xAxis === "string" ? {
|
|
6894
7097
|
dataKey: resolvedXAxisKey,
|
|
@@ -6912,12 +7115,12 @@ var Chart = ({
|
|
|
6912
7115
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
6913
7116
|
}, [data, xAxis, labelMap]);
|
|
6914
7117
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
6915
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
6916
|
-
const [highlightedSeries, setHighlightedSeries] = (0,
|
|
7118
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react36.useState)([]);
|
|
7119
|
+
const [highlightedSeries, setHighlightedSeries] = (0, import_react36.useState)(
|
|
6917
7120
|
/* @__PURE__ */ new Set()
|
|
6918
7121
|
);
|
|
6919
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0,
|
|
6920
|
-
(0,
|
|
7122
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react36.useState)(false);
|
|
7123
|
+
(0, import_react36.useEffect)(() => {
|
|
6921
7124
|
if (highlightedSeries.size === 0 && showOnlyHighlighted) {
|
|
6922
7125
|
setShowOnlyHighlighted(false);
|
|
6923
7126
|
}
|
|
@@ -6926,9 +7129,9 @@ var Chart = ({
|
|
|
6926
7129
|
...item,
|
|
6927
7130
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
6928
7131
|
}));
|
|
6929
|
-
const wrapperRef = (0,
|
|
6930
|
-
const [measuredWidth, setMeasuredWidth] = (0,
|
|
6931
|
-
(0,
|
|
7132
|
+
const wrapperRef = (0, import_react36.useRef)(null);
|
|
7133
|
+
const [measuredWidth, setMeasuredWidth] = (0, import_react36.useState)(null);
|
|
7134
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
6932
7135
|
const el = wrapperRef.current;
|
|
6933
7136
|
if (!el) return;
|
|
6934
7137
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -6955,7 +7158,7 @@ var Chart = ({
|
|
|
6955
7158
|
);
|
|
6956
7159
|
}
|
|
6957
7160
|
const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
|
|
6958
|
-
const generateColors = (0,
|
|
7161
|
+
const generateColors = (0, import_react36.useCallback)(
|
|
6959
7162
|
(dataKeys) => {
|
|
6960
7163
|
const colorMap = {};
|
|
6961
7164
|
const allColors = generateAdditionalColors(colors2, dataKeys.length);
|
|
@@ -6966,25 +7169,25 @@ var Chart = ({
|
|
|
6966
7169
|
},
|
|
6967
7170
|
[colors2, mapperConfig]
|
|
6968
7171
|
);
|
|
6969
|
-
const finalColors = (0,
|
|
7172
|
+
const finalColors = (0, import_react36.useMemo)(
|
|
6970
7173
|
() => generateColors(allKeys),
|
|
6971
7174
|
[generateColors, allKeys]
|
|
6972
7175
|
);
|
|
6973
|
-
const adaptDataForTooltip = (0,
|
|
7176
|
+
const adaptDataForTooltip = (0, import_react36.useCallback)(
|
|
6974
7177
|
(universalData) => ({
|
|
6975
7178
|
...universalData,
|
|
6976
7179
|
name: String(universalData[xAxisConfig.dataKey] || "N/A")
|
|
6977
7180
|
}),
|
|
6978
7181
|
[xAxisConfig.dataKey]
|
|
6979
7182
|
);
|
|
6980
|
-
const activePeriods = (0,
|
|
7183
|
+
const activePeriods = (0, import_react36.useMemo)(
|
|
6981
7184
|
() => activeTooltips.map((t) => adaptDataForTooltip(t.data).name),
|
|
6982
7185
|
[activeTooltips, adaptDataForTooltip]
|
|
6983
7186
|
);
|
|
6984
|
-
(0,
|
|
7187
|
+
(0, import_react36.useEffect)(() => {
|
|
6985
7188
|
window.dispatchEvent(new Event("recountTooltips"));
|
|
6986
7189
|
}, [activeTooltips.length]);
|
|
6987
|
-
const toggleHighlight = (0,
|
|
7190
|
+
const toggleHighlight = (0, import_react36.useCallback)((key) => {
|
|
6988
7191
|
setHighlightedSeries((prev) => {
|
|
6989
7192
|
const next = new Set(prev);
|
|
6990
7193
|
if (next.has(key)) next.delete(key);
|
|
@@ -6992,7 +7195,7 @@ var Chart = ({
|
|
|
6992
7195
|
return next;
|
|
6993
7196
|
});
|
|
6994
7197
|
}, []);
|
|
6995
|
-
const maxDataValue = (0,
|
|
7198
|
+
const maxDataValue = (0, import_react36.useMemo)(() => {
|
|
6996
7199
|
let max = 0;
|
|
6997
7200
|
const numericKeys = allKeys;
|
|
6998
7201
|
for (const row of processedData) {
|
|
@@ -7004,7 +7207,7 @@ var Chart = ({
|
|
|
7004
7207
|
}
|
|
7005
7208
|
return max;
|
|
7006
7209
|
}, [processedData, allKeys]);
|
|
7007
|
-
const minDataValue = (0,
|
|
7210
|
+
const minDataValue = (0, import_react36.useMemo)(() => {
|
|
7008
7211
|
let min = 0;
|
|
7009
7212
|
const numericKeys = allKeys;
|
|
7010
7213
|
for (const row of processedData) {
|
|
@@ -7017,7 +7220,7 @@ var Chart = ({
|
|
|
7017
7220
|
}
|
|
7018
7221
|
return min;
|
|
7019
7222
|
}, [processedData, allKeys]);
|
|
7020
|
-
const niceMax = (0,
|
|
7223
|
+
const niceMax = (0, import_react36.useMemo)(() => {
|
|
7021
7224
|
let padding = 0.08;
|
|
7022
7225
|
if (maxDataValue > 1e6) padding = 0.05;
|
|
7023
7226
|
if (maxDataValue > 1e7) padding = 0.03;
|
|
@@ -7025,7 +7228,7 @@ var Chart = ({
|
|
|
7025
7228
|
const padded = maxDataValue * (1 + padding);
|
|
7026
7229
|
return niceCeil(padded);
|
|
7027
7230
|
}, [maxDataValue]);
|
|
7028
|
-
const computedWidth = (0,
|
|
7231
|
+
const computedWidth = (0, import_react36.useMemo)(() => {
|
|
7029
7232
|
if (typeof width === "number") return width;
|
|
7030
7233
|
const points = Math.max(1, processedData.length);
|
|
7031
7234
|
const barCount = series?.bar?.length ?? 0;
|
|
@@ -7054,7 +7257,7 @@ var Chart = ({
|
|
|
7054
7257
|
series?.area?.length,
|
|
7055
7258
|
niceMax
|
|
7056
7259
|
]);
|
|
7057
|
-
const toggleTooltip = (0,
|
|
7260
|
+
const toggleTooltip = (0, import_react36.useCallback)(
|
|
7058
7261
|
(tooltipId, data2, basePosition) => {
|
|
7059
7262
|
const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
|
|
7060
7263
|
if (existingIndex !== -1) {
|
|
@@ -7083,7 +7286,7 @@ var Chart = ({
|
|
|
7083
7286
|
},
|
|
7084
7287
|
[activeTooltips, maxTooltips]
|
|
7085
7288
|
);
|
|
7086
|
-
const handleChartClick = (0,
|
|
7289
|
+
const handleChartClick = (0, import_react36.useCallback)(
|
|
7087
7290
|
(e) => {
|
|
7088
7291
|
if (!enableDraggableTooltips) return;
|
|
7089
7292
|
const ev = e;
|
|
@@ -7101,7 +7304,7 @@ var Chart = ({
|
|
|
7101
7304
|
},
|
|
7102
7305
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
7103
7306
|
);
|
|
7104
|
-
const handleBarClick = (0,
|
|
7307
|
+
const handleBarClick = (0, import_react36.useCallback)(
|
|
7105
7308
|
(data2, index, event) => {
|
|
7106
7309
|
if (!enableDraggableTooltips) return;
|
|
7107
7310
|
event.stopPropagation();
|
|
@@ -7115,7 +7318,7 @@ var Chart = ({
|
|
|
7115
7318
|
},
|
|
7116
7319
|
[enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
|
|
7117
7320
|
);
|
|
7118
|
-
const handleSeriesClick = (0,
|
|
7321
|
+
const handleSeriesClick = (0, import_react36.useCallback)(
|
|
7119
7322
|
(...args) => {
|
|
7120
7323
|
if (args.length >= 3) {
|
|
7121
7324
|
const [data2, index, event] = args;
|
|
@@ -7126,7 +7329,7 @@ var Chart = ({
|
|
|
7126
7329
|
},
|
|
7127
7330
|
[handleBarClick, handleChartClick]
|
|
7128
7331
|
);
|
|
7129
|
-
const onTooltipPositionChange = (0,
|
|
7332
|
+
const onTooltipPositionChange = (0, import_react36.useCallback)(
|
|
7130
7333
|
(id, position) => {
|
|
7131
7334
|
setActiveTooltips(
|
|
7132
7335
|
(prev) => prev.map((t) => t.id === id ? { ...t, position } : t)
|
|
@@ -7134,7 +7337,7 @@ var Chart = ({
|
|
|
7134
7337
|
},
|
|
7135
7338
|
[]
|
|
7136
7339
|
);
|
|
7137
|
-
const titleClassName = (0,
|
|
7340
|
+
const titleClassName = (0, import_react36.useMemo)(
|
|
7138
7341
|
() => "text-xl font-semibold text-foreground mb-3",
|
|
7139
7342
|
[]
|
|
7140
7343
|
);
|
|
@@ -7151,7 +7354,7 @@ var Chart = ({
|
|
|
7151
7354
|
const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
|
|
7152
7355
|
const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
|
|
7153
7356
|
const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
|
|
7154
|
-
const openTooltipForPeriod = (0,
|
|
7357
|
+
const openTooltipForPeriod = (0, import_react36.useCallback)(
|
|
7155
7358
|
(periodName) => {
|
|
7156
7359
|
if (!enableDraggableTooltips) return;
|
|
7157
7360
|
const row = processedData.find((r) => String(r.name) === periodName);
|
|
@@ -7534,7 +7737,7 @@ var Chart = ({
|
|
|
7534
7737
|
var Chart_default = Chart;
|
|
7535
7738
|
|
|
7536
7739
|
// src/components/charts/BarChart.tsx
|
|
7537
|
-
var
|
|
7740
|
+
var import_react37 = require("react");
|
|
7538
7741
|
var import_recharts2 = require("recharts");
|
|
7539
7742
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
7540
7743
|
var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
|
|
@@ -7566,7 +7769,7 @@ var BarChart = ({
|
|
|
7566
7769
|
containerPaddingLeft,
|
|
7567
7770
|
16
|
|
7568
7771
|
);
|
|
7569
|
-
const smartConfig = (0,
|
|
7772
|
+
const smartConfig = (0, import_react37.useMemo)(() => {
|
|
7570
7773
|
const providedMapper = yAxis ?? mapper;
|
|
7571
7774
|
if (autoDetect === true || xAxis == null || providedMapper == null) {
|
|
7572
7775
|
const detectedXAxis = detectXAxis(data);
|
|
@@ -7616,14 +7819,14 @@ var BarChart = ({
|
|
|
7616
7819
|
return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
|
|
7617
7820
|
}, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
|
|
7618
7821
|
const { xAxisConfig, mapperConfig } = smartConfig;
|
|
7619
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
7620
|
-
const [isDragging, setIsDragging] = (0,
|
|
7621
|
-
const [dragOffset, setDragOffset] = (0,
|
|
7822
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react37.useState)([]);
|
|
7823
|
+
const [isDragging, setIsDragging] = (0, import_react37.useState)(null);
|
|
7824
|
+
const [dragOffset, setDragOffset] = (0, import_react37.useState)({
|
|
7622
7825
|
x: 0,
|
|
7623
7826
|
y: 0
|
|
7624
7827
|
});
|
|
7625
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
7626
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
7828
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react37.useState)(0);
|
|
7829
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react37.useState)([]);
|
|
7627
7830
|
const processedData = data.map((item) => ({
|
|
7628
7831
|
...item,
|
|
7629
7832
|
name: String(item[xAxisConfig.dataKey] || "N/A")
|
|
@@ -7646,7 +7849,7 @@ var BarChart = ({
|
|
|
7646
7849
|
// Garantir que tem a propriedade 'name'
|
|
7647
7850
|
};
|
|
7648
7851
|
};
|
|
7649
|
-
const maxDataValue = (0,
|
|
7852
|
+
const maxDataValue = (0, import_react37.useMemo)(() => {
|
|
7650
7853
|
let max = 0;
|
|
7651
7854
|
const keys = Object.keys(mapperConfig);
|
|
7652
7855
|
for (const row of processedData) {
|
|
@@ -7659,7 +7862,7 @@ var BarChart = ({
|
|
|
7659
7862
|
}
|
|
7660
7863
|
return max;
|
|
7661
7864
|
}, [processedData, mapperConfig]);
|
|
7662
|
-
const niceMax = (0,
|
|
7865
|
+
const niceMax = (0, import_react37.useMemo)(() => {
|
|
7663
7866
|
let padding2 = 0.08;
|
|
7664
7867
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
7665
7868
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -7700,7 +7903,7 @@ var BarChart = ({
|
|
|
7700
7903
|
const GUIDE_THRESHOLD2 = 60;
|
|
7701
7904
|
const STRONG_SNAP_THRESHOLD2 = 35;
|
|
7702
7905
|
const PRECISION_SNAP_THRESHOLD2 = 8;
|
|
7703
|
-
const updateAlignmentGuides = (0,
|
|
7906
|
+
const updateAlignmentGuides = (0, import_react37.useCallback)(
|
|
7704
7907
|
(draggedTooltipId, currentPosition) => {
|
|
7705
7908
|
if (!isDragging) return;
|
|
7706
7909
|
const getAllTooltips = () => {
|
|
@@ -7764,7 +7967,7 @@ var BarChart = ({
|
|
|
7764
7967
|
},
|
|
7765
7968
|
[isDragging, activeTooltips]
|
|
7766
7969
|
);
|
|
7767
|
-
const snapToGuides = (0,
|
|
7970
|
+
const snapToGuides = (0, import_react37.useCallback)(
|
|
7768
7971
|
(position) => {
|
|
7769
7972
|
const snappedPosition = { ...position };
|
|
7770
7973
|
let hasSnapped = false;
|
|
@@ -7826,7 +8029,7 @@ var BarChart = ({
|
|
|
7826
8029
|
setIsDragging(tooltipId);
|
|
7827
8030
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
7828
8031
|
};
|
|
7829
|
-
(0,
|
|
8032
|
+
(0, import_react37.useEffect)(() => {
|
|
7830
8033
|
let rafId;
|
|
7831
8034
|
let lastMousePosition = { x: 0, y: 0 };
|
|
7832
8035
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -7884,7 +8087,7 @@ var BarChart = ({
|
|
|
7884
8087
|
updateAlignmentGuides,
|
|
7885
8088
|
snapToGuides
|
|
7886
8089
|
]);
|
|
7887
|
-
(0,
|
|
8090
|
+
(0, import_react37.useEffect)(() => {
|
|
7888
8091
|
const handleCloseAllTooltips = () => {
|
|
7889
8092
|
setActiveTooltips([]);
|
|
7890
8093
|
setGlobalTooltipCount(0);
|
|
@@ -7894,7 +8097,7 @@ var BarChart = ({
|
|
|
7894
8097
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
|
|
7895
8098
|
};
|
|
7896
8099
|
}, []);
|
|
7897
|
-
(0,
|
|
8100
|
+
(0, import_react37.useEffect)(() => {
|
|
7898
8101
|
const handleTooltipCountRequest = () => {
|
|
7899
8102
|
window.dispatchEvent(
|
|
7900
8103
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -7933,7 +8136,7 @@ var BarChart = ({
|
|
|
7933
8136
|
);
|
|
7934
8137
|
};
|
|
7935
8138
|
}, [activeTooltips]);
|
|
7936
|
-
(0,
|
|
8139
|
+
(0, import_react37.useEffect)(() => {
|
|
7937
8140
|
if (isDragging) return;
|
|
7938
8141
|
let totalCount = 0;
|
|
7939
8142
|
const handleCountResponse = (event) => {
|
|
@@ -8199,7 +8402,7 @@ var BarChart = ({
|
|
|
8199
8402
|
var BarChart_default = BarChart;
|
|
8200
8403
|
|
|
8201
8404
|
// src/components/charts/LineChart.tsx
|
|
8202
|
-
var
|
|
8405
|
+
var import_react38 = require("react");
|
|
8203
8406
|
var import_recharts3 = require("recharts");
|
|
8204
8407
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
8205
8408
|
var defaultData = [
|
|
@@ -8233,14 +8436,14 @@ var CustomLineChart = ({
|
|
|
8233
8436
|
containerPaddingLeft,
|
|
8234
8437
|
16
|
|
8235
8438
|
);
|
|
8236
|
-
const [activeTooltips, setActiveTooltips] = (0,
|
|
8237
|
-
const [isDragging, setIsDragging] = (0,
|
|
8238
|
-
const [dragOffset, setDragOffset] = (0,
|
|
8439
|
+
const [activeTooltips, setActiveTooltips] = (0, import_react38.useState)([]);
|
|
8440
|
+
const [isDragging, setIsDragging] = (0, import_react38.useState)(null);
|
|
8441
|
+
const [dragOffset, setDragOffset] = (0, import_react38.useState)({
|
|
8239
8442
|
x: 0,
|
|
8240
8443
|
y: 0
|
|
8241
8444
|
});
|
|
8242
|
-
const [globalTooltipCount, setGlobalTooltipCount] = (0,
|
|
8243
|
-
const [alignmentGuides, setAlignmentGuides] = (0,
|
|
8445
|
+
const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react38.useState)(0);
|
|
8446
|
+
const [alignmentGuides, setAlignmentGuides] = (0, import_react38.useState)([]);
|
|
8244
8447
|
const generateColors = (dataKeys2) => {
|
|
8245
8448
|
const colorMap = {};
|
|
8246
8449
|
const allColors = generateAdditionalColors(colors2, dataKeys2.length);
|
|
@@ -8249,12 +8452,12 @@ var CustomLineChart = ({
|
|
|
8249
8452
|
});
|
|
8250
8453
|
return colorMap;
|
|
8251
8454
|
};
|
|
8252
|
-
const dataKeys = (0,
|
|
8455
|
+
const dataKeys = (0, import_react38.useMemo)(
|
|
8253
8456
|
() => data.length > 0 ? Object.keys(data[0]).filter((key) => key !== "name") : [],
|
|
8254
8457
|
[data]
|
|
8255
8458
|
);
|
|
8256
8459
|
const finalColors = generateColors(dataKeys);
|
|
8257
|
-
const maxDataValue = (0,
|
|
8460
|
+
const maxDataValue = (0, import_react38.useMemo)(() => {
|
|
8258
8461
|
let max = 0;
|
|
8259
8462
|
for (const row of data) {
|
|
8260
8463
|
const r = row;
|
|
@@ -8266,7 +8469,7 @@ var CustomLineChart = ({
|
|
|
8266
8469
|
}
|
|
8267
8470
|
return max;
|
|
8268
8471
|
}, [data, dataKeys]);
|
|
8269
|
-
const niceMax = (0,
|
|
8472
|
+
const niceMax = (0, import_react38.useMemo)(() => {
|
|
8270
8473
|
let padding2 = 0.08;
|
|
8271
8474
|
if (maxDataValue > 1e6) padding2 = 0.05;
|
|
8272
8475
|
if (maxDataValue > 1e7) padding2 = 0.03;
|
|
@@ -8342,10 +8545,10 @@ var CustomLineChart = ({
|
|
|
8342
8545
|
const handleChartBackgroundClick = () => {
|
|
8343
8546
|
setActiveTooltips([]);
|
|
8344
8547
|
};
|
|
8345
|
-
const handleCloseAllTooltips = (0,
|
|
8548
|
+
const handleCloseAllTooltips = (0, import_react38.useCallback)(() => {
|
|
8346
8549
|
window.dispatchEvent(new CustomEvent("closeAllTooltips"));
|
|
8347
8550
|
}, []);
|
|
8348
|
-
const updateAlignmentGuides = (0,
|
|
8551
|
+
const updateAlignmentGuides = (0, import_react38.useCallback)(
|
|
8349
8552
|
(draggedTooltipId, draggedPosition) => {
|
|
8350
8553
|
const SNAP_THRESHOLD = 15;
|
|
8351
8554
|
const draggedTooltip = activeTooltips.find(
|
|
@@ -8426,7 +8629,7 @@ var CustomLineChart = ({
|
|
|
8426
8629
|
},
|
|
8427
8630
|
[activeTooltips]
|
|
8428
8631
|
);
|
|
8429
|
-
const snapToGuides = (0,
|
|
8632
|
+
const snapToGuides = (0, import_react38.useCallback)(
|
|
8430
8633
|
(position) => {
|
|
8431
8634
|
const SNAP_DISTANCE = 10;
|
|
8432
8635
|
const snappedPosition = { ...position };
|
|
@@ -8454,7 +8657,7 @@ var CustomLineChart = ({
|
|
|
8454
8657
|
setIsDragging(tooltipId);
|
|
8455
8658
|
setDragOffset({ x: offsetX, y: offsetY });
|
|
8456
8659
|
};
|
|
8457
|
-
(0,
|
|
8660
|
+
(0, import_react38.useEffect)(() => {
|
|
8458
8661
|
let rafId;
|
|
8459
8662
|
let lastMousePosition = { x: 0, y: 0 };
|
|
8460
8663
|
const handleGlobalMouseMove = (e) => {
|
|
@@ -8501,7 +8704,7 @@ var CustomLineChart = ({
|
|
|
8501
8704
|
updateAlignmentGuides,
|
|
8502
8705
|
snapToGuides
|
|
8503
8706
|
]);
|
|
8504
|
-
(0,
|
|
8707
|
+
(0, import_react38.useEffect)(() => {
|
|
8505
8708
|
const handleCloseAllTooltips2 = () => {
|
|
8506
8709
|
setActiveTooltips([]);
|
|
8507
8710
|
setGlobalTooltipCount(0);
|
|
@@ -8511,7 +8714,7 @@ var CustomLineChart = ({
|
|
|
8511
8714
|
window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
|
|
8512
8715
|
};
|
|
8513
8716
|
}, []);
|
|
8514
|
-
(0,
|
|
8717
|
+
(0, import_react38.useEffect)(() => {
|
|
8515
8718
|
const handleTooltipCountRequest = () => {
|
|
8516
8719
|
window.dispatchEvent(
|
|
8517
8720
|
new CustomEvent("tooltipCountResponse", {
|
|
@@ -8555,7 +8758,7 @@ var CustomLineChart = ({
|
|
|
8555
8758
|
);
|
|
8556
8759
|
};
|
|
8557
8760
|
}, [activeTooltips]);
|
|
8558
|
-
(0,
|
|
8761
|
+
(0, import_react38.useEffect)(() => {
|
|
8559
8762
|
if (isDragging) return;
|
|
8560
8763
|
let totalCount = 0;
|
|
8561
8764
|
const handleCountResponse = (event) => {
|
|
@@ -8877,13 +9080,13 @@ var CustomPieChart = ({
|
|
|
8877
9080
|
var PieChart_default = CustomPieChart;
|
|
8878
9081
|
|
|
8879
9082
|
// src/components/charts/hooks/useChartHighlights.tsx
|
|
8880
|
-
var
|
|
9083
|
+
var import_react39 = require("react");
|
|
8881
9084
|
var useChartHighlights = () => {
|
|
8882
|
-
const [highlightedSeries, setHighlightedSeries] = (0,
|
|
9085
|
+
const [highlightedSeries, setHighlightedSeries] = (0, import_react39.useState)(
|
|
8883
9086
|
/* @__PURE__ */ new Set()
|
|
8884
9087
|
);
|
|
8885
|
-
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0,
|
|
8886
|
-
const toggleHighlight = (0,
|
|
9088
|
+
const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react39.useState)(false);
|
|
9089
|
+
const toggleHighlight = (0, import_react39.useCallback)((key) => {
|
|
8887
9090
|
setHighlightedSeries((prev) => {
|
|
8888
9091
|
const next = new Set(prev);
|
|
8889
9092
|
if (next.has(key)) {
|
|
@@ -8894,17 +9097,17 @@ var useChartHighlights = () => {
|
|
|
8894
9097
|
return next;
|
|
8895
9098
|
});
|
|
8896
9099
|
}, []);
|
|
8897
|
-
const clearHighlights = (0,
|
|
9100
|
+
const clearHighlights = (0, import_react39.useCallback)(() => {
|
|
8898
9101
|
setHighlightedSeries(/* @__PURE__ */ new Set());
|
|
8899
9102
|
setShowOnlyHighlighted(false);
|
|
8900
9103
|
}, []);
|
|
8901
|
-
const isHighlighted = (0,
|
|
9104
|
+
const isHighlighted = (0, import_react39.useCallback)(
|
|
8902
9105
|
(key) => {
|
|
8903
9106
|
return highlightedSeries.has(key);
|
|
8904
9107
|
},
|
|
8905
9108
|
[highlightedSeries]
|
|
8906
9109
|
);
|
|
8907
|
-
const getSeriesStyle = (0,
|
|
9110
|
+
const getSeriesStyle = (0, import_react39.useCallback)(
|
|
8908
9111
|
(key) => {
|
|
8909
9112
|
const hasHighlights = highlightedSeries.size > 0;
|
|
8910
9113
|
const isSeriesHighlighted = highlightedSeries.has(key);
|
|
@@ -8950,13 +9153,13 @@ var useChartHighlights = () => {
|
|
|
8950
9153
|
};
|
|
8951
9154
|
|
|
8952
9155
|
// src/hooks/use-drag.tsx
|
|
8953
|
-
var
|
|
9156
|
+
var import_react40 = require("react");
|
|
8954
9157
|
var useDrag = (options = {}) => {
|
|
8955
|
-
const [isDragging, setIsDragging] = (0,
|
|
8956
|
-
const [positions, setPositions] = (0,
|
|
8957
|
-
const dragStartPos = (0,
|
|
8958
|
-
const dragId = (0,
|
|
8959
|
-
const handleMouseDown = (0,
|
|
9158
|
+
const [isDragging, setIsDragging] = (0, import_react40.useState)(null);
|
|
9159
|
+
const [positions, setPositions] = (0, import_react40.useState)({});
|
|
9160
|
+
const dragStartPos = (0, import_react40.useRef)(null);
|
|
9161
|
+
const dragId = (0, import_react40.useRef)(null);
|
|
9162
|
+
const handleMouseDown = (0, import_react40.useCallback)((id, e) => {
|
|
8960
9163
|
e.preventDefault();
|
|
8961
9164
|
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
8962
9165
|
dragStartPos.current = {
|
|
@@ -8969,7 +9172,7 @@ var useDrag = (options = {}) => {
|
|
|
8969
9172
|
setIsDragging(id);
|
|
8970
9173
|
options.onDragStart?.(id);
|
|
8971
9174
|
}, [positions, options]);
|
|
8972
|
-
const handleMouseMove = (0,
|
|
9175
|
+
const handleMouseMove = (0, import_react40.useCallback)((e) => {
|
|
8973
9176
|
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
8974
9177
|
const deltaX = e.clientX - dragStartPos.current.x;
|
|
8975
9178
|
const deltaY = e.clientY - dragStartPos.current.y;
|
|
@@ -8985,7 +9188,7 @@ var useDrag = (options = {}) => {
|
|
|
8985
9188
|
}));
|
|
8986
9189
|
options.onDrag?.(dragId.current, newPosition);
|
|
8987
9190
|
}, [isDragging, options]);
|
|
8988
|
-
const handleMouseUp = (0,
|
|
9191
|
+
const handleMouseUp = (0, import_react40.useCallback)(() => {
|
|
8989
9192
|
if (dragId.current) {
|
|
8990
9193
|
options.onDragEnd?.(dragId.current);
|
|
8991
9194
|
}
|
|
@@ -8993,7 +9196,7 @@ var useDrag = (options = {}) => {
|
|
|
8993
9196
|
dragStartPos.current = null;
|
|
8994
9197
|
dragId.current = null;
|
|
8995
9198
|
}, [options]);
|
|
8996
|
-
(0,
|
|
9199
|
+
(0, import_react40.useEffect)(() => {
|
|
8997
9200
|
if (isDragging) {
|
|
8998
9201
|
document.addEventListener("mousemove", handleMouseMove);
|
|
8999
9202
|
document.addEventListener("mouseup", handleMouseUp);
|
|
@@ -9005,16 +9208,16 @@ var useDrag = (options = {}) => {
|
|
|
9005
9208
|
};
|
|
9006
9209
|
}
|
|
9007
9210
|
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
9008
|
-
const setPosition = (0,
|
|
9211
|
+
const setPosition = (0, import_react40.useCallback)((id, position) => {
|
|
9009
9212
|
setPositions((prev) => ({
|
|
9010
9213
|
...prev,
|
|
9011
9214
|
[id]: position
|
|
9012
9215
|
}));
|
|
9013
9216
|
}, []);
|
|
9014
|
-
const getPosition = (0,
|
|
9217
|
+
const getPosition = (0, import_react40.useCallback)((id) => {
|
|
9015
9218
|
return positions[id] || { top: 0, left: 0 };
|
|
9016
9219
|
}, [positions]);
|
|
9017
|
-
const isElementDragging = (0,
|
|
9220
|
+
const isElementDragging = (0, import_react40.useCallback)((id) => {
|
|
9018
9221
|
return isDragging === id;
|
|
9019
9222
|
}, [isDragging]);
|
|
9020
9223
|
return {
|