@x-plat/design-system 0.5.66 → 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/Accordion/index.css +6 -6
- package/dist/components/AutoResizeTextArea/index.css +5 -5
- package/dist/components/Avatar/index.css +2 -2
- package/dist/components/Badge/index.css +1 -1
- package/dist/components/Box/index.css +5 -5
- package/dist/components/Breadcrumb/index.css +4 -4
- package/dist/components/Button/index.cjs +1 -2
- package/dist/components/Button/index.css +6 -6
- package/dist/components/Button/index.d.cts +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.js +1 -2
- package/dist/components/Calendar/index.cjs +1 -1
- package/dist/components/Calendar/index.css +18 -18
- package/dist/components/Calendar/index.js +1 -1
- package/dist/components/CardTab/index.css +8 -8
- package/dist/components/Chart/index.css +11 -11
- package/dist/components/ChatInput/index.cjs +1 -2
- package/dist/components/ChatInput/index.css +16 -16
- package/dist/components/ChatInput/index.js +1 -2
- package/dist/components/CheckBox/index.css +2 -2
- package/dist/components/CheckBox/index.js +1 -1
- package/dist/components/Chip/index.css +5 -5
- package/dist/components/DatePicker/index.cjs +1 -2
- package/dist/components/DatePicker/index.css +36 -36
- package/dist/components/DatePicker/index.js +1 -2
- package/dist/components/Divider/index.css +2 -2
- package/dist/components/Drawer/index.css +5 -5
- package/dist/components/Dropdown/index.css +4 -4
- package/dist/components/Editor/index.css +36 -36
- package/dist/components/EmptyState/index.css +2 -2
- package/dist/components/FileUpload/index.css +4 -4
- package/dist/components/HtmlTypeWriter/index.css +1 -1
- package/dist/components/IconButton/index.cjs +1 -2
- package/dist/components/IconButton/index.css +5 -5
- package/dist/components/IconButton/index.d.cts +1 -1
- package/dist/components/IconButton/index.d.ts +1 -1
- package/dist/components/IconButton/index.js +1 -2
- package/dist/components/ImageSelector/index.css +7 -7
- package/dist/components/Input/index.css +7 -7
- package/dist/components/Modal/index.css +1 -1
- package/dist/components/Pagination/index.css +3 -3
- package/dist/components/PopOver/index.css +1 -1
- package/dist/components/Progress/index.css +1 -1
- package/dist/components/Radio/index.css +5 -5
- package/dist/components/Select/index.css +9 -9
- package/dist/components/Skeleton/index.cjs +6 -6
- package/dist/components/Skeleton/index.js +6 -6
- package/dist/components/Spinner/index.css +1 -1
- package/dist/components/Steps/index.css +3 -3
- package/dist/components/Swiper/index.css +3 -3
- package/dist/components/Switch/index.css +3 -3
- package/dist/components/Tab/index.css +4 -4
- package/dist/components/Table/index.css +10 -10
- package/dist/components/Tag/index.css +3 -3
- package/dist/components/TextArea/index.css +5 -5
- package/dist/components/Tooltip/index.css +4 -4
- package/dist/components/Video/index.css +2 -2
- package/dist/components/index.cjs +249 -251
- package/dist/components/index.css +667 -1059
- package/dist/components/index.d.cts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +224 -226
- package/dist/index.cjs +249 -253
- package/dist/index.css +670 -1062
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +224 -227
- package/dist/layout/Header/index.css +2 -2
- package/dist/layout/Layout/index.css +1 -1
- package/dist/layout/index.css +404 -796
- package/dist/tokens/index.cjs +0 -2
- package/dist/tokens/index.d.cts +9 -10
- package/dist/tokens/index.d.ts +9 -10
- package/dist/tokens/index.js +1 -2
- package/guidelines/AGENT_PROMPT.md +8 -9
- package/guidelines/Guidelines.md +1 -1
- package/guidelines/components/chart.md +1 -1
- package/guidelines/foundations/color.md +22 -23
- package/guidelines/foundations/typography.md +86 -36
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -391,7 +391,6 @@ __export(index_exports, {
|
|
|
391
391
|
gridColumns: () => gridColumns,
|
|
392
392
|
isInRange: () => isInRange,
|
|
393
393
|
isSameDay: () => isSameDay,
|
|
394
|
-
primitive: () => import_tokens_core.primitive,
|
|
395
394
|
semantic: () => import_tokens_core.semantic,
|
|
396
395
|
useCalendar: () => useCalendar,
|
|
397
396
|
useSideBarContext: () => useSideBarContext,
|
|
@@ -5994,8 +5993,69 @@ var Alert = (props) => {
|
|
|
5994
5993
|
Alert.displayName = "Alert";
|
|
5995
5994
|
var Alert_default = Alert;
|
|
5996
5995
|
|
|
5997
|
-
// src/components/
|
|
5996
|
+
// src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
|
|
5997
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
5998
5998
|
var import_jsx_runtime297 = require("react/jsx-runtime");
|
|
5999
|
+
var MAX_HEIGHT = 400;
|
|
6000
|
+
var AutoResizeTextArea = import_react2.default.forwardRef(
|
|
6001
|
+
(props, ref) => {
|
|
6002
|
+
const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
|
|
6003
|
+
const localRef = import_react2.default.useRef(null);
|
|
6004
|
+
const setRefs = (el) => {
|
|
6005
|
+
localRef.current = el;
|
|
6006
|
+
if (!ref) return;
|
|
6007
|
+
if (typeof ref === "function") ref(el);
|
|
6008
|
+
else if (ref && "current" in ref)
|
|
6009
|
+
ref.current = el;
|
|
6010
|
+
};
|
|
6011
|
+
const updateHeight = () => {
|
|
6012
|
+
const el = localRef.current;
|
|
6013
|
+
if (!el) return;
|
|
6014
|
+
el.style.height = "0px";
|
|
6015
|
+
el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
|
|
6016
|
+
};
|
|
6017
|
+
const handleChange = (e) => {
|
|
6018
|
+
if (onChange) {
|
|
6019
|
+
const event = {
|
|
6020
|
+
...e,
|
|
6021
|
+
target: { value: e.target.value }
|
|
6022
|
+
};
|
|
6023
|
+
onChange(event);
|
|
6024
|
+
}
|
|
6025
|
+
};
|
|
6026
|
+
import_react2.default.useEffect(() => {
|
|
6027
|
+
updateHeight();
|
|
6028
|
+
}, [value]);
|
|
6029
|
+
if (bare) {
|
|
6030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
|
|
6031
|
+
"textarea",
|
|
6032
|
+
{
|
|
6033
|
+
...textareaProps,
|
|
6034
|
+
ref: setRefs,
|
|
6035
|
+
className,
|
|
6036
|
+
disabled,
|
|
6037
|
+
value,
|
|
6038
|
+
onChange: handleChange
|
|
6039
|
+
}
|
|
6040
|
+
);
|
|
6041
|
+
}
|
|
6042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime297.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ (0, import_jsx_runtime297.jsx)(
|
|
6043
|
+
"textarea",
|
|
6044
|
+
{
|
|
6045
|
+
...textareaProps,
|
|
6046
|
+
ref: setRefs,
|
|
6047
|
+
disabled,
|
|
6048
|
+
value,
|
|
6049
|
+
onChange: handleChange
|
|
6050
|
+
}
|
|
6051
|
+
) }) });
|
|
6052
|
+
}
|
|
6053
|
+
);
|
|
6054
|
+
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
6055
|
+
var AutoResizeTextArea_default = AutoResizeTextArea;
|
|
6056
|
+
|
|
6057
|
+
// src/components/Avatar/Avatar.tsx
|
|
6058
|
+
var import_jsx_runtime298 = require("react/jsx-runtime");
|
|
5999
6059
|
var CATEGORICAL_COUNT = 8;
|
|
6000
6060
|
var getColorIndex = (name) => {
|
|
6001
6061
|
if (!name) return 1;
|
|
@@ -6012,13 +6072,13 @@ var Avatar = (props) => {
|
|
|
6012
6072
|
const fullInitials = name ? name.split(" ").map((s) => s[0]).join("").slice(0, 2).toUpperCase() : "";
|
|
6013
6073
|
const initials = size === "sm" ? fullInitials.slice(0, 1) : fullInitials;
|
|
6014
6074
|
const catIndex = getColorIndex(name || "");
|
|
6015
|
-
return /* @__PURE__ */ (0,
|
|
6075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: clsx_default("lib-xplat-avatar", size), children: src ? /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("img", { src, alt: alt || name || "avatar" }) : /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("div", { className: clsx_default("fallback", `cat-${catIndex}`), children: initials || /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime298.jsx)("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" }) }) }) });
|
|
6016
6076
|
};
|
|
6017
6077
|
Avatar.displayName = "Avatar";
|
|
6018
6078
|
var Avatar_default = Avatar;
|
|
6019
6079
|
|
|
6020
6080
|
// src/components/Badge/Badge.tsx
|
|
6021
|
-
var
|
|
6081
|
+
var import_jsx_runtime299 = require("react/jsx-runtime");
|
|
6022
6082
|
var Badge = (props) => {
|
|
6023
6083
|
const {
|
|
6024
6084
|
children,
|
|
@@ -6030,39 +6090,39 @@ var Badge = (props) => {
|
|
|
6030
6090
|
} = props;
|
|
6031
6091
|
const showBadge = dot || count !== void 0 && count > 0;
|
|
6032
6092
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
6033
|
-
return /* @__PURE__ */ (0,
|
|
6093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime299.jsxs)("div", { className: clsx_default("lib-xplat-badge", size), children: [
|
|
6034
6094
|
children,
|
|
6035
|
-
showBadge && /* @__PURE__ */ (0,
|
|
6095
|
+
showBadge && /* @__PURE__ */ (0, import_jsx_runtime299.jsx)("span", { className: clsx_default("badge-indicator", type, { dot }), children: !dot && displayCount })
|
|
6036
6096
|
] });
|
|
6037
6097
|
};
|
|
6038
6098
|
Badge.displayName = "Badge";
|
|
6039
6099
|
var Badge_default = Badge;
|
|
6040
6100
|
|
|
6041
6101
|
// src/components/Box/Box.tsx
|
|
6042
|
-
var
|
|
6102
|
+
var import_jsx_runtime300 = require("react/jsx-runtime");
|
|
6043
6103
|
var Box = ({
|
|
6044
6104
|
children,
|
|
6045
6105
|
title,
|
|
6046
6106
|
variant = "outlined",
|
|
6047
6107
|
padding = "md"
|
|
6048
6108
|
}) => {
|
|
6049
|
-
return /* @__PURE__ */ (0,
|
|
6050
|
-
title && /* @__PURE__ */ (0,
|
|
6051
|
-
/* @__PURE__ */ (0,
|
|
6109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime300.jsxs)("div", { className: clsx_default("lib-xplat-box", variant, `pad-${padding}`), children: [
|
|
6110
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: "box-title", children: title }),
|
|
6111
|
+
/* @__PURE__ */ (0, import_jsx_runtime300.jsx)("div", { className: "box-content", children })
|
|
6052
6112
|
] });
|
|
6053
6113
|
};
|
|
6054
6114
|
Box.displayName = "Box";
|
|
6055
6115
|
var Box_default = Box;
|
|
6056
6116
|
|
|
6057
6117
|
// src/components/Breadcrumb/Breadcrumb.tsx
|
|
6058
|
-
var
|
|
6118
|
+
var import_jsx_runtime301 = require("react/jsx-runtime");
|
|
6059
6119
|
var Breadcrumb = (props) => {
|
|
6060
6120
|
const { items, separator = "/" } = props;
|
|
6061
|
-
return /* @__PURE__ */ (0,
|
|
6121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("nav", { className: "lib-xplat-breadcrumb", "aria-label": "\uACBD\uB85C", children: /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("ol", { children: items.map((item, index) => {
|
|
6062
6122
|
const isLast = index === items.length - 1;
|
|
6063
|
-
return /* @__PURE__ */ (0,
|
|
6064
|
-
isLast ? /* @__PURE__ */ (0,
|
|
6065
|
-
!isLast && /* @__PURE__ */ (0,
|
|
6123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime301.jsxs)("li", { children: [
|
|
6124
|
+
isLast ? /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("a", { href: item.href, className: "link", children: item.label }) : /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("button", { className: "link", onClick: item.onClick, children: item.label }),
|
|
6125
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime301.jsx)("span", { className: "separator", children: separator })
|
|
6066
6126
|
] }, index);
|
|
6067
6127
|
}) }) });
|
|
6068
6128
|
};
|
|
@@ -6070,20 +6130,19 @@ Breadcrumb.displayName = "Breadcrumb";
|
|
|
6070
6130
|
var Breadcrumb_default = Breadcrumb;
|
|
6071
6131
|
|
|
6072
6132
|
// src/components/Button/Button.tsx
|
|
6073
|
-
var
|
|
6133
|
+
var import_jsx_runtime302 = require("react/jsx-runtime");
|
|
6074
6134
|
var Button = (props) => {
|
|
6075
6135
|
const {
|
|
6076
6136
|
children,
|
|
6077
|
-
className,
|
|
6078
6137
|
type = "primary",
|
|
6079
6138
|
size = "md",
|
|
6080
6139
|
disabled,
|
|
6081
6140
|
...rest
|
|
6082
6141
|
} = props;
|
|
6083
|
-
return /* @__PURE__ */ (0,
|
|
6142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
6084
6143
|
"button",
|
|
6085
6144
|
{
|
|
6086
|
-
className: clsx_default("lib-xplat-button", type, size
|
|
6145
|
+
className: clsx_default("lib-xplat-button", type, size),
|
|
6087
6146
|
disabled,
|
|
6088
6147
|
...rest,
|
|
6089
6148
|
children
|
|
@@ -6094,15 +6153,15 @@ Button.displayName = "Button";
|
|
|
6094
6153
|
var Button_default = Button;
|
|
6095
6154
|
|
|
6096
6155
|
// src/components/Calendar/Calendar.tsx
|
|
6097
|
-
var
|
|
6156
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
6098
6157
|
|
|
6099
6158
|
// src/components/Calendar/useCalendar.ts
|
|
6100
|
-
var
|
|
6159
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
6101
6160
|
var useCalendar = (initialYear, initialMonth) => {
|
|
6102
6161
|
const today = /* @__PURE__ */ new Date();
|
|
6103
|
-
const [year, setYear] =
|
|
6104
|
-
const [month, setMonth] =
|
|
6105
|
-
const days =
|
|
6162
|
+
const [year, setYear] = import_react3.default.useState(initialYear ?? today.getFullYear());
|
|
6163
|
+
const [month, setMonth] = import_react3.default.useState(initialMonth ?? today.getMonth());
|
|
6164
|
+
const days = import_react3.default.useMemo(() => {
|
|
6106
6165
|
const firstDay = new Date(year, month, 1);
|
|
6107
6166
|
const lastDay = new Date(year, month + 1, 0);
|
|
6108
6167
|
const startDayOfWeek = firstDay.getDay();
|
|
@@ -6145,7 +6204,7 @@ var useCalendar = (initialYear, initialMonth) => {
|
|
|
6145
6204
|
}
|
|
6146
6205
|
return result;
|
|
6147
6206
|
}, [year, month]);
|
|
6148
|
-
const goToPrevMonth =
|
|
6207
|
+
const goToPrevMonth = import_react3.default.useCallback(() => {
|
|
6149
6208
|
setMonth((prev) => {
|
|
6150
6209
|
if (prev === 0) {
|
|
6151
6210
|
setYear((y) => y - 1);
|
|
@@ -6154,7 +6213,7 @@ var useCalendar = (initialYear, initialMonth) => {
|
|
|
6154
6213
|
return prev - 1;
|
|
6155
6214
|
});
|
|
6156
6215
|
}, []);
|
|
6157
|
-
const goToNextMonth =
|
|
6216
|
+
const goToNextMonth = import_react3.default.useCallback(() => {
|
|
6158
6217
|
setMonth((prev) => {
|
|
6159
6218
|
if (prev === 11) {
|
|
6160
6219
|
setYear((y) => y + 1);
|
|
@@ -6163,7 +6222,7 @@ var useCalendar = (initialYear, initialMonth) => {
|
|
|
6163
6222
|
return prev + 1;
|
|
6164
6223
|
});
|
|
6165
6224
|
}, []);
|
|
6166
|
-
const goToToday =
|
|
6225
|
+
const goToToday = import_react3.default.useCallback(() => {
|
|
6167
6226
|
setYear(today.getFullYear());
|
|
6168
6227
|
setMonth(today.getMonth());
|
|
6169
6228
|
}, []);
|
|
@@ -6197,8 +6256,8 @@ var MONTH_LABELS = {
|
|
|
6197
6256
|
};
|
|
6198
6257
|
|
|
6199
6258
|
// src/components/Calendar/Calendar.tsx
|
|
6200
|
-
var
|
|
6201
|
-
var DayCell =
|
|
6259
|
+
var import_jsx_runtime303 = require("react/jsx-runtime");
|
|
6260
|
+
var DayCell = import_react4.default.memo(
|
|
6202
6261
|
({
|
|
6203
6262
|
day,
|
|
6204
6263
|
disabled,
|
|
@@ -6209,7 +6268,7 @@ var DayCell = import_react3.default.memo(
|
|
|
6209
6268
|
onEventClick
|
|
6210
6269
|
}) => {
|
|
6211
6270
|
if (renderDay) {
|
|
6212
|
-
return /* @__PURE__ */ (0,
|
|
6271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
6213
6272
|
"div",
|
|
6214
6273
|
{
|
|
6215
6274
|
className: clsx_default(
|
|
@@ -6226,7 +6285,7 @@ var DayCell = import_react3.default.memo(
|
|
|
6226
6285
|
}
|
|
6227
6286
|
);
|
|
6228
6287
|
}
|
|
6229
|
-
return /* @__PURE__ */ (0,
|
|
6288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)(
|
|
6230
6289
|
"div",
|
|
6231
6290
|
{
|
|
6232
6291
|
className: clsx_default(
|
|
@@ -6242,13 +6301,13 @@ var DayCell = import_react3.default.memo(
|
|
|
6242
6301
|
if (!disabled && day.isCurrentMonth) onSelect?.(day.date);
|
|
6243
6302
|
},
|
|
6244
6303
|
children: [
|
|
6245
|
-
/* @__PURE__ */ (0,
|
|
6246
|
-
dayEvents.length > 0 && /* @__PURE__ */ (0,
|
|
6247
|
-
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0,
|
|
6304
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)("span", { className: "calendar-day-number", children: day.day }),
|
|
6305
|
+
dayEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: "calendar-day-events", children: [
|
|
6306
|
+
dayEvents.slice(0, 3).map((event, ei) => /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
6248
6307
|
"span",
|
|
6249
6308
|
{
|
|
6250
6309
|
className: "calendar-event-dot",
|
|
6251
|
-
style: { backgroundColor: event.color ?? "var(--
|
|
6310
|
+
style: { backgroundColor: event.color ?? "var(--semantic-surface-brand-default)" },
|
|
6252
6311
|
title: event.label,
|
|
6253
6312
|
onClick: (e) => {
|
|
6254
6313
|
e.stopPropagation();
|
|
@@ -6257,7 +6316,7 @@ var DayCell = import_react3.default.memo(
|
|
|
6257
6316
|
},
|
|
6258
6317
|
ei
|
|
6259
6318
|
)),
|
|
6260
|
-
dayEvents.length > 3 && /* @__PURE__ */ (0,
|
|
6319
|
+
dayEvents.length > 3 && /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("span", { className: "calendar-event-more", children: [
|
|
6261
6320
|
"+",
|
|
6262
6321
|
dayEvents.length - 3
|
|
6263
6322
|
] })
|
|
@@ -6294,14 +6353,14 @@ var Calendar = (props) => {
|
|
|
6294
6353
|
setYear,
|
|
6295
6354
|
setMonth
|
|
6296
6355
|
} = useCalendar(yearProp, monthProp);
|
|
6297
|
-
const [pickerMode, setPickerMode] =
|
|
6298
|
-
const [yearRangeStart, setYearRangeStart] =
|
|
6356
|
+
const [pickerMode, setPickerMode] = import_react4.default.useState("days");
|
|
6357
|
+
const [yearRangeStart, setYearRangeStart] = import_react4.default.useState(
|
|
6299
6358
|
Math.floor(year / 12) * 12
|
|
6300
6359
|
);
|
|
6301
|
-
|
|
6360
|
+
import_react4.default.useEffect(() => {
|
|
6302
6361
|
if (yearProp !== void 0) setYear(yearProp);
|
|
6303
6362
|
}, [yearProp, setYear]);
|
|
6304
|
-
|
|
6363
|
+
import_react4.default.useEffect(() => {
|
|
6305
6364
|
if (monthProp !== void 0) setMonth(monthProp);
|
|
6306
6365
|
}, [monthProp, setMonth]);
|
|
6307
6366
|
const handlePrev = () => {
|
|
@@ -6353,15 +6412,15 @@ var Calendar = (props) => {
|
|
|
6353
6412
|
setPickerMode("months");
|
|
6354
6413
|
onMonthChange?.(y, month);
|
|
6355
6414
|
};
|
|
6356
|
-
const minTime =
|
|
6415
|
+
const minTime = import_react4.default.useMemo(
|
|
6357
6416
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
6358
6417
|
[minDate]
|
|
6359
6418
|
);
|
|
6360
|
-
const maxTime =
|
|
6419
|
+
const maxTime = import_react4.default.useMemo(
|
|
6361
6420
|
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
6362
6421
|
[maxDate]
|
|
6363
6422
|
);
|
|
6364
|
-
const eventsMap =
|
|
6423
|
+
const eventsMap = import_react4.default.useMemo(() => {
|
|
6365
6424
|
const map = /* @__PURE__ */ new Map();
|
|
6366
6425
|
for (const e of events) {
|
|
6367
6426
|
const key = `${e.date.getFullYear()}-${e.date.getMonth()}-${e.date.getDate()}`;
|
|
@@ -6371,28 +6430,28 @@ var Calendar = (props) => {
|
|
|
6371
6430
|
}
|
|
6372
6431
|
return map;
|
|
6373
6432
|
}, [events]);
|
|
6374
|
-
const getEventsForDay =
|
|
6433
|
+
const getEventsForDay = import_react4.default.useCallback(
|
|
6375
6434
|
(date) => eventsMap.get(`${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`) ?? [],
|
|
6376
6435
|
[eventsMap]
|
|
6377
6436
|
);
|
|
6378
6437
|
const weekdays = WEEKDAY_LABELS[locale];
|
|
6379
6438
|
const monthLabels = MONTH_LABELS[locale];
|
|
6380
6439
|
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
6381
|
-
return /* @__PURE__ */ (0,
|
|
6440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)(
|
|
6382
6441
|
"div",
|
|
6383
6442
|
{
|
|
6384
6443
|
className: "lib-xplat-calendar",
|
|
6385
6444
|
style: selectedColor ? { "--calendar-selected-color": `var(--${selectedColor})` } : void 0,
|
|
6386
6445
|
children: [
|
|
6387
|
-
/* @__PURE__ */ (0,
|
|
6388
|
-
/* @__PURE__ */ (0,
|
|
6389
|
-
/* @__PURE__ */ (0,
|
|
6390
|
-
/* @__PURE__ */ (0,
|
|
6391
|
-
showToday && /* @__PURE__ */ (0,
|
|
6446
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: "calendar-header", children: [
|
|
6447
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)("button", { className: "calendar-nav", onClick: handlePrev, "aria-label": "\uC774\uC804", children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(ChevronLeftIcon_default, {}) }),
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)("button", { className: "calendar-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
6449
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)("button", { className: "calendar-nav", onClick: handleNext, "aria-label": "\uB2E4\uC74C", children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(ChevronRightIcon_default, {}) }),
|
|
6450
|
+
showToday && /* @__PURE__ */ (0, import_jsx_runtime303.jsx)("button", { className: "calendar-today-btn", onClick: handleToday, children: locale === "ko" ? "\uC624\uB298" : "Today" })
|
|
6392
6451
|
] }),
|
|
6393
|
-
pickerMode === "years" && /* @__PURE__ */ (0,
|
|
6452
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime303.jsx)("div", { className: "calendar-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
6394
6453
|
const y = yearRangeStart + i;
|
|
6395
|
-
return /* @__PURE__ */ (0,
|
|
6454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
6396
6455
|
"button",
|
|
6397
6456
|
{
|
|
6398
6457
|
type: "button",
|
|
@@ -6403,7 +6462,7 @@ var Calendar = (props) => {
|
|
|
6403
6462
|
y
|
|
6404
6463
|
);
|
|
6405
6464
|
}) }),
|
|
6406
|
-
pickerMode === "months" && /* @__PURE__ */ (0,
|
|
6465
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime303.jsx)("div", { className: "calendar-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
6407
6466
|
"button",
|
|
6408
6467
|
{
|
|
6409
6468
|
type: "button",
|
|
@@ -6413,8 +6472,8 @@ var Calendar = (props) => {
|
|
|
6413
6472
|
},
|
|
6414
6473
|
i
|
|
6415
6474
|
)) }),
|
|
6416
|
-
pickerMode === "days" && /* @__PURE__ */ (0,
|
|
6417
|
-
/* @__PURE__ */ (0,
|
|
6475
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)(import_jsx_runtime303.Fragment, { children: [
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)("div", { className: "calendar-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
6418
6477
|
"div",
|
|
6419
6478
|
{
|
|
6420
6479
|
className: clsx_default(
|
|
@@ -6426,12 +6485,12 @@ var Calendar = (props) => {
|
|
|
6426
6485
|
},
|
|
6427
6486
|
label
|
|
6428
6487
|
)) }),
|
|
6429
|
-
/* @__PURE__ */ (0,
|
|
6488
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)("div", { className: "calendar-grid", children: days.map((day, idx) => {
|
|
6430
6489
|
const dayEvents = getEventsForDay(day.date);
|
|
6431
6490
|
const t = day.date.getTime();
|
|
6432
6491
|
const disabled = t < minTime || t > maxTime;
|
|
6433
6492
|
const isSelected = selectedDate ? isSameDay(day.date, selectedDate) : false;
|
|
6434
|
-
return /* @__PURE__ */ (0,
|
|
6493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
6435
6494
|
DayCell,
|
|
6436
6495
|
{
|
|
6437
6496
|
day,
|
|
@@ -6454,13 +6513,13 @@ Calendar.displayName = "Calendar";
|
|
|
6454
6513
|
var Calendar_default = Calendar;
|
|
6455
6514
|
|
|
6456
6515
|
// src/components/CardTab/CardTab.tsx
|
|
6457
|
-
var
|
|
6516
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
6458
6517
|
|
|
6459
6518
|
// src/components/CardTab/CardTabPanel.tsx
|
|
6460
|
-
var
|
|
6519
|
+
var import_jsx_runtime304 = require("react/jsx-runtime");
|
|
6461
6520
|
var CardTabPanel = (props) => {
|
|
6462
6521
|
const { children, columns = 3 } = props;
|
|
6463
|
-
return /* @__PURE__ */ (0,
|
|
6522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime304.jsx)(
|
|
6464
6523
|
"div",
|
|
6465
6524
|
{
|
|
6466
6525
|
className: "card-tab-panel",
|
|
@@ -6473,7 +6532,7 @@ CardTabPanel.displayName = "CardTab.Panel";
|
|
|
6473
6532
|
var CardTabPanel_default = CardTabPanel;
|
|
6474
6533
|
|
|
6475
6534
|
// src/components/CardTab/CardTab.tsx
|
|
6476
|
-
var
|
|
6535
|
+
var import_jsx_runtime305 = require("react/jsx-runtime");
|
|
6477
6536
|
var CardTabRoot = (props) => {
|
|
6478
6537
|
const {
|
|
6479
6538
|
tabs,
|
|
@@ -6483,7 +6542,7 @@ var CardTabRoot = (props) => {
|
|
|
6483
6542
|
children
|
|
6484
6543
|
} = props;
|
|
6485
6544
|
const isControlled = activeValueProp !== void 0;
|
|
6486
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
6545
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react5.default.useState(tabs[0]?.value ?? "");
|
|
6487
6546
|
const activeValue = isControlled ? activeValueProp : uncontrolledValue;
|
|
6488
6547
|
const handleTabClick = (tab) => {
|
|
6489
6548
|
if (!isControlled) {
|
|
@@ -6491,16 +6550,16 @@ var CardTabRoot = (props) => {
|
|
|
6491
6550
|
}
|
|
6492
6551
|
onChange?.(tab);
|
|
6493
6552
|
};
|
|
6494
|
-
const panels =
|
|
6495
|
-
(child) =>
|
|
6553
|
+
const panels = import_react5.default.Children.toArray(children).filter(
|
|
6554
|
+
(child) => import_react5.default.isValidElement(child) && child.type === CardTabPanel_default
|
|
6496
6555
|
);
|
|
6497
6556
|
const activePanel = panels.find(
|
|
6498
6557
|
(panel) => panel.props.value === activeValue
|
|
6499
6558
|
);
|
|
6500
|
-
return /* @__PURE__ */ (0,
|
|
6501
|
-
/* @__PURE__ */ (0,
|
|
6559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("div", { className: clsx_default("lib-xplat-card-tab", size), children: [
|
|
6560
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("div", { className: "card-tab-bar", children: tabs.map((tab) => {
|
|
6502
6561
|
const isActive2 = tab.value === activeValue;
|
|
6503
|
-
return /* @__PURE__ */ (0,
|
|
6562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
|
|
6504
6563
|
"button",
|
|
6505
6564
|
{
|
|
6506
6565
|
className: clsx_default("card-tab-trigger", isActive2 && "active"),
|
|
@@ -6512,7 +6571,7 @@ var CardTabRoot = (props) => {
|
|
|
6512
6571
|
tab.value
|
|
6513
6572
|
);
|
|
6514
6573
|
}) }),
|
|
6515
|
-
/* @__PURE__ */ (0,
|
|
6574
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("div", { className: "card-tab-body", children: activePanel })
|
|
6516
6575
|
] });
|
|
6517
6576
|
};
|
|
6518
6577
|
CardTabRoot.displayName = "CardTab";
|
|
@@ -6522,8 +6581,8 @@ var CardTab = Object.assign(CardTabRoot, {
|
|
|
6522
6581
|
var CardTab_default = CardTab;
|
|
6523
6582
|
|
|
6524
6583
|
// src/components/Chart/Chart.tsx
|
|
6525
|
-
var
|
|
6526
|
-
var
|
|
6584
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
6585
|
+
var import_jsx_runtime306 = require("react/jsx-runtime");
|
|
6527
6586
|
var CATEGORICAL_COUNT2 = 8;
|
|
6528
6587
|
var LINE_BAR_PALETTES = Array.from({ length: CATEGORICAL_COUNT2 }, (_, i) => {
|
|
6529
6588
|
const n = i + 1;
|
|
@@ -6568,8 +6627,8 @@ var toSmoothPath = (points) => {
|
|
|
6568
6627
|
return d;
|
|
6569
6628
|
};
|
|
6570
6629
|
var useChartSize = (ref) => {
|
|
6571
|
-
const [size, setSize] =
|
|
6572
|
-
|
|
6630
|
+
const [size, setSize] = import_react6.default.useState({ width: 0, height: 0 });
|
|
6631
|
+
import_react6.default.useEffect(() => {
|
|
6573
6632
|
const el = ref.current;
|
|
6574
6633
|
if (!el) return;
|
|
6575
6634
|
let rafId = 0;
|
|
@@ -6595,10 +6654,10 @@ var useChartSize = (ref) => {
|
|
|
6595
6654
|
};
|
|
6596
6655
|
var prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
6597
6656
|
var useChartAnimation = (containerRef, dataKey) => {
|
|
6598
|
-
const [animate, setAnimate] =
|
|
6599
|
-
const prevDataKey =
|
|
6600
|
-
const hasAnimated =
|
|
6601
|
-
|
|
6657
|
+
const [animate, setAnimate] = import_react6.default.useState(false);
|
|
6658
|
+
const prevDataKey = import_react6.default.useRef(dataKey);
|
|
6659
|
+
const hasAnimated = import_react6.default.useRef(false);
|
|
6660
|
+
import_react6.default.useEffect(() => {
|
|
6602
6661
|
if (prefersReducedMotion()) return;
|
|
6603
6662
|
const el = containerRef.current;
|
|
6604
6663
|
if (!el) return;
|
|
@@ -6614,7 +6673,7 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
6614
6673
|
observer.observe(el);
|
|
6615
6674
|
return () => observer.disconnect();
|
|
6616
6675
|
}, [containerRef]);
|
|
6617
|
-
|
|
6676
|
+
import_react6.default.useEffect(() => {
|
|
6618
6677
|
if (dataKey !== prevDataKey.current) {
|
|
6619
6678
|
prevDataKey.current = dataKey;
|
|
6620
6679
|
if (prefersReducedMotion()) return;
|
|
@@ -6628,15 +6687,15 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
6628
6687
|
};
|
|
6629
6688
|
var TOOLTIP_OFFSET = 12;
|
|
6630
6689
|
var useChartTooltip = (enabled) => {
|
|
6631
|
-
const [tooltip, setTooltip] =
|
|
6690
|
+
const [tooltip, setTooltip] = import_react6.default.useState({
|
|
6632
6691
|
visible: false,
|
|
6633
6692
|
x: 0,
|
|
6634
6693
|
y: 0,
|
|
6635
6694
|
content: ""
|
|
6636
6695
|
});
|
|
6637
|
-
const containerRef =
|
|
6638
|
-
const rafRef =
|
|
6639
|
-
const move =
|
|
6696
|
+
const containerRef = import_react6.default.useRef(null);
|
|
6697
|
+
const rafRef = import_react6.default.useRef(0);
|
|
6698
|
+
const move = import_react6.default.useCallback((e) => {
|
|
6640
6699
|
if (!enabled) return;
|
|
6641
6700
|
const cx = e.clientX;
|
|
6642
6701
|
const cy = e.clientY;
|
|
@@ -6647,24 +6706,24 @@ var useChartTooltip = (enabled) => {
|
|
|
6647
6706
|
setTooltip((prev) => ({ ...prev, x: cx - rect.left, y: cy - rect.top }));
|
|
6648
6707
|
});
|
|
6649
6708
|
}, [enabled]);
|
|
6650
|
-
const show =
|
|
6709
|
+
const show = import_react6.default.useCallback((e, content) => {
|
|
6651
6710
|
if (!enabled) return;
|
|
6652
6711
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
6653
6712
|
if (!rect) return;
|
|
6654
6713
|
setTooltip({ visible: true, x: e.clientX - rect.left, y: e.clientY - rect.top, content });
|
|
6655
6714
|
}, [enabled]);
|
|
6656
|
-
const hide =
|
|
6715
|
+
const hide = import_react6.default.useCallback(() => {
|
|
6657
6716
|
cancelAnimationFrame(rafRef.current);
|
|
6658
6717
|
setTooltip((prev) => ({ ...prev, visible: false }));
|
|
6659
6718
|
}, []);
|
|
6660
6719
|
return { tooltip, show, hide, move, containerRef };
|
|
6661
6720
|
};
|
|
6662
|
-
var GridLines =
|
|
6721
|
+
var GridLines = import_react6.default.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(import_jsx_runtime306.Fragment, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
6663
6722
|
const y = PADDING.top + (1 - ratio) * chartH;
|
|
6664
6723
|
const val = Math.round(maxVal * ratio);
|
|
6665
|
-
return /* @__PURE__ */ (0,
|
|
6666
|
-
/* @__PURE__ */ (0,
|
|
6667
|
-
/* @__PURE__ */ (0,
|
|
6724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("g", { children: [
|
|
6725
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
6726
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
6668
6727
|
] }, ratio);
|
|
6669
6728
|
}) }));
|
|
6670
6729
|
GridLines.displayName = "GridLines";
|
|
@@ -6674,18 +6733,18 @@ var getLabelStep = (count, chartW) => {
|
|
|
6674
6733
|
if (count <= maxLabels) return 1;
|
|
6675
6734
|
return Math.ceil(count / maxLabels);
|
|
6676
6735
|
};
|
|
6677
|
-
var AxisLabels =
|
|
6736
|
+
var AxisLabels = import_react6.default.memo(({ labels, count, chartW, height }) => {
|
|
6678
6737
|
const step = getLabelStep(count, chartW);
|
|
6679
|
-
return /* @__PURE__ */ (0,
|
|
6738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(import_jsx_runtime306.Fragment, { children: labels.map((label, i) => {
|
|
6680
6739
|
if (i % step !== 0) return null;
|
|
6681
6740
|
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
6682
|
-
return /* @__PURE__ */ (0,
|
|
6741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6683
6742
|
}) });
|
|
6684
6743
|
});
|
|
6685
6744
|
AxisLabels.displayName = "AxisLabels";
|
|
6686
6745
|
var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
6687
|
-
const [activeIndex, setActiveIndex] =
|
|
6688
|
-
const handleMouseMove =
|
|
6746
|
+
const [activeIndex, setActiveIndex] = import_react6.default.useState(null);
|
|
6747
|
+
const handleMouseMove = import_react6.default.useCallback((e) => {
|
|
6689
6748
|
const svg = e.currentTarget;
|
|
6690
6749
|
const rect = svg.getBoundingClientRect();
|
|
6691
6750
|
const mx = (e.clientX - rect.left) / rect.width * svg.viewBox.baseVal.width;
|
|
@@ -6704,17 +6763,17 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
6704
6763
|
}
|
|
6705
6764
|
setActiveIndex(minDist <= threshold ? closest : null);
|
|
6706
6765
|
}, [seriesPoints]);
|
|
6707
|
-
const handleMouseLeave =
|
|
6766
|
+
const handleMouseLeave = import_react6.default.useCallback(() => {
|
|
6708
6767
|
setActiveIndex(null);
|
|
6709
6768
|
}, []);
|
|
6710
|
-
const tooltipContent =
|
|
6769
|
+
const tooltipContent = import_react6.default.useMemo(() => {
|
|
6711
6770
|
if (activeIndex === null) return "";
|
|
6712
6771
|
return entries.map(([key], di) => {
|
|
6713
6772
|
const p = seriesPoints[di]?.[activeIndex];
|
|
6714
6773
|
return p ? `${key}: ${p.v}` : "";
|
|
6715
6774
|
}).filter(Boolean).join(" / ");
|
|
6716
6775
|
}, [activeIndex, entries, seriesPoints]);
|
|
6717
|
-
const getTooltipAt =
|
|
6776
|
+
const getTooltipAt = import_react6.default.useCallback((idx) => {
|
|
6718
6777
|
return entries.map(([key], di) => {
|
|
6719
6778
|
const p = seriesPoints[di]?.[idx];
|
|
6720
6779
|
return p ? `${key}: ${p.v}` : "";
|
|
@@ -6722,16 +6781,16 @@ var useCrosshair = (seriesPoints, entries, labels, chartH) => {
|
|
|
6722
6781
|
}, [entries, seriesPoints]);
|
|
6723
6782
|
return { activeIndex, handleMouseMove, handleMouseLeave, tooltipContent, getTooltipAt };
|
|
6724
6783
|
};
|
|
6725
|
-
var LineChart =
|
|
6726
|
-
const entries =
|
|
6727
|
-
const maxVal =
|
|
6784
|
+
var LineChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6785
|
+
const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
|
|
6786
|
+
const maxVal = import_react6.default.useMemo(() => {
|
|
6728
6787
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6729
6788
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6730
6789
|
}, [entries]);
|
|
6731
6790
|
const count = labels.length;
|
|
6732
6791
|
const chartW = width - PADDING.left - PADDING.right;
|
|
6733
6792
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6734
|
-
const seriesPoints =
|
|
6793
|
+
const seriesPoints = import_react6.default.useMemo(
|
|
6735
6794
|
() => entries.map(
|
|
6736
6795
|
([, values]) => values.map((v, i) => ({
|
|
6737
6796
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -6741,9 +6800,9 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6741
6800
|
),
|
|
6742
6801
|
[entries, count, chartW, chartH, maxVal]
|
|
6743
6802
|
);
|
|
6744
|
-
const clipRef =
|
|
6803
|
+
const clipRef = import_react6.default.useRef(null);
|
|
6745
6804
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
6746
|
-
|
|
6805
|
+
import_react6.default.useEffect(() => {
|
|
6747
6806
|
if (!animate || !clipRef.current) return;
|
|
6748
6807
|
clipRef.current.setAttribute("width", "0");
|
|
6749
6808
|
requestAnimationFrame(() => {
|
|
@@ -6755,7 +6814,7 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6755
6814
|
}, [animate, width]);
|
|
6756
6815
|
const activeX = activeIndex !== null ? seriesPoints[0]?.[activeIndex]?.x ?? null : null;
|
|
6757
6816
|
const lineClipId = "line-area-clip";
|
|
6758
|
-
return /* @__PURE__ */ (0,
|
|
6817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)(
|
|
6759
6818
|
"svg",
|
|
6760
6819
|
{
|
|
6761
6820
|
viewBox: `0 0 ${width} ${height}`,
|
|
@@ -6773,9 +6832,9 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6773
6832
|
onLeave();
|
|
6774
6833
|
},
|
|
6775
6834
|
children: [
|
|
6776
|
-
animate && /* @__PURE__ */ (0,
|
|
6777
|
-
/* @__PURE__ */ (0,
|
|
6778
|
-
/* @__PURE__ */ (0,
|
|
6835
|
+
animate && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("clipPath", { id: lineClipId, children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("rect", { ref: clipRef, x: "0", y: "0", width: animate ? 0 : width, height }) }) }),
|
|
6836
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
6837
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(AxisLabels, { labels, count, chartW, height }),
|
|
6779
6838
|
entries.map(([key], di) => {
|
|
6780
6839
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6781
6840
|
const color = palette[2];
|
|
@@ -6784,16 +6843,16 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6784
6843
|
const gradientId = `line-gradient-${di}`;
|
|
6785
6844
|
const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
|
|
6786
6845
|
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`;
|
|
6787
|
-
return /* @__PURE__ */ (0,
|
|
6788
|
-
/* @__PURE__ */ (0,
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
6790
|
-
/* @__PURE__ */ (0,
|
|
6846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("g", { children: [
|
|
6847
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6848
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.2" }),
|
|
6849
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0" })
|
|
6791
6850
|
] }) }),
|
|
6792
|
-
/* @__PURE__ */ (0,
|
|
6793
|
-
/* @__PURE__ */ (0,
|
|
6794
|
-
/* @__PURE__ */ (0,
|
|
6851
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("g", { clipPath: animate ? `url(#${lineClipId})` : void 0, children: [
|
|
6852
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("path", { d: areaD, fill: `url(#${gradientId})` }),
|
|
6853
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("polyline", { points: polyPoints, fill: "none", stroke: color, strokeWidth: "2" })
|
|
6795
6854
|
] }),
|
|
6796
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ (0,
|
|
6855
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6797
6856
|
"circle",
|
|
6798
6857
|
{
|
|
6799
6858
|
cx: points[activeIndex].x,
|
|
@@ -6805,7 +6864,7 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6805
6864
|
)
|
|
6806
6865
|
] }, di);
|
|
6807
6866
|
}),
|
|
6808
|
-
activeX !== null && /* @__PURE__ */ (0,
|
|
6867
|
+
activeX !== null && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6809
6868
|
"line",
|
|
6810
6869
|
{
|
|
6811
6870
|
x1: activeX,
|
|
@@ -6815,7 +6874,7 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6815
6874
|
className: "chart-crosshair"
|
|
6816
6875
|
}
|
|
6817
6876
|
),
|
|
6818
|
-
/* @__PURE__ */ (0,
|
|
6877
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6819
6878
|
"rect",
|
|
6820
6879
|
{
|
|
6821
6880
|
x: PADDING.left,
|
|
@@ -6831,16 +6890,16 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
6831
6890
|
);
|
|
6832
6891
|
});
|
|
6833
6892
|
LineChart.displayName = "LineChart";
|
|
6834
|
-
var CurveChart =
|
|
6835
|
-
const entries =
|
|
6836
|
-
const maxVal =
|
|
6893
|
+
var CurveChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
6894
|
+
const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
|
|
6895
|
+
const maxVal = import_react6.default.useMemo(() => {
|
|
6837
6896
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6838
6897
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6839
6898
|
}, [entries]);
|
|
6840
6899
|
const count = labels.length;
|
|
6841
6900
|
const chartW = width - PADDING.left - PADDING.right;
|
|
6842
6901
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
6843
|
-
const seriesPoints =
|
|
6902
|
+
const seriesPoints = import_react6.default.useMemo(
|
|
6844
6903
|
() => entries.map(
|
|
6845
6904
|
([, values]) => values.map((v, i) => ({
|
|
6846
6905
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -6850,9 +6909,9 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6850
6909
|
),
|
|
6851
6910
|
[entries, count, chartW, chartH, maxVal]
|
|
6852
6911
|
);
|
|
6853
|
-
const curveClipRef =
|
|
6912
|
+
const curveClipRef = import_react6.default.useRef(null);
|
|
6854
6913
|
const { activeIndex, handleMouseMove, handleMouseLeave, getTooltipAt } = useCrosshair(seriesPoints, entries, labels, chartH);
|
|
6855
|
-
|
|
6914
|
+
import_react6.default.useEffect(() => {
|
|
6856
6915
|
if (!animate || !curveClipRef.current) return;
|
|
6857
6916
|
curveClipRef.current.setAttribute("width", "0");
|
|
6858
6917
|
requestAnimationFrame(() => {
|
|
@@ -6864,7 +6923,7 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6864
6923
|
}, [animate, width]);
|
|
6865
6924
|
const activeX = activeIndex !== null ? seriesPoints[0]?.[activeIndex]?.x ?? null : null;
|
|
6866
6925
|
const curveClipId = "curve-area-clip";
|
|
6867
|
-
return /* @__PURE__ */ (0,
|
|
6926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)(
|
|
6868
6927
|
"svg",
|
|
6869
6928
|
{
|
|
6870
6929
|
viewBox: `0 0 ${width} ${height}`,
|
|
@@ -6883,9 +6942,9 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6883
6942
|
onLeave();
|
|
6884
6943
|
},
|
|
6885
6944
|
children: [
|
|
6886
|
-
animate && /* @__PURE__ */ (0,
|
|
6887
|
-
/* @__PURE__ */ (0,
|
|
6888
|
-
/* @__PURE__ */ (0,
|
|
6945
|
+
animate && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("clipPath", { id: curveClipId, children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("rect", { ref: curveClipRef, x: "0", y: "0", width: animate ? 0 : width, height }) }) }),
|
|
6946
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
6947
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(AxisLabels, { labels, count, chartW, height }),
|
|
6889
6948
|
entries.map(([key], di) => {
|
|
6890
6949
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
6891
6950
|
const color = palette[2];
|
|
@@ -6894,16 +6953,16 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6894
6953
|
const gradientId = `curve-gradient-${di}`;
|
|
6895
6954
|
const linePath = toSmoothPath(points);
|
|
6896
6955
|
const areaPath = linePath + ` L ${points[points.length - 1].x} ${PADDING.top + chartH} L ${points[0].x} ${PADDING.top + chartH} Z`;
|
|
6897
|
-
return /* @__PURE__ */ (0,
|
|
6898
|
-
/* @__PURE__ */ (0,
|
|
6899
|
-
/* @__PURE__ */ (0,
|
|
6900
|
-
/* @__PURE__ */ (0,
|
|
6956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("g", { children: [
|
|
6957
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
6958
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.4" }),
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0.02" })
|
|
6901
6960
|
] }) }),
|
|
6902
|
-
/* @__PURE__ */ (0,
|
|
6903
|
-
/* @__PURE__ */ (0,
|
|
6904
|
-
/* @__PURE__ */ (0,
|
|
6961
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("g", { clipPath: animate ? `url(#${curveClipId})` : void 0, children: [
|
|
6962
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("path", { d: areaPath, fill: `url(#${gradientId})` }),
|
|
6963
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("path", { d: linePath, fill: "none", stroke: color, strokeWidth: "2" })
|
|
6905
6964
|
] }),
|
|
6906
|
-
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ (0,
|
|
6965
|
+
activeIndex !== null && points[activeIndex] && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6907
6966
|
"circle",
|
|
6908
6967
|
{
|
|
6909
6968
|
cx: points[activeIndex].x,
|
|
@@ -6915,7 +6974,7 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6915
6974
|
)
|
|
6916
6975
|
] }, di);
|
|
6917
6976
|
}),
|
|
6918
|
-
activeX !== null && /* @__PURE__ */ (0,
|
|
6977
|
+
activeX !== null && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6919
6978
|
"line",
|
|
6920
6979
|
{
|
|
6921
6980
|
x1: activeX,
|
|
@@ -6925,7 +6984,7 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6925
6984
|
className: "chart-crosshair"
|
|
6926
6985
|
}
|
|
6927
6986
|
),
|
|
6928
|
-
/* @__PURE__ */ (0,
|
|
6987
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6929
6988
|
"rect",
|
|
6930
6989
|
{
|
|
6931
6990
|
x: PADDING.left,
|
|
@@ -6941,9 +7000,9 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
6941
7000
|
);
|
|
6942
7001
|
});
|
|
6943
7002
|
CurveChart.displayName = "CurveChart";
|
|
6944
|
-
var BarChart =
|
|
6945
|
-
const entries =
|
|
6946
|
-
const maxVal =
|
|
7003
|
+
var BarChart = import_react6.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
7004
|
+
const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
|
|
7005
|
+
const maxVal = import_react6.default.useMemo(() => {
|
|
6947
7006
|
const allValues = entries.flatMap(([, v]) => v);
|
|
6948
7007
|
return Math.max(...allValues) * 1.2 || 1;
|
|
6949
7008
|
}, [entries]);
|
|
@@ -6955,7 +7014,7 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
6955
7014
|
const barGap = groupCount > 1 ? 2 : 0;
|
|
6956
7015
|
const barW = Math.max(1, Math.min(32, (groupW * 0.7 - barGap * (groupCount - 1)) / groupCount));
|
|
6957
7016
|
const baseline = PADDING.top + chartH;
|
|
6958
|
-
const bars =
|
|
7017
|
+
const bars = import_react6.default.useMemo(
|
|
6959
7018
|
() => entries.map(
|
|
6960
7019
|
([, values], di) => values.map((v, i) => {
|
|
6961
7020
|
const totalBarsW = barW * groupCount + barGap * (groupCount - 1);
|
|
@@ -6968,11 +7027,11 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
6968
7027
|
[entries, maxVal, chartH, groupW, barW, barGap, groupCount]
|
|
6969
7028
|
);
|
|
6970
7029
|
const barLabelStep = getLabelStep(count, chartW);
|
|
6971
|
-
return /* @__PURE__ */ (0,
|
|
6972
|
-
/* @__PURE__ */ (0,
|
|
7030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
7031
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
6973
7032
|
labels.map((label, i) => {
|
|
6974
7033
|
if (i % barLabelStep !== 0) return null;
|
|
6975
|
-
return /* @__PURE__ */ (0,
|
|
7034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
6976
7035
|
}),
|
|
6977
7036
|
entries.map(([key], di) => {
|
|
6978
7037
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
@@ -6981,7 +7040,7 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
6981
7040
|
const r2 = Math.min(4, b.w / 2);
|
|
6982
7041
|
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`;
|
|
6983
7042
|
const delay = 100 + i * 80;
|
|
6984
|
-
return /* @__PURE__ */ (0,
|
|
7043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
6985
7044
|
"path",
|
|
6986
7045
|
{
|
|
6987
7046
|
d,
|
|
@@ -7002,11 +7061,11 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
7002
7061
|
] });
|
|
7003
7062
|
});
|
|
7004
7063
|
BarChart.displayName = "BarChart";
|
|
7005
|
-
var PieDonutChart =
|
|
7064
|
+
var PieDonutChart = import_react6.default.memo(
|
|
7006
7065
|
({ data, labels, width, height, animate, isDoughnut, onHover, onMove, onLeave }) => {
|
|
7007
|
-
const entries =
|
|
7008
|
-
const values =
|
|
7009
|
-
const total =
|
|
7066
|
+
const entries = import_react6.default.useMemo(() => Object.entries(data), [data]);
|
|
7067
|
+
const values = import_react6.default.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
7068
|
+
const total = import_react6.default.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
7010
7069
|
const size = Math.min(width, height);
|
|
7011
7070
|
const cx = size / 2;
|
|
7012
7071
|
const cy = size / 2;
|
|
@@ -7014,10 +7073,10 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
7014
7073
|
const innerR = isDoughnut ? r2 * 0.5 : 0;
|
|
7015
7074
|
const firstKey = entries[0]?.[0] ?? "";
|
|
7016
7075
|
const colorOffset = hashString(firstKey);
|
|
7017
|
-
const maskRef =
|
|
7076
|
+
const maskRef = import_react6.default.useRef(null);
|
|
7018
7077
|
const maskR = r2 + 10;
|
|
7019
7078
|
const maskCircumference = 2 * Math.PI * maskR;
|
|
7020
|
-
|
|
7079
|
+
import_react6.default.useEffect(() => {
|
|
7021
7080
|
if (!animate || !maskRef.current) return;
|
|
7022
7081
|
const el = maskRef.current;
|
|
7023
7082
|
el.style.strokeDasharray = `${maskCircumference}`;
|
|
@@ -7027,7 +7086,7 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
7027
7086
|
el.style.strokeDashoffset = "0";
|
|
7028
7087
|
});
|
|
7029
7088
|
}, [animate, maskCircumference]);
|
|
7030
|
-
const sliceData =
|
|
7089
|
+
const sliceData = import_react6.default.useMemo(() => {
|
|
7031
7090
|
let angle0 = -Math.PI / 2;
|
|
7032
7091
|
let cumulativeAngle = 0;
|
|
7033
7092
|
return values.map((v, i) => {
|
|
@@ -7061,8 +7120,8 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
7061
7120
|
});
|
|
7062
7121
|
}, [values, total, cx, cy, r2, innerR, labels]);
|
|
7063
7122
|
const maskId = `pie-mask-${isDoughnut ? "d" : "p"}`;
|
|
7064
|
-
return /* @__PURE__ */ (0,
|
|
7065
|
-
animate && /* @__PURE__ */ (0,
|
|
7123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: [
|
|
7124
|
+
animate && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("mask", { id: maskId, children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
7066
7125
|
"circle",
|
|
7067
7126
|
{
|
|
7068
7127
|
ref: maskRef,
|
|
@@ -7075,7 +7134,7 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
7075
7134
|
transform: `rotate(-90 ${cx} ${cy})`
|
|
7076
7135
|
}
|
|
7077
7136
|
) }) }),
|
|
7078
|
-
/* @__PURE__ */ (0,
|
|
7137
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("g", { mask: animate ? `url(#${maskId})` : void 0, children: sliceData.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
7079
7138
|
"path",
|
|
7080
7139
|
{
|
|
7081
7140
|
d: s.d,
|
|
@@ -7091,9 +7150,9 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
7091
7150
|
);
|
|
7092
7151
|
PieDonutChart.displayName = "PieDonutChart";
|
|
7093
7152
|
var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, children }) => {
|
|
7094
|
-
const ref =
|
|
7095
|
-
const [pos, setPos] =
|
|
7096
|
-
|
|
7153
|
+
const ref = import_react6.default.useRef(null);
|
|
7154
|
+
const [pos, setPos] = import_react6.default.useState({ left: 0, top: 0 });
|
|
7155
|
+
import_react6.default.useLayoutEffect(() => {
|
|
7097
7156
|
const el = ref.current;
|
|
7098
7157
|
if (!el) return;
|
|
7099
7158
|
const w = el.offsetWidth;
|
|
@@ -7110,15 +7169,15 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
7110
7169
|
const sepIdx = content.indexOf(" \u2014 ");
|
|
7111
7170
|
const title = sepIdx >= 0 ? content.slice(0, sepIdx) : content;
|
|
7112
7171
|
const desc = sepIdx >= 0 ? content.slice(sepIdx + 3) : "";
|
|
7113
|
-
return /* @__PURE__ */ (0,
|
|
7172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)(
|
|
7114
7173
|
"div",
|
|
7115
7174
|
{
|
|
7116
7175
|
ref,
|
|
7117
7176
|
className: `lib-xplat-tooltip ${tooltipType} chart-tooltip-pos`,
|
|
7118
7177
|
style: { left: pos.left, top: pos.top },
|
|
7119
7178
|
children: [
|
|
7120
|
-
title && /* @__PURE__ */ (0,
|
|
7121
|
-
desc && /* @__PURE__ */ (0,
|
|
7179
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: "tooltip-title", children: title }),
|
|
7180
|
+
desc && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: "tooltip-desc", children: desc })
|
|
7122
7181
|
]
|
|
7123
7182
|
}
|
|
7124
7183
|
);
|
|
@@ -7130,14 +7189,14 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
7130
7189
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
7131
7190
|
const firstKey = entries[0]?.[0] ?? "";
|
|
7132
7191
|
const colorOffset = hashString(firstKey);
|
|
7133
|
-
return /* @__PURE__ */ (0,
|
|
7192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: "chart-legend", children: values.map((v, i) => {
|
|
7134
7193
|
const pct = Math.round(v / total * 100);
|
|
7135
7194
|
const color = PIE_COLORS[(i + colorOffset) % PIE_COLORS.length];
|
|
7136
|
-
return /* @__PURE__ */ (0,
|
|
7137
|
-
/* @__PURE__ */ (0,
|
|
7138
|
-
/* @__PURE__ */ (0,
|
|
7139
|
-
/* @__PURE__ */ (0,
|
|
7140
|
-
/* @__PURE__ */ (0,
|
|
7195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: "chart-legend-item", children: [
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
7197
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: "chart-legend-text", children: [
|
|
7198
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: "chart-legend-label", children: labels[i] || `${i + 1}` }),
|
|
7199
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("span", { className: "chart-legend-value", children: [
|
|
7141
7200
|
v.toLocaleString(),
|
|
7142
7201
|
"(",
|
|
7143
7202
|
pct,
|
|
@@ -7147,103 +7206,42 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
7147
7206
|
] }, i);
|
|
7148
7207
|
}) });
|
|
7149
7208
|
}
|
|
7150
|
-
return /* @__PURE__ */ (0,
|
|
7209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: "chart-legend", children: entries.map(([key], di) => {
|
|
7151
7210
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
7152
7211
|
const color = palette[2];
|
|
7153
7212
|
const values = entries[di][1];
|
|
7154
7213
|
const sum = values.reduce((a, b) => a + b, 0);
|
|
7155
|
-
return /* @__PURE__ */ (0,
|
|
7156
|
-
/* @__PURE__ */ (0,
|
|
7157
|
-
/* @__PURE__ */ (0,
|
|
7158
|
-
/* @__PURE__ */ (0,
|
|
7159
|
-
/* @__PURE__ */ (0,
|
|
7214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: "chart-legend-item", children: [
|
|
7215
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: "chart-legend-dot", style: { backgroundColor: color } }),
|
|
7216
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: "chart-legend-text", children: [
|
|
7217
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: "chart-legend-label", children: key }),
|
|
7218
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("span", { className: "chart-legend-value", children: sum.toLocaleString() })
|
|
7160
7219
|
] })
|
|
7161
7220
|
] }, di);
|
|
7162
7221
|
}) });
|
|
7163
7222
|
};
|
|
7164
|
-
var Chart =
|
|
7223
|
+
var Chart = import_react6.default.memo((props) => {
|
|
7165
7224
|
const { type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
7166
7225
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
7167
7226
|
const { width, height } = useChartSize(containerRef);
|
|
7168
|
-
const stableData =
|
|
7169
|
-
const stableLabels =
|
|
7170
|
-
const dataKey =
|
|
7227
|
+
const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
7228
|
+
const stableLabels = import_react6.default.useMemo(() => labels, [JSON.stringify(labels)]);
|
|
7229
|
+
const dataKey = import_react6.default.useMemo(() => JSON.stringify(labels), [labels]);
|
|
7171
7230
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
7172
7231
|
const ready = width > 0 && height > 0;
|
|
7173
|
-
return /* @__PURE__ */ (0,
|
|
7174
|
-
ready && type === "line" && /* @__PURE__ */ (0,
|
|
7175
|
-
ready && type === "curve" && /* @__PURE__ */ (0,
|
|
7176
|
-
ready && type === "bar" && /* @__PURE__ */ (0,
|
|
7177
|
-
ready && type === "pie" && /* @__PURE__ */ (0,
|
|
7178
|
-
ready && type === "doughnut" && /* @__PURE__ */ (0,
|
|
7179
|
-
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ (0,
|
|
7180
|
-
tooltip.visible && tooltip.content && /* @__PURE__ */ (0,
|
|
7232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
7233
|
+
ready && type === "line" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7234
|
+
ready && type === "curve" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7235
|
+
ready && type === "bar" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7236
|
+
ready && type === "pie" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
7237
|
+
ready && type === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
7238
|
+
ready && (type === "pie" || type === "doughnut") && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartLegend, { data: stableData, labels: stableLabels, type }),
|
|
7239
|
+
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
7181
7240
|
] });
|
|
7182
7241
|
});
|
|
7183
7242
|
Chart.displayName = "Chart";
|
|
7184
7243
|
var Chart_default = Chart;
|
|
7185
7244
|
|
|
7186
|
-
// src/components/AutoResizeTextArea/AutoResizeTextArea.tsx
|
|
7187
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
7188
|
-
var import_jsx_runtime306 = require("react/jsx-runtime");
|
|
7189
|
-
var MAX_HEIGHT = 400;
|
|
7190
|
-
var AutoResizeTextArea = import_react6.default.forwardRef(
|
|
7191
|
-
(props, ref) => {
|
|
7192
|
-
const { value, className, onChange, disabled, bare = false, ...textareaProps } = props;
|
|
7193
|
-
const localRef = import_react6.default.useRef(null);
|
|
7194
|
-
const setRefs = (el) => {
|
|
7195
|
-
localRef.current = el;
|
|
7196
|
-
if (!ref) return;
|
|
7197
|
-
if (typeof ref === "function") ref(el);
|
|
7198
|
-
else if (ref && "current" in ref)
|
|
7199
|
-
ref.current = el;
|
|
7200
|
-
};
|
|
7201
|
-
const updateHeight = () => {
|
|
7202
|
-
const el = localRef.current;
|
|
7203
|
-
if (!el) return;
|
|
7204
|
-
el.style.height = "0px";
|
|
7205
|
-
el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
|
|
7206
|
-
};
|
|
7207
|
-
const handleChange = (e) => {
|
|
7208
|
-
if (onChange) {
|
|
7209
|
-
const event = {
|
|
7210
|
-
...e,
|
|
7211
|
-
target: { value: e.target.value }
|
|
7212
|
-
};
|
|
7213
|
-
onChange(event);
|
|
7214
|
-
}
|
|
7215
|
-
};
|
|
7216
|
-
import_react6.default.useEffect(() => {
|
|
7217
|
-
updateHeight();
|
|
7218
|
-
}, [value]);
|
|
7219
|
-
if (bare) {
|
|
7220
|
-
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
7221
|
-
"textarea",
|
|
7222
|
-
{
|
|
7223
|
-
...textareaProps,
|
|
7224
|
-
ref: setRefs,
|
|
7225
|
-
className,
|
|
7226
|
-
disabled,
|
|
7227
|
-
value,
|
|
7228
|
-
onChange: handleChange
|
|
7229
|
-
}
|
|
7230
|
-
);
|
|
7231
|
-
}
|
|
7232
|
-
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea-wrapper", className), children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: clsx_default("lib-xplat-auto-resize-textarea", disabled && "disabled"), children: /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
7233
|
-
"textarea",
|
|
7234
|
-
{
|
|
7235
|
-
...textareaProps,
|
|
7236
|
-
ref: setRefs,
|
|
7237
|
-
disabled,
|
|
7238
|
-
value,
|
|
7239
|
-
onChange: handleChange
|
|
7240
|
-
}
|
|
7241
|
-
) }) });
|
|
7242
|
-
}
|
|
7243
|
-
);
|
|
7244
|
-
AutoResizeTextArea.displayName = "AutoResizeTextArea";
|
|
7245
|
-
var AutoResizeTextArea_default = AutoResizeTextArea;
|
|
7246
|
-
|
|
7247
7245
|
// src/components/ChatInput/ChatInput.tsx
|
|
7248
7246
|
var import_react7 = __toESM(require("react"), 1);
|
|
7249
7247
|
|
|
@@ -7252,7 +7250,6 @@ var import_jsx_runtime307 = require("react/jsx-runtime");
|
|
|
7252
7250
|
var IconButton = (props) => {
|
|
7253
7251
|
const {
|
|
7254
7252
|
icon,
|
|
7255
|
-
className,
|
|
7256
7253
|
type = "primary",
|
|
7257
7254
|
size = "md",
|
|
7258
7255
|
disabled,
|
|
@@ -7261,7 +7258,7 @@ var IconButton = (props) => {
|
|
|
7261
7258
|
return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
7262
7259
|
"button",
|
|
7263
7260
|
{
|
|
7264
|
-
className: clsx_default("lib-xplat-icon-button", type, size
|
|
7261
|
+
className: clsx_default("lib-xplat-icon-button", type, size),
|
|
7265
7262
|
disabled,
|
|
7266
7263
|
...rest,
|
|
7267
7264
|
children: icon
|
|
@@ -9782,12 +9779,12 @@ var Select_default = Select;
|
|
|
9782
9779
|
// src/components/Skeleton/Skeleton.tsx
|
|
9783
9780
|
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
9784
9781
|
var SIZE_MAP = {
|
|
9785
|
-
xs: "var(--spacing-
|
|
9786
|
-
sm: "var(--spacing-
|
|
9787
|
-
md: "var(--spacing-
|
|
9788
|
-
lg: "var(--spacing-
|
|
9789
|
-
xl: "var(--spacing-
|
|
9790
|
-
"2xl": "var(--spacing-
|
|
9782
|
+
xs: "var(--spacing-space-1)",
|
|
9783
|
+
sm: "var(--spacing-space-2)",
|
|
9784
|
+
md: "var(--spacing-space-4)",
|
|
9785
|
+
lg: "var(--spacing-space-8)",
|
|
9786
|
+
xl: "var(--spacing-space-12)",
|
|
9787
|
+
"2xl": "var(--spacing-space-16)",
|
|
9791
9788
|
full: "100%"
|
|
9792
9789
|
};
|
|
9793
9790
|
var Skeleton = (props) => {
|
|
@@ -11518,7 +11515,6 @@ var SideBar_default = SideBar;
|
|
|
11518
11515
|
gridColumns,
|
|
11519
11516
|
isInRange,
|
|
11520
11517
|
isSameDay,
|
|
11521
|
-
primitive,
|
|
11522
11518
|
semantic,
|
|
11523
11519
|
useCalendar,
|
|
11524
11520
|
useSideBarContext,
|