@marcoschwartz/lite-ui 0.26.3 → 0.27.0
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.d.mts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +891 -652
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +823 -585
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3511,8 +3511,244 @@ var Radio = ({
|
|
|
3511
3511
|
}) });
|
|
3512
3512
|
};
|
|
3513
3513
|
|
|
3514
|
-
// src/components/
|
|
3514
|
+
// src/components/SegmentedControl.tsx
|
|
3515
|
+
import { useState as useState12, useRef as useRef6, useEffect as useEffect9, useId, useCallback as useCallback2 } from "react";
|
|
3515
3516
|
import { jsx as jsx99, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3517
|
+
function normalizeData(data) {
|
|
3518
|
+
return data.map(
|
|
3519
|
+
(item) => typeof item === "string" ? { value: item, label: item } : item
|
|
3520
|
+
);
|
|
3521
|
+
}
|
|
3522
|
+
var sizeConfig = {
|
|
3523
|
+
xs: {
|
|
3524
|
+
padding: "px-2 py-0.5",
|
|
3525
|
+
text: "text-xs",
|
|
3526
|
+
height: "h-6",
|
|
3527
|
+
minWidth: "min-w-[2rem]"
|
|
3528
|
+
},
|
|
3529
|
+
sm: {
|
|
3530
|
+
padding: "px-2.5 py-1",
|
|
3531
|
+
text: "text-sm",
|
|
3532
|
+
height: "h-8",
|
|
3533
|
+
minWidth: "min-w-[2.5rem]"
|
|
3534
|
+
},
|
|
3535
|
+
md: {
|
|
3536
|
+
padding: "px-3 py-1.5",
|
|
3537
|
+
text: "text-sm",
|
|
3538
|
+
height: "h-9",
|
|
3539
|
+
minWidth: "min-w-[3rem]"
|
|
3540
|
+
},
|
|
3541
|
+
lg: {
|
|
3542
|
+
padding: "px-4 py-2",
|
|
3543
|
+
text: "text-base",
|
|
3544
|
+
height: "h-11",
|
|
3545
|
+
minWidth: "min-w-[3.5rem]"
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3548
|
+
var radiusConfig = {
|
|
3549
|
+
none: "rounded-none",
|
|
3550
|
+
sm: "rounded-sm",
|
|
3551
|
+
md: "rounded-md",
|
|
3552
|
+
lg: "rounded-lg",
|
|
3553
|
+
full: "rounded-full"
|
|
3554
|
+
};
|
|
3555
|
+
var colorConfig = {
|
|
3556
|
+
primary: "bg-[hsl(var(--primary))]",
|
|
3557
|
+
secondary: "bg-[hsl(var(--secondary))]",
|
|
3558
|
+
neutral: "bg-[hsl(var(--muted))]"
|
|
3559
|
+
};
|
|
3560
|
+
var activeTextConfig = {
|
|
3561
|
+
primary: "text-[hsl(var(--primary-foreground))]",
|
|
3562
|
+
secondary: "text-[hsl(var(--secondary-foreground))]",
|
|
3563
|
+
neutral: "text-[hsl(var(--foreground))]"
|
|
3564
|
+
};
|
|
3565
|
+
var SegmentedControl = ({
|
|
3566
|
+
data,
|
|
3567
|
+
value: controlledValue,
|
|
3568
|
+
defaultValue,
|
|
3569
|
+
onChange,
|
|
3570
|
+
size = "md",
|
|
3571
|
+
radius = "md",
|
|
3572
|
+
color = "primary",
|
|
3573
|
+
fullWidth = false,
|
|
3574
|
+
disabled = false,
|
|
3575
|
+
orientation = "horizontal",
|
|
3576
|
+
className = "",
|
|
3577
|
+
transitionDuration = 200,
|
|
3578
|
+
name,
|
|
3579
|
+
ariaLabel
|
|
3580
|
+
}) => {
|
|
3581
|
+
const groupId = useId();
|
|
3582
|
+
const groupName = name || `segmented-control-${groupId}`;
|
|
3583
|
+
const containerRef = useRef6(null);
|
|
3584
|
+
const [indicatorStyle, setIndicatorStyle] = useState12({});
|
|
3585
|
+
const options = normalizeData(data);
|
|
3586
|
+
const [internalValue, setInternalValue] = useState12(
|
|
3587
|
+
defaultValue || options[0]?.value || ""
|
|
3588
|
+
);
|
|
3589
|
+
const isControlled = controlledValue !== void 0;
|
|
3590
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
3591
|
+
const handleChange = useCallback2((newValue) => {
|
|
3592
|
+
if (disabled) return;
|
|
3593
|
+
if (!isControlled) {
|
|
3594
|
+
setInternalValue(newValue);
|
|
3595
|
+
}
|
|
3596
|
+
onChange?.(newValue);
|
|
3597
|
+
}, [disabled, isControlled, onChange]);
|
|
3598
|
+
const updateIndicator = useCallback2(() => {
|
|
3599
|
+
if (!containerRef.current) return;
|
|
3600
|
+
const container = containerRef.current;
|
|
3601
|
+
const activeIndex = options.findIndex((opt) => opt.value === currentValue);
|
|
3602
|
+
if (activeIndex === -1) return;
|
|
3603
|
+
const buttons = container.querySelectorAll("[data-segment-button]");
|
|
3604
|
+
const activeButton = buttons[activeIndex];
|
|
3605
|
+
if (!activeButton) return;
|
|
3606
|
+
const containerRect = container.getBoundingClientRect();
|
|
3607
|
+
const buttonRect = activeButton.getBoundingClientRect();
|
|
3608
|
+
if (orientation === "horizontal") {
|
|
3609
|
+
setIndicatorStyle({
|
|
3610
|
+
width: buttonRect.width,
|
|
3611
|
+
height: "100%",
|
|
3612
|
+
transform: `translateX(${buttonRect.left - containerRect.left}px)`,
|
|
3613
|
+
transition: `transform ${transitionDuration}ms ease, width ${transitionDuration}ms ease`
|
|
3614
|
+
});
|
|
3615
|
+
} else {
|
|
3616
|
+
setIndicatorStyle({
|
|
3617
|
+
width: "100%",
|
|
3618
|
+
height: buttonRect.height,
|
|
3619
|
+
transform: `translateY(${buttonRect.top - containerRect.top}px)`,
|
|
3620
|
+
transition: `transform ${transitionDuration}ms ease, height ${transitionDuration}ms ease`
|
|
3621
|
+
});
|
|
3622
|
+
}
|
|
3623
|
+
}, [currentValue, options, orientation, transitionDuration]);
|
|
3624
|
+
useEffect9(() => {
|
|
3625
|
+
updateIndicator();
|
|
3626
|
+
const handleResize = () => updateIndicator();
|
|
3627
|
+
window.addEventListener("resize", handleResize);
|
|
3628
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
3629
|
+
}, [updateIndicator]);
|
|
3630
|
+
const handleKeyDown = useCallback2((e, index) => {
|
|
3631
|
+
const enabledOptions = options.filter((opt) => !opt.disabled);
|
|
3632
|
+
const currentEnabledIndex = enabledOptions.findIndex((opt) => opt.value === currentValue);
|
|
3633
|
+
let nextIndex = -1;
|
|
3634
|
+
if (orientation === "horizontal") {
|
|
3635
|
+
if (e.key === "ArrowRight") {
|
|
3636
|
+
nextIndex = (currentEnabledIndex + 1) % enabledOptions.length;
|
|
3637
|
+
} else if (e.key === "ArrowLeft") {
|
|
3638
|
+
nextIndex = (currentEnabledIndex - 1 + enabledOptions.length) % enabledOptions.length;
|
|
3639
|
+
}
|
|
3640
|
+
} else {
|
|
3641
|
+
if (e.key === "ArrowDown") {
|
|
3642
|
+
nextIndex = (currentEnabledIndex + 1) % enabledOptions.length;
|
|
3643
|
+
} else if (e.key === "ArrowUp") {
|
|
3644
|
+
nextIndex = (currentEnabledIndex - 1 + enabledOptions.length) % enabledOptions.length;
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
if (e.key === "Home") {
|
|
3648
|
+
nextIndex = 0;
|
|
3649
|
+
} else if (e.key === "End") {
|
|
3650
|
+
nextIndex = enabledOptions.length - 1;
|
|
3651
|
+
}
|
|
3652
|
+
if (nextIndex !== -1) {
|
|
3653
|
+
e.preventDefault();
|
|
3654
|
+
const nextOption = enabledOptions[nextIndex];
|
|
3655
|
+
handleChange(nextOption.value);
|
|
3656
|
+
const buttons = containerRef.current?.querySelectorAll("[data-segment-button]");
|
|
3657
|
+
const nextButton = Array.from(buttons || []).find(
|
|
3658
|
+
(btn) => btn.getAttribute("data-value") === nextOption.value
|
|
3659
|
+
);
|
|
3660
|
+
nextButton?.focus();
|
|
3661
|
+
}
|
|
3662
|
+
}, [options, currentValue, orientation, handleChange]);
|
|
3663
|
+
const sizeStyles2 = sizeConfig[size];
|
|
3664
|
+
const radiusStyle = radiusConfig[radius];
|
|
3665
|
+
const containerClasses = [
|
|
3666
|
+
"relative inline-flex p-1",
|
|
3667
|
+
"bg-[hsl(var(--muted))]",
|
|
3668
|
+
radiusStyle,
|
|
3669
|
+
orientation === "vertical" ? "flex-col" : "flex-row",
|
|
3670
|
+
fullWidth ? "w-full" : "",
|
|
3671
|
+
disabled ? "opacity-50 cursor-not-allowed" : "",
|
|
3672
|
+
className
|
|
3673
|
+
].filter(Boolean).join(" ");
|
|
3674
|
+
return /* @__PURE__ */ jsxs27(
|
|
3675
|
+
"div",
|
|
3676
|
+
{
|
|
3677
|
+
ref: containerRef,
|
|
3678
|
+
role: "radiogroup",
|
|
3679
|
+
"aria-label": ariaLabel || "Segmented control",
|
|
3680
|
+
className: containerClasses,
|
|
3681
|
+
children: [
|
|
3682
|
+
/* @__PURE__ */ jsx99(
|
|
3683
|
+
"div",
|
|
3684
|
+
{
|
|
3685
|
+
className: [
|
|
3686
|
+
"absolute top-1 left-1 z-0",
|
|
3687
|
+
radiusStyle,
|
|
3688
|
+
colorConfig[color],
|
|
3689
|
+
"shadow-sm"
|
|
3690
|
+
].join(" "),
|
|
3691
|
+
style: indicatorStyle,
|
|
3692
|
+
"aria-hidden": "true"
|
|
3693
|
+
}
|
|
3694
|
+
),
|
|
3695
|
+
options.map((option, index) => {
|
|
3696
|
+
const isActive = option.value === currentValue;
|
|
3697
|
+
const isDisabled = disabled || option.disabled;
|
|
3698
|
+
const buttonClasses = [
|
|
3699
|
+
"relative z-10 flex items-center justify-center",
|
|
3700
|
+
"font-medium select-none",
|
|
3701
|
+
"transition-colors duration-150",
|
|
3702
|
+
sizeStyles2.padding,
|
|
3703
|
+
sizeStyles2.text,
|
|
3704
|
+
sizeStyles2.minWidth,
|
|
3705
|
+
radiusStyle,
|
|
3706
|
+
fullWidth ? "flex-1" : "",
|
|
3707
|
+
isActive ? activeTextConfig[color] : "text-[hsl(var(--muted-foreground))]",
|
|
3708
|
+
isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:text-[hsl(var(--foreground))]",
|
|
3709
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--ring))] focus-visible:ring-offset-1"
|
|
3710
|
+
].filter(Boolean).join(" ");
|
|
3711
|
+
return /* @__PURE__ */ jsxs27(
|
|
3712
|
+
"button",
|
|
3713
|
+
{
|
|
3714
|
+
type: "button",
|
|
3715
|
+
role: "radio",
|
|
3716
|
+
"aria-checked": isActive,
|
|
3717
|
+
"data-segment-button": true,
|
|
3718
|
+
"data-value": option.value,
|
|
3719
|
+
disabled: isDisabled,
|
|
3720
|
+
tabIndex: isActive ? 0 : -1,
|
|
3721
|
+
className: buttonClasses,
|
|
3722
|
+
onClick: () => !isDisabled && handleChange(option.value),
|
|
3723
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
3724
|
+
children: [
|
|
3725
|
+
option.label,
|
|
3726
|
+
/* @__PURE__ */ jsx99(
|
|
3727
|
+
"input",
|
|
3728
|
+
{
|
|
3729
|
+
type: "radio",
|
|
3730
|
+
name: groupName,
|
|
3731
|
+
value: option.value,
|
|
3732
|
+
checked: isActive,
|
|
3733
|
+
disabled: isDisabled,
|
|
3734
|
+
onChange: () => {
|
|
3735
|
+
},
|
|
3736
|
+
className: "sr-only",
|
|
3737
|
+
"aria-hidden": "true"
|
|
3738
|
+
}
|
|
3739
|
+
)
|
|
3740
|
+
]
|
|
3741
|
+
},
|
|
3742
|
+
option.value
|
|
3743
|
+
);
|
|
3744
|
+
})
|
|
3745
|
+
]
|
|
3746
|
+
}
|
|
3747
|
+
);
|
|
3748
|
+
};
|
|
3749
|
+
|
|
3750
|
+
// src/components/ProgressBar.tsx
|
|
3751
|
+
import { jsx as jsx100, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3516
3752
|
var ProgressBar = ({
|
|
3517
3753
|
value,
|
|
3518
3754
|
max = 100,
|
|
@@ -3534,15 +3770,15 @@ var ProgressBar = ({
|
|
|
3534
3770
|
warning: "bg-[hsl(var(--warning))]",
|
|
3535
3771
|
danger: "bg-[hsl(var(--destructive))]"
|
|
3536
3772
|
};
|
|
3537
|
-
return /* @__PURE__ */
|
|
3538
|
-
(showLabel || label) && /* @__PURE__ */
|
|
3539
|
-
label && /* @__PURE__ */
|
|
3540
|
-
showLabel && /* @__PURE__ */
|
|
3773
|
+
return /* @__PURE__ */ jsxs28("div", { className: `w-full ${className}`, children: [
|
|
3774
|
+
(showLabel || label) && /* @__PURE__ */ jsxs28("div", { className: "flex justify-between items-center mb-1", children: [
|
|
3775
|
+
label && /* @__PURE__ */ jsx100("span", { className: "text-sm font-medium text-[hsl(var(--foreground))]", children: label }),
|
|
3776
|
+
showLabel && /* @__PURE__ */ jsxs28("span", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
3541
3777
|
Math.round(percentage),
|
|
3542
3778
|
"%"
|
|
3543
3779
|
] })
|
|
3544
3780
|
] }),
|
|
3545
|
-
/* @__PURE__ */
|
|
3781
|
+
/* @__PURE__ */ jsx100(
|
|
3546
3782
|
"div",
|
|
3547
3783
|
{
|
|
3548
3784
|
className: `w-full bg-[hsl(var(--muted))] rounded-full overflow-hidden ${sizeClasses7[size]}`,
|
|
@@ -3550,7 +3786,7 @@ var ProgressBar = ({
|
|
|
3550
3786
|
"aria-valuenow": value,
|
|
3551
3787
|
"aria-valuemin": 0,
|
|
3552
3788
|
"aria-valuemax": max,
|
|
3553
|
-
children: /* @__PURE__ */
|
|
3789
|
+
children: /* @__PURE__ */ jsx100(
|
|
3554
3790
|
"div",
|
|
3555
3791
|
{
|
|
3556
3792
|
className: `${sizeClasses7[size]} ${variantClasses[variant]} rounded-full transition-all duration-300 ease-out`,
|
|
@@ -3563,8 +3799,8 @@ var ProgressBar = ({
|
|
|
3563
3799
|
};
|
|
3564
3800
|
|
|
3565
3801
|
// src/components/Slider.tsx
|
|
3566
|
-
import
|
|
3567
|
-
import { jsx as
|
|
3802
|
+
import React21, { useRef as useRef7 } from "react";
|
|
3803
|
+
import { jsx as jsx101, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3568
3804
|
var Slider = ({
|
|
3569
3805
|
value: controlledValue,
|
|
3570
3806
|
defaultValue = 50,
|
|
@@ -3581,10 +3817,10 @@ var Slider = ({
|
|
|
3581
3817
|
defaultRangeValue = [25, 75],
|
|
3582
3818
|
onRangeChange
|
|
3583
3819
|
}) => {
|
|
3584
|
-
const [internalValue, setInternalValue] =
|
|
3585
|
-
const [internalRangeValue, setInternalRangeValue] =
|
|
3586
|
-
const trackRef =
|
|
3587
|
-
const [isDragging, setIsDragging] =
|
|
3820
|
+
const [internalValue, setInternalValue] = React21.useState(defaultValue);
|
|
3821
|
+
const [internalRangeValue, setInternalRangeValue] = React21.useState(defaultRangeValue);
|
|
3822
|
+
const trackRef = useRef7(null);
|
|
3823
|
+
const [isDragging, setIsDragging] = React21.useState(null);
|
|
3588
3824
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
3589
3825
|
const rangeValue = controlledRangeValue !== void 0 ? controlledRangeValue : internalRangeValue;
|
|
3590
3826
|
const handleChange = (e) => {
|
|
@@ -3632,7 +3868,7 @@ var Slider = ({
|
|
|
3632
3868
|
const handleRangeEnd = () => {
|
|
3633
3869
|
setIsDragging(null);
|
|
3634
3870
|
};
|
|
3635
|
-
|
|
3871
|
+
React21.useEffect(() => {
|
|
3636
3872
|
if (isDragging) {
|
|
3637
3873
|
document.addEventListener("mousemove", handleRangeMouseMove);
|
|
3638
3874
|
document.addEventListener("mouseup", handleRangeEnd);
|
|
@@ -3650,18 +3886,18 @@ var Slider = ({
|
|
|
3650
3886
|
const minPercentage = (rangeValue[0] - min) / (max - min) * 100;
|
|
3651
3887
|
const maxPercentage = (rangeValue[1] - min) / (max - min) * 100;
|
|
3652
3888
|
if (range) {
|
|
3653
|
-
return /* @__PURE__ */
|
|
3654
|
-
(label || showValue) && /* @__PURE__ */
|
|
3655
|
-
label && /* @__PURE__ */
|
|
3656
|
-
showValue && /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsxs29("div", { className: `w-full ${className}`, children: [
|
|
3890
|
+
(label || showValue) && /* @__PURE__ */ jsxs29("div", { className: "flex justify-between items-center mb-2", children: [
|
|
3891
|
+
label && /* @__PURE__ */ jsx101("label", { className: "text-sm font-medium text-[hsl(var(--foreground))]", children: label }),
|
|
3892
|
+
showValue && /* @__PURE__ */ jsxs29("span", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
3657
3893
|
rangeValue[0],
|
|
3658
3894
|
" - ",
|
|
3659
3895
|
rangeValue[1]
|
|
3660
3896
|
] })
|
|
3661
3897
|
] }),
|
|
3662
|
-
/* @__PURE__ */
|
|
3663
|
-
/* @__PURE__ */
|
|
3664
|
-
/* @__PURE__ */
|
|
3898
|
+
/* @__PURE__ */ jsxs29("div", { className: "relative h-10 flex items-center", ref: trackRef, children: [
|
|
3899
|
+
/* @__PURE__ */ jsx101("div", { className: "absolute w-full h-2 bg-[hsl(var(--muted))] rounded-full" }),
|
|
3900
|
+
/* @__PURE__ */ jsx101(
|
|
3665
3901
|
"div",
|
|
3666
3902
|
{
|
|
3667
3903
|
className: "absolute h-2 bg-[hsl(var(--primary))] rounded-full pointer-events-none",
|
|
@@ -3671,7 +3907,7 @@ var Slider = ({
|
|
|
3671
3907
|
}
|
|
3672
3908
|
}
|
|
3673
3909
|
),
|
|
3674
|
-
/* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx101(
|
|
3675
3911
|
"div",
|
|
3676
3912
|
{
|
|
3677
3913
|
className: `absolute w-4 h-4 -ml-2 rounded-full bg-[hsl(var(--background))] border-2 border-[hsl(var(--primary))] shadow-md cursor-pointer z-10
|
|
@@ -3688,7 +3924,7 @@ var Slider = ({
|
|
|
3688
3924
|
tabIndex: disabled ? -1 : 0
|
|
3689
3925
|
}
|
|
3690
3926
|
),
|
|
3691
|
-
/* @__PURE__ */
|
|
3927
|
+
/* @__PURE__ */ jsx101(
|
|
3692
3928
|
"div",
|
|
3693
3929
|
{
|
|
3694
3930
|
className: `absolute w-4 h-4 -ml-2 rounded-full bg-[hsl(var(--background))] border-2 border-[hsl(var(--primary))] shadow-md cursor-pointer z-10
|
|
@@ -3708,21 +3944,21 @@ var Slider = ({
|
|
|
3708
3944
|
] })
|
|
3709
3945
|
] });
|
|
3710
3946
|
}
|
|
3711
|
-
return /* @__PURE__ */
|
|
3712
|
-
(label || showValue) && /* @__PURE__ */
|
|
3713
|
-
label && /* @__PURE__ */
|
|
3714
|
-
showValue && /* @__PURE__ */
|
|
3947
|
+
return /* @__PURE__ */ jsxs29("div", { className: `w-full ${className}`, children: [
|
|
3948
|
+
(label || showValue) && /* @__PURE__ */ jsxs29("div", { className: "flex justify-between items-center mb-2", children: [
|
|
3949
|
+
label && /* @__PURE__ */ jsx101("label", { className: "text-sm font-medium text-[hsl(var(--foreground))]", children: label }),
|
|
3950
|
+
showValue && /* @__PURE__ */ jsx101("span", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: value })
|
|
3715
3951
|
] }),
|
|
3716
|
-
/* @__PURE__ */
|
|
3717
|
-
/* @__PURE__ */
|
|
3718
|
-
/* @__PURE__ */
|
|
3952
|
+
/* @__PURE__ */ jsxs29("div", { className: "relative h-10 flex items-center", children: [
|
|
3953
|
+
/* @__PURE__ */ jsx101("div", { className: "absolute w-full h-2 bg-[hsl(var(--muted))] rounded-full" }),
|
|
3954
|
+
/* @__PURE__ */ jsx101(
|
|
3719
3955
|
"div",
|
|
3720
3956
|
{
|
|
3721
3957
|
className: "absolute h-2 bg-[hsl(var(--primary))] rounded-full pointer-events-none",
|
|
3722
3958
|
style: { width: `${percentage}%` }
|
|
3723
3959
|
}
|
|
3724
3960
|
),
|
|
3725
|
-
/* @__PURE__ */
|
|
3961
|
+
/* @__PURE__ */ jsx101(
|
|
3726
3962
|
"div",
|
|
3727
3963
|
{
|
|
3728
3964
|
className: `absolute w-4 h-4 -ml-2 rounded-full bg-[hsl(var(--background))] border-2 border-[hsl(var(--primary))] shadow-md pointer-events-none z-10
|
|
@@ -3731,7 +3967,7 @@ var Slider = ({
|
|
|
3731
3967
|
style: { left: `${percentage}%` }
|
|
3732
3968
|
}
|
|
3733
3969
|
),
|
|
3734
|
-
/* @__PURE__ */
|
|
3970
|
+
/* @__PURE__ */ jsx101(
|
|
3735
3971
|
"input",
|
|
3736
3972
|
{
|
|
3737
3973
|
type: "range",
|
|
@@ -3753,8 +3989,8 @@ var Slider = ({
|
|
|
3753
3989
|
};
|
|
3754
3990
|
|
|
3755
3991
|
// src/components/Avatar.tsx
|
|
3756
|
-
import
|
|
3757
|
-
import { jsx as
|
|
3992
|
+
import React22 from "react";
|
|
3993
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
3758
3994
|
var Avatar = ({
|
|
3759
3995
|
src,
|
|
3760
3996
|
alt,
|
|
@@ -3764,7 +4000,7 @@ var Avatar = ({
|
|
|
3764
4000
|
className = "",
|
|
3765
4001
|
fallbackColor = "bg-[hsl(var(--primary))]"
|
|
3766
4002
|
}) => {
|
|
3767
|
-
const [imageError, setImageError] =
|
|
4003
|
+
const [imageError, setImageError] = React22.useState(false);
|
|
3768
4004
|
const sizeClasses7 = {
|
|
3769
4005
|
xs: "w-6 h-6 text-xs",
|
|
3770
4006
|
sm: "w-8 h-8 text-sm",
|
|
@@ -3782,11 +4018,11 @@ var Avatar = ({
|
|
|
3782
4018
|
};
|
|
3783
4019
|
const showImage = src && !imageError;
|
|
3784
4020
|
const showInitials = !showImage && name;
|
|
3785
|
-
return /* @__PURE__ */
|
|
4021
|
+
return /* @__PURE__ */ jsx102(
|
|
3786
4022
|
"div",
|
|
3787
4023
|
{
|
|
3788
4024
|
className: `${sizeClasses7[size]} ${shapeClass} flex items-center justify-center overflow-hidden ${showImage ? "bg-[hsl(var(--muted))]" : `${fallbackColor} text-white`} ${className}`,
|
|
3789
|
-
children: showImage ? /* @__PURE__ */
|
|
4025
|
+
children: showImage ? /* @__PURE__ */ jsx102(
|
|
3790
4026
|
"img",
|
|
3791
4027
|
{
|
|
3792
4028
|
src,
|
|
@@ -3794,13 +4030,13 @@ var Avatar = ({
|
|
|
3794
4030
|
className: "w-full h-full object-cover",
|
|
3795
4031
|
onError: () => setImageError(true)
|
|
3796
4032
|
}
|
|
3797
|
-
) : showInitials ? /* @__PURE__ */
|
|
4033
|
+
) : showInitials ? /* @__PURE__ */ jsx102("span", { className: "font-semibold select-none", children: getInitials(name) }) : /* @__PURE__ */ jsx102(
|
|
3798
4034
|
"svg",
|
|
3799
4035
|
{
|
|
3800
4036
|
className: "w-full h-full text-[hsl(var(--muted-foreground))]",
|
|
3801
4037
|
fill: "currentColor",
|
|
3802
4038
|
viewBox: "0 0 24 24",
|
|
3803
|
-
children: /* @__PURE__ */
|
|
4039
|
+
children: /* @__PURE__ */ jsx102("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
|
|
3804
4040
|
}
|
|
3805
4041
|
)
|
|
3806
4042
|
}
|
|
@@ -3808,7 +4044,7 @@ var Avatar = ({
|
|
|
3808
4044
|
};
|
|
3809
4045
|
|
|
3810
4046
|
// src/components/Textarea.tsx
|
|
3811
|
-
import { jsx as
|
|
4047
|
+
import { jsx as jsx103, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3812
4048
|
var Textarea = ({
|
|
3813
4049
|
label,
|
|
3814
4050
|
error,
|
|
@@ -3835,9 +4071,9 @@ var Textarea = ({
|
|
|
3835
4071
|
bg-transparent text-[hsl(var(--foreground))]
|
|
3836
4072
|
placeholder:text-[hsl(var(--muted-foreground))]
|
|
3837
4073
|
disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-[hsl(var(--muted))]`;
|
|
3838
|
-
return /* @__PURE__ */
|
|
3839
|
-
label && /* @__PURE__ */
|
|
3840
|
-
/* @__PURE__ */
|
|
4074
|
+
return /* @__PURE__ */ jsxs30("div", { className: `w-full ${className}`, children: [
|
|
4075
|
+
label && /* @__PURE__ */ jsx103("label", { className: "block text-sm font-medium text-[hsl(var(--foreground))] mb-1.5", children: label }),
|
|
4076
|
+
/* @__PURE__ */ jsx103(
|
|
3841
4077
|
"textarea",
|
|
3842
4078
|
{
|
|
3843
4079
|
className: `${baseClasses} ${sizeClasses7[size]} ${resizeClasses[resize]}`,
|
|
@@ -3845,14 +4081,14 @@ var Textarea = ({
|
|
|
3845
4081
|
...props
|
|
3846
4082
|
}
|
|
3847
4083
|
),
|
|
3848
|
-
error && /* @__PURE__ */
|
|
3849
|
-
helperText && !error && /* @__PURE__ */
|
|
4084
|
+
error && /* @__PURE__ */ jsx103("p", { className: "mt-1.5 text-sm text-[hsl(var(--destructive))]", children: error }),
|
|
4085
|
+
helperText && !error && /* @__PURE__ */ jsx103("p", { className: "mt-1.5 text-sm text-[hsl(var(--muted-foreground))]", children: helperText })
|
|
3850
4086
|
] });
|
|
3851
4087
|
};
|
|
3852
4088
|
|
|
3853
4089
|
// src/components/RichTextEditor.tsx
|
|
3854
|
-
import { useRef as
|
|
3855
|
-
import { jsx as
|
|
4090
|
+
import { useRef as useRef8, useCallback as useCallback3, useState as useState14, useEffect as useEffect10, useLayoutEffect } from "react";
|
|
4091
|
+
import { jsx as jsx104, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3856
4092
|
var RichTextEditor = ({
|
|
3857
4093
|
value = "",
|
|
3858
4094
|
onChange,
|
|
@@ -3866,15 +4102,15 @@ var RichTextEditor = ({
|
|
|
3866
4102
|
helperText
|
|
3867
4103
|
}) => {
|
|
3868
4104
|
const { themeName } = useTheme();
|
|
3869
|
-
const editorRef =
|
|
3870
|
-
const [isFocused, setIsFocused] =
|
|
3871
|
-
const [activeFormats, setActiveFormats] =
|
|
3872
|
-
const [showLinkModal, setShowLinkModal] =
|
|
3873
|
-
const [linkUrl, setLinkUrl] =
|
|
3874
|
-
const [showImageModal, setShowImageModal] =
|
|
3875
|
-
const [imageUrl, setImageUrl] =
|
|
3876
|
-
const [imageAlt, setImageAlt] =
|
|
3877
|
-
const savedSelection =
|
|
4105
|
+
const editorRef = useRef8(null);
|
|
4106
|
+
const [isFocused, setIsFocused] = useState14(false);
|
|
4107
|
+
const [activeFormats, setActiveFormats] = useState14(/* @__PURE__ */ new Set());
|
|
4108
|
+
const [showLinkModal, setShowLinkModal] = useState14(false);
|
|
4109
|
+
const [linkUrl, setLinkUrl] = useState14("");
|
|
4110
|
+
const [showImageModal, setShowImageModal] = useState14(false);
|
|
4111
|
+
const [imageUrl, setImageUrl] = useState14("");
|
|
4112
|
+
const [imageAlt, setImageAlt] = useState14("");
|
|
4113
|
+
const savedSelection = useRef8(null);
|
|
3878
4114
|
useLayoutEffect(() => {
|
|
3879
4115
|
const styleId = "rich-text-editor-styles";
|
|
3880
4116
|
if (!document.getElementById(styleId)) {
|
|
@@ -3937,9 +4173,9 @@ var RichTextEditor = ({
|
|
|
3937
4173
|
document.head.appendChild(style);
|
|
3938
4174
|
}
|
|
3939
4175
|
}, []);
|
|
3940
|
-
const isInitialRender =
|
|
3941
|
-
const isInternalUpdate =
|
|
3942
|
-
|
|
4176
|
+
const isInitialRender = useRef8(true);
|
|
4177
|
+
const isInternalUpdate = useRef8(false);
|
|
4178
|
+
useEffect10(() => {
|
|
3943
4179
|
if (isInitialRender.current && editorRef.current) {
|
|
3944
4180
|
editorRef.current.innerHTML = value;
|
|
3945
4181
|
isInitialRender.current = false;
|
|
@@ -3950,7 +4186,7 @@ var RichTextEditor = ({
|
|
|
3950
4186
|
}
|
|
3951
4187
|
}
|
|
3952
4188
|
}, []);
|
|
3953
|
-
|
|
4189
|
+
useEffect10(() => {
|
|
3954
4190
|
if (!isInitialRender.current && !isInternalUpdate.current && editorRef.current) {
|
|
3955
4191
|
const currentHtml = editorRef.current.innerHTML;
|
|
3956
4192
|
if (currentHtml !== value) {
|
|
@@ -3993,7 +4229,7 @@ var RichTextEditor = ({
|
|
|
3993
4229
|
}
|
|
3994
4230
|
isInternalUpdate.current = false;
|
|
3995
4231
|
}, [value]);
|
|
3996
|
-
const updateActiveFormats =
|
|
4232
|
+
const updateActiveFormats = useCallback3(() => {
|
|
3997
4233
|
const formats = /* @__PURE__ */ new Set();
|
|
3998
4234
|
if (document.queryCommandState("bold")) formats.add("bold");
|
|
3999
4235
|
if (document.queryCommandState("italic")) formats.add("italic");
|
|
@@ -4010,14 +4246,14 @@ var RichTextEditor = ({
|
|
|
4010
4246
|
}
|
|
4011
4247
|
setActiveFormats(formats);
|
|
4012
4248
|
}, []);
|
|
4013
|
-
const handleInput =
|
|
4249
|
+
const handleInput = useCallback3(() => {
|
|
4014
4250
|
if (editorRef.current && onChange) {
|
|
4015
4251
|
isInternalUpdate.current = true;
|
|
4016
4252
|
onChange(editorRef.current.innerHTML);
|
|
4017
4253
|
}
|
|
4018
4254
|
updateActiveFormats();
|
|
4019
4255
|
}, [onChange, updateActiveFormats]);
|
|
4020
|
-
const handleFocus =
|
|
4256
|
+
const handleFocus = useCallback3(() => {
|
|
4021
4257
|
setIsFocused(true);
|
|
4022
4258
|
if (editorRef.current && (!editorRef.current.innerHTML || editorRef.current.innerHTML === "")) {
|
|
4023
4259
|
editorRef.current.innerHTML = "<p><br></p>";
|
|
@@ -4031,28 +4267,28 @@ var RichTextEditor = ({
|
|
|
4031
4267
|
}
|
|
4032
4268
|
}
|
|
4033
4269
|
}, []);
|
|
4034
|
-
const handleFormat =
|
|
4270
|
+
const handleFormat = useCallback3((command) => {
|
|
4035
4271
|
if (disabled) return;
|
|
4036
4272
|
document.execCommand(command, false);
|
|
4037
4273
|
editorRef.current?.focus();
|
|
4038
4274
|
updateActiveFormats();
|
|
4039
4275
|
handleInput();
|
|
4040
4276
|
}, [disabled, updateActiveFormats, handleInput]);
|
|
4041
|
-
const handleList =
|
|
4277
|
+
const handleList = useCallback3((command) => {
|
|
4042
4278
|
if (disabled) return;
|
|
4043
4279
|
document.execCommand(command, false);
|
|
4044
4280
|
editorRef.current?.focus();
|
|
4045
4281
|
updateActiveFormats();
|
|
4046
4282
|
handleInput();
|
|
4047
4283
|
}, [disabled, updateActiveFormats, handleInput]);
|
|
4048
|
-
const handleHeading =
|
|
4284
|
+
const handleHeading = useCallback3((level) => {
|
|
4049
4285
|
if (disabled) return;
|
|
4050
4286
|
document.execCommand("formatBlock", false, level);
|
|
4051
4287
|
editorRef.current?.focus();
|
|
4052
4288
|
updateActiveFormats();
|
|
4053
4289
|
handleInput();
|
|
4054
4290
|
}, [disabled, updateActiveFormats, handleInput]);
|
|
4055
|
-
const handleLink =
|
|
4291
|
+
const handleLink = useCallback3(() => {
|
|
4056
4292
|
if (disabled) return;
|
|
4057
4293
|
const selection = window.getSelection();
|
|
4058
4294
|
if (selection && selection.rangeCount > 0) {
|
|
@@ -4060,7 +4296,7 @@ var RichTextEditor = ({
|
|
|
4060
4296
|
}
|
|
4061
4297
|
setShowLinkModal(true);
|
|
4062
4298
|
}, [disabled]);
|
|
4063
|
-
const insertLink =
|
|
4299
|
+
const insertLink = useCallback3(() => {
|
|
4064
4300
|
if (!linkUrl || !editorRef.current) return;
|
|
4065
4301
|
const selection = window.getSelection();
|
|
4066
4302
|
if (savedSelection.current && selection) {
|
|
@@ -4078,7 +4314,7 @@ var RichTextEditor = ({
|
|
|
4078
4314
|
editorRef.current?.focus();
|
|
4079
4315
|
handleInput();
|
|
4080
4316
|
}, [linkUrl, handleInput]);
|
|
4081
|
-
const handleCode =
|
|
4317
|
+
const handleCode = useCallback3(() => {
|
|
4082
4318
|
if (disabled) return;
|
|
4083
4319
|
const selection = window.getSelection();
|
|
4084
4320
|
if (selection && selection.rangeCount > 0) {
|
|
@@ -4094,7 +4330,7 @@ var RichTextEditor = ({
|
|
|
4094
4330
|
}
|
|
4095
4331
|
editorRef.current?.focus();
|
|
4096
4332
|
}, [disabled, handleInput]);
|
|
4097
|
-
const handleImage =
|
|
4333
|
+
const handleImage = useCallback3(() => {
|
|
4098
4334
|
if (disabled) return;
|
|
4099
4335
|
const selection = window.getSelection();
|
|
4100
4336
|
if (selection && selection.rangeCount > 0) {
|
|
@@ -4102,7 +4338,7 @@ var RichTextEditor = ({
|
|
|
4102
4338
|
}
|
|
4103
4339
|
setShowImageModal(true);
|
|
4104
4340
|
}, [disabled]);
|
|
4105
|
-
const insertImage =
|
|
4341
|
+
const insertImage = useCallback3(() => {
|
|
4106
4342
|
if (!imageUrl || !editorRef.current) return;
|
|
4107
4343
|
editorRef.current.focus();
|
|
4108
4344
|
const img = document.createElement("img");
|
|
@@ -4182,11 +4418,11 @@ var RichTextEditor = ({
|
|
|
4182
4418
|
const editorBaseClass = themeName === "minimalistic" ? "bg-transparent border-2 border-white text-white placeholder:text-[hsl(var(--muted-foreground))]" : "bg-[hsl(var(--card))] border border-[hsl(var(--input))] text-[hsl(var(--foreground))]";
|
|
4183
4419
|
const focusClass = isFocused && !disabled ? themeName === "minimalistic" ? "border-white" : "border-[hsl(var(--primary))] ring-1 ring-[hsl(var(--ring))]/50" : "";
|
|
4184
4420
|
const errorClass = error ? "border-red-500 dark:border-red-400" : "";
|
|
4185
|
-
return /* @__PURE__ */
|
|
4186
|
-
label && /* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4188
|
-
/* @__PURE__ */
|
|
4189
|
-
/* @__PURE__ */
|
|
4421
|
+
return /* @__PURE__ */ jsxs31("div", { className: `w-full ${className}`, children: [
|
|
4422
|
+
label && /* @__PURE__ */ jsx104("label", { className: "block text-sm font-medium text-[hsl(var(--foreground))] mb-2", children: label }),
|
|
4423
|
+
/* @__PURE__ */ jsxs31("div", { className: `rounded-t-lg border-b ${editorBaseClass} p-2 flex flex-wrap gap-1`, children: [
|
|
4424
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
4425
|
+
/* @__PURE__ */ jsx104(
|
|
4190
4426
|
"button",
|
|
4191
4427
|
{
|
|
4192
4428
|
type: "button",
|
|
@@ -4194,10 +4430,10 @@ var RichTextEditor = ({
|
|
|
4194
4430
|
className: getButtonClass(activeFormats.has("bold")),
|
|
4195
4431
|
disabled,
|
|
4196
4432
|
title: "Bold (Ctrl+B)",
|
|
4197
|
-
children: /* @__PURE__ */
|
|
4433
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("path", { d: "M12.78 4c1.09 0 2.04.38 2.84 1.14.8.76 1.2 1.74 1.2 2.94 0 .9-.25 1.68-.76 2.36-.51.68-1.2 1.14-2.04 1.38v.08c1.06.22 1.89.7 2.48 1.44.59.74.88 1.64.88 2.7 0 1.34-.47 2.43-1.41 3.27C14.96 19.77 13.74 20 12.24 20H4V4h8.78zm-.66 7.14c.62 0 1.12-.18 1.5-.54.38-.36.57-.84.57-1.44 0-.6-.19-1.08-.57-1.44-.38-.36-.88-.54-1.5-.54H7.5v3.96h4.62zm.24 6.86c.68 0 1.24-.19 1.68-.57.44-.38.66-.9.66-1.56 0-.66-.22-1.18-.66-1.56-.44-.38-1-.57-1.68-.57H7.5v4.26h4.86z" }) })
|
|
4198
4434
|
}
|
|
4199
4435
|
),
|
|
4200
|
-
/* @__PURE__ */
|
|
4436
|
+
/* @__PURE__ */ jsx104(
|
|
4201
4437
|
"button",
|
|
4202
4438
|
{
|
|
4203
4439
|
type: "button",
|
|
@@ -4205,10 +4441,10 @@ var RichTextEditor = ({
|
|
|
4205
4441
|
className: getButtonClass(activeFormats.has("italic")),
|
|
4206
4442
|
disabled,
|
|
4207
4443
|
title: "Italic (Ctrl+I)",
|
|
4208
|
-
children: /* @__PURE__ */
|
|
4444
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("path", { d: "M11.59 4H16v2h-1.71l-3.58 8H13v2H8v-2h1.71l3.58-8H11.59V4z" }) })
|
|
4209
4445
|
}
|
|
4210
4446
|
),
|
|
4211
|
-
/* @__PURE__ */
|
|
4447
|
+
/* @__PURE__ */ jsx104(
|
|
4212
4448
|
"button",
|
|
4213
4449
|
{
|
|
4214
4450
|
type: "button",
|
|
@@ -4216,10 +4452,10 @@ var RichTextEditor = ({
|
|
|
4216
4452
|
className: getButtonClass(activeFormats.has("underline")),
|
|
4217
4453
|
disabled,
|
|
4218
4454
|
title: "Underline (Ctrl+U)",
|
|
4219
|
-
children: /* @__PURE__ */
|
|
4455
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("path", { d: "M10 16c-2.21 0-4-1.79-4-4V4h2v8c0 1.1.9 2 2 2s2-.9 2-2V4h2v8c0 2.21-1.79 4-4 4zM4 18h12v2H4v-2z" }) })
|
|
4220
4456
|
}
|
|
4221
4457
|
),
|
|
4222
|
-
/* @__PURE__ */
|
|
4458
|
+
/* @__PURE__ */ jsx104(
|
|
4223
4459
|
"button",
|
|
4224
4460
|
{
|
|
4225
4461
|
type: "button",
|
|
@@ -4227,13 +4463,13 @@ var RichTextEditor = ({
|
|
|
4227
4463
|
className: getButtonClass(activeFormats.has("strikeThrough")),
|
|
4228
4464
|
disabled,
|
|
4229
4465
|
title: "Strikethrough",
|
|
4230
|
-
children: /* @__PURE__ */
|
|
4466
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("path", { d: "M10 4c-2 0-3.5.5-4.5 1.5S4 7.5 4 9h2c0-.7.2-1.2.6-1.6.4-.4 1-.6 1.9-.6.8 0 1.4.2 1.8.5.4.3.7.8.7 1.4 0 .5-.2.9-.5 1.2-.3.3-.9.6-1.8.9l-.7.2c-1.2.3-2.1.7-2.7 1.2C4.2 12.7 4 13.5 4 14.5c0 1.1.4 2 1.1 2.6.7.6 1.7.9 3 .9 2.1 0 3.6-.5 4.6-1.5.9-1 1.3-2.3 1.3-3.8h-2c0 .9-.2 1.6-.7 2.1-.5.5-1.2.7-2.2.7-.8 0-1.4-.2-1.8-.5-.4-.3-.6-.8-.6-1.4 0-.5.2-.9.5-1.2.3-.3.9-.6 1.8-.9l.7-.2c1.2-.3 2.1-.7 2.7-1.2.6-.5.9-1.3.9-2.3 0-1.2-.4-2.1-1.2-2.8-.8-.7-1.9-1-3.3-1zM2 10h16v1H2v-1z" }) })
|
|
4231
4467
|
}
|
|
4232
4468
|
)
|
|
4233
4469
|
] }),
|
|
4234
|
-
/* @__PURE__ */
|
|
4235
|
-
/* @__PURE__ */
|
|
4236
|
-
/* @__PURE__ */
|
|
4470
|
+
/* @__PURE__ */ jsx104("div", { className: "w-px bg-[hsl(var(--border))] mx-1" }),
|
|
4471
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
4472
|
+
/* @__PURE__ */ jsx104(
|
|
4237
4473
|
"button",
|
|
4238
4474
|
{
|
|
4239
4475
|
type: "button",
|
|
@@ -4241,10 +4477,10 @@ var RichTextEditor = ({
|
|
|
4241
4477
|
className: getButtonClass(activeFormats.has("h1")),
|
|
4242
4478
|
disabled,
|
|
4243
4479
|
title: "Heading 1",
|
|
4244
|
-
children: /* @__PURE__ */
|
|
4480
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("text", { x: "2", y: "16", fontSize: "14", fontWeight: "bold", children: "H1" }) })
|
|
4245
4481
|
}
|
|
4246
4482
|
),
|
|
4247
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsx104(
|
|
4248
4484
|
"button",
|
|
4249
4485
|
{
|
|
4250
4486
|
type: "button",
|
|
@@ -4252,10 +4488,10 @@ var RichTextEditor = ({
|
|
|
4252
4488
|
className: getButtonClass(activeFormats.has("h2")),
|
|
4253
4489
|
disabled,
|
|
4254
4490
|
title: "Heading 2",
|
|
4255
|
-
children: /* @__PURE__ */
|
|
4491
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("text", { x: "2", y: "16", fontSize: "14", fontWeight: "bold", children: "H2" }) })
|
|
4256
4492
|
}
|
|
4257
4493
|
),
|
|
4258
|
-
/* @__PURE__ */
|
|
4494
|
+
/* @__PURE__ */ jsx104(
|
|
4259
4495
|
"button",
|
|
4260
4496
|
{
|
|
4261
4497
|
type: "button",
|
|
@@ -4263,13 +4499,13 @@ var RichTextEditor = ({
|
|
|
4263
4499
|
className: getButtonClass(activeFormats.has("h3")),
|
|
4264
4500
|
disabled,
|
|
4265
4501
|
title: "Heading 3",
|
|
4266
|
-
children: /* @__PURE__ */
|
|
4502
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("text", { x: "2", y: "16", fontSize: "14", fontWeight: "bold", children: "H3" }) })
|
|
4267
4503
|
}
|
|
4268
4504
|
)
|
|
4269
4505
|
] }),
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
/* @__PURE__ */
|
|
4272
|
-
/* @__PURE__ */
|
|
4506
|
+
/* @__PURE__ */ jsx104("div", { className: "w-px bg-[hsl(var(--border))] mx-1" }),
|
|
4507
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
4508
|
+
/* @__PURE__ */ jsx104(
|
|
4273
4509
|
"button",
|
|
4274
4510
|
{
|
|
4275
4511
|
type: "button",
|
|
@@ -4277,10 +4513,10 @@ var RichTextEditor = ({
|
|
|
4277
4513
|
className: getButtonClass(activeFormats.has("ul")),
|
|
4278
4514
|
disabled,
|
|
4279
4515
|
title: "Bullet List",
|
|
4280
|
-
children: /* @__PURE__ */
|
|
4516
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("path", { d: "M4 4h2v2H4V4zm4 0h8v2H8V4zM4 8h2v2H4V8zm4 0h8v2H8V8zm-4 4h2v2H4v-2zm4 0h8v2H8v-2zm-4 4h2v2H4v-2zm4 0h8v2H8v-2z" }) })
|
|
4281
4517
|
}
|
|
4282
4518
|
),
|
|
4283
|
-
/* @__PURE__ */
|
|
4519
|
+
/* @__PURE__ */ jsx104(
|
|
4284
4520
|
"button",
|
|
4285
4521
|
{
|
|
4286
4522
|
type: "button",
|
|
@@ -4288,13 +4524,13 @@ var RichTextEditor = ({
|
|
|
4288
4524
|
className: getButtonClass(activeFormats.has("ol")),
|
|
4289
4525
|
disabled,
|
|
4290
4526
|
title: "Numbered List",
|
|
4291
|
-
children: /* @__PURE__ */
|
|
4527
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx104("path", { d: "M4 4h1v3H4V4zm0 4h1v1H3V8h2v1H4zm1 2H3v1h2v1H3v1h2v-3zM8 4h8v2H8V4zm0 4h8v2H8V8zm0 4h8v2H8v-2zm0 4h8v2H8v-2z" }) })
|
|
4292
4528
|
}
|
|
4293
4529
|
)
|
|
4294
4530
|
] }),
|
|
4295
|
-
/* @__PURE__ */
|
|
4296
|
-
/* @__PURE__ */
|
|
4297
|
-
/* @__PURE__ */
|
|
4531
|
+
/* @__PURE__ */ jsx104("div", { className: "w-px bg-[hsl(var(--border))] mx-1" }),
|
|
4532
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
4533
|
+
/* @__PURE__ */ jsx104(
|
|
4298
4534
|
"button",
|
|
4299
4535
|
{
|
|
4300
4536
|
type: "button",
|
|
@@ -4302,10 +4538,10 @@ var RichTextEditor = ({
|
|
|
4302
4538
|
className: getButtonClass(false),
|
|
4303
4539
|
disabled,
|
|
4304
4540
|
title: "Insert Link",
|
|
4305
|
-
children: /* @__PURE__ */
|
|
4541
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx104("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1" }) })
|
|
4306
4542
|
}
|
|
4307
4543
|
),
|
|
4308
|
-
/* @__PURE__ */
|
|
4544
|
+
/* @__PURE__ */ jsx104(
|
|
4309
4545
|
"button",
|
|
4310
4546
|
{
|
|
4311
4547
|
type: "button",
|
|
@@ -4313,10 +4549,10 @@ var RichTextEditor = ({
|
|
|
4313
4549
|
className: getButtonClass(false),
|
|
4314
4550
|
disabled,
|
|
4315
4551
|
title: "Insert Image/Video",
|
|
4316
|
-
children: /* @__PURE__ */
|
|
4552
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx104("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) })
|
|
4317
4553
|
}
|
|
4318
4554
|
),
|
|
4319
|
-
/* @__PURE__ */
|
|
4555
|
+
/* @__PURE__ */ jsx104(
|
|
4320
4556
|
"button",
|
|
4321
4557
|
{
|
|
4322
4558
|
type: "button",
|
|
@@ -4324,12 +4560,12 @@ var RichTextEditor = ({
|
|
|
4324
4560
|
className: getButtonClass(false),
|
|
4325
4561
|
disabled,
|
|
4326
4562
|
title: "Code",
|
|
4327
|
-
children: /* @__PURE__ */
|
|
4563
|
+
children: /* @__PURE__ */ jsx104("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx104("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" }) })
|
|
4328
4564
|
}
|
|
4329
4565
|
)
|
|
4330
4566
|
] })
|
|
4331
4567
|
] }),
|
|
4332
|
-
/* @__PURE__ */
|
|
4568
|
+
/* @__PURE__ */ jsx104(
|
|
4333
4569
|
"div",
|
|
4334
4570
|
{
|
|
4335
4571
|
ref: editorRef,
|
|
@@ -4353,9 +4589,9 @@ var RichTextEditor = ({
|
|
|
4353
4589
|
suppressContentEditableWarning: true
|
|
4354
4590
|
}
|
|
4355
4591
|
),
|
|
4356
|
-
error && /* @__PURE__ */
|
|
4357
|
-
helperText && !error && /* @__PURE__ */
|
|
4358
|
-
/* @__PURE__ */
|
|
4592
|
+
error && /* @__PURE__ */ jsx104("p", { className: "mt-1 text-sm text-red-600 dark:text-red-400", children: error }),
|
|
4593
|
+
helperText && !error && /* @__PURE__ */ jsx104("p", { className: "mt-1 text-sm text-[hsl(var(--muted-foreground))]", children: helperText }),
|
|
4594
|
+
/* @__PURE__ */ jsx104(
|
|
4359
4595
|
Modal,
|
|
4360
4596
|
{
|
|
4361
4597
|
isOpen: showLinkModal,
|
|
@@ -4365,8 +4601,8 @@ var RichTextEditor = ({
|
|
|
4365
4601
|
},
|
|
4366
4602
|
title: "Insert Link",
|
|
4367
4603
|
size: "sm",
|
|
4368
|
-
children: /* @__PURE__ */
|
|
4369
|
-
/* @__PURE__ */
|
|
4604
|
+
children: /* @__PURE__ */ jsxs31("div", { className: "space-y-4", children: [
|
|
4605
|
+
/* @__PURE__ */ jsx104(
|
|
4370
4606
|
TextInput,
|
|
4371
4607
|
{
|
|
4372
4608
|
label: "URL",
|
|
@@ -4382,8 +4618,8 @@ var RichTextEditor = ({
|
|
|
4382
4618
|
}
|
|
4383
4619
|
}
|
|
4384
4620
|
),
|
|
4385
|
-
/* @__PURE__ */
|
|
4386
|
-
/* @__PURE__ */
|
|
4621
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-2 justify-end", children: [
|
|
4622
|
+
/* @__PURE__ */ jsx104(
|
|
4387
4623
|
Button,
|
|
4388
4624
|
{
|
|
4389
4625
|
variant: "secondary",
|
|
@@ -4394,7 +4630,7 @@ var RichTextEditor = ({
|
|
|
4394
4630
|
children: "Cancel"
|
|
4395
4631
|
}
|
|
4396
4632
|
),
|
|
4397
|
-
/* @__PURE__ */
|
|
4633
|
+
/* @__PURE__ */ jsx104(
|
|
4398
4634
|
Button,
|
|
4399
4635
|
{
|
|
4400
4636
|
variant: "primary",
|
|
@@ -4407,7 +4643,7 @@ var RichTextEditor = ({
|
|
|
4407
4643
|
] })
|
|
4408
4644
|
}
|
|
4409
4645
|
),
|
|
4410
|
-
/* @__PURE__ */
|
|
4646
|
+
/* @__PURE__ */ jsx104(
|
|
4411
4647
|
Modal,
|
|
4412
4648
|
{
|
|
4413
4649
|
isOpen: showImageModal,
|
|
@@ -4418,8 +4654,8 @@ var RichTextEditor = ({
|
|
|
4418
4654
|
},
|
|
4419
4655
|
title: "Insert Image",
|
|
4420
4656
|
size: "sm",
|
|
4421
|
-
children: /* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4657
|
+
children: /* @__PURE__ */ jsxs31("div", { className: "space-y-4", children: [
|
|
4658
|
+
/* @__PURE__ */ jsx104(
|
|
4423
4659
|
TextInput,
|
|
4424
4660
|
{
|
|
4425
4661
|
label: "Image URL",
|
|
@@ -4435,7 +4671,7 @@ var RichTextEditor = ({
|
|
|
4435
4671
|
}
|
|
4436
4672
|
}
|
|
4437
4673
|
),
|
|
4438
|
-
/* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsx104(
|
|
4439
4675
|
TextInput,
|
|
4440
4676
|
{
|
|
4441
4677
|
label: "Alt Text (optional)",
|
|
@@ -4444,8 +4680,8 @@ var RichTextEditor = ({
|
|
|
4444
4680
|
placeholder: "Describe the image"
|
|
4445
4681
|
}
|
|
4446
4682
|
),
|
|
4447
|
-
/* @__PURE__ */
|
|
4448
|
-
/* @__PURE__ */
|
|
4683
|
+
/* @__PURE__ */ jsxs31("div", { className: "flex gap-2 justify-end", children: [
|
|
4684
|
+
/* @__PURE__ */ jsx104(
|
|
4449
4685
|
Button,
|
|
4450
4686
|
{
|
|
4451
4687
|
variant: "secondary",
|
|
@@ -4457,7 +4693,7 @@ var RichTextEditor = ({
|
|
|
4457
4693
|
children: "Cancel"
|
|
4458
4694
|
}
|
|
4459
4695
|
),
|
|
4460
|
-
/* @__PURE__ */
|
|
4696
|
+
/* @__PURE__ */ jsx104(
|
|
4461
4697
|
Button,
|
|
4462
4698
|
{
|
|
4463
4699
|
variant: "primary",
|
|
@@ -4474,8 +4710,8 @@ var RichTextEditor = ({
|
|
|
4474
4710
|
};
|
|
4475
4711
|
|
|
4476
4712
|
// src/components/Toast.tsx
|
|
4477
|
-
import { createContext as createContext5, useContext as useContext5, useState as
|
|
4478
|
-
import { jsx as
|
|
4713
|
+
import { createContext as createContext5, useContext as useContext5, useState as useState15, useCallback as useCallback4 } from "react";
|
|
4714
|
+
import { jsx as jsx105, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
4479
4715
|
var ToastContext = createContext5(void 0);
|
|
4480
4716
|
var useToast = () => {
|
|
4481
4717
|
const context = useContext5(ToastContext);
|
|
@@ -4485,8 +4721,8 @@ var useToast = () => {
|
|
|
4485
4721
|
return context;
|
|
4486
4722
|
};
|
|
4487
4723
|
var ToastProvider = ({ children, position = "top-right" }) => {
|
|
4488
|
-
const [toasts, setToasts] =
|
|
4489
|
-
const addToast =
|
|
4724
|
+
const [toasts, setToasts] = useState15([]);
|
|
4725
|
+
const addToast = useCallback4((toast2) => {
|
|
4490
4726
|
const id = Math.random().toString(36).substring(7);
|
|
4491
4727
|
const newToast = { ...toast2, id };
|
|
4492
4728
|
setToasts((prev) => [...prev, newToast]);
|
|
@@ -4495,7 +4731,7 @@ var ToastProvider = ({ children, position = "top-right" }) => {
|
|
|
4495
4731
|
removeToast(id);
|
|
4496
4732
|
}, duration);
|
|
4497
4733
|
}, []);
|
|
4498
|
-
const removeToast =
|
|
4734
|
+
const removeToast = useCallback4((id) => {
|
|
4499
4735
|
setToasts((prev) => prev.filter((toast2) => toast2.id !== id));
|
|
4500
4736
|
}, []);
|
|
4501
4737
|
const positionClasses2 = {
|
|
@@ -4506,9 +4742,9 @@ var ToastProvider = ({ children, position = "top-right" }) => {
|
|
|
4506
4742
|
"top-center": "top-4 left-1/2 -translate-x-1/2",
|
|
4507
4743
|
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2"
|
|
4508
4744
|
};
|
|
4509
|
-
return /* @__PURE__ */
|
|
4745
|
+
return /* @__PURE__ */ jsxs32(ToastContext.Provider, { value: { toasts, addToast, removeToast }, children: [
|
|
4510
4746
|
children,
|
|
4511
|
-
/* @__PURE__ */
|
|
4747
|
+
/* @__PURE__ */ jsx105("div", { className: `fixed ${positionClasses2[position]} z-50 flex flex-col gap-2 max-w-md`, children: toasts.map((toast2) => /* @__PURE__ */ jsx105(ToastItem, { toast: toast2, onClose: () => removeToast(toast2.id) }, toast2.id)) })
|
|
4512
4748
|
] });
|
|
4513
4749
|
};
|
|
4514
4750
|
var ToastItem = ({ toast: toast2, onClose }) => {
|
|
@@ -4519,27 +4755,27 @@ var ToastItem = ({ toast: toast2, onClose }) => {
|
|
|
4519
4755
|
info: "bg-[hsl(var(--info))]/10 border-[hsl(var(--info))] text-[hsl(var(--info))]"
|
|
4520
4756
|
};
|
|
4521
4757
|
const typeIcons = {
|
|
4522
|
-
success: /* @__PURE__ */
|
|
4523
|
-
error: /* @__PURE__ */
|
|
4524
|
-
warning: /* @__PURE__ */
|
|
4525
|
-
info: /* @__PURE__ */
|
|
4758
|
+
success: /* @__PURE__ */ jsx105(CheckIcon, { size: "sm", className: "text-[hsl(var(--success))]" }),
|
|
4759
|
+
error: /* @__PURE__ */ jsx105(CloseIcon, { size: "sm", className: "text-[hsl(var(--destructive))]" }),
|
|
4760
|
+
warning: /* @__PURE__ */ jsx105("svg", { className: "w-4 h-4 text-[hsl(var(--warning))]", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx105("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }),
|
|
4761
|
+
info: /* @__PURE__ */ jsx105("svg", { className: "w-4 h-4 text-[hsl(var(--info))]", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx105("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) })
|
|
4526
4762
|
};
|
|
4527
4763
|
const type = toast2.type || "info";
|
|
4528
|
-
return /* @__PURE__ */
|
|
4764
|
+
return /* @__PURE__ */ jsxs32(
|
|
4529
4765
|
"div",
|
|
4530
4766
|
{
|
|
4531
4767
|
className: `flex items-start gap-3 p-4 rounded-md border-l-4 shadow-lg bg-[hsl(var(--card))] ${typeStyles[type]} animate-slide-in`,
|
|
4532
4768
|
role: "alert",
|
|
4533
4769
|
children: [
|
|
4534
|
-
/* @__PURE__ */
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4770
|
+
/* @__PURE__ */ jsx105("div", { className: "flex-shrink-0 mt-0.5", children: typeIcons[type] }),
|
|
4771
|
+
/* @__PURE__ */ jsx105("p", { className: "flex-1 text-sm font-medium text-[hsl(var(--foreground))]", children: toast2.message }),
|
|
4772
|
+
/* @__PURE__ */ jsx105(
|
|
4537
4773
|
"button",
|
|
4538
4774
|
{
|
|
4539
4775
|
onClick: onClose,
|
|
4540
4776
|
className: "flex-shrink-0 text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] transition-colors",
|
|
4541
4777
|
"aria-label": "Close",
|
|
4542
|
-
children: /* @__PURE__ */
|
|
4778
|
+
children: /* @__PURE__ */ jsx105(CloseIcon, { size: "sm" })
|
|
4543
4779
|
}
|
|
4544
4780
|
)
|
|
4545
4781
|
]
|
|
@@ -4570,8 +4806,8 @@ var toast = {
|
|
|
4570
4806
|
};
|
|
4571
4807
|
|
|
4572
4808
|
// src/components/Stepper.tsx
|
|
4573
|
-
import
|
|
4574
|
-
import { jsx as
|
|
4809
|
+
import React25 from "react";
|
|
4810
|
+
import { jsx as jsx106, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
4575
4811
|
var Stepper = ({
|
|
4576
4812
|
steps,
|
|
4577
4813
|
currentStep,
|
|
@@ -4591,8 +4827,8 @@ var Stepper = ({
|
|
|
4591
4827
|
return { mobile: mobileVisible, desktop: desktopVisible };
|
|
4592
4828
|
};
|
|
4593
4829
|
const shouldShowCounter = isHorizontal && steps.length > 3;
|
|
4594
|
-
return /* @__PURE__ */
|
|
4595
|
-
shouldShowCounter && /* @__PURE__ */
|
|
4830
|
+
return /* @__PURE__ */ jsxs33("div", { className: `${isHorizontal ? "flex items-start w-full" : "flex flex-col"} ${className}`, children: [
|
|
4831
|
+
shouldShowCounter && /* @__PURE__ */ jsx106("div", { className: "md:hidden flex items-center mr-4 flex-shrink-0", children: /* @__PURE__ */ jsxs33("span", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
4596
4832
|
currentStep,
|
|
4597
4833
|
"/",
|
|
4598
4834
|
steps.length
|
|
@@ -4605,19 +4841,19 @@ var Stepper = ({
|
|
|
4605
4841
|
const visibility = getStepVisibility(index);
|
|
4606
4842
|
const visibleMobileSteps = steps.filter((_, i) => getStepVisibility(i).mobile);
|
|
4607
4843
|
const isLastVisibleMobile = index === steps.map((_, i) => i).filter((i) => getStepVisibility(i).mobile).slice(-1)[0];
|
|
4608
|
-
return /* @__PURE__ */
|
|
4609
|
-
/* @__PURE__ */
|
|
4844
|
+
return /* @__PURE__ */ jsxs33(React25.Fragment, { children: [
|
|
4845
|
+
/* @__PURE__ */ jsxs33("div", { className: `
|
|
4610
4846
|
flex ${isHorizontal ? "flex-col items-center flex-shrink-0" : "flex-row items-start"}
|
|
4611
4847
|
${isHorizontal ? "" : isLast ? "" : "mb-6"}
|
|
4612
4848
|
${!visibility.mobile ? "hidden md:flex" : ""}
|
|
4613
4849
|
${!visibility.desktop && visibility.mobile ? "md:hidden" : ""}
|
|
4614
4850
|
`, children: [
|
|
4615
|
-
/* @__PURE__ */
|
|
4616
|
-
/* @__PURE__ */
|
|
4851
|
+
/* @__PURE__ */ jsxs33("div", { className: `flex ${isHorizontal ? "flex-col items-center" : "flex-col items-center flex-shrink-0"}`, children: [
|
|
4852
|
+
/* @__PURE__ */ jsx106(
|
|
4617
4853
|
"div",
|
|
4618
4854
|
{
|
|
4619
4855
|
className: `flex items-center justify-center w-10 h-10 rounded-full border-2 transition-all ${isCompleted ? "bg-[hsl(var(--primary))] border-[hsl(var(--primary))]" : isActive ? "border-[hsl(var(--primary))] bg-[hsl(var(--background))]" : "border-[hsl(var(--border))] bg-[hsl(var(--background))]"}`,
|
|
4620
|
-
children: isCompleted ? /* @__PURE__ */
|
|
4856
|
+
children: isCompleted ? /* @__PURE__ */ jsx106(CheckIcon, { size: "sm", className: "text-[hsl(var(--primary-foreground))]" }) : /* @__PURE__ */ jsx106(
|
|
4621
4857
|
"span",
|
|
4622
4858
|
{
|
|
4623
4859
|
className: `text-sm font-semibold ${isActive ? "text-[hsl(var(--primary))]" : "text-[hsl(var(--muted-foreground))]"}`,
|
|
@@ -4626,29 +4862,29 @@ var Stepper = ({
|
|
|
4626
4862
|
)
|
|
4627
4863
|
}
|
|
4628
4864
|
),
|
|
4629
|
-
!isLast && !isHorizontal && /* @__PURE__ */
|
|
4865
|
+
!isLast && !isHorizontal && /* @__PURE__ */ jsx106(
|
|
4630
4866
|
"div",
|
|
4631
4867
|
{
|
|
4632
4868
|
className: `w-0.5 flex-1 min-h-[24px] ${isCompleted ? "bg-[hsl(var(--primary))]" : "bg-[hsl(var(--border))]"}`
|
|
4633
4869
|
}
|
|
4634
4870
|
)
|
|
4635
4871
|
] }),
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4872
|
+
/* @__PURE__ */ jsxs33("div", { className: `${isHorizontal ? "mt-3 text-center" : "ml-4 flex-1 min-h-[40px] flex flex-col justify-center"}`, children: [
|
|
4873
|
+
/* @__PURE__ */ jsx106(
|
|
4638
4874
|
"p",
|
|
4639
4875
|
{
|
|
4640
4876
|
className: `text-sm font-medium whitespace-nowrap ${isActive || isCompleted ? "text-[hsl(var(--foreground))]" : "text-[hsl(var(--muted-foreground))]"}`,
|
|
4641
4877
|
children: step.label
|
|
4642
4878
|
}
|
|
4643
4879
|
),
|
|
4644
|
-
step.description && /* @__PURE__ */
|
|
4880
|
+
step.description && /* @__PURE__ */ jsx106("p", { className: "text-xs text-[hsl(var(--muted-foreground))] mt-1 whitespace-nowrap", children: step.description })
|
|
4645
4881
|
] })
|
|
4646
4882
|
] }),
|
|
4647
|
-
!isLast && isHorizontal && /* @__PURE__ */
|
|
4883
|
+
!isLast && isHorizontal && /* @__PURE__ */ jsx106("div", { className: `
|
|
4648
4884
|
flex items-start pt-5 mx-4 min-w-[80px] max-w-[200px] flex-1
|
|
4649
4885
|
${!visibility.mobile || isLastVisibleMobile ? "hidden md:flex" : ""}
|
|
4650
4886
|
${!visibility.desktop && visibility.mobile ? "md:hidden" : ""}
|
|
4651
|
-
`, children: /* @__PURE__ */
|
|
4887
|
+
`, children: /* @__PURE__ */ jsx106(
|
|
4652
4888
|
"div",
|
|
4653
4889
|
{
|
|
4654
4890
|
className: `h-0.5 w-full ${isCompleted ? "bg-[hsl(var(--primary))]" : "bg-[hsl(var(--border))]"}`
|
|
@@ -4660,7 +4896,7 @@ var Stepper = ({
|
|
|
4660
4896
|
};
|
|
4661
4897
|
|
|
4662
4898
|
// src/components/Divider.tsx
|
|
4663
|
-
import { jsx as
|
|
4899
|
+
import { jsx as jsx107, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4664
4900
|
var Divider = ({
|
|
4665
4901
|
orientation = "horizontal",
|
|
4666
4902
|
variant = "solid",
|
|
@@ -4679,14 +4915,14 @@ var Divider = ({
|
|
|
4679
4915
|
center: "justify-center",
|
|
4680
4916
|
right: "justify-end"
|
|
4681
4917
|
};
|
|
4682
|
-
return /* @__PURE__ */
|
|
4683
|
-
labelPosition !== "left" && /* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
labelPosition !== "right" && /* @__PURE__ */
|
|
4918
|
+
return /* @__PURE__ */ jsxs34("div", { className: `flex items-center ${alignmentClasses[labelPosition]} ${className}`, role: "separator", children: [
|
|
4919
|
+
labelPosition !== "left" && /* @__PURE__ */ jsx107("div", { className: `flex-1 border-t ${variantClasses[variant]} border-[hsl(var(--input))]` }),
|
|
4920
|
+
/* @__PURE__ */ jsx107("span", { className: "px-4 text-sm text-[hsl(var(--muted-foreground))]", children: label }),
|
|
4921
|
+
labelPosition !== "right" && /* @__PURE__ */ jsx107("div", { className: `flex-1 border-t ${variantClasses[variant]} border-[hsl(var(--input))]` })
|
|
4686
4922
|
] });
|
|
4687
4923
|
}
|
|
4688
4924
|
if (orientation === "vertical") {
|
|
4689
|
-
return /* @__PURE__ */
|
|
4925
|
+
return /* @__PURE__ */ jsx107(
|
|
4690
4926
|
"div",
|
|
4691
4927
|
{
|
|
4692
4928
|
className: `inline-block h-full border-l ${variantClasses[variant]} border-[hsl(var(--input))] ${className}`,
|
|
@@ -4695,7 +4931,7 @@ var Divider = ({
|
|
|
4695
4931
|
}
|
|
4696
4932
|
);
|
|
4697
4933
|
}
|
|
4698
|
-
return /* @__PURE__ */
|
|
4934
|
+
return /* @__PURE__ */ jsx107(
|
|
4699
4935
|
"hr",
|
|
4700
4936
|
{
|
|
4701
4937
|
className: `border-t ${variantClasses[variant]} border-[hsl(var(--input))] ${className}`,
|
|
@@ -4705,8 +4941,8 @@ var Divider = ({
|
|
|
4705
4941
|
};
|
|
4706
4942
|
|
|
4707
4943
|
// src/components/FileUpload.tsx
|
|
4708
|
-
import { useRef as
|
|
4709
|
-
import { jsx as
|
|
4944
|
+
import { useRef as useRef9, useState as useState16 } from "react";
|
|
4945
|
+
import { jsx as jsx108, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4710
4946
|
var FileUpload = ({
|
|
4711
4947
|
accept,
|
|
4712
4948
|
multiple = false,
|
|
@@ -4719,9 +4955,9 @@ var FileUpload = ({
|
|
|
4719
4955
|
label,
|
|
4720
4956
|
helperText
|
|
4721
4957
|
}) => {
|
|
4722
|
-
const [files, setFiles] =
|
|
4723
|
-
const [isDragging, setIsDragging] =
|
|
4724
|
-
const fileInputRef =
|
|
4958
|
+
const [files, setFiles] = useState16([]);
|
|
4959
|
+
const [isDragging, setIsDragging] = useState16(false);
|
|
4960
|
+
const fileInputRef = useRef9(null);
|
|
4725
4961
|
const formatFileSize = (bytes) => {
|
|
4726
4962
|
if (bytes === 0) return "0 Bytes";
|
|
4727
4963
|
const k = 1024;
|
|
@@ -4779,9 +5015,9 @@ var FileUpload = ({
|
|
|
4779
5015
|
setFiles(newFiles);
|
|
4780
5016
|
onChange?.(newFiles);
|
|
4781
5017
|
};
|
|
4782
|
-
return /* @__PURE__ */
|
|
4783
|
-
label && /* @__PURE__ */
|
|
4784
|
-
/* @__PURE__ */
|
|
5018
|
+
return /* @__PURE__ */ jsxs35("div", { className: `w-full ${className}`, children: [
|
|
5019
|
+
label && /* @__PURE__ */ jsx108("label", { className: "block text-sm font-medium text-[hsl(var(--foreground))] mb-2", children: label }),
|
|
5020
|
+
/* @__PURE__ */ jsxs35(
|
|
4785
5021
|
"div",
|
|
4786
5022
|
{
|
|
4787
5023
|
onDrop: handleDrop,
|
|
@@ -4790,7 +5026,7 @@ var FileUpload = ({
|
|
|
4790
5026
|
onClick: handleClick,
|
|
4791
5027
|
className: `relative border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-all ${isDragging ? "border-[hsl(var(--primary))] bg-[hsl(var(--primary))]/10" : "border-[hsl(var(--input))] hover:border-[hsl(var(--muted-foreground))]"} ${disabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
4792
5028
|
children: [
|
|
4793
|
-
/* @__PURE__ */
|
|
5029
|
+
/* @__PURE__ */ jsx108(
|
|
4794
5030
|
"input",
|
|
4795
5031
|
{
|
|
4796
5032
|
ref: fileInputRef,
|
|
@@ -4802,14 +5038,14 @@ var FileUpload = ({
|
|
|
4802
5038
|
className: "hidden"
|
|
4803
5039
|
}
|
|
4804
5040
|
),
|
|
4805
|
-
/* @__PURE__ */
|
|
4806
|
-
/* @__PURE__ */
|
|
4807
|
-
/* @__PURE__ */
|
|
4808
|
-
/* @__PURE__ */
|
|
4809
|
-
/* @__PURE__ */
|
|
5041
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex flex-col items-center gap-2", children: [
|
|
5042
|
+
/* @__PURE__ */ jsx108("div", { className: "w-12 h-12 rounded-full bg-[hsl(var(--muted))] flex items-center justify-center", children: /* @__PURE__ */ jsx108(UploadIcon, { size: "lg", className: "text-[hsl(var(--muted-foreground))]" }) }),
|
|
5043
|
+
/* @__PURE__ */ jsxs35("div", { children: [
|
|
5044
|
+
/* @__PURE__ */ jsxs35("p", { className: "text-sm font-medium text-[hsl(var(--foreground))]", children: [
|
|
5045
|
+
/* @__PURE__ */ jsx108("span", { className: "text-[hsl(var(--primary))]", children: "Click to upload" }),
|
|
4810
5046
|
" or drag and drop"
|
|
4811
5047
|
] }),
|
|
4812
|
-
/* @__PURE__ */
|
|
5048
|
+
/* @__PURE__ */ jsxs35("p", { className: "text-xs text-[hsl(var(--muted-foreground))] mt-1", children: [
|
|
4813
5049
|
accept ? `Accepted: ${accept}` : "Any file type",
|
|
4814
5050
|
maxSize && ` \u2022 Max size: ${formatFileSize(maxSize)}`
|
|
4815
5051
|
] })
|
|
@@ -4818,17 +5054,17 @@ var FileUpload = ({
|
|
|
4818
5054
|
]
|
|
4819
5055
|
}
|
|
4820
5056
|
),
|
|
4821
|
-
helperText && /* @__PURE__ */
|
|
4822
|
-
files.length > 0 && /* @__PURE__ */
|
|
5057
|
+
helperText && /* @__PURE__ */ jsx108("p", { className: "mt-2 text-sm text-[hsl(var(--muted-foreground))]", children: helperText }),
|
|
5058
|
+
files.length > 0 && /* @__PURE__ */ jsx108("div", { className: "mt-4 space-y-2", children: files.map((file, index) => /* @__PURE__ */ jsxs35(
|
|
4823
5059
|
"div",
|
|
4824
5060
|
{
|
|
4825
5061
|
className: "flex items-center justify-between p-3 bg-[hsl(var(--muted))] rounded-lg border border-[hsl(var(--border))]",
|
|
4826
5062
|
children: [
|
|
4827
|
-
/* @__PURE__ */
|
|
4828
|
-
/* @__PURE__ */
|
|
4829
|
-
/* @__PURE__ */
|
|
5063
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex-1 min-w-0", children: [
|
|
5064
|
+
/* @__PURE__ */ jsx108("p", { className: "text-sm font-medium text-[hsl(var(--foreground))] truncate", children: file.name }),
|
|
5065
|
+
/* @__PURE__ */ jsx108("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: formatFileSize(file.size) })
|
|
4830
5066
|
] }),
|
|
4831
|
-
/* @__PURE__ */
|
|
5067
|
+
/* @__PURE__ */ jsx108(
|
|
4832
5068
|
"button",
|
|
4833
5069
|
{
|
|
4834
5070
|
onClick: (e) => {
|
|
@@ -4837,7 +5073,7 @@ var FileUpload = ({
|
|
|
4837
5073
|
},
|
|
4838
5074
|
className: "ml-4 text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--destructive))] transition-colors",
|
|
4839
5075
|
"aria-label": "Remove file",
|
|
4840
|
-
children: /* @__PURE__ */
|
|
5076
|
+
children: /* @__PURE__ */ jsx108(CloseIcon, { size: "sm" })
|
|
4841
5077
|
}
|
|
4842
5078
|
)
|
|
4843
5079
|
]
|
|
@@ -4848,8 +5084,8 @@ var FileUpload = ({
|
|
|
4848
5084
|
};
|
|
4849
5085
|
|
|
4850
5086
|
// src/components/AudioPlayer.tsx
|
|
4851
|
-
import { useRef as
|
|
4852
|
-
import { jsx as
|
|
5087
|
+
import { useRef as useRef10, useState as useState17, useEffect as useEffect11 } from "react";
|
|
5088
|
+
import { jsx as jsx109, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4853
5089
|
var AudioPlayer = ({
|
|
4854
5090
|
src,
|
|
4855
5091
|
title,
|
|
@@ -4872,18 +5108,18 @@ var AudioPlayer = ({
|
|
|
4872
5108
|
showChapters = true,
|
|
4873
5109
|
onChapterChange
|
|
4874
5110
|
}) => {
|
|
4875
|
-
const audioRef =
|
|
4876
|
-
const [isPlaying, setIsPlaying] =
|
|
4877
|
-
const [currentTime, setCurrentTime] =
|
|
4878
|
-
const [duration, setDuration] =
|
|
4879
|
-
const [volume, setVolume] =
|
|
4880
|
-
const [isMuted, setIsMuted] =
|
|
4881
|
-
const [isLoading, setIsLoading] =
|
|
4882
|
-
const [currentChapter, setCurrentChapter] =
|
|
4883
|
-
const [showChapterList, setShowChapterList] =
|
|
4884
|
-
const [hoveredChapter, setHoveredChapter] =
|
|
4885
|
-
const [hoverPosition, setHoverPosition] =
|
|
4886
|
-
|
|
5111
|
+
const audioRef = useRef10(null);
|
|
5112
|
+
const [isPlaying, setIsPlaying] = useState17(false);
|
|
5113
|
+
const [currentTime, setCurrentTime] = useState17(0);
|
|
5114
|
+
const [duration, setDuration] = useState17(0);
|
|
5115
|
+
const [volume, setVolume] = useState17(1);
|
|
5116
|
+
const [isMuted, setIsMuted] = useState17(false);
|
|
5117
|
+
const [isLoading, setIsLoading] = useState17(true);
|
|
5118
|
+
const [currentChapter, setCurrentChapter] = useState17(null);
|
|
5119
|
+
const [showChapterList, setShowChapterList] = useState17(false);
|
|
5120
|
+
const [hoveredChapter, setHoveredChapter] = useState17(null);
|
|
5121
|
+
const [hoverPosition, setHoverPosition] = useState17({ x: 0, y: 0 });
|
|
5122
|
+
useEffect11(() => {
|
|
4887
5123
|
const audio = audioRef.current;
|
|
4888
5124
|
if (!audio) return;
|
|
4889
5125
|
const handleLoadedMetadata = () => {
|
|
@@ -4947,7 +5183,7 @@ var AudioPlayer = ({
|
|
|
4947
5183
|
audio.removeEventListener("error", handleError);
|
|
4948
5184
|
};
|
|
4949
5185
|
}, [onPlay, onPause, onEnded, onTimeUpdate]);
|
|
4950
|
-
|
|
5186
|
+
useEffect11(() => {
|
|
4951
5187
|
const audio = audioRef.current;
|
|
4952
5188
|
if (!audio) return;
|
|
4953
5189
|
audio.load();
|
|
@@ -5034,9 +5270,9 @@ var AudioPlayer = ({
|
|
|
5034
5270
|
};
|
|
5035
5271
|
const progress = duration > 0 ? currentTime / duration * 100 : 0;
|
|
5036
5272
|
if (variant === "mini") {
|
|
5037
|
-
return /* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5273
|
+
return /* @__PURE__ */ jsxs36("div", { className: `flex items-center gap-2 p-2 bg-[hsl(var(--card))] rounded-lg border border-[hsl(var(--border))] ${className}`, children: [
|
|
5274
|
+
/* @__PURE__ */ jsx109("audio", { ref: audioRef, src, preload, loop, autoPlay }),
|
|
5275
|
+
/* @__PURE__ */ jsx109(
|
|
5040
5276
|
Button,
|
|
5041
5277
|
{
|
|
5042
5278
|
iconOnly: true,
|
|
@@ -5045,16 +5281,16 @@ var AudioPlayer = ({
|
|
|
5045
5281
|
onClick: togglePlayPause,
|
|
5046
5282
|
disabled: isLoading,
|
|
5047
5283
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
5048
|
-
children: isPlaying ? /* @__PURE__ */
|
|
5284
|
+
children: isPlaying ? /* @__PURE__ */ jsx109(PauseIcon, { size: "sm" }) : /* @__PURE__ */ jsx109(PlayIcon, { size: "sm" })
|
|
5049
5285
|
}
|
|
5050
5286
|
),
|
|
5051
|
-
title && /* @__PURE__ */
|
|
5287
|
+
title && /* @__PURE__ */ jsx109("span", { className: "text-sm font-medium text-[hsl(var(--foreground))] truncate", children: title })
|
|
5052
5288
|
] });
|
|
5053
5289
|
}
|
|
5054
5290
|
if (variant === "compact") {
|
|
5055
|
-
return /* @__PURE__ */
|
|
5056
|
-
/* @__PURE__ */
|
|
5057
|
-
/* @__PURE__ */
|
|
5291
|
+
return /* @__PURE__ */ jsxs36("div", { className: `flex items-center gap-3 p-3 bg-[hsl(var(--card))] rounded-lg border border-[hsl(var(--border))] shadow-sm ${className}`, children: [
|
|
5292
|
+
/* @__PURE__ */ jsx109("audio", { ref: audioRef, src, preload, loop, autoPlay }),
|
|
5293
|
+
/* @__PURE__ */ jsx109(
|
|
5058
5294
|
Button,
|
|
5059
5295
|
{
|
|
5060
5296
|
iconOnly: true,
|
|
@@ -5063,17 +5299,17 @@ var AudioPlayer = ({
|
|
|
5063
5299
|
onClick: togglePlayPause,
|
|
5064
5300
|
disabled: isLoading,
|
|
5065
5301
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
5066
|
-
children: isPlaying ? /* @__PURE__ */
|
|
5302
|
+
children: isPlaying ? /* @__PURE__ */ jsx109(PauseIcon, { size: "md" }) : /* @__PURE__ */ jsx109(PlayIcon, { size: "md" })
|
|
5067
5303
|
}
|
|
5068
5304
|
),
|
|
5069
|
-
/* @__PURE__ */
|
|
5070
|
-
title && /* @__PURE__ */
|
|
5071
|
-
artist && /* @__PURE__ */
|
|
5305
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex-1 min-w-0", children: [
|
|
5306
|
+
title && /* @__PURE__ */ jsx109("div", { className: "text-sm font-medium text-[hsl(var(--foreground))] truncate", children: title }),
|
|
5307
|
+
artist && /* @__PURE__ */ jsx109("div", { className: "text-xs text-[hsl(var(--muted-foreground))] truncate", children: artist })
|
|
5072
5308
|
] }),
|
|
5073
|
-
/* @__PURE__ */
|
|
5074
|
-
/* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5076
|
-
/* @__PURE__ */
|
|
5309
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
5310
|
+
/* @__PURE__ */ jsx109("span", { className: "text-xs text-[hsl(var(--muted-foreground))] tabular-nums", children: formatTime(currentTime) }),
|
|
5311
|
+
/* @__PURE__ */ jsxs36("div", { className: "relative flex-1 h-1.5 bg-[hsl(var(--muted))] rounded-full overflow-visible", children: [
|
|
5312
|
+
/* @__PURE__ */ jsx109(
|
|
5077
5313
|
"div",
|
|
5078
5314
|
{
|
|
5079
5315
|
className: "absolute h-full bg-[hsl(var(--primary))] rounded-full transition-all",
|
|
@@ -5082,7 +5318,7 @@ var AudioPlayer = ({
|
|
|
5082
5318
|
),
|
|
5083
5319
|
showChapters && chapters.length > 0 && chapters.map((chapter, index) => {
|
|
5084
5320
|
const markerPosition = duration > 0 ? chapter.startTime / duration * 100 : 0;
|
|
5085
|
-
return /* @__PURE__ */
|
|
5321
|
+
return /* @__PURE__ */ jsx109(
|
|
5086
5322
|
"div",
|
|
5087
5323
|
{
|
|
5088
5324
|
className: "absolute top-0 bottom-0 w-1 -ml-0.5 bg-[hsl(var(--background))] opacity-70 hover:opacity-100 hover:w-1.5 hover:-ml-0.5 cursor-pointer z-10 transition-all",
|
|
@@ -5098,7 +5334,7 @@ var AudioPlayer = ({
|
|
|
5098
5334
|
index
|
|
5099
5335
|
);
|
|
5100
5336
|
}),
|
|
5101
|
-
/* @__PURE__ */
|
|
5337
|
+
/* @__PURE__ */ jsx109(
|
|
5102
5338
|
"input",
|
|
5103
5339
|
{
|
|
5104
5340
|
type: "range",
|
|
@@ -5112,23 +5348,23 @@ var AudioPlayer = ({
|
|
|
5112
5348
|
}
|
|
5113
5349
|
)
|
|
5114
5350
|
] }),
|
|
5115
|
-
/* @__PURE__ */
|
|
5116
|
-
currentChapter && showChapters && /* @__PURE__ */
|
|
5351
|
+
/* @__PURE__ */ jsx109("span", { className: "text-xs text-[hsl(var(--muted-foreground))] tabular-nums", children: formatTime(duration) }),
|
|
5352
|
+
currentChapter && showChapters && /* @__PURE__ */ jsxs36("span", { className: "text-xs text-[hsl(var(--primary))] font-medium truncate max-w-[120px]", children: [
|
|
5117
5353
|
"\u2022 ",
|
|
5118
5354
|
currentChapter.title
|
|
5119
5355
|
] })
|
|
5120
5356
|
] }),
|
|
5121
|
-
/* @__PURE__ */
|
|
5122
|
-
/* @__PURE__ */
|
|
5357
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
5358
|
+
/* @__PURE__ */ jsx109(
|
|
5123
5359
|
"button",
|
|
5124
5360
|
{
|
|
5125
5361
|
onClick: toggleMute,
|
|
5126
5362
|
className: "text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))]",
|
|
5127
5363
|
"aria-label": isMuted ? "Unmute" : "Mute",
|
|
5128
|
-
children: isMuted ? /* @__PURE__ */
|
|
5364
|
+
children: isMuted ? /* @__PURE__ */ jsx109(VolumeOffIcon, { size: "sm" }) : /* @__PURE__ */ jsx109(VolumeUpIcon, { size: "sm" })
|
|
5129
5365
|
}
|
|
5130
5366
|
),
|
|
5131
|
-
/* @__PURE__ */
|
|
5367
|
+
/* @__PURE__ */ jsx109(
|
|
5132
5368
|
"input",
|
|
5133
5369
|
{
|
|
5134
5370
|
type: "range",
|
|
@@ -5142,24 +5378,24 @@ var AudioPlayer = ({
|
|
|
5142
5378
|
}
|
|
5143
5379
|
)
|
|
5144
5380
|
] }),
|
|
5145
|
-
hoveredChapter && showChapters && /* @__PURE__ */
|
|
5381
|
+
hoveredChapter && showChapters && /* @__PURE__ */ jsxs36(
|
|
5146
5382
|
"div",
|
|
5147
5383
|
{
|
|
5148
5384
|
className: "fixed z-50 px-3 py-2 bg-[hsl(var(--popover))] text-white text-xs font-medium rounded shadow-lg pointer-events-none transform -translate-x-1/2 -translate-y-full",
|
|
5149
5385
|
style: { left: hoverPosition.x, top: hoverPosition.y - 8 },
|
|
5150
5386
|
children: [
|
|
5151
|
-
/* @__PURE__ */
|
|
5152
|
-
/* @__PURE__ */
|
|
5153
|
-
/* @__PURE__ */
|
|
5387
|
+
/* @__PURE__ */ jsx109("div", { className: "whitespace-nowrap", children: hoveredChapter.title }),
|
|
5388
|
+
/* @__PURE__ */ jsx109("div", { className: "text-[hsl(var(--muted-foreground))] text-[10px] mt-0.5", children: formatTime(hoveredChapter.startTime) }),
|
|
5389
|
+
/* @__PURE__ */ jsx109("div", { className: "absolute left-1/2 -bottom-1 w-2 h-2 bg-[hsl(var(--popover))] transform -translate-x-1/2 rotate-45" })
|
|
5154
5390
|
]
|
|
5155
5391
|
}
|
|
5156
5392
|
)
|
|
5157
5393
|
] });
|
|
5158
5394
|
}
|
|
5159
|
-
return /* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5161
|
-
/* @__PURE__ */
|
|
5162
|
-
coverArt && /* @__PURE__ */
|
|
5395
|
+
return /* @__PURE__ */ jsxs36("div", { className: `bg-[hsl(var(--card))] rounded-lg border border-[hsl(var(--border))] shadow-md overflow-hidden ${className}`, children: [
|
|
5396
|
+
/* @__PURE__ */ jsx109("audio", { ref: audioRef, src, preload, loop, autoPlay }),
|
|
5397
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-4 p-4 border-b border-[hsl(var(--border))]", children: [
|
|
5398
|
+
coverArt && /* @__PURE__ */ jsx109("div", { className: "w-16 h-16 flex-shrink-0 rounded-md overflow-hidden bg-[hsl(var(--muted))]", children: /* @__PURE__ */ jsx109(
|
|
5163
5399
|
"img",
|
|
5164
5400
|
{
|
|
5165
5401
|
src: coverArt,
|
|
@@ -5167,15 +5403,15 @@ var AudioPlayer = ({
|
|
|
5167
5403
|
className: "w-full h-full object-cover"
|
|
5168
5404
|
}
|
|
5169
5405
|
) }),
|
|
5170
|
-
/* @__PURE__ */
|
|
5171
|
-
title && /* @__PURE__ */
|
|
5172
|
-
artist && /* @__PURE__ */
|
|
5173
|
-
album && /* @__PURE__ */
|
|
5406
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex-1 min-w-0", children: [
|
|
5407
|
+
title && /* @__PURE__ */ jsx109("h3", { className: "text-base font-semibold text-[hsl(var(--foreground))] truncate", children: title }),
|
|
5408
|
+
artist && /* @__PURE__ */ jsx109("p", { className: "text-sm text-[hsl(var(--muted-foreground))] truncate", children: artist }),
|
|
5409
|
+
album && /* @__PURE__ */ jsx109("p", { className: "text-xs text-[hsl(var(--muted-foreground))] truncate", children: album })
|
|
5174
5410
|
] })
|
|
5175
5411
|
] }),
|
|
5176
|
-
/* @__PURE__ */
|
|
5177
|
-
/* @__PURE__ */
|
|
5178
|
-
/* @__PURE__ */
|
|
5412
|
+
/* @__PURE__ */ jsxs36("div", { className: "px-4 pt-4", children: [
|
|
5413
|
+
/* @__PURE__ */ jsxs36("div", { className: "relative h-2 bg-[hsl(var(--muted))] rounded-full overflow-visible", children: [
|
|
5414
|
+
/* @__PURE__ */ jsx109(
|
|
5179
5415
|
"div",
|
|
5180
5416
|
{
|
|
5181
5417
|
className: "absolute h-full bg-[hsl(var(--primary))] rounded-full transition-all",
|
|
@@ -5184,7 +5420,7 @@ var AudioPlayer = ({
|
|
|
5184
5420
|
),
|
|
5185
5421
|
showChapters && chapters.length > 0 && chapters.map((chapter, index) => {
|
|
5186
5422
|
const markerPosition = duration > 0 ? chapter.startTime / duration * 100 : 0;
|
|
5187
|
-
return /* @__PURE__ */
|
|
5423
|
+
return /* @__PURE__ */ jsx109(
|
|
5188
5424
|
"div",
|
|
5189
5425
|
{
|
|
5190
5426
|
className: "absolute top-0 bottom-0 w-1 -ml-0.5 bg-[hsl(var(--background))] opacity-70 hover:opacity-100 hover:w-1.5 hover:-ml-0.5 cursor-pointer z-10 transition-all",
|
|
@@ -5200,19 +5436,19 @@ var AudioPlayer = ({
|
|
|
5200
5436
|
index
|
|
5201
5437
|
);
|
|
5202
5438
|
}),
|
|
5203
|
-
hoveredChapter && showChapters && /* @__PURE__ */
|
|
5439
|
+
hoveredChapter && showChapters && /* @__PURE__ */ jsxs36(
|
|
5204
5440
|
"div",
|
|
5205
5441
|
{
|
|
5206
5442
|
className: "fixed z-50 px-3 py-2 bg-[hsl(var(--popover))] text-white text-xs font-medium rounded shadow-lg pointer-events-none transform -translate-x-1/2 -translate-y-full",
|
|
5207
5443
|
style: { left: hoverPosition.x, top: hoverPosition.y - 8 },
|
|
5208
5444
|
children: [
|
|
5209
|
-
/* @__PURE__ */
|
|
5210
|
-
/* @__PURE__ */
|
|
5211
|
-
/* @__PURE__ */
|
|
5445
|
+
/* @__PURE__ */ jsx109("div", { className: "whitespace-nowrap", children: hoveredChapter.title }),
|
|
5446
|
+
/* @__PURE__ */ jsx109("div", { className: "text-[hsl(var(--muted-foreground))] text-[10px] mt-0.5", children: formatTime(hoveredChapter.startTime) }),
|
|
5447
|
+
/* @__PURE__ */ jsx109("div", { className: "absolute left-1/2 -bottom-1 w-2 h-2 bg-[hsl(var(--popover))] transform -translate-x-1/2 rotate-45" })
|
|
5212
5448
|
]
|
|
5213
5449
|
}
|
|
5214
5450
|
),
|
|
5215
|
-
/* @__PURE__ */
|
|
5451
|
+
/* @__PURE__ */ jsx109(
|
|
5216
5452
|
"input",
|
|
5217
5453
|
{
|
|
5218
5454
|
type: "range",
|
|
@@ -5226,24 +5462,24 @@ var AudioPlayer = ({
|
|
|
5226
5462
|
}
|
|
5227
5463
|
)
|
|
5228
5464
|
] }),
|
|
5229
|
-
/* @__PURE__ */
|
|
5230
|
-
/* @__PURE__ */
|
|
5231
|
-
currentChapter && showChapters && /* @__PURE__ */
|
|
5232
|
-
/* @__PURE__ */
|
|
5465
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex justify-between items-center mt-1 text-xs text-[hsl(var(--muted-foreground))] tabular-nums", children: [
|
|
5466
|
+
/* @__PURE__ */ jsx109("span", { children: formatTime(currentTime) }),
|
|
5467
|
+
currentChapter && showChapters && /* @__PURE__ */ jsx109("span", { className: "text-[hsl(var(--primary))] font-medium truncate max-w-[200px]", children: currentChapter.title }),
|
|
5468
|
+
/* @__PURE__ */ jsx109("span", { children: formatTime(duration) })
|
|
5233
5469
|
] })
|
|
5234
5470
|
] }),
|
|
5235
|
-
/* @__PURE__ */
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
/* @__PURE__ */
|
|
5471
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
5472
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2 flex-1", children: [
|
|
5473
|
+
/* @__PURE__ */ jsx109(
|
|
5238
5474
|
"button",
|
|
5239
5475
|
{
|
|
5240
5476
|
onClick: toggleMute,
|
|
5241
5477
|
className: "text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] transition-colors",
|
|
5242
5478
|
"aria-label": isMuted ? "Unmute" : "Mute",
|
|
5243
|
-
children: isMuted ? /* @__PURE__ */
|
|
5479
|
+
children: isMuted ? /* @__PURE__ */ jsx109(VolumeOffIcon, { size: "md" }) : /* @__PURE__ */ jsx109(VolumeUpIcon, { size: "md" })
|
|
5244
5480
|
}
|
|
5245
5481
|
),
|
|
5246
|
-
/* @__PURE__ */
|
|
5482
|
+
/* @__PURE__ */ jsx109(
|
|
5247
5483
|
"input",
|
|
5248
5484
|
{
|
|
5249
5485
|
type: "range",
|
|
@@ -5257,8 +5493,8 @@ var AudioPlayer = ({
|
|
|
5257
5493
|
}
|
|
5258
5494
|
)
|
|
5259
5495
|
] }),
|
|
5260
|
-
/* @__PURE__ */
|
|
5261
|
-
showSkipButtons && /* @__PURE__ */
|
|
5496
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2", children: [
|
|
5497
|
+
showSkipButtons && /* @__PURE__ */ jsx109(
|
|
5262
5498
|
Button,
|
|
5263
5499
|
{
|
|
5264
5500
|
iconOnly: true,
|
|
@@ -5267,10 +5503,10 @@ var AudioPlayer = ({
|
|
|
5267
5503
|
onClick: handleSkipBack,
|
|
5268
5504
|
disabled: isLoading,
|
|
5269
5505
|
"aria-label": "Skip back 10 seconds",
|
|
5270
|
-
children: /* @__PURE__ */
|
|
5506
|
+
children: /* @__PURE__ */ jsx109(SkipBackIcon, { size: "md" })
|
|
5271
5507
|
}
|
|
5272
5508
|
),
|
|
5273
|
-
/* @__PURE__ */
|
|
5509
|
+
/* @__PURE__ */ jsx109(
|
|
5274
5510
|
Button,
|
|
5275
5511
|
{
|
|
5276
5512
|
iconOnly: true,
|
|
@@ -5279,10 +5515,10 @@ var AudioPlayer = ({
|
|
|
5279
5515
|
onClick: togglePlayPause,
|
|
5280
5516
|
disabled: isLoading,
|
|
5281
5517
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
5282
|
-
children: isPlaying ? /* @__PURE__ */
|
|
5518
|
+
children: isPlaying ? /* @__PURE__ */ jsx109(PauseIcon, { size: "lg" }) : /* @__PURE__ */ jsx109(PlayIcon, { size: "lg" })
|
|
5283
5519
|
}
|
|
5284
5520
|
),
|
|
5285
|
-
showSkipButtons && /* @__PURE__ */
|
|
5521
|
+
showSkipButtons && /* @__PURE__ */ jsx109(
|
|
5286
5522
|
Button,
|
|
5287
5523
|
{
|
|
5288
5524
|
iconOnly: true,
|
|
@@ -5291,11 +5527,11 @@ var AudioPlayer = ({
|
|
|
5291
5527
|
onClick: handleSkipForward,
|
|
5292
5528
|
disabled: isLoading,
|
|
5293
5529
|
"aria-label": "Skip forward 10 seconds",
|
|
5294
|
-
children: /* @__PURE__ */
|
|
5530
|
+
children: /* @__PURE__ */ jsx109(SkipForwardIcon, { size: "md" })
|
|
5295
5531
|
}
|
|
5296
5532
|
)
|
|
5297
5533
|
] }),
|
|
5298
|
-
/* @__PURE__ */
|
|
5534
|
+
/* @__PURE__ */ jsx109("div", { className: "flex-1 flex justify-end", children: showChapters && chapters.length > 0 && /* @__PURE__ */ jsxs36(
|
|
5299
5535
|
"button",
|
|
5300
5536
|
{
|
|
5301
5537
|
onClick: () => setShowChapterList(!showChapterList),
|
|
@@ -5309,16 +5545,16 @@ var AudioPlayer = ({
|
|
|
5309
5545
|
}
|
|
5310
5546
|
) })
|
|
5311
5547
|
] }),
|
|
5312
|
-
showChapters && showChapterList && chapters.length > 0 && /* @__PURE__ */
|
|
5548
|
+
showChapters && showChapterList && chapters.length > 0 && /* @__PURE__ */ jsx109("div", { className: "border-t border-[hsl(var(--border))] bg-[hsl(var(--muted))]/50 max-h-48 overflow-y-auto", children: chapters.map((chapter, index) => {
|
|
5313
5549
|
const isCurrentChapter = currentChapter?.startTime === chapter.startTime;
|
|
5314
|
-
return /* @__PURE__ */
|
|
5550
|
+
return /* @__PURE__ */ jsx109(
|
|
5315
5551
|
"button",
|
|
5316
5552
|
{
|
|
5317
5553
|
onClick: () => jumpToChapter(chapter),
|
|
5318
5554
|
className: `w-full text-left px-4 py-2 hover:bg-[hsl(var(--accent))] transition-colors ${isCurrentChapter ? "bg-[hsl(var(--primary))]/10 border-l-2 border-[hsl(var(--primary))]" : ""}`,
|
|
5319
|
-
children: /* @__PURE__ */
|
|
5320
|
-
/* @__PURE__ */
|
|
5321
|
-
/* @__PURE__ */
|
|
5555
|
+
children: /* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5556
|
+
/* @__PURE__ */ jsx109("span", { className: `text-sm font-medium ${isCurrentChapter ? "text-[hsl(var(--primary))]" : "text-[hsl(var(--foreground))]"}`, children: chapter.title }),
|
|
5557
|
+
/* @__PURE__ */ jsx109("span", { className: "text-xs text-[hsl(var(--muted-foreground))] tabular-nums", children: formatTime(chapter.startTime) })
|
|
5322
5558
|
] })
|
|
5323
5559
|
},
|
|
5324
5560
|
index
|
|
@@ -5328,8 +5564,8 @@ var AudioPlayer = ({
|
|
|
5328
5564
|
};
|
|
5329
5565
|
|
|
5330
5566
|
// src/components/VideoPlayer.tsx
|
|
5331
|
-
import { useRef as
|
|
5332
|
-
import { jsx as
|
|
5567
|
+
import { useRef as useRef11, useState as useState18, useEffect as useEffect12 } from "react";
|
|
5568
|
+
import { jsx as jsx110, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
5333
5569
|
var VideoPlayer = ({
|
|
5334
5570
|
src,
|
|
5335
5571
|
poster,
|
|
@@ -5353,21 +5589,21 @@ var VideoPlayer = ({
|
|
|
5353
5589
|
showChapters = true,
|
|
5354
5590
|
onChapterChange
|
|
5355
5591
|
}) => {
|
|
5356
|
-
const videoRef =
|
|
5357
|
-
const containerRef =
|
|
5358
|
-
const [isPlaying, setIsPlaying] =
|
|
5359
|
-
const [currentTime, setCurrentTime] =
|
|
5360
|
-
const [duration, setDuration] =
|
|
5361
|
-
const [volume, setVolume] =
|
|
5362
|
-
const [isMuted, setIsMuted] =
|
|
5363
|
-
const [isLoading, setIsLoading] =
|
|
5364
|
-
const [isFullscreen, setIsFullscreen] =
|
|
5365
|
-
const [showControlsOverlay, setShowControlsOverlay] =
|
|
5366
|
-
const hideControlsTimeout =
|
|
5367
|
-
const [currentChapter, setCurrentChapter] =
|
|
5368
|
-
const [hoveredChapter, setHoveredChapter] =
|
|
5369
|
-
const [hoverPosition, setHoverPosition] =
|
|
5370
|
-
|
|
5592
|
+
const videoRef = useRef11(null);
|
|
5593
|
+
const containerRef = useRef11(null);
|
|
5594
|
+
const [isPlaying, setIsPlaying] = useState18(false);
|
|
5595
|
+
const [currentTime, setCurrentTime] = useState18(0);
|
|
5596
|
+
const [duration, setDuration] = useState18(0);
|
|
5597
|
+
const [volume, setVolume] = useState18(muted ? 0 : 1);
|
|
5598
|
+
const [isMuted, setIsMuted] = useState18(muted);
|
|
5599
|
+
const [isLoading, setIsLoading] = useState18(true);
|
|
5600
|
+
const [isFullscreen, setIsFullscreen] = useState18(false);
|
|
5601
|
+
const [showControlsOverlay, setShowControlsOverlay] = useState18(true);
|
|
5602
|
+
const hideControlsTimeout = useRef11(null);
|
|
5603
|
+
const [currentChapter, setCurrentChapter] = useState18(null);
|
|
5604
|
+
const [hoveredChapter, setHoveredChapter] = useState18(null);
|
|
5605
|
+
const [hoverPosition, setHoverPosition] = useState18({ x: 0, y: 0 });
|
|
5606
|
+
useEffect12(() => {
|
|
5371
5607
|
const video = videoRef.current;
|
|
5372
5608
|
if (!video) return;
|
|
5373
5609
|
const handleLoadedMetadata = () => {
|
|
@@ -5436,12 +5672,12 @@ var VideoPlayer = ({
|
|
|
5436
5672
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
5437
5673
|
};
|
|
5438
5674
|
}, [onPlay, onPause, onEnded, onTimeUpdate]);
|
|
5439
|
-
|
|
5675
|
+
useEffect12(() => {
|
|
5440
5676
|
const video = videoRef.current;
|
|
5441
5677
|
if (!video) return;
|
|
5442
5678
|
video.load();
|
|
5443
5679
|
}, [src]);
|
|
5444
|
-
|
|
5680
|
+
useEffect12(() => {
|
|
5445
5681
|
if (!isPlaying) {
|
|
5446
5682
|
setShowControlsOverlay(true);
|
|
5447
5683
|
return;
|
|
@@ -5557,7 +5793,7 @@ var VideoPlayer = ({
|
|
|
5557
5793
|
}
|
|
5558
5794
|
};
|
|
5559
5795
|
if (variant === "compact") {
|
|
5560
|
-
return /* @__PURE__ */
|
|
5796
|
+
return /* @__PURE__ */ jsxs37(
|
|
5561
5797
|
"div",
|
|
5562
5798
|
{
|
|
5563
5799
|
ref: containerRef,
|
|
@@ -5565,7 +5801,7 @@ var VideoPlayer = ({
|
|
|
5565
5801
|
style: { width, height },
|
|
5566
5802
|
onMouseMove: handleMouseMove,
|
|
5567
5803
|
children: [
|
|
5568
|
-
/* @__PURE__ */
|
|
5804
|
+
/* @__PURE__ */ jsx110(
|
|
5569
5805
|
"video",
|
|
5570
5806
|
{
|
|
5571
5807
|
ref: videoRef,
|
|
@@ -5579,8 +5815,8 @@ var VideoPlayer = ({
|
|
|
5579
5815
|
onClick: togglePlayPause
|
|
5580
5816
|
}
|
|
5581
5817
|
),
|
|
5582
|
-
showControls && /* @__PURE__ */
|
|
5583
|
-
/* @__PURE__ */
|
|
5818
|
+
showControls && /* @__PURE__ */ jsxs37("div", { className: `absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent transition-opacity duration-300 ${showControlsOverlay || !isPlaying ? "opacity-100" : "opacity-0 pointer-events-none"}`, children: [
|
|
5819
|
+
/* @__PURE__ */ jsx110("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx110(
|
|
5584
5820
|
"button",
|
|
5585
5821
|
{
|
|
5586
5822
|
onClick: togglePlayPause,
|
|
@@ -5588,12 +5824,12 @@ var VideoPlayer = ({
|
|
|
5588
5824
|
className: "flex items-center justify-center w-16 h-16 rounded-full bg-white/20 hover:bg-white/30 backdrop-blur-sm text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed",
|
|
5589
5825
|
style: { width: 64, height: 64, borderRadius: "50%" },
|
|
5590
5826
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
5591
|
-
children: isPlaying ? /* @__PURE__ */
|
|
5827
|
+
children: isPlaying ? /* @__PURE__ */ jsx110(PauseIcon, { size: "xl" }) : /* @__PURE__ */ jsx110(PlayIcon, { size: "xl" })
|
|
5592
5828
|
}
|
|
5593
5829
|
) }),
|
|
5594
|
-
/* @__PURE__ */
|
|
5595
|
-
/* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
5830
|
+
/* @__PURE__ */ jsxs37("div", { className: "absolute bottom-0 left-0 right-0 p-3 space-y-2", children: [
|
|
5831
|
+
/* @__PURE__ */ jsxs37("div", { className: "relative h-1 bg-white/30 rounded-full overflow-visible", children: [
|
|
5832
|
+
/* @__PURE__ */ jsx110(
|
|
5597
5833
|
"div",
|
|
5598
5834
|
{
|
|
5599
5835
|
className: "absolute h-full bg-[hsl(var(--primary))] rounded-full transition-all",
|
|
@@ -5602,7 +5838,7 @@ var VideoPlayer = ({
|
|
|
5602
5838
|
),
|
|
5603
5839
|
showChapters && chapters.length > 0 && chapters.map((chapter, index) => {
|
|
5604
5840
|
const markerPosition = duration > 0 ? chapter.startTime / duration * 100 : 0;
|
|
5605
|
-
return /* @__PURE__ */
|
|
5841
|
+
return /* @__PURE__ */ jsx110(
|
|
5606
5842
|
"div",
|
|
5607
5843
|
{
|
|
5608
5844
|
className: "absolute top-0 bottom-0 w-1 -ml-0.5 bg-white opacity-70 hover:opacity-100 hover:w-1.5 hover:-ml-0.5 cursor-pointer z-10 transition-all",
|
|
@@ -5618,7 +5854,7 @@ var VideoPlayer = ({
|
|
|
5618
5854
|
index
|
|
5619
5855
|
);
|
|
5620
5856
|
}),
|
|
5621
|
-
/* @__PURE__ */
|
|
5857
|
+
/* @__PURE__ */ jsx110(
|
|
5622
5858
|
"input",
|
|
5623
5859
|
{
|
|
5624
5860
|
type: "range",
|
|
@@ -5632,50 +5868,50 @@ var VideoPlayer = ({
|
|
|
5632
5868
|
}
|
|
5633
5869
|
)
|
|
5634
5870
|
] }),
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5637
|
-
/* @__PURE__ */
|
|
5871
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5872
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
5873
|
+
/* @__PURE__ */ jsxs37("span", { className: "text-xs text-white tabular-nums", children: [
|
|
5638
5874
|
formatTime(currentTime),
|
|
5639
5875
|
" / ",
|
|
5640
5876
|
formatTime(duration)
|
|
5641
5877
|
] }),
|
|
5642
|
-
currentChapter && showChapters && /* @__PURE__ */
|
|
5878
|
+
currentChapter && showChapters && /* @__PURE__ */ jsxs37("span", { className: "text-xs text-white/90 font-medium truncate max-w-[150px]", children: [
|
|
5643
5879
|
"\u2022 ",
|
|
5644
5880
|
currentChapter.title
|
|
5645
5881
|
] })
|
|
5646
5882
|
] }),
|
|
5647
|
-
/* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
5883
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
5884
|
+
/* @__PURE__ */ jsx110(
|
|
5649
5885
|
"button",
|
|
5650
5886
|
{
|
|
5651
5887
|
onClick: toggleMute,
|
|
5652
5888
|
className: "text-white/80 hover:text-white transition-colors",
|
|
5653
5889
|
"aria-label": isMuted ? "Unmute" : "Mute",
|
|
5654
|
-
children: isMuted ? /* @__PURE__ */
|
|
5890
|
+
children: isMuted ? /* @__PURE__ */ jsx110(VolumeOffIcon, { size: "sm" }) : /* @__PURE__ */ jsx110(VolumeUpIcon, { size: "sm" })
|
|
5655
5891
|
}
|
|
5656
5892
|
),
|
|
5657
|
-
/* @__PURE__ */
|
|
5893
|
+
/* @__PURE__ */ jsx110(
|
|
5658
5894
|
"button",
|
|
5659
5895
|
{
|
|
5660
5896
|
onClick: toggleFullscreen,
|
|
5661
5897
|
className: "text-white/80 hover:text-white transition-colors",
|
|
5662
5898
|
"aria-label": isFullscreen ? "Exit fullscreen" : "Enter fullscreen",
|
|
5663
|
-
children: isFullscreen ? /* @__PURE__ */
|
|
5899
|
+
children: isFullscreen ? /* @__PURE__ */ jsx110(FullscreenExitIcon, { size: "sm" }) : /* @__PURE__ */ jsx110(FullscreenIcon, { size: "sm" })
|
|
5664
5900
|
}
|
|
5665
5901
|
)
|
|
5666
5902
|
] })
|
|
5667
5903
|
] })
|
|
5668
5904
|
] })
|
|
5669
5905
|
] }),
|
|
5670
|
-
hoveredChapter && showChapters && /* @__PURE__ */
|
|
5906
|
+
hoveredChapter && showChapters && /* @__PURE__ */ jsxs37(
|
|
5671
5907
|
"div",
|
|
5672
5908
|
{
|
|
5673
5909
|
className: "fixed z-50 px-3 py-2 bg-[hsl(var(--popover))] text-white text-xs font-medium rounded shadow-lg pointer-events-none transform -translate-x-1/2 -translate-y-full",
|
|
5674
5910
|
style: { left: hoverPosition.x, top: hoverPosition.y - 8 },
|
|
5675
5911
|
children: [
|
|
5676
|
-
/* @__PURE__ */
|
|
5677
|
-
/* @__PURE__ */
|
|
5678
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsx110("div", { className: "whitespace-nowrap", children: hoveredChapter.title }),
|
|
5913
|
+
/* @__PURE__ */ jsx110("div", { className: "text-[hsl(var(--muted-foreground))] text-[10px] mt-0.5", children: formatTime(hoveredChapter.startTime) }),
|
|
5914
|
+
/* @__PURE__ */ jsx110("div", { className: "absolute left-1/2 -bottom-1 w-2 h-2 bg-[hsl(var(--popover))] transform -translate-x-1/2 rotate-45" })
|
|
5679
5915
|
]
|
|
5680
5916
|
}
|
|
5681
5917
|
)
|
|
@@ -5683,9 +5919,9 @@ var VideoPlayer = ({
|
|
|
5683
5919
|
}
|
|
5684
5920
|
);
|
|
5685
5921
|
}
|
|
5686
|
-
return /* @__PURE__ */
|
|
5687
|
-
title && /* @__PURE__ */
|
|
5688
|
-
/* @__PURE__ */
|
|
5922
|
+
return /* @__PURE__ */ jsxs37("div", { className: `bg-[hsl(var(--card))] rounded-lg border border-[hsl(var(--border))] shadow-md overflow-hidden ${className}`, children: [
|
|
5923
|
+
title && /* @__PURE__ */ jsx110("div", { className: "px-4 py-3 border-b border-[hsl(var(--border))]", children: /* @__PURE__ */ jsx110("h3", { className: "text-base font-semibold text-[hsl(var(--foreground))] truncate", children: title }) }),
|
|
5924
|
+
/* @__PURE__ */ jsxs37(
|
|
5689
5925
|
"div",
|
|
5690
5926
|
{
|
|
5691
5927
|
ref: containerRef,
|
|
@@ -5693,7 +5929,7 @@ var VideoPlayer = ({
|
|
|
5693
5929
|
style: { width, height },
|
|
5694
5930
|
onMouseMove: handleMouseMove,
|
|
5695
5931
|
children: [
|
|
5696
|
-
/* @__PURE__ */
|
|
5932
|
+
/* @__PURE__ */ jsx110(
|
|
5697
5933
|
"video",
|
|
5698
5934
|
{
|
|
5699
5935
|
ref: videoRef,
|
|
@@ -5708,8 +5944,8 @@ var VideoPlayer = ({
|
|
|
5708
5944
|
onClick: togglePlayPause
|
|
5709
5945
|
}
|
|
5710
5946
|
),
|
|
5711
|
-
showControls && !controls && /* @__PURE__ */
|
|
5712
|
-
/* @__PURE__ */
|
|
5947
|
+
showControls && !controls && /* @__PURE__ */ jsxs37("div", { className: `absolute inset-0 bg-gradient-to-t from-black/70 via-transparent to-transparent transition-opacity duration-300 ${showControlsOverlay || !isPlaying ? "opacity-100" : "opacity-0 pointer-events-none"}`, children: [
|
|
5948
|
+
/* @__PURE__ */ jsx110("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx110(
|
|
5713
5949
|
"button",
|
|
5714
5950
|
{
|
|
5715
5951
|
onClick: togglePlayPause,
|
|
@@ -5717,12 +5953,12 @@ var VideoPlayer = ({
|
|
|
5717
5953
|
className: "flex items-center justify-center w-20 h-20 rounded-full bg-white/20 hover:bg-white/30 backdrop-blur-sm text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed",
|
|
5718
5954
|
style: { width: 80, height: 80, borderRadius: "50%" },
|
|
5719
5955
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
5720
|
-
children: isPlaying ? /* @__PURE__ */
|
|
5956
|
+
children: isPlaying ? /* @__PURE__ */ jsx110(PauseIcon, { size: "xl" }) : /* @__PURE__ */ jsx110(PlayIcon, { size: "xl" })
|
|
5721
5957
|
}
|
|
5722
5958
|
) }),
|
|
5723
|
-
/* @__PURE__ */
|
|
5724
|
-
/* @__PURE__ */
|
|
5725
|
-
/* @__PURE__ */
|
|
5959
|
+
/* @__PURE__ */ jsxs37("div", { className: "absolute bottom-0 left-0 right-0 p-4 space-y-3", children: [
|
|
5960
|
+
/* @__PURE__ */ jsxs37("div", { className: "relative h-1.5 bg-white/30 rounded-full overflow-visible", children: [
|
|
5961
|
+
/* @__PURE__ */ jsx110(
|
|
5726
5962
|
"div",
|
|
5727
5963
|
{
|
|
5728
5964
|
className: "absolute h-full bg-[hsl(var(--primary))] rounded-full transition-all",
|
|
@@ -5731,7 +5967,7 @@ var VideoPlayer = ({
|
|
|
5731
5967
|
),
|
|
5732
5968
|
showChapters && chapters.length > 0 && chapters.map((chapter, index) => {
|
|
5733
5969
|
const markerPosition = duration > 0 ? chapter.startTime / duration * 100 : 0;
|
|
5734
|
-
return /* @__PURE__ */
|
|
5970
|
+
return /* @__PURE__ */ jsx110(
|
|
5735
5971
|
"div",
|
|
5736
5972
|
{
|
|
5737
5973
|
className: "absolute top-0 bottom-0 w-1 -ml-0.5 bg-white opacity-70 hover:opacity-100 hover:w-1.5 hover:-ml-0.5 cursor-pointer z-10 transition-all",
|
|
@@ -5747,7 +5983,7 @@ var VideoPlayer = ({
|
|
|
5747
5983
|
index
|
|
5748
5984
|
);
|
|
5749
5985
|
}),
|
|
5750
|
-
/* @__PURE__ */
|
|
5986
|
+
/* @__PURE__ */ jsx110(
|
|
5751
5987
|
"input",
|
|
5752
5988
|
{
|
|
5753
5989
|
type: "range",
|
|
@@ -5761,42 +5997,42 @@ var VideoPlayer = ({
|
|
|
5761
5997
|
}
|
|
5762
5998
|
)
|
|
5763
5999
|
] }),
|
|
5764
|
-
/* @__PURE__ */
|
|
5765
|
-
/* @__PURE__ */
|
|
5766
|
-
/* @__PURE__ */
|
|
6000
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between gap-4", children: [
|
|
6001
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
|
|
6002
|
+
/* @__PURE__ */ jsx110(
|
|
5767
6003
|
"button",
|
|
5768
6004
|
{
|
|
5769
6005
|
onClick: togglePlayPause,
|
|
5770
6006
|
disabled: isLoading,
|
|
5771
6007
|
className: "flex items-center justify-center w-10 h-10 rounded-lg bg-white/20 hover:bg-white/30 backdrop-blur-sm text-white transition-all disabled:opacity-50 disabled:cursor-not-allowed",
|
|
5772
6008
|
"aria-label": isPlaying ? "Pause" : "Play",
|
|
5773
|
-
children: isPlaying ? /* @__PURE__ */
|
|
6009
|
+
children: isPlaying ? /* @__PURE__ */ jsx110(PauseIcon, { size: "md" }) : /* @__PURE__ */ jsx110(PlayIcon, { size: "md" })
|
|
5774
6010
|
}
|
|
5775
6011
|
),
|
|
5776
|
-
/* @__PURE__ */
|
|
5777
|
-
/* @__PURE__ */
|
|
6012
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
6013
|
+
/* @__PURE__ */ jsxs37("span", { className: "text-sm text-white tabular-nums", children: [
|
|
5778
6014
|
formatTime(currentTime),
|
|
5779
6015
|
" / ",
|
|
5780
6016
|
formatTime(duration)
|
|
5781
6017
|
] }),
|
|
5782
|
-
currentChapter && showChapters && /* @__PURE__ */
|
|
6018
|
+
currentChapter && showChapters && /* @__PURE__ */ jsxs37("span", { className: "text-sm text-white/90 font-medium truncate max-w-[200px]", children: [
|
|
5783
6019
|
"\u2022 ",
|
|
5784
6020
|
currentChapter.title
|
|
5785
6021
|
] })
|
|
5786
6022
|
] })
|
|
5787
6023
|
] }),
|
|
5788
|
-
/* @__PURE__ */
|
|
5789
|
-
/* @__PURE__ */
|
|
5790
|
-
/* @__PURE__ */
|
|
6024
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-3", children: [
|
|
6025
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
6026
|
+
/* @__PURE__ */ jsx110(
|
|
5791
6027
|
"button",
|
|
5792
6028
|
{
|
|
5793
6029
|
onClick: toggleMute,
|
|
5794
6030
|
className: "text-white/80 hover:text-white transition-colors",
|
|
5795
6031
|
"aria-label": isMuted ? "Unmute" : "Mute",
|
|
5796
|
-
children: isMuted ? /* @__PURE__ */
|
|
6032
|
+
children: isMuted ? /* @__PURE__ */ jsx110(VolumeOffIcon, { size: "md" }) : /* @__PURE__ */ jsx110(VolumeUpIcon, { size: "md" })
|
|
5797
6033
|
}
|
|
5798
6034
|
),
|
|
5799
|
-
/* @__PURE__ */
|
|
6035
|
+
/* @__PURE__ */ jsx110(
|
|
5800
6036
|
"input",
|
|
5801
6037
|
{
|
|
5802
6038
|
type: "range",
|
|
@@ -5810,28 +6046,28 @@ var VideoPlayer = ({
|
|
|
5810
6046
|
}
|
|
5811
6047
|
)
|
|
5812
6048
|
] }),
|
|
5813
|
-
/* @__PURE__ */
|
|
6049
|
+
/* @__PURE__ */ jsx110(
|
|
5814
6050
|
"button",
|
|
5815
6051
|
{
|
|
5816
6052
|
onClick: toggleFullscreen,
|
|
5817
6053
|
className: "text-white/80 hover:text-white transition-colors",
|
|
5818
6054
|
"aria-label": isFullscreen ? "Exit fullscreen" : "Enter fullscreen",
|
|
5819
|
-
children: isFullscreen ? /* @__PURE__ */
|
|
6055
|
+
children: isFullscreen ? /* @__PURE__ */ jsx110(FullscreenExitIcon, { size: "md" }) : /* @__PURE__ */ jsx110(FullscreenIcon, { size: "md" })
|
|
5820
6056
|
}
|
|
5821
6057
|
)
|
|
5822
6058
|
] })
|
|
5823
6059
|
] })
|
|
5824
6060
|
] })
|
|
5825
6061
|
] }),
|
|
5826
|
-
hoveredChapter && showChapters && /* @__PURE__ */
|
|
6062
|
+
hoveredChapter && showChapters && /* @__PURE__ */ jsxs37(
|
|
5827
6063
|
"div",
|
|
5828
6064
|
{
|
|
5829
6065
|
className: "fixed z-50 px-3 py-2 bg-[hsl(var(--popover))] text-white text-xs font-medium rounded shadow-lg pointer-events-none transform -translate-x-1/2 -translate-y-full",
|
|
5830
6066
|
style: { left: hoverPosition.x, top: hoverPosition.y - 8 },
|
|
5831
6067
|
children: [
|
|
5832
|
-
/* @__PURE__ */
|
|
5833
|
-
/* @__PURE__ */
|
|
5834
|
-
/* @__PURE__ */
|
|
6068
|
+
/* @__PURE__ */ jsx110("div", { className: "whitespace-nowrap", children: hoveredChapter.title }),
|
|
6069
|
+
/* @__PURE__ */ jsx110("div", { className: "text-[hsl(var(--muted-foreground))] text-[10px] mt-0.5", children: formatTime(hoveredChapter.startTime) }),
|
|
6070
|
+
/* @__PURE__ */ jsx110("div", { className: "absolute left-1/2 -bottom-1 w-2 h-2 bg-[hsl(var(--popover))] transform -translate-x-1/2 rotate-45" })
|
|
5835
6071
|
]
|
|
5836
6072
|
}
|
|
5837
6073
|
)
|
|
@@ -5842,7 +6078,7 @@ var VideoPlayer = ({
|
|
|
5842
6078
|
};
|
|
5843
6079
|
|
|
5844
6080
|
// src/charts/LineChart.tsx
|
|
5845
|
-
import
|
|
6081
|
+
import React31, { useMemo as useMemo2, useCallback as useCallback5, useRef as useRef13, useState as useState21 } from "react";
|
|
5846
6082
|
|
|
5847
6083
|
// src/charts/constants.ts
|
|
5848
6084
|
var CHART_DEFAULTS = {
|
|
@@ -5909,7 +6145,7 @@ var CHART_DEFAULTS = {
|
|
|
5909
6145
|
};
|
|
5910
6146
|
|
|
5911
6147
|
// src/charts/hooks/useResponsiveChart.ts
|
|
5912
|
-
import { useState as
|
|
6148
|
+
import { useState as useState19, useEffect as useEffect13 } from "react";
|
|
5913
6149
|
var BREAKPOINTS = {
|
|
5914
6150
|
mobile: 640,
|
|
5915
6151
|
// < 640px
|
|
@@ -5928,8 +6164,8 @@ var DEFAULT_ASPECT_RATIOS = {
|
|
|
5928
6164
|
desktop: 2
|
|
5929
6165
|
};
|
|
5930
6166
|
function useBreakpoint() {
|
|
5931
|
-
const [breakpoint, setBreakpoint] =
|
|
5932
|
-
|
|
6167
|
+
const [breakpoint, setBreakpoint] = useState19("desktop");
|
|
6168
|
+
useEffect13(() => {
|
|
5933
6169
|
const update = () => {
|
|
5934
6170
|
const width = window.innerWidth;
|
|
5935
6171
|
if (width < BREAKPOINTS.mobile) {
|
|
@@ -6226,8 +6462,8 @@ function createTickFormatter(domain) {
|
|
|
6226
6462
|
}
|
|
6227
6463
|
|
|
6228
6464
|
// src/charts/components/ChartTooltip.tsx
|
|
6229
|
-
import
|
|
6230
|
-
import { jsx as
|
|
6465
|
+
import React29, { useRef as useRef12, useEffect as useEffect14, useState as useState20 } from "react";
|
|
6466
|
+
import { jsx as jsx111, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
6231
6467
|
var DefaultTooltipContent = ({
|
|
6232
6468
|
active,
|
|
6233
6469
|
label,
|
|
@@ -6239,22 +6475,22 @@ var DefaultTooltipContent = ({
|
|
|
6239
6475
|
return null;
|
|
6240
6476
|
}
|
|
6241
6477
|
const formattedLabel = labelFormatter ? labelFormatter(label ?? "") : String(label ?? "");
|
|
6242
|
-
return /* @__PURE__ */
|
|
6243
|
-
formattedLabel && /* @__PURE__ */
|
|
6244
|
-
/* @__PURE__ */
|
|
6478
|
+
return /* @__PURE__ */ jsxs38("div", { className: "bg-[hsl(var(--popover))] text-white rounded-lg shadow-xl border border-[hsl(var(--border))] overflow-hidden min-w-[120px]", children: [
|
|
6479
|
+
formattedLabel && /* @__PURE__ */ jsx111("div", { className: "px-3 py-2 bg-[hsl(var(--popover))] border-b border-[hsl(var(--border))]", children: /* @__PURE__ */ jsx111("span", { className: "text-sm font-medium text-[hsl(var(--muted-foreground))]", children: formattedLabel }) }),
|
|
6480
|
+
/* @__PURE__ */ jsx111("div", { className: "px-3 py-2 space-y-1", children: payload.map((item, index) => {
|
|
6245
6481
|
const formattedValue = formatter ? formatter(item.value, item.name, item) : String(item.value);
|
|
6246
|
-
return /* @__PURE__ */
|
|
6247
|
-
/* @__PURE__ */
|
|
6248
|
-
item.color && /* @__PURE__ */
|
|
6482
|
+
return /* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between gap-4", children: [
|
|
6483
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2", children: [
|
|
6484
|
+
item.color && /* @__PURE__ */ jsx111(
|
|
6249
6485
|
"span",
|
|
6250
6486
|
{
|
|
6251
6487
|
className: "w-2.5 h-2.5 rounded-full flex-shrink-0",
|
|
6252
6488
|
style: { backgroundColor: item.color }
|
|
6253
6489
|
}
|
|
6254
6490
|
),
|
|
6255
|
-
/* @__PURE__ */
|
|
6491
|
+
/* @__PURE__ */ jsx111("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: item.name })
|
|
6256
6492
|
] }),
|
|
6257
|
-
/* @__PURE__ */
|
|
6493
|
+
/* @__PURE__ */ jsx111("span", { className: "text-sm font-semibold text-white", children: formattedValue })
|
|
6258
6494
|
] }, `${item.name}-${index}`);
|
|
6259
6495
|
}) })
|
|
6260
6496
|
] });
|
|
@@ -6273,10 +6509,10 @@ var ChartTooltip = ({
|
|
|
6273
6509
|
containerBounds,
|
|
6274
6510
|
animationDuration = 150
|
|
6275
6511
|
}) => {
|
|
6276
|
-
const tooltipRef =
|
|
6277
|
-
const [position, setPosition] =
|
|
6278
|
-
const [isVisible, setIsVisible] =
|
|
6279
|
-
|
|
6512
|
+
const tooltipRef = useRef12(null);
|
|
6513
|
+
const [position, setPosition] = useState20({ x: 0, y: 0 });
|
|
6514
|
+
const [isVisible, setIsVisible] = useState20(false);
|
|
6515
|
+
useEffect14(() => {
|
|
6280
6516
|
if (!active || !tooltipRef.current) {
|
|
6281
6517
|
setIsVisible(false);
|
|
6282
6518
|
return;
|
|
@@ -6305,19 +6541,19 @@ var ChartTooltip = ({
|
|
|
6305
6541
|
if (!active) {
|
|
6306
6542
|
return null;
|
|
6307
6543
|
}
|
|
6308
|
-
const tooltipContent = content ?
|
|
6544
|
+
const tooltipContent = content ? React29.isValidElement(content) ? React29.cloneElement(content, {
|
|
6309
6545
|
active,
|
|
6310
6546
|
label,
|
|
6311
6547
|
payload,
|
|
6312
6548
|
formatter,
|
|
6313
6549
|
labelFormatter
|
|
6314
|
-
}) :
|
|
6550
|
+
}) : React29.createElement(content, {
|
|
6315
6551
|
active,
|
|
6316
6552
|
label,
|
|
6317
6553
|
payload,
|
|
6318
6554
|
formatter,
|
|
6319
6555
|
labelFormatter
|
|
6320
|
-
}) : /* @__PURE__ */
|
|
6556
|
+
}) : /* @__PURE__ */ jsx111(
|
|
6321
6557
|
DefaultTooltipContent,
|
|
6322
6558
|
{
|
|
6323
6559
|
active,
|
|
@@ -6327,7 +6563,7 @@ var ChartTooltip = ({
|
|
|
6327
6563
|
labelFormatter
|
|
6328
6564
|
}
|
|
6329
6565
|
);
|
|
6330
|
-
return /* @__PURE__ */
|
|
6566
|
+
return /* @__PURE__ */ jsx111(
|
|
6331
6567
|
"div",
|
|
6332
6568
|
{
|
|
6333
6569
|
ref: tooltipRef,
|
|
@@ -6344,26 +6580,26 @@ var ChartTooltip = ({
|
|
|
6344
6580
|
);
|
|
6345
6581
|
};
|
|
6346
6582
|
function useTooltip() {
|
|
6347
|
-
const [tooltipData, setTooltipData] =
|
|
6583
|
+
const [tooltipData, setTooltipData] = useState20({
|
|
6348
6584
|
active: false,
|
|
6349
6585
|
x: 0,
|
|
6350
6586
|
y: 0,
|
|
6351
6587
|
label: void 0,
|
|
6352
6588
|
payload: void 0
|
|
6353
6589
|
});
|
|
6354
|
-
const showTooltip =
|
|
6590
|
+
const showTooltip = React29.useCallback((data) => {
|
|
6355
6591
|
setTooltipData({
|
|
6356
6592
|
active: true,
|
|
6357
6593
|
...data
|
|
6358
6594
|
});
|
|
6359
6595
|
}, []);
|
|
6360
|
-
const hideTooltip =
|
|
6596
|
+
const hideTooltip = React29.useCallback(() => {
|
|
6361
6597
|
setTooltipData((prev) => ({
|
|
6362
6598
|
...prev,
|
|
6363
6599
|
active: false
|
|
6364
6600
|
}));
|
|
6365
6601
|
}, []);
|
|
6366
|
-
const updatePosition =
|
|
6602
|
+
const updatePosition = React29.useCallback((x, y) => {
|
|
6367
6603
|
setTooltipData((prev) => ({
|
|
6368
6604
|
...prev,
|
|
6369
6605
|
x,
|
|
@@ -6379,7 +6615,7 @@ function useTooltip() {
|
|
|
6379
6615
|
}
|
|
6380
6616
|
|
|
6381
6617
|
// src/charts/components/Legend.tsx
|
|
6382
|
-
import { jsx as
|
|
6618
|
+
import { jsx as jsx112, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6383
6619
|
var Legend = ({
|
|
6384
6620
|
items = [],
|
|
6385
6621
|
layout = "horizontal",
|
|
@@ -6403,7 +6639,7 @@ var Legend = ({
|
|
|
6403
6639
|
const style = { backgroundColor: item.color };
|
|
6404
6640
|
switch (item.type) {
|
|
6405
6641
|
case "line":
|
|
6406
|
-
return /* @__PURE__ */
|
|
6642
|
+
return /* @__PURE__ */ jsx112(
|
|
6407
6643
|
"div",
|
|
6408
6644
|
{
|
|
6409
6645
|
className: "flex-shrink-0",
|
|
@@ -6415,7 +6651,7 @@ var Legend = ({
|
|
|
6415
6651
|
}
|
|
6416
6652
|
);
|
|
6417
6653
|
case "circle":
|
|
6418
|
-
return /* @__PURE__ */
|
|
6654
|
+
return /* @__PURE__ */ jsx112(
|
|
6419
6655
|
"div",
|
|
6420
6656
|
{
|
|
6421
6657
|
className: "rounded-full flex-shrink-0",
|
|
@@ -6429,7 +6665,7 @@ var Legend = ({
|
|
|
6429
6665
|
case "rect":
|
|
6430
6666
|
case "square":
|
|
6431
6667
|
default:
|
|
6432
|
-
return /* @__PURE__ */
|
|
6668
|
+
return /* @__PURE__ */ jsx112(
|
|
6433
6669
|
"div",
|
|
6434
6670
|
{
|
|
6435
6671
|
className: "rounded-sm flex-shrink-0",
|
|
@@ -6442,12 +6678,12 @@ var Legend = ({
|
|
|
6442
6678
|
);
|
|
6443
6679
|
}
|
|
6444
6680
|
};
|
|
6445
|
-
return /* @__PURE__ */
|
|
6681
|
+
return /* @__PURE__ */ jsx112(
|
|
6446
6682
|
"div",
|
|
6447
6683
|
{
|
|
6448
6684
|
className: `flex gap-4 px-4 py-2 ${layoutClass} ${alignClass} ${className}`,
|
|
6449
6685
|
style: wrapperStyle,
|
|
6450
|
-
children: items.map((item, index) => /* @__PURE__ */
|
|
6686
|
+
children: items.map((item, index) => /* @__PURE__ */ jsxs39(
|
|
6451
6687
|
"button",
|
|
6452
6688
|
{
|
|
6453
6689
|
type: "button",
|
|
@@ -6461,7 +6697,7 @@ var Legend = ({
|
|
|
6461
6697
|
onMouseLeave,
|
|
6462
6698
|
children: [
|
|
6463
6699
|
renderIcon(item),
|
|
6464
|
-
/* @__PURE__ */
|
|
6700
|
+
/* @__PURE__ */ jsx112("span", { className: "text-[hsl(var(--foreground))]", children: formatter ? formatter(item.name, item, index) : item.name })
|
|
6465
6701
|
]
|
|
6466
6702
|
},
|
|
6467
6703
|
`${item.name}-${index}`
|
|
@@ -6471,7 +6707,7 @@ var Legend = ({
|
|
|
6471
6707
|
};
|
|
6472
6708
|
|
|
6473
6709
|
// src/charts/components/ReferenceLine.tsx
|
|
6474
|
-
import { jsx as
|
|
6710
|
+
import { jsx as jsx113, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6475
6711
|
var ReferenceLine = ({
|
|
6476
6712
|
x,
|
|
6477
6713
|
y,
|
|
@@ -6583,8 +6819,8 @@ var ReferenceLine = ({
|
|
|
6583
6819
|
} else {
|
|
6584
6820
|
return null;
|
|
6585
6821
|
}
|
|
6586
|
-
return /* @__PURE__ */
|
|
6587
|
-
/* @__PURE__ */
|
|
6822
|
+
return /* @__PURE__ */ jsxs40("g", { className: `reference-line ${className}`, children: [
|
|
6823
|
+
/* @__PURE__ */ jsx113(
|
|
6588
6824
|
"line",
|
|
6589
6825
|
{
|
|
6590
6826
|
x1,
|
|
@@ -6596,7 +6832,7 @@ var ReferenceLine = ({
|
|
|
6596
6832
|
strokeDasharray
|
|
6597
6833
|
}
|
|
6598
6834
|
),
|
|
6599
|
-
label && (typeof label === "string" ? /* @__PURE__ */
|
|
6835
|
+
label && (typeof label === "string" ? /* @__PURE__ */ jsx113(
|
|
6600
6836
|
"text",
|
|
6601
6837
|
{
|
|
6602
6838
|
x: labelX,
|
|
@@ -6608,7 +6844,7 @@ var ReferenceLine = ({
|
|
|
6608
6844
|
className: "fill-[hsl(var(--muted-foreground))]",
|
|
6609
6845
|
children: label
|
|
6610
6846
|
}
|
|
6611
|
-
) : /* @__PURE__ */
|
|
6847
|
+
) : /* @__PURE__ */ jsx113(
|
|
6612
6848
|
"foreignObject",
|
|
6613
6849
|
{
|
|
6614
6850
|
x: labelX - 50,
|
|
@@ -6622,7 +6858,7 @@ var ReferenceLine = ({
|
|
|
6622
6858
|
};
|
|
6623
6859
|
|
|
6624
6860
|
// src/charts/components/ReferenceArea.tsx
|
|
6625
|
-
import { jsx as
|
|
6861
|
+
import { jsx as jsx114, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
6626
6862
|
var ReferenceArea = ({
|
|
6627
6863
|
x1,
|
|
6628
6864
|
x2,
|
|
@@ -6730,8 +6966,8 @@ var ReferenceArea = ({
|
|
|
6730
6966
|
labelX = rectX + rectWidth / 2;
|
|
6731
6967
|
labelY = rectY + rectHeight / 2;
|
|
6732
6968
|
}
|
|
6733
|
-
return /* @__PURE__ */
|
|
6734
|
-
/* @__PURE__ */
|
|
6969
|
+
return /* @__PURE__ */ jsxs41("g", { className: `reference-area ${className}`, children: [
|
|
6970
|
+
/* @__PURE__ */ jsx114(
|
|
6735
6971
|
"rect",
|
|
6736
6972
|
{
|
|
6737
6973
|
x: rectX,
|
|
@@ -6744,7 +6980,7 @@ var ReferenceArea = ({
|
|
|
6744
6980
|
strokeWidth
|
|
6745
6981
|
}
|
|
6746
6982
|
),
|
|
6747
|
-
label && (typeof label === "string" ? /* @__PURE__ */
|
|
6983
|
+
label && (typeof label === "string" ? /* @__PURE__ */ jsx114(
|
|
6748
6984
|
"text",
|
|
6749
6985
|
{
|
|
6750
6986
|
x: labelX,
|
|
@@ -6756,7 +6992,7 @@ var ReferenceArea = ({
|
|
|
6756
6992
|
className: "fill-[hsl(var(--muted-foreground))]",
|
|
6757
6993
|
children: label
|
|
6758
6994
|
}
|
|
6759
|
-
) : /* @__PURE__ */
|
|
6995
|
+
) : /* @__PURE__ */ jsx114(
|
|
6760
6996
|
"foreignObject",
|
|
6761
6997
|
{
|
|
6762
6998
|
x: labelX - 50,
|
|
@@ -6771,7 +7007,7 @@ var ReferenceArea = ({
|
|
|
6771
7007
|
|
|
6772
7008
|
// src/charts/components/CartesianGrid.tsx
|
|
6773
7009
|
import { useMemo } from "react";
|
|
6774
|
-
import { jsx as
|
|
7010
|
+
import { jsx as jsx115, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
6775
7011
|
var CartesianGrid = ({
|
|
6776
7012
|
horizontal = true,
|
|
6777
7013
|
vertical = true,
|
|
@@ -6798,8 +7034,8 @@ var CartesianGrid = ({
|
|
|
6798
7034
|
const count = 6;
|
|
6799
7035
|
return Array.from({ length: count + 1 }, (_, i) => width / count * i);
|
|
6800
7036
|
}, [verticalPoints, width]);
|
|
6801
|
-
return /* @__PURE__ */
|
|
6802
|
-
horizontal && hPoints.map((y, i) => /* @__PURE__ */
|
|
7037
|
+
return /* @__PURE__ */ jsxs42("g", { className: `cartesian-grid ${className}`, children: [
|
|
7038
|
+
horizontal && hPoints.map((y, i) => /* @__PURE__ */ jsx115(
|
|
6803
7039
|
"line",
|
|
6804
7040
|
{
|
|
6805
7041
|
x1: 0,
|
|
@@ -6814,7 +7050,7 @@ var CartesianGrid = ({
|
|
|
6814
7050
|
},
|
|
6815
7051
|
`h-${i}`
|
|
6816
7052
|
)),
|
|
6817
|
-
vertical && vPoints.map((x, i) => /* @__PURE__ */
|
|
7053
|
+
vertical && vPoints.map((x, i) => /* @__PURE__ */ jsx115(
|
|
6818
7054
|
"line",
|
|
6819
7055
|
{
|
|
6820
7056
|
x1: x,
|
|
@@ -6833,7 +7069,7 @@ var CartesianGrid = ({
|
|
|
6833
7069
|
};
|
|
6834
7070
|
|
|
6835
7071
|
// src/charts/LineChart.tsx
|
|
6836
|
-
import { jsx as
|
|
7072
|
+
import { jsx as jsx116, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6837
7073
|
var LineChart = ({
|
|
6838
7074
|
data,
|
|
6839
7075
|
width: providedWidth,
|
|
@@ -6869,10 +7105,10 @@ var LineChart = ({
|
|
|
6869
7105
|
colors = CHART_DEFAULTS.colors,
|
|
6870
7106
|
ariaLabel
|
|
6871
7107
|
}) => {
|
|
6872
|
-
const containerRef =
|
|
6873
|
-
const svgRef =
|
|
6874
|
-
const [hoveredPoint, setHoveredPoint] =
|
|
6875
|
-
const [crosshairX, setCrosshairX] =
|
|
7108
|
+
const containerRef = useRef13(null);
|
|
7109
|
+
const svgRef = useRef13(null);
|
|
7110
|
+
const [hoveredPoint, setHoveredPoint] = useState21(null);
|
|
7111
|
+
const [crosshairX, setCrosshairX] = useState21(null);
|
|
6876
7112
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
6877
7113
|
const {
|
|
6878
7114
|
width,
|
|
@@ -6967,7 +7203,7 @@ var LineChart = ({
|
|
|
6967
7203
|
const ticks = getTicks(xDomainCalc, tickCount);
|
|
6968
7204
|
return ticks.map((t) => ({ value: t, index: 0 }));
|
|
6969
7205
|
}, [xValueType, xDomainCalc, data]);
|
|
6970
|
-
const xFormatter =
|
|
7206
|
+
const xFormatter = useCallback5((value) => {
|
|
6971
7207
|
if (formatXValue) return formatXValue(value);
|
|
6972
7208
|
if (value instanceof Date) {
|
|
6973
7209
|
const range = xDomainCalc[1] - xDomainCalc[0];
|
|
@@ -7004,7 +7240,7 @@ var LineChart = ({
|
|
|
7004
7240
|
return { points, path };
|
|
7005
7241
|
});
|
|
7006
7242
|
}, [data, xScale, yScale]);
|
|
7007
|
-
const handlePointEnter =
|
|
7243
|
+
const handlePointEnter = useCallback5((e, seriesIndex, pointIndex) => {
|
|
7008
7244
|
const series = data[seriesIndex];
|
|
7009
7245
|
const point = series.data[pointIndex];
|
|
7010
7246
|
const scaledPoint = seriesPaths[seriesIndex].points[pointIndex];
|
|
@@ -7031,13 +7267,13 @@ var LineChart = ({
|
|
|
7031
7267
|
}
|
|
7032
7268
|
onPointHover?.(point, seriesIndex, pointIndex);
|
|
7033
7269
|
}, [data, seriesPaths, showCrosshair, showTooltip, colors, xFormatter, showTooltipFn, onPointHover]);
|
|
7034
|
-
const handlePointLeave =
|
|
7270
|
+
const handlePointLeave = useCallback5(() => {
|
|
7035
7271
|
setHoveredPoint(null);
|
|
7036
7272
|
setCrosshairX(null);
|
|
7037
7273
|
hideTooltip();
|
|
7038
7274
|
onPointHover?.(null, -1, -1);
|
|
7039
7275
|
}, [hideTooltip, onPointHover]);
|
|
7040
|
-
const handlePointClick =
|
|
7276
|
+
const handlePointClick = useCallback5((seriesIndex, pointIndex) => {
|
|
7041
7277
|
const point = data[seriesIndex].data[pointIndex];
|
|
7042
7278
|
onPointClick?.(point, seriesIndex, pointIndex);
|
|
7043
7279
|
}, [data, onPointClick]);
|
|
@@ -7066,10 +7302,10 @@ var LineChart = ({
|
|
|
7066
7302
|
},
|
|
7067
7303
|
yScale
|
|
7068
7304
|
};
|
|
7069
|
-
return
|
|
7070
|
-
if (!
|
|
7305
|
+
return React31.Children.map(children, (child) => {
|
|
7306
|
+
if (!React31.isValidElement(child)) return child;
|
|
7071
7307
|
if (child.type === ReferenceLine || child.type === ReferenceArea || child.type === CartesianGrid) {
|
|
7072
|
-
return
|
|
7308
|
+
return React31.cloneElement(child, {
|
|
7073
7309
|
_chartDimensions: chartDimensions,
|
|
7074
7310
|
_scales: scales
|
|
7075
7311
|
});
|
|
@@ -7082,14 +7318,14 @@ var LineChart = ({
|
|
|
7082
7318
|
const seriesNames = data.map((s) => s.name).join(", ");
|
|
7083
7319
|
return `Line chart with ${data.length} series: ${seriesNames}`;
|
|
7084
7320
|
}, [data, ariaLabel]);
|
|
7085
|
-
return /* @__PURE__ */
|
|
7321
|
+
return /* @__PURE__ */ jsxs43(
|
|
7086
7322
|
"div",
|
|
7087
7323
|
{
|
|
7088
7324
|
ref: containerRef,
|
|
7089
7325
|
className: `relative ${className}`,
|
|
7090
7326
|
style: containerStyle,
|
|
7091
7327
|
children: [
|
|
7092
|
-
/* @__PURE__ */
|
|
7328
|
+
/* @__PURE__ */ jsxs43(
|
|
7093
7329
|
"svg",
|
|
7094
7330
|
{
|
|
7095
7331
|
ref: svgRef,
|
|
@@ -7102,14 +7338,14 @@ var LineChart = ({
|
|
|
7102
7338
|
className: "bg-[hsl(var(--card))]",
|
|
7103
7339
|
style: svgStyle,
|
|
7104
7340
|
children: [
|
|
7105
|
-
/* @__PURE__ */
|
|
7341
|
+
/* @__PURE__ */ jsx116("defs", { children: animate && data.map((series, i) => /* @__PURE__ */ jsx116("style", { children: `
|
|
7106
7342
|
@keyframes drawLine${i} {
|
|
7107
7343
|
from { stroke-dashoffset: 2000; }
|
|
7108
7344
|
to { stroke-dashoffset: 0; }
|
|
7109
7345
|
}
|
|
7110
7346
|
` }, `anim-${i}`)) }),
|
|
7111
|
-
/* @__PURE__ */
|
|
7112
|
-
showGrid && /* @__PURE__ */
|
|
7347
|
+
/* @__PURE__ */ jsxs43("g", { transform: `translate(${padding.left}, ${padding.top})`, children: [
|
|
7348
|
+
showGrid && /* @__PURE__ */ jsx116(
|
|
7113
7349
|
CartesianGrid,
|
|
7114
7350
|
{
|
|
7115
7351
|
_chartDimensions: { width: chartWidth, height: chartHeight },
|
|
@@ -7117,7 +7353,7 @@ var LineChart = ({
|
|
|
7117
7353
|
}
|
|
7118
7354
|
),
|
|
7119
7355
|
referenceElements,
|
|
7120
|
-
showCrosshair && crosshairX !== null && /* @__PURE__ */
|
|
7356
|
+
showCrosshair && crosshairX !== null && /* @__PURE__ */ jsx116(
|
|
7121
7357
|
"line",
|
|
7122
7358
|
{
|
|
7123
7359
|
x1: crosshairX,
|
|
@@ -7135,7 +7371,7 @@ var LineChart = ({
|
|
|
7135
7371
|
const { path } = seriesPaths[seriesIndex];
|
|
7136
7372
|
const color = series.color || colors[seriesIndex % colors.length];
|
|
7137
7373
|
const strokeWidth = series.strokeWidth || CHART_DEFAULTS.line.strokeWidth;
|
|
7138
|
-
return /* @__PURE__ */
|
|
7374
|
+
return /* @__PURE__ */ jsx116(
|
|
7139
7375
|
"path",
|
|
7140
7376
|
{
|
|
7141
7377
|
d: path,
|
|
@@ -7160,7 +7396,7 @@ var LineChart = ({
|
|
|
7160
7396
|
return points.map((point, pointIndex) => {
|
|
7161
7397
|
const isHovered = hoveredPoint?.seriesIndex === seriesIndex && hoveredPoint?.pointIndex === pointIndex;
|
|
7162
7398
|
const animateDots = animate && !isResponsive;
|
|
7163
|
-
return /* @__PURE__ */
|
|
7399
|
+
return /* @__PURE__ */ jsx116(
|
|
7164
7400
|
"circle",
|
|
7165
7401
|
{
|
|
7166
7402
|
cx: point.x,
|
|
@@ -7188,8 +7424,8 @@ var LineChart = ({
|
|
|
7188
7424
|
const lastScaled = points[points.length - 1];
|
|
7189
7425
|
const color = series.color || colors[seriesIndex % colors.length];
|
|
7190
7426
|
if (!lastPoint || !lastScaled) return null;
|
|
7191
|
-
return /* @__PURE__ */
|
|
7192
|
-
/* @__PURE__ */
|
|
7427
|
+
return /* @__PURE__ */ jsxs43("g", { children: [
|
|
7428
|
+
/* @__PURE__ */ jsx116(
|
|
7193
7429
|
"circle",
|
|
7194
7430
|
{
|
|
7195
7431
|
cx: chartWidth + 12,
|
|
@@ -7198,7 +7434,7 @@ var LineChart = ({
|
|
|
7198
7434
|
fill: color
|
|
7199
7435
|
}
|
|
7200
7436
|
),
|
|
7201
|
-
/* @__PURE__ */
|
|
7437
|
+
/* @__PURE__ */ jsx116(
|
|
7202
7438
|
"text",
|
|
7203
7439
|
{
|
|
7204
7440
|
x: chartWidth + 22,
|
|
@@ -7212,8 +7448,8 @@ var LineChart = ({
|
|
|
7212
7448
|
)
|
|
7213
7449
|
] }, `label-${seriesIndex}`);
|
|
7214
7450
|
}),
|
|
7215
|
-
showXAxis && /* @__PURE__ */
|
|
7216
|
-
/* @__PURE__ */
|
|
7451
|
+
showXAxis && /* @__PURE__ */ jsxs43("g", { transform: `translate(0, ${chartHeight})`, children: [
|
|
7452
|
+
/* @__PURE__ */ jsx116(
|
|
7217
7453
|
"line",
|
|
7218
7454
|
{
|
|
7219
7455
|
x1: 0,
|
|
@@ -7226,9 +7462,9 @@ var LineChart = ({
|
|
|
7226
7462
|
),
|
|
7227
7463
|
xTicks.map((tick, i) => {
|
|
7228
7464
|
const x = xValueType === "string" ? xScale(tick.value, tick.index) : xScale(xValueType === "date" ? new Date(tick.value) : tick.value, 0);
|
|
7229
|
-
return /* @__PURE__ */
|
|
7230
|
-
/* @__PURE__ */
|
|
7231
|
-
/* @__PURE__ */
|
|
7465
|
+
return /* @__PURE__ */ jsxs43("g", { transform: `translate(${x}, 0)`, children: [
|
|
7466
|
+
/* @__PURE__ */ jsx116("line", { y2: 6, className: "stroke-[hsl(var(--border))]" }),
|
|
7467
|
+
/* @__PURE__ */ jsx116(
|
|
7232
7468
|
"text",
|
|
7233
7469
|
{
|
|
7234
7470
|
y: 20,
|
|
@@ -7240,7 +7476,7 @@ var LineChart = ({
|
|
|
7240
7476
|
)
|
|
7241
7477
|
] }, `x-tick-${i}`);
|
|
7242
7478
|
}),
|
|
7243
|
-
xAxisLabel && /* @__PURE__ */
|
|
7479
|
+
xAxisLabel && /* @__PURE__ */ jsx116(
|
|
7244
7480
|
"text",
|
|
7245
7481
|
{
|
|
7246
7482
|
x: chartWidth / 2,
|
|
@@ -7253,8 +7489,8 @@ var LineChart = ({
|
|
|
7253
7489
|
}
|
|
7254
7490
|
)
|
|
7255
7491
|
] }),
|
|
7256
|
-
showYAxis && /* @__PURE__ */
|
|
7257
|
-
/* @__PURE__ */
|
|
7492
|
+
showYAxis && /* @__PURE__ */ jsxs43("g", { children: [
|
|
7493
|
+
/* @__PURE__ */ jsx116(
|
|
7258
7494
|
"line",
|
|
7259
7495
|
{
|
|
7260
7496
|
x1: 0,
|
|
@@ -7265,9 +7501,9 @@ var LineChart = ({
|
|
|
7265
7501
|
strokeWidth: 1
|
|
7266
7502
|
}
|
|
7267
7503
|
),
|
|
7268
|
-
yTicks.map((tick, i) => /* @__PURE__ */
|
|
7269
|
-
/* @__PURE__ */
|
|
7270
|
-
/* @__PURE__ */
|
|
7504
|
+
yTicks.map((tick, i) => /* @__PURE__ */ jsxs43("g", { transform: `translate(0, ${yScale(tick)})`, children: [
|
|
7505
|
+
/* @__PURE__ */ jsx116("line", { x2: -6, className: "stroke-[hsl(var(--border))]" }),
|
|
7506
|
+
/* @__PURE__ */ jsx116(
|
|
7271
7507
|
"text",
|
|
7272
7508
|
{
|
|
7273
7509
|
x: -12,
|
|
@@ -7279,7 +7515,7 @@ var LineChart = ({
|
|
|
7279
7515
|
}
|
|
7280
7516
|
)
|
|
7281
7517
|
] }, `y-tick-${i}`)),
|
|
7282
|
-
yAxisLabel && /* @__PURE__ */
|
|
7518
|
+
yAxisLabel && /* @__PURE__ */ jsx116(
|
|
7283
7519
|
"text",
|
|
7284
7520
|
{
|
|
7285
7521
|
x: -chartHeight / 2,
|
|
@@ -7294,7 +7530,7 @@ var LineChart = ({
|
|
|
7294
7530
|
)
|
|
7295
7531
|
] })
|
|
7296
7532
|
] }),
|
|
7297
|
-
/* @__PURE__ */
|
|
7533
|
+
/* @__PURE__ */ jsx116("style", { children: `
|
|
7298
7534
|
@keyframes fadeIn {
|
|
7299
7535
|
from { opacity: 0; }
|
|
7300
7536
|
to { opacity: 1; }
|
|
@@ -7303,7 +7539,7 @@ var LineChart = ({
|
|
|
7303
7539
|
]
|
|
7304
7540
|
}
|
|
7305
7541
|
),
|
|
7306
|
-
showLegend && /* @__PURE__ */
|
|
7542
|
+
showLegend && /* @__PURE__ */ jsx116(
|
|
7307
7543
|
Legend,
|
|
7308
7544
|
{
|
|
7309
7545
|
items: legendItems,
|
|
@@ -7311,7 +7547,7 @@ var LineChart = ({
|
|
|
7311
7547
|
align: "center"
|
|
7312
7548
|
}
|
|
7313
7549
|
),
|
|
7314
|
-
showTooltip && /* @__PURE__ */
|
|
7550
|
+
showTooltip && /* @__PURE__ */ jsx116(
|
|
7315
7551
|
ChartTooltip,
|
|
7316
7552
|
{
|
|
7317
7553
|
...tooltipData,
|
|
@@ -7327,8 +7563,8 @@ var LineChart = ({
|
|
|
7327
7563
|
};
|
|
7328
7564
|
|
|
7329
7565
|
// src/charts/BarChart.tsx
|
|
7330
|
-
import
|
|
7331
|
-
import { jsx as
|
|
7566
|
+
import React32, { useMemo as useMemo3, useCallback as useCallback6, useRef as useRef14, useState as useState22 } from "react";
|
|
7567
|
+
import { jsx as jsx117, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
7332
7568
|
var BarChart = ({
|
|
7333
7569
|
data,
|
|
7334
7570
|
width: providedWidth,
|
|
@@ -7364,8 +7600,8 @@ var BarChart = ({
|
|
|
7364
7600
|
colors = CHART_DEFAULTS.colors,
|
|
7365
7601
|
ariaLabel
|
|
7366
7602
|
}) => {
|
|
7367
|
-
const containerRef =
|
|
7368
|
-
const [hoveredBar, setHoveredBar] =
|
|
7603
|
+
const containerRef = useRef14(null);
|
|
7604
|
+
const [hoveredBar, setHoveredBar] = useState22(null);
|
|
7369
7605
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
7370
7606
|
const {
|
|
7371
7607
|
width,
|
|
@@ -7434,7 +7670,7 @@ var BarChart = ({
|
|
|
7434
7670
|
const numSeries = data.length;
|
|
7435
7671
|
const bandwidth = xBandScale.bandwidth();
|
|
7436
7672
|
const barWidth = stacked ? bandwidth : (bandwidth - bandwidth * barGap * (numSeries - 1)) / numSeries;
|
|
7437
|
-
const handleBarEnter =
|
|
7673
|
+
const handleBarEnter = useCallback6((e, seriesIndex, barIndex) => {
|
|
7438
7674
|
const series = data[seriesIndex];
|
|
7439
7675
|
const point = series.data[barIndex];
|
|
7440
7676
|
setHoveredBar({ seriesIndex, barIndex });
|
|
@@ -7457,12 +7693,12 @@ var BarChart = ({
|
|
|
7457
7693
|
}
|
|
7458
7694
|
onBarHover?.(point, seriesIndex, barIndex);
|
|
7459
7695
|
}, [data, showTooltip, colors, showTooltipFn, onBarHover]);
|
|
7460
|
-
const handleBarLeave =
|
|
7696
|
+
const handleBarLeave = useCallback6(() => {
|
|
7461
7697
|
setHoveredBar(null);
|
|
7462
7698
|
hideTooltip();
|
|
7463
7699
|
onBarHover?.(null, -1, -1);
|
|
7464
7700
|
}, [hideTooltip, onBarHover]);
|
|
7465
|
-
const handleBarClick =
|
|
7701
|
+
const handleBarClick = useCallback6((seriesIndex, barIndex) => {
|
|
7466
7702
|
const point = data[seriesIndex].data[barIndex];
|
|
7467
7703
|
onBarClick?.(point, seriesIndex, barIndex);
|
|
7468
7704
|
}, [data, onBarClick]);
|
|
@@ -7514,7 +7750,7 @@ var BarChart = ({
|
|
|
7514
7750
|
}
|
|
7515
7751
|
const isHovered = hoveredBar?.seriesIndex === seriesIndex && hoveredBar?.barIndex === barIndex;
|
|
7516
7752
|
result.push(
|
|
7517
|
-
/* @__PURE__ */
|
|
7753
|
+
/* @__PURE__ */ jsx117(
|
|
7518
7754
|
"rect",
|
|
7519
7755
|
{
|
|
7520
7756
|
x: barX,
|
|
@@ -7542,7 +7778,7 @@ var BarChart = ({
|
|
|
7542
7778
|
const labelX = horizontal ? barX + barW + 8 : barX + barW / 2;
|
|
7543
7779
|
const labelY = horizontal ? barY + barH / 2 : barY - 8;
|
|
7544
7780
|
result.push(
|
|
7545
|
-
/* @__PURE__ */
|
|
7781
|
+
/* @__PURE__ */ jsx117(
|
|
7546
7782
|
"text",
|
|
7547
7783
|
{
|
|
7548
7784
|
x: labelX,
|
|
@@ -7593,10 +7829,10 @@ var BarChart = ({
|
|
|
7593
7829
|
xScale: (value) => xBandScale.scale(String(value)) + bandwidth / 2,
|
|
7594
7830
|
yScale
|
|
7595
7831
|
};
|
|
7596
|
-
return
|
|
7597
|
-
if (!
|
|
7832
|
+
return React32.Children.map(children, (child) => {
|
|
7833
|
+
if (!React32.isValidElement(child)) return child;
|
|
7598
7834
|
if (child.type === ReferenceLine || child.type === ReferenceArea || child.type === CartesianGrid) {
|
|
7599
|
-
return
|
|
7835
|
+
return React32.cloneElement(child, {
|
|
7600
7836
|
_chartDimensions: chartDimensions,
|
|
7601
7837
|
_scales: scales
|
|
7602
7838
|
});
|
|
@@ -7609,14 +7845,14 @@ var BarChart = ({
|
|
|
7609
7845
|
const seriesNames = data.map((s) => s.name).join(", ");
|
|
7610
7846
|
return `Bar chart with ${data.length} series: ${seriesNames}`;
|
|
7611
7847
|
}, [data, ariaLabel]);
|
|
7612
|
-
return /* @__PURE__ */
|
|
7848
|
+
return /* @__PURE__ */ jsxs44(
|
|
7613
7849
|
"div",
|
|
7614
7850
|
{
|
|
7615
7851
|
ref: containerRef,
|
|
7616
7852
|
className: `relative ${className}`,
|
|
7617
7853
|
style: containerStyle,
|
|
7618
7854
|
children: [
|
|
7619
|
-
/* @__PURE__ */
|
|
7855
|
+
/* @__PURE__ */ jsxs44(
|
|
7620
7856
|
"svg",
|
|
7621
7857
|
{
|
|
7622
7858
|
width: svgWidth,
|
|
@@ -7628,7 +7864,7 @@ var BarChart = ({
|
|
|
7628
7864
|
className: "bg-[hsl(var(--card))]",
|
|
7629
7865
|
style: svgStyle,
|
|
7630
7866
|
children: [
|
|
7631
|
-
/* @__PURE__ */
|
|
7867
|
+
/* @__PURE__ */ jsx117("defs", { children: /* @__PURE__ */ jsx117("style", { children: `
|
|
7632
7868
|
@keyframes growY {
|
|
7633
7869
|
from { transform: scaleY(0); }
|
|
7634
7870
|
to { transform: scaleY(1); }
|
|
@@ -7642,8 +7878,8 @@ var BarChart = ({
|
|
|
7642
7878
|
to { opacity: 1; }
|
|
7643
7879
|
}
|
|
7644
7880
|
` }) }),
|
|
7645
|
-
/* @__PURE__ */
|
|
7646
|
-
showGrid && /* @__PURE__ */
|
|
7881
|
+
/* @__PURE__ */ jsxs44("g", { transform: `translate(${padding.left}, ${padding.top})`, children: [
|
|
7882
|
+
showGrid && /* @__PURE__ */ jsx117(
|
|
7647
7883
|
CartesianGrid,
|
|
7648
7884
|
{
|
|
7649
7885
|
_chartDimensions: { width: chartWidth, height: chartHeight },
|
|
@@ -7655,8 +7891,8 @@ var BarChart = ({
|
|
|
7655
7891
|
),
|
|
7656
7892
|
referenceElements,
|
|
7657
7893
|
bars,
|
|
7658
|
-
showXAxis && /* @__PURE__ */
|
|
7659
|
-
/* @__PURE__ */
|
|
7894
|
+
showXAxis && /* @__PURE__ */ jsxs44("g", { transform: `translate(0, ${chartHeight})`, children: [
|
|
7895
|
+
/* @__PURE__ */ jsx117(
|
|
7660
7896
|
"line",
|
|
7661
7897
|
{
|
|
7662
7898
|
x1: 0,
|
|
@@ -7668,9 +7904,9 @@ var BarChart = ({
|
|
|
7668
7904
|
),
|
|
7669
7905
|
categories.map((cat, i) => {
|
|
7670
7906
|
const x = xBandScale.scale(cat) + bandwidth / 2;
|
|
7671
|
-
return /* @__PURE__ */
|
|
7672
|
-
/* @__PURE__ */
|
|
7673
|
-
/* @__PURE__ */
|
|
7907
|
+
return /* @__PURE__ */ jsxs44("g", { transform: `translate(${x}, 0)`, children: [
|
|
7908
|
+
/* @__PURE__ */ jsx117("line", { y2: 6, className: "stroke-[hsl(var(--border))]" }),
|
|
7909
|
+
/* @__PURE__ */ jsx117(
|
|
7674
7910
|
"text",
|
|
7675
7911
|
{
|
|
7676
7912
|
y: 20,
|
|
@@ -7682,7 +7918,7 @@ var BarChart = ({
|
|
|
7682
7918
|
)
|
|
7683
7919
|
] }, `x-tick-${i}`);
|
|
7684
7920
|
}),
|
|
7685
|
-
xAxisLabel && /* @__PURE__ */
|
|
7921
|
+
xAxisLabel && /* @__PURE__ */ jsx117(
|
|
7686
7922
|
"text",
|
|
7687
7923
|
{
|
|
7688
7924
|
x: chartWidth / 2,
|
|
@@ -7695,8 +7931,8 @@ var BarChart = ({
|
|
|
7695
7931
|
}
|
|
7696
7932
|
)
|
|
7697
7933
|
] }),
|
|
7698
|
-
showYAxis && /* @__PURE__ */
|
|
7699
|
-
/* @__PURE__ */
|
|
7934
|
+
showYAxis && /* @__PURE__ */ jsxs44("g", { children: [
|
|
7935
|
+
/* @__PURE__ */ jsx117(
|
|
7700
7936
|
"line",
|
|
7701
7937
|
{
|
|
7702
7938
|
x1: 0,
|
|
@@ -7706,9 +7942,9 @@ var BarChart = ({
|
|
|
7706
7942
|
className: "stroke-[hsl(var(--border))]"
|
|
7707
7943
|
}
|
|
7708
7944
|
),
|
|
7709
|
-
yTicks.map((tick, i) => /* @__PURE__ */
|
|
7710
|
-
/* @__PURE__ */
|
|
7711
|
-
/* @__PURE__ */
|
|
7945
|
+
yTicks.map((tick, i) => /* @__PURE__ */ jsxs44("g", { transform: `translate(0, ${yScale(tick)})`, children: [
|
|
7946
|
+
/* @__PURE__ */ jsx117("line", { x2: -6, className: "stroke-[hsl(var(--border))]" }),
|
|
7947
|
+
/* @__PURE__ */ jsx117(
|
|
7712
7948
|
"text",
|
|
7713
7949
|
{
|
|
7714
7950
|
x: -12,
|
|
@@ -7720,7 +7956,7 @@ var BarChart = ({
|
|
|
7720
7956
|
}
|
|
7721
7957
|
)
|
|
7722
7958
|
] }, `y-tick-${i}`)),
|
|
7723
|
-
yAxisLabel && /* @__PURE__ */
|
|
7959
|
+
yAxisLabel && /* @__PURE__ */ jsx117(
|
|
7724
7960
|
"text",
|
|
7725
7961
|
{
|
|
7726
7962
|
x: -chartHeight / 2,
|
|
@@ -7738,8 +7974,8 @@ var BarChart = ({
|
|
|
7738
7974
|
]
|
|
7739
7975
|
}
|
|
7740
7976
|
),
|
|
7741
|
-
showLegend && /* @__PURE__ */
|
|
7742
|
-
showTooltip && /* @__PURE__ */
|
|
7977
|
+
showLegend && /* @__PURE__ */ jsx117(Legend, { items: legendItems, layout: "horizontal", align: "center" }),
|
|
7978
|
+
showTooltip && /* @__PURE__ */ jsx117(
|
|
7743
7979
|
ChartTooltip,
|
|
7744
7980
|
{
|
|
7745
7981
|
...tooltipData,
|
|
@@ -7753,8 +7989,8 @@ var BarChart = ({
|
|
|
7753
7989
|
};
|
|
7754
7990
|
|
|
7755
7991
|
// src/charts/AreaChart.tsx
|
|
7756
|
-
import
|
|
7757
|
-
import { jsx as
|
|
7992
|
+
import React33, { useMemo as useMemo4, useCallback as useCallback7, useRef as useRef15, useState as useState23, useId as useId2 } from "react";
|
|
7993
|
+
import { jsx as jsx118, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
7758
7994
|
var AreaChart = ({
|
|
7759
7995
|
data,
|
|
7760
7996
|
width: providedWidth,
|
|
@@ -7789,8 +8025,9 @@ var AreaChart = ({
|
|
|
7789
8025
|
colors = CHART_DEFAULTS.colors,
|
|
7790
8026
|
ariaLabel
|
|
7791
8027
|
}) => {
|
|
7792
|
-
const containerRef =
|
|
7793
|
-
const
|
|
8028
|
+
const containerRef = useRef15(null);
|
|
8029
|
+
const chartId = useId2();
|
|
8030
|
+
const [hoveredPoint, setHoveredPoint] = useState23(null);
|
|
7794
8031
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
7795
8032
|
const {
|
|
7796
8033
|
width,
|
|
@@ -7892,7 +8129,7 @@ var AreaChart = ({
|
|
|
7892
8129
|
const ticks = getTicks(xDomainCalc, tickCount);
|
|
7893
8130
|
return ticks.map((t) => ({ value: t, index: 0 }));
|
|
7894
8131
|
}, [xValueType, xDomainCalc, data]);
|
|
7895
|
-
const xFormatter =
|
|
8132
|
+
const xFormatter = useCallback7((value) => {
|
|
7896
8133
|
if (formatXValue) return formatXValue(value);
|
|
7897
8134
|
if (value instanceof Date) {
|
|
7898
8135
|
const range = xDomainCalc[1] - xDomainCalc[0];
|
|
@@ -7938,7 +8175,7 @@ var AreaChart = ({
|
|
|
7938
8175
|
});
|
|
7939
8176
|
return paths;
|
|
7940
8177
|
}, [data, xScale, yScale, stacked, curved]);
|
|
7941
|
-
const handlePointEnter =
|
|
8178
|
+
const handlePointEnter = useCallback7((e, seriesIndex, pointIndex) => {
|
|
7942
8179
|
const series = data[seriesIndex];
|
|
7943
8180
|
const point = series.data[pointIndex];
|
|
7944
8181
|
setHoveredPoint({ seriesIndex, pointIndex });
|
|
@@ -7961,12 +8198,12 @@ var AreaChart = ({
|
|
|
7961
8198
|
}
|
|
7962
8199
|
onPointHover?.(point, seriesIndex, pointIndex);
|
|
7963
8200
|
}, [data, showTooltip, colors, xFormatter, showTooltipFn, onPointHover]);
|
|
7964
|
-
const handlePointLeave =
|
|
8201
|
+
const handlePointLeave = useCallback7(() => {
|
|
7965
8202
|
setHoveredPoint(null);
|
|
7966
8203
|
hideTooltip();
|
|
7967
8204
|
onPointHover?.(null, -1, -1);
|
|
7968
8205
|
}, [hideTooltip, onPointHover]);
|
|
7969
|
-
const handlePointClick =
|
|
8206
|
+
const handlePointClick = useCallback7((seriesIndex, pointIndex) => {
|
|
7970
8207
|
const point = data[seriesIndex].data[pointIndex];
|
|
7971
8208
|
onPointClick?.(point, seriesIndex, pointIndex);
|
|
7972
8209
|
}, [data, onPointClick]);
|
|
@@ -7991,10 +8228,10 @@ var AreaChart = ({
|
|
|
7991
8228
|
},
|
|
7992
8229
|
yScale
|
|
7993
8230
|
};
|
|
7994
|
-
return
|
|
7995
|
-
if (!
|
|
8231
|
+
return React33.Children.map(children, (child) => {
|
|
8232
|
+
if (!React33.isValidElement(child)) return child;
|
|
7996
8233
|
if (child.type === ReferenceLine || child.type === ReferenceArea || child.type === CartesianGrid) {
|
|
7997
|
-
return
|
|
8234
|
+
return React33.cloneElement(child, {
|
|
7998
8235
|
_chartDimensions: chartDimensions,
|
|
7999
8236
|
_scales: scales
|
|
8000
8237
|
});
|
|
@@ -8007,14 +8244,14 @@ var AreaChart = ({
|
|
|
8007
8244
|
const seriesNames = data.map((s) => s.name).join(", ");
|
|
8008
8245
|
return `Area chart with ${data.length} series: ${seriesNames}`;
|
|
8009
8246
|
}, [data, ariaLabel]);
|
|
8010
|
-
return /* @__PURE__ */
|
|
8247
|
+
return /* @__PURE__ */ jsxs45(
|
|
8011
8248
|
"div",
|
|
8012
8249
|
{
|
|
8013
8250
|
ref: containerRef,
|
|
8014
8251
|
className: `relative ${className}`,
|
|
8015
8252
|
style: containerStyle,
|
|
8016
8253
|
children: [
|
|
8017
|
-
/* @__PURE__ */
|
|
8254
|
+
/* @__PURE__ */ jsxs45(
|
|
8018
8255
|
"svg",
|
|
8019
8256
|
{
|
|
8020
8257
|
width: svgWidth,
|
|
@@ -8026,26 +8263,26 @@ var AreaChart = ({
|
|
|
8026
8263
|
className: "bg-[hsl(var(--card))]",
|
|
8027
8264
|
style: svgStyle,
|
|
8028
8265
|
children: [
|
|
8029
|
-
/* @__PURE__ */
|
|
8266
|
+
/* @__PURE__ */ jsxs45("defs", { children: [
|
|
8030
8267
|
data.map((series, i) => {
|
|
8031
8268
|
const color = series.color || colors[i % colors.length];
|
|
8032
|
-
return /* @__PURE__ */
|
|
8269
|
+
return /* @__PURE__ */ jsxs45(
|
|
8033
8270
|
"linearGradient",
|
|
8034
8271
|
{
|
|
8035
|
-
id: `area-gradient-${i}`,
|
|
8272
|
+
id: `area-gradient-${chartId}-${i}`,
|
|
8036
8273
|
x1: "0",
|
|
8037
8274
|
y1: "0",
|
|
8038
8275
|
x2: "0",
|
|
8039
8276
|
y2: "1",
|
|
8040
8277
|
children: [
|
|
8041
|
-
/* @__PURE__ */
|
|
8042
|
-
/* @__PURE__ */
|
|
8278
|
+
/* @__PURE__ */ jsx118("stop", { offset: "0%", stopColor: color, stopOpacity: series.fillOpacity ?? fillOpacity }),
|
|
8279
|
+
/* @__PURE__ */ jsx118("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
|
|
8043
8280
|
]
|
|
8044
8281
|
},
|
|
8045
8282
|
`gradient-${i}`
|
|
8046
8283
|
);
|
|
8047
8284
|
}),
|
|
8048
|
-
/* @__PURE__ */
|
|
8285
|
+
/* @__PURE__ */ jsx118("style", { children: `
|
|
8049
8286
|
@keyframes fadeIn {
|
|
8050
8287
|
from { opacity: 0; }
|
|
8051
8288
|
to { opacity: 1; }
|
|
@@ -8056,8 +8293,8 @@ var AreaChart = ({
|
|
|
8056
8293
|
}
|
|
8057
8294
|
` })
|
|
8058
8295
|
] }),
|
|
8059
|
-
/* @__PURE__ */
|
|
8060
|
-
showGrid && /* @__PURE__ */
|
|
8296
|
+
/* @__PURE__ */ jsxs45("g", { transform: `translate(${padding.left}, ${padding.top})`, children: [
|
|
8297
|
+
showGrid && /* @__PURE__ */ jsx118(
|
|
8061
8298
|
CartesianGrid,
|
|
8062
8299
|
{
|
|
8063
8300
|
_chartDimensions: { width: chartWidth, height: chartHeight },
|
|
@@ -8070,19 +8307,19 @@ var AreaChart = ({
|
|
|
8070
8307
|
const { areaPath, linePath } = areaPaths[seriesIndex];
|
|
8071
8308
|
const color = series.color || colors[seriesIndex % colors.length];
|
|
8072
8309
|
const strokeWidth = series.strokeWidth || CHART_DEFAULTS.line.strokeWidth;
|
|
8073
|
-
return /* @__PURE__ */
|
|
8074
|
-
/* @__PURE__ */
|
|
8310
|
+
return /* @__PURE__ */ jsxs45("g", { children: [
|
|
8311
|
+
/* @__PURE__ */ jsx118(
|
|
8075
8312
|
"path",
|
|
8076
8313
|
{
|
|
8077
8314
|
d: areaPath,
|
|
8078
|
-
fill: `url(#area-gradient-${seriesIndex})`,
|
|
8315
|
+
fill: `url(#area-gradient-${chartId}-${seriesIndex})`,
|
|
8079
8316
|
style: animate ? {
|
|
8080
8317
|
opacity: 0,
|
|
8081
8318
|
animation: `fadeIn ${animationDuration}ms ease-out forwards`
|
|
8082
8319
|
} : void 0
|
|
8083
8320
|
}
|
|
8084
8321
|
),
|
|
8085
|
-
/* @__PURE__ */
|
|
8322
|
+
/* @__PURE__ */ jsx118(
|
|
8086
8323
|
"path",
|
|
8087
8324
|
{
|
|
8088
8325
|
d: linePath,
|
|
@@ -8106,7 +8343,7 @@ var AreaChart = ({
|
|
|
8106
8343
|
if (!showSeriesDots) return null;
|
|
8107
8344
|
return points.map((point, pointIndex) => {
|
|
8108
8345
|
const isHovered = hoveredPoint?.seriesIndex === seriesIndex && hoveredPoint?.pointIndex === pointIndex;
|
|
8109
|
-
return /* @__PURE__ */
|
|
8346
|
+
return /* @__PURE__ */ jsx118(
|
|
8110
8347
|
"circle",
|
|
8111
8348
|
{
|
|
8112
8349
|
cx: point.x,
|
|
@@ -8128,8 +8365,8 @@ var AreaChart = ({
|
|
|
8128
8365
|
);
|
|
8129
8366
|
});
|
|
8130
8367
|
}),
|
|
8131
|
-
showXAxis && /* @__PURE__ */
|
|
8132
|
-
/* @__PURE__ */
|
|
8368
|
+
showXAxis && /* @__PURE__ */ jsxs45("g", { transform: `translate(0, ${chartHeight})`, children: [
|
|
8369
|
+
/* @__PURE__ */ jsx118(
|
|
8133
8370
|
"line",
|
|
8134
8371
|
{
|
|
8135
8372
|
x1: 0,
|
|
@@ -8141,9 +8378,9 @@ var AreaChart = ({
|
|
|
8141
8378
|
),
|
|
8142
8379
|
xTicks.map((tick, i) => {
|
|
8143
8380
|
const x = xValueType === "string" ? xScale(tick.value, tick.index) : xScale(xValueType === "date" ? new Date(tick.value) : tick.value, 0);
|
|
8144
|
-
return /* @__PURE__ */
|
|
8145
|
-
/* @__PURE__ */
|
|
8146
|
-
/* @__PURE__ */
|
|
8381
|
+
return /* @__PURE__ */ jsxs45("g", { transform: `translate(${x}, 0)`, children: [
|
|
8382
|
+
/* @__PURE__ */ jsx118("line", { y2: 6, className: "stroke-[hsl(var(--border))]" }),
|
|
8383
|
+
/* @__PURE__ */ jsx118(
|
|
8147
8384
|
"text",
|
|
8148
8385
|
{
|
|
8149
8386
|
y: 20,
|
|
@@ -8155,7 +8392,7 @@ var AreaChart = ({
|
|
|
8155
8392
|
)
|
|
8156
8393
|
] }, `x-tick-${i}`);
|
|
8157
8394
|
}),
|
|
8158
|
-
xAxisLabel && /* @__PURE__ */
|
|
8395
|
+
xAxisLabel && /* @__PURE__ */ jsx118(
|
|
8159
8396
|
"text",
|
|
8160
8397
|
{
|
|
8161
8398
|
x: chartWidth / 2,
|
|
@@ -8168,8 +8405,8 @@ var AreaChart = ({
|
|
|
8168
8405
|
}
|
|
8169
8406
|
)
|
|
8170
8407
|
] }),
|
|
8171
|
-
showYAxis && /* @__PURE__ */
|
|
8172
|
-
/* @__PURE__ */
|
|
8408
|
+
showYAxis && /* @__PURE__ */ jsxs45("g", { children: [
|
|
8409
|
+
/* @__PURE__ */ jsx118(
|
|
8173
8410
|
"line",
|
|
8174
8411
|
{
|
|
8175
8412
|
x1: 0,
|
|
@@ -8179,9 +8416,9 @@ var AreaChart = ({
|
|
|
8179
8416
|
className: "stroke-[hsl(var(--border))]"
|
|
8180
8417
|
}
|
|
8181
8418
|
),
|
|
8182
|
-
yTicks.map((tick, i) => /* @__PURE__ */
|
|
8183
|
-
/* @__PURE__ */
|
|
8184
|
-
/* @__PURE__ */
|
|
8419
|
+
yTicks.map((tick, i) => /* @__PURE__ */ jsxs45("g", { transform: `translate(0, ${yScale(tick)})`, children: [
|
|
8420
|
+
/* @__PURE__ */ jsx118("line", { x2: -6, className: "stroke-[hsl(var(--border))]" }),
|
|
8421
|
+
/* @__PURE__ */ jsx118(
|
|
8185
8422
|
"text",
|
|
8186
8423
|
{
|
|
8187
8424
|
x: -12,
|
|
@@ -8193,7 +8430,7 @@ var AreaChart = ({
|
|
|
8193
8430
|
}
|
|
8194
8431
|
)
|
|
8195
8432
|
] }, `y-tick-${i}`)),
|
|
8196
|
-
yAxisLabel && /* @__PURE__ */
|
|
8433
|
+
yAxisLabel && /* @__PURE__ */ jsx118(
|
|
8197
8434
|
"text",
|
|
8198
8435
|
{
|
|
8199
8436
|
x: -chartHeight / 2,
|
|
@@ -8211,8 +8448,8 @@ var AreaChart = ({
|
|
|
8211
8448
|
]
|
|
8212
8449
|
}
|
|
8213
8450
|
),
|
|
8214
|
-
showLegend && /* @__PURE__ */
|
|
8215
|
-
showTooltip && /* @__PURE__ */
|
|
8451
|
+
showLegend && /* @__PURE__ */ jsx118(Legend, { items: legendItems, layout: "horizontal", align: "center" }),
|
|
8452
|
+
showTooltip && /* @__PURE__ */ jsx118(
|
|
8216
8453
|
ChartTooltip,
|
|
8217
8454
|
{
|
|
8218
8455
|
...tooltipData,
|
|
@@ -8226,8 +8463,8 @@ var AreaChart = ({
|
|
|
8226
8463
|
};
|
|
8227
8464
|
|
|
8228
8465
|
// src/charts/PieChart.tsx
|
|
8229
|
-
import { useMemo as useMemo5, useCallback as
|
|
8230
|
-
import { jsx as
|
|
8466
|
+
import { useMemo as useMemo5, useCallback as useCallback8, useRef as useRef16, useState as useState24 } from "react";
|
|
8467
|
+
import { jsx as jsx119, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
8231
8468
|
var PieChart = ({
|
|
8232
8469
|
data,
|
|
8233
8470
|
width: providedWidth,
|
|
@@ -8260,9 +8497,9 @@ var PieChart = ({
|
|
|
8260
8497
|
colors = CHART_DEFAULTS.colors,
|
|
8261
8498
|
ariaLabel
|
|
8262
8499
|
}) => {
|
|
8263
|
-
const containerRef =
|
|
8264
|
-
const [hoveredSlice, setHoveredSlice] =
|
|
8265
|
-
const [activeSlice, setActiveSlice] =
|
|
8500
|
+
const containerRef = useRef16(null);
|
|
8501
|
+
const [hoveredSlice, setHoveredSlice] = useState24(null);
|
|
8502
|
+
const [activeSlice, setActiveSlice] = useState24(null);
|
|
8266
8503
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
8267
8504
|
const {
|
|
8268
8505
|
width,
|
|
@@ -8329,7 +8566,7 @@ var PieChart = ({
|
|
|
8329
8566
|
};
|
|
8330
8567
|
});
|
|
8331
8568
|
}, [data, total, startAngle, endAngle, paddingAngle, centerX, centerY, outerRadius, innerRadius, isDonut, colors]);
|
|
8332
|
-
const handleSliceEnter =
|
|
8569
|
+
const handleSliceEnter = useCallback8((e, index) => {
|
|
8333
8570
|
const slice = slices[index];
|
|
8334
8571
|
setHoveredSlice(index);
|
|
8335
8572
|
if (showTooltip && containerRef.current) {
|
|
@@ -8351,16 +8588,16 @@ var PieChart = ({
|
|
|
8351
8588
|
}
|
|
8352
8589
|
onSliceHover?.(data[index], index);
|
|
8353
8590
|
}, [slices, data, showTooltip, showTooltipFn, onSliceHover]);
|
|
8354
|
-
const handleSliceLeave =
|
|
8591
|
+
const handleSliceLeave = useCallback8(() => {
|
|
8355
8592
|
setHoveredSlice(null);
|
|
8356
8593
|
hideTooltip();
|
|
8357
8594
|
onSliceHover?.(null, -1);
|
|
8358
8595
|
}, [hideTooltip, onSliceHover]);
|
|
8359
|
-
const handleSliceClick =
|
|
8596
|
+
const handleSliceClick = useCallback8((index) => {
|
|
8360
8597
|
setActiveSlice((prev) => prev === index ? null : index);
|
|
8361
8598
|
onSliceClick?.(data[index], index);
|
|
8362
8599
|
}, [data, onSliceClick]);
|
|
8363
|
-
const getLabelText =
|
|
8600
|
+
const getLabelText = useCallback8((slice) => {
|
|
8364
8601
|
if (labelFormatter) {
|
|
8365
8602
|
return labelFormatter(data[slice.index], slice.percent);
|
|
8366
8603
|
}
|
|
@@ -8388,14 +8625,14 @@ var PieChart = ({
|
|
|
8388
8625
|
const sliceNames = data.map((d) => `${d.label}: ${d.value}`).join(", ");
|
|
8389
8626
|
return `${isDonut ? "Donut" : "Pie"} chart with ${data.length} slices: ${sliceNames}`;
|
|
8390
8627
|
}, [data, isDonut, ariaLabel]);
|
|
8391
|
-
return /* @__PURE__ */
|
|
8628
|
+
return /* @__PURE__ */ jsxs46(
|
|
8392
8629
|
"div",
|
|
8393
8630
|
{
|
|
8394
8631
|
ref: containerRef,
|
|
8395
8632
|
className: `relative inline-flex flex-col items-center ${className}`,
|
|
8396
8633
|
style: containerStyle,
|
|
8397
8634
|
children: [
|
|
8398
|
-
/* @__PURE__ */
|
|
8635
|
+
/* @__PURE__ */ jsxs46(
|
|
8399
8636
|
"svg",
|
|
8400
8637
|
{
|
|
8401
8638
|
width: svgWidth,
|
|
@@ -8407,7 +8644,7 @@ var PieChart = ({
|
|
|
8407
8644
|
className: "bg-[hsl(var(--card))]",
|
|
8408
8645
|
style: svgStyle,
|
|
8409
8646
|
children: [
|
|
8410
|
-
/* @__PURE__ */
|
|
8647
|
+
/* @__PURE__ */ jsx119("defs", { children: /* @__PURE__ */ jsx119("style", { children: `
|
|
8411
8648
|
@keyframes rotateIn {
|
|
8412
8649
|
from {
|
|
8413
8650
|
transform: rotate(-90deg);
|
|
@@ -8423,7 +8660,7 @@ var PieChart = ({
|
|
|
8423
8660
|
to { opacity: 1; }
|
|
8424
8661
|
}
|
|
8425
8662
|
` }) }),
|
|
8426
|
-
/* @__PURE__ */
|
|
8663
|
+
/* @__PURE__ */ jsx119("g", { style: animate ? {
|
|
8427
8664
|
transformOrigin: `${centerX}px ${centerY}px`,
|
|
8428
8665
|
animation: `rotateIn ${animationDuration}ms ease-out forwards`
|
|
8429
8666
|
} : void 0, children: slices.map((slice) => {
|
|
@@ -8431,8 +8668,8 @@ var PieChart = ({
|
|
|
8431
8668
|
const isActive = activeSlice === slice.index;
|
|
8432
8669
|
const scale = isHovered || isActive ? 1.03 : 1;
|
|
8433
8670
|
const transform = `translate(${centerX}px, ${centerY}px) scale(${scale}) translate(${-centerX}px, ${-centerY}px)`;
|
|
8434
|
-
return /* @__PURE__ */
|
|
8435
|
-
/* @__PURE__ */
|
|
8671
|
+
return /* @__PURE__ */ jsxs46("g", { children: [
|
|
8672
|
+
/* @__PURE__ */ jsx119(
|
|
8436
8673
|
"path",
|
|
8437
8674
|
{
|
|
8438
8675
|
d: slice.path,
|
|
@@ -8446,7 +8683,7 @@ var PieChart = ({
|
|
|
8446
8683
|
onClick: () => handleSliceClick(slice.index)
|
|
8447
8684
|
}
|
|
8448
8685
|
),
|
|
8449
|
-
showLabels && slice.percent >= minLabelPercent && /* @__PURE__ */
|
|
8686
|
+
showLabels && slice.percent >= minLabelPercent && /* @__PURE__ */ jsx119(
|
|
8450
8687
|
"text",
|
|
8451
8688
|
{
|
|
8452
8689
|
x: slice.labelX,
|
|
@@ -8465,8 +8702,8 @@ var PieChart = ({
|
|
|
8465
8702
|
)
|
|
8466
8703
|
] }, slice.index);
|
|
8467
8704
|
}) }),
|
|
8468
|
-
isDonut && (centerLabel || centerValue !== void 0) && /* @__PURE__ */
|
|
8469
|
-
centerValue !== void 0 && /* @__PURE__ */
|
|
8705
|
+
isDonut && (centerLabel || centerValue !== void 0) && /* @__PURE__ */ jsxs46("g", { children: [
|
|
8706
|
+
centerValue !== void 0 && /* @__PURE__ */ jsx119(
|
|
8470
8707
|
"text",
|
|
8471
8708
|
{
|
|
8472
8709
|
x: centerX,
|
|
@@ -8479,7 +8716,7 @@ var PieChart = ({
|
|
|
8479
8716
|
children: typeof centerValue === "number" ? formatNumber(centerValue) : centerValue
|
|
8480
8717
|
}
|
|
8481
8718
|
),
|
|
8482
|
-
centerLabel && (typeof centerLabel === "string" ? /* @__PURE__ */
|
|
8719
|
+
centerLabel && (typeof centerLabel === "string" ? /* @__PURE__ */ jsx119(
|
|
8483
8720
|
"text",
|
|
8484
8721
|
{
|
|
8485
8722
|
x: centerX,
|
|
@@ -8490,7 +8727,7 @@ var PieChart = ({
|
|
|
8490
8727
|
className: "fill-[hsl(var(--muted-foreground))]",
|
|
8491
8728
|
children: centerLabel
|
|
8492
8729
|
}
|
|
8493
|
-
) : /* @__PURE__ */
|
|
8730
|
+
) : /* @__PURE__ */ jsx119(
|
|
8494
8731
|
"foreignObject",
|
|
8495
8732
|
{
|
|
8496
8733
|
x: centerX - innerRadius * 0.7,
|
|
@@ -8504,7 +8741,7 @@ var PieChart = ({
|
|
|
8504
8741
|
]
|
|
8505
8742
|
}
|
|
8506
8743
|
),
|
|
8507
|
-
showLegend && /* @__PURE__ */
|
|
8744
|
+
showLegend && /* @__PURE__ */ jsx119(
|
|
8508
8745
|
Legend,
|
|
8509
8746
|
{
|
|
8510
8747
|
items: legendItems,
|
|
@@ -8515,7 +8752,7 @@ var PieChart = ({
|
|
|
8515
8752
|
onMouseLeave: () => setHoveredSlice(null)
|
|
8516
8753
|
}
|
|
8517
8754
|
),
|
|
8518
|
-
showTooltip && /* @__PURE__ */
|
|
8755
|
+
showTooltip && /* @__PURE__ */ jsx119(
|
|
8519
8756
|
ChartTooltip,
|
|
8520
8757
|
{
|
|
8521
8758
|
...tooltipData,
|
|
@@ -8529,8 +8766,8 @@ var PieChart = ({
|
|
|
8529
8766
|
};
|
|
8530
8767
|
|
|
8531
8768
|
// src/charts/ScatterChart.tsx
|
|
8532
|
-
import
|
|
8533
|
-
import { jsx as
|
|
8769
|
+
import React35, { useMemo as useMemo6, useCallback as useCallback9, useRef as useRef17, useState as useState25 } from "react";
|
|
8770
|
+
import { jsx as jsx120, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
8534
8771
|
function linearRegression(points) {
|
|
8535
8772
|
const n = points.length;
|
|
8536
8773
|
if (n === 0) return { slope: 0, intercept: 0 };
|
|
@@ -8551,7 +8788,7 @@ var renderShape = (shape, x, y, size, color, commonProps) => {
|
|
|
8551
8788
|
const { className, stroke, strokeWidth, onMouseEnter, onMouseLeave, onClick } = commonProps;
|
|
8552
8789
|
switch (shape) {
|
|
8553
8790
|
case "square":
|
|
8554
|
-
return /* @__PURE__ */
|
|
8791
|
+
return /* @__PURE__ */ jsx120(
|
|
8555
8792
|
"rect",
|
|
8556
8793
|
{
|
|
8557
8794
|
x: x - size / 2,
|
|
@@ -8570,7 +8807,7 @@ var renderShape = (shape, x, y, size, color, commonProps) => {
|
|
|
8570
8807
|
case "triangle": {
|
|
8571
8808
|
const h = size * 0.866;
|
|
8572
8809
|
const points = `${x},${y - h / 2} ${x - size / 2},${y + h / 2} ${x + size / 2},${y + h / 2}`;
|
|
8573
|
-
return /* @__PURE__ */
|
|
8810
|
+
return /* @__PURE__ */ jsx120(
|
|
8574
8811
|
"polygon",
|
|
8575
8812
|
{
|
|
8576
8813
|
points,
|
|
@@ -8587,7 +8824,7 @@ var renderShape = (shape, x, y, size, color, commonProps) => {
|
|
|
8587
8824
|
case "diamond": {
|
|
8588
8825
|
const d = size / 1.414;
|
|
8589
8826
|
const diamondPoints = `${x},${y - d} ${x + d},${y} ${x},${y + d} ${x - d},${y}`;
|
|
8590
|
-
return /* @__PURE__ */
|
|
8827
|
+
return /* @__PURE__ */ jsx120(
|
|
8591
8828
|
"polygon",
|
|
8592
8829
|
{
|
|
8593
8830
|
points: diamondPoints,
|
|
@@ -8603,7 +8840,7 @@ var renderShape = (shape, x, y, size, color, commonProps) => {
|
|
|
8603
8840
|
}
|
|
8604
8841
|
case "circle":
|
|
8605
8842
|
default:
|
|
8606
|
-
return /* @__PURE__ */
|
|
8843
|
+
return /* @__PURE__ */ jsx120(
|
|
8607
8844
|
"circle",
|
|
8608
8845
|
{
|
|
8609
8846
|
cx: x,
|
|
@@ -8657,8 +8894,8 @@ var ScatterChart = ({
|
|
|
8657
8894
|
colors = CHART_DEFAULTS.colors,
|
|
8658
8895
|
ariaLabel
|
|
8659
8896
|
}) => {
|
|
8660
|
-
const containerRef =
|
|
8661
|
-
const [hoveredPoint, setHoveredPoint] =
|
|
8897
|
+
const containerRef = useRef17(null);
|
|
8898
|
+
const [hoveredPoint, setHoveredPoint] = useState25(null);
|
|
8662
8899
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
8663
8900
|
const {
|
|
8664
8901
|
width,
|
|
@@ -8745,7 +8982,7 @@ var ScatterChart = ({
|
|
|
8745
8982
|
};
|
|
8746
8983
|
});
|
|
8747
8984
|
}, [data, showTrendLine, xDomainCalc, xScale, yScale]);
|
|
8748
|
-
const handlePointEnter =
|
|
8985
|
+
const handlePointEnter = useCallback9((e, seriesIndex, pointIndex) => {
|
|
8749
8986
|
const series = data[seriesIndex];
|
|
8750
8987
|
const point = series.data[pointIndex];
|
|
8751
8988
|
setHoveredPoint({ seriesIndex, pointIndex });
|
|
@@ -8769,12 +9006,12 @@ var ScatterChart = ({
|
|
|
8769
9006
|
}
|
|
8770
9007
|
onPointHover?.(point, seriesIndex, pointIndex);
|
|
8771
9008
|
}, [data, showTooltip, colors, bubble, showTooltipFn, onPointHover]);
|
|
8772
|
-
const handlePointLeave =
|
|
9009
|
+
const handlePointLeave = useCallback9(() => {
|
|
8773
9010
|
setHoveredPoint(null);
|
|
8774
9011
|
hideTooltip();
|
|
8775
9012
|
onPointHover?.(null, -1, -1);
|
|
8776
9013
|
}, [hideTooltip, onPointHover]);
|
|
8777
|
-
const handlePointClick =
|
|
9014
|
+
const handlePointClick = useCallback9((seriesIndex, pointIndex) => {
|
|
8778
9015
|
const point = data[seriesIndex].data[pointIndex];
|
|
8779
9016
|
onPointClick?.(point, seriesIndex, pointIndex);
|
|
8780
9017
|
}, [data, onPointClick]);
|
|
@@ -8790,10 +9027,10 @@ var ScatterChart = ({
|
|
|
8790
9027
|
if (!children) return null;
|
|
8791
9028
|
const chartDimensions = { width: chartWidth, height: chartHeight, padding };
|
|
8792
9029
|
const scales = { xScale, yScale };
|
|
8793
|
-
return
|
|
8794
|
-
if (!
|
|
9030
|
+
return React35.Children.map(children, (child) => {
|
|
9031
|
+
if (!React35.isValidElement(child)) return child;
|
|
8795
9032
|
if (child.type === ReferenceLine || child.type === ReferenceArea || child.type === CartesianGrid) {
|
|
8796
|
-
return
|
|
9033
|
+
return React35.cloneElement(child, {
|
|
8797
9034
|
_chartDimensions: chartDimensions,
|
|
8798
9035
|
_scales: scales
|
|
8799
9036
|
});
|
|
@@ -8806,14 +9043,14 @@ var ScatterChart = ({
|
|
|
8806
9043
|
const totalPoints = data.reduce((sum, s) => sum + s.data.length, 0);
|
|
8807
9044
|
return `Scatter chart with ${data.length} series and ${totalPoints} data points`;
|
|
8808
9045
|
}, [data, ariaLabel]);
|
|
8809
|
-
return /* @__PURE__ */
|
|
9046
|
+
return /* @__PURE__ */ jsxs47(
|
|
8810
9047
|
"div",
|
|
8811
9048
|
{
|
|
8812
9049
|
ref: containerRef,
|
|
8813
9050
|
className: `relative ${className}`,
|
|
8814
9051
|
style: containerStyle,
|
|
8815
9052
|
children: [
|
|
8816
|
-
/* @__PURE__ */
|
|
9053
|
+
/* @__PURE__ */ jsxs47(
|
|
8817
9054
|
"svg",
|
|
8818
9055
|
{
|
|
8819
9056
|
width: svgWidth,
|
|
@@ -8825,7 +9062,7 @@ var ScatterChart = ({
|
|
|
8825
9062
|
className: "bg-[hsl(var(--card))]",
|
|
8826
9063
|
style: svgStyle,
|
|
8827
9064
|
children: [
|
|
8828
|
-
/* @__PURE__ */
|
|
9065
|
+
/* @__PURE__ */ jsx120("defs", { children: /* @__PURE__ */ jsx120("style", { children: `
|
|
8829
9066
|
@keyframes popIn {
|
|
8830
9067
|
from {
|
|
8831
9068
|
transform: scale(0);
|
|
@@ -8837,8 +9074,8 @@ var ScatterChart = ({
|
|
|
8837
9074
|
}
|
|
8838
9075
|
}
|
|
8839
9076
|
` }) }),
|
|
8840
|
-
/* @__PURE__ */
|
|
8841
|
-
showGrid && /* @__PURE__ */
|
|
9077
|
+
/* @__PURE__ */ jsxs47("g", { transform: `translate(${padding.left}, ${padding.top})`, children: [
|
|
9078
|
+
showGrid && /* @__PURE__ */ jsx120(
|
|
8842
9079
|
CartesianGrid,
|
|
8843
9080
|
{
|
|
8844
9081
|
_chartDimensions: { width: chartWidth, height: chartHeight },
|
|
@@ -8847,7 +9084,7 @@ var ScatterChart = ({
|
|
|
8847
9084
|
}
|
|
8848
9085
|
),
|
|
8849
9086
|
referenceElements,
|
|
8850
|
-
showTrendLine && trendLines.map((line, i) => /* @__PURE__ */
|
|
9087
|
+
showTrendLine && trendLines.map((line, i) => /* @__PURE__ */ jsx120(
|
|
8851
9088
|
"line",
|
|
8852
9089
|
{
|
|
8853
9090
|
x1: line.x1,
|
|
@@ -8871,7 +9108,7 @@ var ScatterChart = ({
|
|
|
8871
9108
|
const size = bubble && point.z !== void 0 ? sizeScale(point.z) : baseSize;
|
|
8872
9109
|
const isHovered = hoveredPoint?.seriesIndex === seriesIndex && hoveredPoint?.pointIndex === pointIndex;
|
|
8873
9110
|
const displaySize = isHovered ? size * 1.3 : size;
|
|
8874
|
-
return /* @__PURE__ */
|
|
9111
|
+
return /* @__PURE__ */ jsx120(
|
|
8875
9112
|
"g",
|
|
8876
9113
|
{
|
|
8877
9114
|
style: animate ? {
|
|
@@ -8892,8 +9129,8 @@ var ScatterChart = ({
|
|
|
8892
9129
|
);
|
|
8893
9130
|
});
|
|
8894
9131
|
}),
|
|
8895
|
-
showXAxis && /* @__PURE__ */
|
|
8896
|
-
/* @__PURE__ */
|
|
9132
|
+
showXAxis && /* @__PURE__ */ jsxs47("g", { transform: `translate(0, ${chartHeight})`, children: [
|
|
9133
|
+
/* @__PURE__ */ jsx120(
|
|
8897
9134
|
"line",
|
|
8898
9135
|
{
|
|
8899
9136
|
x1: 0,
|
|
@@ -8903,9 +9140,9 @@ var ScatterChart = ({
|
|
|
8903
9140
|
className: "stroke-[hsl(var(--border))]"
|
|
8904
9141
|
}
|
|
8905
9142
|
),
|
|
8906
|
-
xTicks.map((tick, i) => /* @__PURE__ */
|
|
8907
|
-
/* @__PURE__ */
|
|
8908
|
-
/* @__PURE__ */
|
|
9143
|
+
xTicks.map((tick, i) => /* @__PURE__ */ jsxs47("g", { transform: `translate(${xScale(tick)}, 0)`, children: [
|
|
9144
|
+
/* @__PURE__ */ jsx120("line", { y2: 6, className: "stroke-[hsl(var(--border))]" }),
|
|
9145
|
+
/* @__PURE__ */ jsx120(
|
|
8909
9146
|
"text",
|
|
8910
9147
|
{
|
|
8911
9148
|
y: 20,
|
|
@@ -8916,7 +9153,7 @@ var ScatterChart = ({
|
|
|
8916
9153
|
}
|
|
8917
9154
|
)
|
|
8918
9155
|
] }, `x-tick-${i}`)),
|
|
8919
|
-
xAxisLabel && /* @__PURE__ */
|
|
9156
|
+
xAxisLabel && /* @__PURE__ */ jsx120(
|
|
8920
9157
|
"text",
|
|
8921
9158
|
{
|
|
8922
9159
|
x: chartWidth / 2,
|
|
@@ -8929,8 +9166,8 @@ var ScatterChart = ({
|
|
|
8929
9166
|
}
|
|
8930
9167
|
)
|
|
8931
9168
|
] }),
|
|
8932
|
-
showYAxis && /* @__PURE__ */
|
|
8933
|
-
/* @__PURE__ */
|
|
9169
|
+
showYAxis && /* @__PURE__ */ jsxs47("g", { children: [
|
|
9170
|
+
/* @__PURE__ */ jsx120(
|
|
8934
9171
|
"line",
|
|
8935
9172
|
{
|
|
8936
9173
|
x1: 0,
|
|
@@ -8940,9 +9177,9 @@ var ScatterChart = ({
|
|
|
8940
9177
|
className: "stroke-[hsl(var(--border))]"
|
|
8941
9178
|
}
|
|
8942
9179
|
),
|
|
8943
|
-
yTicks.map((tick, i) => /* @__PURE__ */
|
|
8944
|
-
/* @__PURE__ */
|
|
8945
|
-
/* @__PURE__ */
|
|
9180
|
+
yTicks.map((tick, i) => /* @__PURE__ */ jsxs47("g", { transform: `translate(0, ${yScale(tick)})`, children: [
|
|
9181
|
+
/* @__PURE__ */ jsx120("line", { x2: -6, className: "stroke-[hsl(var(--border))]" }),
|
|
9182
|
+
/* @__PURE__ */ jsx120(
|
|
8946
9183
|
"text",
|
|
8947
9184
|
{
|
|
8948
9185
|
x: -12,
|
|
@@ -8954,7 +9191,7 @@ var ScatterChart = ({
|
|
|
8954
9191
|
}
|
|
8955
9192
|
)
|
|
8956
9193
|
] }, `y-tick-${i}`)),
|
|
8957
|
-
yAxisLabel && /* @__PURE__ */
|
|
9194
|
+
yAxisLabel && /* @__PURE__ */ jsx120(
|
|
8958
9195
|
"text",
|
|
8959
9196
|
{
|
|
8960
9197
|
x: -chartHeight / 2,
|
|
@@ -8972,8 +9209,8 @@ var ScatterChart = ({
|
|
|
8972
9209
|
]
|
|
8973
9210
|
}
|
|
8974
9211
|
),
|
|
8975
|
-
showLegend && /* @__PURE__ */
|
|
8976
|
-
showTooltip && /* @__PURE__ */
|
|
9212
|
+
showLegend && /* @__PURE__ */ jsx120(Legend, { items: legendItems, layout: "horizontal", align: "center" }),
|
|
9213
|
+
showTooltip && /* @__PURE__ */ jsx120(
|
|
8977
9214
|
ChartTooltip,
|
|
8978
9215
|
{
|
|
8979
9216
|
...tooltipData,
|
|
@@ -8987,8 +9224,8 @@ var ScatterChart = ({
|
|
|
8987
9224
|
};
|
|
8988
9225
|
|
|
8989
9226
|
// src/charts/components/ResponsiveContainer.tsx
|
|
8990
|
-
import
|
|
8991
|
-
import { jsx as
|
|
9227
|
+
import React36, { useRef as useRef18, useState as useState26, useEffect as useEffect15, useCallback as useCallback10 } from "react";
|
|
9228
|
+
import { jsx as jsx121 } from "react/jsx-runtime";
|
|
8992
9229
|
var ResponsiveContainer = ({
|
|
8993
9230
|
width = "100%",
|
|
8994
9231
|
height,
|
|
@@ -9002,13 +9239,13 @@ var ResponsiveContainer = ({
|
|
|
9002
9239
|
children,
|
|
9003
9240
|
onResize
|
|
9004
9241
|
}) => {
|
|
9005
|
-
const containerRef =
|
|
9006
|
-
const [dimensions, setDimensions] =
|
|
9242
|
+
const containerRef = useRef18(null);
|
|
9243
|
+
const [dimensions, setDimensions] = useState26({
|
|
9007
9244
|
width: 0,
|
|
9008
9245
|
height: 0
|
|
9009
9246
|
});
|
|
9010
|
-
const debounceTimerRef =
|
|
9011
|
-
const calculateDimensions =
|
|
9247
|
+
const debounceTimerRef = useRef18(null);
|
|
9248
|
+
const calculateDimensions = useCallback10((containerWidth, containerHeight) => {
|
|
9012
9249
|
let finalWidth = containerWidth;
|
|
9013
9250
|
let finalHeight = containerHeight;
|
|
9014
9251
|
if (aspect && !height) {
|
|
@@ -9024,7 +9261,7 @@ var ResponsiveContainer = ({
|
|
|
9024
9261
|
}
|
|
9025
9262
|
return { width: finalWidth, height: finalHeight };
|
|
9026
9263
|
}, [aspect, height, minWidth, minHeight, maxWidth, maxHeight]);
|
|
9027
|
-
const handleResize =
|
|
9264
|
+
const handleResize = useCallback10((entries) => {
|
|
9028
9265
|
const entry = entries[0];
|
|
9029
9266
|
if (!entry) return;
|
|
9030
9267
|
const { width: containerWidth, height: containerHeight } = entry.contentRect;
|
|
@@ -9042,7 +9279,7 @@ var ResponsiveContainer = ({
|
|
|
9042
9279
|
updateDimensions();
|
|
9043
9280
|
}
|
|
9044
9281
|
}, [calculateDimensions, debounce, onResize]);
|
|
9045
|
-
|
|
9282
|
+
useEffect15(() => {
|
|
9046
9283
|
const container = containerRef.current;
|
|
9047
9284
|
if (!container) return;
|
|
9048
9285
|
const observer = new ResizeObserver(handleResize);
|
|
@@ -9066,7 +9303,7 @@ var ResponsiveContainer = ({
|
|
|
9066
9303
|
maxHeight: maxHeight ? `${maxHeight}px` : void 0
|
|
9067
9304
|
};
|
|
9068
9305
|
if (dimensions.width === 0 || dimensions.height === 0) {
|
|
9069
|
-
return /* @__PURE__ */
|
|
9306
|
+
return /* @__PURE__ */ jsx121(
|
|
9070
9307
|
"div",
|
|
9071
9308
|
{
|
|
9072
9309
|
ref: containerRef,
|
|
@@ -9075,14 +9312,14 @@ var ResponsiveContainer = ({
|
|
|
9075
9312
|
}
|
|
9076
9313
|
);
|
|
9077
9314
|
}
|
|
9078
|
-
const chartElement =
|
|
9315
|
+
const chartElement = React36.cloneElement(
|
|
9079
9316
|
children,
|
|
9080
9317
|
{
|
|
9081
9318
|
width: dimensions.width,
|
|
9082
9319
|
height: dimensions.height
|
|
9083
9320
|
}
|
|
9084
9321
|
);
|
|
9085
|
-
return /* @__PURE__ */
|
|
9322
|
+
return /* @__PURE__ */ jsx121(
|
|
9086
9323
|
"div",
|
|
9087
9324
|
{
|
|
9088
9325
|
ref: containerRef,
|
|
@@ -9094,8 +9331,8 @@ var ResponsiveContainer = ({
|
|
|
9094
9331
|
};
|
|
9095
9332
|
|
|
9096
9333
|
// src/components/Heatmap.tsx
|
|
9097
|
-
import
|
|
9098
|
-
import { jsx as
|
|
9334
|
+
import React37, { useMemo as useMemo7, useState as useState27 } from "react";
|
|
9335
|
+
import { jsx as jsx122, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
9099
9336
|
var COLOR_SCALES = {
|
|
9100
9337
|
blue: {
|
|
9101
9338
|
light: ["#eff6ff", "#dbeafe", "#bfdbfe", "#93c5fd", "#60a5fa", "#3b82f6", "#2563eb", "#1d4ed8", "#1e40af"],
|
|
@@ -9138,9 +9375,9 @@ var Heatmap = ({
|
|
|
9138
9375
|
formatValue = (v) => v.toFixed(0),
|
|
9139
9376
|
formatTooltip
|
|
9140
9377
|
}) => {
|
|
9141
|
-
const [hoveredCell, setHoveredCell] =
|
|
9142
|
-
const [isDarkMode, setIsDarkMode] =
|
|
9143
|
-
|
|
9378
|
+
const [hoveredCell, setHoveredCell] = useState27(null);
|
|
9379
|
+
const [isDarkMode, setIsDarkMode] = useState27(false);
|
|
9380
|
+
React37.useEffect(() => {
|
|
9144
9381
|
const checkDarkMode = () => {
|
|
9145
9382
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
9146
9383
|
};
|
|
@@ -9200,15 +9437,15 @@ var Heatmap = ({
|
|
|
9200
9437
|
const labelHeight = 30;
|
|
9201
9438
|
const width = labelWidth + uniqueX.length * (cellSize + cellGap);
|
|
9202
9439
|
const height = labelHeight + uniqueY.length * (cellSize + cellGap);
|
|
9203
|
-
return /* @__PURE__ */
|
|
9204
|
-
/* @__PURE__ */
|
|
9440
|
+
return /* @__PURE__ */ jsxs48("div", { className: `relative inline-block ${className}`, children: [
|
|
9441
|
+
/* @__PURE__ */ jsxs48(
|
|
9205
9442
|
"svg",
|
|
9206
9443
|
{
|
|
9207
9444
|
width,
|
|
9208
9445
|
height,
|
|
9209
9446
|
className: "select-none",
|
|
9210
9447
|
children: [
|
|
9211
|
-
uniqueX.map((label, i) => /* @__PURE__ */
|
|
9448
|
+
uniqueX.map((label, i) => /* @__PURE__ */ jsx122(
|
|
9212
9449
|
"text",
|
|
9213
9450
|
{
|
|
9214
9451
|
x: labelWidth + i * (cellSize + cellGap) + cellSize / 2,
|
|
@@ -9220,7 +9457,7 @@ var Heatmap = ({
|
|
|
9220
9457
|
},
|
|
9221
9458
|
`x-${label}`
|
|
9222
9459
|
)),
|
|
9223
|
-
uniqueY.map((label, j) => /* @__PURE__ */
|
|
9460
|
+
uniqueY.map((label, j) => /* @__PURE__ */ jsx122(
|
|
9224
9461
|
"text",
|
|
9225
9462
|
{
|
|
9226
9463
|
x: labelWidth - 8,
|
|
@@ -9238,8 +9475,8 @@ var Heatmap = ({
|
|
|
9238
9475
|
const point = data.find((d) => String(d.x) === xLabel && String(d.y) === yLabel);
|
|
9239
9476
|
const x = labelWidth + i * (cellSize + cellGap);
|
|
9240
9477
|
const y = labelHeight + j * (cellSize + cellGap);
|
|
9241
|
-
return /* @__PURE__ */
|
|
9242
|
-
/* @__PURE__ */
|
|
9478
|
+
return /* @__PURE__ */ jsxs48("g", { children: [
|
|
9479
|
+
/* @__PURE__ */ jsx122(
|
|
9243
9480
|
"rect",
|
|
9244
9481
|
{
|
|
9245
9482
|
x,
|
|
@@ -9262,7 +9499,7 @@ var Heatmap = ({
|
|
|
9262
9499
|
}
|
|
9263
9500
|
}
|
|
9264
9501
|
),
|
|
9265
|
-
showValues && value !== void 0 && /* @__PURE__ */
|
|
9502
|
+
showValues && value !== void 0 && /* @__PURE__ */ jsx122(
|
|
9266
9503
|
"text",
|
|
9267
9504
|
{
|
|
9268
9505
|
x: x + cellSize / 2,
|
|
@@ -9279,7 +9516,7 @@ var Heatmap = ({
|
|
|
9279
9516
|
]
|
|
9280
9517
|
}
|
|
9281
9518
|
),
|
|
9282
|
-
showTooltip && hoveredCell && /* @__PURE__ */
|
|
9519
|
+
showTooltip && hoveredCell && /* @__PURE__ */ jsxs48(
|
|
9283
9520
|
"div",
|
|
9284
9521
|
{
|
|
9285
9522
|
className: "absolute z-50 px-3 py-2 text-sm bg-[hsl(var(--popover))] text-[hsl(var(--popover-foreground))] border border-[hsl(var(--border))] rounded-lg shadow-lg pointer-events-none whitespace-nowrap",
|
|
@@ -9290,7 +9527,7 @@ var Heatmap = ({
|
|
|
9290
9527
|
},
|
|
9291
9528
|
children: [
|
|
9292
9529
|
getTooltipContent(hoveredCell.point),
|
|
9293
|
-
/* @__PURE__ */
|
|
9530
|
+
/* @__PURE__ */ jsx122(
|
|
9294
9531
|
"div",
|
|
9295
9532
|
{
|
|
9296
9533
|
className: "absolute w-2 h-2 bg-[hsl(var(--popover))] rotate-45",
|
|
@@ -9321,9 +9558,9 @@ var CalendarHeatmap = ({
|
|
|
9321
9558
|
onCellClick,
|
|
9322
9559
|
formatTooltip
|
|
9323
9560
|
}) => {
|
|
9324
|
-
const [hoveredCell, setHoveredCell] =
|
|
9325
|
-
const [isDarkMode, setIsDarkMode] =
|
|
9326
|
-
|
|
9561
|
+
const [hoveredCell, setHoveredCell] = useState27(null);
|
|
9562
|
+
const [isDarkMode, setIsDarkMode] = useState27(false);
|
|
9563
|
+
React37.useEffect(() => {
|
|
9327
9564
|
const checkDarkMode = () => {
|
|
9328
9565
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
9329
9566
|
};
|
|
@@ -9392,9 +9629,9 @@ var CalendarHeatmap = ({
|
|
|
9392
9629
|
const monthLabelHeight = showMonthLabels ? 20 : 0;
|
|
9393
9630
|
const width = dayLabelWidth + weeks.length * (cellSize + cellGap);
|
|
9394
9631
|
const height = monthLabelHeight + 7 * (cellSize + cellGap);
|
|
9395
|
-
return /* @__PURE__ */
|
|
9396
|
-
/* @__PURE__ */
|
|
9397
|
-
showMonthLabels && monthLabels.map(({ label, weekIndex }, i) => /* @__PURE__ */
|
|
9632
|
+
return /* @__PURE__ */ jsxs48("div", { className: `relative inline-block ${className}`, children: [
|
|
9633
|
+
/* @__PURE__ */ jsxs48("svg", { width, height, className: "select-none", children: [
|
|
9634
|
+
showMonthLabels && monthLabels.map(({ label, weekIndex }, i) => /* @__PURE__ */ jsx122(
|
|
9398
9635
|
"text",
|
|
9399
9636
|
{
|
|
9400
9637
|
x: dayLabelWidth + weekIndex * (cellSize + cellGap),
|
|
@@ -9405,7 +9642,7 @@ var CalendarHeatmap = ({
|
|
|
9405
9642
|
},
|
|
9406
9643
|
`month-${i}`
|
|
9407
9644
|
)),
|
|
9408
|
-
showDayLabels && [1, 3, 5].map((dayIndex) => /* @__PURE__ */
|
|
9645
|
+
showDayLabels && [1, 3, 5].map((dayIndex) => /* @__PURE__ */ jsx122(
|
|
9409
9646
|
"text",
|
|
9410
9647
|
{
|
|
9411
9648
|
x: dayLabelWidth - 6,
|
|
@@ -9423,7 +9660,7 @@ var CalendarHeatmap = ({
|
|
|
9423
9660
|
const value = dataMap.get(key);
|
|
9424
9661
|
const x = dayLabelWidth + weekIndex * (cellSize + cellGap);
|
|
9425
9662
|
const y = monthLabelHeight + dayIndex * (cellSize + cellGap);
|
|
9426
|
-
return /* @__PURE__ */
|
|
9663
|
+
return /* @__PURE__ */ jsx122(
|
|
9427
9664
|
"rect",
|
|
9428
9665
|
{
|
|
9429
9666
|
x,
|
|
@@ -9448,7 +9685,7 @@ var CalendarHeatmap = ({
|
|
|
9448
9685
|
})
|
|
9449
9686
|
)
|
|
9450
9687
|
] }),
|
|
9451
|
-
hoveredCell && /* @__PURE__ */
|
|
9688
|
+
hoveredCell && /* @__PURE__ */ jsxs48(
|
|
9452
9689
|
"div",
|
|
9453
9690
|
{
|
|
9454
9691
|
className: "absolute z-50 px-3 py-2 text-sm bg-[hsl(var(--popover))] text-[hsl(var(--popover-foreground))] border border-[hsl(var(--border))] rounded-lg shadow-lg pointer-events-none whitespace-nowrap",
|
|
@@ -9459,7 +9696,7 @@ var CalendarHeatmap = ({
|
|
|
9459
9696
|
},
|
|
9460
9697
|
children: [
|
|
9461
9698
|
getTooltipContent(hoveredCell.date, hoveredCell.value),
|
|
9462
|
-
/* @__PURE__ */
|
|
9699
|
+
/* @__PURE__ */ jsx122(
|
|
9463
9700
|
"div",
|
|
9464
9701
|
{
|
|
9465
9702
|
className: "absolute w-2 h-2 bg-[hsl(var(--popover))] rotate-45",
|
|
@@ -9477,7 +9714,7 @@ var CalendarHeatmap = ({
|
|
|
9477
9714
|
};
|
|
9478
9715
|
|
|
9479
9716
|
// src/theme/ColorSchemeScript.tsx
|
|
9480
|
-
import { jsx as
|
|
9717
|
+
import { jsx as jsx123 } from "react/jsx-runtime";
|
|
9481
9718
|
function getColorSchemeScript(defaultColorMode, localStorageKey) {
|
|
9482
9719
|
return `(function(){try{var d=document.documentElement,s=d.style,c=localStorage.getItem('${localStorageKey}')||'${defaultColorMode}',r=c;if(c==='system'||!c)r=matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light';d.setAttribute('data-color-mode',r);s.colorScheme=r;if(r==='dark'){d.classList.add('dark');s.setProperty('--background','0 0% 3.9%');s.setProperty('--foreground','0 0% 98%');s.setProperty('--card','0 0% 5.9%');s.setProperty('--card-foreground','0 0% 98%');s.setProperty('--popover','0 0% 5.9%');s.setProperty('--popover-foreground','0 0% 98%');s.setProperty('--muted','0 0% 14.9%');s.setProperty('--muted-foreground','0 0% 63.9%');s.setProperty('--border','0 0% 25%');s.setProperty('--input','0 0% 25%');s.setProperty('--primary','217 91% 60%');s.setProperty('--secondary','0 0% 14.9%');s.setProperty('--accent','0 0% 14.9%');s.backgroundColor='hsl(0,0%,3.9%)';s.color='hsl(0,0%,98%)'}else{d.classList.remove('dark');s.backgroundColor='hsl(0,0%,100%)';s.color='hsl(0,0%,3.9%)'}d.setAttribute('data-theme-initialized','true')}catch(e){}})()`;
|
|
9483
9720
|
}
|
|
@@ -9487,7 +9724,7 @@ function ColorSchemeScript({
|
|
|
9487
9724
|
nonce
|
|
9488
9725
|
} = {}) {
|
|
9489
9726
|
const scriptContent = getColorSchemeScript(defaultColorMode, localStorageKey);
|
|
9490
|
-
return /* @__PURE__ */
|
|
9727
|
+
return /* @__PURE__ */ jsx123(
|
|
9491
9728
|
"script",
|
|
9492
9729
|
{
|
|
9493
9730
|
nonce,
|
|
@@ -9598,6 +9835,7 @@ export {
|
|
|
9598
9835
|
SaveIcon,
|
|
9599
9836
|
ScatterChart,
|
|
9600
9837
|
SearchIcon,
|
|
9838
|
+
SegmentedControl,
|
|
9601
9839
|
Select,
|
|
9602
9840
|
SettingsIcon,
|
|
9603
9841
|
ShieldIcon,
|