@mlw-packages/react-components 1.5.5 → 1.5.7
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 +578 -36
- package/dist/index.d.mts +202 -5
- package/dist/index.d.ts +202 -5
- package/dist/index.js +2323 -449
- package/dist/index.mjs +2350 -465
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -499,13 +499,13 @@ var buttonVariantsBase = cva(
|
|
|
499
499
|
variant: {
|
|
500
500
|
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
501
501
|
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",
|
|
502
|
-
outline: "
|
|
502
|
+
outline: "bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
503
503
|
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
504
504
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
505
505
|
link: "text-primary underline-offset-4 hover:underline"
|
|
506
506
|
},
|
|
507
507
|
size: {
|
|
508
|
-
default: "
|
|
508
|
+
default: " px-4 py-2 has-[>svg]:px-3",
|
|
509
509
|
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
510
510
|
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
511
511
|
icon: "size-9"
|
|
@@ -551,7 +551,7 @@ var ButtonGroupBase = React.forwardRef(
|
|
|
551
551
|
return React.cloneElement(typedChild, {
|
|
552
552
|
className: cn(
|
|
553
553
|
typedChild.props.className,
|
|
554
|
-
"rounded-none
|
|
554
|
+
"rounded-none",
|
|
555
555
|
index === 0 && orientation === "horizontal" && "rounded-l-md",
|
|
556
556
|
index === 0 && orientation === "vertical" && "rounded-t-md",
|
|
557
557
|
index === React.Children.count(children) - 1 && orientation === "horizontal" && "rounded-r-md",
|
|
@@ -1419,34 +1419,39 @@ var DialogOverlayBase = React8.forwardRef(({ className, testid: dataTestId = "di
|
|
|
1419
1419
|
}
|
|
1420
1420
|
));
|
|
1421
1421
|
DialogOverlayBase.displayName = DialogPrimitive.Overlay.displayName;
|
|
1422
|
-
var DialogContentBase = React8.forwardRef(
|
|
1423
|
-
/* @__PURE__ */
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
children
|
|
1436
|
-
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1422
|
+
var DialogContentBase = React8.forwardRef(
|
|
1423
|
+
({ className, children, testid: dataTestId = "dialog-content", ...props }, ref) => /* @__PURE__ */ jsxs5(DialogPortalBase, { children: [
|
|
1424
|
+
/* @__PURE__ */ jsx11(DialogOverlayBase, {}),
|
|
1425
|
+
/* @__PURE__ */ jsxs5(
|
|
1426
|
+
DialogPrimitive.Content,
|
|
1427
|
+
{
|
|
1428
|
+
ref,
|
|
1429
|
+
className: cn(
|
|
1430
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg max-h-[100dvh] overflow-hidden",
|
|
1431
|
+
className
|
|
1432
|
+
),
|
|
1433
|
+
"data-testid": dataTestId,
|
|
1434
|
+
...props,
|
|
1435
|
+
children: [
|
|
1436
|
+
children,
|
|
1437
|
+
/* @__PURE__ */ jsxs5(DialogPrimitive.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground z-10 touch-manipulation", children: [
|
|
1438
|
+
/* @__PURE__ */ jsx11(XIcon, { className: "h-5 w-5 sm:h-4 sm:w-4" }),
|
|
1439
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Close" })
|
|
1440
|
+
] })
|
|
1441
|
+
]
|
|
1442
|
+
}
|
|
1443
|
+
)
|
|
1444
|
+
] })
|
|
1445
|
+
);
|
|
1444
1446
|
DialogContentBase.displayName = DialogPrimitive.Content.displayName;
|
|
1445
1447
|
var DialogHeaderBase = React8.forwardRef(({ className, testid: dataTestId = "dialog-header", ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
1446
1448
|
"div",
|
|
1447
1449
|
{
|
|
1448
1450
|
ref,
|
|
1449
|
-
className: cn(
|
|
1451
|
+
className: cn(
|
|
1452
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
1453
|
+
className
|
|
1454
|
+
),
|
|
1450
1455
|
"data-testid": dataTestId,
|
|
1451
1456
|
...props
|
|
1452
1457
|
}
|
|
@@ -1456,7 +1461,10 @@ var DialogFooterBase = React8.forwardRef(({ className, testid: dataTestId = "dia
|
|
|
1456
1461
|
"div",
|
|
1457
1462
|
{
|
|
1458
1463
|
ref,
|
|
1459
|
-
className: cn(
|
|
1464
|
+
className: cn(
|
|
1465
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
1466
|
+
className
|
|
1467
|
+
),
|
|
1460
1468
|
"data-testid": dataTestId,
|
|
1461
1469
|
...props
|
|
1462
1470
|
}
|
|
@@ -1466,7 +1474,10 @@ var DialogTitleBase = React8.forwardRef(({ className, testid: dataTestId = "dial
|
|
|
1466
1474
|
DialogPrimitive.Title,
|
|
1467
1475
|
{
|
|
1468
1476
|
ref,
|
|
1469
|
-
className: cn(
|
|
1477
|
+
className: cn(
|
|
1478
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
1479
|
+
className
|
|
1480
|
+
),
|
|
1470
1481
|
"data-testid": dataTestId,
|
|
1471
1482
|
...props
|
|
1472
1483
|
}
|
|
@@ -2130,7 +2141,7 @@ var InputBase = React12.forwardRef(
|
|
|
2130
2141
|
{
|
|
2131
2142
|
type,
|
|
2132
2143
|
className: cn(
|
|
2133
|
-
"w-full flex-1 text-sm py-
|
|
2144
|
+
"w-full flex-1 text-sm py-2 px-3 focus:outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 bg-background text-foreground",
|
|
2134
2145
|
className
|
|
2135
2146
|
),
|
|
2136
2147
|
ref,
|
|
@@ -2205,7 +2216,7 @@ function ComboboxBase({
|
|
|
2205
2216
|
role: "combobox",
|
|
2206
2217
|
"aria-expanded": open,
|
|
2207
2218
|
className: cn(
|
|
2208
|
-
"flex items-start gap-2 justify-between h-full",
|
|
2219
|
+
"flex items-start gap-2 justify-between h-full border border-input",
|
|
2209
2220
|
errorMessage && "border-red-500"
|
|
2210
2221
|
),
|
|
2211
2222
|
"data-testid": testIds.trigger ?? "combobox-trigger",
|
|
@@ -2554,17 +2565,188 @@ function InputOTPSeparatorBase({ ...props }) {
|
|
|
2554
2565
|
return /* @__PURE__ */ jsx25("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx25(MinusIcon, {}) });
|
|
2555
2566
|
}
|
|
2556
2567
|
|
|
2568
|
+
// src/components/ui/LoadingBase.tsx
|
|
2569
|
+
import * as React16 from "react";
|
|
2570
|
+
import { cva as cva3 } from "class-variance-authority";
|
|
2571
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2572
|
+
var loadingVariants = cva3(
|
|
2573
|
+
"rounded-full border-2 animate-spin border-muted border-t-primary",
|
|
2574
|
+
{
|
|
2575
|
+
variants: {
|
|
2576
|
+
size: {
|
|
2577
|
+
sm: "h-4 w-4",
|
|
2578
|
+
md: "h-6 w-6",
|
|
2579
|
+
lg: "h-8 w-8",
|
|
2580
|
+
xl: "h-12 w-12 border-[3px]"
|
|
2581
|
+
}
|
|
2582
|
+
},
|
|
2583
|
+
defaultVariants: {
|
|
2584
|
+
size: "md"
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
);
|
|
2588
|
+
var dotsVariants = cva3(
|
|
2589
|
+
"flex items-center justify-center",
|
|
2590
|
+
{
|
|
2591
|
+
variants: {
|
|
2592
|
+
size: {
|
|
2593
|
+
sm: "gap-1",
|
|
2594
|
+
md: "gap-1.5",
|
|
2595
|
+
lg: "gap-2",
|
|
2596
|
+
xl: "gap-2.5"
|
|
2597
|
+
}
|
|
2598
|
+
},
|
|
2599
|
+
defaultVariants: {
|
|
2600
|
+
size: "md"
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
);
|
|
2604
|
+
var dotVariants = cva3(
|
|
2605
|
+
"rounded-full bg-gradient-to-r from-primary to-primary/70 shadow-sm",
|
|
2606
|
+
{
|
|
2607
|
+
variants: {
|
|
2608
|
+
size: {
|
|
2609
|
+
sm: "h-1.5 w-2",
|
|
2610
|
+
md: "h-2.5 w-2.5",
|
|
2611
|
+
lg: "h-2.5 w-3",
|
|
2612
|
+
xl: "h-3.5 w-4"
|
|
2613
|
+
}
|
|
2614
|
+
},
|
|
2615
|
+
defaultVariants: {
|
|
2616
|
+
size: "md"
|
|
2617
|
+
}
|
|
2618
|
+
}
|
|
2619
|
+
);
|
|
2620
|
+
var LoadingBase = React16.forwardRef(
|
|
2621
|
+
({ className, size, message, overlay = false, variant = "spinner", ...props }, ref) => {
|
|
2622
|
+
React16.useEffect(() => {
|
|
2623
|
+
const style = document.createElement("style");
|
|
2624
|
+
style.textContent = `
|
|
2625
|
+
@keyframes dotBounce {
|
|
2626
|
+
0%, 80%, 100% {
|
|
2627
|
+
transform: translateY(0);
|
|
2628
|
+
opacity: 0.8;
|
|
2629
|
+
}
|
|
2630
|
+
40% {
|
|
2631
|
+
transform: translateY(-8px);
|
|
2632
|
+
opacity: 1;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
`;
|
|
2636
|
+
document.head.appendChild(style);
|
|
2637
|
+
return () => {
|
|
2638
|
+
if (document.head.contains(style)) {
|
|
2639
|
+
document.head.removeChild(style);
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
}, []);
|
|
2643
|
+
const renderSpinner = () => {
|
|
2644
|
+
if (variant === "dots") {
|
|
2645
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn(dotsVariants({ size })), "aria-hidden": "true", children: [
|
|
2646
|
+
/* @__PURE__ */ jsx26(
|
|
2647
|
+
"div",
|
|
2648
|
+
{
|
|
2649
|
+
className: cn(dotVariants({ size })),
|
|
2650
|
+
style: {
|
|
2651
|
+
animation: "dotBounce 1.4s ease-in-out infinite",
|
|
2652
|
+
animationDelay: "0ms",
|
|
2653
|
+
transform: "translateY(0px)"
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
),
|
|
2657
|
+
/* @__PURE__ */ jsx26(
|
|
2658
|
+
"div",
|
|
2659
|
+
{
|
|
2660
|
+
className: cn(dotVariants({ size })),
|
|
2661
|
+
style: {
|
|
2662
|
+
animation: "dotBounce 1.4s ease-in-out infinite",
|
|
2663
|
+
animationDelay: "0.16s",
|
|
2664
|
+
transform: "translateY(0px)"
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2667
|
+
),
|
|
2668
|
+
/* @__PURE__ */ jsx26(
|
|
2669
|
+
"div",
|
|
2670
|
+
{
|
|
2671
|
+
className: cn(dotVariants({ size })),
|
|
2672
|
+
style: {
|
|
2673
|
+
animation: "dotBounce 1.4s ease-in-out infinite",
|
|
2674
|
+
animationDelay: "0.32s",
|
|
2675
|
+
transform: "translateY(0px)"
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
)
|
|
2679
|
+
] });
|
|
2680
|
+
}
|
|
2681
|
+
return /* @__PURE__ */ jsx26(
|
|
2682
|
+
"div",
|
|
2683
|
+
{
|
|
2684
|
+
className: cn(loadingVariants({ size })),
|
|
2685
|
+
style: {
|
|
2686
|
+
animation: "spin 1s linear infinite"
|
|
2687
|
+
},
|
|
2688
|
+
"aria-hidden": "true"
|
|
2689
|
+
}
|
|
2690
|
+
);
|
|
2691
|
+
};
|
|
2692
|
+
const loadingContent = /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center gap-4", children: [
|
|
2693
|
+
renderSpinner(),
|
|
2694
|
+
message && /* @__PURE__ */ jsx26("p", { className: "text-sm font-medium text-muted-foreground animate-pulse", children: message })
|
|
2695
|
+
] });
|
|
2696
|
+
if (overlay) {
|
|
2697
|
+
return /* @__PURE__ */ jsx26(
|
|
2698
|
+
"div",
|
|
2699
|
+
{
|
|
2700
|
+
ref,
|
|
2701
|
+
className: cn(
|
|
2702
|
+
"fixed inset-0 z-50 flex items-center justify-center",
|
|
2703
|
+
"bg-background/80 dark:bg-background/60",
|
|
2704
|
+
"backdrop-blur-md backdrop-saturate-150",
|
|
2705
|
+
"transition-all duration-300 ease-in-out",
|
|
2706
|
+
"animate-in fade-in-0",
|
|
2707
|
+
className
|
|
2708
|
+
),
|
|
2709
|
+
role: "status",
|
|
2710
|
+
"aria-label": message || "Carregando",
|
|
2711
|
+
...props,
|
|
2712
|
+
children: /* @__PURE__ */ jsx26("div", { className: cn(
|
|
2713
|
+
"relative p-8 rounded-2xl",
|
|
2714
|
+
"bg-card/90 dark:bg-card/95",
|
|
2715
|
+
"border border-border/50",
|
|
2716
|
+
"shadow-2xl shadow-black/10 dark:shadow-black/30",
|
|
2717
|
+
"backdrop-blur-xl backdrop-saturate-150",
|
|
2718
|
+
"animate-in zoom-in-95 fade-in-0 duration-300",
|
|
2719
|
+
"text-center space-y-4"
|
|
2720
|
+
), children: loadingContent })
|
|
2721
|
+
}
|
|
2722
|
+
);
|
|
2723
|
+
}
|
|
2724
|
+
return /* @__PURE__ */ jsx26(
|
|
2725
|
+
"div",
|
|
2726
|
+
{
|
|
2727
|
+
ref,
|
|
2728
|
+
className: cn("flex items-center justify-center", className),
|
|
2729
|
+
role: "status",
|
|
2730
|
+
"aria-label": message || "Carregando",
|
|
2731
|
+
...props,
|
|
2732
|
+
children: loadingContent
|
|
2733
|
+
}
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2736
|
+
);
|
|
2737
|
+
LoadingBase.displayName = "LoadingBase";
|
|
2738
|
+
|
|
2557
2739
|
// src/components/ui/NavigationMenuBase.tsx
|
|
2558
2740
|
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
|
|
2559
2741
|
import { CaretDownIcon as CaretDownIcon2 } from "@phosphor-icons/react";
|
|
2560
|
-
import { jsx as
|
|
2742
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2561
2743
|
function NavigationMenuBase({
|
|
2562
2744
|
className,
|
|
2563
2745
|
children,
|
|
2564
2746
|
viewport = true,
|
|
2565
2747
|
...props
|
|
2566
2748
|
}) {
|
|
2567
|
-
return /* @__PURE__ */
|
|
2749
|
+
return /* @__PURE__ */ jsxs17(
|
|
2568
2750
|
NavigationMenuPrimitive.Root,
|
|
2569
2751
|
{
|
|
2570
2752
|
"data-slot": "navigation-menu",
|
|
@@ -2576,7 +2758,7 @@ function NavigationMenuBase({
|
|
|
2576
2758
|
...props,
|
|
2577
2759
|
children: [
|
|
2578
2760
|
children,
|
|
2579
|
-
viewport && /* @__PURE__ */
|
|
2761
|
+
viewport && /* @__PURE__ */ jsx27(NavigationMenuViewportBase, {})
|
|
2580
2762
|
]
|
|
2581
2763
|
}
|
|
2582
2764
|
);
|
|
@@ -2585,7 +2767,7 @@ function NavigationMenuListBase({
|
|
|
2585
2767
|
className,
|
|
2586
2768
|
...props
|
|
2587
2769
|
}) {
|
|
2588
|
-
return /* @__PURE__ */
|
|
2770
|
+
return /* @__PURE__ */ jsx27(
|
|
2589
2771
|
NavigationMenuPrimitive.List,
|
|
2590
2772
|
{
|
|
2591
2773
|
"data-slot": "navigation-menu-list",
|
|
@@ -2601,7 +2783,7 @@ function NavigationMenuItemBase({
|
|
|
2601
2783
|
className,
|
|
2602
2784
|
...props
|
|
2603
2785
|
}) {
|
|
2604
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsx27(
|
|
2605
2787
|
NavigationMenuPrimitive.Item,
|
|
2606
2788
|
{
|
|
2607
2789
|
"data-slot": "navigation-menu-item",
|
|
@@ -2615,7 +2797,7 @@ function NavigationMenuTriggerBase({
|
|
|
2615
2797
|
children,
|
|
2616
2798
|
...props
|
|
2617
2799
|
}) {
|
|
2618
|
-
return /* @__PURE__ */
|
|
2800
|
+
return /* @__PURE__ */ jsxs17(
|
|
2619
2801
|
NavigationMenuPrimitive.Trigger,
|
|
2620
2802
|
{
|
|
2621
2803
|
"data-slot": "navigation-menu-trigger",
|
|
@@ -2623,7 +2805,7 @@ function NavigationMenuTriggerBase({
|
|
|
2623
2805
|
...props,
|
|
2624
2806
|
children: [
|
|
2625
2807
|
children,
|
|
2626
|
-
/* @__PURE__ */
|
|
2808
|
+
/* @__PURE__ */ jsx27(
|
|
2627
2809
|
CaretDownIcon2,
|
|
2628
2810
|
{
|
|
2629
2811
|
className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
|
|
@@ -2638,7 +2820,7 @@ function NavigationMenuContentBase({
|
|
|
2638
2820
|
className,
|
|
2639
2821
|
...props
|
|
2640
2822
|
}) {
|
|
2641
|
-
return /* @__PURE__ */
|
|
2823
|
+
return /* @__PURE__ */ jsx27(
|
|
2642
2824
|
NavigationMenuPrimitive.Content,
|
|
2643
2825
|
{
|
|
2644
2826
|
"data-slot": "navigation-menu-content",
|
|
@@ -2655,7 +2837,7 @@ function NavigationMenuViewportBase({
|
|
|
2655
2837
|
className,
|
|
2656
2838
|
...props
|
|
2657
2839
|
}) {
|
|
2658
|
-
return /* @__PURE__ */
|
|
2840
|
+
return /* @__PURE__ */ jsx27("div", { className: cn("absolute top-full left-0 isolate z-50 flex justify-center"), children: /* @__PURE__ */ jsx27(
|
|
2659
2841
|
NavigationMenuPrimitive.Viewport,
|
|
2660
2842
|
{
|
|
2661
2843
|
"data-slot": "navigation-menu-viewport",
|
|
@@ -2671,7 +2853,7 @@ function NavigationMenuLinkBase({
|
|
|
2671
2853
|
className,
|
|
2672
2854
|
...props
|
|
2673
2855
|
}) {
|
|
2674
|
-
return /* @__PURE__ */
|
|
2856
|
+
return /* @__PURE__ */ jsx27(
|
|
2675
2857
|
NavigationMenuPrimitive.Link,
|
|
2676
2858
|
{
|
|
2677
2859
|
"data-slot": "navigation-menu-link",
|
|
@@ -2687,7 +2869,7 @@ function NavigationMenuIndicatorBase({
|
|
|
2687
2869
|
className,
|
|
2688
2870
|
...props
|
|
2689
2871
|
}) {
|
|
2690
|
-
return /* @__PURE__ */
|
|
2872
|
+
return /* @__PURE__ */ jsx27(
|
|
2691
2873
|
NavigationMenuPrimitive.Indicator,
|
|
2692
2874
|
{
|
|
2693
2875
|
"data-slot": "navigation-menu-indicator",
|
|
@@ -2696,21 +2878,21 @@ function NavigationMenuIndicatorBase({
|
|
|
2696
2878
|
className
|
|
2697
2879
|
),
|
|
2698
2880
|
...props,
|
|
2699
|
-
children: /* @__PURE__ */
|
|
2881
|
+
children: /* @__PURE__ */ jsx27("div", { className: "bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" })
|
|
2700
2882
|
}
|
|
2701
2883
|
);
|
|
2702
2884
|
}
|
|
2703
2885
|
|
|
2704
2886
|
// src/components/ui/ProgressBase.tsx
|
|
2705
|
-
import * as
|
|
2887
|
+
import * as React17 from "react";
|
|
2706
2888
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
2707
|
-
import { jsx as
|
|
2708
|
-
var ProgressBase =
|
|
2709
|
-
return /* @__PURE__ */
|
|
2710
|
-
label && /* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
leftIcon && /* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2889
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2890
|
+
var ProgressBase = React17.forwardRef(({ className, value, label, leftIcon, rightIcon, ...props }, ref) => {
|
|
2891
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
|
|
2892
|
+
label && /* @__PURE__ */ jsx28(LabelBase_default, { className: "py-2", children: label }),
|
|
2893
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
2894
|
+
leftIcon && /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center", children: leftIcon }),
|
|
2895
|
+
/* @__PURE__ */ jsx28(
|
|
2714
2896
|
ProgressPrimitive.Root,
|
|
2715
2897
|
{
|
|
2716
2898
|
ref,
|
|
@@ -2720,7 +2902,7 @@ var ProgressBase = React16.forwardRef(({ className, value, label, leftIcon, righ
|
|
|
2720
2902
|
),
|
|
2721
2903
|
value,
|
|
2722
2904
|
...props,
|
|
2723
|
-
children: /* @__PURE__ */
|
|
2905
|
+
children: /* @__PURE__ */ jsx28(
|
|
2724
2906
|
ProgressPrimitive.Indicator,
|
|
2725
2907
|
{
|
|
2726
2908
|
className: "h-full w-full flex-1 bg-primary transition-all duration-500 ease-in-out",
|
|
@@ -2729,7 +2911,7 @@ var ProgressBase = React16.forwardRef(({ className, value, label, leftIcon, righ
|
|
|
2729
2911
|
)
|
|
2730
2912
|
}
|
|
2731
2913
|
),
|
|
2732
|
-
rightIcon && /* @__PURE__ */
|
|
2914
|
+
rightIcon && /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-center", children: rightIcon })
|
|
2733
2915
|
] })
|
|
2734
2916
|
] });
|
|
2735
2917
|
});
|
|
@@ -2740,9 +2922,9 @@ var ProgressSegmentsBase = ({
|
|
|
2740
2922
|
value
|
|
2741
2923
|
}) => {
|
|
2742
2924
|
const filled = Math.round(value / 100 * segments);
|
|
2743
|
-
return /* @__PURE__ */
|
|
2744
|
-
label && /* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2925
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1 w-full min-w-[150px]", children: [
|
|
2926
|
+
label && /* @__PURE__ */ jsx28(LabelBase_default, { className: "py-2", children: label }),
|
|
2927
|
+
/* @__PURE__ */ jsx28("div", { className: "flex gap-1 w-full", children: Array.from({ length: segments }).map((_, idx) => /* @__PURE__ */ jsx28(
|
|
2746
2928
|
"div",
|
|
2747
2929
|
{
|
|
2748
2930
|
className: cn(
|
|
@@ -2754,7 +2936,7 @@ var ProgressSegmentsBase = ({
|
|
|
2754
2936
|
)) })
|
|
2755
2937
|
] });
|
|
2756
2938
|
};
|
|
2757
|
-
var ArrowRightIcon2 = () => /* @__PURE__ */
|
|
2939
|
+
var ArrowRightIcon2 = () => /* @__PURE__ */ jsx28(
|
|
2758
2940
|
"svg",
|
|
2759
2941
|
{
|
|
2760
2942
|
className: "w-6 h-6 text-zinc-400 transition-transform duration-300 group-hover:translate-x-1",
|
|
@@ -2763,7 +2945,7 @@ var ArrowRightIcon2 = () => /* @__PURE__ */ jsx27(
|
|
|
2763
2945
|
strokeWidth: 2,
|
|
2764
2946
|
viewBox: "0 0 24 24",
|
|
2765
2947
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2766
|
-
children: /* @__PURE__ */
|
|
2948
|
+
children: /* @__PURE__ */ jsx28("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })
|
|
2767
2949
|
}
|
|
2768
2950
|
);
|
|
2769
2951
|
var ProgressPanelsBase = ({
|
|
@@ -2771,13 +2953,13 @@ var ProgressPanelsBase = ({
|
|
|
2771
2953
|
steps,
|
|
2772
2954
|
currentStep
|
|
2773
2955
|
}) => {
|
|
2774
|
-
return /* @__PURE__ */
|
|
2775
|
-
label && /* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2956
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1 w-full", children: [
|
|
2957
|
+
label && /* @__PURE__ */ jsx28(LabelBase_default, { className: "py-2", children: label }),
|
|
2958
|
+
/* @__PURE__ */ jsx28("div", { className: "flex w-full gap-1 rounded-lg overflow-hidden", children: steps.map((step, idx) => {
|
|
2777
2959
|
const isActive = idx === currentStep;
|
|
2778
2960
|
const isLast = idx === steps.length - 1;
|
|
2779
|
-
return /* @__PURE__ */
|
|
2780
|
-
/* @__PURE__ */
|
|
2961
|
+
return /* @__PURE__ */ jsxs18(React17.Fragment, { children: [
|
|
2962
|
+
/* @__PURE__ */ jsxs18(
|
|
2781
2963
|
"div",
|
|
2782
2964
|
{
|
|
2783
2965
|
className: cn(
|
|
@@ -2788,12 +2970,12 @@ var ProgressPanelsBase = ({
|
|
|
2788
2970
|
),
|
|
2789
2971
|
style: { flex: "1 1 0" },
|
|
2790
2972
|
children: [
|
|
2791
|
-
/* @__PURE__ */
|
|
2792
|
-
isActive && /* @__PURE__ */
|
|
2973
|
+
/* @__PURE__ */ jsx28("span", { className: "truncate", children: step }),
|
|
2974
|
+
isActive && /* @__PURE__ */ jsx28("div", { className: "absolute bottom-0 left-0 h-1 w-full animate-pulse rounded-b-lg" })
|
|
2793
2975
|
]
|
|
2794
2976
|
}
|
|
2795
2977
|
),
|
|
2796
|
-
!isLast && /* @__PURE__ */
|
|
2978
|
+
!isLast && /* @__PURE__ */ jsx28("div", { className: "flex items-center px-2 group", children: /* @__PURE__ */ jsx28(ArrowRightIcon2, {}) })
|
|
2797
2979
|
] }, idx);
|
|
2798
2980
|
}) })
|
|
2799
2981
|
] });
|
|
@@ -2803,11 +2985,11 @@ var ProgressCirclesBase = ({
|
|
|
2803
2985
|
steps,
|
|
2804
2986
|
currentStep
|
|
2805
2987
|
}) => {
|
|
2806
|
-
return /* @__PURE__ */
|
|
2807
|
-
label && /* @__PURE__ */
|
|
2808
|
-
/* @__PURE__ */
|
|
2809
|
-
/* @__PURE__ */
|
|
2810
|
-
/* @__PURE__ */
|
|
2988
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
2989
|
+
label && /* @__PURE__ */ jsx28("label", { className: "py-2 text-base font-semibold text-gray-700 dark:text-gray-300", children: label }),
|
|
2990
|
+
/* @__PURE__ */ jsxs18("div", { className: "relative flex items-center justify-between w-full", children: [
|
|
2991
|
+
/* @__PURE__ */ jsx28("div", { className: "absolute top-5 left-0 w-full h-1 bg-zinc-200 dark:bg-zinc-700" }),
|
|
2992
|
+
/* @__PURE__ */ jsx28(
|
|
2811
2993
|
"div",
|
|
2812
2994
|
{
|
|
2813
2995
|
className: "absolute top-5 left-0 h-1 bg-primary transition-all duration-300",
|
|
@@ -2818,13 +3000,13 @@ var ProgressCirclesBase = ({
|
|
|
2818
3000
|
),
|
|
2819
3001
|
steps.map((step, idx) => {
|
|
2820
3002
|
const isActive = idx <= currentStep;
|
|
2821
|
-
return /* @__PURE__ */
|
|
3003
|
+
return /* @__PURE__ */ jsxs18(
|
|
2822
3004
|
"div",
|
|
2823
3005
|
{
|
|
2824
3006
|
className: "relative flex flex-col items-center w-10",
|
|
2825
3007
|
style: { zIndex: isActive ? 10 : 1 },
|
|
2826
3008
|
children: [
|
|
2827
|
-
/* @__PURE__ */
|
|
3009
|
+
/* @__PURE__ */ jsx28(
|
|
2828
3010
|
"div",
|
|
2829
3011
|
{
|
|
2830
3012
|
className: cn(
|
|
@@ -2834,7 +3016,7 @@ var ProgressCirclesBase = ({
|
|
|
2834
3016
|
children: idx + 1
|
|
2835
3017
|
}
|
|
2836
3018
|
),
|
|
2837
|
-
/* @__PURE__ */
|
|
3019
|
+
/* @__PURE__ */ jsx28("span", { className: "text-xs text-center font-medium mt-1 max-w-[80px] break-words", children: step })
|
|
2838
3020
|
]
|
|
2839
3021
|
},
|
|
2840
3022
|
idx
|
|
@@ -2845,24 +3027,24 @@ var ProgressCirclesBase = ({
|
|
|
2845
3027
|
};
|
|
2846
3028
|
|
|
2847
3029
|
// src/components/ui/ScrollareaBase.tsx
|
|
2848
|
-
import * as
|
|
3030
|
+
import * as React18 from "react";
|
|
2849
3031
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
2850
|
-
import { jsx as
|
|
2851
|
-
var ScrollAreaBase =
|
|
3032
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3033
|
+
var ScrollAreaBase = React18.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs19(
|
|
2852
3034
|
ScrollAreaPrimitive.Root,
|
|
2853
3035
|
{
|
|
2854
3036
|
ref,
|
|
2855
3037
|
className: cn("relative overflow-hidden", className),
|
|
2856
3038
|
...props,
|
|
2857
3039
|
children: [
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ jsx29(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
3041
|
+
/* @__PURE__ */ jsx29(ScrollBarBase, {}),
|
|
3042
|
+
/* @__PURE__ */ jsx29(ScrollAreaPrimitive.Corner, {})
|
|
2861
3043
|
]
|
|
2862
3044
|
}
|
|
2863
3045
|
));
|
|
2864
3046
|
ScrollAreaBase.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
2865
|
-
var ScrollBarBase =
|
|
3047
|
+
var ScrollBarBase = React18.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx29(
|
|
2866
3048
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
2867
3049
|
{
|
|
2868
3050
|
ref,
|
|
@@ -2874,21 +3056,21 @@ var ScrollBarBase = React17.forwardRef(({ className, orientation = "vertical", .
|
|
|
2874
3056
|
className
|
|
2875
3057
|
),
|
|
2876
3058
|
...props,
|
|
2877
|
-
children: /* @__PURE__ */
|
|
3059
|
+
children: /* @__PURE__ */ jsx29(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
2878
3060
|
}
|
|
2879
3061
|
));
|
|
2880
3062
|
ScrollBarBase.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
2881
3063
|
|
|
2882
3064
|
// src/components/ui/SelectBase.tsx
|
|
2883
|
-
import * as
|
|
3065
|
+
import * as React19 from "react";
|
|
2884
3066
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2885
3067
|
import { CheckIcon as CheckIcon5, CaretDownIcon as CaretDownIcon3, CaretUpIcon } from "@phosphor-icons/react";
|
|
2886
3068
|
import { motion as motion4, AnimatePresence as AnimatePresence3 } from "framer-motion";
|
|
2887
|
-
import { Fragment as Fragment2, jsx as
|
|
3069
|
+
import { Fragment as Fragment2, jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2888
3070
|
var SelectBase = SelectPrimitive.Root;
|
|
2889
3071
|
var SelectGroupBase = SelectPrimitive.Group;
|
|
2890
3072
|
var SelectValueBase = SelectPrimitive.Value;
|
|
2891
|
-
var SelectTriggerBase =
|
|
3073
|
+
var SelectTriggerBase = React19.forwardRef(({ className, children, open, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
2892
3074
|
SelectPrimitive.Trigger,
|
|
2893
3075
|
{
|
|
2894
3076
|
ref,
|
|
@@ -2899,20 +3081,20 @@ var SelectTriggerBase = React18.forwardRef(({ className, children, open, ...prop
|
|
|
2899
3081
|
...props,
|
|
2900
3082
|
children: [
|
|
2901
3083
|
children,
|
|
2902
|
-
/* @__PURE__ */
|
|
3084
|
+
/* @__PURE__ */ jsx30(
|
|
2903
3085
|
motion4.span,
|
|
2904
3086
|
{
|
|
2905
3087
|
animate: { rotate: open ? 180 : 0 },
|
|
2906
3088
|
transition: { duration: 0.3 },
|
|
2907
3089
|
className: "flex items-center",
|
|
2908
|
-
children: /* @__PURE__ */
|
|
3090
|
+
children: /* @__PURE__ */ jsx30(CaretDownIcon3, { className: "h-4 w-4 opacity-50" })
|
|
2909
3091
|
}
|
|
2910
3092
|
)
|
|
2911
3093
|
]
|
|
2912
3094
|
}
|
|
2913
3095
|
));
|
|
2914
3096
|
SelectTriggerBase.displayName = SelectPrimitive.Trigger.displayName;
|
|
2915
|
-
var SelectScrollUpButtonBase =
|
|
3097
|
+
var SelectScrollUpButtonBase = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx30(
|
|
2916
3098
|
SelectPrimitive.ScrollUpButton,
|
|
2917
3099
|
{
|
|
2918
3100
|
ref,
|
|
@@ -2921,11 +3103,11 @@ var SelectScrollUpButtonBase = React18.forwardRef(({ className, ...props }, ref)
|
|
|
2921
3103
|
className
|
|
2922
3104
|
),
|
|
2923
3105
|
...props,
|
|
2924
|
-
children: /* @__PURE__ */
|
|
3106
|
+
children: /* @__PURE__ */ jsx30(CaretUpIcon, { className: "h-4 w-4" })
|
|
2925
3107
|
}
|
|
2926
3108
|
));
|
|
2927
3109
|
SelectScrollUpButtonBase.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
2928
|
-
var SelectScrollDownButtonBase =
|
|
3110
|
+
var SelectScrollDownButtonBase = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx30(
|
|
2929
3111
|
SelectPrimitive.ScrollDownButton,
|
|
2930
3112
|
{
|
|
2931
3113
|
ref,
|
|
@@ -2934,11 +3116,11 @@ var SelectScrollDownButtonBase = React18.forwardRef(({ className, ...props }, re
|
|
|
2934
3116
|
className
|
|
2935
3117
|
),
|
|
2936
3118
|
...props,
|
|
2937
|
-
children: /* @__PURE__ */
|
|
3119
|
+
children: /* @__PURE__ */ jsx30(CaretDownIcon3, { className: "h-4 w-4" })
|
|
2938
3120
|
}
|
|
2939
3121
|
));
|
|
2940
3122
|
SelectScrollDownButtonBase.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
2941
|
-
var SelectContentBase =
|
|
3123
|
+
var SelectContentBase = React19.forwardRef(({ className, children, position = "popper", testid: dataTestId = "select-content", ...props }, ref) => /* @__PURE__ */ jsx30(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsx30(AnimatePresence3, { children: /* @__PURE__ */ jsx30(
|
|
2942
3124
|
SelectPrimitive.Content,
|
|
2943
3125
|
{
|
|
2944
3126
|
ref,
|
|
@@ -2950,16 +3132,16 @@ var SelectContentBase = React18.forwardRef(({ className, children, position = "p
|
|
|
2950
3132
|
"data-testid": dataTestId,
|
|
2951
3133
|
...props,
|
|
2952
3134
|
asChild: true,
|
|
2953
|
-
children: /* @__PURE__ */
|
|
3135
|
+
children: /* @__PURE__ */ jsx30(
|
|
2954
3136
|
motion4.div,
|
|
2955
3137
|
{
|
|
2956
3138
|
initial: { opacity: 0, scale: 0.95 },
|
|
2957
3139
|
animate: { opacity: 1, scale: 1 },
|
|
2958
3140
|
exit: { opacity: 0, scale: 0.95 },
|
|
2959
3141
|
transition: { duration: 0.2 },
|
|
2960
|
-
children: /* @__PURE__ */
|
|
2961
|
-
/* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
3142
|
+
children: /* @__PURE__ */ jsxs20(Fragment2, { children: [
|
|
3143
|
+
/* @__PURE__ */ jsx30(SelectScrollUpButtonBase, {}),
|
|
3144
|
+
/* @__PURE__ */ jsx30(
|
|
2963
3145
|
SelectPrimitive.Viewport,
|
|
2964
3146
|
{
|
|
2965
3147
|
className: cn(
|
|
@@ -2969,14 +3151,14 @@ var SelectContentBase = React18.forwardRef(({ className, children, position = "p
|
|
|
2969
3151
|
children
|
|
2970
3152
|
}
|
|
2971
3153
|
),
|
|
2972
|
-
/* @__PURE__ */
|
|
3154
|
+
/* @__PURE__ */ jsx30(SelectScrollDownButtonBase, {})
|
|
2973
3155
|
] })
|
|
2974
3156
|
}
|
|
2975
3157
|
)
|
|
2976
3158
|
}
|
|
2977
3159
|
) }) }));
|
|
2978
3160
|
SelectContentBase.displayName = SelectPrimitive.Content.displayName;
|
|
2979
|
-
var SelectLabelBase =
|
|
3161
|
+
var SelectLabelBase = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx30(
|
|
2980
3162
|
SelectPrimitive.Label,
|
|
2981
3163
|
{
|
|
2982
3164
|
ref,
|
|
@@ -2985,7 +3167,7 @@ var SelectLabelBase = React18.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
2985
3167
|
}
|
|
2986
3168
|
));
|
|
2987
3169
|
SelectLabelBase.displayName = SelectPrimitive.Label.displayName;
|
|
2988
|
-
var SelectItemBase =
|
|
3170
|
+
var SelectItemBase = React19.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs20(
|
|
2989
3171
|
SelectPrimitive.Item,
|
|
2990
3172
|
{
|
|
2991
3173
|
ref,
|
|
@@ -2995,13 +3177,13 @@ var SelectItemBase = React18.forwardRef(({ className, children, ...props }, ref)
|
|
|
2995
3177
|
),
|
|
2996
3178
|
...props,
|
|
2997
3179
|
children: [
|
|
2998
|
-
/* @__PURE__ */
|
|
2999
|
-
/* @__PURE__ */
|
|
3180
|
+
/* @__PURE__ */ jsx30("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx30(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx30(CheckIcon5, { className: "h-4 w-4" }) }) }),
|
|
3181
|
+
/* @__PURE__ */ jsx30(SelectPrimitive.ItemText, { children })
|
|
3000
3182
|
]
|
|
3001
3183
|
}
|
|
3002
3184
|
));
|
|
3003
3185
|
SelectItemBase.displayName = SelectPrimitive.Item.displayName;
|
|
3004
|
-
var SelectSeparatorBase =
|
|
3186
|
+
var SelectSeparatorBase = React19.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx30(
|
|
3005
3187
|
SelectPrimitive.Separator,
|
|
3006
3188
|
{
|
|
3007
3189
|
ref,
|
|
@@ -3012,14 +3194,14 @@ var SelectSeparatorBase = React18.forwardRef(({ className, ...props }, ref) => /
|
|
|
3012
3194
|
SelectSeparatorBase.displayName = SelectPrimitive.Separator.displayName;
|
|
3013
3195
|
|
|
3014
3196
|
// src/components/ui/SeparatorBase.tsx
|
|
3015
|
-
import * as
|
|
3197
|
+
import * as React20 from "react";
|
|
3016
3198
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
3017
3199
|
import { motion as motion5 } from "framer-motion";
|
|
3018
|
-
import { jsx as
|
|
3019
|
-
var SeparatorBase =
|
|
3200
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3201
|
+
var SeparatorBase = React20.forwardRef(
|
|
3020
3202
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => {
|
|
3021
3203
|
const isHorizontal = orientation === "horizontal";
|
|
3022
|
-
return /* @__PURE__ */
|
|
3204
|
+
return /* @__PURE__ */ jsx31(
|
|
3023
3205
|
SeparatorPrimitive.Root,
|
|
3024
3206
|
{
|
|
3025
3207
|
ref,
|
|
@@ -3027,7 +3209,7 @@ var SeparatorBase = React19.forwardRef(
|
|
|
3027
3209
|
orientation,
|
|
3028
3210
|
asChild: true,
|
|
3029
3211
|
...props,
|
|
3030
|
-
children: /* @__PURE__ */
|
|
3212
|
+
children: /* @__PURE__ */ jsx31(
|
|
3031
3213
|
motion5.div,
|
|
3032
3214
|
{
|
|
3033
3215
|
className: cn(
|
|
@@ -3047,16 +3229,16 @@ var SeparatorBase = React19.forwardRef(
|
|
|
3047
3229
|
SeparatorBase.displayName = SeparatorPrimitive.Root.displayName;
|
|
3048
3230
|
|
|
3049
3231
|
// src/components/ui/SheetBase.tsx
|
|
3050
|
-
import * as
|
|
3232
|
+
import * as React21 from "react";
|
|
3051
3233
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
3052
|
-
import { cva as
|
|
3234
|
+
import { cva as cva4 } from "class-variance-authority";
|
|
3053
3235
|
import { XIcon as XIcon3 } from "@phosphor-icons/react";
|
|
3054
|
-
import { jsx as
|
|
3236
|
+
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3055
3237
|
var SheetBase = SheetPrimitive.Root;
|
|
3056
3238
|
var SheetTriggerBase = SheetPrimitive.Trigger;
|
|
3057
3239
|
var SheetCloseBase = SheetPrimitive.Close;
|
|
3058
3240
|
var SheetPortalBase = SheetPrimitive.Portal;
|
|
3059
|
-
var SheetOverlayBase =
|
|
3241
|
+
var SheetOverlayBase = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
3060
3242
|
SheetPrimitive.Overlay,
|
|
3061
3243
|
{
|
|
3062
3244
|
className: cn(
|
|
@@ -3068,7 +3250,7 @@ var SheetOverlayBase = React20.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
3068
3250
|
}
|
|
3069
3251
|
));
|
|
3070
3252
|
SheetOverlayBase.displayName = SheetPrimitive.Overlay.displayName;
|
|
3071
|
-
var sheetVariants =
|
|
3253
|
+
var sheetVariants = cva4(
|
|
3072
3254
|
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
3073
3255
|
{
|
|
3074
3256
|
variants: {
|
|
@@ -3084,18 +3266,18 @@ var sheetVariants = cva3(
|
|
|
3084
3266
|
}
|
|
3085
3267
|
}
|
|
3086
3268
|
);
|
|
3087
|
-
var SheetContentBase =
|
|
3088
|
-
/* @__PURE__ */
|
|
3089
|
-
/* @__PURE__ */
|
|
3269
|
+
var SheetContentBase = React21.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs21(SheetPortalBase, { children: [
|
|
3270
|
+
/* @__PURE__ */ jsx32(SheetOverlayBase, {}),
|
|
3271
|
+
/* @__PURE__ */ jsxs21(
|
|
3090
3272
|
SheetPrimitive.Content,
|
|
3091
3273
|
{
|
|
3092
3274
|
ref,
|
|
3093
3275
|
className: cn(sheetVariants({ side }), className),
|
|
3094
3276
|
...props,
|
|
3095
3277
|
children: [
|
|
3096
|
-
/* @__PURE__ */
|
|
3097
|
-
/* @__PURE__ */
|
|
3098
|
-
/* @__PURE__ */
|
|
3278
|
+
/* @__PURE__ */ jsxs21(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
3279
|
+
/* @__PURE__ */ jsx32(XIcon3, { className: "h-4 w-4" }),
|
|
3280
|
+
/* @__PURE__ */ jsx32("span", { className: "sr-only", children: "Close" })
|
|
3099
3281
|
] }),
|
|
3100
3282
|
children
|
|
3101
3283
|
]
|
|
@@ -3106,7 +3288,7 @@ SheetContentBase.displayName = SheetPrimitive.Content.displayName;
|
|
|
3106
3288
|
var SheetHeaderBase = ({
|
|
3107
3289
|
className,
|
|
3108
3290
|
...props
|
|
3109
|
-
}) => /* @__PURE__ */
|
|
3291
|
+
}) => /* @__PURE__ */ jsx32(
|
|
3110
3292
|
"div",
|
|
3111
3293
|
{
|
|
3112
3294
|
className: cn(
|
|
@@ -3120,7 +3302,7 @@ SheetHeaderBase.displayName = "SheetHeaderBase";
|
|
|
3120
3302
|
var SheetFooterBase = ({
|
|
3121
3303
|
className,
|
|
3122
3304
|
...props
|
|
3123
|
-
}) => /* @__PURE__ */
|
|
3305
|
+
}) => /* @__PURE__ */ jsx32(
|
|
3124
3306
|
"div",
|
|
3125
3307
|
{
|
|
3126
3308
|
className: cn(
|
|
@@ -3131,7 +3313,7 @@ var SheetFooterBase = ({
|
|
|
3131
3313
|
}
|
|
3132
3314
|
);
|
|
3133
3315
|
SheetFooterBase.displayName = "SheetFooterBase";
|
|
3134
|
-
var SheetTitleBase =
|
|
3316
|
+
var SheetTitleBase = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
3135
3317
|
SheetPrimitive.Title,
|
|
3136
3318
|
{
|
|
3137
3319
|
ref,
|
|
@@ -3140,7 +3322,7 @@ var SheetTitleBase = React20.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
3140
3322
|
}
|
|
3141
3323
|
));
|
|
3142
3324
|
SheetTitleBase.displayName = SheetPrimitive.Title.displayName;
|
|
3143
|
-
var SheetDescriptionBase =
|
|
3325
|
+
var SheetDescriptionBase = React21.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx32(
|
|
3144
3326
|
SheetPrimitive.Description,
|
|
3145
3327
|
{
|
|
3146
3328
|
ref,
|
|
@@ -3151,16 +3333,16 @@ var SheetDescriptionBase = React20.forwardRef(({ className, ...props }, ref) =>
|
|
|
3151
3333
|
SheetDescriptionBase.displayName = SheetPrimitive.Description.displayName;
|
|
3152
3334
|
|
|
3153
3335
|
// src/components/ui/SidebarBase.tsx
|
|
3154
|
-
import * as
|
|
3336
|
+
import * as React23 from "react";
|
|
3155
3337
|
import { Slot as Slot5 } from "@radix-ui/react-slot";
|
|
3156
|
-
import { cva as
|
|
3338
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
3157
3339
|
|
|
3158
3340
|
// src/hooks/use-mobile.tsx
|
|
3159
|
-
import * as
|
|
3341
|
+
import * as React22 from "react";
|
|
3160
3342
|
var MOBILE_BREAKPOINT = 768;
|
|
3161
3343
|
function useIsMobile() {
|
|
3162
|
-
const [isMobile, setIsMobile] =
|
|
3163
|
-
|
|
3344
|
+
const [isMobile, setIsMobile] = React22.useState(void 0);
|
|
3345
|
+
React22.useEffect(() => {
|
|
3164
3346
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
3165
3347
|
const onChange = () => {
|
|
3166
3348
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -3173,12 +3355,12 @@ function useIsMobile() {
|
|
|
3173
3355
|
}
|
|
3174
3356
|
|
|
3175
3357
|
// src/components/ui/SkeletonBase.tsx
|
|
3176
|
-
import { jsx as
|
|
3358
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
3177
3359
|
function SkeletonBase({
|
|
3178
3360
|
className,
|
|
3179
3361
|
...props
|
|
3180
3362
|
}) {
|
|
3181
|
-
return /* @__PURE__ */
|
|
3363
|
+
return /* @__PURE__ */ jsx33(
|
|
3182
3364
|
"div",
|
|
3183
3365
|
{
|
|
3184
3366
|
className: cn("animate-pulse bg-primary/10", className),
|
|
@@ -3189,16 +3371,16 @@ function SkeletonBase({
|
|
|
3189
3371
|
|
|
3190
3372
|
// src/components/ui/SidebarBase.tsx
|
|
3191
3373
|
import { SidebarSimpleIcon } from "@phosphor-icons/react";
|
|
3192
|
-
import { jsx as
|
|
3374
|
+
import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3193
3375
|
var SIDEBAR_COOKIE_NAME = "sidebar:state";
|
|
3194
3376
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
3195
3377
|
var SIDEBAR_WIDTH = "16rem";
|
|
3196
3378
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
3197
3379
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
3198
3380
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
3199
|
-
var SidebarContext =
|
|
3381
|
+
var SidebarContext = React23.createContext(null);
|
|
3200
3382
|
function UseSideBarBase() {
|
|
3201
|
-
const context =
|
|
3383
|
+
const context = React23.useContext(SidebarContext);
|
|
3202
3384
|
if (!context) {
|
|
3203
3385
|
throw new Error(
|
|
3204
3386
|
"UseSideBarBase must be used within a SidebarProviderBase."
|
|
@@ -3206,7 +3388,7 @@ function UseSideBarBase() {
|
|
|
3206
3388
|
}
|
|
3207
3389
|
return context;
|
|
3208
3390
|
}
|
|
3209
|
-
var SidebarProviderBase =
|
|
3391
|
+
var SidebarProviderBase = React23.forwardRef(
|
|
3210
3392
|
({
|
|
3211
3393
|
defaultOpen = true,
|
|
3212
3394
|
open: openProp,
|
|
@@ -3217,10 +3399,10 @@ var SidebarProviderBase = React22.forwardRef(
|
|
|
3217
3399
|
...props
|
|
3218
3400
|
}, ref) => {
|
|
3219
3401
|
const isMobile = useIsMobile();
|
|
3220
|
-
const [openMobile, setOpenMobile] =
|
|
3221
|
-
const [_open, _setOpen] =
|
|
3402
|
+
const [openMobile, setOpenMobile] = React23.useState(false);
|
|
3403
|
+
const [_open, _setOpen] = React23.useState(defaultOpen);
|
|
3222
3404
|
const open = openProp ?? _open;
|
|
3223
|
-
const setOpen =
|
|
3405
|
+
const setOpen = React23.useCallback(
|
|
3224
3406
|
(value) => {
|
|
3225
3407
|
const openState = typeof value === "function" ? value(open) : value;
|
|
3226
3408
|
if (setOpenProp) {
|
|
@@ -3232,10 +3414,10 @@ var SidebarProviderBase = React22.forwardRef(
|
|
|
3232
3414
|
},
|
|
3233
3415
|
[setOpenProp, open]
|
|
3234
3416
|
);
|
|
3235
|
-
const toggleSidebar =
|
|
3417
|
+
const toggleSidebar = React23.useCallback(() => {
|
|
3236
3418
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
3237
3419
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
3238
|
-
|
|
3420
|
+
React23.useEffect(() => {
|
|
3239
3421
|
const handleKeyDown = (event) => {
|
|
3240
3422
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
3241
3423
|
event.preventDefault();
|
|
@@ -3246,7 +3428,7 @@ var SidebarProviderBase = React22.forwardRef(
|
|
|
3246
3428
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
3247
3429
|
}, [toggleSidebar]);
|
|
3248
3430
|
const state = open ? "expanded" : "collapsed";
|
|
3249
|
-
const contextValue =
|
|
3431
|
+
const contextValue = React23.useMemo(
|
|
3250
3432
|
() => ({
|
|
3251
3433
|
state,
|
|
3252
3434
|
open,
|
|
@@ -3258,7 +3440,7 @@ var SidebarProviderBase = React22.forwardRef(
|
|
|
3258
3440
|
}),
|
|
3259
3441
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
3260
3442
|
);
|
|
3261
|
-
return /* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsx34(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx34(TooltipProviderBase, { delayDuration: 0, children: /* @__PURE__ */ jsx34(
|
|
3262
3444
|
"div",
|
|
3263
3445
|
{
|
|
3264
3446
|
style: {
|
|
@@ -3278,7 +3460,7 @@ var SidebarProviderBase = React22.forwardRef(
|
|
|
3278
3460
|
}
|
|
3279
3461
|
);
|
|
3280
3462
|
SidebarProviderBase.displayName = "SidebarProviderBase";
|
|
3281
|
-
var SidebarBase =
|
|
3463
|
+
var SidebarBase = React23.forwardRef(
|
|
3282
3464
|
({
|
|
3283
3465
|
side = "left",
|
|
3284
3466
|
variant = "sidebar",
|
|
@@ -3289,7 +3471,7 @@ var SidebarBase = React22.forwardRef(
|
|
|
3289
3471
|
}, ref) => {
|
|
3290
3472
|
const { isMobile, state, openMobile, setOpenMobile } = UseSideBarBase();
|
|
3291
3473
|
if (collapsible === "none") {
|
|
3292
|
-
return /* @__PURE__ */
|
|
3474
|
+
return /* @__PURE__ */ jsx34(
|
|
3293
3475
|
"div",
|
|
3294
3476
|
{
|
|
3295
3477
|
className: cn(
|
|
@@ -3303,7 +3485,7 @@ var SidebarBase = React22.forwardRef(
|
|
|
3303
3485
|
);
|
|
3304
3486
|
}
|
|
3305
3487
|
if (isMobile) {
|
|
3306
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsx34(SheetBase, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsx34(
|
|
3307
3489
|
SheetContentBase,
|
|
3308
3490
|
{
|
|
3309
3491
|
"data-sidebar": "sidebar",
|
|
@@ -3313,11 +3495,11 @@ var SidebarBase = React22.forwardRef(
|
|
|
3313
3495
|
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
3314
3496
|
},
|
|
3315
3497
|
side,
|
|
3316
|
-
children: /* @__PURE__ */
|
|
3498
|
+
children: /* @__PURE__ */ jsx34("div", { className: "flex h-full w-full flex-col", children })
|
|
3317
3499
|
}
|
|
3318
3500
|
) });
|
|
3319
3501
|
}
|
|
3320
|
-
return /* @__PURE__ */
|
|
3502
|
+
return /* @__PURE__ */ jsxs22(
|
|
3321
3503
|
"div",
|
|
3322
3504
|
{
|
|
3323
3505
|
ref,
|
|
@@ -3327,7 +3509,7 @@ var SidebarBase = React22.forwardRef(
|
|
|
3327
3509
|
"data-variant": variant,
|
|
3328
3510
|
"data-side": side,
|
|
3329
3511
|
children: [
|
|
3330
|
-
/* @__PURE__ */
|
|
3512
|
+
/* @__PURE__ */ jsx34(
|
|
3331
3513
|
"div",
|
|
3332
3514
|
{
|
|
3333
3515
|
className: cn(
|
|
@@ -3338,7 +3520,7 @@ var SidebarBase = React22.forwardRef(
|
|
|
3338
3520
|
)
|
|
3339
3521
|
}
|
|
3340
3522
|
),
|
|
3341
|
-
/* @__PURE__ */
|
|
3523
|
+
/* @__PURE__ */ jsx34(
|
|
3342
3524
|
"div",
|
|
3343
3525
|
{
|
|
3344
3526
|
className: cn(
|
|
@@ -3349,7 +3531,7 @@ var SidebarBase = React22.forwardRef(
|
|
|
3349
3531
|
className
|
|
3350
3532
|
),
|
|
3351
3533
|
...props,
|
|
3352
|
-
children: /* @__PURE__ */
|
|
3534
|
+
children: /* @__PURE__ */ jsx34(
|
|
3353
3535
|
"div",
|
|
3354
3536
|
{
|
|
3355
3537
|
"data-sidebar": "sidebar",
|
|
@@ -3365,9 +3547,9 @@ var SidebarBase = React22.forwardRef(
|
|
|
3365
3547
|
}
|
|
3366
3548
|
);
|
|
3367
3549
|
SidebarBase.displayName = "SidebarBase";
|
|
3368
|
-
var SidebarTriggerBase =
|
|
3550
|
+
var SidebarTriggerBase = React23.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
3369
3551
|
const { toggleSidebar } = UseSideBarBase();
|
|
3370
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ jsx34("div", { children: /* @__PURE__ */ jsxs22(
|
|
3371
3553
|
ButtonBase,
|
|
3372
3554
|
{
|
|
3373
3555
|
ref,
|
|
@@ -3381,16 +3563,16 @@ var SidebarTriggerBase = React22.forwardRef(({ className, onClick, ...props }, r
|
|
|
3381
3563
|
},
|
|
3382
3564
|
...props,
|
|
3383
3565
|
children: [
|
|
3384
|
-
/* @__PURE__ */
|
|
3385
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx34("span", { className: "sr-only", children: "Toggle SidebarBase" }),
|
|
3567
|
+
/* @__PURE__ */ jsx34(SidebarSimpleIcon, {})
|
|
3386
3568
|
]
|
|
3387
3569
|
}
|
|
3388
3570
|
) });
|
|
3389
3571
|
});
|
|
3390
3572
|
SidebarTriggerBase.displayName = "SidebarTriggerBase";
|
|
3391
|
-
var SidebarRailBase =
|
|
3573
|
+
var SidebarRailBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3392
3574
|
const { toggleSidebar } = UseSideBarBase();
|
|
3393
|
-
return /* @__PURE__ */
|
|
3575
|
+
return /* @__PURE__ */ jsx34(
|
|
3394
3576
|
"button",
|
|
3395
3577
|
{
|
|
3396
3578
|
ref,
|
|
@@ -3413,8 +3595,8 @@ var SidebarRailBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3413
3595
|
);
|
|
3414
3596
|
});
|
|
3415
3597
|
SidebarRailBase.displayName = "SidebarRailBase";
|
|
3416
|
-
var SidebarInsetBase =
|
|
3417
|
-
return /* @__PURE__ */
|
|
3598
|
+
var SidebarInsetBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3599
|
+
return /* @__PURE__ */ jsx34(
|
|
3418
3600
|
"main",
|
|
3419
3601
|
{
|
|
3420
3602
|
ref,
|
|
@@ -3428,8 +3610,8 @@ var SidebarInsetBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3428
3610
|
);
|
|
3429
3611
|
});
|
|
3430
3612
|
SidebarInsetBase.displayName = "SidebarInsetBase";
|
|
3431
|
-
var SidebarInputBase =
|
|
3432
|
-
return /* @__PURE__ */
|
|
3613
|
+
var SidebarInputBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3614
|
+
return /* @__PURE__ */ jsx34(
|
|
3433
3615
|
InputBase,
|
|
3434
3616
|
{
|
|
3435
3617
|
ref,
|
|
@@ -3443,8 +3625,8 @@ var SidebarInputBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3443
3625
|
);
|
|
3444
3626
|
});
|
|
3445
3627
|
SidebarInputBase.displayName = "SidebarInputBase";
|
|
3446
|
-
var SidebarHeaderBase =
|
|
3447
|
-
return /* @__PURE__ */
|
|
3628
|
+
var SidebarHeaderBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3629
|
+
return /* @__PURE__ */ jsx34(
|
|
3448
3630
|
"div",
|
|
3449
3631
|
{
|
|
3450
3632
|
ref,
|
|
@@ -3455,8 +3637,8 @@ var SidebarHeaderBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3455
3637
|
);
|
|
3456
3638
|
});
|
|
3457
3639
|
SidebarHeaderBase.displayName = "SidebarHeaderBase";
|
|
3458
|
-
var SidebarFooterBase =
|
|
3459
|
-
return /* @__PURE__ */
|
|
3640
|
+
var SidebarFooterBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3641
|
+
return /* @__PURE__ */ jsx34(
|
|
3460
3642
|
"div",
|
|
3461
3643
|
{
|
|
3462
3644
|
ref,
|
|
@@ -3467,8 +3649,8 @@ var SidebarFooterBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3467
3649
|
);
|
|
3468
3650
|
});
|
|
3469
3651
|
SidebarFooterBase.displayName = "SidebarFooterBase";
|
|
3470
|
-
var SidebarSeparatorBase =
|
|
3471
|
-
return /* @__PURE__ */
|
|
3652
|
+
var SidebarSeparatorBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3653
|
+
return /* @__PURE__ */ jsx34(
|
|
3472
3654
|
SeparatorBase,
|
|
3473
3655
|
{
|
|
3474
3656
|
ref,
|
|
@@ -3479,8 +3661,8 @@ var SidebarSeparatorBase = React22.forwardRef(({ className, ...props }, ref) =>
|
|
|
3479
3661
|
);
|
|
3480
3662
|
});
|
|
3481
3663
|
SidebarSeparatorBase.displayName = "SidebarSeparatorBase";
|
|
3482
|
-
var SidebarContentBase =
|
|
3483
|
-
return /* @__PURE__ */
|
|
3664
|
+
var SidebarContentBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3665
|
+
return /* @__PURE__ */ jsx34(
|
|
3484
3666
|
"div",
|
|
3485
3667
|
{
|
|
3486
3668
|
ref,
|
|
@@ -3494,8 +3676,8 @@ var SidebarContentBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3494
3676
|
);
|
|
3495
3677
|
});
|
|
3496
3678
|
SidebarContentBase.displayName = "SidebarContentBase";
|
|
3497
|
-
var SidebarGroupBase =
|
|
3498
|
-
return /* @__PURE__ */
|
|
3679
|
+
var SidebarGroupBase = React23.forwardRef(({ className, ...props }, ref) => {
|
|
3680
|
+
return /* @__PURE__ */ jsx34(
|
|
3499
3681
|
"div",
|
|
3500
3682
|
{
|
|
3501
3683
|
ref,
|
|
@@ -3506,9 +3688,9 @@ var SidebarGroupBase = React22.forwardRef(({ className, ...props }, ref) => {
|
|
|
3506
3688
|
);
|
|
3507
3689
|
});
|
|
3508
3690
|
SidebarGroupBase.displayName = "SidebarGroupBase";
|
|
3509
|
-
var SidebarGroupLabelBase =
|
|
3691
|
+
var SidebarGroupLabelBase = React23.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
3510
3692
|
const Comp = asChild ? Slot5 : "div";
|
|
3511
|
-
return /* @__PURE__ */
|
|
3693
|
+
return /* @__PURE__ */ jsx34(
|
|
3512
3694
|
Comp,
|
|
3513
3695
|
{
|
|
3514
3696
|
ref,
|
|
@@ -3523,9 +3705,9 @@ var SidebarGroupLabelBase = React22.forwardRef(({ className, asChild = false, ..
|
|
|
3523
3705
|
);
|
|
3524
3706
|
});
|
|
3525
3707
|
SidebarGroupLabelBase.displayName = "SidebarGroupLabelBase";
|
|
3526
|
-
var SidebarGroupActionBase =
|
|
3708
|
+
var SidebarGroupActionBase = React23.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
3527
3709
|
const Comp = asChild ? Slot5 : "button";
|
|
3528
|
-
return /* @__PURE__ */
|
|
3710
|
+
return /* @__PURE__ */ jsx34(
|
|
3529
3711
|
Comp,
|
|
3530
3712
|
{
|
|
3531
3713
|
ref,
|
|
@@ -3542,7 +3724,7 @@ var SidebarGroupActionBase = React22.forwardRef(({ className, asChild = false, .
|
|
|
3542
3724
|
);
|
|
3543
3725
|
});
|
|
3544
3726
|
SidebarGroupActionBase.displayName = "SidebarGroupActionBase";
|
|
3545
|
-
var SidebarGroupContentBase =
|
|
3727
|
+
var SidebarGroupContentBase = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
3546
3728
|
"div",
|
|
3547
3729
|
{
|
|
3548
3730
|
ref,
|
|
@@ -3552,7 +3734,7 @@ var SidebarGroupContentBase = React22.forwardRef(({ className, ...props }, ref)
|
|
|
3552
3734
|
}
|
|
3553
3735
|
));
|
|
3554
3736
|
SidebarGroupContentBase.displayName = "SidebarGroupContentBase";
|
|
3555
|
-
var SidebarMenuBase =
|
|
3737
|
+
var SidebarMenuBase = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
3556
3738
|
"ul",
|
|
3557
3739
|
{
|
|
3558
3740
|
ref,
|
|
@@ -3562,7 +3744,7 @@ var SidebarMenuBase = React22.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
3562
3744
|
}
|
|
3563
3745
|
));
|
|
3564
3746
|
SidebarMenuBase.displayName = "SidebarMenuBase";
|
|
3565
|
-
var SidebarMenuItemBase =
|
|
3747
|
+
var SidebarMenuItemBase = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
3566
3748
|
"li",
|
|
3567
3749
|
{
|
|
3568
3750
|
ref,
|
|
@@ -3572,7 +3754,7 @@ var SidebarMenuItemBase = React22.forwardRef(({ className, ...props }, ref) => /
|
|
|
3572
3754
|
}
|
|
3573
3755
|
));
|
|
3574
3756
|
SidebarMenuItemBase.displayName = "SidebarMenuItemBase";
|
|
3575
|
-
var sidebarMenuButtonVariants =
|
|
3757
|
+
var sidebarMenuButtonVariants = cva5(
|
|
3576
3758
|
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
3577
3759
|
{
|
|
3578
3760
|
variants: {
|
|
@@ -3592,7 +3774,7 @@ var sidebarMenuButtonVariants = cva4(
|
|
|
3592
3774
|
}
|
|
3593
3775
|
}
|
|
3594
3776
|
);
|
|
3595
|
-
var SidebarMenuButtonBase =
|
|
3777
|
+
var SidebarMenuButtonBase = React23.forwardRef(
|
|
3596
3778
|
({
|
|
3597
3779
|
asChild = false,
|
|
3598
3780
|
isActive = false,
|
|
@@ -3604,7 +3786,7 @@ var SidebarMenuButtonBase = React22.forwardRef(
|
|
|
3604
3786
|
}, ref) => {
|
|
3605
3787
|
const Comp = asChild ? Slot5 : "button";
|
|
3606
3788
|
const { isMobile, state } = UseSideBarBase();
|
|
3607
|
-
const button = /* @__PURE__ */
|
|
3789
|
+
const button = /* @__PURE__ */ jsx34(
|
|
3608
3790
|
Comp,
|
|
3609
3791
|
{
|
|
3610
3792
|
ref,
|
|
@@ -3623,9 +3805,9 @@ var SidebarMenuButtonBase = React22.forwardRef(
|
|
|
3623
3805
|
children: tooltip
|
|
3624
3806
|
};
|
|
3625
3807
|
}
|
|
3626
|
-
return /* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3628
|
-
/* @__PURE__ */
|
|
3808
|
+
return /* @__PURE__ */ jsxs22(TooltipBase, { children: [
|
|
3809
|
+
/* @__PURE__ */ jsx34(TooltipTriggerBase, { asChild: true, children: button }),
|
|
3810
|
+
/* @__PURE__ */ jsx34(
|
|
3629
3811
|
TooltipContentBase,
|
|
3630
3812
|
{
|
|
3631
3813
|
side: "right",
|
|
@@ -3638,9 +3820,9 @@ var SidebarMenuButtonBase = React22.forwardRef(
|
|
|
3638
3820
|
}
|
|
3639
3821
|
);
|
|
3640
3822
|
SidebarMenuButtonBase.displayName = "SidebarMenuButtonBase";
|
|
3641
|
-
var SidebarMenuActionBase =
|
|
3823
|
+
var SidebarMenuActionBase = React23.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
3642
3824
|
const Comp = asChild ? Slot5 : "button";
|
|
3643
|
-
return /* @__PURE__ */
|
|
3825
|
+
return /* @__PURE__ */ jsx34(
|
|
3644
3826
|
Comp,
|
|
3645
3827
|
{
|
|
3646
3828
|
ref,
|
|
@@ -3661,7 +3843,7 @@ var SidebarMenuActionBase = React22.forwardRef(({ className, asChild = false, sh
|
|
|
3661
3843
|
);
|
|
3662
3844
|
});
|
|
3663
3845
|
SidebarMenuActionBase.displayName = "SidebarMenuActionBase";
|
|
3664
|
-
var SidebarMenuBadgeBase =
|
|
3846
|
+
var SidebarMenuBadgeBase = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
3665
3847
|
"div",
|
|
3666
3848
|
{
|
|
3667
3849
|
ref,
|
|
@@ -3679,11 +3861,11 @@ var SidebarMenuBadgeBase = React22.forwardRef(({ className, ...props }, ref) =>
|
|
|
3679
3861
|
}
|
|
3680
3862
|
));
|
|
3681
3863
|
SidebarMenuBadgeBase.displayName = "SidebarMenuBadgeBase";
|
|
3682
|
-
var SidebarMenuSkeletonBase =
|
|
3683
|
-
const width =
|
|
3864
|
+
var SidebarMenuSkeletonBase = React23.forwardRef(({ className, showIcon = false, ...props }, ref) => {
|
|
3865
|
+
const width = React23.useMemo(() => {
|
|
3684
3866
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
3685
3867
|
}, []);
|
|
3686
|
-
return /* @__PURE__ */
|
|
3868
|
+
return /* @__PURE__ */ jsxs22(
|
|
3687
3869
|
"div",
|
|
3688
3870
|
{
|
|
3689
3871
|
ref,
|
|
@@ -3691,14 +3873,14 @@ var SidebarMenuSkeletonBase = React22.forwardRef(({ className, showIcon = false,
|
|
|
3691
3873
|
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
3692
3874
|
...props,
|
|
3693
3875
|
children: [
|
|
3694
|
-
showIcon && /* @__PURE__ */
|
|
3876
|
+
showIcon && /* @__PURE__ */ jsx34(
|
|
3695
3877
|
SkeletonBase,
|
|
3696
3878
|
{
|
|
3697
3879
|
className: "size-4 rounded-md",
|
|
3698
3880
|
"data-sidebar": "menu-skeleton-icon"
|
|
3699
3881
|
}
|
|
3700
3882
|
),
|
|
3701
|
-
/* @__PURE__ */
|
|
3883
|
+
/* @__PURE__ */ jsx34(
|
|
3702
3884
|
SkeletonBase,
|
|
3703
3885
|
{
|
|
3704
3886
|
className: "h-4 max-w-[--skeleton-width] flex-1",
|
|
@@ -3713,7 +3895,7 @@ var SidebarMenuSkeletonBase = React22.forwardRef(({ className, showIcon = false,
|
|
|
3713
3895
|
);
|
|
3714
3896
|
});
|
|
3715
3897
|
SidebarMenuSkeletonBase.displayName = "SidebarMenuSkeletonBase";
|
|
3716
|
-
var SidebarMenuSubBase =
|
|
3898
|
+
var SidebarMenuSubBase = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx34(
|
|
3717
3899
|
"ul",
|
|
3718
3900
|
{
|
|
3719
3901
|
ref,
|
|
@@ -3727,11 +3909,11 @@ var SidebarMenuSubBase = React22.forwardRef(({ className, ...props }, ref) => /*
|
|
|
3727
3909
|
}
|
|
3728
3910
|
));
|
|
3729
3911
|
SidebarMenuSubBase.displayName = "SidebarMenuSubBase";
|
|
3730
|
-
var SidebarMenuSubItemBase =
|
|
3912
|
+
var SidebarMenuSubItemBase = React23.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx34("li", { ref, ...props }));
|
|
3731
3913
|
SidebarMenuSubItemBase.displayName = "SidebarMenuSubItemBase";
|
|
3732
|
-
var SidebarMenuSubButtonBase =
|
|
3914
|
+
var SidebarMenuSubButtonBase = React23.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
|
|
3733
3915
|
const Comp = asChild ? Slot5 : "a";
|
|
3734
|
-
return /* @__PURE__ */
|
|
3916
|
+
return /* @__PURE__ */ jsx34(
|
|
3735
3917
|
Comp,
|
|
3736
3918
|
{
|
|
3737
3919
|
ref,
|
|
@@ -3753,10 +3935,10 @@ var SidebarMenuSubButtonBase = React22.forwardRef(({ asChild = false, size = "md
|
|
|
3753
3935
|
SidebarMenuSubButtonBase.displayName = "SidebarMenuSubButtonBase";
|
|
3754
3936
|
|
|
3755
3937
|
// src/components/ui/SliderBase.tsx
|
|
3756
|
-
import * as
|
|
3938
|
+
import * as React24 from "react";
|
|
3757
3939
|
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
3758
|
-
import { jsx as
|
|
3759
|
-
var SlideBase =
|
|
3940
|
+
import { jsx as jsx35, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3941
|
+
var SlideBase = React24.forwardRef(
|
|
3760
3942
|
({
|
|
3761
3943
|
className,
|
|
3762
3944
|
orientation = "horizontal",
|
|
@@ -3766,7 +3948,7 @@ var SlideBase = React23.forwardRef(
|
|
|
3766
3948
|
...props
|
|
3767
3949
|
}, ref) => {
|
|
3768
3950
|
const isVertical = orientation === "vertical";
|
|
3769
|
-
return /* @__PURE__ */
|
|
3951
|
+
return /* @__PURE__ */ jsxs23(
|
|
3770
3952
|
"div",
|
|
3771
3953
|
{
|
|
3772
3954
|
className: cn(
|
|
@@ -3774,8 +3956,8 @@ var SlideBase = React23.forwardRef(
|
|
|
3774
3956
|
isVertical ? "h-full " : "w-full"
|
|
3775
3957
|
),
|
|
3776
3958
|
children: [
|
|
3777
|
-
label && /* @__PURE__ */
|
|
3778
|
-
/* @__PURE__ */
|
|
3959
|
+
label && /* @__PURE__ */ jsx35(LabelBase_default, { className: "py-2", children: label }),
|
|
3960
|
+
/* @__PURE__ */ jsxs23(
|
|
3779
3961
|
"div",
|
|
3780
3962
|
{
|
|
3781
3963
|
className: cn(
|
|
@@ -3783,8 +3965,8 @@ var SlideBase = React23.forwardRef(
|
|
|
3783
3965
|
isVertical ? "flex-col h-full" : "flex-row items-center w-full"
|
|
3784
3966
|
),
|
|
3785
3967
|
children: [
|
|
3786
|
-
leftIcon && /* @__PURE__ */
|
|
3787
|
-
/* @__PURE__ */
|
|
3968
|
+
leftIcon && /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-center", children: leftIcon }),
|
|
3969
|
+
/* @__PURE__ */ jsxs23(
|
|
3788
3970
|
SliderPrimitive.Root,
|
|
3789
3971
|
{
|
|
3790
3972
|
ref,
|
|
@@ -3796,14 +3978,14 @@ var SlideBase = React23.forwardRef(
|
|
|
3796
3978
|
),
|
|
3797
3979
|
...props,
|
|
3798
3980
|
children: [
|
|
3799
|
-
/* @__PURE__ */
|
|
3981
|
+
/* @__PURE__ */ jsx35(
|
|
3800
3982
|
SliderPrimitive.Track,
|
|
3801
3983
|
{
|
|
3802
3984
|
className: cn(
|
|
3803
3985
|
"relative overflow-hidden bg-primary/20 rounded-full",
|
|
3804
3986
|
isVertical ? "w-1.5 h-full" : "h-1.5 w-full"
|
|
3805
3987
|
),
|
|
3806
|
-
children: /* @__PURE__ */
|
|
3988
|
+
children: /* @__PURE__ */ jsx35(
|
|
3807
3989
|
SliderPrimitive.Range,
|
|
3808
3990
|
{
|
|
3809
3991
|
className: cn(
|
|
@@ -3814,7 +3996,7 @@ var SlideBase = React23.forwardRef(
|
|
|
3814
3996
|
)
|
|
3815
3997
|
}
|
|
3816
3998
|
),
|
|
3817
|
-
/* @__PURE__ */
|
|
3999
|
+
/* @__PURE__ */ jsx35(
|
|
3818
4000
|
SliderPrimitive.Thumb,
|
|
3819
4001
|
{
|
|
3820
4002
|
className: cn(
|
|
@@ -3827,7 +4009,7 @@ var SlideBase = React23.forwardRef(
|
|
|
3827
4009
|
]
|
|
3828
4010
|
}
|
|
3829
4011
|
),
|
|
3830
|
-
rightIcon && /* @__PURE__ */
|
|
4012
|
+
rightIcon && /* @__PURE__ */ jsx35("div", { className: "flex items-center justify-center", children: rightIcon })
|
|
3831
4013
|
]
|
|
3832
4014
|
}
|
|
3833
4015
|
)
|
|
@@ -3847,10 +4029,10 @@ import {
|
|
|
3847
4029
|
SpinnerIcon
|
|
3848
4030
|
} from "@phosphor-icons/react";
|
|
3849
4031
|
import { Toaster as Sonner, toast as sonnertoast } from "sonner";
|
|
3850
|
-
import { jsx as
|
|
4032
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3851
4033
|
var iconBaseClass = "w-5 h-auto";
|
|
3852
4034
|
var Toaster = ({ testId, ...props }) => {
|
|
3853
|
-
return /* @__PURE__ */
|
|
4035
|
+
return /* @__PURE__ */ jsx36(
|
|
3854
4036
|
Sonner,
|
|
3855
4037
|
{
|
|
3856
4038
|
className: "toaster group",
|
|
@@ -3897,33 +4079,33 @@ var Toaster = ({ testId, ...props }) => {
|
|
|
3897
4079
|
};
|
|
3898
4080
|
var toast = {
|
|
3899
4081
|
success: (message) => sonnertoast.success(message, {
|
|
3900
|
-
icon: /* @__PURE__ */
|
|
4082
|
+
icon: /* @__PURE__ */ jsx36(CheckCircleIcon, { className: `${iconBaseClass} text-green-600`, weight: "fill" }),
|
|
3901
4083
|
className: "sonner-success"
|
|
3902
4084
|
}),
|
|
3903
4085
|
error: (message) => sonnertoast.error(message, {
|
|
3904
|
-
icon: /* @__PURE__ */
|
|
4086
|
+
icon: /* @__PURE__ */ jsx36(XCircleIcon, { className: `${iconBaseClass} text-red-600`, weight: "fill" }),
|
|
3905
4087
|
className: "sonner-error"
|
|
3906
4088
|
}),
|
|
3907
4089
|
warning: (message) => sonnertoast.warning(message, {
|
|
3908
|
-
icon: /* @__PURE__ */
|
|
4090
|
+
icon: /* @__PURE__ */ jsx36(WarningIcon, { className: `${iconBaseClass} text-yellow-600`, weight: "fill" }),
|
|
3909
4091
|
className: "sonner-WarningIcon"
|
|
3910
4092
|
}),
|
|
3911
4093
|
info: (message) => sonnertoast.info(message, {
|
|
3912
|
-
icon: /* @__PURE__ */
|
|
4094
|
+
icon: /* @__PURE__ */ jsx36(InfoIcon, { className: `${iconBaseClass} text-blue-600`, weight: "fill" }),
|
|
3913
4095
|
className: "sonner-InfoIcon"
|
|
3914
4096
|
}),
|
|
3915
4097
|
loading: (message) => sonnertoast(message, {
|
|
3916
|
-
icon: /* @__PURE__ */
|
|
4098
|
+
icon: /* @__PURE__ */ jsx36(SpinnerIcon, { className: `${iconBaseClass} animate-spin text-neutral-500`, weight: "fill" }),
|
|
3917
4099
|
className: "sonner-loading"
|
|
3918
4100
|
})
|
|
3919
4101
|
};
|
|
3920
4102
|
|
|
3921
4103
|
// src/components/ui/SwitchBase.tsx
|
|
3922
|
-
import * as
|
|
4104
|
+
import * as React25 from "react";
|
|
3923
4105
|
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
3924
|
-
import { jsx as
|
|
3925
|
-
var SwitchBase =
|
|
3926
|
-
return /* @__PURE__ */
|
|
4106
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
4107
|
+
var SwitchBase = React25.forwardRef(({ className, testid: dataTestId = "switch-base", ...props }, ref) => {
|
|
4108
|
+
return /* @__PURE__ */ jsx37(
|
|
3927
4109
|
SwitchPrimitives.Root,
|
|
3928
4110
|
{
|
|
3929
4111
|
...props,
|
|
@@ -3933,7 +4115,7 @@ var SwitchBase = React24.forwardRef(({ className, testid: dataTestId = "switch-b
|
|
|
3933
4115
|
className
|
|
3934
4116
|
),
|
|
3935
4117
|
"data-testid": dataTestId,
|
|
3936
|
-
children: /* @__PURE__ */
|
|
4118
|
+
children: /* @__PURE__ */ jsx37(
|
|
3937
4119
|
SwitchPrimitives.Thumb,
|
|
3938
4120
|
{
|
|
3939
4121
|
className: cn(
|
|
@@ -3951,9 +4133,9 @@ var SwitchBase = React24.forwardRef(({ className, testid: dataTestId = "switch-b
|
|
|
3951
4133
|
SwitchBase.displayName = SwitchPrimitives.Root.displayName;
|
|
3952
4134
|
|
|
3953
4135
|
// src/components/ui/TableBase.tsx
|
|
3954
|
-
import * as
|
|
3955
|
-
import { jsx as
|
|
3956
|
-
var TableBase =
|
|
4136
|
+
import * as React26 from "react";
|
|
4137
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
4138
|
+
var TableBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx38(
|
|
3957
4139
|
"table",
|
|
3958
4140
|
{
|
|
3959
4141
|
ref,
|
|
@@ -3962,9 +4144,9 @@ var TableBase = React25.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
3962
4144
|
}
|
|
3963
4145
|
) }));
|
|
3964
4146
|
TableBase.displayName = "TableBase";
|
|
3965
|
-
var TableHeaderBase =
|
|
4147
|
+
var TableHeaderBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
3966
4148
|
TableHeaderBase.displayName = "TableHeaderBase";
|
|
3967
|
-
var TableBodyBase =
|
|
4149
|
+
var TableBodyBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
3968
4150
|
"tbody",
|
|
3969
4151
|
{
|
|
3970
4152
|
ref,
|
|
@@ -3973,7 +4155,7 @@ var TableBodyBase = React25.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
3973
4155
|
}
|
|
3974
4156
|
));
|
|
3975
4157
|
TableBodyBase.displayName = "TableBodyBase";
|
|
3976
|
-
var TableFooterBase =
|
|
4158
|
+
var TableFooterBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
3977
4159
|
"tfoot",
|
|
3978
4160
|
{
|
|
3979
4161
|
ref,
|
|
@@ -3985,7 +4167,7 @@ var TableFooterBase = React25.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
3985
4167
|
}
|
|
3986
4168
|
));
|
|
3987
4169
|
TableFooterBase.displayName = "TableFooterBase";
|
|
3988
|
-
var TableRowBase =
|
|
4170
|
+
var TableRowBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
3989
4171
|
"tr",
|
|
3990
4172
|
{
|
|
3991
4173
|
ref,
|
|
@@ -3997,7 +4179,7 @@ var TableRowBase = React25.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
3997
4179
|
}
|
|
3998
4180
|
));
|
|
3999
4181
|
TableRowBase.displayName = "TableRowBase";
|
|
4000
|
-
var TableHeadBase =
|
|
4182
|
+
var TableHeadBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
4001
4183
|
"th",
|
|
4002
4184
|
{
|
|
4003
4185
|
ref,
|
|
@@ -4009,7 +4191,7 @@ var TableHeadBase = React25.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
4009
4191
|
}
|
|
4010
4192
|
));
|
|
4011
4193
|
TableHeadBase.displayName = "TableHeadBase";
|
|
4012
|
-
var TableCellBase =
|
|
4194
|
+
var TableCellBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
4013
4195
|
"td",
|
|
4014
4196
|
{
|
|
4015
4197
|
ref,
|
|
@@ -4021,7 +4203,7 @@ var TableCellBase = React25.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
4021
4203
|
}
|
|
4022
4204
|
));
|
|
4023
4205
|
TableCellBase.displayName = "TableCellBase";
|
|
4024
|
-
var TableCaptionBase =
|
|
4206
|
+
var TableCaptionBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx38(
|
|
4025
4207
|
"caption",
|
|
4026
4208
|
{
|
|
4027
4209
|
ref,
|
|
@@ -4032,11 +4214,11 @@ var TableCaptionBase = React25.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4032
4214
|
TableCaptionBase.displayName = "TableCaptionBase";
|
|
4033
4215
|
|
|
4034
4216
|
// src/components/ui/TabsBase.tsx
|
|
4035
|
-
import * as
|
|
4217
|
+
import * as React27 from "react";
|
|
4036
4218
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4037
|
-
import { jsx as
|
|
4219
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
4038
4220
|
var TabsBase = TabsPrimitive.Root;
|
|
4039
|
-
var TabsListBase =
|
|
4221
|
+
var TabsListBase = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
4040
4222
|
TabsPrimitive.List,
|
|
4041
4223
|
{
|
|
4042
4224
|
ref,
|
|
@@ -4048,7 +4230,7 @@ var TabsListBase = React26.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
4048
4230
|
}
|
|
4049
4231
|
));
|
|
4050
4232
|
TabsListBase.displayName = TabsPrimitive.List.displayName;
|
|
4051
|
-
var TabsTriggerBase =
|
|
4233
|
+
var TabsTriggerBase = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
4052
4234
|
TabsPrimitive.Trigger,
|
|
4053
4235
|
{
|
|
4054
4236
|
ref,
|
|
@@ -4066,7 +4248,7 @@ var TabsTriggerBase = React26.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4066
4248
|
...props
|
|
4067
4249
|
}
|
|
4068
4250
|
));
|
|
4069
|
-
var TabsContentBase =
|
|
4251
|
+
var TabsContentBase = React27.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx39(
|
|
4070
4252
|
TabsPrimitive.Content,
|
|
4071
4253
|
{
|
|
4072
4254
|
ref,
|
|
@@ -4081,10 +4263,10 @@ var TabsContentBase = React26.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4081
4263
|
TabsContentBase.displayName = TabsPrimitive.Content.displayName;
|
|
4082
4264
|
|
|
4083
4265
|
// src/components/ui/TextAreaBase.tsx
|
|
4084
|
-
import * as
|
|
4085
|
-
import { jsx as
|
|
4086
|
-
var TextAreaBase =
|
|
4087
|
-
return /* @__PURE__ */
|
|
4266
|
+
import * as React28 from "react";
|
|
4267
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
4268
|
+
var TextAreaBase = React28.forwardRef(({ className, ...props }, ref) => {
|
|
4269
|
+
return /* @__PURE__ */ jsx40(
|
|
4088
4270
|
"textarea",
|
|
4089
4271
|
{
|
|
4090
4272
|
className: cn(
|
|
@@ -4102,8 +4284,8 @@ TextAreaBase.displayName = "TextAreaBase";
|
|
|
4102
4284
|
import { CheckIcon as CheckIcon6, MoonIcon, SunIcon } from "@phosphor-icons/react";
|
|
4103
4285
|
|
|
4104
4286
|
// src/components/theme-provider.tsx
|
|
4105
|
-
import { createContext as createContext3, useContext as useContext4, useEffect as
|
|
4106
|
-
import { jsx as
|
|
4287
|
+
import { createContext as createContext3, useContext as useContext4, useEffect as useEffect6, useState as useState6 } from "react";
|
|
4288
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
4107
4289
|
var initialState = {
|
|
4108
4290
|
theme: "system",
|
|
4109
4291
|
setTheme: () => null
|
|
@@ -4116,7 +4298,7 @@ function ThemeProviderBase({
|
|
|
4116
4298
|
...props
|
|
4117
4299
|
}) {
|
|
4118
4300
|
const [theme, setThemeState] = useState6(defaultTheme);
|
|
4119
|
-
|
|
4301
|
+
useEffect6(() => {
|
|
4120
4302
|
const root = window.document.documentElement;
|
|
4121
4303
|
root.classList.remove(
|
|
4122
4304
|
"light",
|
|
@@ -4142,7 +4324,7 @@ function ThemeProviderBase({
|
|
|
4142
4324
|
document.body.style.color = "";
|
|
4143
4325
|
}
|
|
4144
4326
|
}, [theme]);
|
|
4145
|
-
|
|
4327
|
+
useEffect6(() => {
|
|
4146
4328
|
const stored = localStorage.getItem(storageKey);
|
|
4147
4329
|
if (stored) setThemeState(stored);
|
|
4148
4330
|
}, [storageKey]);
|
|
@@ -4153,7 +4335,7 @@ function ThemeProviderBase({
|
|
|
4153
4335
|
setThemeState(newTheme);
|
|
4154
4336
|
};
|
|
4155
4337
|
const value = { theme, setTheme };
|
|
4156
|
-
return /* @__PURE__ */
|
|
4338
|
+
return /* @__PURE__ */ jsx41(ThemeProviderContext.Provider, { ...props, value, children });
|
|
4157
4339
|
}
|
|
4158
4340
|
var useTheme = () => {
|
|
4159
4341
|
const context = useContext4(ThemeProviderContext);
|
|
@@ -4163,7 +4345,7 @@ var useTheme = () => {
|
|
|
4163
4345
|
};
|
|
4164
4346
|
|
|
4165
4347
|
// src/components/mode-toggle.tsx
|
|
4166
|
-
import { Fragment as Fragment3, jsx as
|
|
4348
|
+
import { Fragment as Fragment3, jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4167
4349
|
var themeLabels = {
|
|
4168
4350
|
light: "Light",
|
|
4169
4351
|
dark: "Dark",
|
|
@@ -4180,30 +4362,30 @@ function ModeToggleBase({
|
|
|
4180
4362
|
}) {
|
|
4181
4363
|
const { setTheme, theme: currentTheme } = useTheme();
|
|
4182
4364
|
const isDark = currentTheme?.includes("dark") || currentTheme === "system" && typeof window !== "undefined" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
4183
|
-
return /* @__PURE__ */
|
|
4184
|
-
/* @__PURE__ */
|
|
4365
|
+
return /* @__PURE__ */ jsxs24(DropDownMenuBase, { children: [
|
|
4366
|
+
/* @__PURE__ */ jsx42(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs24(
|
|
4185
4367
|
ButtonBase,
|
|
4186
4368
|
{
|
|
4187
4369
|
variant: "ghost",
|
|
4188
4370
|
size: "icon",
|
|
4189
4371
|
className: "relative overflow-hidden border-transparent",
|
|
4190
4372
|
children: [
|
|
4191
|
-
/* @__PURE__ */
|
|
4192
|
-
/* @__PURE__ */
|
|
4193
|
-
/* @__PURE__ */
|
|
4373
|
+
/* @__PURE__ */ jsxs24(Fragment3, { children: [
|
|
4374
|
+
/* @__PURE__ */ jsx42(SunIcon, { className: `h-[1.2rem] w-[1.2rem] transition-transform duration-300 ${isDark ? "rotate-90 scale-0" : "rotate-0 scale-100"}` }),
|
|
4375
|
+
/* @__PURE__ */ jsx42(MoonIcon, { className: `absolute h-[1.2rem] w-[1.2rem] transition-transform duration-300 ${isDark ? "rotate-0 scale-100" : "rotate-90 scale-0"}` })
|
|
4194
4376
|
] }),
|
|
4195
|
-
/* @__PURE__ */
|
|
4377
|
+
/* @__PURE__ */ jsx42("span", { className: "sr-only", children: "Toggle theme" })
|
|
4196
4378
|
]
|
|
4197
4379
|
}
|
|
4198
4380
|
) }),
|
|
4199
|
-
/* @__PURE__ */
|
|
4381
|
+
/* @__PURE__ */ jsx42(DropDownMenuContentBase, { align: "end", className: "border-border bg-popover text-popover-foreground", children: themes.map((theme) => /* @__PURE__ */ jsxs24(
|
|
4200
4382
|
DropDownMenuItemBase,
|
|
4201
4383
|
{
|
|
4202
4384
|
onClick: () => setTheme(theme),
|
|
4203
4385
|
className: "flex items-center justify-between hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground",
|
|
4204
4386
|
children: [
|
|
4205
4387
|
themeLabels[theme],
|
|
4206
|
-
currentTheme === theme && /* @__PURE__ */
|
|
4388
|
+
currentTheme === theme && /* @__PURE__ */ jsx42(CheckIcon6, { className: "h-4 w-4 opacity-100" })
|
|
4207
4389
|
]
|
|
4208
4390
|
},
|
|
4209
4391
|
theme
|
|
@@ -4215,114 +4397,101 @@ function ModeToggleBase({
|
|
|
4215
4397
|
import { add, format } from "date-fns";
|
|
4216
4398
|
|
|
4217
4399
|
// src/components/date-time-picker/calendar.tsx
|
|
4218
|
-
import * as
|
|
4400
|
+
import * as React29 from "react";
|
|
4219
4401
|
import { DayPicker as DayPicker2 } from "react-day-picker";
|
|
4220
|
-
import {
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
center: {
|
|
4229
|
-
opacity: 1,
|
|
4230
|
-
x: 0
|
|
4231
|
-
},
|
|
4232
|
-
exit: (direction) => ({
|
|
4233
|
-
opacity: 0,
|
|
4234
|
-
x: direction > 0 ? -30 : 30
|
|
4235
|
-
})
|
|
4236
|
-
};
|
|
4402
|
+
import {
|
|
4403
|
+
CaretLeftIcon as CaretLeftIcon2,
|
|
4404
|
+
CaretRightIcon as CaretRightIcon5,
|
|
4405
|
+
XIcon as XIcon4,
|
|
4406
|
+
CalendarIcon
|
|
4407
|
+
} from "@phosphor-icons/react";
|
|
4408
|
+
import { AnimatePresence as AnimatePresence4 } from "framer-motion";
|
|
4409
|
+
import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4237
4410
|
function CalendarBase2({
|
|
4238
4411
|
className,
|
|
4239
4412
|
classNames,
|
|
4240
4413
|
showOutsideDays = true,
|
|
4241
4414
|
...props
|
|
4242
4415
|
}) {
|
|
4243
|
-
const [month, setMonth] =
|
|
4416
|
+
const [month, setMonth] = React29.useState(
|
|
4244
4417
|
props.month || props.defaultMonth || /* @__PURE__ */ new Date()
|
|
4245
4418
|
);
|
|
4246
|
-
const [direction, setDirection] =
|
|
4419
|
+
const [direction, setDirection] = React29.useState(1);
|
|
4247
4420
|
const handleMonthChange = (newMonth) => {
|
|
4248
4421
|
const isNext = newMonth > month ? 1 : -1;
|
|
4249
4422
|
setDirection(isNext);
|
|
4250
4423
|
setMonth(newMonth);
|
|
4251
4424
|
props.onMonthChange?.(newMonth);
|
|
4252
4425
|
};
|
|
4253
|
-
return /* @__PURE__ */
|
|
4426
|
+
return /* @__PURE__ */ jsx43(
|
|
4254
4427
|
"div",
|
|
4255
4428
|
{
|
|
4256
4429
|
className: cn(
|
|
4257
|
-
"rounded-
|
|
4430
|
+
"rounded-2xl border bg-background p-4 shadow-lg overflow-hidden w-full h-full flex flex-col",
|
|
4258
4431
|
className
|
|
4259
4432
|
),
|
|
4260
|
-
children: /* @__PURE__ */
|
|
4261
|
-
|
|
4433
|
+
children: /* @__PURE__ */ jsx43("div", { className: "relative flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsx43(AnimatePresence4, { initial: false, mode: "wait", custom: direction, children: /* @__PURE__ */ jsx43(
|
|
4434
|
+
"div",
|
|
4262
4435
|
{
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
animate: "center",
|
|
4266
|
-
exit: "exit",
|
|
4267
|
-
custom: direction,
|
|
4268
|
-
transition: { duration: 0.3, ease: "easeInOut" },
|
|
4269
|
-
style: { position: "relative" },
|
|
4270
|
-
children: /* @__PURE__ */ jsx42(
|
|
4436
|
+
className: "w-full h-full flex flex-col",
|
|
4437
|
+
children: /* @__PURE__ */ jsx43(
|
|
4271
4438
|
DayPicker2,
|
|
4272
4439
|
{
|
|
4273
4440
|
showOutsideDays,
|
|
4274
4441
|
month,
|
|
4275
4442
|
onMonthChange: handleMonthChange,
|
|
4276
|
-
className: "w-full",
|
|
4443
|
+
className: "w-full h-full min-w-0 flex flex-col",
|
|
4277
4444
|
classNames: {
|
|
4278
|
-
months: "flex items-center flex-col sm:flex-row space-y-
|
|
4279
|
-
month: "space-y-
|
|
4280
|
-
caption: "flex justify-center pt-1 relative items-center",
|
|
4281
|
-
caption_label: "text-
|
|
4445
|
+
months: "flex items-center flex-col sm:flex-row space-y-2 sm:space-x-2 sm:space-y-0 flex-1",
|
|
4446
|
+
month: "space-y-2 min-w-0 flex-1 flex flex-col",
|
|
4447
|
+
caption: "flex justify-center pt-1 relative items-center h-[10%] min-h-[2rem] mb-2",
|
|
4448
|
+
caption_label: "text-[clamp(0.875rem,2.5vw,1.25rem)] font-semibold truncate px-10 tracking-tight",
|
|
4282
4449
|
nav: "space-x-1 flex items-center",
|
|
4283
4450
|
nav_button: cn(
|
|
4284
4451
|
buttonVariantsBase({ variant: "outline" }),
|
|
4285
|
-
"h-
|
|
4452
|
+
"h-8 w-8 bg-background p-0 opacity-60 hover:opacity-100 hover:bg-muted flex-shrink-0 touch-manipulation transition-all duration-200 ease-out hover:scale-105 active:scale-95",
|
|
4453
|
+
"[@media(min-width:400px)]:h-9 [@media(min-width:400px)]:w-9"
|
|
4286
4454
|
),
|
|
4287
|
-
nav_button_previous: "absolute left-
|
|
4288
|
-
nav_button_next: "absolute right-
|
|
4289
|
-
table: "w-full border-collapse
|
|
4290
|
-
head_row: "flex",
|
|
4291
|
-
head_cell: "text-muted-foreground rounded-md w-
|
|
4292
|
-
row: "flex w-full
|
|
4455
|
+
nav_button_previous: "absolute left-0",
|
|
4456
|
+
nav_button_next: "absolute right-0",
|
|
4457
|
+
table: "w-full border-collapse min-w-0 flex-1 flex flex-col",
|
|
4458
|
+
head_row: "flex w-full gap-1 mb-1",
|
|
4459
|
+
head_cell: "text-muted-foreground rounded-md flex-1 min-w-0 font-semibold text-[clamp(0.625rem,1.5vw,0.75rem)] text-center pb-1 uppercase tracking-wider",
|
|
4460
|
+
row: "flex w-full flex-1 gap-1",
|
|
4293
4461
|
cell: cn(
|
|
4294
|
-
"
|
|
4295
|
-
"[&:has([aria-selected].day-range-end)]:rounded-r-
|
|
4296
|
-
"[&:has([aria-selected].day-range-start)]:rounded-l-
|
|
4462
|
+
"flex-1 min-w-0 aspect-square text-center p-0 relative",
|
|
4463
|
+
"[&:has([aria-selected].day-range-end)]:rounded-r-lg",
|
|
4464
|
+
"[&:has([aria-selected].day-range-start)]:rounded-l-lg",
|
|
4297
4465
|
"[&:has([aria-selected].day-outside)]:bg-muted/50",
|
|
4298
4466
|
"[&:has([aria-selected])]:bg-muted",
|
|
4299
|
-
"first:[&:has([aria-selected])]:rounded-l-
|
|
4300
|
-
"last:[&:has([aria-selected])]:rounded-r-
|
|
4467
|
+
"first:[&:has([aria-selected])]:rounded-l-lg",
|
|
4468
|
+
"last:[&:has([aria-selected])]:rounded-r-lg",
|
|
4301
4469
|
"focus-within:relative focus-within:z-20"
|
|
4302
4470
|
),
|
|
4303
4471
|
day: cn(
|
|
4304
4472
|
buttonVariantsBase({ variant: "ghost" }),
|
|
4305
|
-
"
|
|
4306
|
-
"aria-selected:opacity-100 hover:bg-muted"
|
|
4473
|
+
"w-full h-full p-0 rounded-lg",
|
|
4474
|
+
"aria-selected:opacity-100 hover:bg-muted text-[clamp(0.75rem,2vw,1rem)] flex items-center justify-center",
|
|
4475
|
+
"touch-manipulation transition-all duration-200 ease-out hover:scale-105 active:scale-95"
|
|
4307
4476
|
),
|
|
4308
|
-
day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90",
|
|
4309
|
-
day_today: "bg-muted text-foreground
|
|
4310
|
-
day_outside: "day-outside text-
|
|
4311
|
-
day_disabled: "text-
|
|
4477
|
+
day_selected: "bg-primary text-primary-foreground hover:bg-primary/90 focus:bg-primary/90 font-semibold",
|
|
4478
|
+
day_today: "bg-muted text-foreground font-bold ring-2 ring-primary/30 ring-inset",
|
|
4479
|
+
day_outside: "day-outside text-muted-foreground/40 opacity-40 aria-selected:bg-muted/50 aria-selected:text-foreground",
|
|
4480
|
+
day_disabled: "text-muted-foreground/30 opacity-40 cursor-not-allowed",
|
|
4312
4481
|
day_range_middle: "aria-selected:bg-muted aria-selected:text-foreground",
|
|
4313
4482
|
day_hidden: "invisible",
|
|
4314
4483
|
...classNames
|
|
4315
4484
|
},
|
|
4316
4485
|
components: {
|
|
4317
|
-
IconLeft: () => /* @__PURE__ */
|
|
4318
|
-
IconRight: () => /* @__PURE__ */
|
|
4486
|
+
IconLeft: () => /* @__PURE__ */ jsx43(CaretLeftIcon2, { className: "h-4 w-4" }),
|
|
4487
|
+
IconRight: () => /* @__PURE__ */ jsx43(CaretRightIcon5, { className: "h-4 w-4" })
|
|
4319
4488
|
},
|
|
4320
4489
|
...props
|
|
4321
4490
|
}
|
|
4322
4491
|
)
|
|
4323
4492
|
},
|
|
4324
4493
|
month.toISOString()
|
|
4325
|
-
)
|
|
4494
|
+
) }) })
|
|
4326
4495
|
}
|
|
4327
4496
|
);
|
|
4328
4497
|
}
|
|
@@ -4330,14 +4499,15 @@ CalendarBase2.displayName = "CalendarBase";
|
|
|
4330
4499
|
|
|
4331
4500
|
// src/components/date-time-picker/DateTimePicker.tsx
|
|
4332
4501
|
import { ptBR } from "date-fns/locale";
|
|
4333
|
-
import { useEffect as
|
|
4502
|
+
import { useEffect as useEffect7, useState as useState8 } from "react";
|
|
4334
4503
|
|
|
4335
4504
|
// src/components/date-time-picker/TimePicker.tsx
|
|
4336
|
-
import {
|
|
4337
|
-
import * as
|
|
4505
|
+
import { motion as motion6, AnimatePresence as AnimatePresence5 } from "framer-motion";
|
|
4506
|
+
import * as React31 from "react";
|
|
4338
4507
|
|
|
4339
4508
|
// src/components/date-time-picker/TimePickerInput.tsx
|
|
4340
|
-
import
|
|
4509
|
+
import { CaretUpIcon as CaretUpIcon2, CaretDownIcon as CaretDownIcon4 } from "@phosphor-icons/react";
|
|
4510
|
+
import React30 from "react";
|
|
4341
4511
|
|
|
4342
4512
|
// src/components/date-time-picker/time-picker-utils.ts
|
|
4343
4513
|
function isValidHour(value) {
|
|
@@ -4479,8 +4649,8 @@ function display12HourValue(hours) {
|
|
|
4479
4649
|
}
|
|
4480
4650
|
|
|
4481
4651
|
// src/components/date-time-picker/TimePickerInput.tsx
|
|
4482
|
-
import { jsx as
|
|
4483
|
-
var TimePickerInput =
|
|
4652
|
+
import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4653
|
+
var TimePickerInput = React30.forwardRef(
|
|
4484
4654
|
({
|
|
4485
4655
|
className,
|
|
4486
4656
|
type = "tel",
|
|
@@ -4495,11 +4665,14 @@ var TimePickerInput = React29.forwardRef(
|
|
|
4495
4665
|
period,
|
|
4496
4666
|
onLeftFocus,
|
|
4497
4667
|
onRightFocus,
|
|
4668
|
+
showArrows = true,
|
|
4669
|
+
label,
|
|
4498
4670
|
...props
|
|
4499
4671
|
}, ref) => {
|
|
4500
|
-
const [flag, setFlag] =
|
|
4501
|
-
const [prevIntKey, setPrevIntKey] =
|
|
4502
|
-
|
|
4672
|
+
const [flag, setFlag] = React30.useState(false);
|
|
4673
|
+
const [prevIntKey, setPrevIntKey] = React30.useState("0");
|
|
4674
|
+
const [isFocused, setIsFocused] = React30.useState(false);
|
|
4675
|
+
React30.useEffect(() => {
|
|
4503
4676
|
if (flag) {
|
|
4504
4677
|
const timer = setTimeout(() => {
|
|
4505
4678
|
setFlag(false);
|
|
@@ -4507,7 +4680,7 @@ var TimePickerInput = React29.forwardRef(
|
|
|
4507
4680
|
return () => clearTimeout(timer);
|
|
4508
4681
|
}
|
|
4509
4682
|
}, [flag]);
|
|
4510
|
-
const calculatedValue =
|
|
4683
|
+
const calculatedValue = React30.useMemo(() => {
|
|
4511
4684
|
return getDateByType(date, picker);
|
|
4512
4685
|
}, [date, picker]);
|
|
4513
4686
|
const calculateNewValue = (key) => {
|
|
@@ -4517,6 +4690,13 @@ var TimePickerInput = React29.forwardRef(
|
|
|
4517
4690
|
}
|
|
4518
4691
|
return !flag ? "0" + key : calculatedValue.slice(1, 2) + key;
|
|
4519
4692
|
};
|
|
4693
|
+
const handleArrowClick = (direction) => {
|
|
4694
|
+
const step = direction === "up" ? 1 : -1;
|
|
4695
|
+
const newValue = getArrowByType(calculatedValue, step, picker);
|
|
4696
|
+
if (flag) setFlag(false);
|
|
4697
|
+
const tempDate = new Date(date);
|
|
4698
|
+
setDate(setDateByType(tempDate, newValue, picker, period));
|
|
4699
|
+
};
|
|
4520
4700
|
const handleKeyDown = (e) => {
|
|
4521
4701
|
if (e.key === "Tab") return;
|
|
4522
4702
|
e.preventDefault();
|
|
@@ -4538,173 +4718,399 @@ var TimePickerInput = React29.forwardRef(
|
|
|
4538
4718
|
setDate(setDateByType(tempDate, newValue, picker, period));
|
|
4539
4719
|
}
|
|
4540
4720
|
};
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
{
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
e.preventDefault();
|
|
4554
|
-
onChange?.(e);
|
|
4555
|
-
},
|
|
4556
|
-
type,
|
|
4557
|
-
inputMode: "decimal",
|
|
4558
|
-
onKeyDown: (e) => {
|
|
4559
|
-
onKeyDown?.(e);
|
|
4560
|
-
handleKeyDown(e);
|
|
4561
|
-
},
|
|
4562
|
-
...props
|
|
4721
|
+
const getPickerLabel = () => {
|
|
4722
|
+
if (label) return label;
|
|
4723
|
+
switch (picker) {
|
|
4724
|
+
case "hours":
|
|
4725
|
+
case "12hours":
|
|
4726
|
+
return "Horas";
|
|
4727
|
+
case "minutes":
|
|
4728
|
+
return "Minutos";
|
|
4729
|
+
case "seconds":
|
|
4730
|
+
return "Segundos";
|
|
4731
|
+
default:
|
|
4732
|
+
return "";
|
|
4563
4733
|
}
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
);
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
const minuteRef = React30.useRef(null);
|
|
4573
|
-
const hourRef = React30.useRef(null);
|
|
4574
|
-
const secondRef = React30.useRef(null);
|
|
4575
|
-
return /* @__PURE__ */ jsxs25("div", { className: "flex items-end gap-2", children: [
|
|
4576
|
-
/* @__PURE__ */ jsxs25("div", { className: "grid gap-1 text-center", children: [
|
|
4577
|
-
/* @__PURE__ */ jsx44(LabelBase_default, { htmlFor: "hours", className: "text-xs", children: "Horas" }),
|
|
4578
|
-
/* @__PURE__ */ jsx44(
|
|
4579
|
-
TimePickerInput,
|
|
4580
|
-
{
|
|
4581
|
-
picker: "hours",
|
|
4582
|
-
date,
|
|
4583
|
-
setDate,
|
|
4584
|
-
ref: hourRef,
|
|
4585
|
-
onRightFocus: () => minuteRef.current?.focus()
|
|
4586
|
-
}
|
|
4587
|
-
)
|
|
4588
|
-
] }),
|
|
4589
|
-
/* @__PURE__ */ jsxs25("div", { className: "grid gap-1 text-center", children: [
|
|
4590
|
-
/* @__PURE__ */ jsx44(LabelBase_default, { htmlFor: "minutes", className: "text-xs", children: "Minutos" }),
|
|
4591
|
-
/* @__PURE__ */ jsx44(
|
|
4592
|
-
TimePickerInput,
|
|
4734
|
+
};
|
|
4735
|
+
const getAriaLabel = () => {
|
|
4736
|
+
const baseLabel = getPickerLabel();
|
|
4737
|
+
return `${baseLabel}, valor atual: ${calculatedValue}.`;
|
|
4738
|
+
};
|
|
4739
|
+
return /* @__PURE__ */ jsxs26("div", { className: "relative group flex flex-col items-center", children: [
|
|
4740
|
+
getPickerLabel() && /* @__PURE__ */ jsx44(
|
|
4741
|
+
"label",
|
|
4593
4742
|
{
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
ref: minuteRef,
|
|
4598
|
-
onLeftFocus: () => hourRef.current?.focus(),
|
|
4599
|
-
onRightFocus: () => secondRef.current?.focus()
|
|
4743
|
+
htmlFor: id || picker,
|
|
4744
|
+
className: "text-xs sm:text-sm font-medium text-muted-foreground mb-1 sm:mb-2 select-none",
|
|
4745
|
+
children: getPickerLabel()
|
|
4600
4746
|
}
|
|
4601
|
-
)
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
/* @__PURE__ */ jsx44(LabelBase_default, { htmlFor: "seconds", className: "text-xs", children: "Segundos" }),
|
|
4605
|
-
/* @__PURE__ */ jsx44(
|
|
4606
|
-
TimePickerInput,
|
|
4747
|
+
),
|
|
4748
|
+
/* @__PURE__ */ jsxs26(
|
|
4749
|
+
"div",
|
|
4607
4750
|
{
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4751
|
+
className: cn(
|
|
4752
|
+
"relative flex flex-col items-center",
|
|
4753
|
+
"transition-all duration-200"
|
|
4754
|
+
),
|
|
4755
|
+
children: [
|
|
4756
|
+
showArrows && /* @__PURE__ */ jsx44(
|
|
4757
|
+
"button",
|
|
4758
|
+
{
|
|
4759
|
+
type: "button",
|
|
4760
|
+
onClick: () => handleArrowClick("up"),
|
|
4761
|
+
className: cn(
|
|
4762
|
+
"flex items-center justify-center w-10 sm:w-12 h-5 sm:h-6 mb-1",
|
|
4763
|
+
"rounded-t",
|
|
4764
|
+
"bg-background hover:bg-accent active:bg-accent/80 transition-colors",
|
|
4765
|
+
"text-muted-foreground hover:text-foreground",
|
|
4766
|
+
"focus:outline-none focus:ring-1 focus:ring-ring",
|
|
4767
|
+
"touch-manipulation",
|
|
4768
|
+
isFocused && "border-ring"
|
|
4769
|
+
),
|
|
4770
|
+
tabIndex: -1,
|
|
4771
|
+
"aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
|
|
4772
|
+
children: /* @__PURE__ */ jsx44(CaretUpIcon2, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
4773
|
+
}
|
|
4774
|
+
),
|
|
4775
|
+
/* @__PURE__ */ jsxs26("div", { className: "relative", children: [
|
|
4776
|
+
/* @__PURE__ */ jsx44(
|
|
4777
|
+
"input",
|
|
4778
|
+
{
|
|
4779
|
+
ref,
|
|
4780
|
+
id: id || picker,
|
|
4781
|
+
name: name || picker,
|
|
4782
|
+
className: cn(
|
|
4783
|
+
"w-16 sm:w-20 h-10 sm:h-12 text-center font-mono text-lg sm:text-xl font-semibold",
|
|
4784
|
+
"border-2 rounded-lg",
|
|
4785
|
+
"bg-background text-foreground",
|
|
4786
|
+
"transition-all duration-200",
|
|
4787
|
+
"focus:outline-none focus:ring-2 focus:ring-ring focus:border-ring",
|
|
4788
|
+
"selection:bg-primary selection:text-primary-foreground",
|
|
4789
|
+
"touch-manipulation",
|
|
4790
|
+
showArrows && "rounded-lg",
|
|
4791
|
+
isFocused && "ring-2 ring-ring border-ring shadow-md",
|
|
4792
|
+
className
|
|
4793
|
+
),
|
|
4794
|
+
value: value || calculatedValue,
|
|
4795
|
+
onChange: (e) => {
|
|
4796
|
+
e.preventDefault();
|
|
4797
|
+
onChange?.(e);
|
|
4798
|
+
},
|
|
4799
|
+
onFocus: (e) => {
|
|
4800
|
+
setIsFocused(true);
|
|
4801
|
+
props.onFocus?.(e);
|
|
4802
|
+
e.target.select();
|
|
4803
|
+
},
|
|
4804
|
+
onBlur: (e) => {
|
|
4805
|
+
setIsFocused(false);
|
|
4806
|
+
props.onBlur?.(e);
|
|
4807
|
+
},
|
|
4808
|
+
type,
|
|
4809
|
+
inputMode: "decimal",
|
|
4810
|
+
onKeyDown: (e) => {
|
|
4811
|
+
onKeyDown?.(e);
|
|
4812
|
+
handleKeyDown(e);
|
|
4813
|
+
},
|
|
4814
|
+
"aria-label": getAriaLabel(),
|
|
4815
|
+
"aria-describedby": `${id || picker}-help`,
|
|
4816
|
+
autoComplete: "off",
|
|
4817
|
+
spellCheck: false,
|
|
4818
|
+
...props
|
|
4819
|
+
}
|
|
4820
|
+
),
|
|
4821
|
+
isFocused && /* @__PURE__ */ jsx44("div", { className: "absolute inset-0 rounded-lg ring-2 ring-primary/20 pointer-events-none animate-pulse" })
|
|
4822
|
+
] }),
|
|
4823
|
+
showArrows && /* @__PURE__ */ jsx44(
|
|
4824
|
+
"button",
|
|
4825
|
+
{
|
|
4826
|
+
type: "button",
|
|
4827
|
+
onClick: () => handleArrowClick("down"),
|
|
4828
|
+
className: cn(
|
|
4829
|
+
"flex items-center justify-center w-10 sm:w-12 h-5 sm:h-6 mt-1",
|
|
4830
|
+
"rounded-b",
|
|
4831
|
+
"bg-background hover:bg-accent active:bg-accent/80 transition-colors",
|
|
4832
|
+
"text-muted-foreground hover:text-foreground",
|
|
4833
|
+
"focus:outline-none focus:ring-1 focus:ring-ring",
|
|
4834
|
+
"touch-manipulation",
|
|
4835
|
+
isFocused && "border-ring"
|
|
4836
|
+
),
|
|
4837
|
+
tabIndex: -1,
|
|
4838
|
+
"aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
|
|
4839
|
+
children: /* @__PURE__ */ jsx44(CaretDownIcon4, { size: 14, className: "sm:w-4 sm:h-4" })
|
|
4840
|
+
}
|
|
4841
|
+
)
|
|
4842
|
+
]
|
|
4613
4843
|
}
|
|
4614
4844
|
)
|
|
4615
|
-
] })
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4845
|
+
] });
|
|
4846
|
+
}
|
|
4847
|
+
);
|
|
4848
|
+
TimePickerInput.displayName = "TimePickerInput";
|
|
4619
4849
|
|
|
4620
|
-
// src/components/date-time-picker/
|
|
4621
|
-
import {
|
|
4622
|
-
|
|
4623
|
-
function DateTimePicker({
|
|
4624
|
-
label,
|
|
4850
|
+
// src/components/date-time-picker/TimePicker.tsx
|
|
4851
|
+
import { Fragment as Fragment4, jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4852
|
+
function TimePicker({
|
|
4625
4853
|
date,
|
|
4626
|
-
|
|
4854
|
+
setDate,
|
|
4627
4855
|
hideSeconds,
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4856
|
+
enableButton
|
|
4857
|
+
}) {
|
|
4858
|
+
const minuteRef = React31.useRef(null);
|
|
4859
|
+
const hourRef = React31.useRef(null);
|
|
4860
|
+
const secondRef = React31.useRef(null);
|
|
4861
|
+
const containerVariants = {
|
|
4862
|
+
hidden: { opacity: 0, y: 10 },
|
|
4863
|
+
visible: {
|
|
4864
|
+
opacity: 1,
|
|
4865
|
+
y: 0,
|
|
4866
|
+
transition: {
|
|
4867
|
+
duration: 0.3,
|
|
4868
|
+
staggerChildren: 0.1
|
|
4869
|
+
}
|
|
4870
|
+
}
|
|
4871
|
+
};
|
|
4872
|
+
const itemVariants2 = {
|
|
4873
|
+
hidden: { opacity: 0, y: 10 },
|
|
4874
|
+
visible: { opacity: 1, y: 0 }
|
|
4875
|
+
};
|
|
4876
|
+
return /* @__PURE__ */ jsxs27(
|
|
4877
|
+
motion6.div,
|
|
4878
|
+
{
|
|
4879
|
+
variants: containerVariants,
|
|
4880
|
+
initial: "hidden",
|
|
4881
|
+
animate: "visible",
|
|
4882
|
+
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",
|
|
4883
|
+
children: [
|
|
4884
|
+
/* @__PURE__ */ jsx45(
|
|
4885
|
+
motion6.div,
|
|
4886
|
+
{
|
|
4887
|
+
variants: itemVariants2,
|
|
4888
|
+
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
4889
|
+
children: /* @__PURE__ */ jsx45(
|
|
4890
|
+
TimePickerInput,
|
|
4891
|
+
{
|
|
4892
|
+
picker: "hours",
|
|
4893
|
+
date,
|
|
4894
|
+
setDate,
|
|
4895
|
+
ref: hourRef,
|
|
4896
|
+
onRightFocus: () => minuteRef.current?.focus(),
|
|
4897
|
+
enableButton
|
|
4898
|
+
}
|
|
4899
|
+
)
|
|
4900
|
+
}
|
|
4901
|
+
),
|
|
4902
|
+
/* @__PURE__ */ jsx45(
|
|
4903
|
+
motion6.div,
|
|
4904
|
+
{
|
|
4905
|
+
variants: itemVariants2,
|
|
4906
|
+
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
4907
|
+
children: /* @__PURE__ */ jsx45(
|
|
4908
|
+
TimePickerInput,
|
|
4909
|
+
{
|
|
4910
|
+
picker: "minutes",
|
|
4911
|
+
date,
|
|
4912
|
+
setDate,
|
|
4913
|
+
ref: minuteRef,
|
|
4914
|
+
onLeftFocus: () => hourRef.current?.focus(),
|
|
4915
|
+
onRightFocus: () => secondRef.current?.focus(),
|
|
4916
|
+
enableButton
|
|
4917
|
+
}
|
|
4918
|
+
)
|
|
4919
|
+
}
|
|
4920
|
+
),
|
|
4921
|
+
/* @__PURE__ */ jsx45(AnimatePresence5, { children: !hideSeconds && /* @__PURE__ */ jsx45(Fragment4, { children: /* @__PURE__ */ jsx45(
|
|
4922
|
+
motion6.div,
|
|
4923
|
+
{
|
|
4924
|
+
variants: itemVariants2,
|
|
4925
|
+
initial: "hidden",
|
|
4926
|
+
animate: "visible",
|
|
4927
|
+
exit: "hidden",
|
|
4928
|
+
className: "grid gap-1 sm:gap-2 text-center flex-shrink-0 min-w-0",
|
|
4929
|
+
children: /* @__PURE__ */ jsx45(
|
|
4930
|
+
TimePickerInput,
|
|
4931
|
+
{
|
|
4932
|
+
picker: "seconds",
|
|
4933
|
+
date,
|
|
4934
|
+
setDate,
|
|
4935
|
+
ref: secondRef,
|
|
4936
|
+
onLeftFocus: () => minuteRef.current?.focus(),
|
|
4937
|
+
enableButton
|
|
4938
|
+
}
|
|
4939
|
+
)
|
|
4940
|
+
}
|
|
4941
|
+
) }) })
|
|
4942
|
+
]
|
|
4943
|
+
}
|
|
4944
|
+
);
|
|
4945
|
+
}
|
|
4946
|
+
|
|
4947
|
+
// src/components/date-time-picker/DateTimePicker.tsx
|
|
4948
|
+
import { CalendarBlankIcon, ClockIcon } from "@phosphor-icons/react";
|
|
4949
|
+
import { jsx as jsx46, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4950
|
+
function DateTimePicker({
|
|
4951
|
+
label,
|
|
4952
|
+
date,
|
|
4953
|
+
onChange,
|
|
4954
|
+
hideSeconds,
|
|
4955
|
+
hideHour,
|
|
4956
|
+
hideMinute,
|
|
4957
|
+
fromDate,
|
|
4958
|
+
toDate,
|
|
4959
|
+
disabled,
|
|
4960
|
+
className
|
|
4632
4961
|
}) {
|
|
4633
4962
|
const [internalDate, setInternalDate] = useState8(date);
|
|
4963
|
+
const [open, setOpen] = useState8(false);
|
|
4964
|
+
const [timePickerOpen, setTimePickerOpen] = useState8(false);
|
|
4634
4965
|
const handleSelect = (newDay) => {
|
|
4635
4966
|
if (!newDay) return;
|
|
4636
4967
|
if (!internalDate) {
|
|
4637
4968
|
setInternalDate(newDay);
|
|
4969
|
+
onChange(newDay);
|
|
4638
4970
|
return;
|
|
4639
4971
|
}
|
|
4640
4972
|
const diff = newDay.getTime() - internalDate.getTime();
|
|
4641
4973
|
const diffInDays = diff / (1e3 * 60 * 60 * 24);
|
|
4642
4974
|
const newDateFull = add(internalDate, { days: Math.ceil(diffInDays) });
|
|
4643
4975
|
setInternalDate(newDateFull);
|
|
4976
|
+
onChange(newDateFull);
|
|
4644
4977
|
};
|
|
4645
|
-
const
|
|
4646
|
-
|
|
4978
|
+
const handleTimeChange = (newDate) => {
|
|
4979
|
+
setInternalDate(newDate);
|
|
4980
|
+
onChange(newDate);
|
|
4981
|
+
};
|
|
4982
|
+
const getTimeFormat = () => {
|
|
4983
|
+
if (hideHour && hideMinute) return "";
|
|
4984
|
+
if (hideHour) return hideSeconds ? "mm" : "mm:ss";
|
|
4985
|
+
if (hideMinute) return hideSeconds ? "HH" : "HH':00'";
|
|
4986
|
+
return hideSeconds ? "HH:mm" : "HH:mm:ss";
|
|
4987
|
+
};
|
|
4988
|
+
const getDisplayFormat = () => {
|
|
4989
|
+
const timeFormat = getTimeFormat();
|
|
4990
|
+
if (!timeFormat) return "PPP";
|
|
4991
|
+
return `PPP - ${timeFormat}`;
|
|
4992
|
+
};
|
|
4993
|
+
useEffect7(() => {
|
|
4647
4994
|
if (date) {
|
|
4648
4995
|
setInternalDate(date);
|
|
4649
4996
|
}
|
|
4650
4997
|
}, [date, open]);
|
|
4651
|
-
return /* @__PURE__ */
|
|
4652
|
-
label && /* @__PURE__ */
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
/* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ jsxs28("div", { className: cn("space-y-2 w-full sm:w-auto", className), children: [
|
|
4999
|
+
label && /* @__PURE__ */ jsx46(LabelBase_default, { children: label }),
|
|
5000
|
+
/* @__PURE__ */ jsxs28(PopoverBase, { open, onOpenChange: setOpen, children: [
|
|
5001
|
+
/* @__PURE__ */ jsx46(PopoverTriggerBase, { disabled, asChild: true, children: /* @__PURE__ */ jsxs28(
|
|
4655
5002
|
ButtonBase,
|
|
4656
5003
|
{
|
|
4657
|
-
variant: "
|
|
5004
|
+
variant: "outline",
|
|
4658
5005
|
size: "lg",
|
|
4659
5006
|
className: cn(
|
|
4660
|
-
"w-full justify-start text-left
|
|
5007
|
+
"w-full justify-start text-left min-w-0 overflow-hidden",
|
|
5008
|
+
"min-h-[44px] sm:min-h-[48px] px-3 sm:px-4",
|
|
5009
|
+
"text-sm sm:text-base",
|
|
4661
5010
|
!date && "text-muted-foreground"
|
|
4662
5011
|
),
|
|
4663
5012
|
children: [
|
|
4664
|
-
|
|
4665
|
-
/* @__PURE__ */
|
|
5013
|
+
/* @__PURE__ */ jsx46("span", { className: "truncate flex-1", children: date ? format(date, getDisplayFormat(), { locale: ptBR }) : "Pick a date" }),
|
|
5014
|
+
/* @__PURE__ */ jsx46(CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
|
|
4666
5015
|
]
|
|
4667
5016
|
}
|
|
4668
5017
|
) }),
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
5018
|
+
/* @__PURE__ */ jsx46(
|
|
5019
|
+
PopoverContentBase,
|
|
5020
|
+
{
|
|
5021
|
+
className: "w-full p-0",
|
|
5022
|
+
align: "center",
|
|
5023
|
+
sideOffset: 4,
|
|
5024
|
+
side: "bottom",
|
|
5025
|
+
avoidCollisions: true,
|
|
5026
|
+
collisionPadding: 8,
|
|
5027
|
+
children: /* @__PURE__ */ jsxs28("div", { className: "flex flex-col space-y-2 sm:space-y-3 p-2 sm:p-3 md:p-4 max-h-[calc(100vh-4rem)] overflow-y-auto", children: [
|
|
5028
|
+
/* @__PURE__ */ jsx46(
|
|
5029
|
+
CalendarBase2,
|
|
5030
|
+
{
|
|
5031
|
+
mode: "single",
|
|
5032
|
+
locale: ptBR,
|
|
5033
|
+
selected: internalDate,
|
|
5034
|
+
onSelect: (d) => handleSelect(d),
|
|
5035
|
+
initialFocus: true,
|
|
5036
|
+
fromDate,
|
|
5037
|
+
toDate,
|
|
5038
|
+
className: "w-full"
|
|
5039
|
+
}
|
|
5040
|
+
),
|
|
5041
|
+
!(hideHour && hideMinute) && /* @__PURE__ */ jsx46("div", { className: "flex justify-center w-full px-2", children: /* @__PURE__ */ jsxs28(
|
|
5042
|
+
PopoverBase,
|
|
5043
|
+
{
|
|
5044
|
+
open: timePickerOpen,
|
|
5045
|
+
onOpenChange: setTimePickerOpen,
|
|
5046
|
+
children: [
|
|
5047
|
+
/* @__PURE__ */ jsx46(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ jsxs28(
|
|
5048
|
+
ButtonBase,
|
|
5049
|
+
{
|
|
5050
|
+
variant: "outline",
|
|
5051
|
+
size: "default",
|
|
5052
|
+
className: cn(
|
|
5053
|
+
"flex items-center justify-center gap-1.5 sm:gap-2",
|
|
5054
|
+
"px-2 sm:px-3 py-1.5 sm:py-2",
|
|
5055
|
+
"text-sm sm:text-base font-semibold w-full max-w-xs",
|
|
5056
|
+
"border-2 border-primary/20 rounded-lg",
|
|
5057
|
+
"bg-primary/5 hover:bg-primary/10 hover:border-primary/30",
|
|
5058
|
+
"transition-all duration-200",
|
|
5059
|
+
"shadow-sm hover:shadow-md active:scale-[0.98]",
|
|
5060
|
+
"min-h-[36px] sm:min-h-[40px]"
|
|
5061
|
+
),
|
|
5062
|
+
children: [
|
|
5063
|
+
/* @__PURE__ */ jsx46(ClockIcon, { className: "text-primary/70 flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
|
|
5064
|
+
/* @__PURE__ */ jsx46("span", { className: "text-foreground truncate", children: internalDate ? format(internalDate, getTimeFormat() || "HH:mm", {
|
|
5065
|
+
locale: ptBR
|
|
5066
|
+
}) : "00:00" })
|
|
5067
|
+
]
|
|
5068
|
+
}
|
|
5069
|
+
) }),
|
|
5070
|
+
/* @__PURE__ */ jsx46(
|
|
5071
|
+
PopoverContentBase,
|
|
5072
|
+
{
|
|
5073
|
+
className: "w-[calc(100vw-2rem)] max-w-sm p-3 sm:p-3 rounded-md",
|
|
5074
|
+
align: "center",
|
|
5075
|
+
side: "top",
|
|
5076
|
+
sideOffset: 8,
|
|
5077
|
+
avoidCollisions: true,
|
|
5078
|
+
collisionPadding: 8,
|
|
5079
|
+
children: /* @__PURE__ */ jsxs28("div", { className: "flex flex-col items-center space-y-2 sm:space-y-3", children: [
|
|
5080
|
+
/* @__PURE__ */ jsx46("h4", { className: "text-sm sm:text-base font-medium text-center", children: "Alterar Hor\xE1rio" }),
|
|
5081
|
+
/* @__PURE__ */ jsx46(
|
|
5082
|
+
TimePicker,
|
|
5083
|
+
{
|
|
5084
|
+
setDate: handleTimeChange,
|
|
5085
|
+
date: internalDate,
|
|
5086
|
+
hideSeconds
|
|
5087
|
+
}
|
|
5088
|
+
),
|
|
5089
|
+
/* @__PURE__ */ jsx46(
|
|
5090
|
+
ButtonBase,
|
|
5091
|
+
{
|
|
5092
|
+
size: "sm",
|
|
5093
|
+
variant: "destructive",
|
|
5094
|
+
onClick: () => setTimePickerOpen(false),
|
|
5095
|
+
className: "w-full text-xs sm:text-sm min-h-[36px] sm:min-h-[40px]",
|
|
5096
|
+
children: "Fechar"
|
|
5097
|
+
}
|
|
5098
|
+
)
|
|
5099
|
+
] })
|
|
5100
|
+
}
|
|
5101
|
+
)
|
|
5102
|
+
]
|
|
5103
|
+
}
|
|
5104
|
+
) })
|
|
5105
|
+
] })
|
|
5106
|
+
}
|
|
5107
|
+
)
|
|
4702
5108
|
] })
|
|
4703
5109
|
] });
|
|
4704
5110
|
}
|
|
4705
5111
|
|
|
4706
5112
|
// src/components/selects/Select.tsx
|
|
4707
|
-
import { Fragment as Fragment5, jsx as
|
|
5113
|
+
import { Fragment as Fragment5, jsx as jsx47, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4708
5114
|
function Select({
|
|
4709
5115
|
items,
|
|
4710
5116
|
groupItems,
|
|
@@ -4713,9 +5119,9 @@ function Select({
|
|
|
4713
5119
|
errorMessage,
|
|
4714
5120
|
testIds = {}
|
|
4715
5121
|
}) {
|
|
4716
|
-
return /* @__PURE__ */
|
|
4717
|
-
/* @__PURE__ */
|
|
4718
|
-
/* @__PURE__ */
|
|
5122
|
+
return /* @__PURE__ */ jsxs29("div", { "data-testid": testIds.root ?? "select-root", children: [
|
|
5123
|
+
/* @__PURE__ */ jsxs29(SelectBase, { onValueChange: onChange, "data-testid": testIds.base ?? "select-base", children: [
|
|
5124
|
+
/* @__PURE__ */ jsx47(
|
|
4719
5125
|
SelectTriggerBase,
|
|
4720
5126
|
{
|
|
4721
5127
|
className: cn(
|
|
@@ -4723,7 +5129,7 @@ function Select({
|
|
|
4723
5129
|
errorMessage && "border-red-500"
|
|
4724
5130
|
),
|
|
4725
5131
|
"data-testid": testIds.trigger ?? "select-trigger",
|
|
4726
|
-
children: /* @__PURE__ */
|
|
5132
|
+
children: /* @__PURE__ */ jsx47(
|
|
4727
5133
|
SelectValueBase,
|
|
4728
5134
|
{
|
|
4729
5135
|
placeholder,
|
|
@@ -4732,9 +5138,9 @@ function Select({
|
|
|
4732
5138
|
)
|
|
4733
5139
|
}
|
|
4734
5140
|
),
|
|
4735
|
-
/* @__PURE__ */
|
|
4736
|
-
/* @__PURE__ */
|
|
4737
|
-
groupItems[key].map((item) => /* @__PURE__ */
|
|
5141
|
+
/* @__PURE__ */ jsx47(ScrollAreaBase, { "data-testid": testIds.scrollarea ?? "select-scrollarea", children: /* @__PURE__ */ jsx47(SelectContentBase, { "data-testid": testIds.content ?? "select-content", children: groupItems ? /* @__PURE__ */ jsx47(Fragment5, { children: Object.keys(groupItems).map((key) => /* @__PURE__ */ jsxs29(SelectGroupBase, { "data-testid": testIds.group ?? "select-group", children: [
|
|
5142
|
+
/* @__PURE__ */ jsx47(SelectLabelBase, { "data-testid": testIds.label ?? "select-label", children: key }),
|
|
5143
|
+
groupItems[key].map((item) => /* @__PURE__ */ jsx47(
|
|
4738
5144
|
SelectItemBase,
|
|
4739
5145
|
{
|
|
4740
5146
|
value: item.value,
|
|
@@ -4743,7 +5149,7 @@ function Select({
|
|
|
4743
5149
|
},
|
|
4744
5150
|
item.value
|
|
4745
5151
|
))
|
|
4746
|
-
] }, key)) }) : /* @__PURE__ */
|
|
5152
|
+
] }, key)) }) : /* @__PURE__ */ jsx47(SelectGroupBase, { "data-testid": testIds.group ?? "select-group", children: items.map((item) => /* @__PURE__ */ jsx47(
|
|
4747
5153
|
SelectItemBase,
|
|
4748
5154
|
{
|
|
4749
5155
|
value: item.value,
|
|
@@ -4753,7 +5159,7 @@ function Select({
|
|
|
4753
5159
|
item.value
|
|
4754
5160
|
)) }) }) })
|
|
4755
5161
|
] }),
|
|
4756
|
-
errorMessage && /* @__PURE__ */
|
|
5162
|
+
errorMessage && /* @__PURE__ */ jsx47(
|
|
4757
5163
|
"p",
|
|
4758
5164
|
{
|
|
4759
5165
|
className: "text-sm text-red-500",
|
|
@@ -4765,9 +5171,9 @@ function Select({
|
|
|
4765
5171
|
}
|
|
4766
5172
|
|
|
4767
5173
|
// src/components/ui/DestructiveDialog.tsx
|
|
4768
|
-
import * as
|
|
5174
|
+
import * as React32 from "react";
|
|
4769
5175
|
import { XCircleIcon as XCircleIcon2 } from "@phosphor-icons/react";
|
|
4770
|
-
import { jsx as
|
|
5176
|
+
import { jsx as jsx48, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4771
5177
|
var DestructiveDialog = ({
|
|
4772
5178
|
title,
|
|
4773
5179
|
description,
|
|
@@ -4778,10 +5184,10 @@ var DestructiveDialog = ({
|
|
|
4778
5184
|
}) => {
|
|
4779
5185
|
const titleId = "destructive-dialog-title";
|
|
4780
5186
|
const descriptionId = "destructive-dialog-description";
|
|
4781
|
-
const triggerEl =
|
|
4782
|
-
return /* @__PURE__ */
|
|
5187
|
+
const triggerEl = React32.isValidElement(children) ? /* @__PURE__ */ jsx48(AlertDialogTriggerBase, { asChild: true, children }) : /* @__PURE__ */ jsx48(AlertDialogTriggerBase, { children: /* @__PURE__ */ jsx48(ButtonBase, { variant: "destructive", children: triggerContent ?? "Excluir" }) });
|
|
5188
|
+
return /* @__PURE__ */ jsxs30(AlertDialogBase, { children: [
|
|
4783
5189
|
triggerEl,
|
|
4784
|
-
/* @__PURE__ */
|
|
5190
|
+
/* @__PURE__ */ jsxs30(
|
|
4785
5191
|
AlertDialogContentBase,
|
|
4786
5192
|
{
|
|
4787
5193
|
role: "alertdialog",
|
|
@@ -4790,10 +5196,10 @@ var DestructiveDialog = ({
|
|
|
4790
5196
|
"aria-describedby": descriptionId,
|
|
4791
5197
|
className: cn("border border-destructive bg-background"),
|
|
4792
5198
|
children: [
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
4796
|
-
/* @__PURE__ */
|
|
5199
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex items-start gap-4", children: [
|
|
5200
|
+
/* @__PURE__ */ jsx48("div", { className: "flex items-center justify-center w-10 h-10 rounded-full ring-1 ring-destructive/30", children: /* @__PURE__ */ jsx48(XCircleIcon2, { className: "w-6 h-6 text-destructive" }) }),
|
|
5201
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex-1", children: [
|
|
5202
|
+
/* @__PURE__ */ jsx48(
|
|
4797
5203
|
AlertDialogTitleBase,
|
|
4798
5204
|
{
|
|
4799
5205
|
id: titleId,
|
|
@@ -4801,7 +5207,7 @@ var DestructiveDialog = ({
|
|
|
4801
5207
|
children: title
|
|
4802
5208
|
}
|
|
4803
5209
|
),
|
|
4804
|
-
/* @__PURE__ */
|
|
5210
|
+
/* @__PURE__ */ jsx48(
|
|
4805
5211
|
AlertDialogDescriptionBase,
|
|
4806
5212
|
{
|
|
4807
5213
|
id: descriptionId,
|
|
@@ -4811,8 +5217,8 @@ var DestructiveDialog = ({
|
|
|
4811
5217
|
)
|
|
4812
5218
|
] })
|
|
4813
5219
|
] }),
|
|
4814
|
-
/* @__PURE__ */
|
|
4815
|
-
/* @__PURE__ */
|
|
5220
|
+
/* @__PURE__ */ jsxs30(AlertDialogFooterBase, { className: "mt-2 flex justify-end gap-3", children: [
|
|
5221
|
+
/* @__PURE__ */ jsx48(
|
|
4816
5222
|
AlertDialogCancelBase,
|
|
4817
5223
|
{
|
|
4818
5224
|
onClick: onCancel,
|
|
@@ -4823,7 +5229,7 @@ var DestructiveDialog = ({
|
|
|
4823
5229
|
children: "Cancelar"
|
|
4824
5230
|
}
|
|
4825
5231
|
),
|
|
4826
|
-
/* @__PURE__ */
|
|
5232
|
+
/* @__PURE__ */ jsx48(
|
|
4827
5233
|
AlertDialogActionBase,
|
|
4828
5234
|
{
|
|
4829
5235
|
onClick: onConfirm,
|
|
@@ -4839,6 +5245,1467 @@ var DestructiveDialog = ({
|
|
|
4839
5245
|
)
|
|
4840
5246
|
] });
|
|
4841
5247
|
};
|
|
5248
|
+
|
|
5249
|
+
// src/components/charts/components/controls/PeriodsDropdown.tsx
|
|
5250
|
+
import { useState as useState9, useRef as useRef2, useEffect as useEffect8 } from "react";
|
|
5251
|
+
import { motion as motion7, AnimatePresence as AnimatePresence6 } from "framer-motion";
|
|
5252
|
+
import { DotsThreeIcon as DotsThreeIcon2 } from "@phosphor-icons/react/dist/ssr";
|
|
5253
|
+
import { Check } from "@phosphor-icons/react/dist/ssr";
|
|
5254
|
+
import { jsx as jsx49, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5255
|
+
var menuVariants = {
|
|
5256
|
+
hidden: { opacity: 0, y: -6, scale: 0.98 },
|
|
5257
|
+
visible: { opacity: 1, y: 0, scale: 1 },
|
|
5258
|
+
exit: { opacity: 0, y: -6, scale: 0.98 }
|
|
5259
|
+
};
|
|
5260
|
+
var itemVariants = {
|
|
5261
|
+
hidden: { opacity: 0, x: -6 },
|
|
5262
|
+
visible: { opacity: 1, x: 0 }
|
|
5263
|
+
};
|
|
5264
|
+
function PeriodsDropdown({
|
|
5265
|
+
processedData,
|
|
5266
|
+
onOpenPeriod,
|
|
5267
|
+
rightOffset,
|
|
5268
|
+
topOffset,
|
|
5269
|
+
activePeriod,
|
|
5270
|
+
activePeriods
|
|
5271
|
+
}) {
|
|
5272
|
+
const periods = processedData.map((d) => String(d.name));
|
|
5273
|
+
const [open, setOpen] = useState9(false);
|
|
5274
|
+
const wrapperRef = useRef2(null);
|
|
5275
|
+
const firstItemRef = useRef2(null);
|
|
5276
|
+
const listRef = useRef2(null);
|
|
5277
|
+
useEffect8(() => {
|
|
5278
|
+
const handleClickOutside = (e) => {
|
|
5279
|
+
if (!wrapperRef.current) return;
|
|
5280
|
+
if (!wrapperRef.current.contains(e.target)) setOpen(false);
|
|
5281
|
+
};
|
|
5282
|
+
const handleEscape = (e) => {
|
|
5283
|
+
if (e.key === "Escape") setOpen(false);
|
|
5284
|
+
};
|
|
5285
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
5286
|
+
document.addEventListener("keydown", handleEscape);
|
|
5287
|
+
return () => {
|
|
5288
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
5289
|
+
document.removeEventListener("keydown", handleEscape);
|
|
5290
|
+
};
|
|
5291
|
+
}, []);
|
|
5292
|
+
useEffect8(() => {
|
|
5293
|
+
if (open && firstItemRef.current) {
|
|
5294
|
+
firstItemRef.current.focus();
|
|
5295
|
+
}
|
|
5296
|
+
}, [open]);
|
|
5297
|
+
function handleSelect(p) {
|
|
5298
|
+
onOpenPeriod(p);
|
|
5299
|
+
setOpen(false);
|
|
5300
|
+
}
|
|
5301
|
+
const containerStyle = typeof rightOffset === "number" ? { position: "relative", zIndex: 30 } : { position: "relative", zIndex: 30 };
|
|
5302
|
+
return /* @__PURE__ */ jsxs31("div", { ref: wrapperRef, style: containerStyle, className: "mr-4", children: [
|
|
5303
|
+
/* @__PURE__ */ jsxs31(
|
|
5304
|
+
"button",
|
|
5305
|
+
{
|
|
5306
|
+
className: "relative p-2.5 rounded-md hover:bg-accent/10 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-accent/50 transition flex items-center justify-center",
|
|
5307
|
+
"aria-expanded": open,
|
|
5308
|
+
"aria-haspopup": "menu",
|
|
5309
|
+
"aria-controls": "periods-menu",
|
|
5310
|
+
onClick: () => setOpen((v) => !v),
|
|
5311
|
+
onKeyDown: (e) => {
|
|
5312
|
+
if (e.key === "ArrowDown") setOpen(true);
|
|
5313
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
5314
|
+
e.preventDefault();
|
|
5315
|
+
setOpen((v) => !v);
|
|
5316
|
+
}
|
|
5317
|
+
},
|
|
5318
|
+
title: open ? "Fechar lista de per\xEDodos" : "Abrir lista de per\xEDodos",
|
|
5319
|
+
children: [
|
|
5320
|
+
/* @__PURE__ */ jsx49(DotsThreeIcon2, { size: 18 }),
|
|
5321
|
+
/* @__PURE__ */ jsx49("span", { className: "sr-only", children: open ? "Fechar per\xEDodos" : "Abrir per\xEDodos" }),
|
|
5322
|
+
periods.length > 0 && /* @__PURE__ */ jsx49("span", { className: "absolute -top-1 -right-1 bg-accent text-foreground text-xs rounded-full w-5 h-5 flex items-center justify-center ring-1 ring-border", children: periods.length })
|
|
5323
|
+
]
|
|
5324
|
+
}
|
|
5325
|
+
),
|
|
5326
|
+
/* @__PURE__ */ jsx49(AnimatePresence6, { children: open && /* @__PURE__ */ jsxs31(
|
|
5327
|
+
motion7.div,
|
|
5328
|
+
{
|
|
5329
|
+
initial: "hidden",
|
|
5330
|
+
animate: "visible",
|
|
5331
|
+
exit: "exit",
|
|
5332
|
+
variants: menuVariants,
|
|
5333
|
+
transition: { type: "spring", stiffness: 500, damping: 30 },
|
|
5334
|
+
className: "bg-card border border-border rounded-lg shadow-lg overflow-hidden ring-1 ring-black/5",
|
|
5335
|
+
style: {
|
|
5336
|
+
minWidth: 200,
|
|
5337
|
+
maxHeight: 260,
|
|
5338
|
+
overflow: "hidden",
|
|
5339
|
+
position: "absolute",
|
|
5340
|
+
top: typeof topOffset === "number" ? topOffset : "calc(100% + 6px)",
|
|
5341
|
+
right: typeof rightOffset === "number" ? rightOffset : 0
|
|
5342
|
+
},
|
|
5343
|
+
role: "menu",
|
|
5344
|
+
"aria-orientation": "vertical",
|
|
5345
|
+
id: "periods-menu",
|
|
5346
|
+
children: [
|
|
5347
|
+
/* @__PURE__ */ jsx49("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground", children: "Per\xEDodos" }),
|
|
5348
|
+
/* @__PURE__ */ jsx49("div", { className: "h-px bg-border" }),
|
|
5349
|
+
/* @__PURE__ */ jsx49(
|
|
5350
|
+
"div",
|
|
5351
|
+
{
|
|
5352
|
+
ref: listRef,
|
|
5353
|
+
className: "flex flex-col p-2 gap-1",
|
|
5354
|
+
style: { maxHeight: 200, overflowY: "auto" },
|
|
5355
|
+
children: periods.map((p, idx) => /* @__PURE__ */ jsxs31(
|
|
5356
|
+
motion7.button,
|
|
5357
|
+
{
|
|
5358
|
+
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"),
|
|
5359
|
+
variants: itemVariants,
|
|
5360
|
+
initial: "hidden",
|
|
5361
|
+
animate: "visible",
|
|
5362
|
+
whileTap: { scale: 0.98 },
|
|
5363
|
+
onClick: () => handleSelect(p),
|
|
5364
|
+
ref: idx === 0 ? firstItemRef : void 0,
|
|
5365
|
+
role: "menuitem",
|
|
5366
|
+
"aria-checked": activePeriods && activePeriods.includes(p) || p === activePeriod,
|
|
5367
|
+
children: [
|
|
5368
|
+
/* @__PURE__ */ jsx49("span", { className: "truncate", children: p }),
|
|
5369
|
+
(activePeriods && activePeriods.includes(p) || p === activePeriod) && /* @__PURE__ */ jsx49("span", { className: "ml-2 text-primary flex items-center", children: /* @__PURE__ */ jsx49(Check, { size: 16, weight: "bold" }) })
|
|
5370
|
+
]
|
|
5371
|
+
},
|
|
5372
|
+
p
|
|
5373
|
+
))
|
|
5374
|
+
}
|
|
5375
|
+
)
|
|
5376
|
+
]
|
|
5377
|
+
}
|
|
5378
|
+
) })
|
|
5379
|
+
] });
|
|
5380
|
+
}
|
|
5381
|
+
var PeriodsDropdown_default = PeriodsDropdown;
|
|
5382
|
+
|
|
5383
|
+
// src/components/charts/components/controls/ShowOnly.tsx
|
|
5384
|
+
import { motion as motion8 } from "framer-motion";
|
|
5385
|
+
import { Eye, EyeSlash } from "@phosphor-icons/react";
|
|
5386
|
+
import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5387
|
+
var ShowOnly = ({
|
|
5388
|
+
showOnlyHighlighted,
|
|
5389
|
+
setShowOnlyHighlighted,
|
|
5390
|
+
highlightedSeriesSize
|
|
5391
|
+
}) => {
|
|
5392
|
+
const hasHighlights = highlightedSeriesSize > 0;
|
|
5393
|
+
if (!hasHighlights) return null;
|
|
5394
|
+
return /* @__PURE__ */ jsx50("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx50(
|
|
5395
|
+
motion8.div,
|
|
5396
|
+
{
|
|
5397
|
+
whileTap: { scale: hasHighlights ? 0.985 : 1 },
|
|
5398
|
+
whileHover: { y: hasHighlights ? -2 : 0 },
|
|
5399
|
+
children: /* @__PURE__ */ jsx50(
|
|
5400
|
+
ButtonBase,
|
|
5401
|
+
{
|
|
5402
|
+
variant: "secondary",
|
|
5403
|
+
onClick: () => hasHighlights && setShowOnlyHighlighted((v) => !v),
|
|
5404
|
+
"aria-pressed": showOnlyHighlighted,
|
|
5405
|
+
"aria-label": showOnlyHighlighted ? "Exibir todos" : "Mostrar somente destacados",
|
|
5406
|
+
title: showOnlyHighlighted ? "Exibir todos" : "Mostrar somente destacados",
|
|
5407
|
+
disabled: !hasHighlights,
|
|
5408
|
+
className: cn(
|
|
5409
|
+
"flex items-center justify-center gap-2 text-sm h-8 min-w-[2rem] px-2.5 rounded-md transition-shadow",
|
|
5410
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary/60",
|
|
5411
|
+
!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"
|
|
5412
|
+
),
|
|
5413
|
+
children: showOnlyHighlighted ? /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
5414
|
+
/* @__PURE__ */ jsx50(EyeSlash, { size: 16, weight: "regular" }),
|
|
5415
|
+
/* @__PURE__ */ jsx50("span", { className: "sr-only", children: "Exibir todos" })
|
|
5416
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment6, { children: [
|
|
5417
|
+
/* @__PURE__ */ jsx50(Eye, { size: 16, weight: "bold" }),
|
|
5418
|
+
/* @__PURE__ */ jsx50("span", { className: "sr-only", children: "Mostrar somente destacados" })
|
|
5419
|
+
] })
|
|
5420
|
+
}
|
|
5421
|
+
)
|
|
5422
|
+
}
|
|
5423
|
+
) });
|
|
5424
|
+
};
|
|
5425
|
+
var ShowOnly_default = ShowOnly;
|
|
5426
|
+
|
|
5427
|
+
// src/components/charts/components/controls/Highlights.tsx
|
|
5428
|
+
import { motion as motion9, AnimatePresence as AnimatePresence7 } from "framer-motion";
|
|
5429
|
+
import { CheckIcon as CheckIcon7 } from "@phosphor-icons/react/dist/ssr";
|
|
5430
|
+
import { jsx as jsx51, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
5431
|
+
var Highlights = ({
|
|
5432
|
+
allKeys,
|
|
5433
|
+
mapperConfig,
|
|
5434
|
+
finalColors,
|
|
5435
|
+
highlightedSeries,
|
|
5436
|
+
toggleHighlight,
|
|
5437
|
+
containerWidth
|
|
5438
|
+
}) => {
|
|
5439
|
+
const count = allKeys.length || 1;
|
|
5440
|
+
const available = containerWidth && containerWidth > 0 ? containerWidth : 600;
|
|
5441
|
+
const perPill = Math.floor(available / count);
|
|
5442
|
+
const showFullLabel = perPill >= 96;
|
|
5443
|
+
const showShortLabel = perPill >= 64;
|
|
5444
|
+
const containerVariants = {
|
|
5445
|
+
hidden: { opacity: 0 },
|
|
5446
|
+
visible: { opacity: 1, transition: { staggerChildren: 0.03 } }
|
|
5447
|
+
};
|
|
5448
|
+
return /* @__PURE__ */ jsx51(
|
|
5449
|
+
motion9.div,
|
|
5450
|
+
{
|
|
5451
|
+
className: "flex-1 flex items-center gap-2 flex-wrap",
|
|
5452
|
+
initial: "hidden",
|
|
5453
|
+
animate: "visible",
|
|
5454
|
+
variants: containerVariants,
|
|
5455
|
+
children: /* @__PURE__ */ jsx51(AnimatePresence7, { initial: false, mode: "popLayout", children: allKeys.map((k) => {
|
|
5456
|
+
const isHighlighted = highlightedSeries.has(k);
|
|
5457
|
+
const label = mapperConfig[k]?.label ?? k;
|
|
5458
|
+
const color = finalColors[k];
|
|
5459
|
+
const pillClasses = cn(
|
|
5460
|
+
"inline-flex items-center gap-2 px-3 py-1 rounded-full text-sm border transition-all select-none relative overflow-hidden",
|
|
5461
|
+
isHighlighted ? "pr-8" : "",
|
|
5462
|
+
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"
|
|
5463
|
+
);
|
|
5464
|
+
return /* @__PURE__ */ jsx51(
|
|
5465
|
+
motion9.div,
|
|
5466
|
+
{
|
|
5467
|
+
layout: true,
|
|
5468
|
+
initial: "hidden",
|
|
5469
|
+
animate: "visible",
|
|
5470
|
+
exit: "exit",
|
|
5471
|
+
children: /* @__PURE__ */ jsx51(
|
|
5472
|
+
ButtonBase,
|
|
5473
|
+
{
|
|
5474
|
+
asChild: true,
|
|
5475
|
+
variant: "ghost",
|
|
5476
|
+
onClick: () => toggleHighlight(k),
|
|
5477
|
+
title: isHighlighted ? `Desativar ${label}` : `Ativar ${label}`,
|
|
5478
|
+
className: pillClasses,
|
|
5479
|
+
style: { minWidth: showFullLabel ? void 0 : 36 },
|
|
5480
|
+
"aria-pressed": isHighlighted,
|
|
5481
|
+
children: /* @__PURE__ */ jsxs33(
|
|
5482
|
+
motion9.button,
|
|
5483
|
+
{
|
|
5484
|
+
whileHover: { scale: isHighlighted ? 1.04 : 1.03 },
|
|
5485
|
+
whileTap: { scale: 0.96 },
|
|
5486
|
+
animate: isHighlighted ? { scale: 1.02 } : { scale: 1 },
|
|
5487
|
+
className: "flex items-center gap-2 min-w-0 pr-2",
|
|
5488
|
+
children: [
|
|
5489
|
+
/* @__PURE__ */ jsx51(
|
|
5490
|
+
motion9.span,
|
|
5491
|
+
{
|
|
5492
|
+
className: cn("w-3 h-3 rounded-sm flex-shrink-0 border"),
|
|
5493
|
+
style: {
|
|
5494
|
+
backgroundColor: color,
|
|
5495
|
+
borderColor: isHighlighted ? color : "transparent",
|
|
5496
|
+
boxShadow: isHighlighted ? `0 6px 20px ${color}33` : void 0
|
|
5497
|
+
},
|
|
5498
|
+
layout: true,
|
|
5499
|
+
initial: { scale: 0.8, opacity: 0.9 },
|
|
5500
|
+
animate: { scale: 1, opacity: 1 },
|
|
5501
|
+
transition: { type: "spring", stiffness: 400, damping: 30 }
|
|
5502
|
+
}
|
|
5503
|
+
),
|
|
5504
|
+
showFullLabel ? /* @__PURE__ */ jsx51(motion9.span, { className: "truncate max-w-[10rem] pr-2", layout: true, children: label }) : showShortLabel ? /* @__PURE__ */ jsx51(
|
|
5505
|
+
motion9.span,
|
|
5506
|
+
{
|
|
5507
|
+
className: "truncate max-w-[6rem] text-xs pr-2",
|
|
5508
|
+
layout: true,
|
|
5509
|
+
children: label
|
|
5510
|
+
}
|
|
5511
|
+
) : null,
|
|
5512
|
+
/* @__PURE__ */ jsx51(
|
|
5513
|
+
motion9.span,
|
|
5514
|
+
{
|
|
5515
|
+
"aria-hidden": true,
|
|
5516
|
+
initial: { opacity: 0, scale: 0.6 },
|
|
5517
|
+
animate: isHighlighted ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0.6 },
|
|
5518
|
+
transition: { type: "spring", stiffness: 450, damping: 28 },
|
|
5519
|
+
className: cn(
|
|
5520
|
+
"pointer-events-none absolute right-2 -translate-y-1/2 text-xs text-foreground flex items-center justify-center",
|
|
5521
|
+
isHighlighted ? "" : "opacity-0 pointer-events-none"
|
|
5522
|
+
),
|
|
5523
|
+
style: { width: 18, height: 18 },
|
|
5524
|
+
children: /* @__PURE__ */ jsx51(CheckIcon7, {})
|
|
5525
|
+
}
|
|
5526
|
+
)
|
|
5527
|
+
]
|
|
5528
|
+
}
|
|
5529
|
+
)
|
|
5530
|
+
}
|
|
5531
|
+
)
|
|
5532
|
+
},
|
|
5533
|
+
`pill-${k}`
|
|
5534
|
+
);
|
|
5535
|
+
}) })
|
|
5536
|
+
}
|
|
5537
|
+
);
|
|
5538
|
+
};
|
|
5539
|
+
var Highlights_default = Highlights;
|
|
5540
|
+
|
|
5541
|
+
// src/components/charts/components/controls/CloseAllButton.tsx
|
|
5542
|
+
import { XIcon as XIcon5 } from "@phosphor-icons/react/dist/ssr";
|
|
5543
|
+
import { jsx as jsx52, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
5544
|
+
var CloseAllButton = ({
|
|
5545
|
+
count,
|
|
5546
|
+
onCloseAll,
|
|
5547
|
+
position = "top-center",
|
|
5548
|
+
variant = "floating"
|
|
5549
|
+
}) => {
|
|
5550
|
+
if (count <= 1) return null;
|
|
5551
|
+
const getPositionClasses = () => {
|
|
5552
|
+
if (variant === "inline") return "";
|
|
5553
|
+
switch (position) {
|
|
5554
|
+
case "top-left":
|
|
5555
|
+
return "fixed top-6 left-6 z-50";
|
|
5556
|
+
case "top-right":
|
|
5557
|
+
return "fixed top-6 right-6 z-50";
|
|
5558
|
+
case "top-center":
|
|
5559
|
+
return "fixed top-6 left-1/2 transform -translate-x-1/2 z-50";
|
|
5560
|
+
default:
|
|
5561
|
+
return "fixed top-6 left-1/2 transform -translate-x-1/2 z-50";
|
|
5562
|
+
}
|
|
5563
|
+
};
|
|
5564
|
+
const getVariantClasses = () => {
|
|
5565
|
+
if (variant === "inline") {
|
|
5566
|
+
return "text-xs px-2 py-1 h-auto bg-card border border-border shadow-sm hover:bg-accent";
|
|
5567
|
+
}
|
|
5568
|
+
return `
|
|
5569
|
+
rounded-full px-4 py-2.5
|
|
5570
|
+
text-white font-semibold text-sm
|
|
5571
|
+
transition-all duration-200 ease-in-out
|
|
5572
|
+
hover:scale-105 active:scale-95 hover:shadow-2xl
|
|
5573
|
+
flex items-center gap-2.5
|
|
5574
|
+
group
|
|
5575
|
+
min-w-max
|
|
5576
|
+
`;
|
|
5577
|
+
};
|
|
5578
|
+
if (variant === "inline") {
|
|
5579
|
+
return /* @__PURE__ */ jsx52("div", { className: "absolute top-4 right-4 z-30", children: /* @__PURE__ */ jsxs34(
|
|
5580
|
+
ButtonBase,
|
|
5581
|
+
{
|
|
5582
|
+
variant: "ghost",
|
|
5583
|
+
size: "sm",
|
|
5584
|
+
onClick: onCloseAll,
|
|
5585
|
+
className: getVariantClasses(),
|
|
5586
|
+
children: [
|
|
5587
|
+
/* @__PURE__ */ jsx52(XIcon5, { size: 12, className: "mr-1" }),
|
|
5588
|
+
"Fechar Todos"
|
|
5589
|
+
]
|
|
5590
|
+
}
|
|
5591
|
+
) });
|
|
5592
|
+
}
|
|
5593
|
+
return /* @__PURE__ */ jsx52(
|
|
5594
|
+
"div",
|
|
5595
|
+
{
|
|
5596
|
+
className: `${getPositionClasses()} animate-in fade-in slide-in-from-top-2 duration-300`,
|
|
5597
|
+
children: /* @__PURE__ */ jsx52("div", { children: /* @__PURE__ */ jsxs34(
|
|
5598
|
+
ButtonBase,
|
|
5599
|
+
{
|
|
5600
|
+
onClick: onCloseAll,
|
|
5601
|
+
size: "sm",
|
|
5602
|
+
className: `bg-red-600 hover:bg-red-700${getVariantClasses()}`,
|
|
5603
|
+
children: [
|
|
5604
|
+
/* @__PURE__ */ jsx52(
|
|
5605
|
+
XIcon5,
|
|
5606
|
+
{
|
|
5607
|
+
size: 18,
|
|
5608
|
+
className: "\n group-hover:rotate-90 transition-all duration-300 ease-out\n drop-shadow-sm\n "
|
|
5609
|
+
}
|
|
5610
|
+
),
|
|
5611
|
+
/* @__PURE__ */ jsx52("span", { className: "min-w-0 tracking-wide", children: "Fechar Todos" }),
|
|
5612
|
+
/* @__PURE__ */ jsx52("div", { className: "mb-1 mx-2", children: count })
|
|
5613
|
+
]
|
|
5614
|
+
}
|
|
5615
|
+
) })
|
|
5616
|
+
}
|
|
5617
|
+
);
|
|
5618
|
+
};
|
|
5619
|
+
var CloseAllButton_default = CloseAllButton;
|
|
5620
|
+
|
|
5621
|
+
// src/components/charts/components/tooltips/DraggableTooltip.tsx
|
|
5622
|
+
import React34, {
|
|
5623
|
+
useEffect as useEffect9,
|
|
5624
|
+
useRef as useRef3,
|
|
5625
|
+
useState as useState10,
|
|
5626
|
+
useCallback as useCallback6,
|
|
5627
|
+
useMemo as useMemo5
|
|
5628
|
+
} from "react";
|
|
5629
|
+
import { motion as motion10, AnimatePresence as AnimatePresence8 } from "framer-motion";
|
|
5630
|
+
import { DotsSixVerticalIcon } from "@phosphor-icons/react";
|
|
5631
|
+
import { XIcon as XIcon6 } from "@phosphor-icons/react/dist/ssr";
|
|
5632
|
+
import { Fragment as Fragment7, jsx as jsx53, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
5633
|
+
var ALIGNMENT_THRESHOLD = 25;
|
|
5634
|
+
var GUIDE_THRESHOLD = 60;
|
|
5635
|
+
var STRONG_SNAP_THRESHOLD = 35;
|
|
5636
|
+
var PRECISION_SNAP_THRESHOLD = 8;
|
|
5637
|
+
var TOOLTIP_DIMENSIONS = { width: 224, height: 120 };
|
|
5638
|
+
var tooltipVariants = {
|
|
5639
|
+
hidden: {
|
|
5640
|
+
opacity: 0,
|
|
5641
|
+
scale: 0.96,
|
|
5642
|
+
transition: { type: "spring", stiffness: 400, damping: 28 }
|
|
5643
|
+
},
|
|
5644
|
+
visible: {
|
|
5645
|
+
opacity: 1,
|
|
5646
|
+
scale: 1,
|
|
5647
|
+
transition: { type: "spring", stiffness: 300, damping: 28 }
|
|
5648
|
+
},
|
|
5649
|
+
exit: {
|
|
5650
|
+
opacity: 0,
|
|
5651
|
+
scale: 0.96,
|
|
5652
|
+
transition: { type: "spring", stiffness: 400, damping: 28 }
|
|
5653
|
+
}
|
|
5654
|
+
};
|
|
5655
|
+
var guideVariants = {
|
|
5656
|
+
hidden: {
|
|
5657
|
+
opacity: 0,
|
|
5658
|
+
transition: { type: "spring", stiffness: 220, damping: 24 }
|
|
5659
|
+
},
|
|
5660
|
+
visible: {
|
|
5661
|
+
opacity: 0.95,
|
|
5662
|
+
transition: { type: "spring", stiffness: 220, damping: 24 }
|
|
5663
|
+
},
|
|
5664
|
+
exit: {
|
|
5665
|
+
opacity: 0,
|
|
5666
|
+
transition: { type: "spring", stiffness: 220, damping: 24 }
|
|
5667
|
+
}
|
|
5668
|
+
};
|
|
5669
|
+
var guideDotVariants = {
|
|
5670
|
+
hidden: {
|
|
5671
|
+
scale: 0.6,
|
|
5672
|
+
opacity: 0,
|
|
5673
|
+
transition: { type: "spring", stiffness: 400, damping: 24 }
|
|
5674
|
+
},
|
|
5675
|
+
visible: {
|
|
5676
|
+
scale: 1,
|
|
5677
|
+
opacity: 0.9,
|
|
5678
|
+
transition: { type: "spring", stiffness: 400, damping: 24 }
|
|
5679
|
+
},
|
|
5680
|
+
exit: {
|
|
5681
|
+
opacity: 0,
|
|
5682
|
+
scale: 0.6,
|
|
5683
|
+
transition: { type: "spring", stiffness: 400, damping: 24 }
|
|
5684
|
+
}
|
|
5685
|
+
};
|
|
5686
|
+
var DraggableTooltipComponent = ({
|
|
5687
|
+
id,
|
|
5688
|
+
data,
|
|
5689
|
+
position,
|
|
5690
|
+
title,
|
|
5691
|
+
dataKeys,
|
|
5692
|
+
finalColors,
|
|
5693
|
+
onMouseDown,
|
|
5694
|
+
onClose,
|
|
5695
|
+
periodLabel = "Per\xEDodo Selecionado",
|
|
5696
|
+
dataLabel = "Dados do Per\xEDodo",
|
|
5697
|
+
showCloseAllButton = false,
|
|
5698
|
+
globalTooltipCount,
|
|
5699
|
+
onCloseAll,
|
|
5700
|
+
closeAllButtonPosition = "top-center",
|
|
5701
|
+
closeAllButtonVariant = "floating",
|
|
5702
|
+
onPositionChange,
|
|
5703
|
+
highlightedSeries,
|
|
5704
|
+
toggleHighlight,
|
|
5705
|
+
showOnlyHighlighted
|
|
5706
|
+
}) => {
|
|
5707
|
+
const visibleKeys = useMemo5(
|
|
5708
|
+
() => showOnlyHighlighted && highlightedSeries && highlightedSeries.size > 0 ? dataKeys.filter((k) => highlightedSeries.has(k)) : dataKeys,
|
|
5709
|
+
[showOnlyHighlighted, highlightedSeries, dataKeys]
|
|
5710
|
+
);
|
|
5711
|
+
const TotalDisplay = React34.memo(
|
|
5712
|
+
({ data: data2, visibleKeys: visibleKeys2 }) => {
|
|
5713
|
+
const total = useMemo5(() => {
|
|
5714
|
+
const numeric = visibleKeys2.map((k) => data2[k]).filter((v) => typeof v === "number");
|
|
5715
|
+
return numeric.reduce((s, v) => s + (v || 0), 0);
|
|
5716
|
+
}, [data2, visibleKeys2]);
|
|
5717
|
+
return /* @__PURE__ */ jsxs35("div", { className: "text-sm", children: [
|
|
5718
|
+
/* @__PURE__ */ jsx53("div", { className: "text-sm text-muted-foreground", children: "Total" }),
|
|
5719
|
+
/* @__PURE__ */ jsx53(
|
|
5720
|
+
"div",
|
|
5721
|
+
{
|
|
5722
|
+
className: `text-base font-semibold ${total < 0 ? "text-destructive" : "text-foreground"}`,
|
|
5723
|
+
children: total.toLocaleString("pt-BR")
|
|
5724
|
+
}
|
|
5725
|
+
)
|
|
5726
|
+
] });
|
|
5727
|
+
}
|
|
5728
|
+
);
|
|
5729
|
+
const [localPos, setLocalPos] = useState10(position);
|
|
5730
|
+
const [dragging, setDragging] = useState10(false);
|
|
5731
|
+
const offsetRef = useRef3({ x: 0, y: 0 });
|
|
5732
|
+
const lastMouse = useRef3({ x: 0, y: 0 });
|
|
5733
|
+
const [alignmentGuides, setAlignmentGuides] = useState10([]);
|
|
5734
|
+
const [globalTooltipCountLocal, setGlobalTooltipCountLocal] = useState10(0);
|
|
5735
|
+
useEffect9(() => setLocalPos(position), [position]);
|
|
5736
|
+
const getAllTooltips = useCallback6(() => {
|
|
5737
|
+
const response = [];
|
|
5738
|
+
const ev = new CustomEvent("requestGlobalTooltips", {
|
|
5739
|
+
detail: { requesterId: id, response }
|
|
5740
|
+
});
|
|
5741
|
+
window.dispatchEvent(ev);
|
|
5742
|
+
return response;
|
|
5743
|
+
}, [id]);
|
|
5744
|
+
const updateAlignmentGuides = useCallback6(
|
|
5745
|
+
(currentPosition) => {
|
|
5746
|
+
const allTooltips = getAllTooltips();
|
|
5747
|
+
const otherTooltips = allTooltips.filter((t) => t.id !== id);
|
|
5748
|
+
const guides = [];
|
|
5749
|
+
otherTooltips.forEach((tooltip) => {
|
|
5750
|
+
const topDiff = Math.abs(currentPosition.top - tooltip.position.top);
|
|
5751
|
+
if (topDiff <= GUIDE_THRESHOLD) {
|
|
5752
|
+
guides.push({
|
|
5753
|
+
type: "horizontal",
|
|
5754
|
+
position: tooltip.position.top,
|
|
5755
|
+
sourceTooltip: {
|
|
5756
|
+
top: currentPosition.top,
|
|
5757
|
+
left: currentPosition.left,
|
|
5758
|
+
width: TOOLTIP_DIMENSIONS.width,
|
|
5759
|
+
height: TOOLTIP_DIMENSIONS.height
|
|
5760
|
+
},
|
|
5761
|
+
targetTooltip: {
|
|
5762
|
+
top: tooltip.position.top,
|
|
5763
|
+
left: tooltip.position.left,
|
|
5764
|
+
width: TOOLTIP_DIMENSIONS.width,
|
|
5765
|
+
height: TOOLTIP_DIMENSIONS.height
|
|
5766
|
+
}
|
|
5767
|
+
});
|
|
5768
|
+
}
|
|
5769
|
+
const leftDiff = Math.abs(currentPosition.left - tooltip.position.left);
|
|
5770
|
+
if (leftDiff <= GUIDE_THRESHOLD) {
|
|
5771
|
+
guides.push({
|
|
5772
|
+
type: "vertical",
|
|
5773
|
+
position: tooltip.position.left,
|
|
5774
|
+
sourceTooltip: {
|
|
5775
|
+
top: currentPosition.top,
|
|
5776
|
+
left: currentPosition.left,
|
|
5777
|
+
width: TOOLTIP_DIMENSIONS.width,
|
|
5778
|
+
height: TOOLTIP_DIMENSIONS.height
|
|
5779
|
+
},
|
|
5780
|
+
targetTooltip: {
|
|
5781
|
+
top: tooltip.position.top,
|
|
5782
|
+
left: tooltip.position.left,
|
|
5783
|
+
width: TOOLTIP_DIMENSIONS.width,
|
|
5784
|
+
height: TOOLTIP_DIMENSIONS.height
|
|
5785
|
+
}
|
|
5786
|
+
});
|
|
5787
|
+
}
|
|
5788
|
+
});
|
|
5789
|
+
setAlignmentGuides(guides);
|
|
5790
|
+
},
|
|
5791
|
+
[getAllTooltips, id]
|
|
5792
|
+
);
|
|
5793
|
+
const snapToGuides = useCallback6(
|
|
5794
|
+
(position2) => {
|
|
5795
|
+
const snappedPosition = { ...position2 };
|
|
5796
|
+
let hasSnapped = false;
|
|
5797
|
+
alignmentGuides.forEach((guide) => {
|
|
5798
|
+
if (guide.type === "horizontal") {
|
|
5799
|
+
const diff = Math.abs(position2.top - guide.position);
|
|
5800
|
+
if (diff <= PRECISION_SNAP_THRESHOLD) {
|
|
5801
|
+
snappedPosition.top = guide.position;
|
|
5802
|
+
hasSnapped = true;
|
|
5803
|
+
}
|
|
5804
|
+
} else {
|
|
5805
|
+
const diff = Math.abs(position2.left - guide.position);
|
|
5806
|
+
if (diff <= PRECISION_SNAP_THRESHOLD) {
|
|
5807
|
+
snappedPosition.left = guide.position;
|
|
5808
|
+
hasSnapped = true;
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
});
|
|
5812
|
+
if (!hasSnapped) {
|
|
5813
|
+
alignmentGuides.forEach((guide) => {
|
|
5814
|
+
if (guide.type === "horizontal") {
|
|
5815
|
+
const diff = Math.abs(position2.top - guide.position);
|
|
5816
|
+
if (diff <= STRONG_SNAP_THRESHOLD)
|
|
5817
|
+
snappedPosition.top = guide.position;
|
|
5818
|
+
} else {
|
|
5819
|
+
const diff = Math.abs(position2.left - guide.position);
|
|
5820
|
+
if (diff <= STRONG_SNAP_THRESHOLD)
|
|
5821
|
+
snappedPosition.left = guide.position;
|
|
5822
|
+
}
|
|
5823
|
+
});
|
|
5824
|
+
}
|
|
5825
|
+
alignmentGuides.forEach((guide) => {
|
|
5826
|
+
if (guide.type === "horizontal") {
|
|
5827
|
+
const diff = Math.abs(position2.top - guide.position);
|
|
5828
|
+
if (diff <= ALIGNMENT_THRESHOLD && snappedPosition.top === position2.top)
|
|
5829
|
+
snappedPosition.top = guide.position;
|
|
5830
|
+
} else {
|
|
5831
|
+
const diff = Math.abs(position2.left - guide.position);
|
|
5832
|
+
if (diff <= ALIGNMENT_THRESHOLD && snappedPosition.left === position2.left)
|
|
5833
|
+
snappedPosition.left = guide.position;
|
|
5834
|
+
}
|
|
5835
|
+
});
|
|
5836
|
+
return snappedPosition;
|
|
5837
|
+
},
|
|
5838
|
+
[alignmentGuides]
|
|
5839
|
+
);
|
|
5840
|
+
useEffect9(() => {
|
|
5841
|
+
let rafId = null;
|
|
5842
|
+
const handleMouseMove = (e) => {
|
|
5843
|
+
if (!dragging) return;
|
|
5844
|
+
lastMouse.current = { x: e.clientX, y: e.clientY };
|
|
5845
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
5846
|
+
rafId = requestAnimationFrame(() => {
|
|
5847
|
+
const newLeft = lastMouse.current.x - offsetRef.current.x;
|
|
5848
|
+
const newTop = lastMouse.current.y - offsetRef.current.y;
|
|
5849
|
+
const rawPosition = {
|
|
5850
|
+
top: Math.max(0, Math.min(newTop, window.innerHeight - 200)),
|
|
5851
|
+
left: Math.max(0, Math.min(newLeft, window.innerWidth - 250))
|
|
5852
|
+
};
|
|
5853
|
+
updateAlignmentGuides(rawPosition);
|
|
5854
|
+
const snapped = snapToGuides(rawPosition);
|
|
5855
|
+
setLocalPos(snapped);
|
|
5856
|
+
if (onPositionChange) onPositionChange(id, snapped);
|
|
5857
|
+
});
|
|
5858
|
+
};
|
|
5859
|
+
const handleMouseUp = () => {
|
|
5860
|
+
if (dragging) {
|
|
5861
|
+
setDragging(false);
|
|
5862
|
+
setAlignmentGuides([]);
|
|
5863
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
5864
|
+
}
|
|
5865
|
+
};
|
|
5866
|
+
if (dragging) {
|
|
5867
|
+
document.addEventListener("mousemove", handleMouseMove, {
|
|
5868
|
+
passive: true
|
|
5869
|
+
});
|
|
5870
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
5871
|
+
document.body.style.cursor = "grabbing";
|
|
5872
|
+
document.body.style.userSelect = "none";
|
|
5873
|
+
}
|
|
5874
|
+
return () => {
|
|
5875
|
+
if (rafId) cancelAnimationFrame(rafId);
|
|
5876
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
5877
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
5878
|
+
document.body.style.cursor = "";
|
|
5879
|
+
document.body.style.userSelect = "";
|
|
5880
|
+
};
|
|
5881
|
+
}, [dragging, snapToGuides, updateAlignmentGuides, id, onPositionChange]);
|
|
5882
|
+
useEffect9(() => {
|
|
5883
|
+
const handleCloseAll = () => onClose(id);
|
|
5884
|
+
const handleRequestTooltipCount = () => {
|
|
5885
|
+
window.dispatchEvent(
|
|
5886
|
+
new CustomEvent("tooltipCountResponse", { detail: { count: 1 } })
|
|
5887
|
+
);
|
|
5888
|
+
};
|
|
5889
|
+
const handleRequestGlobalTooltips = (event) => {
|
|
5890
|
+
const customEvent = event;
|
|
5891
|
+
const detail = customEvent.detail;
|
|
5892
|
+
if (detail?.response && detail.requesterId && detail.requesterId !== id) {
|
|
5893
|
+
detail.response.push({ id, position: localPos });
|
|
5894
|
+
}
|
|
5895
|
+
};
|
|
5896
|
+
const events = [
|
|
5897
|
+
{ name: "closeAllTooltips", handler: handleCloseAll },
|
|
5898
|
+
{ name: "requestTooltipCount", handler: handleRequestTooltipCount },
|
|
5899
|
+
{
|
|
5900
|
+
name: "requestGlobalTooltips",
|
|
5901
|
+
handler: handleRequestGlobalTooltips
|
|
5902
|
+
}
|
|
5903
|
+
];
|
|
5904
|
+
events.forEach(({ name, handler }) => {
|
|
5905
|
+
window.addEventListener(name, handler);
|
|
5906
|
+
});
|
|
5907
|
+
return () => {
|
|
5908
|
+
events.forEach(({ name, handler }) => {
|
|
5909
|
+
window.removeEventListener(name, handler);
|
|
5910
|
+
});
|
|
5911
|
+
};
|
|
5912
|
+
}, [id, localPos, onClose]);
|
|
5913
|
+
useEffect9(() => {
|
|
5914
|
+
if (dragging) return;
|
|
5915
|
+
let total = 0;
|
|
5916
|
+
const timeoutId = setTimeout(() => {
|
|
5917
|
+
const handleCountResponse = (event) => {
|
|
5918
|
+
const customEvent = event;
|
|
5919
|
+
total += customEvent.detail.count || 0;
|
|
5920
|
+
};
|
|
5921
|
+
window.addEventListener("tooltipCountResponse", handleCountResponse);
|
|
5922
|
+
window.dispatchEvent(new CustomEvent("requestTooltipCount"));
|
|
5923
|
+
const cleanupTimeout = setTimeout(() => {
|
|
5924
|
+
window.removeEventListener("tooltipCountResponse", handleCountResponse);
|
|
5925
|
+
setGlobalTooltipCountLocal(total);
|
|
5926
|
+
}, 50);
|
|
5927
|
+
return () => clearTimeout(cleanupTimeout);
|
|
5928
|
+
}, 0);
|
|
5929
|
+
return () => clearTimeout(timeoutId);
|
|
5930
|
+
}, [localPos, dragging]);
|
|
5931
|
+
useEffect9(() => {
|
|
5932
|
+
const recount = () => {
|
|
5933
|
+
if (dragging) return;
|
|
5934
|
+
let total = 0;
|
|
5935
|
+
const handleCountResponse = (event) => {
|
|
5936
|
+
const customEvent = event;
|
|
5937
|
+
total += customEvent.detail.count || 0;
|
|
5938
|
+
};
|
|
5939
|
+
window.addEventListener("tooltipCountResponse", handleCountResponse);
|
|
5940
|
+
window.dispatchEvent(new CustomEvent("requestTooltipCount"));
|
|
5941
|
+
setTimeout(() => {
|
|
5942
|
+
window.removeEventListener("tooltipCountResponse", handleCountResponse);
|
|
5943
|
+
setGlobalTooltipCountLocal(total);
|
|
5944
|
+
}, 50);
|
|
5945
|
+
};
|
|
5946
|
+
window.addEventListener("recountTooltips", recount);
|
|
5947
|
+
return () => window.removeEventListener("recountTooltips", recount);
|
|
5948
|
+
}, [dragging]);
|
|
5949
|
+
const handleMouseDownLocal = useCallback6(
|
|
5950
|
+
(e) => {
|
|
5951
|
+
e.preventDefault();
|
|
5952
|
+
e.stopPropagation();
|
|
5953
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
5954
|
+
offsetRef.current = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
5955
|
+
setDragging(true);
|
|
5956
|
+
onMouseDown?.(id, e);
|
|
5957
|
+
},
|
|
5958
|
+
[id, onMouseDown]
|
|
5959
|
+
);
|
|
5960
|
+
const handleTouchStartLocal = useCallback6(
|
|
5961
|
+
(e) => {
|
|
5962
|
+
e.stopPropagation();
|
|
5963
|
+
const touch = e.touches[0];
|
|
5964
|
+
if (!touch) return;
|
|
5965
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
5966
|
+
offsetRef.current = {
|
|
5967
|
+
x: touch.clientX - rect.left,
|
|
5968
|
+
y: touch.clientY - rect.top
|
|
5969
|
+
};
|
|
5970
|
+
setDragging(true);
|
|
5971
|
+
onMouseDown?.(id, e);
|
|
5972
|
+
},
|
|
5973
|
+
[id, onMouseDown]
|
|
5974
|
+
);
|
|
5975
|
+
const handleCloseClick = useCallback6(
|
|
5976
|
+
(e) => {
|
|
5977
|
+
e.stopPropagation();
|
|
5978
|
+
onClose(id);
|
|
5979
|
+
},
|
|
5980
|
+
[id, onClose]
|
|
5981
|
+
);
|
|
5982
|
+
return /* @__PURE__ */ jsxs35(Fragment7, { children: [
|
|
5983
|
+
dragging && alignmentGuides.map((guide, index) => {
|
|
5984
|
+
const isHorizontal = guide.type === "horizontal";
|
|
5985
|
+
const color = isHorizontal ? "#3b82f6" : "#ef4444";
|
|
5986
|
+
const startX = isHorizontal ? Math.min(
|
|
5987
|
+
guide.sourceTooltip.left + guide.sourceTooltip.width / 2,
|
|
5988
|
+
guide.targetTooltip.left + guide.targetTooltip.width / 2
|
|
5989
|
+
) : guide.sourceTooltip.left + guide.sourceTooltip.width / 2;
|
|
5990
|
+
const endX = isHorizontal ? Math.max(
|
|
5991
|
+
guide.sourceTooltip.left + guide.sourceTooltip.width / 2,
|
|
5992
|
+
guide.targetTooltip.left + guide.targetTooltip.width / 2
|
|
5993
|
+
) : guide.targetTooltip.left + guide.targetTooltip.width / 2;
|
|
5994
|
+
const startY = isHorizontal ? guide.sourceTooltip.top + guide.sourceTooltip.height / 2 : Math.min(
|
|
5995
|
+
guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
|
|
5996
|
+
guide.targetTooltip.top + guide.targetTooltip.height / 2
|
|
5997
|
+
);
|
|
5998
|
+
const endY = isHorizontal ? guide.targetTooltip.top + guide.targetTooltip.height / 2 : Math.max(
|
|
5999
|
+
guide.sourceTooltip.top + guide.sourceTooltip.height / 2,
|
|
6000
|
+
guide.targetTooltip.top + guide.targetTooltip.height / 2
|
|
6001
|
+
);
|
|
6002
|
+
return /* @__PURE__ */ jsxs35("div", { children: [
|
|
6003
|
+
/* @__PURE__ */ jsx53(
|
|
6004
|
+
motion10.div,
|
|
6005
|
+
{
|
|
6006
|
+
className: "fixed pointer-events-none z-30",
|
|
6007
|
+
variants: guideVariants,
|
|
6008
|
+
initial: "hidden",
|
|
6009
|
+
animate: "visible",
|
|
6010
|
+
exit: "exit",
|
|
6011
|
+
style: {
|
|
6012
|
+
left: startX,
|
|
6013
|
+
top: startY,
|
|
6014
|
+
width: isHorizontal ? endX - startX : 2,
|
|
6015
|
+
height: isHorizontal ? 2 : endY - startY,
|
|
6016
|
+
backgroundColor: color,
|
|
6017
|
+
boxShadow: `0 0 8px ${color}60`,
|
|
6018
|
+
borderStyle: "dashed",
|
|
6019
|
+
borderWidth: "1px",
|
|
6020
|
+
borderColor: color,
|
|
6021
|
+
transform: "translateZ(0)"
|
|
6022
|
+
}
|
|
6023
|
+
}
|
|
6024
|
+
),
|
|
6025
|
+
/* @__PURE__ */ jsx53(
|
|
6026
|
+
motion10.div,
|
|
6027
|
+
{
|
|
6028
|
+
className: "fixed pointer-events-none z-31",
|
|
6029
|
+
variants: guideDotVariants,
|
|
6030
|
+
initial: "hidden",
|
|
6031
|
+
animate: "visible",
|
|
6032
|
+
exit: "exit",
|
|
6033
|
+
style: {
|
|
6034
|
+
left: guide.sourceTooltip.left + guide.sourceTooltip.width / 2 - 4,
|
|
6035
|
+
top: guide.sourceTooltip.top + guide.sourceTooltip.height / 2 - 4,
|
|
6036
|
+
width: "8px",
|
|
6037
|
+
height: "8px",
|
|
6038
|
+
backgroundColor: color,
|
|
6039
|
+
borderRadius: "50%",
|
|
6040
|
+
boxShadow: `0 0 4px ${color}80`
|
|
6041
|
+
}
|
|
6042
|
+
}
|
|
6043
|
+
),
|
|
6044
|
+
/* @__PURE__ */ jsx53(
|
|
6045
|
+
motion10.div,
|
|
6046
|
+
{
|
|
6047
|
+
className: "fixed pointer-events-none z-31",
|
|
6048
|
+
variants: guideDotVariants,
|
|
6049
|
+
initial: "hidden",
|
|
6050
|
+
animate: "visible",
|
|
6051
|
+
exit: "exit",
|
|
6052
|
+
style: {
|
|
6053
|
+
left: guide.targetTooltip.left + guide.targetTooltip.width / 2 - 4,
|
|
6054
|
+
top: guide.targetTooltip.top + guide.targetTooltip.height / 2 - 4,
|
|
6055
|
+
width: "8px",
|
|
6056
|
+
height: "8px",
|
|
6057
|
+
backgroundColor: color,
|
|
6058
|
+
borderRadius: "50%",
|
|
6059
|
+
boxShadow: `0 0 4px ${color}80`
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
)
|
|
6063
|
+
] }, index);
|
|
6064
|
+
}),
|
|
6065
|
+
/* @__PURE__ */ jsx53(AnimatePresence8, { children: /* @__PURE__ */ jsxs35(
|
|
6066
|
+
motion10.div,
|
|
6067
|
+
{
|
|
6068
|
+
className: "fixed bg-card border border-border rounded-lg shadow-lg z-50 min-w-80 select-none",
|
|
6069
|
+
variants: tooltipVariants,
|
|
6070
|
+
initial: "hidden",
|
|
6071
|
+
animate: "visible",
|
|
6072
|
+
exit: "exit",
|
|
6073
|
+
style: {
|
|
6074
|
+
top: localPos.top,
|
|
6075
|
+
left: localPos.left,
|
|
6076
|
+
cursor: dragging ? "grabbing" : "grab",
|
|
6077
|
+
transform: "translateZ(0)"
|
|
6078
|
+
},
|
|
6079
|
+
onClick: (e) => e.stopPropagation(),
|
|
6080
|
+
role: "dialog",
|
|
6081
|
+
"aria-label": title ? `Tooltip ${title}` : `Tooltip ${data.name}`,
|
|
6082
|
+
children: [
|
|
6083
|
+
/* @__PURE__ */ jsxs35(
|
|
6084
|
+
"div",
|
|
6085
|
+
{
|
|
6086
|
+
className: "flex items-center justify-between p-3 pb-2 border-b bg-muted/20 rounded-t-lg",
|
|
6087
|
+
onMouseDown: handleMouseDownLocal,
|
|
6088
|
+
onTouchStart: handleTouchStartLocal,
|
|
6089
|
+
style: { touchAction: "none" },
|
|
6090
|
+
children: [
|
|
6091
|
+
/* @__PURE__ */ jsx53(DotsSixVerticalIcon, { size: 16 }),
|
|
6092
|
+
/* @__PURE__ */ jsx53("div", { className: "flex flex-col gap-1", children: title && /* @__PURE__ */ jsx53("div", { className: "flex items-center gap-2 pb-0.5", children: /* @__PURE__ */ jsx53("p", { className: "font-bold text-foreground text-base", children: title }) }) }),
|
|
6093
|
+
/* @__PURE__ */ jsx53(
|
|
6094
|
+
"button",
|
|
6095
|
+
{
|
|
6096
|
+
onClick: handleCloseClick,
|
|
6097
|
+
className: "text-muted-foreground hover:text-destructive ml-2 text-sm hover:bg-destructive/10 rounded p-1",
|
|
6098
|
+
title: "Fechar este tooltip",
|
|
6099
|
+
children: /* @__PURE__ */ jsx53(XIcon6, { size: 14 })
|
|
6100
|
+
}
|
|
6101
|
+
)
|
|
6102
|
+
]
|
|
6103
|
+
}
|
|
6104
|
+
),
|
|
6105
|
+
/* @__PURE__ */ jsx53("div", { className: "px-3 py-2 bg-accent/5 border-l-4 border-primary", children: /* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between gap-2", children: [
|
|
6106
|
+
/* @__PURE__ */ jsxs35("div", { children: [
|
|
6107
|
+
/* @__PURE__ */ jsx53("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide", children: periodLabel }),
|
|
6108
|
+
/* @__PURE__ */ jsx53("p", { className: "font-bold text-lg text-foreground mt-1 truncate", children: data.name })
|
|
6109
|
+
] }),
|
|
6110
|
+
/* @__PURE__ */ jsx53("div", { className: "text-right", children: /* @__PURE__ */ jsx53(TotalDisplay, { data, visibleKeys }) })
|
|
6111
|
+
] }) }),
|
|
6112
|
+
/* @__PURE__ */ jsxs35("div", { className: "p-3 pt-2 space-y-2", children: [
|
|
6113
|
+
/* @__PURE__ */ jsx53("p", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2", children: dataLabel }),
|
|
6114
|
+
useMemo5(
|
|
6115
|
+
() => visibleKeys.map((key) => {
|
|
6116
|
+
const value = data[key];
|
|
6117
|
+
if (value === void 0) return null;
|
|
6118
|
+
const numericKeys = dataKeys.filter(
|
|
6119
|
+
(k) => typeof data[k] === "number"
|
|
6120
|
+
);
|
|
6121
|
+
const absDenominator = numericKeys.reduce(
|
|
6122
|
+
(s, k) => s + Math.abs(Number(data[k]) || 0),
|
|
6123
|
+
0
|
|
6124
|
+
);
|
|
6125
|
+
const val = typeof value === "number" ? value : Number(value) || 0;
|
|
6126
|
+
const pct = absDenominator > 0 ? Math.abs(val) / absDenominator * 100 : 0;
|
|
6127
|
+
const isDimmed = highlightedSeries && highlightedSeries.size > 0 && !highlightedSeries.has(key);
|
|
6128
|
+
const isHighlighted = highlightedSeries && highlightedSeries.has(key);
|
|
6129
|
+
return /* @__PURE__ */ jsxs35(
|
|
6130
|
+
"div",
|
|
6131
|
+
{
|
|
6132
|
+
role: "button",
|
|
6133
|
+
tabIndex: 0,
|
|
6134
|
+
onKeyDown: (e) => {
|
|
6135
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
6136
|
+
e.preventDefault();
|
|
6137
|
+
toggleHighlight?.(key);
|
|
6138
|
+
}
|
|
6139
|
+
},
|
|
6140
|
+
onClick: () => toggleHighlight?.(key),
|
|
6141
|
+
className: `flex flex-col gap-1 text-sm mb-1 p-2 rounded transition-colors cursor-pointer bg-muted/20`,
|
|
6142
|
+
style: {
|
|
6143
|
+
boxShadow: isHighlighted ? `0 6px 18px ${finalColors[key] || "#666"}33` : void 0,
|
|
6144
|
+
border: isHighlighted ? `1px solid ${finalColors[key] || "#666"}22` : void 0
|
|
6145
|
+
},
|
|
6146
|
+
children: [
|
|
6147
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center justify-between", children: [
|
|
6148
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
6149
|
+
/* @__PURE__ */ jsx53(
|
|
6150
|
+
"div",
|
|
6151
|
+
{
|
|
6152
|
+
className: "w-3 h-3 rounded-sm shadow-sm",
|
|
6153
|
+
style: {
|
|
6154
|
+
backgroundColor: finalColors[key] || "#666"
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6157
|
+
),
|
|
6158
|
+
/* @__PURE__ */ jsx53(
|
|
6159
|
+
"span",
|
|
6160
|
+
{
|
|
6161
|
+
className: `font-medium text-foreground truncate`,
|
|
6162
|
+
children: key.charAt(0).toUpperCase() + key.slice(1)
|
|
6163
|
+
}
|
|
6164
|
+
)
|
|
6165
|
+
] }),
|
|
6166
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-baseline gap-2", children: [
|
|
6167
|
+
/* @__PURE__ */ jsx53(
|
|
6168
|
+
"span",
|
|
6169
|
+
{
|
|
6170
|
+
className: `font-semibold tabular-nums ${val < 0 ? "text-destructive" : "text-foreground"}`,
|
|
6171
|
+
children: val.toLocaleString("pt-BR")
|
|
6172
|
+
}
|
|
6173
|
+
),
|
|
6174
|
+
/* @__PURE__ */ jsx53("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
|
|
6175
|
+
] })
|
|
6176
|
+
] }),
|
|
6177
|
+
/* @__PURE__ */ jsx53("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsx53(
|
|
6178
|
+
"div",
|
|
6179
|
+
{
|
|
6180
|
+
className: "h-1 rounded-full",
|
|
6181
|
+
style: {
|
|
6182
|
+
width: `${Math.max(0, Math.min(100, pct))}%`,
|
|
6183
|
+
opacity: isDimmed ? 0.35 : 1,
|
|
6184
|
+
background: finalColors[key] || "#666",
|
|
6185
|
+
transition: "none"
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
) })
|
|
6189
|
+
]
|
|
6190
|
+
},
|
|
6191
|
+
key
|
|
6192
|
+
);
|
|
6193
|
+
}),
|
|
6194
|
+
[
|
|
6195
|
+
visibleKeys,
|
|
6196
|
+
data,
|
|
6197
|
+
dataKeys,
|
|
6198
|
+
highlightedSeries,
|
|
6199
|
+
toggleHighlight,
|
|
6200
|
+
finalColors
|
|
6201
|
+
]
|
|
6202
|
+
),
|
|
6203
|
+
/* @__PURE__ */ jsx53("div", { className: "mt-3 pt-2 border-t", children: /* @__PURE__ */ jsxs35("p", { className: "text-xs text-muted-foreground flex items-center gap-1", children: [
|
|
6204
|
+
"Clique no ",
|
|
6205
|
+
/* @__PURE__ */ jsx53(XIcon6, { size: 12 }),
|
|
6206
|
+
" para remover"
|
|
6207
|
+
] }) })
|
|
6208
|
+
] })
|
|
6209
|
+
]
|
|
6210
|
+
},
|
|
6211
|
+
id
|
|
6212
|
+
) }),
|
|
6213
|
+
showCloseAllButton && onCloseAll && /* @__PURE__ */ jsx53(
|
|
6214
|
+
CloseAllButton_default,
|
|
6215
|
+
{
|
|
6216
|
+
count: typeof globalTooltipCount === "number" ? globalTooltipCount : globalTooltipCountLocal,
|
|
6217
|
+
onCloseAll,
|
|
6218
|
+
position: closeAllButtonPosition,
|
|
6219
|
+
variant: closeAllButtonVariant
|
|
6220
|
+
}
|
|
6221
|
+
)
|
|
6222
|
+
] });
|
|
6223
|
+
};
|
|
6224
|
+
var DraggableTooltip = React34.memo(DraggableTooltipComponent);
|
|
6225
|
+
DraggableTooltip.displayName = "DraggableTooltip";
|
|
6226
|
+
var DraggableTooltip_default = DraggableTooltip;
|
|
6227
|
+
|
|
6228
|
+
// src/components/charts/components/tooltips/TooltipWithTotal.tsx
|
|
6229
|
+
import { jsx as jsx54, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6230
|
+
var RechartTooltipWithTotal = ({
|
|
6231
|
+
active,
|
|
6232
|
+
payload,
|
|
6233
|
+
label,
|
|
6234
|
+
finalColors = {},
|
|
6235
|
+
periodLabel = "Per\xEDodo",
|
|
6236
|
+
totalLabel = "Total"
|
|
6237
|
+
}) => {
|
|
6238
|
+
if (!active || !payload || payload.length === 0) return null;
|
|
6239
|
+
const numeric = payload.filter(
|
|
6240
|
+
(p) => typeof p.value === "number" && Number.isFinite(p.value)
|
|
6241
|
+
);
|
|
6242
|
+
const total = numeric.reduce((sum, p) => sum + (p.value || 0), 0);
|
|
6243
|
+
const isTotalNegative = total < 0;
|
|
6244
|
+
const absDenominator = numeric.reduce(
|
|
6245
|
+
(sum, p) => sum + Math.abs(typeof p.value === "number" ? p.value : 0),
|
|
6246
|
+
0
|
|
6247
|
+
);
|
|
6248
|
+
return /* @__PURE__ */ jsxs36(
|
|
6249
|
+
"div",
|
|
6250
|
+
{
|
|
6251
|
+
role: "dialog",
|
|
6252
|
+
"aria-label": `Tooltip ${label ?? ""}`,
|
|
6253
|
+
className: "bg-card border border-border rounded-lg p-3 shadow-2xl max-w-xs",
|
|
6254
|
+
style: { minWidth: 220 },
|
|
6255
|
+
children: [
|
|
6256
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-start justify-between mb-2", children: [
|
|
6257
|
+
/* @__PURE__ */ jsxs36("div", { className: "pr-2", children: [
|
|
6258
|
+
/* @__PURE__ */ jsx54("p", { className: "text-xs text-muted-foreground", children: periodLabel }),
|
|
6259
|
+
/* @__PURE__ */ jsx54("p", { className: "font-medium text-foreground truncate", children: label })
|
|
6260
|
+
] }),
|
|
6261
|
+
/* @__PURE__ */ jsxs36("div", { className: "text-right ml-3", children: [
|
|
6262
|
+
/* @__PURE__ */ jsx54("p", { className: "text-xs text-muted-foreground", children: totalLabel }),
|
|
6263
|
+
/* @__PURE__ */ jsx54(
|
|
6264
|
+
"p",
|
|
6265
|
+
{
|
|
6266
|
+
className: `text-sm font-semibold ${isTotalNegative ? "text-rose-500" : "text-foreground"}`,
|
|
6267
|
+
children: total.toLocaleString("pt-BR")
|
|
6268
|
+
}
|
|
6269
|
+
)
|
|
6270
|
+
] })
|
|
6271
|
+
] }),
|
|
6272
|
+
/* @__PURE__ */ jsx54("div", { className: "flex flex-col gap-2", children: payload.map((entry, index) => {
|
|
6273
|
+
const value = typeof entry.value === "number" ? entry.value : 0;
|
|
6274
|
+
const pct = absDenominator > 0 ? Math.abs(value) / absDenominator * 100 : 0;
|
|
6275
|
+
const baseColor = finalColors[entry.dataKey] || entry.color || "#999";
|
|
6276
|
+
const isNeg = value < 0;
|
|
6277
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-1", children: [
|
|
6278
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between text-sm", children: [
|
|
6279
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2 truncate", children: [
|
|
6280
|
+
/* @__PURE__ */ jsx54(
|
|
6281
|
+
"span",
|
|
6282
|
+
{
|
|
6283
|
+
className: "w-3 h-3 rounded-sm flex-shrink-0",
|
|
6284
|
+
style: { backgroundColor: baseColor },
|
|
6285
|
+
"aria-hidden": true
|
|
6286
|
+
}
|
|
6287
|
+
),
|
|
6288
|
+
/* @__PURE__ */ jsx54("span", { className: "text-muted-foreground truncate", children: entry.name })
|
|
6289
|
+
] }),
|
|
6290
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-baseline gap-3 ml-3", children: [
|
|
6291
|
+
/* @__PURE__ */ jsx54(
|
|
6292
|
+
"span",
|
|
6293
|
+
{
|
|
6294
|
+
className: `${isNeg ? "text-rose-500" : "text-foreground"} font-medium`,
|
|
6295
|
+
children: value.toLocaleString("pt-BR")
|
|
6296
|
+
}
|
|
6297
|
+
),
|
|
6298
|
+
/* @__PURE__ */ jsx54("span", { className: "text-xs text-muted-foreground", children: absDenominator > 0 ? `${pct.toFixed(1)}%` : "-" })
|
|
6299
|
+
] })
|
|
6300
|
+
] }),
|
|
6301
|
+
/* @__PURE__ */ jsx54("div", { className: "w-full bg-muted rounded-full h-1 overflow-hidden", children: /* @__PURE__ */ jsx54(
|
|
6302
|
+
"div",
|
|
6303
|
+
{
|
|
6304
|
+
className: "h-1 rounded-full transition-all duration-300",
|
|
6305
|
+
style: {
|
|
6306
|
+
width: `${Math.max(0, Math.min(100, pct))}%`,
|
|
6307
|
+
background: baseColor
|
|
6308
|
+
}
|
|
6309
|
+
}
|
|
6310
|
+
) })
|
|
6311
|
+
] }, index);
|
|
6312
|
+
}) })
|
|
6313
|
+
]
|
|
6314
|
+
}
|
|
6315
|
+
);
|
|
6316
|
+
};
|
|
6317
|
+
var TooltipWithTotal_default = RechartTooltipWithTotal;
|
|
6318
|
+
|
|
6319
|
+
// src/components/charts/components/tooltips/TooltipSimple.tsx
|
|
6320
|
+
import { jsx as jsx55, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
6321
|
+
var TooltipSimple = ({
|
|
6322
|
+
active,
|
|
6323
|
+
payload,
|
|
6324
|
+
label,
|
|
6325
|
+
finalColors = {},
|
|
6326
|
+
periodLabel = "Per\xEDodo"
|
|
6327
|
+
}) => {
|
|
6328
|
+
if (!active || !payload || payload.length === 0) return null;
|
|
6329
|
+
return /* @__PURE__ */ jsxs37(
|
|
6330
|
+
"div",
|
|
6331
|
+
{
|
|
6332
|
+
role: "dialog",
|
|
6333
|
+
"aria-label": `Tooltip ${label ?? ""}`,
|
|
6334
|
+
className: "bg-card border border-border rounded-lg p-3 shadow-2xl max-w-[280px]",
|
|
6335
|
+
style: { minWidth: 220 },
|
|
6336
|
+
children: [
|
|
6337
|
+
/* @__PURE__ */ jsx55("div", { className: "mb-2", children: /* @__PURE__ */ jsx55("div", { className: "flex items-center justify-between gap-3", children: /* @__PURE__ */ jsxs37("div", { className: "min-w-0", children: [
|
|
6338
|
+
/* @__PURE__ */ jsx55("p", { className: "text-xs text-muted-foreground", children: periodLabel }),
|
|
6339
|
+
/* @__PURE__ */ jsx55("p", { className: "font-medium text-foreground truncate", children: label })
|
|
6340
|
+
] }) }) }),
|
|
6341
|
+
/* @__PURE__ */ jsx55("div", { className: "divide-y divide-border rounded-md overflow-hidden", children: payload.map((entry, index) => {
|
|
6342
|
+
const value = typeof entry.value === "number" ? entry.value : 0;
|
|
6343
|
+
const color = finalColors[entry.dataKey] || entry.color || "#999";
|
|
6344
|
+
return /* @__PURE__ */ jsxs37(
|
|
6345
|
+
"div",
|
|
6346
|
+
{
|
|
6347
|
+
className: "flex items-center justify-between text-sm px-2 py-2 bg-card/0 hover:bg-muted transition-colors",
|
|
6348
|
+
children: [
|
|
6349
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3 min-w-0", children: [
|
|
6350
|
+
/* @__PURE__ */ jsx55(
|
|
6351
|
+
"span",
|
|
6352
|
+
{
|
|
6353
|
+
className: "w-3 h-3 rounded-sm flex-shrink-0 border border-border/20",
|
|
6354
|
+
style: { backgroundColor: color },
|
|
6355
|
+
"aria-hidden": true
|
|
6356
|
+
}
|
|
6357
|
+
),
|
|
6358
|
+
/* @__PURE__ */ jsx55("span", { className: "text-muted-foreground truncate", children: entry.name })
|
|
6359
|
+
] }),
|
|
6360
|
+
/* @__PURE__ */ jsx55("div", { className: "ml-3", children: /* @__PURE__ */ jsx55(
|
|
6361
|
+
"span",
|
|
6362
|
+
{
|
|
6363
|
+
className: `font-medium tabular-nums ${value < 0 ? "text-destructive" : "text-foreground"}`,
|
|
6364
|
+
children: value.toLocaleString("pt-BR")
|
|
6365
|
+
}
|
|
6366
|
+
) })
|
|
6367
|
+
]
|
|
6368
|
+
},
|
|
6369
|
+
index
|
|
6370
|
+
);
|
|
6371
|
+
}) })
|
|
6372
|
+
]
|
|
6373
|
+
}
|
|
6374
|
+
);
|
|
6375
|
+
};
|
|
6376
|
+
var TooltipSimple_default = TooltipSimple;
|
|
6377
|
+
|
|
6378
|
+
// src/components/charts/utils/helpers.ts
|
|
6379
|
+
var formatFieldName = (fieldName) => {
|
|
6380
|
+
return fieldName.replace(/([A-Z])/g, " $1").replace(/[_-]/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()).trim();
|
|
6381
|
+
};
|
|
6382
|
+
var detectDataFields = (data, xAxisKey) => {
|
|
6383
|
+
if (!data || data.length === 0) return [];
|
|
6384
|
+
const firstItem = data[0];
|
|
6385
|
+
return Object.keys(firstItem).filter(
|
|
6386
|
+
(key) => key !== xAxisKey && typeof firstItem[key] === "number"
|
|
6387
|
+
);
|
|
6388
|
+
};
|
|
6389
|
+
var detectXAxis = (data) => {
|
|
6390
|
+
if (!data || data.length === 0) return "name";
|
|
6391
|
+
const firstItem = data[0];
|
|
6392
|
+
const stringFields = Object.keys(firstItem).filter(
|
|
6393
|
+
(key) => typeof firstItem[key] === "string" || typeof firstItem[key] === "number" && String(firstItem[key]).length <= 4
|
|
6394
|
+
);
|
|
6395
|
+
return stringFields[0] || Object.keys(firstItem)[0] || "name";
|
|
6396
|
+
};
|
|
6397
|
+
var generateAdditionalColors = (baseColors, count) => {
|
|
6398
|
+
const hexToRgb = (hex) => {
|
|
6399
|
+
const clean = hex.replace("#", "");
|
|
6400
|
+
const bigint = parseInt(
|
|
6401
|
+
clean.length === 3 ? clean.split("").map((c) => c + c).join("") : clean,
|
|
6402
|
+
16
|
|
6403
|
+
);
|
|
6404
|
+
return { r: bigint >> 16 & 255, g: bigint >> 8 & 255, b: bigint & 255 };
|
|
6405
|
+
};
|
|
6406
|
+
const rgbToHsl = ({ r, g, b }) => {
|
|
6407
|
+
r /= 255;
|
|
6408
|
+
g /= 255;
|
|
6409
|
+
b /= 255;
|
|
6410
|
+
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
6411
|
+
let h = 0;
|
|
6412
|
+
let s = 0;
|
|
6413
|
+
const l = (max + min) / 2;
|
|
6414
|
+
if (max !== min) {
|
|
6415
|
+
const d = max - min;
|
|
6416
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
6417
|
+
switch (max) {
|
|
6418
|
+
case r:
|
|
6419
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
6420
|
+
break;
|
|
6421
|
+
case g:
|
|
6422
|
+
h = (b - r) / d + 2;
|
|
6423
|
+
break;
|
|
6424
|
+
case b:
|
|
6425
|
+
h = (r - g) / d + 4;
|
|
6426
|
+
break;
|
|
6427
|
+
}
|
|
6428
|
+
h /= 6;
|
|
6429
|
+
}
|
|
6430
|
+
return {
|
|
6431
|
+
h: Math.round(h * 360),
|
|
6432
|
+
s: Math.round(s * 100),
|
|
6433
|
+
l: Math.round(l * 100)
|
|
6434
|
+
};
|
|
6435
|
+
};
|
|
6436
|
+
const hslToHex = (h, s, l) => {
|
|
6437
|
+
s /= 100;
|
|
6438
|
+
l /= 100;
|
|
6439
|
+
const k = (n) => (n + h / 30) % 5;
|
|
6440
|
+
const a = s * Math.min(l, 1 - l);
|
|
6441
|
+
const f = (n) => {
|
|
6442
|
+
const color = l - a * Math.max(-1, Math.min(k(n) - 3, Math.min(9 - k(n), 1)));
|
|
6443
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
6444
|
+
};
|
|
6445
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
6446
|
+
};
|
|
6447
|
+
const anchors = baseColors.map((c) => rgbToHsl(hexToRgb(c)));
|
|
6448
|
+
const colors2 = [...baseColors];
|
|
6449
|
+
let i = 0;
|
|
6450
|
+
while (colors2.length < count) {
|
|
6451
|
+
const anchor = anchors[i % anchors.length];
|
|
6452
|
+
const step = Math.floor(i / anchors.length + 1);
|
|
6453
|
+
const hueOffset = step * 25 * (i % 2 === 0 ? 1 : -1);
|
|
6454
|
+
const satOffset = i % 3 === 0 ? -6 : 6;
|
|
6455
|
+
const lightOffset = i % 4 === 0 ? 6 : -4;
|
|
6456
|
+
const newH = (anchor.h + hueOffset + 360) % 360;
|
|
6457
|
+
const newS = Math.max(30, Math.min(95, anchor.s + satOffset));
|
|
6458
|
+
const newL = Math.max(25, Math.min(45, anchor.l + lightOffset));
|
|
6459
|
+
colors2.push(hslToHex(newH, newS, newL));
|
|
6460
|
+
i += 1;
|
|
6461
|
+
}
|
|
6462
|
+
return colors2.slice(0, count);
|
|
6463
|
+
};
|
|
6464
|
+
var niceCeil = (value) => {
|
|
6465
|
+
if (!isFinite(value) || value <= 0) return 1;
|
|
6466
|
+
const pow = Math.pow(10, Math.floor(Math.log10(value)));
|
|
6467
|
+
const normalized = value / pow;
|
|
6468
|
+
const multipliers = [
|
|
6469
|
+
1,
|
|
6470
|
+
1.25,
|
|
6471
|
+
1.5,
|
|
6472
|
+
2,
|
|
6473
|
+
2.5,
|
|
6474
|
+
3,
|
|
6475
|
+
4,
|
|
6476
|
+
5,
|
|
6477
|
+
7.5,
|
|
6478
|
+
10,
|
|
6479
|
+
15,
|
|
6480
|
+
20,
|
|
6481
|
+
25,
|
|
6482
|
+
50,
|
|
6483
|
+
100
|
|
6484
|
+
];
|
|
6485
|
+
for (const m of multipliers) {
|
|
6486
|
+
if (m >= normalized) return Math.ceil(m * pow);
|
|
6487
|
+
}
|
|
6488
|
+
return Math.ceil(100 * pow);
|
|
6489
|
+
};
|
|
6490
|
+
var compactTick = (value) => {
|
|
6491
|
+
if (value >= 1e9)
|
|
6492
|
+
return (value / 1e9).toFixed(1).replace(/\.0$/, "") + "B";
|
|
6493
|
+
if (value >= 1e6)
|
|
6494
|
+
return (value / 1e6).toFixed(1).replace(/\.0$/, "") + "M";
|
|
6495
|
+
if (value >= 1e3) return (value / 1e3).toFixed(1).replace(/\.0$/, "") + "K";
|
|
6496
|
+
return String(value);
|
|
6497
|
+
};
|
|
6498
|
+
var resolveContainerPaddingLeft = (padding, containerPaddingLeft, defaultLeft = 16) => {
|
|
6499
|
+
if (typeof padding === "number") return padding;
|
|
6500
|
+
if (padding && typeof padding === "object" && padding.left != null)
|
|
6501
|
+
return padding.left;
|
|
6502
|
+
if (typeof containerPaddingLeft === "number") return containerPaddingLeft;
|
|
6503
|
+
return defaultLeft;
|
|
6504
|
+
};
|
|
6505
|
+
var resolveChartMargins = (margins, chartMargins, showLabels) => {
|
|
6506
|
+
const defaultRight = 30;
|
|
6507
|
+
const defaultLeft = 20;
|
|
6508
|
+
const topDefault = showLabels ? 48 : 20;
|
|
6509
|
+
const bottomDefault = 5;
|
|
6510
|
+
return {
|
|
6511
|
+
top: margins?.top ?? chartMargins?.top ?? topDefault,
|
|
6512
|
+
right: margins?.right ?? chartMargins?.right ?? defaultRight,
|
|
6513
|
+
left: margins?.left ?? chartMargins?.left ?? defaultLeft,
|
|
6514
|
+
bottom: margins?.bottom ?? chartMargins?.bottom ?? bottomDefault
|
|
6515
|
+
};
|
|
6516
|
+
};
|
|
6517
|
+
|
|
6518
|
+
// src/components/charts/utils/pillLabelRenderer.tsx
|
|
6519
|
+
import { jsx as jsx56, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
6520
|
+
var formatCompactNumber = (value) => {
|
|
6521
|
+
const isNegative = value < 0;
|
|
6522
|
+
const absValue = Math.abs(value);
|
|
6523
|
+
let formatted;
|
|
6524
|
+
if (absValue >= 1e9) {
|
|
6525
|
+
formatted = (absValue / 1e9).toFixed(1).replace(/\.0$/, "") + "B";
|
|
6526
|
+
} else if (absValue >= 1e6) {
|
|
6527
|
+
formatted = (absValue / 1e6).toFixed(1).replace(/\.0$/, "") + "M";
|
|
6528
|
+
} else if (absValue >= 1e3) {
|
|
6529
|
+
formatted = (absValue / 1e3).toFixed(1).replace(/\.0$/, "") + "K";
|
|
6530
|
+
} else {
|
|
6531
|
+
formatted = absValue.toString();
|
|
6532
|
+
}
|
|
6533
|
+
return isNegative ? `-${formatted}` : formatted;
|
|
6534
|
+
};
|
|
6535
|
+
var parseNumber = (v) => {
|
|
6536
|
+
if (typeof v === "number") return v;
|
|
6537
|
+
if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)))
|
|
6538
|
+
return Number(v);
|
|
6539
|
+
return void 0;
|
|
6540
|
+
};
|
|
6541
|
+
var renderPillLabel = (color, variant) => {
|
|
6542
|
+
return (props) => {
|
|
6543
|
+
const { x, y, value } = props;
|
|
6544
|
+
const text = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
|
|
6545
|
+
const paddingX = 8;
|
|
6546
|
+
const approxCharWidth = 7;
|
|
6547
|
+
const pillWidth = Math.max(
|
|
6548
|
+
40,
|
|
6549
|
+
String(text).length * approxCharWidth + paddingX * 2
|
|
6550
|
+
);
|
|
6551
|
+
const pillHeight = 20;
|
|
6552
|
+
const xNum = parseNumber(x);
|
|
6553
|
+
const px = parseNumber(props.x);
|
|
6554
|
+
const pWidth = parseNumber(props.width);
|
|
6555
|
+
const vb = props.viewBox;
|
|
6556
|
+
const cxNum = parseNumber(props.cx);
|
|
6557
|
+
let centerX;
|
|
6558
|
+
if (typeof px === "number" && typeof pWidth === "number") {
|
|
6559
|
+
centerX = px + pWidth / 2;
|
|
6560
|
+
} else if (typeof xNum === "number" && typeof pWidth === "number") {
|
|
6561
|
+
centerX = xNum + pWidth / 2;
|
|
6562
|
+
} else if (typeof cxNum === "number") {
|
|
6563
|
+
centerX = cxNum;
|
|
6564
|
+
} else if (vb && typeof vb.x === "number" && typeof vb.width === "number" && typeof props.index === "number") {
|
|
6565
|
+
const approxCols = Math.max(1, props.index + 1);
|
|
6566
|
+
const colWidth = vb.width / approxCols;
|
|
6567
|
+
centerX = vb.x + colWidth * (props.index + 0.5);
|
|
6568
|
+
} else if (vb && typeof vb.x === "number" && typeof vb.width === "number") {
|
|
6569
|
+
centerX = vb.x + vb.width / 2;
|
|
6570
|
+
} else {
|
|
6571
|
+
centerX = typeof props.index === "number" ? props.index * 40 + 24 : 0;
|
|
6572
|
+
}
|
|
6573
|
+
if (vb && typeof vb.x === "number" && typeof vb.width === "number") {
|
|
6574
|
+
const minX = vb.x + 0 + pillWidth / 22;
|
|
6575
|
+
const maxX = vb.x + vb.width - 2 - pillWidth / 2;
|
|
6576
|
+
centerX = Math.max(minX, Math.min(maxX, centerX));
|
|
6577
|
+
}
|
|
6578
|
+
const yNum = parseNumber(y);
|
|
6579
|
+
const py = parseNumber(props.y);
|
|
6580
|
+
const cyNum = parseNumber(props.cy);
|
|
6581
|
+
const centerY = yNum ?? (typeof py === "number" ? py : vb && typeof vb.y === "number" && typeof vb.height === "number" ? vb.y + vb.height / 2 : typeof cyNum === "number" ? cyNum : 0);
|
|
6582
|
+
const rectX = centerX - pillWidth / 2;
|
|
6583
|
+
const rectY = centerY - pillHeight - 6;
|
|
6584
|
+
const textX = centerX;
|
|
6585
|
+
const textY = rectY + pillHeight / 2 + 3;
|
|
6586
|
+
const rectFill = variant === "filled" ? color : variant === "soft" ? `${color}20` : "#ffffff";
|
|
6587
|
+
const rectStroke = variant === "outline" ? `${color}CC` : void 0;
|
|
6588
|
+
const numValue = parseNumber(value);
|
|
6589
|
+
const isNegative = typeof numValue === "number" && numValue < 0;
|
|
6590
|
+
let textColor;
|
|
6591
|
+
if (isNegative) {
|
|
6592
|
+
textColor = "#dc2626";
|
|
6593
|
+
} else {
|
|
6594
|
+
if (variant === "filled") {
|
|
6595
|
+
textColor = "#ffffff";
|
|
6596
|
+
} else {
|
|
6597
|
+
textColor = "#374151";
|
|
6598
|
+
}
|
|
6599
|
+
}
|
|
6600
|
+
return /* @__PURE__ */ jsxs38("g", { children: [
|
|
6601
|
+
/* @__PURE__ */ jsx56(
|
|
6602
|
+
"rect",
|
|
6603
|
+
{
|
|
6604
|
+
x: rectX,
|
|
6605
|
+
y: rectY,
|
|
6606
|
+
rx: pillHeight / 2,
|
|
6607
|
+
width: pillWidth,
|
|
6608
|
+
height: pillHeight,
|
|
6609
|
+
fill: rectFill,
|
|
6610
|
+
stroke: rectStroke,
|
|
6611
|
+
strokeWidth: rectStroke ? 1 : 0
|
|
6612
|
+
}
|
|
6613
|
+
),
|
|
6614
|
+
/* @__PURE__ */ jsx56(
|
|
6615
|
+
"text",
|
|
6616
|
+
{
|
|
6617
|
+
x: textX,
|
|
6618
|
+
y: textY - 3,
|
|
6619
|
+
fill: textColor,
|
|
6620
|
+
fontSize: 13,
|
|
6621
|
+
fontWeight: 700,
|
|
6622
|
+
textAnchor: "middle",
|
|
6623
|
+
dominantBaseline: "central",
|
|
6624
|
+
letterSpacing: 0.2,
|
|
6625
|
+
children: text
|
|
6626
|
+
}
|
|
6627
|
+
)
|
|
6628
|
+
] });
|
|
6629
|
+
};
|
|
6630
|
+
};
|
|
6631
|
+
var pillLabelRenderer_default = renderPillLabel;
|
|
6632
|
+
|
|
6633
|
+
// src/hooks/use-drag.tsx
|
|
6634
|
+
import { useState as useState11, useCallback as useCallback7, useRef as useRef4, useEffect as useEffect10 } from "react";
|
|
6635
|
+
var useDrag = (options = {}) => {
|
|
6636
|
+
const [isDragging, setIsDragging] = useState11(null);
|
|
6637
|
+
const [positions, setPositions] = useState11({});
|
|
6638
|
+
const dragStartPos = useRef4(null);
|
|
6639
|
+
const dragId = useRef4(null);
|
|
6640
|
+
const handleMouseDown = useCallback7((id, e) => {
|
|
6641
|
+
e.preventDefault();
|
|
6642
|
+
const currentPosition = positions[id] || { top: 0, left: 0 };
|
|
6643
|
+
dragStartPos.current = {
|
|
6644
|
+
x: e.clientX,
|
|
6645
|
+
y: e.clientY,
|
|
6646
|
+
elementX: currentPosition.left,
|
|
6647
|
+
elementY: currentPosition.top
|
|
6648
|
+
};
|
|
6649
|
+
dragId.current = id;
|
|
6650
|
+
setIsDragging(id);
|
|
6651
|
+
options.onDragStart?.(id);
|
|
6652
|
+
}, [positions, options]);
|
|
6653
|
+
const handleMouseMove = useCallback7((e) => {
|
|
6654
|
+
if (!isDragging || !dragStartPos.current || !dragId.current) return;
|
|
6655
|
+
const deltaX = e.clientX - dragStartPos.current.x;
|
|
6656
|
+
const deltaY = e.clientY - dragStartPos.current.y;
|
|
6657
|
+
const newPosition = {
|
|
6658
|
+
left: dragStartPos.current.elementX + deltaX,
|
|
6659
|
+
top: dragStartPos.current.elementY + deltaY
|
|
6660
|
+
};
|
|
6661
|
+
newPosition.left = Math.max(0, Math.min(window.innerWidth - 300, newPosition.left));
|
|
6662
|
+
newPosition.top = Math.max(0, Math.min(window.innerHeight - 200, newPosition.top));
|
|
6663
|
+
setPositions((prev) => ({
|
|
6664
|
+
...prev,
|
|
6665
|
+
[dragId.current]: newPosition
|
|
6666
|
+
}));
|
|
6667
|
+
options.onDrag?.(dragId.current, newPosition);
|
|
6668
|
+
}, [isDragging, options]);
|
|
6669
|
+
const handleMouseUp = useCallback7(() => {
|
|
6670
|
+
if (dragId.current) {
|
|
6671
|
+
options.onDragEnd?.(dragId.current);
|
|
6672
|
+
}
|
|
6673
|
+
setIsDragging(null);
|
|
6674
|
+
dragStartPos.current = null;
|
|
6675
|
+
dragId.current = null;
|
|
6676
|
+
}, [options]);
|
|
6677
|
+
useEffect10(() => {
|
|
6678
|
+
if (isDragging) {
|
|
6679
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
6680
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
6681
|
+
document.body.style.userSelect = "none";
|
|
6682
|
+
return () => {
|
|
6683
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
6684
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
6685
|
+
document.body.style.userSelect = "";
|
|
6686
|
+
};
|
|
6687
|
+
}
|
|
6688
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
6689
|
+
const setPosition = useCallback7((id, position) => {
|
|
6690
|
+
setPositions((prev) => ({
|
|
6691
|
+
...prev,
|
|
6692
|
+
[id]: position
|
|
6693
|
+
}));
|
|
6694
|
+
}, []);
|
|
6695
|
+
const getPosition = useCallback7((id) => {
|
|
6696
|
+
return positions[id] || { top: 0, left: 0 };
|
|
6697
|
+
}, [positions]);
|
|
6698
|
+
const isElementDragging = useCallback7((id) => {
|
|
6699
|
+
return isDragging === id;
|
|
6700
|
+
}, [isDragging]);
|
|
6701
|
+
return {
|
|
6702
|
+
handleMouseDown,
|
|
6703
|
+
getPosition,
|
|
6704
|
+
setPosition,
|
|
6705
|
+
isElementDragging,
|
|
6706
|
+
isDragging: isDragging !== null
|
|
6707
|
+
};
|
|
6708
|
+
};
|
|
4842
6709
|
export {
|
|
4843
6710
|
AlertDialogActionBase,
|
|
4844
6711
|
AlertDialogBase,
|
|
@@ -4877,6 +6744,7 @@ export {
|
|
|
4877
6744
|
CarouselNextBase,
|
|
4878
6745
|
CarouselPrevious,
|
|
4879
6746
|
CheckboxBase,
|
|
6747
|
+
CloseAllButton_default as CloseAllButton,
|
|
4880
6748
|
CollapsibleBase,
|
|
4881
6749
|
CollapsibleContentBase,
|
|
4882
6750
|
CollapsibleTriggerBase,
|
|
@@ -4917,6 +6785,7 @@ export {
|
|
|
4917
6785
|
DialogPortalBase,
|
|
4918
6786
|
DialogTitleBase,
|
|
4919
6787
|
DialogTriggerBase,
|
|
6788
|
+
DraggableTooltip_default as DraggableTooltip,
|
|
4920
6789
|
DrawerBase,
|
|
4921
6790
|
DrawerCloseBase,
|
|
4922
6791
|
DrawerContentBase,
|
|
@@ -4942,6 +6811,7 @@ export {
|
|
|
4942
6811
|
DropDownMenuSubContentBase,
|
|
4943
6812
|
DropDownMenuSubTriggerBase,
|
|
4944
6813
|
DropDownMenuTriggerBase,
|
|
6814
|
+
Highlights_default as Highlights,
|
|
4945
6815
|
HoverCardBase,
|
|
4946
6816
|
HoverCardContentBase,
|
|
4947
6817
|
HoverCardTriggerBase,
|
|
@@ -4951,6 +6821,7 @@ export {
|
|
|
4951
6821
|
InputOTPSeparatorBase,
|
|
4952
6822
|
InputOTPSlotBase,
|
|
4953
6823
|
LabelBase_default as LabelBase,
|
|
6824
|
+
LoadingBase,
|
|
4954
6825
|
ModeToggleBase,
|
|
4955
6826
|
MultiCombobox,
|
|
4956
6827
|
NavigationMenuBase,
|
|
@@ -4961,6 +6832,7 @@ export {
|
|
|
4961
6832
|
NavigationMenuListBase,
|
|
4962
6833
|
NavigationMenuTriggerBase,
|
|
4963
6834
|
NavigationMenuViewportBase,
|
|
6835
|
+
PeriodsDropdown_default as PeriodsDropdown,
|
|
4964
6836
|
PopoverAnchorBase,
|
|
4965
6837
|
PopoverBase,
|
|
4966
6838
|
PopoverContentBase,
|
|
@@ -4993,6 +6865,7 @@ export {
|
|
|
4993
6865
|
SheetPortalBase,
|
|
4994
6866
|
SheetTitleBase,
|
|
4995
6867
|
SheetTriggerBase,
|
|
6868
|
+
ShowOnly_default as ShowOnly,
|
|
4996
6869
|
SidebarBase,
|
|
4997
6870
|
SidebarContentBase,
|
|
4998
6871
|
SidebarFooterBase,
|
|
@@ -5039,11 +6912,23 @@ export {
|
|
|
5039
6912
|
TooltipBase,
|
|
5040
6913
|
TooltipContentBase,
|
|
5041
6914
|
TooltipProviderBase,
|
|
6915
|
+
TooltipSimple_default as TooltipSimple,
|
|
5042
6916
|
TooltipTriggerBase,
|
|
6917
|
+
TooltipWithTotal_default as TooltipWithTotal,
|
|
5043
6918
|
UseSideBarBase,
|
|
5044
6919
|
badgeVariants,
|
|
5045
6920
|
buttonVariantsBase,
|
|
6921
|
+
compactTick,
|
|
6922
|
+
detectDataFields,
|
|
6923
|
+
detectXAxis,
|
|
6924
|
+
formatFieldName,
|
|
6925
|
+
generateAdditionalColors,
|
|
6926
|
+
niceCeil,
|
|
6927
|
+
pillLabelRenderer_default as renderPillLabel,
|
|
6928
|
+
resolveChartMargins,
|
|
6929
|
+
resolveContainerPaddingLeft,
|
|
5046
6930
|
toast,
|
|
6931
|
+
useDrag,
|
|
5047
6932
|
useIsMobile,
|
|
5048
6933
|
useTheme
|
|
5049
6934
|
};
|