@x-plat/design-system 0.6.0 → 0.6.1
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/components/Calendar/index.cjs +1 -1
- package/dist/components/Calendar/index.js +1 -1
- package/dist/components/Skeleton/index.cjs +6 -6
- package/dist/components/Skeleton/index.js +6 -6
- package/dist/components/Video/index.css +1 -1
- package/dist/components/index.cjs +247 -247
- package/dist/components/index.css +48 -48
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +221 -221
- package/dist/index.cjs +247 -247
- package/dist/index.css +51 -51
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +221 -221
- package/dist/layout/Header/index.css +2 -2
- package/dist/layout/Layout/index.css +1 -1
- package/dist/layout/index.css +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5593,8 +5593,69 @@ var Alert = (props) => {
|
|
|
5593
5593
|
Alert.displayName = "Alert";
|
|
5594
5594
|
var Alert_default = Alert;
|
|
5595
5595
|
|
|
5596
|
-
// src/components/
|
|
5596
|
+
// src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
|
|
5597
|
+
import React2 from "react";
|
|
5597
5598
|
import { jsx as jsx297 } from "react/jsx-runtime";
|
|
5599
|
+
var MAX_HEIGHT = 400;
|
|
5600
|
+
var AutoResizeTextArea = React2.forwardRef(
|
|
5601
|
+
(props, ref) => {
|
|
5602
|
+
const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
|
|
5603
|
+
const localRef = React2.useRef(null);
|
|
5604
|
+
const setRefs = (el) => {
|
|
5605
|
+
localRef.current = el;
|
|
5606
|
+
if (!ref) return;
|
|
5607
|
+
if (typeof ref === "function") ref(el);
|
|
5608
|
+
else if (ref && "current" in ref)
|
|
5609
|
+
ref.current = el;
|
|
5610
|
+
};
|
|
5611
|
+
const updateHeight = () => {
|
|
5612
|
+
const el = localRef.current;
|
|
5613
|
+
if (!el) return;
|
|
5614
|
+
el.style.height = "0px";
|
|
5615
|
+
el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
|
|
5616
|
+
};
|
|
5617
|
+
const handleChange = (e) => {
|
|
5618
|
+
if (onChange) {
|
|
5619
|
+
const event = {
|
|
5620
|
+
...e,
|
|
5621
|
+
target: { value: e.target.value }
|
|
5622
|
+
};
|
|
5623
|
+
onChange(event);
|
|
5624
|
+
}
|
|
5625
|
+
};
|
|
5626
|
+
React2.useEffect(() => {
|
|
5627
|
+
updateHeight();
|
|
5628
|
+
}, [value]);
|
|
5629
|
+
if (bare) {
|
|
5630
|
+
return /* @__PURE__ */ jsx297(
|
|
5631
|
+
"textarea",
|
|
5632
|
+
{
|
|
5633
|
+
...textareaProps,
|
|
5634
|
+
ref: setRefs,
|
|
5635
|
+
className,
|
|
5636
|
+
disabled,
|
|
5637
|
+
value,
|
|
5638
|
+
onChange: handleChange
|
|
5639
|
+
}
|
|
5640
|
+
);
|
|
5641
|
+
}
|
|
5642
|
+
return /* @__PURE__ */ jsx297("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ jsx297("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ jsx297(
|
|
5643
|
+
"textarea",
|
|
5644
|
+
{
|
|
5645
|
+
...textareaProps,
|
|
5646
|
+
ref: setRefs,
|
|
5647
|
+
disabled,
|
|
5648
|
+
value,
|
|
5649
|
+
onChange: handleChange
|
|
5650
|
+
}
|
|
5651
|
+
) }) });
|
|
5652
|
+
}
|
|
5653
|
+
);
|
|
5654
|
+
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
5655
|
+
var AutoResizeTextArea_default = AutoResizeTextArea;
|
|
5656
|
+
|
|
5657
|
+
// src/components/Avatar/Avatar.tsx
|
|
5658
|
+
import { jsx as jsx298 } from "react/jsx-runtime";
|
|
5598
5659
|
var CATEGORICAL_COUNT = 8;
|
|
5599
5660
|
var getColorIndex = (name) => {
|
|
5600
5661
|
if (!name) return 1;
|
|
@@ -5611,13 +5672,13 @@ var Avatar = (props) => {
|
|
|
5611
5672
|
const fullInitials = name ? name.split(" ").map((s) => s[0]).join("").slice(0, 2).toUpperCase() : "";
|
|
5612
5673
|
const initials = size === "sm" ? fullInitials.slice(0, 1) : fullInitials;
|
|
5613
5674
|
const catIndex = getColorIndex(name || "");
|
|
5614
|
-
return /* @__PURE__ */
|
|
5675
|
+
return /* @__PURE__ */ jsx298("div", { className: clsx_default("lib-xplat-avatar", size), children: src ? /* @__PURE__ */ jsx298("img", { src, alt: alt || name || "avatar" }) : /* @__PURE__ */ jsx298("div", { className: clsx_default("fallback", `cat-${catIndex}`), children: initials || /* @__PURE__ */ jsx298("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx298("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" }) }) }) });
|
|
5615
5676
|
};
|
|
5616
5677
|
Avatar.displayName = "Avatar";
|
|
5617
5678
|
var Avatar_default = Avatar;
|
|
5618
5679
|
|
|
5619
5680
|
// src/components/Badge/Badge.tsx
|
|
5620
|
-
import { jsx as
|
|
5681
|
+
import { jsx as jsx299, jsxs as jsxs191 } from "react/jsx-runtime";
|
|
5621
5682
|
var Badge = (props) => {
|
|
5622
5683
|
const {
|
|
5623
5684
|
children,
|
|
@@ -5631,14 +5692,14 @@ var Badge = (props) => {
|
|
|
5631
5692
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
5632
5693
|
return /* @__PURE__ */ jsxs191("div", { className: clsx_default("lib-xplat-badge", size), children: [
|
|
5633
5694
|
children,
|
|
5634
|
-
showBadge && /* @__PURE__ */
|
|
5695
|
+
showBadge && /* @__PURE__ */ jsx299("span", { className: clsx_default("badge-indicator", type, { dot }), children: !dot && displayCount })
|
|
5635
5696
|
] });
|
|
5636
5697
|
};
|
|
5637
5698
|
Badge.displayName = "Badge";
|
|
5638
5699
|
var Badge_default = Badge;
|
|
5639
5700
|
|
|
5640
5701
|
// src/components/Box/Box.tsx
|
|
5641
|
-
import { jsx as
|
|
5702
|
+
import { jsx as jsx300, jsxs as jsxs192 } from "react/jsx-runtime";
|
|
5642
5703
|
var Box = ({
|
|
5643
5704
|
children,
|
|
5644
5705
|
title,
|
|
@@ -5646,22 +5707,22 @@ var Box = ({
|
|
|
5646
5707
|
padding = "md"
|
|
5647
5708
|
}) => {
|
|
5648
5709
|
return /* @__PURE__ */ jsxs192("div", { className: clsx_default("lib-xplat-box", variant, `pad-${padding}`), children: [
|
|
5649
|
-
title && /* @__PURE__ */
|
|
5650
|
-
/* @__PURE__ */
|
|
5710
|
+
title && /* @__PURE__ */ jsx300("div", { className: "box-title", children: title }),
|
|
5711
|
+
/* @__PURE__ */ jsx300("div", { className: "box-content", children })
|
|
5651
5712
|
] });
|
|
5652
5713
|
};
|
|
5653
5714
|
Box.displayName = "Box";
|
|
5654
5715
|
var Box_default = Box;
|
|
5655
5716
|
|
|
5656
5717
|
// src/components/Breadcrumb/Breadcrumb.tsx
|
|
5657
|
-
import { jsx as
|
|
5718
|
+
import { jsx as jsx301, jsxs as jsxs193 } from "react/jsx-runtime";
|
|
5658
5719
|
var Breadcrumb = (props) => {
|
|
5659
5720
|
const { items, separator = "/" } = props;
|
|
5660
|
-
return /* @__PURE__ */
|
|
5721
|
+
return /* @__PURE__ */ jsx301("nav", { className: "lib-xplat-breadcrumb", "aria-label": "\uACBD\uB85C", children: /* @__PURE__ */ jsx301("ol", { children: items.map((item, index) => {
|
|
5661
5722
|
const isLast = index === items.length - 1;
|
|
5662
5723
|
return /* @__PURE__ */ jsxs193("li", { children: [
|
|
5663
|
-
isLast ? /* @__PURE__ */
|
|
5664
|
-
!isLast && /* @__PURE__ */
|
|
5724
|
+
isLast ? /* @__PURE__ */ jsx301("span", { className: "current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ jsx301("a", { href: item.href, className: "link", children: item.label }) : /* @__PURE__ */ jsx301("button", { className: "link", onClick: item.onClick, children: item.label }),
|
|
5725
|
+
!isLast && /* @__PURE__ */ jsx301("span", { className: "separator", children: separator })
|
|
5665
5726
|
] }, index);
|
|
5666
5727
|
}) }) });
|
|
5667
5728
|
};
|
|
@@ -5669,7 +5730,7 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
5669
5730
|
var Breadcrumb_default = Breadcrumb;
|
|
5670
5731
|
|
|
5671
5732
|
// src/components/Button/Button.tsx
|
|
5672
|
-
import { jsx as
|
|
5733
|
+
import { jsx as jsx302 } from "react/jsx-runtime";
|
|
5673
5734
|
var Button = (props) => {
|
|
5674
5735
|
const {
|
|
5675
5736
|
children,
|
|
@@ -5678,7 +5739,7 @@ var Button = (props) => {
|
|
|
5678
5739
|
disabled,
|
|
5679
5740
|
...rest
|
|
5680
5741
|
} = props;
|
|
5681
|
-
return /* @__PURE__ */
|
|
5742
|
+
return /* @__PURE__ */ jsx302(
|
|
5682
5743
|
"button",
|
|
5683
5744
|
{
|
|
5684
5745
|
className: clsx_default("lib-xplat-button", type, size),
|
|
@@ -5692,15 +5753,15 @@ Button.displayName = "Button";
|
|
|
5692
5753
|
var Button_default = Button;
|
|
5693
5754
|
|
|
5694
5755
|
// src/components/Calendar/Calendar.tsx
|
|
5695
|
-
import
|
|
5756
|
+
import React4 from "react";
|
|
5696
5757
|
|
|
5697
5758
|
// src/components/Calendar/useCalendar.ts
|
|
5698
|
-
import
|
|
5759
|
+
import React3 from "react";
|
|
5699
5760
|
var useCalendar = (initialYear, initialMonth) => {
|
|
5700
5761
|
const today = /* @__PURE__ */ new Date();
|
|
5701
|
-
const [year, setYear] =
|
|
5702
|
-
const [month, setMonth] =
|
|
5703
|
-
const days =
|
|
5762
|
+
const [year, setYear] = React3.useState(initialYear ?? today.getFullYear());
|
|
5763
|
+
const [month, setMonth] = React3.useState(initialMonth ?? today.getMonth());
|
|
5764
|
+
const days = React3.useMemo(() => {
|
|
5704
5765
|
const firstDay = new Date(year, month, 1);
|
|
5705
5766
|
const lastDay = new Date(year, month + 1, 0);
|
|
5706
5767
|
const startDayOfWeek = firstDay.getDay();
|
|
@@ -5743,7 +5804,7 @@ var useCalendar = (initialYear, initialMonth) => {
|
|
|
5743
5804
|
}
|
|
5744
5805
|
return result;
|
|
5745
5806
|
}, [year, month]);
|
|
5746
|
-
const goToPrevMonth =
|
|
5807
|
+
const goToPrevMonth = React3.useCallback(() => {
|
|
5747
5808
|
setMonth((prev) => {
|
|
5748
5809
|
if (prev === 0) {
|
|
5749
5810
|
setYear((y) => y - 1);
|
|
@@ -5752,7 +5813,7 @@ var useCalendar = (initialYear, initialMonth) => {
|
|
|
5752
5813
|
return prev - 1;
|
|
5753
5814
|
});
|
|
5754
5815
|
}, []);
|
|
5755
|
-
const goToNextMonth =
|
|
5816
|
+
const goToNextMonth = React3.useCallback(() => {
|
|
5756
5817
|
setMonth((prev) => {
|
|
5757
5818
|
if (prev === 11) {
|
|
5758
5819
|
setYear((y) => y + 1);
|
|
@@ -5761,7 +5822,7 @@ var useCalendar = (initialYear, initialMonth) => {
|
|
|
5761
5822
|
return prev + 1;
|
|
5762
5823
|
});
|
|
5763
5824
|
}, []);
|
|
5764
|
-
const goToToday =
|
|
5825
|
+
const goToToday = React3.useCallback(() => {
|
|
5765
5826
|
setYear(today.getFullYear());
|
|
5766
5827
|
setMonth(today.getMonth());
|
|
5767
5828
|
}, []);
|
|
@@ -5795,8 +5856,8 @@ var MONTH_LABELS = {
|
|
|
5795
5856
|
};
|
|
5796
5857
|
|
|
5797
5858
|
// src/components/Calendar/Calendar.tsx
|
|
5798
|
-
import { Fragment, jsx as
|
|
5799
|
-
var DayCell =
|
|
5859
|
+
import { Fragment, jsx as jsx303, jsxs as jsxs194 } from "react/jsx-runtime";
|
|
5860
|
+
var DayCell = React4.memo(
|
|
5800
5861
|
({
|
|
5801
5862
|
day,
|
|
5802
5863
|
disabled,
|
|
@@ -5807,7 +5868,7 @@ var DayCell = React3.memo(
|
|
|
5807
5868
|
onEventClick
|
|
5808
5869
|
}) => {
|
|
5809
5870
|
if (renderDay) {
|
|
5810
|
-
return /* @__PURE__ */
|
|
5871
|
+
return /* @__PURE__ */ jsx303(
|
|
5811
5872
|
"div",
|
|
5812
5873
|
{
|
|
5813
5874
|
className: clsx_default(
|
|
@@ -5840,13 +5901,13 @@ var DayCell = React3.memo(
|
|
|
5840
5901
|
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
5841
5902
|
},
|
|
5842
5903
|
children: [
|
|
5843
|
-
/* @__PURE__ */
|
|
5904
|
+
/* @__PURE__ */ jsx303("span", { className: "calendar-day-number", children: day.day }),
|
|
5844
5905
|
dayEvents.length > 0 && /* @__PURE__ */ jsxs194("div", { className: "calendar-day-events", children: [
|
|
5845
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */
|
|
5906
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ jsx303(
|
|
5846
5907
|
"span",
|
|
5847
5908
|
{
|
|
5848
5909
|
className: "calendar-event-dot",
|
|
5849
|
-
style: { backgroundColor: event.color ?? "var(--
|
|
5910
|
+
style: { backgroundColor: event.color ?? "var(--semantic-surface-brand-default)" },
|
|
5850
5911
|
title: event.label,
|
|
5851
5912
|
onClick: (e) => {
|
|
5852
5913
|
e.stopPropagation();
|
|
@@ -5892,14 +5953,14 @@ var Calendar = (props) => {
|
|
|
5892
5953
|
setYear,
|
|
5893
5954
|
setMonth
|
|
5894
5955
|
} = useCalendar(yearProp, monthProp);
|
|
5895
|
-
const [pickerMode, setPickerMode] =
|
|
5896
|
-
const [yearRangeStart, setYearRangeStart] =
|
|
5956
|
+
const [pickerMode, setPickerMode] = React4.useState("days");
|
|
5957
|
+
const [yearRangeStart, setYearRangeStart] = React4.useState(
|
|
5897
5958
|
Math.floor(year / 12) * 12
|
|
5898
5959
|
);
|
|
5899
|
-
|
|
5960
|
+
React4.useEffect(() => {
|
|
5900
5961
|
if (yearProp !== void 0) setYear(yearProp);
|
|
5901
5962
|
}, [yearProp, setYear]);
|
|
5902
|
-
|
|
5963
|
+
React4.useEffect(() => {
|
|
5903
5964
|
if (monthProp !== void 0) setMonth(monthProp);
|
|
5904
5965
|
}, [monthProp, setMonth]);
|
|
5905
5966
|
const handlePrev = () => {
|
|
@@ -5951,15 +6012,15 @@ var Calendar = (props) => {
|
|
|
5951
6012
|
setPickerMode("months");
|
|
5952
6013
|
onMonthChange?.(y, month);
|
|
5953
6014
|
};
|
|
5954
|
-
const minTime =
|
|
6015
|
+
const minTime = React4.useMemo(
|
|
5955
6016
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
5956
6017
|
[minDate]
|
|
5957
6018
|
);
|
|
5958
|
-
const maxTime =
|
|
6019
|
+
const maxTime = React4.useMemo(
|
|
5959
6020
|
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
5960
6021
|
[maxDate]
|
|
5961
6022
|
);
|
|
5962
|
-
const eventsMap =
|
|
6023
|
+
const eventsMap = React4.useMemo(() => {
|
|
5963
6024
|
const map = /* @__PURE__ */ new Map();
|
|
5964
6025
|
for (const e of events) {
|
|
5965
6026
|
const key = `${e.date.getFullYear()}-${e.date.getMonth()}-${e.date.getDate()}`;
|
|
@@ -5969,7 +6030,7 @@ var Calendar = (props) => {
|
|
|
5969
6030
|
}
|
|
5970
6031
|
return map;
|
|
5971
6032
|
}, [events]);
|
|
5972
|
-
const getEventsForDay =
|
|
6033
|
+
const getEventsForDay = React4.useCallback(
|
|
5973
6034
|
(date) => eventsMap.get(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`) ?? [],
|
|
5974
6035
|
[eventsMap]
|
|
5975
6036
|
);
|
|
@@ -5983,14 +6044,14 @@ var Calendar = (props) => {
|
|
|
5983
6044
|
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
5984
6045
|
children: [
|
|
5985
6046
|
/* @__PURE__ */ jsxs194("div", { className: "calendar-header", children: [
|
|
5986
|
-
/* @__PURE__ */
|
|
5987
|
-
/* @__PURE__ */
|
|
5988
|
-
/* @__PURE__ */
|
|
5989
|
-
showToday && /* @__PURE__ */
|
|
6047
|
+
/* @__PURE__ */ jsx303("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804", children: /* @__PURE__ */ jsx303(ChevronLeftIcon_default, {}) }),
|
|
6048
|
+
/* @__PURE__ */ jsx303("button", { className: "calendar-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
6049
|
+
/* @__PURE__ */ jsx303("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C", children: /* @__PURE__ */ jsx303(ChevronRightIcon_default, {}) }),
|
|
6050
|
+
showToday && /* @__PURE__ */ jsx303("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
5990
6051
|
] }),
|
|
5991
|
-
pickerMode === "years" && /* @__PURE__ */
|
|
6052
|
+
pickerMode === "years" && /* @__PURE__ */ jsx303("div", { className: "calendar-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
5992
6053
|
const y = yearRangeStart + i;
|
|
5993
|
-
return /* @__PURE__ */
|
|
6054
|
+
return /* @__PURE__ */ jsx303(
|
|
5994
6055
|
"button",
|
|
5995
6056
|
{
|
|
5996
6057
|
type: "button",
|
|
@@ -6001,7 +6062,7 @@ var Calendar = (props) => {
|
|
|
6001
6062
|
y
|
|
6002
6063
|
);
|
|
6003
6064
|
}) }),
|
|
6004
|
-
pickerMode === "months" && /* @__PURE__ */
|
|
6065
|
+
pickerMode === "months" && /* @__PURE__ */ jsx303("div", { className: "calendar-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ jsx303(
|
|
6005
6066
|
"button",
|
|
6006
6067
|
{
|
|
6007
6068
|
type: "button",
|
|
@@ -6012,7 +6073,7 @@ var Calendar = (props) => {
|
|
|
6012
6073
|
i
|
|
6013
6074
|
)) }),
|
|
6014
6075
|
pickerMode === "days" && /* @__PURE__ */ jsxs194(Fragment, { children: [
|
|
6015
|
-
/* @__PURE__ */
|
|
6076
|
+
/* @__PURE__ */ jsx303("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ jsx303(
|
|
6016
6077
|
"div",
|
|
6017
6078
|
{
|
|
6018
6079
|
className: clsx_default(
|
|
@@ -6024,12 +6085,12 @@ var Calendar = (props) => {
|
|
|
6024
6085
|
},
|
|
6025
6086
|
label
|
|
6026
6087
|
)) }),
|
|
6027
|
-
/* @__PURE__ */
|
|
6088
|
+
/* @__PURE__ */ jsx303("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
6028
6089
|
const dayEvents = getEventsForDay(day.date);
|
|
6029
6090
|
const t = day.date.getTime();
|
|
6030
6091
|
const disabled = t < minTime || t > maxTime;
|
|
6031
6092
|
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
6032
|
-
return /* @__PURE__ */
|
|
6093
|
+
return /* @__PURE__ */ jsx303(
|
|
6033
6094
|
DayCell,
|
|
6034
6095
|
{
|
|
6035
6096
|
day,
|
|
@@ -6052,13 +6113,13 @@ Calendar.displayName = "Calendar";
|
|
|
6052
6113
|
var Calendar_default = Calendar;
|
|
6053
6114
|
|
|
6054
6115
|
// src/components/CardTab/CardTab.tsx
|
|
6055
|
-
import
|
|
6116
|
+
import React5 from "react";
|
|
6056
6117
|
|
|
6057
6118
|
// src/components/CardTab/CardTabPanel.tsx
|
|
6058
|
-
import { jsx as
|
|
6119
|
+
import { jsx as jsx304 } from "react/jsx-runtime";
|
|
6059
6120
|
var CardTabPanel = (props) => {
|
|
6060
6121
|
const { children, columns = 3 } = props;
|
|
6061
|
-
return /* @__PURE__ */
|
|
6122
|
+
return /* @__PURE__ */ jsx304(
|
|
6062
6123
|
"div",
|
|
6063
6124
|
{
|
|
6064
6125
|
className: "card-tab-panel",
|
|
@@ -6071,7 +6132,7 @@ CardTabPanel.displayName = "CardTab.Panel";
|
|
|
6071
6132
|
var CardTabPanel_default = CardTabPanel;
|
|
6072
6133
|
|
|
6073
6134
|
// src/components/CardTab/CardTab.tsx
|
|
6074
|
-
import { jsx as
|
|
6135
|
+
import { jsx as jsx305, jsxs as jsxs195 } from "react/jsx-runtime";
|
|
6075
6136
|
var CardTabRoot = (props) => {
|
|
6076
6137
|
const {
|
|
6077
6138
|
tabs,
|
|
@@ -6081,7 +6142,7 @@ var CardTabRoot = (props) => {
|
|
|
6081
6142
|
children
|
|
6082
6143
|
} = props;
|
|
6083
6144
|
const isControlled = activeValueProp !== void 0;
|
|
6084
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6145
|
+
const [uncontrolledValue, setUncontrolledValue] = React5.useState(tabs[0]?.value ?? "");
|
|
6085
6146
|
const activeValue = isControlled ? activeValueProp : uncontrolledValue;
|
|
6086
6147
|
const handleTabClick = (tab) => {
|
|
6087
6148
|
if (!isControlled) {
|
|
@@ -6089,16 +6150,16 @@ var CardTabRoot = (props) => {
|
|
|
6089
6150
|
}
|
|
6090
6151
|
onChange?.(tab);
|
|
6091
6152
|
};
|
|
6092
|
-
const panels =
|
|
6093
|
-
(child) =>
|
|
6153
|
+
const panels = React5.Children.toArray(children).filter(
|
|
6154
|
+
(child) => React5.isValidElement(child) && child.type === CardTabPanel_default
|
|
6094
6155
|
);
|
|
6095
6156
|
const activePanel = panels.find(
|
|
6096
6157
|
(panel) => panel.props.value === activeValue
|
|
6097
6158
|
);
|
|
6098
6159
|
return /* @__PURE__ */ jsxs195("div", { className: clsx_default("lib-xplat-card-tab", size), children: [
|
|
6099
|
-
/* @__PURE__ */
|
|
6160
|
+
/* @__PURE__ */ jsx305("div", { className: "card-tab-bar", children: tabs.map((tab) => {
|
|
6100
6161
|
const isActive2 = tab.value === activeValue;
|
|
6101
|
-
return /* @__PURE__ */
|
|
6162
|
+
return /* @__PURE__ */ jsx305(
|
|
6102
6163
|
"button",
|
|
6103
6164
|
{
|
|
6104
6165
|
className: clsx_default("card-tab-trigger", isActive2 && "active"),
|
|
@@ -6110,7 +6171,7 @@ var CardTabRoot = (props) => {
|
|
|
6110
6171
|
tab.value
|
|
6111
6172
|
);
|
|
6112
6173
|
}) }),
|
|
6113
|
-
/* @__PURE__ */
|
|
6174
|
+
/* @__PURE__ */ jsx305("div", { className: "card-tab-body", children: activePanel })
|
|
6114
6175
|
] });
|
|
6115
6176
|
};
|
|
6116
6177
|
CardTabRoot.displayName = "CardTab";
|
|
@@ -6120,8 +6181,8 @@ var CardTab = Object.assign(CardTabRoot, {
|
|
|
6120
6181
|
var CardTab_default = CardTab;
|
|
6121
6182
|
|
|
6122
6183
|
// src/components/Chart/Chart.tsx
|
|
6123
|
-
import
|
|
6124
|
-
import { Fragment as Fragment2, jsx as
|
|
6184
|
+
import React6 from "react";
|
|
6185
|
+
import { Fragment as Fragment2, jsx as jsx306, jsxs as jsxs196 } from "react/jsx-runtime";
|
|
6125
6186
|
var CATEGORICAL_COUNT2 = 8;
|
|
6126
6187
|
var LINE_BAR_PALETTES = Array.from({ length: CATEGORICAL_COUNT2 }, (_, i) => {
|
|
6127
6188
|
const n = i + 1;
|
|
@@ -6166,8 +6227,8 @@ var toSmoothPath = (points) => {
|
|
|
6166
6227
|
return d;
|
|
6167
6228
|
};
|
|
6168
6229
|
var useChartSize = (ref) => {
|
|
6169
|
-
const [size, setSize] =
|
|
6170
|
-
|
|
6230
|
+
const [size, setSize] = React6.useState({ width: 0, height: 0 });
|
|
6231
|
+
React6.useEffect(() => {
|
|
6171
6232
|
const el = ref.current;
|
|
6172
6233
|
if (!el) return;
|
|
6173
6234
|
let rafId = 0;
|
|
@@ -6193,10 +6254,10 @@ var useChartSize = (ref) => {
|
|
|
6193
6254
|
};
|
|
6194
6255
|
var prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6195
6256
|
var useChartAnimation = (containerRef, dataKey) => {
|
|
6196
|
-
const [animate, setAnimate] =
|
|
6197
|
-
const prevDataKey =
|
|
6198
|
-
const hasAnimated =
|
|
6199
|
-
|
|
6257
|
+
const [animate, setAnimate] = React6.useState(false);
|
|
6258
|
+
const prevDataKey = React6.useRef(dataKey);
|
|
6259
|
+
const hasAnimated = React6.useRef(false);
|
|
6260
|
+
React6.useEffect(() => {
|
|
6200
6261
|
if (prefersReducedMotion()) return;
|
|
6201
6262
|
const el = containerRef.current;
|
|
6202
6263
|
if (!el) return;
|
|
@@ -6212,7 +6273,7 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
6212
6273
|
observer.observe(el);
|
|
6213
6274
|
return () => observer.disconnect();
|
|
6214
6275
|
}, [containerRef]);
|
|
6215
|
-
|
|
6276
|
+
React6.useEffect(() => {
|
|
6216
6277
|
if (dataKey !== prevDataKey.current) {
|
|
6217
6278
|
prevDataKey.current = dataKey;
|
|
6218
6279
|
if (prefersReducedMotion()) return;
|
|
@@ -6226,15 +6287,15 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
6226
6287
|
};
|
|
6227
6288
|
var TOOLTIP_OFFSET = 12;
|
|
6228
6289
|
var useChartTooltip = (enabled) => {
|
|
6229
|
-
const [tooltip, setTooltip] =
|
|
6290
|
+
const [tooltip, setTooltip] = React6.useState({
|
|
6230
6291
|
visible: false,
|
|
6231
6292
|
x: 0,
|
|
6232
6293
|
y: 0,
|
|
6233
6294
|
content: ""
|
|
6234
6295
|
});
|
|
6235
|
-
const containerRef =
|
|
6236
|
-
const rafRef =
|
|
6237
|
-
const move =
|
|
6296
|
+
const containerRef = React6.useRef(null);
|
|
6297
|
+
const rafRef = React6.useRef(0);
|
|
6298
|
+
const move = React6.useCallback((e) => {
|
|
6238
6299
|
if (!enabled) return;
|
|
6239
6300
|
const cx = e.clientX;
|
|
6240
6301
|
const cy = e.clientY;
|
|
@@ -6245,24 +6306,24 @@ var useChartTooltip = (enabled) => {
|
|
|
6245
6306
|
setTooltip((prev) => ({ ...prev, x: cx - rect.left, y: cy - rect.top }));
|
|
6246
6307
|
});
|
|
6247
6308
|
}, [enabled]);
|
|
6248
|
-
const show =
|
|
6309
|
+
const show = React6.useCallback((e, content) => {
|
|
6249
6310
|
if (!enabled) return;
|
|
6250
6311
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
6251
6312
|
if (!rect) return;
|
|
6252
6313
|
setTooltip({ visible: true, x: e.clientX - rect.left, y: e.clientY - rect.top, content });
|
|
6253
6314
|
}, [enabled]);
|
|
6254
|
-
const hide =
|
|
6315
|
+
const hide = React6.useCallback(() => {
|
|
6255
6316
|
cancelAnimationFrame(rafRef.current);
|
|
6256
6317
|
setTooltip((prev) => ({ ...prev, visible: false }));
|
|
6257
6318
|
}, []);
|
|
6258
6319
|
return { tooltip, show, hide, move, containerRef };
|
|
6259
6320
|
};
|
|
6260
|
-
var GridLines =
|
|
6321
|
+
var GridLines = React6.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ jsx306(Fragment2, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
6261
6322
|
const y = PADDING.top + (1 - ratio) * chartH;
|
|
6262
6323
|
const val = Math.round(maxVal * ratio);
|
|
6263
6324
|
return /* @__PURE__ */ jsxs196("g", { children: [
|
|
6264
|
-
/* @__PURE__ */
|
|
6265
|
-
/* @__PURE__ */
|
|
6325
|
+
/* @__PURE__ */ jsx306("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
6326
|
+
/* @__PURE__ */ jsx306("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
6266
6327
|
] }, ratio);
|
|
6267
6328
|
}) }));
|
|
6268
6329
|
GridLines.displayName = "GridLines";
|
|
@@ -6272,18 +6333,18 @@ var getLabelStep = (count, chartW) => {
|
|
|
6272
6333
|
if (count <= maxLabels) return 1;
|
|
6273
6334
|
return Math.ceil(count / maxLabels);
|
|
6274
6335
|
};
|
|
6275
|
-
var AxisLabels =
|
|
6336
|
+
var AxisLabels = React6.memo(({ labels, count, chartW, height }) => {
|
|
6276
6337
|
const step = getLabelStep(count, chartW);
|
|
6277
|
-
return /* @__PURE__ */
|
|
6338
|
+
return /* @__PURE__ */ jsx306(Fragment2, { children: labels.map((label, i) => {
|
|
6278
6339
|
if (i % step !== 0) return null;
|
|
6279
6340
|
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
6280
|
-
return /* @__PURE__ */
|
|
6341
|
+
return /* @__PURE__ */ jsx306("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6281
6342
|
}) });
|
|
6282
6343
|
});
|
|
6283
6344
|
AxisLabels.displayName = "AxisLabels";
|
|
6284
6345
|
var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
6285
|
-
const [activeIndex, setActiveIndex] =
|
|
6286
|
-
const handleMouseMove =
|
|
6346
|
+
const [activeIndex, setActiveIndex] = React6.useState(null);
|
|
6347
|
+
const handleMouseMove = React6.useCallback((e) => {
|
|
6287
6348
|
const svg = e.currentTarget;
|
|
6288
6349
|
const rect = svg.getBoundingClientRect();
|
|
6289
6350
|
const mx = (e.clientX - rect.left) / rect.width * svg.viewBox.baseVal.width;
|
|
@@ -6302,17 +6363,17 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
6302
6363
|
}
|
|
6303
6364
|
setActiveIndex(minDist <= threshold ? closest : null);
|
|
6304
6365
|
}, [seriesPoints]);
|
|
6305
|
-
const handleMouseLeave =
|
|
6366
|
+
const handleMouseLeave = React6.useCallback(() => {
|
|
6306
6367
|
setActiveIndex(null);
|
|
6307
6368
|
}, []);
|
|
6308
|
-
const tooltipContent =
|
|
6369
|
+
const tooltipContent = React6.useMemo(() => {
|
|
6309
6370
|
if (activeIndex === null) return "";
|
|
6310
6371
|
return entries.map(([key], di) => {
|
|
6311
6372
|
const p = seriesPoints[di]?.[activeIndex];
|
|
6312
6373
|
return p ? `${key}: ${p.v}` : "";
|
|
6313
6374
|
}).filter(Boolean).join(" / ");
|
|
6314
6375
|
}, [activeIndex, entries, seriesPoints]);
|
|
6315
|
-
const getTooltipAt =
|
|
6376
|
+
const getTooltipAt = React6.useCallback((idx) => {
|
|
6316
6377
|
return entries.map(([key], di) => {
|
|
6317
6378
|
const p = seriesPoints[di]?.[idx];
|
|
6318
6379
|
return p ? `${key}: ${p.v}` : "";
|
|
@@ -6320,16 +6381,16 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
6320
6381
|
}, [entries, seriesPoints]);
|
|
6321
6382
|
return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
|
|
6322
6383
|
};
|
|
6323
|
-
var LineChart =
|
|
6324
|
-
const entries =
|
|
6325
|
-
const maxVal =
|
|
6384
|
+
var LineChart = React6.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6385
|
+
const entries = React6.useMemo(() => Object.entries(data), [data]);
|
|
6386
|
+
const maxVal = React6.useMemo(() => {
|
|
6326
6387
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6327
6388
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6328
6389
|
}, [entries]);
|
|
6329
6390
|
const count = labels.length;
|
|
6330
6391
|
const chartW = width - PADDING.left - PADDING.right;
|
|
6331
6392
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6332
|
-
const seriesPoints =
|
|
6393
|
+
const seriesPoints = React6.useMemo(
|
|
6333
6394
|
() => entries.map(
|
|
6334
6395
|
([, values]) => values.map((v, i) => ({
|
|
6335
6396
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -6339,9 +6400,9 @@ var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6339
6400
|
),
|
|
6340
6401
|
[entries, count, chartW, chartH, maxVal]
|
|
6341
6402
|
);
|
|
6342
|
-
const clipRef =
|
|
6403
|
+
const clipRef = React6.useRef(null);
|
|
6343
6404
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
6344
|
-
|
|
6405
|
+
React6.useEffect(() => {
|
|
6345
6406
|
if (!animate || !clipRef.current) return;
|
|
6346
6407
|
clipRef.current.setAttribute("width", "0");
|
|
6347
6408
|
requestAnimationFrame(() => {
|
|
@@ -6371,9 +6432,9 @@ var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6371
6432
|
onLeave();
|
|
6372
6433
|
},
|
|
6373
6434
|
children: [
|
|
6374
|
-
animate && /* @__PURE__ */
|
|
6375
|
-
/* @__PURE__ */
|
|
6376
|
-
/* @__PURE__ */
|
|
6435
|
+
animate && /* @__PURE__ */ jsx306("defs", { children: /* @__PURE__ */ jsx306("clipPath", { id: lineClipId, children: /* @__PURE__ */ jsx306("rect", { ref: clipRef, x: "0", y: "0", width: animate ? 0 : width, height }) }) }),
|
|
6436
|
+
/* @__PURE__ */ jsx306(GridLines, { width, height, chartH, maxVal }),
|
|
6437
|
+
/* @__PURE__ */ jsx306(AxisLabels, { labels, count, chartW, height }),
|
|
6377
6438
|
entries.map(([key], di) => {
|
|
6378
6439
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6379
6440
|
const color = palette[2];
|
|
@@ -6383,15 +6444,15 @@ var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6383
6444
|
const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
|
|
6384
6445
|
const areaD = `M ${points[0].x},${points[0].y} ${points.map((p) => `L ${p.x},${p.y}`).join(" ")} L ${points[points.length - 1].x},${PADDING.top + chartH} L ${points[0].x},${PADDING.top + chartH} Z`;
|
|
6385
6446
|
return /* @__PURE__ */ jsxs196("g", { children: [
|
|
6386
|
-
/* @__PURE__ */
|
|
6387
|
-
/* @__PURE__ */
|
|
6388
|
-
/* @__PURE__ */
|
|
6447
|
+
/* @__PURE__ */ jsx306("defs", { children: /* @__PURE__ */ jsxs196("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6448
|
+
/* @__PURE__ */ jsx306("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.2" }),
|
|
6449
|
+
/* @__PURE__ */ jsx306("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0" })
|
|
6389
6450
|
] }) }),
|
|
6390
6451
|
/* @__PURE__ */ jsxs196("g", { clipPath: animate ? `url(#${lineClipId})` : void 0, children: [
|
|
6391
|
-
/* @__PURE__ */
|
|
6392
|
-
/* @__PURE__ */
|
|
6452
|
+
/* @__PURE__ */ jsx306("path", { d: areaD, fill: `url(#${gradientId})` }),
|
|
6453
|
+
/* @__PURE__ */ jsx306("polyline", { points: polyPoints, fill: "none", stroke: color, strokeWidth: "2" })
|
|
6393
6454
|
] }),
|
|
6394
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */
|
|
6455
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ jsx306(
|
|
6395
6456
|
"circle",
|
|
6396
6457
|
{
|
|
6397
6458
|
cx: points[activeIndex].x,
|
|
@@ -6403,7 +6464,7 @@ var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6403
6464
|
)
|
|
6404
6465
|
] }, di);
|
|
6405
6466
|
}),
|
|
6406
|
-
activeX !== null && /* @__PURE__ */
|
|
6467
|
+
activeX !== null && /* @__PURE__ */ jsx306(
|
|
6407
6468
|
"line",
|
|
6408
6469
|
{
|
|
6409
6470
|
x1: activeX,
|
|
@@ -6413,7 +6474,7 @@ var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6413
6474
|
className: "chart-crosshair"
|
|
6414
6475
|
}
|
|
6415
6476
|
),
|
|
6416
|
-
/* @__PURE__ */
|
|
6477
|
+
/* @__PURE__ */ jsx306(
|
|
6417
6478
|
"rect",
|
|
6418
6479
|
{
|
|
6419
6480
|
x: PADDING.left,
|
|
@@ -6429,16 +6490,16 @@ var LineChart = React5.memo(({ data, labels, width, height, animate, onHover, on
|
|
|
6429
6490
|
);
|
|
6430
6491
|
});
|
|
6431
6492
|
LineChart.displayName = "LineChart";
|
|
6432
|
-
var CurveChart =
|
|
6433
|
-
const entries =
|
|
6434
|
-
const maxVal =
|
|
6493
|
+
var CurveChart = React6.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6494
|
+
const entries = React6.useMemo(() => Object.entries(data), [data]);
|
|
6495
|
+
const maxVal = React6.useMemo(() => {
|
|
6435
6496
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6436
6497
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6437
6498
|
}, [entries]);
|
|
6438
6499
|
const count = labels.length;
|
|
6439
6500
|
const chartW = width - PADDING.left - PADDING.right;
|
|
6440
6501
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6441
|
-
const seriesPoints =
|
|
6502
|
+
const seriesPoints = React6.useMemo(
|
|
6442
6503
|
() => entries.map(
|
|
6443
6504
|
([, values]) => values.map((v, i) => ({
|
|
6444
6505
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -6448,9 +6509,9 @@ var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6448
6509
|
),
|
|
6449
6510
|
[entries, count, chartW, chartH, maxVal]
|
|
6450
6511
|
);
|
|
6451
|
-
const curveClipRef =
|
|
6512
|
+
const curveClipRef = React6.useRef(null);
|
|
6452
6513
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
6453
|
-
|
|
6514
|
+
React6.useEffect(() => {
|
|
6454
6515
|
if (!animate || !curveClipRef.current) return;
|
|
6455
6516
|
curveClipRef.current.setAttribute("width", "0");
|
|
6456
6517
|
requestAnimationFrame(() => {
|
|
@@ -6481,9 +6542,9 @@ var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6481
6542
|
onLeave();
|
|
6482
6543
|
},
|
|
6483
6544
|
children: [
|
|
6484
|
-
animate && /* @__PURE__ */
|
|
6485
|
-
/* @__PURE__ */
|
|
6486
|
-
/* @__PURE__ */
|
|
6545
|
+
animate && /* @__PURE__ */ jsx306("defs", { children: /* @__PURE__ */ jsx306("clipPath", { id: curveClipId, children: /* @__PURE__ */ jsx306("rect", { ref: curveClipRef, x: "0", y: "0", width: animate ? 0 : width, height }) }) }),
|
|
6546
|
+
/* @__PURE__ */ jsx306(GridLines, { width, height, chartH, maxVal }),
|
|
6547
|
+
/* @__PURE__ */ jsx306(AxisLabels, { labels, count, chartW, height }),
|
|
6487
6548
|
entries.map(([key], di) => {
|
|
6488
6549
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6489
6550
|
const color = palette[2];
|
|
@@ -6493,15 +6554,15 @@ var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6493
6554
|
const linePath = toSmoothPath(points);
|
|
6494
6555
|
const areaPath = linePath + ` L ${points[points.length - 1].x} ${PADDING.top + chartH} L ${points[0].x} ${PADDING.top + chartH} Z`;
|
|
6495
6556
|
return /* @__PURE__ */ jsxs196("g", { children: [
|
|
6496
|
-
/* @__PURE__ */
|
|
6497
|
-
/* @__PURE__ */
|
|
6498
|
-
/* @__PURE__ */
|
|
6557
|
+
/* @__PURE__ */ jsx306("defs", { children: /* @__PURE__ */ jsxs196("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6558
|
+
/* @__PURE__ */ jsx306("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.4" }),
|
|
6559
|
+
/* @__PURE__ */ jsx306("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0.02" })
|
|
6499
6560
|
] }) }),
|
|
6500
6561
|
/* @__PURE__ */ jsxs196("g", { clipPath: animate ? `url(#${curveClipId})` : void 0, children: [
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
6562
|
+
/* @__PURE__ */ jsx306("path", { d: areaPath, fill: `url(#${gradientId})` }),
|
|
6563
|
+
/* @__PURE__ */ jsx306("path", { d: linePath, fill: "none", stroke: color, strokeWidth: "2" })
|
|
6503
6564
|
] }),
|
|
6504
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */
|
|
6565
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ jsx306(
|
|
6505
6566
|
"circle",
|
|
6506
6567
|
{
|
|
6507
6568
|
cx: points[activeIndex].x,
|
|
@@ -6513,7 +6574,7 @@ var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6513
6574
|
)
|
|
6514
6575
|
] }, di);
|
|
6515
6576
|
}),
|
|
6516
|
-
activeX !== null && /* @__PURE__ */
|
|
6577
|
+
activeX !== null && /* @__PURE__ */ jsx306(
|
|
6517
6578
|
"line",
|
|
6518
6579
|
{
|
|
6519
6580
|
x1: activeX,
|
|
@@ -6523,7 +6584,7 @@ var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6523
6584
|
className: "chart-crosshair"
|
|
6524
6585
|
}
|
|
6525
6586
|
),
|
|
6526
|
-
/* @__PURE__ */
|
|
6587
|
+
/* @__PURE__ */ jsx306(
|
|
6527
6588
|
"rect",
|
|
6528
6589
|
{
|
|
6529
6590
|
x: PADDING.left,
|
|
@@ -6539,9 +6600,9 @@ var CurveChart = React5.memo(({ data, labels, width, height, animate, onHover, o
|
|
|
6539
6600
|
);
|
|
6540
6601
|
});
|
|
6541
6602
|
CurveChart.displayName = "CurveChart";
|
|
6542
|
-
var BarChart =
|
|
6543
|
-
const entries =
|
|
6544
|
-
const maxVal =
|
|
6603
|
+
var BarChart = React6.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6604
|
+
const entries = React6.useMemo(() => Object.entries(data), [data]);
|
|
6605
|
+
const maxVal = React6.useMemo(() => {
|
|
6545
6606
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6546
6607
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6547
6608
|
}, [entries]);
|
|
@@ -6553,7 +6614,7 @@ var BarChart = React5.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6553
6614
|
const barGap = groupCount > 1 ? 2 : 0;
|
|
6554
6615
|
const barW = Math.max(1, Math.min(32, (groupW * 0.7 - barGap * (groupCount - 1)) / groupCount));
|
|
6555
6616
|
const baseline = PADDING.top + chartH;
|
|
6556
|
-
const bars =
|
|
6617
|
+
const bars = React6.useMemo(
|
|
6557
6618
|
() => entries.map(
|
|
6558
6619
|
([, values], di) => values.map((v, i) => {
|
|
6559
6620
|
const totalBarsW = barW * groupCount + barGap * (groupCount - 1);
|
|
@@ -6567,10 +6628,10 @@ var BarChart = React5.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6567
6628
|
);
|
|
6568
6629
|
const barLabelStep = getLabelStep(count, chartW);
|
|
6569
6630
|
return /* @__PURE__ */ jsxs196("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
6570
|
-
/* @__PURE__ */
|
|
6631
|
+
/* @__PURE__ */ jsx306(GridLines, { width, height, chartH, maxVal }),
|
|
6571
6632
|
labels.map((label, i) => {
|
|
6572
6633
|
if (i % barLabelStep !== 0) return null;
|
|
6573
|
-
return /* @__PURE__ */
|
|
6634
|
+
return /* @__PURE__ */ jsx306("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6574
6635
|
}),
|
|
6575
6636
|
entries.map(([key], di) => {
|
|
6576
6637
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
@@ -6579,7 +6640,7 @@ var BarChart = React5.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6579
6640
|
const r2 = Math.min(4, b.w / 2);
|
|
6580
6641
|
const d = b.h <= r2 ? `M ${b.x} ${b.y + b.h} V ${b.y} H ${b.x + b.w} V ${b.y + b.h} Z` : `M ${b.x} ${b.y + b.h} V ${b.y + r2} Q ${b.x} ${b.y} ${b.x + r2} ${b.y} H ${b.x + b.w - r2} Q ${b.x + b.w} ${b.y} ${b.x + b.w} ${b.y + r2} V ${b.y + b.h} Z`;
|
|
6581
6642
|
const delay = 100 + i * 80;
|
|
6582
|
-
return /* @__PURE__ */
|
|
6643
|
+
return /* @__PURE__ */ jsx306(
|
|
6583
6644
|
"path",
|
|
6584
6645
|
{
|
|
6585
6646
|
d,
|
|
@@ -6600,11 +6661,11 @@ var BarChart = React5.memo(({ data, labels, width, height, animate, onHover, onM
|
|
|
6600
6661
|
] });
|
|
6601
6662
|
});
|
|
6602
6663
|
BarChart.displayName = "BarChart";
|
|
6603
|
-
var PieDonutChart =
|
|
6664
|
+
var PieDonutChart = React6.memo(
|
|
6604
6665
|
({ data, labels, width, height, animate, isDoughnut, onHover, onMove, onLeave }) => {
|
|
6605
|
-
const entries =
|
|
6606
|
-
const values =
|
|
6607
|
-
const total =
|
|
6666
|
+
const entries = React6.useMemo(() => Object.entries(data), [data]);
|
|
6667
|
+
const values = React6.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
6668
|
+
const total = React6.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
6608
6669
|
const size = Math.min(width, height);
|
|
6609
6670
|
const cx = size / 2;
|
|
6610
6671
|
const cy = size / 2;
|
|
@@ -6612,10 +6673,10 @@ var PieDonutChart = React5.memo(
|
|
|
6612
6673
|
const innerR = isDoughnut ? r2 * 0.5 : 0;
|
|
6613
6674
|
const firstKey = entries[0]?.[0] ?? "";
|
|
6614
6675
|
const colorOffset = hashString(firstKey);
|
|
6615
|
-
const maskRef =
|
|
6676
|
+
const maskRef = React6.useRef(null);
|
|
6616
6677
|
const maskR = r2 + 10;
|
|
6617
6678
|
const maskCircumference = 2 * Math.PI * maskR;
|
|
6618
|
-
|
|
6679
|
+
React6.useEffect(() => {
|
|
6619
6680
|
if (!animate || !maskRef.current) return;
|
|
6620
6681
|
const el = maskRef.current;
|
|
6621
6682
|
el.style.strokeDasharray = `${maskCircumference}`;
|
|
@@ -6625,7 +6686,7 @@ var PieDonutChart = React5.memo(
|
|
|
6625
6686
|
el.style.strokeDashoffset = "0";
|
|
6626
6687
|
});
|
|
6627
6688
|
}, [animate, maskCircumference]);
|
|
6628
|
-
const sliceData =
|
|
6689
|
+
const sliceData = React6.useMemo(() => {
|
|
6629
6690
|
let angle0 = -Math.PI / 2;
|
|
6630
6691
|
let cumulativeAngle = 0;
|
|
6631
6692
|
return values.map((v, i) => {
|
|
@@ -6660,7 +6721,7 @@ var PieDonutChart = React5.memo(
|
|
|
6660
6721
|
}, [values, total, cx, cy, r2, innerR, labels]);
|
|
6661
6722
|
const maskId = `pie-mask-${isDoughnut ? "d" : "p"}`;
|
|
6662
6723
|
return /* @__PURE__ */ jsxs196("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: [
|
|
6663
|
-
animate && /* @__PURE__ */
|
|
6724
|
+
animate && /* @__PURE__ */ jsx306("defs", { children: /* @__PURE__ */ jsx306("mask", { id: maskId, children: /* @__PURE__ */ jsx306(
|
|
6664
6725
|
"circle",
|
|
6665
6726
|
{
|
|
6666
6727
|
ref: maskRef,
|
|
@@ -6673,7 +6734,7 @@ var PieDonutChart = React5.memo(
|
|
|
6673
6734
|
transform: `rotate(-90 ${cx} ${cy})`
|
|
6674
6735
|
}
|
|
6675
6736
|
) }) }),
|
|
6676
|
-
/* @__PURE__ */
|
|
6737
|
+
/* @__PURE__ */ jsx306("g", { mask: animate ? `url(#${maskId})` : void 0, children: sliceData.map((s, i) => /* @__PURE__ */ jsx306("g", { children: /* @__PURE__ */ jsx306(
|
|
6677
6738
|
"path",
|
|
6678
6739
|
{
|
|
6679
6740
|
d: s.d,
|
|
@@ -6689,9 +6750,9 @@ var PieDonutChart = React5.memo(
|
|
|
6689
6750
|
);
|
|
6690
6751
|
PieDonutChart.displayName = "PieDonutChart";
|
|
6691
6752
|
var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, children }) => {
|
|
6692
|
-
const ref =
|
|
6693
|
-
const [pos, setPos] =
|
|
6694
|
-
|
|
6753
|
+
const ref = React6.useRef(null);
|
|
6754
|
+
const [pos, setPos] = React6.useState({ left: 0, top: 0 });
|
|
6755
|
+
React6.useLayoutEffect(() => {
|
|
6695
6756
|
const el = ref.current;
|
|
6696
6757
|
if (!el) return;
|
|
6697
6758
|
const w = el.offsetWidth;
|
|
@@ -6715,8 +6776,8 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
6715
6776
|
className: `lib-xplat-tooltip ${tooltipType} chart-tooltip-pos`,
|
|
6716
6777
|
style: { left: pos.left, top: pos.top },
|
|
6717
6778
|
children: [
|
|
6718
|
-
title && /* @__PURE__ */
|
|
6719
|
-
desc && /* @__PURE__ */
|
|
6779
|
+
title && /* @__PURE__ */ jsx306("div", { className: "tooltip-title", children: title }),
|
|
6780
|
+
desc && /* @__PURE__ */ jsx306("div", { className: "tooltip-desc", children: desc })
|
|
6720
6781
|
]
|
|
6721
6782
|
}
|
|
6722
6783
|
);
|
|
@@ -6728,13 +6789,13 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
6728
6789
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
6729
6790
|
const firstKey = entries[0]?.[0] ?? "";
|
|
6730
6791
|
const colorOffset = hashString(firstKey);
|
|
6731
|
-
return /* @__PURE__ */
|
|
6792
|
+
return /* @__PURE__ */ jsx306("div", { className: "chart-legend", children: values.map((v, i) => {
|
|
6732
6793
|
const pct = Math.round(v / total * 100);
|
|
6733
6794
|
const color = PIE_COLORS[(i + colorOffset) % PIE_COLORS.length];
|
|
6734
6795
|
return /* @__PURE__ */ jsxs196("div", { className: "chart-legend-item", children: [
|
|
6735
|
-
/* @__PURE__ */
|
|
6796
|
+
/* @__PURE__ */ jsx306("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
6736
6797
|
/* @__PURE__ */ jsxs196("div", { className: "chart-legend-text", children: [
|
|
6737
|
-
/* @__PURE__ */
|
|
6798
|
+
/* @__PURE__ */ jsx306("span", { className: "chart-legend-label", children: labels[i] || `${i + 1}` }),
|
|
6738
6799
|
/* @__PURE__ */ jsxs196("span", { className: "chart-legend-value", children: [
|
|
6739
6800
|
v.toLocaleString(),
|
|
6740
6801
|
"(",
|
|
@@ -6745,103 +6806,42 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
6745
6806
|
] }, i);
|
|
6746
6807
|
}) });
|
|
6747
6808
|
}
|
|
6748
|
-
return /* @__PURE__ */
|
|
6809
|
+
return /* @__PURE__ */ jsx306("div", { className: "chart-legend", children: entries.map(([key], di) => {
|
|
6749
6810
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6750
6811
|
const color = palette[2];
|
|
6751
6812
|
const values = entries[di][1];
|
|
6752
6813
|
const sum = values.reduce((a, b) => a + b, 0);
|
|
6753
6814
|
return /* @__PURE__ */ jsxs196("div", { className: "chart-legend-item", children: [
|
|
6754
|
-
/* @__PURE__ */
|
|
6815
|
+
/* @__PURE__ */ jsx306("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
6755
6816
|
/* @__PURE__ */ jsxs196("div", { className: "chart-legend-text", children: [
|
|
6756
|
-
/* @__PURE__ */
|
|
6757
|
-
/* @__PURE__ */
|
|
6817
|
+
/* @__PURE__ */ jsx306("span", { className: "chart-legend-label", children: key }),
|
|
6818
|
+
/* @__PURE__ */ jsx306("span", { className: "chart-legend-value", children: sum.toLocaleString() })
|
|
6758
6819
|
] })
|
|
6759
6820
|
] }, di);
|
|
6760
6821
|
}) });
|
|
6761
6822
|
};
|
|
6762
|
-
var Chart =
|
|
6823
|
+
var Chart = React6.memo((props) => {
|
|
6763
6824
|
const { type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
6764
6825
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
6765
6826
|
const { width, height } = useChartSize(containerRef);
|
|
6766
|
-
const stableData =
|
|
6767
|
-
const stableLabels =
|
|
6768
|
-
const dataKey =
|
|
6827
|
+
const stableData = React6.useMemo(() => data, [JSON.stringify(data)]);
|
|
6828
|
+
const stableLabels = React6.useMemo(() => labels, [JSON.stringify(labels)]);
|
|
6829
|
+
const dataKey = React6.useMemo(() => JSON.stringify(labels), [labels]);
|
|
6769
6830
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
6770
6831
|
const ready = width > 0 && height > 0;
|
|
6771
6832
|
return /* @__PURE__ */ jsxs196("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
6772
|
-
ready && type === "line" && /* @__PURE__ */
|
|
6773
|
-
ready && type === "curve" && /* @__PURE__ */
|
|
6774
|
-
ready && type === "bar" && /* @__PURE__ */
|
|
6775
|
-
ready && type === "pie" && /* @__PURE__ */
|
|
6776
|
-
ready && type === "doughnut" && /* @__PURE__ */
|
|
6777
|
-
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */
|
|
6778
|
-
tooltip.visible && tooltip.content && /* @__PURE__ */
|
|
6833
|
+
ready && type === "line" && /* @__PURE__ */ jsx306(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6834
|
+
ready && type === "curve" && /* @__PURE__ */ jsx306(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6835
|
+
ready && type === "bar" && /* @__PURE__ */ jsx306(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6836
|
+
ready && type === "pie" && /* @__PURE__ */ jsx306(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
6837
|
+
ready && type === "doughnut" && /* @__PURE__ */ jsx306(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
6838
|
+
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ jsx306(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
6839
|
+
tooltip.visible && tooltip.content && /* @__PURE__ */ jsx306(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
6779
6840
|
] });
|
|
6780
6841
|
});
|
|
6781
6842
|
Chart.displayName = "Chart";
|
|
6782
6843
|
var Chart_default = Chart;
|
|
6783
6844
|
|
|
6784
|
-
// src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
|
|
6785
|
-
import React6 from "react";
|
|
6786
|
-
import { jsx as jsx306 } from "react/jsx-runtime";
|
|
6787
|
-
var MAX_HEIGHT = 400;
|
|
6788
|
-
var AutoResizeTextArea = React6.forwardRef(
|
|
6789
|
-
(props, ref) => {
|
|
6790
|
-
const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
|
|
6791
|
-
const localRef = React6.useRef(null);
|
|
6792
|
-
const setRefs = (el) => {
|
|
6793
|
-
localRef.current = el;
|
|
6794
|
-
if (!ref) return;
|
|
6795
|
-
if (typeof ref === "function") ref(el);
|
|
6796
|
-
else if (ref && "current" in ref)
|
|
6797
|
-
ref.current = el;
|
|
6798
|
-
};
|
|
6799
|
-
const updateHeight = () => {
|
|
6800
|
-
const el = localRef.current;
|
|
6801
|
-
if (!el) return;
|
|
6802
|
-
el.style.height = "0px";
|
|
6803
|
-
el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
|
|
6804
|
-
};
|
|
6805
|
-
const handleChange = (e) => {
|
|
6806
|
-
if (onChange) {
|
|
6807
|
-
const event = {
|
|
6808
|
-
...e,
|
|
6809
|
-
target: { value: e.target.value }
|
|
6810
|
-
};
|
|
6811
|
-
onChange(event);
|
|
6812
|
-
}
|
|
6813
|
-
};
|
|
6814
|
-
React6.useEffect(() => {
|
|
6815
|
-
updateHeight();
|
|
6816
|
-
}, [value]);
|
|
6817
|
-
if (bare) {
|
|
6818
|
-
return /* @__PURE__ */ jsx306(
|
|
6819
|
-
"textarea",
|
|
6820
|
-
{
|
|
6821
|
-
...textareaProps,
|
|
6822
|
-
ref: setRefs,
|
|
6823
|
-
className,
|
|
6824
|
-
disabled,
|
|
6825
|
-
value,
|
|
6826
|
-
onChange: handleChange
|
|
6827
|
-
}
|
|
6828
|
-
);
|
|
6829
|
-
}
|
|
6830
|
-
return /* @__PURE__ */ jsx306("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ jsx306("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ jsx306(
|
|
6831
|
-
"textarea",
|
|
6832
|
-
{
|
|
6833
|
-
...textareaProps,
|
|
6834
|
-
ref: setRefs,
|
|
6835
|
-
disabled,
|
|
6836
|
-
value,
|
|
6837
|
-
onChange: handleChange
|
|
6838
|
-
}
|
|
6839
|
-
) }) });
|
|
6840
|
-
}
|
|
6841
|
-
);
|
|
6842
|
-
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
6843
|
-
var AutoResizeTextArea_default = AutoResizeTextArea;
|
|
6844
|
-
|
|
6845
6845
|
// src/components/ChatInput/ChatInput.tsx
|
|
6846
6846
|
import React7 from "react";
|
|
6847
6847
|
|
|
@@ -9379,12 +9379,12 @@ var Select_default = Select;
|
|
|
9379
9379
|
// src/components/Skeleton/Skeleton.tsx
|
|
9380
9380
|
import { jsx as jsx337 } from "react/jsx-runtime";
|
|
9381
9381
|
var SIZE_MAP = {
|
|
9382
|
-
xs: "var(--spacing-
|
|
9383
|
-
sm: "var(--spacing-
|
|
9384
|
-
md: "var(--spacing-
|
|
9385
|
-
lg: "var(--spacing-
|
|
9386
|
-
xl: "var(--spacing-
|
|
9387
|
-
"2xl": "var(--spacing-
|
|
9382
|
+
xs: "var(--spacing-space-1)",
|
|
9383
|
+
sm: "var(--spacing-space-2)",
|
|
9384
|
+
md: "var(--spacing-space-4)",
|
|
9385
|
+
lg: "var(--spacing-space-8)",
|
|
9386
|
+
xl: "var(--spacing-space-12)",
|
|
9387
|
+
"2xl": "var(--spacing-space-16)",
|
|
9388
9388
|
full: "100%"
|
|
9389
9389
|
};
|
|
9390
9390
|
var Skeleton = (props) => {
|