@marcoschwartz/lite-ui 0.27.3 → 0.27.4
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.js +60 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -63
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3512,7 +3512,7 @@ var Radio = ({
|
|
|
3512
3512
|
};
|
|
3513
3513
|
|
|
3514
3514
|
// src/components/SegmentedControl.tsx
|
|
3515
|
-
import { useState as useState12, useId, useCallback as useCallback2, useMemo } from "react";
|
|
3515
|
+
import { useState as useState12, useRef as useRef6, useEffect as useEffect9, useId, useCallback as useCallback2, useMemo } from "react";
|
|
3516
3516
|
import { jsx as jsx99, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3517
3517
|
function normalizeData(data) {
|
|
3518
3518
|
return data.map(
|
|
@@ -3580,17 +3580,64 @@ var SegmentedControl = ({
|
|
|
3580
3580
|
}) => {
|
|
3581
3581
|
const groupId = useId();
|
|
3582
3582
|
const groupName = name || `segmented-control-${groupId}`;
|
|
3583
|
+
const containerRef = useRef6(null);
|
|
3584
|
+
const indicatorRef = useRef6(null);
|
|
3583
3585
|
const options = useMemo(() => normalizeData(data), [data]);
|
|
3584
3586
|
const [internalValue, setInternalValue] = useState12(
|
|
3585
3587
|
defaultValue || options[0]?.value || ""
|
|
3586
3588
|
);
|
|
3587
3589
|
const isControlled = controlledValue !== void 0;
|
|
3588
3590
|
const currentValue = isControlled ? controlledValue : internalValue;
|
|
3589
|
-
const [
|
|
3591
|
+
const [initialized, setInitialized] = useState12(false);
|
|
3590
3592
|
const activeIndex = options.findIndex((opt) => opt.value === currentValue);
|
|
3593
|
+
const updateIndicator = useCallback2((animate = true) => {
|
|
3594
|
+
if (!containerRef.current || !indicatorRef.current) return;
|
|
3595
|
+
const container = containerRef.current;
|
|
3596
|
+
const indicator = indicatorRef.current;
|
|
3597
|
+
if (activeIndex === -1) {
|
|
3598
|
+
indicator.style.display = "none";
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3601
|
+
const buttons = container.querySelectorAll("[data-segment-button]");
|
|
3602
|
+
const activeButton = buttons[activeIndex];
|
|
3603
|
+
if (!activeButton) return;
|
|
3604
|
+
const containerRect = container.getBoundingClientRect();
|
|
3605
|
+
const buttonRect = activeButton.getBoundingClientRect();
|
|
3606
|
+
if (!animate) {
|
|
3607
|
+
indicator.style.transitionDuration = "0ms";
|
|
3608
|
+
} else {
|
|
3609
|
+
indicator.style.transitionDuration = `${transitionDuration}ms`;
|
|
3610
|
+
}
|
|
3611
|
+
indicator.style.display = "block";
|
|
3612
|
+
if (orientation === "horizontal") {
|
|
3613
|
+
indicator.style.width = `${buttonRect.width}px`;
|
|
3614
|
+
indicator.style.height = `calc(100% - 8px)`;
|
|
3615
|
+
indicator.style.transform = `translateX(${buttonRect.left - containerRect.left - 4}px)`;
|
|
3616
|
+
} else {
|
|
3617
|
+
indicator.style.width = `calc(100% - 8px)`;
|
|
3618
|
+
indicator.style.height = `${buttonRect.height}px`;
|
|
3619
|
+
indicator.style.transform = `translateY(${buttonRect.top - containerRect.top - 4}px)`;
|
|
3620
|
+
}
|
|
3621
|
+
}, [activeIndex, orientation, transitionDuration]);
|
|
3622
|
+
useEffect9(() => {
|
|
3623
|
+
const timer = setTimeout(() => {
|
|
3624
|
+
updateIndicator(false);
|
|
3625
|
+
setInitialized(true);
|
|
3626
|
+
}, 20);
|
|
3627
|
+
return () => clearTimeout(timer);
|
|
3628
|
+
}, []);
|
|
3629
|
+
useEffect9(() => {
|
|
3630
|
+
if (initialized) {
|
|
3631
|
+
updateIndicator(true);
|
|
3632
|
+
}
|
|
3633
|
+
}, [currentValue, initialized, updateIndicator]);
|
|
3634
|
+
useEffect9(() => {
|
|
3635
|
+
const handleResize = () => updateIndicator(false);
|
|
3636
|
+
window.addEventListener("resize", handleResize);
|
|
3637
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
3638
|
+
}, [updateIndicator]);
|
|
3591
3639
|
const handleChange = useCallback2((newValue) => {
|
|
3592
3640
|
if (disabled) return;
|
|
3593
|
-
setHasInteracted(true);
|
|
3594
3641
|
if (!isControlled) {
|
|
3595
3642
|
setInternalValue(newValue);
|
|
3596
3643
|
}
|
|
@@ -3626,20 +3673,6 @@ var SegmentedControl = ({
|
|
|
3626
3673
|
}, [options, currentValue, orientation, handleChange]);
|
|
3627
3674
|
const sizeStyles2 = sizeConfig[size];
|
|
3628
3675
|
const radiusStyle = radiusConfig[radius];
|
|
3629
|
-
const totalOptions = options.length;
|
|
3630
|
-
const indicatorStyle = activeIndex >= 0 ? orientation === "horizontal" ? {
|
|
3631
|
-
width: `calc(${100 / totalOptions}% - ${totalOptions > 1 ? 0 : 0}px)`,
|
|
3632
|
-
height: "calc(100% - 8px)",
|
|
3633
|
-
left: `calc(${activeIndex / totalOptions * 100}% + 4px)`,
|
|
3634
|
-
top: "4px",
|
|
3635
|
-
transition: hasInteracted ? `left ${transitionDuration}ms ease, width ${transitionDuration}ms ease` : "none"
|
|
3636
|
-
} : {
|
|
3637
|
-
width: "calc(100% - 8px)",
|
|
3638
|
-
height: `calc(${100 / totalOptions}% - ${totalOptions > 1 ? 0 : 0}px)`,
|
|
3639
|
-
left: "4px",
|
|
3640
|
-
top: `calc(${activeIndex / totalOptions * 100}% + 4px)`,
|
|
3641
|
-
transition: hasInteracted ? `top ${transitionDuration}ms ease, height ${transitionDuration}ms ease` : "none"
|
|
3642
|
-
} : { display: "none" };
|
|
3643
3676
|
const containerClasses = [
|
|
3644
3677
|
"relative inline-flex p-1",
|
|
3645
3678
|
"bg-[hsl(var(--muted))]",
|
|
@@ -3652,6 +3685,7 @@ var SegmentedControl = ({
|
|
|
3652
3685
|
return /* @__PURE__ */ jsxs27(
|
|
3653
3686
|
"div",
|
|
3654
3687
|
{
|
|
3688
|
+
ref: containerRef,
|
|
3655
3689
|
role: "radiogroup",
|
|
3656
3690
|
"aria-label": ariaLabel || "Segmented control",
|
|
3657
3691
|
className: containerClasses,
|
|
@@ -3659,17 +3693,23 @@ var SegmentedControl = ({
|
|
|
3659
3693
|
/* @__PURE__ */ jsx99(
|
|
3660
3694
|
"div",
|
|
3661
3695
|
{
|
|
3696
|
+
ref: indicatorRef,
|
|
3662
3697
|
className: [
|
|
3663
|
-
"absolute z-0",
|
|
3698
|
+
"absolute z-0 top-1 left-1",
|
|
3664
3699
|
radiusStyle,
|
|
3665
3700
|
colorConfig[color],
|
|
3666
|
-
"shadow-sm"
|
|
3701
|
+
"shadow-sm",
|
|
3702
|
+
"transition-transform",
|
|
3703
|
+
initialized ? "opacity-100" : "opacity-0"
|
|
3667
3704
|
].join(" "),
|
|
3668
|
-
style:
|
|
3705
|
+
style: {
|
|
3706
|
+
transitionProperty: "transform, width, height, opacity",
|
|
3707
|
+
transitionTimingFunction: "ease"
|
|
3708
|
+
},
|
|
3669
3709
|
"aria-hidden": "true"
|
|
3670
3710
|
}
|
|
3671
3711
|
),
|
|
3672
|
-
options.map((option
|
|
3712
|
+
options.map((option) => {
|
|
3673
3713
|
const isActive = option.value === currentValue;
|
|
3674
3714
|
const isDisabled = disabled || option.disabled;
|
|
3675
3715
|
const buttonClasses = [
|
|
@@ -3776,7 +3816,7 @@ var ProgressBar = ({
|
|
|
3776
3816
|
};
|
|
3777
3817
|
|
|
3778
3818
|
// src/components/Slider.tsx
|
|
3779
|
-
import React21, { useRef as
|
|
3819
|
+
import React21, { useRef as useRef7 } from "react";
|
|
3780
3820
|
import { jsx as jsx101, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3781
3821
|
var Slider = ({
|
|
3782
3822
|
value: controlledValue,
|
|
@@ -3796,7 +3836,7 @@ var Slider = ({
|
|
|
3796
3836
|
}) => {
|
|
3797
3837
|
const [internalValue, setInternalValue] = React21.useState(defaultValue);
|
|
3798
3838
|
const [internalRangeValue, setInternalRangeValue] = React21.useState(defaultRangeValue);
|
|
3799
|
-
const trackRef =
|
|
3839
|
+
const trackRef = useRef7(null);
|
|
3800
3840
|
const [isDragging, setIsDragging] = React21.useState(null);
|
|
3801
3841
|
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
3802
3842
|
const rangeValue = controlledRangeValue !== void 0 ? controlledRangeValue : internalRangeValue;
|
|
@@ -4064,7 +4104,7 @@ var Textarea = ({
|
|
|
4064
4104
|
};
|
|
4065
4105
|
|
|
4066
4106
|
// src/components/RichTextEditor.tsx
|
|
4067
|
-
import { useRef as
|
|
4107
|
+
import { useRef as useRef8, useCallback as useCallback3, useState as useState14, useEffect as useEffect10, useLayoutEffect } from "react";
|
|
4068
4108
|
import { jsx as jsx104, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
4069
4109
|
var RichTextEditor = ({
|
|
4070
4110
|
value = "",
|
|
@@ -4079,7 +4119,7 @@ var RichTextEditor = ({
|
|
|
4079
4119
|
helperText
|
|
4080
4120
|
}) => {
|
|
4081
4121
|
const { themeName } = useTheme();
|
|
4082
|
-
const editorRef =
|
|
4122
|
+
const editorRef = useRef8(null);
|
|
4083
4123
|
const [isFocused, setIsFocused] = useState14(false);
|
|
4084
4124
|
const [activeFormats, setActiveFormats] = useState14(/* @__PURE__ */ new Set());
|
|
4085
4125
|
const [showLinkModal, setShowLinkModal] = useState14(false);
|
|
@@ -4087,7 +4127,7 @@ var RichTextEditor = ({
|
|
|
4087
4127
|
const [showImageModal, setShowImageModal] = useState14(false);
|
|
4088
4128
|
const [imageUrl, setImageUrl] = useState14("");
|
|
4089
4129
|
const [imageAlt, setImageAlt] = useState14("");
|
|
4090
|
-
const savedSelection =
|
|
4130
|
+
const savedSelection = useRef8(null);
|
|
4091
4131
|
useLayoutEffect(() => {
|
|
4092
4132
|
const styleId = "rich-text-editor-styles";
|
|
4093
4133
|
if (!document.getElementById(styleId)) {
|
|
@@ -4150,9 +4190,9 @@ var RichTextEditor = ({
|
|
|
4150
4190
|
document.head.appendChild(style);
|
|
4151
4191
|
}
|
|
4152
4192
|
}, []);
|
|
4153
|
-
const isInitialRender =
|
|
4154
|
-
const isInternalUpdate =
|
|
4155
|
-
|
|
4193
|
+
const isInitialRender = useRef8(true);
|
|
4194
|
+
const isInternalUpdate = useRef8(false);
|
|
4195
|
+
useEffect10(() => {
|
|
4156
4196
|
if (isInitialRender.current && editorRef.current) {
|
|
4157
4197
|
editorRef.current.innerHTML = value;
|
|
4158
4198
|
isInitialRender.current = false;
|
|
@@ -4163,7 +4203,7 @@ var RichTextEditor = ({
|
|
|
4163
4203
|
}
|
|
4164
4204
|
}
|
|
4165
4205
|
}, []);
|
|
4166
|
-
|
|
4206
|
+
useEffect10(() => {
|
|
4167
4207
|
if (!isInitialRender.current && !isInternalUpdate.current && editorRef.current) {
|
|
4168
4208
|
const currentHtml = editorRef.current.innerHTML;
|
|
4169
4209
|
if (currentHtml !== value) {
|
|
@@ -4918,7 +4958,7 @@ var Divider = ({
|
|
|
4918
4958
|
};
|
|
4919
4959
|
|
|
4920
4960
|
// src/components/FileUpload.tsx
|
|
4921
|
-
import { useRef as
|
|
4961
|
+
import { useRef as useRef9, useState as useState16 } from "react";
|
|
4922
4962
|
import { jsx as jsx108, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4923
4963
|
var FileUpload = ({
|
|
4924
4964
|
accept,
|
|
@@ -4934,7 +4974,7 @@ var FileUpload = ({
|
|
|
4934
4974
|
}) => {
|
|
4935
4975
|
const [files, setFiles] = useState16([]);
|
|
4936
4976
|
const [isDragging, setIsDragging] = useState16(false);
|
|
4937
|
-
const fileInputRef =
|
|
4977
|
+
const fileInputRef = useRef9(null);
|
|
4938
4978
|
const formatFileSize = (bytes) => {
|
|
4939
4979
|
if (bytes === 0) return "0 Bytes";
|
|
4940
4980
|
const k = 1024;
|
|
@@ -5061,7 +5101,7 @@ var FileUpload = ({
|
|
|
5061
5101
|
};
|
|
5062
5102
|
|
|
5063
5103
|
// src/components/AudioPlayer.tsx
|
|
5064
|
-
import { useRef as
|
|
5104
|
+
import { useRef as useRef10, useState as useState17, useEffect as useEffect11 } from "react";
|
|
5065
5105
|
import { jsx as jsx109, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
5066
5106
|
var AudioPlayer = ({
|
|
5067
5107
|
src,
|
|
@@ -5085,7 +5125,7 @@ var AudioPlayer = ({
|
|
|
5085
5125
|
showChapters = true,
|
|
5086
5126
|
onChapterChange
|
|
5087
5127
|
}) => {
|
|
5088
|
-
const audioRef =
|
|
5128
|
+
const audioRef = useRef10(null);
|
|
5089
5129
|
const [isPlaying, setIsPlaying] = useState17(false);
|
|
5090
5130
|
const [currentTime, setCurrentTime] = useState17(0);
|
|
5091
5131
|
const [duration, setDuration] = useState17(0);
|
|
@@ -5096,7 +5136,7 @@ var AudioPlayer = ({
|
|
|
5096
5136
|
const [showChapterList, setShowChapterList] = useState17(false);
|
|
5097
5137
|
const [hoveredChapter, setHoveredChapter] = useState17(null);
|
|
5098
5138
|
const [hoverPosition, setHoverPosition] = useState17({ x: 0, y: 0 });
|
|
5099
|
-
|
|
5139
|
+
useEffect11(() => {
|
|
5100
5140
|
const audio = audioRef.current;
|
|
5101
5141
|
if (!audio) return;
|
|
5102
5142
|
const handleLoadedMetadata = () => {
|
|
@@ -5160,7 +5200,7 @@ var AudioPlayer = ({
|
|
|
5160
5200
|
audio.removeEventListener("error", handleError);
|
|
5161
5201
|
};
|
|
5162
5202
|
}, [onPlay, onPause, onEnded, onTimeUpdate]);
|
|
5163
|
-
|
|
5203
|
+
useEffect11(() => {
|
|
5164
5204
|
const audio = audioRef.current;
|
|
5165
5205
|
if (!audio) return;
|
|
5166
5206
|
audio.load();
|
|
@@ -5541,7 +5581,7 @@ var AudioPlayer = ({
|
|
|
5541
5581
|
};
|
|
5542
5582
|
|
|
5543
5583
|
// src/components/VideoPlayer.tsx
|
|
5544
|
-
import { useRef as
|
|
5584
|
+
import { useRef as useRef11, useState as useState18, useEffect as useEffect12 } from "react";
|
|
5545
5585
|
import { jsx as jsx110, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
5546
5586
|
var VideoPlayer = ({
|
|
5547
5587
|
src,
|
|
@@ -5566,8 +5606,8 @@ var VideoPlayer = ({
|
|
|
5566
5606
|
showChapters = true,
|
|
5567
5607
|
onChapterChange
|
|
5568
5608
|
}) => {
|
|
5569
|
-
const videoRef =
|
|
5570
|
-
const containerRef =
|
|
5609
|
+
const videoRef = useRef11(null);
|
|
5610
|
+
const containerRef = useRef11(null);
|
|
5571
5611
|
const [isPlaying, setIsPlaying] = useState18(false);
|
|
5572
5612
|
const [currentTime, setCurrentTime] = useState18(0);
|
|
5573
5613
|
const [duration, setDuration] = useState18(0);
|
|
@@ -5576,11 +5616,11 @@ var VideoPlayer = ({
|
|
|
5576
5616
|
const [isLoading, setIsLoading] = useState18(true);
|
|
5577
5617
|
const [isFullscreen, setIsFullscreen] = useState18(false);
|
|
5578
5618
|
const [showControlsOverlay, setShowControlsOverlay] = useState18(true);
|
|
5579
|
-
const hideControlsTimeout =
|
|
5619
|
+
const hideControlsTimeout = useRef11(null);
|
|
5580
5620
|
const [currentChapter, setCurrentChapter] = useState18(null);
|
|
5581
5621
|
const [hoveredChapter, setHoveredChapter] = useState18(null);
|
|
5582
5622
|
const [hoverPosition, setHoverPosition] = useState18({ x: 0, y: 0 });
|
|
5583
|
-
|
|
5623
|
+
useEffect12(() => {
|
|
5584
5624
|
const video = videoRef.current;
|
|
5585
5625
|
if (!video) return;
|
|
5586
5626
|
const handleLoadedMetadata = () => {
|
|
@@ -5649,12 +5689,12 @@ var VideoPlayer = ({
|
|
|
5649
5689
|
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
5650
5690
|
};
|
|
5651
5691
|
}, [onPlay, onPause, onEnded, onTimeUpdate]);
|
|
5652
|
-
|
|
5692
|
+
useEffect12(() => {
|
|
5653
5693
|
const video = videoRef.current;
|
|
5654
5694
|
if (!video) return;
|
|
5655
5695
|
video.load();
|
|
5656
5696
|
}, [src]);
|
|
5657
|
-
|
|
5697
|
+
useEffect12(() => {
|
|
5658
5698
|
if (!isPlaying) {
|
|
5659
5699
|
setShowControlsOverlay(true);
|
|
5660
5700
|
return;
|
|
@@ -6055,7 +6095,7 @@ var VideoPlayer = ({
|
|
|
6055
6095
|
};
|
|
6056
6096
|
|
|
6057
6097
|
// src/charts/LineChart.tsx
|
|
6058
|
-
import React31, { useMemo as useMemo3, useCallback as useCallback5, useRef as
|
|
6098
|
+
import React31, { useMemo as useMemo3, useCallback as useCallback5, useRef as useRef13, useState as useState21 } from "react";
|
|
6059
6099
|
|
|
6060
6100
|
// src/charts/constants.ts
|
|
6061
6101
|
var CHART_DEFAULTS = {
|
|
@@ -6122,7 +6162,7 @@ var CHART_DEFAULTS = {
|
|
|
6122
6162
|
};
|
|
6123
6163
|
|
|
6124
6164
|
// src/charts/hooks/useResponsiveChart.ts
|
|
6125
|
-
import { useState as useState19, useEffect as
|
|
6165
|
+
import { useState as useState19, useEffect as useEffect13 } from "react";
|
|
6126
6166
|
var BREAKPOINTS = {
|
|
6127
6167
|
mobile: 640,
|
|
6128
6168
|
// < 640px
|
|
@@ -6142,7 +6182,7 @@ var DEFAULT_ASPECT_RATIOS = {
|
|
|
6142
6182
|
};
|
|
6143
6183
|
function useBreakpoint() {
|
|
6144
6184
|
const [breakpoint, setBreakpoint] = useState19("desktop");
|
|
6145
|
-
|
|
6185
|
+
useEffect13(() => {
|
|
6146
6186
|
const update = () => {
|
|
6147
6187
|
const width = window.innerWidth;
|
|
6148
6188
|
if (width < BREAKPOINTS.mobile) {
|
|
@@ -6439,7 +6479,7 @@ function createTickFormatter(domain) {
|
|
|
6439
6479
|
}
|
|
6440
6480
|
|
|
6441
6481
|
// src/charts/components/ChartTooltip.tsx
|
|
6442
|
-
import React29, { useRef as
|
|
6482
|
+
import React29, { useRef as useRef12, useEffect as useEffect14, useState as useState20 } from "react";
|
|
6443
6483
|
import { jsx as jsx111, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
6444
6484
|
var DefaultTooltipContent = ({
|
|
6445
6485
|
active,
|
|
@@ -6486,10 +6526,10 @@ var ChartTooltip = ({
|
|
|
6486
6526
|
containerBounds,
|
|
6487
6527
|
animationDuration = 150
|
|
6488
6528
|
}) => {
|
|
6489
|
-
const tooltipRef =
|
|
6529
|
+
const tooltipRef = useRef12(null);
|
|
6490
6530
|
const [position, setPosition] = useState20({ x: 0, y: 0 });
|
|
6491
6531
|
const [isVisible, setIsVisible] = useState20(false);
|
|
6492
|
-
|
|
6532
|
+
useEffect14(() => {
|
|
6493
6533
|
if (!active || !tooltipRef.current) {
|
|
6494
6534
|
setIsVisible(false);
|
|
6495
6535
|
return;
|
|
@@ -7082,8 +7122,8 @@ var LineChart = ({
|
|
|
7082
7122
|
colors = CHART_DEFAULTS.colors,
|
|
7083
7123
|
ariaLabel
|
|
7084
7124
|
}) => {
|
|
7085
|
-
const containerRef =
|
|
7086
|
-
const svgRef =
|
|
7125
|
+
const containerRef = useRef13(null);
|
|
7126
|
+
const svgRef = useRef13(null);
|
|
7087
7127
|
const [hoveredPoint, setHoveredPoint] = useState21(null);
|
|
7088
7128
|
const [crosshairX, setCrosshairX] = useState21(null);
|
|
7089
7129
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
@@ -7540,7 +7580,7 @@ var LineChart = ({
|
|
|
7540
7580
|
};
|
|
7541
7581
|
|
|
7542
7582
|
// src/charts/BarChart.tsx
|
|
7543
|
-
import React32, { useMemo as useMemo4, useCallback as useCallback6, useRef as
|
|
7583
|
+
import React32, { useMemo as useMemo4, useCallback as useCallback6, useRef as useRef14, useState as useState22 } from "react";
|
|
7544
7584
|
import { jsx as jsx117, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
7545
7585
|
var BarChart = ({
|
|
7546
7586
|
data,
|
|
@@ -7577,7 +7617,7 @@ var BarChart = ({
|
|
|
7577
7617
|
colors = CHART_DEFAULTS.colors,
|
|
7578
7618
|
ariaLabel
|
|
7579
7619
|
}) => {
|
|
7580
|
-
const containerRef =
|
|
7620
|
+
const containerRef = useRef14(null);
|
|
7581
7621
|
const [hoveredBar, setHoveredBar] = useState22(null);
|
|
7582
7622
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
7583
7623
|
const {
|
|
@@ -7966,7 +8006,7 @@ var BarChart = ({
|
|
|
7966
8006
|
};
|
|
7967
8007
|
|
|
7968
8008
|
// src/charts/AreaChart.tsx
|
|
7969
|
-
import React33, { useMemo as useMemo5, useCallback as useCallback7, useRef as
|
|
8009
|
+
import React33, { useMemo as useMemo5, useCallback as useCallback7, useRef as useRef15, useState as useState23, useId as useId2 } from "react";
|
|
7970
8010
|
import { jsx as jsx118, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
7971
8011
|
var AreaChart = ({
|
|
7972
8012
|
data,
|
|
@@ -8002,7 +8042,7 @@ var AreaChart = ({
|
|
|
8002
8042
|
colors = CHART_DEFAULTS.colors,
|
|
8003
8043
|
ariaLabel
|
|
8004
8044
|
}) => {
|
|
8005
|
-
const containerRef =
|
|
8045
|
+
const containerRef = useRef15(null);
|
|
8006
8046
|
const chartId = useId2();
|
|
8007
8047
|
const [hoveredPoint, setHoveredPoint] = useState23(null);
|
|
8008
8048
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
@@ -8440,7 +8480,7 @@ var AreaChart = ({
|
|
|
8440
8480
|
};
|
|
8441
8481
|
|
|
8442
8482
|
// src/charts/PieChart.tsx
|
|
8443
|
-
import { useMemo as useMemo6, useCallback as useCallback8, useRef as
|
|
8483
|
+
import { useMemo as useMemo6, useCallback as useCallback8, useRef as useRef16, useState as useState24 } from "react";
|
|
8444
8484
|
import { jsx as jsx119, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
8445
8485
|
var PieChart = ({
|
|
8446
8486
|
data,
|
|
@@ -8474,7 +8514,7 @@ var PieChart = ({
|
|
|
8474
8514
|
colors = CHART_DEFAULTS.colors,
|
|
8475
8515
|
ariaLabel
|
|
8476
8516
|
}) => {
|
|
8477
|
-
const containerRef =
|
|
8517
|
+
const containerRef = useRef16(null);
|
|
8478
8518
|
const [hoveredSlice, setHoveredSlice] = useState24(null);
|
|
8479
8519
|
const [activeSlice, setActiveSlice] = useState24(null);
|
|
8480
8520
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
@@ -8743,7 +8783,7 @@ var PieChart = ({
|
|
|
8743
8783
|
};
|
|
8744
8784
|
|
|
8745
8785
|
// src/charts/ScatterChart.tsx
|
|
8746
|
-
import React35, { useMemo as useMemo7, useCallback as useCallback9, useRef as
|
|
8786
|
+
import React35, { useMemo as useMemo7, useCallback as useCallback9, useRef as useRef17, useState as useState25 } from "react";
|
|
8747
8787
|
import { jsx as jsx120, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
8748
8788
|
function linearRegression(points) {
|
|
8749
8789
|
const n = points.length;
|
|
@@ -8871,7 +8911,7 @@ var ScatterChart = ({
|
|
|
8871
8911
|
colors = CHART_DEFAULTS.colors,
|
|
8872
8912
|
ariaLabel
|
|
8873
8913
|
}) => {
|
|
8874
|
-
const containerRef =
|
|
8914
|
+
const containerRef = useRef17(null);
|
|
8875
8915
|
const [hoveredPoint, setHoveredPoint] = useState25(null);
|
|
8876
8916
|
const { tooltipData, showTooltip: showTooltipFn, hideTooltip } = useTooltip();
|
|
8877
8917
|
const {
|
|
@@ -9201,7 +9241,7 @@ var ScatterChart = ({
|
|
|
9201
9241
|
};
|
|
9202
9242
|
|
|
9203
9243
|
// src/charts/components/ResponsiveContainer.tsx
|
|
9204
|
-
import React36, { useRef as
|
|
9244
|
+
import React36, { useRef as useRef18, useState as useState26, useEffect as useEffect15, useCallback as useCallback10 } from "react";
|
|
9205
9245
|
import { jsx as jsx121 } from "react/jsx-runtime";
|
|
9206
9246
|
var ResponsiveContainer = ({
|
|
9207
9247
|
width = "100%",
|
|
@@ -9216,12 +9256,12 @@ var ResponsiveContainer = ({
|
|
|
9216
9256
|
children,
|
|
9217
9257
|
onResize
|
|
9218
9258
|
}) => {
|
|
9219
|
-
const containerRef =
|
|
9259
|
+
const containerRef = useRef18(null);
|
|
9220
9260
|
const [dimensions, setDimensions] = useState26({
|
|
9221
9261
|
width: 0,
|
|
9222
9262
|
height: 0
|
|
9223
9263
|
});
|
|
9224
|
-
const debounceTimerRef =
|
|
9264
|
+
const debounceTimerRef = useRef18(null);
|
|
9225
9265
|
const calculateDimensions = useCallback10((containerWidth, containerHeight) => {
|
|
9226
9266
|
let finalWidth = containerWidth;
|
|
9227
9267
|
let finalHeight = containerHeight;
|
|
@@ -9256,7 +9296,7 @@ var ResponsiveContainer = ({
|
|
|
9256
9296
|
updateDimensions();
|
|
9257
9297
|
}
|
|
9258
9298
|
}, [calculateDimensions, debounce, onResize]);
|
|
9259
|
-
|
|
9299
|
+
useEffect15(() => {
|
|
9260
9300
|
const container = containerRef.current;
|
|
9261
9301
|
if (!container) return;
|
|
9262
9302
|
const observer = new ResizeObserver(handleResize);
|