@x-plat/design-system 0.5.20 → 0.5.22
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/Chart/index.cjs +58 -29
- package/dist/components/Chart/index.css +2 -15
- package/dist/components/Chart/index.js +58 -29
- package/dist/components/ChatInput/index.cjs +214 -0
- package/dist/components/ChatInput/index.css +133 -0
- package/dist/components/ChatInput/index.d.cts +14 -0
- package/dist/components/ChatInput/index.d.ts +14 -0
- package/dist/components/ChatInput/index.js +177 -0
- package/dist/components/Dropdown/index.cjs +9 -0
- package/dist/components/Dropdown/index.js +9 -0
- package/dist/components/PopOver/index.cjs +9 -0
- package/dist/components/PopOver/index.js +9 -0
- package/dist/components/Select/index.cjs +9 -0
- package/dist/components/Select/index.js +9 -0
- package/dist/components/Table/index.cjs +2 -1
- package/dist/components/Table/index.css +117 -0
- package/dist/components/Table/index.d.cts +3 -1
- package/dist/components/Table/index.d.ts +3 -1
- package/dist/components/Table/index.js +2 -1
- package/dist/components/index.cjs +715 -595
- package/dist/components/index.css +253 -61
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +713 -594
- package/dist/index.cjs +724 -619
- package/dist/index.css +253 -61
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +722 -618
- package/package.json +1 -1
|
@@ -40,6 +40,7 @@ __export(components_exports, {
|
|
|
40
40
|
Calendar: () => Calendar_default,
|
|
41
41
|
CardTab: () => CardTab_default,
|
|
42
42
|
Chart: () => Chart_default,
|
|
43
|
+
ChatInput: () => ChatInput_default,
|
|
43
44
|
CheckBox: () => CheckBox_default,
|
|
44
45
|
Chip: () => Chip_default,
|
|
45
46
|
Divider: () => Divider_default,
|
|
@@ -475,6 +476,21 @@ var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
|
475
476
|
|
|
476
477
|
// src/tokens/svg/communication/SendIcon.tsx
|
|
477
478
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
479
|
+
var SendIcon = () => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
480
|
+
"svg",
|
|
481
|
+
{
|
|
482
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
483
|
+
width: "1em",
|
|
484
|
+
height: "1em",
|
|
485
|
+
viewBox: "0 0 20 20",
|
|
486
|
+
fill: "none",
|
|
487
|
+
children: [
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("g", { clipPath: "url(#send-clip)", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M18.3558 0.918873C18.3887 0.919879 18.4212 0.9224 18.4535 0.927663C18.4642 0.929393 18.4751 0.930348 18.4857 0.932545C18.527 0.941123 18.5675 0.953269 18.6068 0.968678C18.6178 0.972968 18.6282 0.978499 18.639 0.983327C18.6672 0.995914 18.6945 1.01021 18.7211 1.0263C18.7403 1.03794 18.7594 1.04988 18.7777 1.0634C18.7803 1.06534 18.7829 1.0673 18.7855 1.06926C18.8126 1.08979 18.839 1.11195 18.8637 1.13665C18.8872 1.16018 18.9084 1.18517 18.9281 1.21087C18.9322 1.21625 18.9359 1.22198 18.9398 1.22747C18.9501 1.24168 18.959 1.25667 18.9681 1.27141C18.9866 1.30108 19.0029 1.33154 19.017 1.36321C19.0214 1.37309 19.0267 1.38248 19.0306 1.39251C19.0461 1.43186 19.0581 1.47231 19.0668 1.5136C19.069 1.52426 19.0699 1.5351 19.0717 1.54583C19.077 1.57815 19.0794 1.61062 19.0805 1.64348C19.0808 1.65621 19.0817 1.66884 19.0814 1.68157C19.0799 1.75981 19.0681 1.83872 19.0414 1.91497L13.2074 18.581C13.1058 18.871 12.8377 19.0703 12.5306 19.0829C12.2237 19.0954 11.9398 18.9192 11.8148 18.6386L8.59706 11.4003L1.3617 8.18547C1.08085 8.06057 0.90492 7.77678 0.917368 7.46965C0.929915 7.16252 1.12827 6.89358 1.41834 6.79192L18.0853 0.958913C18.1613 0.932334 18.2398 0.919479 18.3178 0.917897C18.3305 0.91763 18.3431 0.918498 18.3558 0.918873ZM10.0609 10.999L12.4164 16.2997L16.5375 4.52239L10.0609 10.999ZM3.69862 7.58294L9.00038 9.93841L15.4808 3.45794L3.69862 7.58294Z", fill: "currentColor" }) }),
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("clipPath", { id: "send-clip", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("rect", { width: "20", height: "20", fill: "currentColor" }) }) })
|
|
490
|
+
]
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
var SendIcon_default = SendIcon;
|
|
478
494
|
|
|
479
495
|
// src/tokens/svg/date/CalendarIcon.tsx
|
|
480
496
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
@@ -2021,30 +2037,151 @@ var Calendar = (props) => {
|
|
|
2021
2037
|
Calendar.displayName = "Calendar";
|
|
2022
2038
|
var Calendar_default = Calendar;
|
|
2023
2039
|
|
|
2024
|
-
// src/components/
|
|
2040
|
+
// src/components/ChatInput/ChatInput.tsx
|
|
2041
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
2042
|
+
|
|
2043
|
+
// src/components/TextArea/TextArea.tsx
|
|
2044
|
+
var import_react4 = __toESM(require("react"), 1);
|
|
2025
2045
|
var import_jsx_runtime302 = require("react/jsx-runtime");
|
|
2046
|
+
var TextArea = import_react4.default.forwardRef(
|
|
2047
|
+
(props, ref) => {
|
|
2048
|
+
const { value, onChange, disabled, ...textareaProps } = props;
|
|
2049
|
+
const localRef = import_react4.default.useRef(null);
|
|
2050
|
+
const setRefs = (el) => {
|
|
2051
|
+
localRef.current = el;
|
|
2052
|
+
if (!ref) return;
|
|
2053
|
+
if (typeof ref === "function") {
|
|
2054
|
+
ref(el);
|
|
2055
|
+
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
2056
|
+
ref.current = el;
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
const handleOnChange = (e) => {
|
|
2060
|
+
const val = e.target.value;
|
|
2061
|
+
if (onChange) {
|
|
2062
|
+
const event = {
|
|
2063
|
+
...e,
|
|
2064
|
+
target: { value: val }
|
|
2065
|
+
};
|
|
2066
|
+
onChange(event);
|
|
2067
|
+
}
|
|
2068
|
+
};
|
|
2069
|
+
import_react4.default.useEffect(() => {
|
|
2070
|
+
const el = localRef.current;
|
|
2071
|
+
if (!el) return;
|
|
2072
|
+
el.style.height = "0px";
|
|
2073
|
+
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
2074
|
+
el.style.height = `${nextHeight}px`;
|
|
2075
|
+
}, [value]);
|
|
2076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime302.jsx)("div", { className: "lib-xplat-textarea-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
2077
|
+
"div",
|
|
2078
|
+
{
|
|
2079
|
+
className: clsx_default(
|
|
2080
|
+
"lib-xplat-textarea",
|
|
2081
|
+
disabled ? "disabled" : void 0
|
|
2082
|
+
),
|
|
2083
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime302.jsx)(
|
|
2084
|
+
"textarea",
|
|
2085
|
+
{
|
|
2086
|
+
...textareaProps,
|
|
2087
|
+
ref: setRefs,
|
|
2088
|
+
disabled,
|
|
2089
|
+
value,
|
|
2090
|
+
onChange: handleOnChange
|
|
2091
|
+
}
|
|
2092
|
+
)
|
|
2093
|
+
}
|
|
2094
|
+
) });
|
|
2095
|
+
}
|
|
2096
|
+
);
|
|
2097
|
+
TextArea.displayName = "TextArea";
|
|
2098
|
+
var TextArea_default = TextArea;
|
|
2099
|
+
|
|
2100
|
+
// src/components/ChatInput/ChatInput.tsx
|
|
2101
|
+
var import_jsx_runtime303 = require("react/jsx-runtime");
|
|
2102
|
+
var ChatInput = import_react5.default.forwardRef(
|
|
2103
|
+
(props, ref) => {
|
|
2104
|
+
const {
|
|
2105
|
+
placeholder,
|
|
2106
|
+
value: valueProp,
|
|
2107
|
+
disabled = false,
|
|
2108
|
+
buttonType = "primary",
|
|
2109
|
+
onSubmit,
|
|
2110
|
+
onChange
|
|
2111
|
+
} = props;
|
|
2112
|
+
const isControlled = valueProp !== void 0;
|
|
2113
|
+
const [internalValue, setInternalValue] = import_react5.default.useState("");
|
|
2114
|
+
const value = isControlled ? valueProp : internalValue;
|
|
2115
|
+
const hasText = value.trim().length > 0;
|
|
2116
|
+
const handleChange = (e) => {
|
|
2117
|
+
const val = e.target.value;
|
|
2118
|
+
if (!isControlled) setInternalValue(val);
|
|
2119
|
+
onChange?.(val);
|
|
2120
|
+
};
|
|
2121
|
+
const handleSubmit = () => {
|
|
2122
|
+
if (!hasText || disabled) return;
|
|
2123
|
+
onSubmit?.(value);
|
|
2124
|
+
if (!isControlled) setInternalValue("");
|
|
2125
|
+
};
|
|
2126
|
+
const handleKeyDown = (e) => {
|
|
2127
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
2128
|
+
e.preventDefault();
|
|
2129
|
+
handleSubmit();
|
|
2130
|
+
}
|
|
2131
|
+
};
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime303.jsxs)("div", { className: clsx_default("lib-xplat-chat-input", disabled && "disabled"), children: [
|
|
2133
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
2134
|
+
TextArea_default,
|
|
2135
|
+
{
|
|
2136
|
+
ref,
|
|
2137
|
+
placeholder,
|
|
2138
|
+
value,
|
|
2139
|
+
disabled,
|
|
2140
|
+
onChange: handleChange,
|
|
2141
|
+
onKeyDown: handleKeyDown
|
|
2142
|
+
}
|
|
2143
|
+
),
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime303.jsx)(
|
|
2145
|
+
"button",
|
|
2146
|
+
{
|
|
2147
|
+
type: "button",
|
|
2148
|
+
className: clsx_default("chat-input-send", `btn-${buttonType}`),
|
|
2149
|
+
disabled: !hasText || disabled,
|
|
2150
|
+
onClick: handleSubmit,
|
|
2151
|
+
"aria-label": "\uC804\uC1A1",
|
|
2152
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime303.jsx)(SendIcon_default, {})
|
|
2153
|
+
}
|
|
2154
|
+
)
|
|
2155
|
+
] });
|
|
2156
|
+
}
|
|
2157
|
+
);
|
|
2158
|
+
ChatInput.displayName = "ChatInput";
|
|
2159
|
+
var ChatInput_default = ChatInput;
|
|
2160
|
+
|
|
2161
|
+
// src/components/Box/Box.tsx
|
|
2162
|
+
var import_jsx_runtime304 = require("react/jsx-runtime");
|
|
2026
2163
|
var Box = ({
|
|
2027
2164
|
children,
|
|
2028
2165
|
title,
|
|
2029
2166
|
variant = "outlined",
|
|
2030
2167
|
padding = "md"
|
|
2031
2168
|
}) => {
|
|
2032
|
-
return /* @__PURE__ */ (0,
|
|
2033
|
-
title && /* @__PURE__ */ (0,
|
|
2034
|
-
/* @__PURE__ */ (0,
|
|
2169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime304.jsxs)("div", { className: clsx_default("lib-xplat-box", variant, `pad-${padding}`), children: [
|
|
2170
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime304.jsx)("div", { className: "box-title", children: title }),
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime304.jsx)("div", { className: "box-content", children })
|
|
2035
2172
|
] });
|
|
2036
2173
|
};
|
|
2037
2174
|
Box.displayName = "Box";
|
|
2038
2175
|
var Box_default = Box;
|
|
2039
2176
|
|
|
2040
2177
|
// src/components/CardTab/CardTab.tsx
|
|
2041
|
-
var
|
|
2178
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
2042
2179
|
|
|
2043
2180
|
// src/components/CardTab/CardTabPanel.tsx
|
|
2044
|
-
var
|
|
2181
|
+
var import_jsx_runtime305 = require("react/jsx-runtime");
|
|
2045
2182
|
var CardTabPanel = (props) => {
|
|
2046
2183
|
const { children, columns = 3 } = props;
|
|
2047
|
-
return /* @__PURE__ */ (0,
|
|
2184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
|
|
2048
2185
|
"div",
|
|
2049
2186
|
{
|
|
2050
2187
|
className: "card-tab-panel",
|
|
@@ -2057,7 +2194,7 @@ CardTabPanel.displayName = "CardTab.Panel";
|
|
|
2057
2194
|
var CardTabPanel_default = CardTabPanel;
|
|
2058
2195
|
|
|
2059
2196
|
// src/components/CardTab/CardTab.tsx
|
|
2060
|
-
var
|
|
2197
|
+
var import_jsx_runtime306 = require("react/jsx-runtime");
|
|
2061
2198
|
var CardTabRoot = (props) => {
|
|
2062
2199
|
const {
|
|
2063
2200
|
tabs,
|
|
@@ -2067,7 +2204,7 @@ var CardTabRoot = (props) => {
|
|
|
2067
2204
|
children
|
|
2068
2205
|
} = props;
|
|
2069
2206
|
const isControlled = activeValueProp !== void 0;
|
|
2070
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
2207
|
+
const [uncontrolledValue, setUncontrolledValue] = import_react6.default.useState(tabs[0]?.value ?? "");
|
|
2071
2208
|
const activeValue = isControlled ? activeValueProp : uncontrolledValue;
|
|
2072
2209
|
const handleTabClick = (tab) => {
|
|
2073
2210
|
if (!isControlled) {
|
|
@@ -2075,16 +2212,16 @@ var CardTabRoot = (props) => {
|
|
|
2075
2212
|
}
|
|
2076
2213
|
onChange?.(tab);
|
|
2077
2214
|
};
|
|
2078
|
-
const panels =
|
|
2079
|
-
(child) =>
|
|
2215
|
+
const panels = import_react6.default.Children.toArray(children).filter(
|
|
2216
|
+
(child) => import_react6.default.isValidElement(child) && child.type === CardTabPanel_default
|
|
2080
2217
|
);
|
|
2081
2218
|
const activePanel = panels.find(
|
|
2082
2219
|
(panel) => panel.props.value === activeValue
|
|
2083
2220
|
);
|
|
2084
|
-
return /* @__PURE__ */ (0,
|
|
2085
|
-
/* @__PURE__ */ (0,
|
|
2221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsxs)("div", { className: clsx_default("lib-xplat-card-tab", size), children: [
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: "card-tab-bar", children: tabs.map((tab) => {
|
|
2086
2223
|
const isActive = tab.value === activeValue;
|
|
2087
|
-
return /* @__PURE__ */ (0,
|
|
2224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(
|
|
2088
2225
|
"button",
|
|
2089
2226
|
{
|
|
2090
2227
|
className: clsx_default("card-tab-trigger", isActive && "active"),
|
|
@@ -2096,7 +2233,7 @@ var CardTabRoot = (props) => {
|
|
|
2096
2233
|
tab.value
|
|
2097
2234
|
);
|
|
2098
2235
|
}) }),
|
|
2099
|
-
/* @__PURE__ */ (0,
|
|
2236
|
+
/* @__PURE__ */ (0, import_jsx_runtime306.jsx)("div", { className: "card-tab-body", children: activePanel })
|
|
2100
2237
|
] });
|
|
2101
2238
|
};
|
|
2102
2239
|
CardTabRoot.displayName = "CardTab";
|
|
@@ -2106,8 +2243,8 @@ var CardTab = Object.assign(CardTabRoot, {
|
|
|
2106
2243
|
var CardTab_default = CardTab;
|
|
2107
2244
|
|
|
2108
2245
|
// src/components/Chart/Chart.tsx
|
|
2109
|
-
var
|
|
2110
|
-
var
|
|
2246
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
2247
|
+
var import_jsx_runtime307 = require("react/jsx-runtime");
|
|
2111
2248
|
var CATEGORICAL_COUNT2 = 8;
|
|
2112
2249
|
var LINE_BAR_PALETTES = Array.from({ length: CATEGORICAL_COUNT2 }, (_, i) => {
|
|
2113
2250
|
const n = i + 1;
|
|
@@ -2153,11 +2290,11 @@ var toSmoothPath = (points) => {
|
|
|
2153
2290
|
};
|
|
2154
2291
|
var RESIZE_SETTLE_MS = 150;
|
|
2155
2292
|
var useChartSize = (ref) => {
|
|
2156
|
-
const [size, setSize] =
|
|
2157
|
-
const settleTimer =
|
|
2158
|
-
const committedSize =
|
|
2159
|
-
const initialRef =
|
|
2160
|
-
|
|
2293
|
+
const [size, setSize] = import_react7.default.useState({ width: 0, height: 0 });
|
|
2294
|
+
const settleTimer = import_react7.default.useRef(0);
|
|
2295
|
+
const committedSize = import_react7.default.useRef({ width: 0, height: 0 });
|
|
2296
|
+
const initialRef = import_react7.default.useRef(true);
|
|
2297
|
+
import_react7.default.useEffect(() => {
|
|
2161
2298
|
const el = ref.current;
|
|
2162
2299
|
if (!el) return;
|
|
2163
2300
|
const observer = new ResizeObserver((entries) => {
|
|
@@ -2199,10 +2336,10 @@ var useChartSize = (ref) => {
|
|
|
2199
2336
|
};
|
|
2200
2337
|
var prefersReducedMotion = () => typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2201
2338
|
var useChartAnimation = (containerRef, dataKey) => {
|
|
2202
|
-
const [animate, setAnimate] =
|
|
2203
|
-
const prevDataKey =
|
|
2204
|
-
const hasAnimated =
|
|
2205
|
-
|
|
2339
|
+
const [animate, setAnimate] = import_react7.default.useState(false);
|
|
2340
|
+
const prevDataKey = import_react7.default.useRef(dataKey);
|
|
2341
|
+
const hasAnimated = import_react7.default.useRef(false);
|
|
2342
|
+
import_react7.default.useEffect(() => {
|
|
2206
2343
|
if (prefersReducedMotion()) return;
|
|
2207
2344
|
const el = containerRef.current;
|
|
2208
2345
|
if (!el) return;
|
|
@@ -2218,7 +2355,7 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
2218
2355
|
observer.observe(el);
|
|
2219
2356
|
return () => observer.disconnect();
|
|
2220
2357
|
}, [containerRef]);
|
|
2221
|
-
|
|
2358
|
+
import_react7.default.useEffect(() => {
|
|
2222
2359
|
if (dataKey !== prevDataKey.current) {
|
|
2223
2360
|
prevDataKey.current = dataKey;
|
|
2224
2361
|
if (prefersReducedMotion()) return;
|
|
@@ -2229,15 +2366,15 @@ var useChartAnimation = (containerRef, dataKey) => {
|
|
|
2229
2366
|
return animate || prefersReducedMotion();
|
|
2230
2367
|
};
|
|
2231
2368
|
var useChartTooltip = (enabled) => {
|
|
2232
|
-
const [tooltip, setTooltip] =
|
|
2369
|
+
const [tooltip, setTooltip] = import_react7.default.useState({
|
|
2233
2370
|
visible: false,
|
|
2234
2371
|
x: 0,
|
|
2235
2372
|
y: 0,
|
|
2236
2373
|
content: ""
|
|
2237
2374
|
});
|
|
2238
|
-
const containerRef =
|
|
2239
|
-
const rafRef =
|
|
2240
|
-
const move =
|
|
2375
|
+
const containerRef = import_react7.default.useRef(null);
|
|
2376
|
+
const rafRef = import_react7.default.useRef(0);
|
|
2377
|
+
const move = import_react7.default.useCallback((e) => {
|
|
2241
2378
|
if (!enabled) return;
|
|
2242
2379
|
const clientX = e.clientX;
|
|
2243
2380
|
const clientY = e.clientY;
|
|
@@ -2252,7 +2389,7 @@ var useChartTooltip = (enabled) => {
|
|
|
2252
2389
|
}));
|
|
2253
2390
|
});
|
|
2254
2391
|
}, [enabled]);
|
|
2255
|
-
const show =
|
|
2392
|
+
const show = import_react7.default.useCallback((e, content) => {
|
|
2256
2393
|
if (!enabled) return;
|
|
2257
2394
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
2258
2395
|
if (!rect) return;
|
|
@@ -2263,18 +2400,18 @@ var useChartTooltip = (enabled) => {
|
|
|
2263
2400
|
content
|
|
2264
2401
|
});
|
|
2265
2402
|
}, [enabled]);
|
|
2266
|
-
const hide =
|
|
2403
|
+
const hide = import_react7.default.useCallback(() => {
|
|
2267
2404
|
cancelAnimationFrame(rafRef.current);
|
|
2268
2405
|
setTooltip((prev) => ({ ...prev, visible: false }));
|
|
2269
2406
|
}, []);
|
|
2270
2407
|
return { tooltip, show, hide, move, containerRef };
|
|
2271
2408
|
};
|
|
2272
|
-
var GridLines =
|
|
2409
|
+
var GridLines = import_react7.default.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(import_jsx_runtime307.Fragment, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
2273
2410
|
const y = PADDING.top + (1 - ratio) * chartH;
|
|
2274
2411
|
const val = Math.round(maxVal * ratio);
|
|
2275
|
-
return /* @__PURE__ */ (0,
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("g", { children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
2278
2415
|
] }, ratio);
|
|
2279
2416
|
}) }));
|
|
2280
2417
|
GridLines.displayName = "GridLines";
|
|
@@ -2284,25 +2421,25 @@ var getLabelStep = (count, chartW) => {
|
|
|
2284
2421
|
if (count <= maxLabels) return 1;
|
|
2285
2422
|
return Math.ceil(count / maxLabels);
|
|
2286
2423
|
};
|
|
2287
|
-
var AxisLabels =
|
|
2424
|
+
var AxisLabels = import_react7.default.memo(({ labels, count, chartW, height }) => {
|
|
2288
2425
|
const step = getLabelStep(count, chartW);
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(import_jsx_runtime307.Fragment, { children: labels.map((label, i) => {
|
|
2290
2427
|
if (i % step !== 0) return null;
|
|
2291
2428
|
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
2292
|
-
return /* @__PURE__ */ (0,
|
|
2429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2293
2430
|
}) });
|
|
2294
2431
|
});
|
|
2295
2432
|
AxisLabels.displayName = "AxisLabels";
|
|
2296
|
-
var LineChart =
|
|
2297
|
-
const entries =
|
|
2298
|
-
const maxVal =
|
|
2433
|
+
var LineChart = import_react7.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2434
|
+
const entries = import_react7.default.useMemo(() => Object.entries(data), [data]);
|
|
2435
|
+
const maxVal = import_react7.default.useMemo(() => {
|
|
2299
2436
|
const allValues = entries.flatMap(([, v]) => v);
|
|
2300
2437
|
return Math.max(...allValues) * 1.2 || 1;
|
|
2301
2438
|
}, [entries]);
|
|
2302
2439
|
const count = labels.length;
|
|
2303
2440
|
const chartW = width - PADDING.left - PADDING.right;
|
|
2304
2441
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
2305
|
-
const seriesPoints =
|
|
2442
|
+
const seriesPoints = import_react7.default.useMemo(
|
|
2306
2443
|
() => entries.map(
|
|
2307
2444
|
([, values]) => values.map((v, i) => ({
|
|
2308
2445
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -2313,8 +2450,8 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
2313
2450
|
[entries, count, chartW, chartH, maxVal]
|
|
2314
2451
|
);
|
|
2315
2452
|
const showPoints = count <= 100;
|
|
2316
|
-
const lineRefs =
|
|
2317
|
-
|
|
2453
|
+
const lineRefs = import_react7.default.useRef([]);
|
|
2454
|
+
import_react7.default.useEffect(() => {
|
|
2318
2455
|
if (!animate) return;
|
|
2319
2456
|
lineRefs.current.forEach((el) => {
|
|
2320
2457
|
if (!el) return;
|
|
@@ -2327,9 +2464,9 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
2327
2464
|
});
|
|
2328
2465
|
});
|
|
2329
2466
|
}, [animate, seriesPoints]);
|
|
2330
|
-
return /* @__PURE__ */ (0,
|
|
2331
|
-
/* @__PURE__ */ (0,
|
|
2332
|
-
/* @__PURE__ */ (0,
|
|
2467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2468
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(AxisLabels, { labels, count, chartW, height }),
|
|
2333
2470
|
entries.map(([key], di) => {
|
|
2334
2471
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2335
2472
|
const color = palette[2];
|
|
@@ -2338,12 +2475,12 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
2338
2475
|
const gradientId = `line-gradient-${di}`;
|
|
2339
2476
|
const polyPoints = points.map((p) => `${p.x},${p.y}`).join(" ");
|
|
2340
2477
|
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`;
|
|
2341
|
-
return /* @__PURE__ */ (0,
|
|
2342
|
-
/* @__PURE__ */ (0,
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2344
|
-
/* @__PURE__ */ (0,
|
|
2478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("g", { children: [
|
|
2479
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.2" }),
|
|
2481
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0" })
|
|
2345
2482
|
] }) }),
|
|
2346
|
-
/* @__PURE__ */ (0,
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2347
2484
|
"path",
|
|
2348
2485
|
{
|
|
2349
2486
|
d: areaD,
|
|
@@ -2352,7 +2489,7 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
2352
2489
|
style: animate ? { animationDelay: "600ms" } : { opacity: 1 }
|
|
2353
2490
|
}
|
|
2354
2491
|
),
|
|
2355
|
-
/* @__PURE__ */ (0,
|
|
2492
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2356
2493
|
"polyline",
|
|
2357
2494
|
{
|
|
2358
2495
|
ref: (el) => {
|
|
@@ -2364,7 +2501,7 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
2364
2501
|
strokeWidth: "2"
|
|
2365
2502
|
}
|
|
2366
2503
|
),
|
|
2367
|
-
showPoints && points.map((p, i) => /* @__PURE__ */ (0,
|
|
2504
|
+
showPoints && points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2368
2505
|
"circle",
|
|
2369
2506
|
{
|
|
2370
2507
|
cx: p.x,
|
|
@@ -2383,16 +2520,16 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, anima
|
|
|
2383
2520
|
] });
|
|
2384
2521
|
});
|
|
2385
2522
|
LineChart.displayName = "LineChart";
|
|
2386
|
-
var CurveChart =
|
|
2387
|
-
const entries =
|
|
2388
|
-
const maxVal =
|
|
2523
|
+
var CurveChart = import_react7.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2524
|
+
const entries = import_react7.default.useMemo(() => Object.entries(data), [data]);
|
|
2525
|
+
const maxVal = import_react7.default.useMemo(() => {
|
|
2389
2526
|
const allValues = entries.flatMap(([, v]) => v);
|
|
2390
2527
|
return Math.max(...allValues) * 1.2 || 1;
|
|
2391
2528
|
}, [entries]);
|
|
2392
2529
|
const count = labels.length;
|
|
2393
2530
|
const chartW = width - PADDING.left - PADDING.right;
|
|
2394
2531
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
2395
|
-
const seriesPoints =
|
|
2532
|
+
const seriesPoints = import_react7.default.useMemo(
|
|
2396
2533
|
() => entries.map(
|
|
2397
2534
|
([, values]) => values.map((v, i) => ({
|
|
2398
2535
|
x: PADDING.left + i / (count - 1 || 1) * chartW,
|
|
@@ -2403,8 +2540,8 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
2403
2540
|
[entries, count, chartW, chartH, maxVal]
|
|
2404
2541
|
);
|
|
2405
2542
|
const showPoints = count <= 100;
|
|
2406
|
-
const lineRefs =
|
|
2407
|
-
|
|
2543
|
+
const lineRefs = import_react7.default.useRef([]);
|
|
2544
|
+
import_react7.default.useEffect(() => {
|
|
2408
2545
|
if (!animate) return;
|
|
2409
2546
|
lineRefs.current.forEach((el) => {
|
|
2410
2547
|
if (!el) return;
|
|
@@ -2417,9 +2554,9 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
2417
2554
|
});
|
|
2418
2555
|
});
|
|
2419
2556
|
}, [animate, seriesPoints]);
|
|
2420
|
-
return /* @__PURE__ */ (0,
|
|
2421
|
-
/* @__PURE__ */ (0,
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(AxisLabels, { labels, count, chartW, height }),
|
|
2423
2560
|
entries.map(([key], di) => {
|
|
2424
2561
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2425
2562
|
const color = palette[2];
|
|
@@ -2428,12 +2565,12 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
2428
2565
|
const gradientId = `curve-gradient-${di}`;
|
|
2429
2566
|
const linePath = toSmoothPath(points);
|
|
2430
2567
|
const areaPath = linePath + ` L ${points[points.length - 1].x} ${PADDING.top + chartH} L ${points[0].x} ${PADDING.top + chartH} Z`;
|
|
2431
|
-
return /* @__PURE__ */ (0,
|
|
2432
|
-
/* @__PURE__ */ (0,
|
|
2433
|
-
/* @__PURE__ */ (0,
|
|
2434
|
-
/* @__PURE__ */ (0,
|
|
2568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("g", { children: [
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
2570
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("stop", { offset: "0%", stopColor: areaColor, stopOpacity: "0.4" }),
|
|
2571
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("stop", { offset: "100%", stopColor: areaColor, stopOpacity: "0.02" })
|
|
2435
2572
|
] }) }),
|
|
2436
|
-
/* @__PURE__ */ (0,
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2437
2574
|
"path",
|
|
2438
2575
|
{
|
|
2439
2576
|
d: areaPath,
|
|
@@ -2442,7 +2579,7 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
2442
2579
|
style: animate ? { animationDelay: "600ms" } : { opacity: 1 }
|
|
2443
2580
|
}
|
|
2444
2581
|
),
|
|
2445
|
-
/* @__PURE__ */ (0,
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2446
2583
|
"path",
|
|
2447
2584
|
{
|
|
2448
2585
|
ref: (el) => {
|
|
@@ -2454,7 +2591,7 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
2454
2591
|
strokeWidth: "2"
|
|
2455
2592
|
}
|
|
2456
2593
|
),
|
|
2457
|
-
showPoints && points.map((p, i) => /* @__PURE__ */ (0,
|
|
2594
|
+
showPoints && points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2458
2595
|
"circle",
|
|
2459
2596
|
{
|
|
2460
2597
|
cx: p.x,
|
|
@@ -2473,9 +2610,9 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, anim
|
|
|
2473
2610
|
] });
|
|
2474
2611
|
});
|
|
2475
2612
|
CurveChart.displayName = "CurveChart";
|
|
2476
|
-
var BarChart =
|
|
2477
|
-
const entries =
|
|
2478
|
-
const maxVal =
|
|
2613
|
+
var BarChart = import_react7.default.memo(({ data, labels, width, height, animate, onHover, onMove, onLeave }) => {
|
|
2614
|
+
const entries = import_react7.default.useMemo(() => Object.entries(data), [data]);
|
|
2615
|
+
const maxVal = import_react7.default.useMemo(() => {
|
|
2479
2616
|
const allValues = entries.flatMap(([, v]) => v);
|
|
2480
2617
|
return Math.max(...allValues) * 1.2 || 1;
|
|
2481
2618
|
}, [entries]);
|
|
@@ -2487,7 +2624,7 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
2487
2624
|
const barGap = groupCount > 1 ? 2 : 0;
|
|
2488
2625
|
const barW = Math.max(1, Math.min(32, (groupW * 0.7 - barGap * (groupCount - 1)) / groupCount));
|
|
2489
2626
|
const baseline = PADDING.top + chartH;
|
|
2490
|
-
const bars =
|
|
2627
|
+
const bars = import_react7.default.useMemo(
|
|
2491
2628
|
() => entries.map(
|
|
2492
2629
|
([, values], di) => values.map((v, i) => {
|
|
2493
2630
|
const totalBarsW = barW * groupCount + barGap * (groupCount - 1);
|
|
@@ -2500,11 +2637,11 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
2500
2637
|
[entries, maxVal, chartH, groupW, barW, barGap, groupCount]
|
|
2501
2638
|
);
|
|
2502
2639
|
const barLabelStep = getLabelStep(count, chartW);
|
|
2503
|
-
return /* @__PURE__ */ (0,
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2641
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
2505
2642
|
labels.map((label, i) => {
|
|
2506
2643
|
if (i % barLabelStep !== 0) return null;
|
|
2507
|
-
return /* @__PURE__ */ (0,
|
|
2644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2508
2645
|
}),
|
|
2509
2646
|
entries.map(([key], di) => {
|
|
2510
2647
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
@@ -2513,7 +2650,7 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
2513
2650
|
const r2 = Math.min(4, b.w / 2);
|
|
2514
2651
|
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`;
|
|
2515
2652
|
const delay = 100 + i * 80;
|
|
2516
|
-
return /* @__PURE__ */ (0,
|
|
2653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2517
2654
|
"path",
|
|
2518
2655
|
{
|
|
2519
2656
|
d,
|
|
@@ -2534,11 +2671,11 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, animat
|
|
|
2534
2671
|
] });
|
|
2535
2672
|
});
|
|
2536
2673
|
BarChart.displayName = "BarChart";
|
|
2537
|
-
var PieDonutChart =
|
|
2674
|
+
var PieDonutChart = import_react7.default.memo(
|
|
2538
2675
|
({ data, labels, width, height, animate, isDoughnut, onHover, onMove, onLeave }) => {
|
|
2539
|
-
const entries =
|
|
2540
|
-
const values =
|
|
2541
|
-
const total =
|
|
2676
|
+
const entries = import_react7.default.useMemo(() => Object.entries(data), [data]);
|
|
2677
|
+
const values = import_react7.default.useMemo(() => entries.flatMap(([, v]) => v), [entries]);
|
|
2678
|
+
const total = import_react7.default.useMemo(() => values.reduce((a, b) => a + b, 0) || 1, [values]);
|
|
2542
2679
|
const size = Math.min(width, height);
|
|
2543
2680
|
const cx = size / 2;
|
|
2544
2681
|
const cy = size / 2;
|
|
@@ -2546,8 +2683,22 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
2546
2683
|
const innerR = isDoughnut ? r2 * 0.5 : 0;
|
|
2547
2684
|
const firstKey = entries[0]?.[0] ?? "";
|
|
2548
2685
|
const colorOffset = hashString(firstKey);
|
|
2549
|
-
const
|
|
2686
|
+
const maskRef = import_react7.default.useRef(null);
|
|
2687
|
+
const maskR = r2 + 10;
|
|
2688
|
+
const maskCircumference = 2 * Math.PI * maskR;
|
|
2689
|
+
import_react7.default.useEffect(() => {
|
|
2690
|
+
if (!animate || !maskRef.current) return;
|
|
2691
|
+
const el = maskRef.current;
|
|
2692
|
+
el.style.strokeDasharray = `${maskCircumference}`;
|
|
2693
|
+
el.style.strokeDashoffset = `${maskCircumference}`;
|
|
2694
|
+
requestAnimationFrame(() => {
|
|
2695
|
+
el.style.transition = "stroke-dashoffset 1000ms ease-out";
|
|
2696
|
+
el.style.strokeDashoffset = "0";
|
|
2697
|
+
});
|
|
2698
|
+
}, [animate, maskCircumference]);
|
|
2699
|
+
const sliceData = import_react7.default.useMemo(() => {
|
|
2550
2700
|
let angle0 = -Math.PI / 2;
|
|
2701
|
+
let cumulativeAngle = 0;
|
|
2551
2702
|
return values.map((v, i) => {
|
|
2552
2703
|
const angle = v / total * Math.PI * 2;
|
|
2553
2704
|
const endAngle = angle0 + angle;
|
|
@@ -2571,45 +2722,60 @@ var PieDonutChart = import_react5.default.memo(
|
|
|
2571
2722
|
const lx = cx + labelR * Math.cos(midAngle);
|
|
2572
2723
|
const ly = cy + labelR * Math.sin(midAngle);
|
|
2573
2724
|
const pct = Math.round(v / total * 100);
|
|
2725
|
+
cumulativeAngle += angle;
|
|
2726
|
+
const sliceEndRatio = cumulativeAngle / (Math.PI * 2);
|
|
2727
|
+
const labelDelay = 1e3 * sliceEndRatio + 150;
|
|
2574
2728
|
angle0 = endAngle;
|
|
2575
|
-
return { d, lx, ly, v, pct, angle, label: labels[i] || `${i + 1}
|
|
2729
|
+
return { d, lx, ly, v, pct, angle, label: labels[i] || `${i + 1}`, labelDelay };
|
|
2576
2730
|
});
|
|
2577
2731
|
}, [values, total, cx, cy, r2, innerR, labels]);
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
}
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2732
|
+
const maskId = `pie-mask-${isDoughnut ? "d" : "p"}`;
|
|
2733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("svg", { viewBox: `0 0 ${size} ${size}`, className: "chart-svg chart-pie", children: [
|
|
2734
|
+
animate && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("mask", { id: maskId, children: /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2735
|
+
"circle",
|
|
2736
|
+
{
|
|
2737
|
+
ref: maskRef,
|
|
2738
|
+
cx,
|
|
2739
|
+
cy,
|
|
2740
|
+
r: maskR,
|
|
2741
|
+
fill: "none",
|
|
2742
|
+
stroke: "white",
|
|
2743
|
+
strokeWidth: maskR * 2,
|
|
2744
|
+
transform: `rotate(-90 ${cx} ${cy})`
|
|
2745
|
+
}
|
|
2746
|
+
) }) }),
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime307.jsx)("g", { mask: animate ? `url(#${maskId})` : void 0, children: sliceData.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime307.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2748
|
+
"path",
|
|
2749
|
+
{
|
|
2750
|
+
d: s.d,
|
|
2751
|
+
fill: PIE_COLORS[(i + colorOffset) % PIE_COLORS.length],
|
|
2752
|
+
className: "chart-slice",
|
|
2753
|
+
onMouseEnter: (e) => onHover(e, `${s.label}: ${s.v} (${s.pct}%)`),
|
|
2754
|
+
onMouseMove: onMove,
|
|
2755
|
+
onMouseLeave: onLeave
|
|
2756
|
+
}
|
|
2757
|
+
) }, i)) }),
|
|
2758
|
+
sliceData.map((s, i) => s.angle > 0.2 && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2759
|
+
"text",
|
|
2760
|
+
{
|
|
2761
|
+
x: s.lx,
|
|
2762
|
+
y: s.ly,
|
|
2763
|
+
className: `chart-pie-label ${animate ? "chart-pie-label-animate" : ""}`,
|
|
2764
|
+
style: animate ? { animationDelay: `${s.labelDelay}ms` } : void 0,
|
|
2765
|
+
textAnchor: "middle",
|
|
2766
|
+
dominantBaseline: "central",
|
|
2767
|
+
children: s.v
|
|
2768
|
+
},
|
|
2769
|
+
`label-${i}`
|
|
2770
|
+
))
|
|
2771
|
+
] });
|
|
2606
2772
|
}
|
|
2607
2773
|
);
|
|
2608
2774
|
PieDonutChart.displayName = "PieDonutChart";
|
|
2609
2775
|
var TooltipBubble = ({ x, y, containerWidth, children }) => {
|
|
2610
|
-
const ref =
|
|
2611
|
-
const [adjustedX, setAdjustedX] =
|
|
2612
|
-
|
|
2776
|
+
const ref = import_react7.default.useRef(null);
|
|
2777
|
+
const [adjustedX, setAdjustedX] = import_react7.default.useState(x);
|
|
2778
|
+
import_react7.default.useEffect(() => {
|
|
2613
2779
|
const el = ref.current;
|
|
2614
2780
|
if (!el) return;
|
|
2615
2781
|
const w = el.offsetWidth;
|
|
@@ -2620,7 +2786,7 @@ var TooltipBubble = ({ x, y, containerWidth, children }) => {
|
|
|
2620
2786
|
else if (x + half > containerWidth - margin) nx = containerWidth - half - margin;
|
|
2621
2787
|
setAdjustedX(nx);
|
|
2622
2788
|
}, [x, containerWidth]);
|
|
2623
|
-
return /* @__PURE__ */ (0,
|
|
2789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(
|
|
2624
2790
|
"div",
|
|
2625
2791
|
{
|
|
2626
2792
|
ref,
|
|
@@ -2630,22 +2796,22 @@ var TooltipBubble = ({ x, y, containerWidth, children }) => {
|
|
|
2630
2796
|
}
|
|
2631
2797
|
);
|
|
2632
2798
|
};
|
|
2633
|
-
var Chart =
|
|
2799
|
+
var Chart = import_react7.default.memo((props) => {
|
|
2634
2800
|
const { type, data, labels, tooltip: showTooltip = true } = props;
|
|
2635
2801
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
2636
2802
|
const { width, height } = useChartSize(containerRef);
|
|
2637
|
-
const stableData =
|
|
2638
|
-
const stableLabels =
|
|
2639
|
-
const dataKey =
|
|
2803
|
+
const stableData = import_react7.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
2804
|
+
const stableLabels = import_react7.default.useMemo(() => labels, [JSON.stringify(labels)]);
|
|
2805
|
+
const dataKey = import_react7.default.useMemo(() => JSON.stringify(labels), [labels]);
|
|
2640
2806
|
const animate = useChartAnimation(containerRef, dataKey);
|
|
2641
2807
|
const ready = width > 0 && height > 0;
|
|
2642
|
-
return /* @__PURE__ */ (0,
|
|
2643
|
-
ready && type === "line" && /* @__PURE__ */ (0,
|
|
2644
|
-
ready && type === "curve" && /* @__PURE__ */ (0,
|
|
2645
|
-
ready && type === "bar" && /* @__PURE__ */ (0,
|
|
2646
|
-
ready && type === "pie" && /* @__PURE__ */ (0,
|
|
2647
|
-
ready && type === "doughnut" && /* @__PURE__ */ (0,
|
|
2648
|
-
tooltip.visible && /* @__PURE__ */ (0,
|
|
2808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime307.jsxs)("div", { className: "lib-xplat-chart", ref: containerRef, children: [
|
|
2809
|
+
ready && type === "line" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(LineChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2810
|
+
ready && type === "curve" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(CurveChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2811
|
+
ready && type === "bar" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2812
|
+
ready && type === "pie" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2813
|
+
ready && type === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2814
|
+
tooltip.visible && /* @__PURE__ */ (0, import_jsx_runtime307.jsx)(TooltipBubble, { x: tooltip.x, y: tooltip.y, containerWidth: width, children: tooltip.content })
|
|
2649
2815
|
] });
|
|
2650
2816
|
});
|
|
2651
2817
|
Chart.displayName = "Chart";
|
|
@@ -2658,7 +2824,7 @@ var import_tokens_core = require("@x-plat/tokens-core");
|
|
|
2658
2824
|
var import_tokens_core2 = require("@x-plat/tokens-core");
|
|
2659
2825
|
|
|
2660
2826
|
// src/components/CheckBox/CheckBox.tsx
|
|
2661
|
-
var
|
|
2827
|
+
var import_jsx_runtime308 = require("react/jsx-runtime");
|
|
2662
2828
|
var CheckBox = (props) => {
|
|
2663
2829
|
const {
|
|
2664
2830
|
checked,
|
|
@@ -2676,8 +2842,8 @@ var CheckBox = (props) => {
|
|
|
2676
2842
|
const checkedClasses = `checked`;
|
|
2677
2843
|
const disabledClasses = "disabled";
|
|
2678
2844
|
const boxClasses = disabled ? disabledClasses : checked ? checkedClasses : uncheckedClasses;
|
|
2679
|
-
return /* @__PURE__ */ (0,
|
|
2680
|
-
/* @__PURE__ */ (0,
|
|
2845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime308.jsxs)("label", { className: clsx_default("lib-xplat-checkbox", size, type), children: [
|
|
2846
|
+
/* @__PURE__ */ (0, import_jsx_runtime308.jsx)(
|
|
2681
2847
|
"input",
|
|
2682
2848
|
{
|
|
2683
2849
|
type: "checkbox",
|
|
@@ -2687,44 +2853,44 @@ var CheckBox = (props) => {
|
|
|
2687
2853
|
...rest
|
|
2688
2854
|
}
|
|
2689
2855
|
),
|
|
2690
|
-
/* @__PURE__ */ (0,
|
|
2691
|
-
label && /* @__PURE__ */ (0,
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { className: clsx_default("checkbox", boxClasses), children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { className: clsx_default("check-icon", { visible: checked }), children: /* @__PURE__ */ (0, import_jsx_runtime308.jsx)(CheckIcon_default, {}) }) }),
|
|
2857
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime308.jsx)("span", { className: "label", children: label })
|
|
2692
2858
|
] });
|
|
2693
2859
|
};
|
|
2694
2860
|
CheckBox.displayName = "CheckBox";
|
|
2695
2861
|
var CheckBox_default = CheckBox;
|
|
2696
2862
|
|
|
2697
2863
|
// src/components/Chip/Chip.tsx
|
|
2698
|
-
var
|
|
2864
|
+
var import_jsx_runtime309 = require("react/jsx-runtime");
|
|
2699
2865
|
var Chip = (props) => {
|
|
2700
2866
|
const {
|
|
2701
2867
|
children,
|
|
2702
2868
|
type = "primary",
|
|
2703
2869
|
size = "md"
|
|
2704
2870
|
} = props;
|
|
2705
|
-
return /* @__PURE__ */ (0,
|
|
2871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime309.jsx)("div", { className: clsx_default("lib-xplat-chip", type, size), children });
|
|
2706
2872
|
};
|
|
2707
2873
|
Chip.displayName = "Chip";
|
|
2708
2874
|
var Chip_default = Chip;
|
|
2709
2875
|
|
|
2710
2876
|
// src/components/DatePicker/InputDatePicker/index.tsx
|
|
2711
|
-
var
|
|
2877
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
2712
2878
|
|
|
2713
2879
|
// src/components/Input/Input.tsx
|
|
2714
|
-
var
|
|
2880
|
+
var import_react8 = __toESM(require("react"), 1);
|
|
2715
2881
|
|
|
2716
2882
|
// src/components/Input/InputValidations.tsx
|
|
2717
|
-
var
|
|
2883
|
+
var import_jsx_runtime310 = require("react/jsx-runtime");
|
|
2718
2884
|
var InputValidations = (props) => {
|
|
2719
2885
|
const { message, status = "default" } = props;
|
|
2720
|
-
return /* @__PURE__ */ (0,
|
|
2721
|
-
/* @__PURE__ */ (0,
|
|
2722
|
-
status === "default" && /* @__PURE__ */ (0,
|
|
2723
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
2724
|
-
status === "warning" && /* @__PURE__ */ (0,
|
|
2725
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
2886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime310.jsxs)("div", { className: clsx_default("lib-xplat-input-validation", status), children: [
|
|
2887
|
+
/* @__PURE__ */ (0, import_jsx_runtime310.jsxs)("div", { className: "icon", children: [
|
|
2888
|
+
status === "default" && /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(InfoIcon_default, {}),
|
|
2889
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(SuccessIcon_default, {}),
|
|
2890
|
+
status === "warning" && /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(InfoIcon_default, {}),
|
|
2891
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(ErrorIcon_default, {})
|
|
2726
2892
|
] }),
|
|
2727
|
-
/* @__PURE__ */ (0,
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime310.jsx)("div", { className: "message", children: message })
|
|
2728
2894
|
] });
|
|
2729
2895
|
};
|
|
2730
2896
|
InputValidations.displayName = "InputValidations";
|
|
@@ -2765,8 +2931,8 @@ var handleTelBackspace = (prevValue, currValue) => {
|
|
|
2765
2931
|
};
|
|
2766
2932
|
|
|
2767
2933
|
// src/components/Input/Input.tsx
|
|
2768
|
-
var
|
|
2769
|
-
var
|
|
2934
|
+
var import_jsx_runtime311 = require("react/jsx-runtime");
|
|
2935
|
+
var import_react9 = require("react");
|
|
2770
2936
|
var formatValue = (type, value) => {
|
|
2771
2937
|
if (value === null || value === void 0) return "";
|
|
2772
2938
|
const strValue = Array.isArray(value) ? String(value[0] ?? "") : String(value);
|
|
@@ -2814,7 +2980,7 @@ var parseValue = (type, value) => {
|
|
|
2814
2980
|
return value;
|
|
2815
2981
|
}
|
|
2816
2982
|
};
|
|
2817
|
-
var Input =
|
|
2983
|
+
var Input = import_react8.default.forwardRef((props, ref) => {
|
|
2818
2984
|
const {
|
|
2819
2985
|
value,
|
|
2820
2986
|
onChange,
|
|
@@ -2840,13 +3006,13 @@ var Input = import_react6.default.forwardRef((props, ref) => {
|
|
|
2840
3006
|
onChange(event);
|
|
2841
3007
|
}
|
|
2842
3008
|
};
|
|
2843
|
-
return /* @__PURE__ */ (0,
|
|
2844
|
-
/* @__PURE__ */ (0,
|
|
3009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime311.jsxs)("div", { className: "lib-xplat-input-wrap", children: [
|
|
3010
|
+
/* @__PURE__ */ (0, import_jsx_runtime311.jsxs)(
|
|
2845
3011
|
"div",
|
|
2846
3012
|
{
|
|
2847
3013
|
className: clsx_default("lib-xplat-input", size, disabled ? "disabled" : void 0),
|
|
2848
3014
|
children: [
|
|
2849
|
-
/* @__PURE__ */ (0,
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime311.jsx)(
|
|
2850
3016
|
"input",
|
|
2851
3017
|
{
|
|
2852
3018
|
...inputProps,
|
|
@@ -2857,11 +3023,11 @@ var Input = import_react6.default.forwardRef((props, ref) => {
|
|
|
2857
3023
|
onChange: handleChange
|
|
2858
3024
|
}
|
|
2859
3025
|
),
|
|
2860
|
-
suffix && /* @__PURE__ */ (0,
|
|
3026
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: "suffix", children: suffix })
|
|
2861
3027
|
]
|
|
2862
3028
|
}
|
|
2863
3029
|
),
|
|
2864
|
-
validations && /* @__PURE__ */ (0,
|
|
3030
|
+
validations && /* @__PURE__ */ (0, import_jsx_runtime311.jsx)("div", { className: "lib-xplat-input-validation-wrap", children: validations?.map((validation, idx) => /* @__PURE__ */ (0, import_react9.createElement)(
|
|
2865
3031
|
InputValidations_default,
|
|
2866
3032
|
{
|
|
2867
3033
|
...validation,
|
|
@@ -2874,20 +3040,20 @@ Input.displayName = "Input";
|
|
|
2874
3040
|
var Input_default = Input;
|
|
2875
3041
|
|
|
2876
3042
|
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
2877
|
-
var
|
|
2878
|
-
var
|
|
2879
|
-
var PasswordInput =
|
|
3043
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
3044
|
+
var import_jsx_runtime312 = require("react/jsx-runtime");
|
|
3045
|
+
var PasswordInput = import_react10.default.forwardRef(
|
|
2880
3046
|
(props, ref) => {
|
|
2881
3047
|
const { reg: _reg, ...inputProps } = props;
|
|
2882
|
-
const [isView, setIsView] =
|
|
3048
|
+
const [isView, setIsView] = import_react10.default.useState(false);
|
|
2883
3049
|
const handleChangeView = () => {
|
|
2884
3050
|
setIsView((prev) => !prev);
|
|
2885
3051
|
};
|
|
2886
|
-
return /* @__PURE__ */ (0,
|
|
3052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
2887
3053
|
Input_default,
|
|
2888
3054
|
{
|
|
2889
3055
|
...inputProps,
|
|
2890
|
-
suffix: /* @__PURE__ */ (0,
|
|
3056
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)("div", { className: "wrapper pointer", onClick: handleChangeView, children: isView ? /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(OpenEyeIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(CloseEyeIcon_default, {}) }),
|
|
2891
3057
|
type: isView ? "text" : "password",
|
|
2892
3058
|
ref
|
|
2893
3059
|
}
|
|
@@ -2898,17 +3064,17 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
2898
3064
|
var PasswordInput_default = PasswordInput;
|
|
2899
3065
|
|
|
2900
3066
|
// src/components/Modal/Modal.tsx
|
|
2901
|
-
var
|
|
3067
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2902
3068
|
var import_react_dom2 = require("react-dom");
|
|
2903
3069
|
|
|
2904
3070
|
// src/tokens/hooks/Portal.tsx
|
|
2905
|
-
var
|
|
3071
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2906
3072
|
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
2907
|
-
var
|
|
2908
|
-
var PortalContainerContext =
|
|
2909
|
-
var PortalProvider = ({ container, children }) => /* @__PURE__ */ (0,
|
|
3073
|
+
var import_jsx_runtime313 = require("react/jsx-runtime");
|
|
3074
|
+
var PortalContainerContext = import_react11.default.createContext(null);
|
|
3075
|
+
var PortalProvider = ({ container, children }) => /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(PortalContainerContext.Provider, { value: container, children });
|
|
2910
3076
|
var Portal = ({ children }) => {
|
|
2911
|
-
const contextContainer =
|
|
3077
|
+
const contextContainer = import_react11.default.useContext(PortalContainerContext);
|
|
2912
3078
|
if (typeof document === "undefined") return null;
|
|
2913
3079
|
const container = contextContainer ?? document.body;
|
|
2914
3080
|
return import_react_dom.default.createPortal(children, container);
|
|
@@ -2917,14 +3083,14 @@ Portal.displayName = "Portal";
|
|
|
2917
3083
|
var Portal_default = Portal;
|
|
2918
3084
|
|
|
2919
3085
|
// src/components/Modal/Modal.tsx
|
|
2920
|
-
var
|
|
3086
|
+
var import_jsx_runtime314 = require("react/jsx-runtime");
|
|
2921
3087
|
var ANIMATION_DURATION_MS = 200;
|
|
2922
3088
|
var Modal = (props) => {
|
|
2923
3089
|
const { isOpen, onClose, children } = props;
|
|
2924
|
-
const [mounted, setMounted] =
|
|
2925
|
-
const [visible, setVisible] =
|
|
2926
|
-
const boxRef =
|
|
2927
|
-
|
|
3090
|
+
const [mounted, setMounted] = import_react12.default.useState(false);
|
|
3091
|
+
const [visible, setVisible] = import_react12.default.useState(false);
|
|
3092
|
+
const boxRef = import_react12.default.useRef(null);
|
|
3093
|
+
import_react12.default.useEffect(() => {
|
|
2928
3094
|
if (isOpen) {
|
|
2929
3095
|
setMounted(true);
|
|
2930
3096
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -2938,12 +3104,12 @@ var Modal = (props) => {
|
|
|
2938
3104
|
if (!mounted) return null;
|
|
2939
3105
|
const stateClass = visible ? "enter" : "exit";
|
|
2940
3106
|
return (0, import_react_dom2.createPortal)(
|
|
2941
|
-
/* @__PURE__ */ (0,
|
|
3107
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
2942
3108
|
"div",
|
|
2943
3109
|
{
|
|
2944
3110
|
className: clsx_default("lib-xplat-modal", "dim", stateClass),
|
|
2945
3111
|
onClick: onClose,
|
|
2946
|
-
children: /* @__PURE__ */ (0,
|
|
3112
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
2947
3113
|
"div",
|
|
2948
3114
|
{
|
|
2949
3115
|
ref: boxRef,
|
|
@@ -2951,7 +3117,7 @@ var Modal = (props) => {
|
|
|
2951
3117
|
role: "dialog",
|
|
2952
3118
|
"aria-modal": "true",
|
|
2953
3119
|
onClick: (e) => e.stopPropagation(),
|
|
2954
|
-
children: /* @__PURE__ */ (0,
|
|
3120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(PortalProvider, { container: boxRef.current, children })
|
|
2955
3121
|
}
|
|
2956
3122
|
)
|
|
2957
3123
|
}
|
|
@@ -2963,9 +3129,9 @@ Modal.displayName = "Modal";
|
|
|
2963
3129
|
var Modal_default = Modal;
|
|
2964
3130
|
|
|
2965
3131
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
2966
|
-
var
|
|
2967
|
-
var
|
|
2968
|
-
var DayCell2 =
|
|
3132
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
3133
|
+
var import_jsx_runtime315 = require("react/jsx-runtime");
|
|
3134
|
+
var DayCell2 = import_react13.default.memo(
|
|
2969
3135
|
({
|
|
2970
3136
|
day,
|
|
2971
3137
|
disabled,
|
|
@@ -2975,7 +3141,7 @@ var DayCell2 = import_react11.default.memo(
|
|
|
2975
3141
|
isEnd,
|
|
2976
3142
|
inRange,
|
|
2977
3143
|
onSelect
|
|
2978
|
-
}) => /* @__PURE__ */ (0,
|
|
3144
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
2979
3145
|
"button",
|
|
2980
3146
|
{
|
|
2981
3147
|
type: "button",
|
|
@@ -3017,26 +3183,26 @@ var SingleDatePicker = (props) => {
|
|
|
3017
3183
|
initialYear,
|
|
3018
3184
|
initialMonth
|
|
3019
3185
|
);
|
|
3020
|
-
const [pickerMode, setPickerMode] =
|
|
3021
|
-
const [yearRangeStart, setYearRangeStart] =
|
|
3186
|
+
const [pickerMode, setPickerMode] = import_react13.default.useState("days");
|
|
3187
|
+
const [yearRangeStart, setYearRangeStart] = import_react13.default.useState(
|
|
3022
3188
|
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
3023
3189
|
);
|
|
3024
|
-
const minTime =
|
|
3190
|
+
const minTime = import_react13.default.useMemo(
|
|
3025
3191
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
3026
3192
|
[minDate]
|
|
3027
3193
|
);
|
|
3028
|
-
const maxTime =
|
|
3194
|
+
const maxTime = import_react13.default.useMemo(
|
|
3029
3195
|
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
3030
3196
|
[maxDate]
|
|
3031
3197
|
);
|
|
3032
|
-
const highlightSet =
|
|
3198
|
+
const highlightSet = import_react13.default.useMemo(() => {
|
|
3033
3199
|
const set = /* @__PURE__ */ new Set();
|
|
3034
3200
|
for (const h of highlightDates) {
|
|
3035
3201
|
set.add(`${h.getFullYear()}-${h.getMonth()}-${h.getDate()}`);
|
|
3036
3202
|
}
|
|
3037
3203
|
return set;
|
|
3038
3204
|
}, [highlightDates]);
|
|
3039
|
-
const handleSelect =
|
|
3205
|
+
const handleSelect = import_react13.default.useCallback(
|
|
3040
3206
|
(date) => {
|
|
3041
3207
|
onChange?.(date);
|
|
3042
3208
|
},
|
|
@@ -3073,20 +3239,20 @@ var SingleDatePicker = (props) => {
|
|
|
3073
3239
|
const monthLabels = MONTH_LABELS[locale];
|
|
3074
3240
|
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
3075
3241
|
const hasRange = rangeStart != null && rangeEnd != null;
|
|
3076
|
-
return /* @__PURE__ */ (0,
|
|
3242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime315.jsxs)(
|
|
3077
3243
|
"div",
|
|
3078
3244
|
{
|
|
3079
3245
|
className: clsx_default("lib-xplat-datepicker", "single"),
|
|
3080
3246
|
children: [
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3082
|
-
/* @__PURE__ */ (0,
|
|
3083
|
-
/* @__PURE__ */ (0,
|
|
3084
|
-
/* @__PURE__ */ (0,
|
|
3247
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsxs)("div", { className: "datepicker-header", children: [
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("button", { className: "datepicker-nav", onClick: handlePrev, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ChevronLeftIcon_default, {}) }),
|
|
3249
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("button", { className: "datepicker-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
3250
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("button", { className: "datepicker-nav", onClick: handleNext, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(ChevronRightIcon_default, {}) })
|
|
3085
3251
|
] }),
|
|
3086
|
-
/* @__PURE__ */ (0,
|
|
3087
|
-
pickerMode === "years" && /* @__PURE__ */ (0,
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsxs)("div", { className: "datepicker-body", children: [
|
|
3253
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
3088
3254
|
const y = yearRangeStart + i;
|
|
3089
|
-
return /* @__PURE__ */ (0,
|
|
3255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
3090
3256
|
"button",
|
|
3091
3257
|
{
|
|
3092
3258
|
type: "button",
|
|
@@ -3097,7 +3263,7 @@ var SingleDatePicker = (props) => {
|
|
|
3097
3263
|
y
|
|
3098
3264
|
);
|
|
3099
3265
|
}) }),
|
|
3100
|
-
pickerMode === "months" && /* @__PURE__ */ (0,
|
|
3266
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
3101
3267
|
"button",
|
|
3102
3268
|
{
|
|
3103
3269
|
type: "button",
|
|
@@ -3107,8 +3273,8 @@ var SingleDatePicker = (props) => {
|
|
|
3107
3273
|
},
|
|
3108
3274
|
i
|
|
3109
3275
|
)) }),
|
|
3110
|
-
pickerMode === "days" && /* @__PURE__ */ (0,
|
|
3111
|
-
/* @__PURE__ */ (0,
|
|
3276
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime315.jsxs)(import_jsx_runtime315.Fragment, { children: [
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
3112
3278
|
"div",
|
|
3113
3279
|
{
|
|
3114
3280
|
className: clsx_default(
|
|
@@ -3120,7 +3286,7 @@ var SingleDatePicker = (props) => {
|
|
|
3120
3286
|
},
|
|
3121
3287
|
label
|
|
3122
3288
|
)) }),
|
|
3123
|
-
/* @__PURE__ */ (0,
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime315.jsx)("div", { className: "datepicker-grid", children: days.map((day, idx) => {
|
|
3124
3290
|
const t = day.date.getTime();
|
|
3125
3291
|
const disabled = t < minTime || t > maxTime;
|
|
3126
3292
|
const selected = value ? isSameDay(day.date, value) : false;
|
|
@@ -3130,7 +3296,7 @@ var SingleDatePicker = (props) => {
|
|
|
3130
3296
|
const isStart = hasRange ? isSameDay(day.date, rangeStart) : false;
|
|
3131
3297
|
const isEnd = hasRange ? isSameDay(day.date, rangeEnd) : false;
|
|
3132
3298
|
const inRangeVal = hasRange ? isInRange(day.date, rangeStart, rangeEnd) : false;
|
|
3133
|
-
return /* @__PURE__ */ (0,
|
|
3299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
3134
3300
|
DayCell2,
|
|
3135
3301
|
{
|
|
3136
3302
|
day,
|
|
@@ -3155,7 +3321,7 @@ SingleDatePicker.displayName = "SingleDatePicker";
|
|
|
3155
3321
|
var SingleDatePicker_default = SingleDatePicker;
|
|
3156
3322
|
|
|
3157
3323
|
// src/components/DatePicker/InputDatePicker/index.tsx
|
|
3158
|
-
var
|
|
3324
|
+
var import_jsx_runtime316 = require("react/jsx-runtime");
|
|
3159
3325
|
var formatDate = (date) => {
|
|
3160
3326
|
if (!date || !(date instanceof Date) || isNaN(date.getTime())) return "";
|
|
3161
3327
|
const y = date.getFullYear();
|
|
@@ -3165,8 +3331,8 @@ var formatDate = (date) => {
|
|
|
3165
3331
|
};
|
|
3166
3332
|
var InputDatePicker = (props) => {
|
|
3167
3333
|
const { value, onChange, minDate, maxDate, disabled, locale = "ko", placeholder } = props;
|
|
3168
|
-
const [isOpen, setIsOpen] =
|
|
3169
|
-
const [tempDate, setTempDate] =
|
|
3334
|
+
const [isOpen, setIsOpen] = import_react14.default.useState(false);
|
|
3335
|
+
const [tempDate, setTempDate] = import_react14.default.useState(value ?? /* @__PURE__ */ new Date());
|
|
3170
3336
|
const handleOpen = () => {
|
|
3171
3337
|
if (disabled) return;
|
|
3172
3338
|
setTempDate(value ?? /* @__PURE__ */ new Date());
|
|
@@ -3182,19 +3348,19 @@ var InputDatePicker = (props) => {
|
|
|
3182
3348
|
const handleClose = () => {
|
|
3183
3349
|
setIsOpen(false);
|
|
3184
3350
|
};
|
|
3185
|
-
return /* @__PURE__ */ (0,
|
|
3186
|
-
/* @__PURE__ */ (0,
|
|
3351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: clsx_default("lib-xplat-datepicker input-datepicker", disabled && "disabled"), children: [
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)("div", { className: "input-datepicker-trigger", onClick: handleOpen, children: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
3187
3353
|
Input_default,
|
|
3188
3354
|
{
|
|
3189
3355
|
value: formatDate(value),
|
|
3190
3356
|
placeholder,
|
|
3191
|
-
suffix: /* @__PURE__ */ (0,
|
|
3357
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(CalenderIcon_default, {}),
|
|
3192
3358
|
disabled,
|
|
3193
3359
|
readOnly: true
|
|
3194
3360
|
}
|
|
3195
3361
|
) }),
|
|
3196
|
-
/* @__PURE__ */ (0,
|
|
3197
|
-
/* @__PURE__ */ (0,
|
|
3362
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "lib-xplat-popup-datepicker-card", children: [
|
|
3363
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)("div", { className: "popup-datepicker-content", children: /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
3198
3364
|
SingleDatePicker_default,
|
|
3199
3365
|
{
|
|
3200
3366
|
value: tempDate,
|
|
@@ -3204,9 +3370,9 @@ var InputDatePicker = (props) => {
|
|
|
3204
3370
|
locale
|
|
3205
3371
|
}
|
|
3206
3372
|
) }),
|
|
3207
|
-
/* @__PURE__ */ (0,
|
|
3208
|
-
/* @__PURE__ */ (0,
|
|
3209
|
-
/* @__PURE__ */ (0,
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: "popup-datepicker-footer", children: [
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Button_default, { type: "secondary", onClick: handleClose, children: locale === "ko" ? "\uCDE8\uC18C" : "Cancel" }),
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime316.jsx)(Button_default, { type: "primary", onClick: handleApply, children: locale === "ko" ? "\uC801\uC6A9" : "Apply" })
|
|
3210
3376
|
] })
|
|
3211
3377
|
] }) })
|
|
3212
3378
|
] });
|
|
@@ -3215,20 +3381,20 @@ InputDatePicker.displayName = "InputDatePicker";
|
|
|
3215
3381
|
var InputDatePicker_default = InputDatePicker;
|
|
3216
3382
|
|
|
3217
3383
|
// src/components/DatePicker/PopupPicker/index.tsx
|
|
3218
|
-
var
|
|
3384
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
3219
3385
|
|
|
3220
3386
|
// src/components/DatePicker/RangePicker/index.tsx
|
|
3221
|
-
var
|
|
3387
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
3222
3388
|
|
|
3223
3389
|
// src/components/Tab/Tab.tsx
|
|
3224
|
-
var
|
|
3390
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
3225
3391
|
|
|
3226
3392
|
// src/components/Tab/TabItem.tsx
|
|
3227
|
-
var
|
|
3228
|
-
var
|
|
3229
|
-
var TabItem =
|
|
3393
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
3394
|
+
var import_jsx_runtime317 = require("react/jsx-runtime");
|
|
3395
|
+
var TabItem = import_react15.default.forwardRef((props, ref) => {
|
|
3230
3396
|
const { isActive, title, onClick } = props;
|
|
3231
|
-
return /* @__PURE__ */ (0,
|
|
3397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
3232
3398
|
"div",
|
|
3233
3399
|
{
|
|
3234
3400
|
ref,
|
|
@@ -3242,25 +3408,25 @@ TabItem.displayName = "TabItem";
|
|
|
3242
3408
|
var TabItem_default = TabItem;
|
|
3243
3409
|
|
|
3244
3410
|
// src/components/Tab/Tab.tsx
|
|
3245
|
-
var
|
|
3411
|
+
var import_jsx_runtime318 = require("react/jsx-runtime");
|
|
3246
3412
|
var Tab = (props) => {
|
|
3247
3413
|
const { activeIndex, onChange, tabs, type, size = "md" } = props;
|
|
3248
|
-
const [underlineStyle, setUnderlineStyle] =
|
|
3414
|
+
const [underlineStyle, setUnderlineStyle] = import_react16.default.useState({
|
|
3249
3415
|
left: 0,
|
|
3250
3416
|
width: 0
|
|
3251
3417
|
});
|
|
3252
|
-
const itemRefs =
|
|
3418
|
+
const itemRefs = import_react16.default.useRef([]);
|
|
3253
3419
|
const handleChangeActiveTab = (tabItem, tabIdx) => {
|
|
3254
3420
|
onChange(tabItem, tabIdx);
|
|
3255
3421
|
};
|
|
3256
|
-
|
|
3422
|
+
import_react16.default.useEffect(() => {
|
|
3257
3423
|
const el = itemRefs.current[activeIndex];
|
|
3258
3424
|
if (el) {
|
|
3259
3425
|
setUnderlineStyle({ left: el.offsetLeft, width: el.offsetWidth });
|
|
3260
3426
|
}
|
|
3261
3427
|
}, [activeIndex, tabs.length]);
|
|
3262
|
-
return /* @__PURE__ */ (0,
|
|
3263
|
-
tabs.map((tab, idx) => /* @__PURE__ */ (0,
|
|
3428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)("div", { className: clsx_default("lib-xplat-tab", `type-${type}`, size), children: [
|
|
3429
|
+
tabs.map((tab, idx) => /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
|
|
3264
3430
|
TabItem_default,
|
|
3265
3431
|
{
|
|
3266
3432
|
onClick: () => handleChangeActiveTab(tab, idx),
|
|
@@ -3272,7 +3438,7 @@ var Tab = (props) => {
|
|
|
3272
3438
|
},
|
|
3273
3439
|
`${tab.value}_${idx}`
|
|
3274
3440
|
)),
|
|
3275
|
-
type === "toggle" && /* @__PURE__ */ (0,
|
|
3441
|
+
type === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
|
|
3276
3442
|
"div",
|
|
3277
3443
|
{
|
|
3278
3444
|
className: "tab-toggle-underline",
|
|
@@ -3288,7 +3454,7 @@ Tab.displayName = "Tab";
|
|
|
3288
3454
|
var Tab_default = Tab;
|
|
3289
3455
|
|
|
3290
3456
|
// src/components/DatePicker/RangePicker/index.tsx
|
|
3291
|
-
var
|
|
3457
|
+
var import_jsx_runtime319 = require("react/jsx-runtime");
|
|
3292
3458
|
var RangePicker = (props) => {
|
|
3293
3459
|
const {
|
|
3294
3460
|
startDate,
|
|
@@ -3298,7 +3464,7 @@ var RangePicker = (props) => {
|
|
|
3298
3464
|
maxDate,
|
|
3299
3465
|
locale = "ko"
|
|
3300
3466
|
} = props;
|
|
3301
|
-
const [activeTab, setActiveTab] =
|
|
3467
|
+
const [activeTab, setActiveTab] = import_react17.default.useState("start");
|
|
3302
3468
|
const handleStartChange = (date) => {
|
|
3303
3469
|
if (!date) return;
|
|
3304
3470
|
const newStart = date > endDate ? endDate : date;
|
|
@@ -3311,8 +3477,8 @@ var RangePicker = (props) => {
|
|
|
3311
3477
|
};
|
|
3312
3478
|
const startMaxDate = maxDate && endDate < maxDate ? endDate : endDate;
|
|
3313
3479
|
const endMinDate = minDate && startDate > minDate ? startDate : startDate;
|
|
3314
|
-
return /* @__PURE__ */ (0,
|
|
3315
|
-
/* @__PURE__ */ (0,
|
|
3480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime319.jsxs)("div", { className: clsx_default("lib-xplat-datepicker", "range"), children: [
|
|
3481
|
+
/* @__PURE__ */ (0, import_jsx_runtime319.jsx)("div", { className: "datepicker-range-tabs", children: /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
3316
3482
|
Tab_default,
|
|
3317
3483
|
{
|
|
3318
3484
|
activeIndex: activeTab === "start" ? 0 : 1,
|
|
@@ -3325,8 +3491,8 @@ var RangePicker = (props) => {
|
|
|
3325
3491
|
size: "sm"
|
|
3326
3492
|
}
|
|
3327
3493
|
) }),
|
|
3328
|
-
/* @__PURE__ */ (0,
|
|
3329
|
-
/* @__PURE__ */ (0,
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime319.jsxs)("div", { className: "datepicker-range-panels", children: [
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
3330
3496
|
SingleDatePicker_default,
|
|
3331
3497
|
{
|
|
3332
3498
|
value: startDate,
|
|
@@ -3338,7 +3504,7 @@ var RangePicker = (props) => {
|
|
|
3338
3504
|
locale
|
|
3339
3505
|
}
|
|
3340
3506
|
),
|
|
3341
|
-
/* @__PURE__ */ (0,
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
3342
3508
|
SingleDatePicker_default,
|
|
3343
3509
|
{
|
|
3344
3510
|
value: endDate,
|
|
@@ -3351,7 +3517,7 @@ var RangePicker = (props) => {
|
|
|
3351
3517
|
}
|
|
3352
3518
|
)
|
|
3353
3519
|
] }),
|
|
3354
|
-
/* @__PURE__ */ (0,
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime319.jsx)("div", { className: "datepicker-range-mobile", children: activeTab === "start" ? /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
3355
3521
|
SingleDatePicker_default,
|
|
3356
3522
|
{
|
|
3357
3523
|
value: startDate,
|
|
@@ -3362,7 +3528,7 @@ var RangePicker = (props) => {
|
|
|
3362
3528
|
rangeEnd: endDate,
|
|
3363
3529
|
locale
|
|
3364
3530
|
}
|
|
3365
|
-
) : /* @__PURE__ */ (0,
|
|
3531
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
3366
3532
|
SingleDatePicker_default,
|
|
3367
3533
|
{
|
|
3368
3534
|
value: endDate,
|
|
@@ -3380,10 +3546,10 @@ RangePicker.displayName = "RangePicker";
|
|
|
3380
3546
|
var RangePicker_default = RangePicker;
|
|
3381
3547
|
|
|
3382
3548
|
// src/components/DatePicker/PopupPicker/index.tsx
|
|
3383
|
-
var
|
|
3549
|
+
var import_jsx_runtime320 = require("react/jsx-runtime");
|
|
3384
3550
|
var PopupPicker = (props) => {
|
|
3385
3551
|
const { component, type, locale } = props;
|
|
3386
|
-
const [isOpen, setIsOpen] =
|
|
3552
|
+
const [isOpen, setIsOpen] = import_react18.default.useState(false);
|
|
3387
3553
|
const handleClick = () => setIsOpen(true);
|
|
3388
3554
|
const handleClose = () => setIsOpen(false);
|
|
3389
3555
|
const handleSingleChange = (date) => {
|
|
@@ -3391,11 +3557,11 @@ var PopupPicker = (props) => {
|
|
|
3391
3557
|
props.onChange?.(date);
|
|
3392
3558
|
handleClose();
|
|
3393
3559
|
};
|
|
3394
|
-
return /* @__PURE__ */ (0,
|
|
3395
|
-
|
|
3396
|
-
/* @__PURE__ */ (0,
|
|
3397
|
-
/* @__PURE__ */ (0,
|
|
3398
|
-
type === "single" && /* @__PURE__ */ (0,
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
3561
|
+
import_react18.default.cloneElement(component, { onClick: handleClick }),
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)("div", { className: clsx_default("lib-xplat-popup-datepicker-card", type === "range" && "range-mode"), children: [
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsxs)("div", { className: "popup-datepicker-content", children: [
|
|
3564
|
+
type === "single" && /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
|
|
3399
3565
|
SingleDatePicker_default,
|
|
3400
3566
|
{
|
|
3401
3567
|
value: props.value,
|
|
@@ -3405,7 +3571,7 @@ var PopupPicker = (props) => {
|
|
|
3405
3571
|
locale
|
|
3406
3572
|
}
|
|
3407
3573
|
),
|
|
3408
|
-
type === "range" && /* @__PURE__ */ (0,
|
|
3574
|
+
type === "range" && /* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
|
|
3409
3575
|
RangePicker_default,
|
|
3410
3576
|
{
|
|
3411
3577
|
startDate: props.startDate,
|
|
@@ -3417,8 +3583,8 @@ var PopupPicker = (props) => {
|
|
|
3417
3583
|
}
|
|
3418
3584
|
)
|
|
3419
3585
|
] }),
|
|
3420
|
-
/* @__PURE__ */ (0,
|
|
3421
|
-
/* @__PURE__ */ (0,
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsxs)("div", { className: "popup-datepicker-footer", children: [
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
|
|
3422
3588
|
Button_default,
|
|
3423
3589
|
{
|
|
3424
3590
|
type: "secondary",
|
|
@@ -3426,7 +3592,7 @@ var PopupPicker = (props) => {
|
|
|
3426
3592
|
children: locale === "ko" ? "\uCDE8\uC18C" : "Cancel"
|
|
3427
3593
|
}
|
|
3428
3594
|
),
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
3595
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)(Button_default, { type: "primary", onClick: handleClose, children: locale === "ko" ? "\uC801\uC6A9" : "Apply" })
|
|
3430
3596
|
] })
|
|
3431
3597
|
] }) })
|
|
3432
3598
|
] });
|
|
@@ -3435,10 +3601,10 @@ PopupPicker.displayName = "PopupPicker";
|
|
|
3435
3601
|
var PopupPicker_default = PopupPicker;
|
|
3436
3602
|
|
|
3437
3603
|
// src/components/Divider/Divider.tsx
|
|
3438
|
-
var
|
|
3604
|
+
var import_jsx_runtime321 = require("react/jsx-runtime");
|
|
3439
3605
|
var Divider = (props) => {
|
|
3440
3606
|
const { orientation = "horizontal" } = props;
|
|
3441
|
-
return /* @__PURE__ */ (0,
|
|
3607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3442
3608
|
"div",
|
|
3443
3609
|
{
|
|
3444
3610
|
className: clsx_default("lib-xplat-divider", orientation),
|
|
@@ -3451,15 +3617,15 @@ Divider.displayName = "Divider";
|
|
|
3451
3617
|
var Divider_default = Divider;
|
|
3452
3618
|
|
|
3453
3619
|
// src/components/Drawer/Drawer.tsx
|
|
3454
|
-
var
|
|
3620
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
3455
3621
|
var import_react_dom3 = require("react-dom");
|
|
3456
|
-
var
|
|
3622
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
3457
3623
|
var ANIMATION_DURATION_MS2 = 250;
|
|
3458
3624
|
var Drawer = (props) => {
|
|
3459
3625
|
const { isOpen, onClose, placement = "right", size = "md", title, children } = props;
|
|
3460
|
-
const [mounted, setMounted] =
|
|
3461
|
-
const [visible, setVisible] =
|
|
3462
|
-
|
|
3626
|
+
const [mounted, setMounted] = import_react19.default.useState(false);
|
|
3627
|
+
const [visible, setVisible] = import_react19.default.useState(false);
|
|
3628
|
+
import_react19.default.useEffect(() => {
|
|
3463
3629
|
if (isOpen) {
|
|
3464
3630
|
setMounted(true);
|
|
3465
3631
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -3473,12 +3639,12 @@ var Drawer = (props) => {
|
|
|
3473
3639
|
if (!mounted) return null;
|
|
3474
3640
|
const stateClass = visible ? "enter" : "exit";
|
|
3475
3641
|
return (0, import_react_dom3.createPortal)(
|
|
3476
|
-
/* @__PURE__ */ (0,
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime322.jsx)(
|
|
3477
3643
|
"div",
|
|
3478
3644
|
{
|
|
3479
3645
|
className: clsx_default("lib-xplat-drawer-overlay", stateClass),
|
|
3480
3646
|
onClick: onClose,
|
|
3481
|
-
children: /* @__PURE__ */ (0,
|
|
3647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)(
|
|
3482
3648
|
"div",
|
|
3483
3649
|
{
|
|
3484
3650
|
className: clsx_default("lib-xplat-drawer", placement, size, stateClass),
|
|
@@ -3486,11 +3652,11 @@ var Drawer = (props) => {
|
|
|
3486
3652
|
"aria-modal": "true",
|
|
3487
3653
|
onClick: (e) => e.stopPropagation(),
|
|
3488
3654
|
children: [
|
|
3489
|
-
title && /* @__PURE__ */ (0,
|
|
3490
|
-
/* @__PURE__ */ (0,
|
|
3491
|
-
/* @__PURE__ */ (0,
|
|
3655
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)("div", { className: "drawer-header", children: [
|
|
3656
|
+
/* @__PURE__ */ (0, import_jsx_runtime322.jsx)("span", { className: "drawer-title", children: title }),
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime322.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
3492
3658
|
] }),
|
|
3493
|
-
/* @__PURE__ */ (0,
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: "drawer-body", children })
|
|
3494
3660
|
]
|
|
3495
3661
|
}
|
|
3496
3662
|
)
|
|
@@ -3503,22 +3669,23 @@ Drawer.displayName = "Drawer";
|
|
|
3503
3669
|
var Drawer_default = Drawer;
|
|
3504
3670
|
|
|
3505
3671
|
// src/components/Dropdown/Dropdown.tsx
|
|
3506
|
-
var
|
|
3672
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3507
3673
|
|
|
3508
3674
|
// src/tokens/hooks/useAutoPosition.ts
|
|
3509
|
-
var
|
|
3675
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
3510
3676
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
3511
|
-
const [position, setPosition] =
|
|
3677
|
+
const [position, setPosition] = import_react20.default.useState({
|
|
3512
3678
|
position: {},
|
|
3513
3679
|
direction: "bottom"
|
|
3514
3680
|
});
|
|
3515
|
-
const calculatePosition =
|
|
3681
|
+
const calculatePosition = import_react20.default.useCallback(() => {
|
|
3516
3682
|
if (!triggerRef.current || !popRef.current) return;
|
|
3517
3683
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
3518
3684
|
const popW = popRef.current.offsetWidth;
|
|
3519
3685
|
const popH = popRef.current.offsetHeight;
|
|
3520
3686
|
const viewportHeight = window.innerHeight;
|
|
3521
3687
|
const viewportWidth = window.innerWidth;
|
|
3688
|
+
if (popH === 0 || popW === 0) return;
|
|
3522
3689
|
let direction = "bottom";
|
|
3523
3690
|
let top;
|
|
3524
3691
|
let left;
|
|
@@ -3538,13 +3705,21 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3538
3705
|
direction
|
|
3539
3706
|
});
|
|
3540
3707
|
}, [triggerRef, popRef]);
|
|
3541
|
-
|
|
3708
|
+
import_react20.default.useLayoutEffect(() => {
|
|
3542
3709
|
if (!enabled) return;
|
|
3543
3710
|
calculatePosition();
|
|
3544
3711
|
const raf = requestAnimationFrame(calculatePosition);
|
|
3545
3712
|
return () => cancelAnimationFrame(raf);
|
|
3546
3713
|
}, [calculatePosition, enabled]);
|
|
3547
|
-
|
|
3714
|
+
import_react20.default.useEffect(() => {
|
|
3715
|
+
if (!enabled || !popRef.current) return;
|
|
3716
|
+
const observer = new ResizeObserver(() => {
|
|
3717
|
+
calculatePosition();
|
|
3718
|
+
});
|
|
3719
|
+
observer.observe(popRef.current);
|
|
3720
|
+
return () => observer.disconnect();
|
|
3721
|
+
}, [calculatePosition, enabled, popRef]);
|
|
3722
|
+
import_react20.default.useEffect(() => {
|
|
3548
3723
|
if (!enabled) return;
|
|
3549
3724
|
window.addEventListener("resize", calculatePosition);
|
|
3550
3725
|
window.addEventListener("scroll", calculatePosition, true);
|
|
@@ -3558,9 +3733,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3558
3733
|
var useAutoPosition_default = useAutoPosition;
|
|
3559
3734
|
|
|
3560
3735
|
// src/tokens/hooks/useClickOutside.ts
|
|
3561
|
-
var
|
|
3736
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
3562
3737
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
3563
|
-
|
|
3738
|
+
import_react21.default.useEffect(() => {
|
|
3564
3739
|
if (!enabled) return;
|
|
3565
3740
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
3566
3741
|
const listener = (event) => {
|
|
@@ -3583,17 +3758,17 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
3583
3758
|
var useClickOutside_default = useClickOutside;
|
|
3584
3759
|
|
|
3585
3760
|
// src/components/Dropdown/Dropdown.tsx
|
|
3586
|
-
var
|
|
3761
|
+
var import_jsx_runtime323 = require("react/jsx-runtime");
|
|
3587
3762
|
var Dropdown = (props) => {
|
|
3588
3763
|
const { items, children } = props;
|
|
3589
|
-
const [isOpen, setIsOpen] =
|
|
3590
|
-
const [mounted, setMounted] =
|
|
3591
|
-
const [visible, setVisible] =
|
|
3592
|
-
const triggerRef =
|
|
3593
|
-
const menuRef =
|
|
3764
|
+
const [isOpen, setIsOpen] = import_react22.default.useState(false);
|
|
3765
|
+
const [mounted, setMounted] = import_react22.default.useState(false);
|
|
3766
|
+
const [visible, setVisible] = import_react22.default.useState(false);
|
|
3767
|
+
const triggerRef = import_react22.default.useRef(null);
|
|
3768
|
+
const menuRef = import_react22.default.useRef(null);
|
|
3594
3769
|
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
3595
3770
|
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
3596
|
-
|
|
3771
|
+
import_react22.default.useEffect(() => {
|
|
3597
3772
|
if (isOpen) {
|
|
3598
3773
|
setMounted(true);
|
|
3599
3774
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -3608,8 +3783,8 @@ var Dropdown = (props) => {
|
|
|
3608
3783
|
item.onClick?.();
|
|
3609
3784
|
setIsOpen(false);
|
|
3610
3785
|
};
|
|
3611
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
-
/* @__PURE__ */ (0,
|
|
3786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)("div", { className: "lib-xplat-dropdown", children: [
|
|
3787
|
+
/* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
|
|
3613
3788
|
"div",
|
|
3614
3789
|
{
|
|
3615
3790
|
ref: triggerRef,
|
|
@@ -3618,14 +3793,14 @@ var Dropdown = (props) => {
|
|
|
3618
3793
|
children
|
|
3619
3794
|
}
|
|
3620
3795
|
),
|
|
3621
|
-
mounted && /* @__PURE__ */ (0,
|
|
3796
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
|
|
3622
3797
|
"div",
|
|
3623
3798
|
{
|
|
3624
3799
|
ref: menuRef,
|
|
3625
3800
|
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
3626
3801
|
style: { top: position.top, left: position.left },
|
|
3627
3802
|
role: "menu",
|
|
3628
|
-
children: items.map((item) => /* @__PURE__ */ (0,
|
|
3803
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
|
|
3629
3804
|
"button",
|
|
3630
3805
|
{
|
|
3631
3806
|
className: clsx_default("dropdown-item", {
|
|
@@ -3647,23 +3822,23 @@ Dropdown.displayName = "Dropdown";
|
|
|
3647
3822
|
var Dropdown_default = Dropdown;
|
|
3648
3823
|
|
|
3649
3824
|
// src/components/EmptyState/EmptyState.tsx
|
|
3650
|
-
var
|
|
3825
|
+
var import_jsx_runtime324 = require("react/jsx-runtime");
|
|
3651
3826
|
var EmptyState = (props) => {
|
|
3652
3827
|
const { icon, title = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4", description, action } = props;
|
|
3653
|
-
return /* @__PURE__ */ (0,
|
|
3654
|
-
icon && /* @__PURE__ */ (0,
|
|
3655
|
-
!icon && /* @__PURE__ */ (0,
|
|
3656
|
-
/* @__PURE__ */ (0,
|
|
3657
|
-
description && /* @__PURE__ */ (0,
|
|
3658
|
-
action && /* @__PURE__ */ (0,
|
|
3828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsxs)("div", { className: "lib-xplat-empty-state", children: [
|
|
3829
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "empty-icon", children: icon }),
|
|
3830
|
+
!icon && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("path", { d: "M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z" }) }) }),
|
|
3831
|
+
/* @__PURE__ */ (0, import_jsx_runtime324.jsx)("p", { className: "empty-title", children: title }),
|
|
3832
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("p", { className: "empty-description", children: description }),
|
|
3833
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "empty-action", children: action })
|
|
3659
3834
|
] });
|
|
3660
3835
|
};
|
|
3661
3836
|
EmptyState.displayName = "EmptyState";
|
|
3662
3837
|
var EmptyState_default = EmptyState;
|
|
3663
3838
|
|
|
3664
3839
|
// src/components/FileUpload/FileUpload.tsx
|
|
3665
|
-
var
|
|
3666
|
-
var
|
|
3840
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
3841
|
+
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
3667
3842
|
var FileUpload = (props) => {
|
|
3668
3843
|
const {
|
|
3669
3844
|
accept,
|
|
@@ -3673,8 +3848,8 @@ var FileUpload = (props) => {
|
|
|
3673
3848
|
label = "\uD30C\uC77C\uC744 \uB4DC\uB798\uADF8\uD558\uAC70\uB098 \uD074\uB9AD\uD558\uC5EC \uC5C5\uB85C\uB4DC",
|
|
3674
3849
|
description
|
|
3675
3850
|
} = props;
|
|
3676
|
-
const [isDragOver, setIsDragOver] =
|
|
3677
|
-
const inputRef =
|
|
3851
|
+
const [isDragOver, setIsDragOver] = import_react23.default.useState(false);
|
|
3852
|
+
const inputRef = import_react23.default.useRef(null);
|
|
3678
3853
|
const handleFiles = (fileList) => {
|
|
3679
3854
|
let files = Array.from(fileList);
|
|
3680
3855
|
if (maxSize) {
|
|
@@ -3704,7 +3879,7 @@ var FileUpload = (props) => {
|
|
|
3704
3879
|
handleFiles(e.target.files);
|
|
3705
3880
|
}
|
|
3706
3881
|
};
|
|
3707
|
-
return /* @__PURE__ */ (0,
|
|
3882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime325.jsxs)(
|
|
3708
3883
|
"div",
|
|
3709
3884
|
{
|
|
3710
3885
|
className: clsx_default("lib-xplat-file-upload", { "drag-over": isDragOver }),
|
|
@@ -3713,7 +3888,7 @@ var FileUpload = (props) => {
|
|
|
3713
3888
|
onDragLeave: handleDragLeave,
|
|
3714
3889
|
onClick: () => inputRef.current?.click(),
|
|
3715
3890
|
children: [
|
|
3716
|
-
/* @__PURE__ */ (0,
|
|
3891
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)(
|
|
3717
3892
|
"input",
|
|
3718
3893
|
{
|
|
3719
3894
|
ref: inputRef,
|
|
@@ -3723,9 +3898,9 @@ var FileUpload = (props) => {
|
|
|
3723
3898
|
onChange: handleChange
|
|
3724
3899
|
}
|
|
3725
3900
|
),
|
|
3726
|
-
/* @__PURE__ */ (0,
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
3728
|
-
description && /* @__PURE__ */ (0,
|
|
3901
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "upload-icon", children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)(UploadIcon_default, {}) }),
|
|
3902
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("p", { className: "upload-label", children: label }),
|
|
3903
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("p", { className: "upload-description", children: description })
|
|
3729
3904
|
]
|
|
3730
3905
|
}
|
|
3731
3906
|
);
|
|
@@ -3734,10 +3909,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
3734
3909
|
var FileUpload_default = FileUpload;
|
|
3735
3910
|
|
|
3736
3911
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
3737
|
-
var
|
|
3912
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
3738
3913
|
|
|
3739
3914
|
// src/components/HtmlTypeWriter/utils.ts
|
|
3740
|
-
var
|
|
3915
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
3741
3916
|
var voidTags = /* @__PURE__ */ new Set([
|
|
3742
3917
|
"br",
|
|
3743
3918
|
"img",
|
|
@@ -3805,41 +3980,41 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
3805
3980
|
props[attr.name] = attr.value;
|
|
3806
3981
|
});
|
|
3807
3982
|
if (voidTags.has(tag)) {
|
|
3808
|
-
return
|
|
3983
|
+
return import_react24.default.createElement(tag, props);
|
|
3809
3984
|
}
|
|
3810
3985
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
3811
|
-
return
|
|
3986
|
+
return import_react24.default.createElement(tag, props, ...children);
|
|
3812
3987
|
};
|
|
3813
3988
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
3814
3989
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
3815
3990
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
3816
|
-
return node == null ? null :
|
|
3991
|
+
return node == null ? null : import_react24.default.createElement(import_react24.default.Fragment, { key: idx }, node);
|
|
3817
3992
|
}).filter(Boolean);
|
|
3818
3993
|
return nodes.length === 0 ? null : nodes;
|
|
3819
3994
|
};
|
|
3820
3995
|
|
|
3821
3996
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
3822
|
-
var
|
|
3997
|
+
var import_jsx_runtime326 = require("react/jsx-runtime");
|
|
3823
3998
|
var HtmlTypeWriter = ({
|
|
3824
3999
|
html,
|
|
3825
4000
|
duration = 20,
|
|
3826
4001
|
onDone,
|
|
3827
4002
|
onChange
|
|
3828
4003
|
}) => {
|
|
3829
|
-
const [typedLen, setTypedLen] =
|
|
3830
|
-
const doneCalledRef =
|
|
3831
|
-
const { doc, rangeMap, totalLength } =
|
|
4004
|
+
const [typedLen, setTypedLen] = import_react25.default.useState(0);
|
|
4005
|
+
const doneCalledRef = import_react25.default.useRef(false);
|
|
4006
|
+
const { doc, rangeMap, totalLength } = import_react25.default.useMemo(() => {
|
|
3832
4007
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
3833
4008
|
const decoded = decodeHtmlEntities(html);
|
|
3834
4009
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
3835
4010
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
3836
4011
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
3837
4012
|
}, [html]);
|
|
3838
|
-
|
|
4013
|
+
import_react25.default.useEffect(() => {
|
|
3839
4014
|
setTypedLen(0);
|
|
3840
4015
|
doneCalledRef.current = false;
|
|
3841
4016
|
}, [html]);
|
|
3842
|
-
|
|
4017
|
+
import_react25.default.useEffect(() => {
|
|
3843
4018
|
if (!totalLength) return;
|
|
3844
4019
|
if (typedLen >= totalLength) return;
|
|
3845
4020
|
const timer = window.setInterval(() => {
|
|
@@ -3847,33 +4022,33 @@ var HtmlTypeWriter = ({
|
|
|
3847
4022
|
}, duration);
|
|
3848
4023
|
return () => window.clearInterval(timer);
|
|
3849
4024
|
}, [typedLen, totalLength, duration]);
|
|
3850
|
-
|
|
4025
|
+
import_react25.default.useEffect(() => {
|
|
3851
4026
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
3852
4027
|
onChange?.();
|
|
3853
4028
|
}
|
|
3854
4029
|
}, [typedLen, totalLength, onChange]);
|
|
3855
|
-
|
|
4030
|
+
import_react25.default.useEffect(() => {
|
|
3856
4031
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
3857
4032
|
doneCalledRef.current = true;
|
|
3858
4033
|
onDone?.();
|
|
3859
4034
|
}
|
|
3860
4035
|
}, [typedLen, totalLength, onDone]);
|
|
3861
|
-
const parsed =
|
|
4036
|
+
const parsed = import_react25.default.useMemo(
|
|
3862
4037
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
3863
4038
|
[doc, typedLen, rangeMap]
|
|
3864
4039
|
);
|
|
3865
|
-
return /* @__PURE__ */ (0,
|
|
4040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime326.jsx)("div", { className: "lib-xplat-htmlTypewriter", children: parsed });
|
|
3866
4041
|
};
|
|
3867
4042
|
HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
3868
4043
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
3869
4044
|
|
|
3870
4045
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
3871
|
-
var
|
|
3872
|
-
var
|
|
4046
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
4047
|
+
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
3873
4048
|
var ImageSelector = (props) => {
|
|
3874
4049
|
const { value, label, onChange } = props;
|
|
3875
|
-
const [previewUrl, setPreviewUrl] =
|
|
3876
|
-
|
|
4050
|
+
const [previewUrl, setPreviewUrl] = import_react26.default.useState();
|
|
4051
|
+
import_react26.default.useEffect(() => {
|
|
3877
4052
|
if (!value) {
|
|
3878
4053
|
setPreviewUrl(void 0);
|
|
3879
4054
|
return;
|
|
@@ -3882,7 +4057,7 @@ var ImageSelector = (props) => {
|
|
|
3882
4057
|
setPreviewUrl(url);
|
|
3883
4058
|
return () => URL.revokeObjectURL(url);
|
|
3884
4059
|
}, [value]);
|
|
3885
|
-
const inputRef =
|
|
4060
|
+
const inputRef = import_react26.default.useRef(null);
|
|
3886
4061
|
const handleFileChange = (e) => {
|
|
3887
4062
|
const selectedFile = e.target.files?.[0];
|
|
3888
4063
|
if (selectedFile) {
|
|
@@ -3895,8 +4070,8 @@ var ImageSelector = (props) => {
|
|
|
3895
4070
|
const handleOpenFileDialog = () => {
|
|
3896
4071
|
inputRef.current?.click();
|
|
3897
4072
|
};
|
|
3898
|
-
return /* @__PURE__ */ (0,
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
4073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)("div", { className: `lib-xplat-imageselector${value ? "" : " none-value"}`, children: [
|
|
4074
|
+
/* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
|
|
3900
4075
|
"input",
|
|
3901
4076
|
{
|
|
3902
4077
|
type: "file",
|
|
@@ -3906,13 +4081,13 @@ var ImageSelector = (props) => {
|
|
|
3906
4081
|
ref: inputRef
|
|
3907
4082
|
}
|
|
3908
4083
|
),
|
|
3909
|
-
value && /* @__PURE__ */ (0,
|
|
3910
|
-
/* @__PURE__ */ (0,
|
|
3911
|
-
/* @__PURE__ */ (0,
|
|
4084
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)("div", { className: "action-bar", children: [
|
|
4085
|
+
/* @__PURE__ */ (0, import_jsx_runtime327.jsx)("div", { className: "icon-wrapper", onClick: handleOpenFileDialog, children: /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(UploadIcon_default, {}) }),
|
|
4086
|
+
/* @__PURE__ */ (0, import_jsx_runtime327.jsx)("div", { className: "icon-wrapper", onClick: handleDeleteFile, children: /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(DeleteIcon_default, {}) })
|
|
3912
4087
|
] }),
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
3914
|
-
/* @__PURE__ */ (0,
|
|
3915
|
-
/* @__PURE__ */ (0,
|
|
4088
|
+
/* @__PURE__ */ (0, import_jsx_runtime327.jsx)("div", { className: "content", children: previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime327.jsx)("img", { src: previewUrl, alt: "preview" }) : /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)("div", { className: "skeleton", onClick: handleOpenFileDialog, children: [
|
|
4089
|
+
/* @__PURE__ */ (0, import_jsx_runtime327.jsx)("div", { className: "icon-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(ImageIcon_default, {}) }),
|
|
4090
|
+
/* @__PURE__ */ (0, import_jsx_runtime327.jsx)("div", { className: "label", children: label || "\uC774\uBBF8\uC9C0 \uCD94\uAC00\uD558\uAE30" })
|
|
3916
4091
|
] }) })
|
|
3917
4092
|
] });
|
|
3918
4093
|
};
|
|
@@ -3920,7 +4095,7 @@ ImageSelector.displayName = "ImageSelector";
|
|
|
3920
4095
|
var ImageSelector_default = ImageSelector;
|
|
3921
4096
|
|
|
3922
4097
|
// src/components/Pagination/Pagination.tsx
|
|
3923
|
-
var
|
|
4098
|
+
var import_jsx_runtime328 = require("react/jsx-runtime");
|
|
3924
4099
|
var getPageRange = (current, totalPages, siblingCount) => {
|
|
3925
4100
|
const totalNumbers = siblingCount * 2 + 5;
|
|
3926
4101
|
if (totalPages <= totalNumbers) {
|
|
@@ -3963,19 +4138,19 @@ var Pagination = (props) => {
|
|
|
3963
4138
|
onChange?.(page);
|
|
3964
4139
|
}
|
|
3965
4140
|
};
|
|
3966
|
-
return /* @__PURE__ */ (0,
|
|
3967
|
-
/* @__PURE__ */ (0,
|
|
4141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("nav", { className: clsx_default("lib-xplat-pagination", size, type), "aria-label": "\uD398\uC774\uC9C0 \uB124\uBE44\uAC8C\uC774\uC158", children: [
|
|
4142
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
3968
4143
|
"button",
|
|
3969
4144
|
{
|
|
3970
4145
|
className: "page-btn prev",
|
|
3971
4146
|
disabled: current <= 1,
|
|
3972
4147
|
onClick: () => handleClick(current - 1),
|
|
3973
4148
|
"aria-label": "\uC774\uC804 \uD398\uC774\uC9C0",
|
|
3974
|
-
children: /* @__PURE__ */ (0,
|
|
4149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(ChevronLeftIcon_default, {})
|
|
3975
4150
|
}
|
|
3976
4151
|
),
|
|
3977
4152
|
pages.map(
|
|
3978
|
-
(page, i) => page === "..." ? /* @__PURE__ */ (0,
|
|
4153
|
+
(page, i) => page === "..." ? /* @__PURE__ */ (0, import_jsx_runtime328.jsx)("span", { className: "dots", children: "..." }, `dots-${i}`) : /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
3979
4154
|
"button",
|
|
3980
4155
|
{
|
|
3981
4156
|
className: clsx_default("page-btn", { active: page === current }),
|
|
@@ -3986,14 +4161,14 @@ var Pagination = (props) => {
|
|
|
3986
4161
|
page
|
|
3987
4162
|
)
|
|
3988
4163
|
),
|
|
3989
|
-
/* @__PURE__ */ (0,
|
|
4164
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
3990
4165
|
"button",
|
|
3991
4166
|
{
|
|
3992
4167
|
className: "page-btn next",
|
|
3993
4168
|
disabled: current >= totalPages,
|
|
3994
4169
|
onClick: () => handleClick(current + 1),
|
|
3995
4170
|
"aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
3996
|
-
children: /* @__PURE__ */ (0,
|
|
4171
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(ChevronRightIcon_default, {})
|
|
3997
4172
|
}
|
|
3998
4173
|
)
|
|
3999
4174
|
] });
|
|
@@ -4002,17 +4177,17 @@ Pagination.displayName = "Pagination";
|
|
|
4002
4177
|
var Pagination_default = Pagination;
|
|
4003
4178
|
|
|
4004
4179
|
// src/components/PopOver/PopOver.tsx
|
|
4005
|
-
var
|
|
4006
|
-
var
|
|
4180
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
4181
|
+
var import_jsx_runtime329 = require("react/jsx-runtime");
|
|
4007
4182
|
var PopOver = (props) => {
|
|
4008
4183
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
4009
|
-
const popRef =
|
|
4010
|
-
const triggerRef =
|
|
4011
|
-
const [localOpen, setLocalOpen] =
|
|
4012
|
-
const [eventTrigger, setEventTrigger] =
|
|
4184
|
+
const popRef = import_react27.default.useRef(null);
|
|
4185
|
+
const triggerRef = import_react27.default.useRef(null);
|
|
4186
|
+
const [localOpen, setLocalOpen] = import_react27.default.useState(false);
|
|
4187
|
+
const [eventTrigger, setEventTrigger] = import_react27.default.useState(false);
|
|
4013
4188
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
4014
4189
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
4015
|
-
|
|
4190
|
+
import_react27.default.useEffect(() => {
|
|
4016
4191
|
if (isOpen) {
|
|
4017
4192
|
setLocalOpen(isOpen);
|
|
4018
4193
|
setTimeout(() => {
|
|
@@ -4025,7 +4200,7 @@ var PopOver = (props) => {
|
|
|
4025
4200
|
}, 200);
|
|
4026
4201
|
}
|
|
4027
4202
|
}, [isOpen]);
|
|
4028
|
-
return /* @__PURE__ */ (0,
|
|
4203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(
|
|
4029
4204
|
"div",
|
|
4030
4205
|
{
|
|
4031
4206
|
className: "lib-xplat-pop-over",
|
|
@@ -4035,7 +4210,7 @@ var PopOver = (props) => {
|
|
|
4035
4210
|
},
|
|
4036
4211
|
children: [
|
|
4037
4212
|
children,
|
|
4038
|
-
localOpen && /* @__PURE__ */ (0,
|
|
4213
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
|
|
4039
4214
|
"div",
|
|
4040
4215
|
{
|
|
4041
4216
|
className: clsx_default(
|
|
@@ -4058,7 +4233,7 @@ PopOver.displayName = "PopOver";
|
|
|
4058
4233
|
var PopOver_default = PopOver;
|
|
4059
4234
|
|
|
4060
4235
|
// src/components/Progress/Progress.tsx
|
|
4061
|
-
var
|
|
4236
|
+
var import_jsx_runtime330 = require("react/jsx-runtime");
|
|
4062
4237
|
var Progress = (props) => {
|
|
4063
4238
|
const {
|
|
4064
4239
|
value,
|
|
@@ -4068,8 +4243,8 @@ var Progress = (props) => {
|
|
|
4068
4243
|
showLabel = false
|
|
4069
4244
|
} = props;
|
|
4070
4245
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
4071
|
-
return /* @__PURE__ */ (0,
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime330.jsxs)("div", { className: clsx_default("lib-xplat-progress", size, type), children: [
|
|
4247
|
+
/* @__PURE__ */ (0, import_jsx_runtime330.jsx)(
|
|
4073
4248
|
"div",
|
|
4074
4249
|
{
|
|
4075
4250
|
className: "track",
|
|
@@ -4077,7 +4252,7 @@ var Progress = (props) => {
|
|
|
4077
4252
|
"aria-valuenow": value,
|
|
4078
4253
|
"aria-valuemin": 0,
|
|
4079
4254
|
"aria-valuemax": max,
|
|
4080
|
-
children: /* @__PURE__ */ (0,
|
|
4255
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(
|
|
4081
4256
|
"div",
|
|
4082
4257
|
{
|
|
4083
4258
|
className: "bar",
|
|
@@ -4086,7 +4261,7 @@ var Progress = (props) => {
|
|
|
4086
4261
|
)
|
|
4087
4262
|
}
|
|
4088
4263
|
),
|
|
4089
|
-
showLabel && /* @__PURE__ */ (0,
|
|
4264
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime330.jsxs)("span", { className: "label", children: [
|
|
4090
4265
|
Math.round(percentage),
|
|
4091
4266
|
"%"
|
|
4092
4267
|
] })
|
|
@@ -4096,17 +4271,17 @@ Progress.displayName = "Progress";
|
|
|
4096
4271
|
var Progress_default = Progress;
|
|
4097
4272
|
|
|
4098
4273
|
// src/components/Radio/RadioGroupContext.tsx
|
|
4099
|
-
var
|
|
4100
|
-
var RadioGroupContext =
|
|
4274
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
4275
|
+
var RadioGroupContext = import_react28.default.createContext(
|
|
4101
4276
|
null
|
|
4102
4277
|
);
|
|
4103
4278
|
var useRadioGroupContext = () => {
|
|
4104
|
-
return
|
|
4279
|
+
return import_react28.default.useContext(RadioGroupContext);
|
|
4105
4280
|
};
|
|
4106
4281
|
var RadioGroupContext_default = RadioGroupContext;
|
|
4107
4282
|
|
|
4108
4283
|
// src/components/Radio/Radio.tsx
|
|
4109
|
-
var
|
|
4284
|
+
var import_jsx_runtime331 = require("react/jsx-runtime");
|
|
4110
4285
|
var Radio = (props) => {
|
|
4111
4286
|
const {
|
|
4112
4287
|
label,
|
|
@@ -4124,7 +4299,7 @@ var Radio = (props) => {
|
|
|
4124
4299
|
value,
|
|
4125
4300
|
onChange: rest.onChange
|
|
4126
4301
|
};
|
|
4127
|
-
return /* @__PURE__ */ (0,
|
|
4302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime331.jsxs)(
|
|
4128
4303
|
"label",
|
|
4129
4304
|
{
|
|
4130
4305
|
className: clsx_default(
|
|
@@ -4134,18 +4309,18 @@ var Radio = (props) => {
|
|
|
4134
4309
|
localChecked ? "checked" : void 0
|
|
4135
4310
|
),
|
|
4136
4311
|
children: [
|
|
4137
|
-
/* @__PURE__ */ (0,
|
|
4138
|
-
/* @__PURE__ */ (0,
|
|
4312
|
+
/* @__PURE__ */ (0, import_jsx_runtime331.jsx)("input", { ...rest, ...inputProps, checked: localChecked, type: "radio" }),
|
|
4313
|
+
/* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
|
|
4139
4314
|
"div",
|
|
4140
4315
|
{
|
|
4141
4316
|
className: clsx_default(
|
|
4142
4317
|
"circle",
|
|
4143
4318
|
localChecked ? "checked" : void 0
|
|
4144
4319
|
),
|
|
4145
|
-
children: localChecked && /* @__PURE__ */ (0,
|
|
4320
|
+
children: localChecked && /* @__PURE__ */ (0, import_jsx_runtime331.jsx)("div", { className: "inner-circle" })
|
|
4146
4321
|
}
|
|
4147
4322
|
),
|
|
4148
|
-
label && /* @__PURE__ */ (0,
|
|
4323
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime331.jsx)("span", { children: label })
|
|
4149
4324
|
]
|
|
4150
4325
|
}
|
|
4151
4326
|
);
|
|
@@ -4154,28 +4329,28 @@ Radio.displayName = "Radio";
|
|
|
4154
4329
|
var Radio_default = Radio;
|
|
4155
4330
|
|
|
4156
4331
|
// src/components/Radio/RadioGroup.tsx
|
|
4157
|
-
var
|
|
4332
|
+
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
4158
4333
|
var RadioGroup = (props) => {
|
|
4159
4334
|
const { children, ...rest } = props;
|
|
4160
|
-
return /* @__PURE__ */ (0,
|
|
4335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(import_jsx_runtime332.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(RadioGroupContext_default.Provider, { value: rest, children }) });
|
|
4161
4336
|
};
|
|
4162
4337
|
RadioGroup.displayName = "RadioGroup";
|
|
4163
4338
|
var RadioGroup_default = RadioGroup;
|
|
4164
4339
|
|
|
4165
4340
|
// src/components/Select/Select.tsx
|
|
4166
|
-
var
|
|
4341
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
4167
4342
|
|
|
4168
4343
|
// src/components/Select/context.ts
|
|
4169
|
-
var
|
|
4170
|
-
var SelectContext =
|
|
4344
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
4345
|
+
var SelectContext = import_react29.default.createContext(null);
|
|
4171
4346
|
var context_default = SelectContext;
|
|
4172
4347
|
|
|
4173
4348
|
// src/components/Select/SelectItem.tsx
|
|
4174
|
-
var
|
|
4175
|
-
var
|
|
4349
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
4350
|
+
var import_jsx_runtime333 = require("react/jsx-runtime");
|
|
4176
4351
|
var SelectItem = (props) => {
|
|
4177
4352
|
const { children, value, onClick, disabled = false } = props;
|
|
4178
|
-
const ctx =
|
|
4353
|
+
const ctx = import_react30.default.useContext(context_default);
|
|
4179
4354
|
const handleClick = (e) => {
|
|
4180
4355
|
e.preventDefault();
|
|
4181
4356
|
e.stopPropagation();
|
|
@@ -4184,7 +4359,7 @@ var SelectItem = (props) => {
|
|
|
4184
4359
|
ctx?.close();
|
|
4185
4360
|
onClick?.();
|
|
4186
4361
|
};
|
|
4187
|
-
return /* @__PURE__ */ (0,
|
|
4362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(
|
|
4188
4363
|
"div",
|
|
4189
4364
|
{
|
|
4190
4365
|
className: clsx_default("select-item", disabled && "disabled"),
|
|
@@ -4205,7 +4380,7 @@ SelectItem.displayName = "Select.Item";
|
|
|
4205
4380
|
var SelectItem_default = SelectItem;
|
|
4206
4381
|
|
|
4207
4382
|
// src/components/Select/Select.tsx
|
|
4208
|
-
var
|
|
4383
|
+
var import_jsx_runtime334 = require("react/jsx-runtime");
|
|
4209
4384
|
var ANIMATION_DURATION_MS3 = 200;
|
|
4210
4385
|
var SelectRoot = (props) => {
|
|
4211
4386
|
const {
|
|
@@ -4217,26 +4392,26 @@ var SelectRoot = (props) => {
|
|
|
4217
4392
|
error = false,
|
|
4218
4393
|
size = "md"
|
|
4219
4394
|
} = props;
|
|
4220
|
-
const itemChildren =
|
|
4221
|
-
(child) =>
|
|
4395
|
+
const itemChildren = import_react31.default.Children.toArray(children).filter(
|
|
4396
|
+
(child) => import_react31.default.isValidElement(child) && child.type === SelectItem_default
|
|
4222
4397
|
);
|
|
4223
4398
|
const isControlled = valueProp !== void 0;
|
|
4224
|
-
const [isOpen, setOpen] =
|
|
4225
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
4226
|
-
const controlledLabel =
|
|
4399
|
+
const [isOpen, setOpen] = import_react31.default.useState(false);
|
|
4400
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react31.default.useState(null);
|
|
4401
|
+
const controlledLabel = import_react31.default.useMemo(() => {
|
|
4227
4402
|
if (!isControlled) return null;
|
|
4228
4403
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
4229
4404
|
return match ? match.props.children : null;
|
|
4230
4405
|
}, [isControlled, valueProp, itemChildren]);
|
|
4231
4406
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
4232
|
-
const triggerRef =
|
|
4233
|
-
const contentRef =
|
|
4234
|
-
const [mounted, setMounted] =
|
|
4235
|
-
const [visible, setVisible] =
|
|
4236
|
-
|
|
4407
|
+
const triggerRef = import_react31.default.useRef(null);
|
|
4408
|
+
const contentRef = import_react31.default.useRef(null);
|
|
4409
|
+
const [mounted, setMounted] = import_react31.default.useState(false);
|
|
4410
|
+
const [visible, setVisible] = import_react31.default.useState(false);
|
|
4411
|
+
import_react31.default.useEffect(() => {
|
|
4237
4412
|
if (disabled && isOpen) setOpen(false);
|
|
4238
4413
|
}, [disabled, isOpen]);
|
|
4239
|
-
|
|
4414
|
+
import_react31.default.useEffect(() => {
|
|
4240
4415
|
if (isOpen) {
|
|
4241
4416
|
setMounted(true);
|
|
4242
4417
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -4246,12 +4421,12 @@ var SelectRoot = (props) => {
|
|
|
4246
4421
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
4247
4422
|
return () => clearTimeout(t);
|
|
4248
4423
|
}, [isOpen]);
|
|
4249
|
-
const open =
|
|
4250
|
-
const close =
|
|
4251
|
-
const toggle =
|
|
4424
|
+
const open = import_react31.default.useCallback(() => setOpen(true), []);
|
|
4425
|
+
const close = import_react31.default.useCallback(() => setOpen(false), []);
|
|
4426
|
+
const toggle = import_react31.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
4252
4427
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
4253
4428
|
const position = useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
4254
|
-
const setSelected =
|
|
4429
|
+
const setSelected = import_react31.default.useCallback(
|
|
4255
4430
|
(label, itemValue) => {
|
|
4256
4431
|
if (!isControlled) {
|
|
4257
4432
|
setUncontrolledLabel(label);
|
|
@@ -4260,7 +4435,7 @@ var SelectRoot = (props) => {
|
|
|
4260
4435
|
},
|
|
4261
4436
|
[isControlled, onChange]
|
|
4262
4437
|
);
|
|
4263
|
-
const ctxValue =
|
|
4438
|
+
const ctxValue = import_react31.default.useMemo(
|
|
4264
4439
|
() => ({
|
|
4265
4440
|
isOpen,
|
|
4266
4441
|
mounted,
|
|
@@ -4281,7 +4456,7 @@ var SelectRoot = (props) => {
|
|
|
4281
4456
|
if (disabled) return;
|
|
4282
4457
|
toggle();
|
|
4283
4458
|
};
|
|
4284
|
-
return /* @__PURE__ */ (0,
|
|
4459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(context_default.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime334.jsxs)(
|
|
4285
4460
|
"div",
|
|
4286
4461
|
{
|
|
4287
4462
|
className: clsx_default(
|
|
@@ -4292,7 +4467,7 @@ var SelectRoot = (props) => {
|
|
|
4292
4467
|
mounted && "is-open"
|
|
4293
4468
|
),
|
|
4294
4469
|
children: [
|
|
4295
|
-
/* @__PURE__ */ (0,
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime334.jsxs)(
|
|
4296
4471
|
"div",
|
|
4297
4472
|
{
|
|
4298
4473
|
ref: triggerRef,
|
|
@@ -4316,7 +4491,7 @@ var SelectRoot = (props) => {
|
|
|
4316
4491
|
}
|
|
4317
4492
|
},
|
|
4318
4493
|
children: [
|
|
4319
|
-
/* @__PURE__ */ (0,
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4320
4495
|
"span",
|
|
4321
4496
|
{
|
|
4322
4497
|
className: clsx_default(
|
|
@@ -4326,25 +4501,25 @@ var SelectRoot = (props) => {
|
|
|
4326
4501
|
children: selectedLabel ?? placeholder
|
|
4327
4502
|
}
|
|
4328
4503
|
),
|
|
4329
|
-
/* @__PURE__ */ (0,
|
|
4504
|
+
/* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4330
4505
|
"span",
|
|
4331
4506
|
{
|
|
4332
4507
|
className: clsx_default("select-trigger-icon", isOpen && "open"),
|
|
4333
4508
|
"aria-hidden": true,
|
|
4334
|
-
children: /* @__PURE__ */ (0,
|
|
4509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(ChevronDownIcon_default, {})
|
|
4335
4510
|
}
|
|
4336
4511
|
)
|
|
4337
4512
|
]
|
|
4338
4513
|
}
|
|
4339
4514
|
),
|
|
4340
|
-
mounted && /* @__PURE__ */ (0,
|
|
4515
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4341
4516
|
"div",
|
|
4342
4517
|
{
|
|
4343
4518
|
className: clsx_default("lib-xplat-select-content", position.direction, stateClass),
|
|
4344
4519
|
ref: contentRef,
|
|
4345
4520
|
style: { ...position.position, width: triggerRef.current?.offsetWidth },
|
|
4346
4521
|
role: "listbox",
|
|
4347
|
-
children: /* @__PURE__ */ (0,
|
|
4522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(context_default.Provider, { value: ctxValue, children: itemChildren })
|
|
4348
4523
|
}
|
|
4349
4524
|
) })
|
|
4350
4525
|
]
|
|
@@ -4358,7 +4533,7 @@ var Select = Object.assign(SelectRoot, {
|
|
|
4358
4533
|
var Select_default = Select;
|
|
4359
4534
|
|
|
4360
4535
|
// src/components/Skeleton/Skeleton.tsx
|
|
4361
|
-
var
|
|
4536
|
+
var import_jsx_runtime335 = require("react/jsx-runtime");
|
|
4362
4537
|
var SIZE_MAP = {
|
|
4363
4538
|
xs: "var(--spacing-size-1)",
|
|
4364
4539
|
sm: "var(--spacing-size-2)",
|
|
@@ -4374,7 +4549,7 @@ var Skeleton = (props) => {
|
|
|
4374
4549
|
...width != null && { width: SIZE_MAP[width] },
|
|
4375
4550
|
...height != null && { height: SIZE_MAP[height] }
|
|
4376
4551
|
};
|
|
4377
|
-
return /* @__PURE__ */ (0,
|
|
4552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(
|
|
4378
4553
|
"div",
|
|
4379
4554
|
{
|
|
4380
4555
|
className: clsx_default("lib-xplat-skeleton", variant),
|
|
@@ -4387,20 +4562,20 @@ Skeleton.displayName = "Skeleton";
|
|
|
4387
4562
|
var Skeleton_default = Skeleton;
|
|
4388
4563
|
|
|
4389
4564
|
// src/components/Spinner/Spinner.tsx
|
|
4390
|
-
var
|
|
4565
|
+
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
4391
4566
|
var Spinner = (props) => {
|
|
4392
4567
|
const {
|
|
4393
4568
|
size = "md",
|
|
4394
4569
|
type = "brand"
|
|
4395
4570
|
} = props;
|
|
4396
|
-
return /* @__PURE__ */ (0,
|
|
4571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4397
4572
|
"div",
|
|
4398
4573
|
{
|
|
4399
4574
|
className: clsx_default("lib-xplat-spinner", size, type),
|
|
4400
4575
|
role: "status",
|
|
4401
4576
|
"aria-label": "\uB85C\uB529 \uC911",
|
|
4402
|
-
children: /* @__PURE__ */ (0,
|
|
4403
|
-
/* @__PURE__ */ (0,
|
|
4577
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime336.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4404
4579
|
"circle",
|
|
4405
4580
|
{
|
|
4406
4581
|
className: "track",
|
|
@@ -4410,7 +4585,7 @@ var Spinner = (props) => {
|
|
|
4410
4585
|
strokeWidth: "3"
|
|
4411
4586
|
}
|
|
4412
4587
|
),
|
|
4413
|
-
/* @__PURE__ */ (0,
|
|
4588
|
+
/* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4414
4589
|
"circle",
|
|
4415
4590
|
{
|
|
4416
4591
|
className: "indicator",
|
|
@@ -4429,20 +4604,20 @@ Spinner.displayName = "Spinner";
|
|
|
4429
4604
|
var Spinner_default = Spinner;
|
|
4430
4605
|
|
|
4431
4606
|
// src/components/Steps/Steps.tsx
|
|
4432
|
-
var
|
|
4607
|
+
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
4433
4608
|
var Steps = (props) => {
|
|
4434
4609
|
const {
|
|
4435
4610
|
items,
|
|
4436
4611
|
current,
|
|
4437
4612
|
type = "brand"
|
|
4438
4613
|
} = props;
|
|
4439
|
-
return /* @__PURE__ */ (0,
|
|
4614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("div", { className: clsx_default("lib-xplat-steps", type), children: items.map((item, index) => {
|
|
4440
4615
|
const status = index < current ? "completed" : index === current ? "active" : "pending";
|
|
4441
|
-
return /* @__PURE__ */ (0,
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4443
|
-
/* @__PURE__ */ (0,
|
|
4444
|
-
/* @__PURE__ */ (0,
|
|
4445
|
-
item.description && /* @__PURE__ */ (0,
|
|
4616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsxs)("div", { className: clsx_default("step-item", status), children: [
|
|
4617
|
+
/* @__PURE__ */ (0, import_jsx_runtime337.jsx)("div", { className: "step-circle", children: status === "completed" ? /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(CheckIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("span", { children: index + 1 }) }),
|
|
4618
|
+
/* @__PURE__ */ (0, import_jsx_runtime337.jsxs)("div", { className: "step-content", children: [
|
|
4619
|
+
/* @__PURE__ */ (0, import_jsx_runtime337.jsx)("span", { className: "step-title", children: item.title }),
|
|
4620
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("span", { className: "step-description", children: item.description })
|
|
4446
4621
|
] })
|
|
4447
4622
|
] }, index);
|
|
4448
4623
|
}) });
|
|
@@ -4451,8 +4626,8 @@ Steps.displayName = "Steps";
|
|
|
4451
4626
|
var Steps_default = Steps;
|
|
4452
4627
|
|
|
4453
4628
|
// src/components/Swiper/Swiper.tsx
|
|
4454
|
-
var
|
|
4455
|
-
var
|
|
4629
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
4630
|
+
var import_jsx_runtime338 = require("react/jsx-runtime");
|
|
4456
4631
|
var Swiper = (props) => {
|
|
4457
4632
|
const {
|
|
4458
4633
|
auto = false,
|
|
@@ -4475,23 +4650,23 @@ var Swiper = (props) => {
|
|
|
4475
4650
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
4476
4651
|
const useLoop = loop && canSlide;
|
|
4477
4652
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
4478
|
-
const extendedItems =
|
|
4653
|
+
const extendedItems = import_react32.default.useMemo(() => {
|
|
4479
4654
|
if (!useLoop) return items;
|
|
4480
4655
|
return [...items, ...items, ...items];
|
|
4481
4656
|
}, [items, useLoop]);
|
|
4482
4657
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
4483
|
-
const [innerIndex, setInnerIndex] =
|
|
4658
|
+
const [innerIndex, setInnerIndex] = import_react32.default.useState(
|
|
4484
4659
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
4485
4660
|
);
|
|
4486
|
-
const [isDragging, setIsDragging] =
|
|
4487
|
-
const [dragOffset, setDragOffset] =
|
|
4488
|
-
const [animated, setAnimated] =
|
|
4489
|
-
const [containerWidth, setContainerWidth] =
|
|
4490
|
-
const containerRef =
|
|
4491
|
-
const startXRef =
|
|
4492
|
-
const startTimeRef =
|
|
4493
|
-
const autoplayTimerRef =
|
|
4494
|
-
|
|
4661
|
+
const [isDragging, setIsDragging] = import_react32.default.useState(false);
|
|
4662
|
+
const [dragOffset, setDragOffset] = import_react32.default.useState(0);
|
|
4663
|
+
const [animated, setAnimated] = import_react32.default.useState(true);
|
|
4664
|
+
const [containerWidth, setContainerWidth] = import_react32.default.useState(0);
|
|
4665
|
+
const containerRef = import_react32.default.useRef(null);
|
|
4666
|
+
const startXRef = import_react32.default.useRef(0);
|
|
4667
|
+
const startTimeRef = import_react32.default.useRef(0);
|
|
4668
|
+
const autoplayTimerRef = import_react32.default.useRef(null);
|
|
4669
|
+
import_react32.default.useEffect(() => {
|
|
4495
4670
|
const el = containerRef.current;
|
|
4496
4671
|
if (!el) return;
|
|
4497
4672
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -4510,7 +4685,7 @@ var Swiper = (props) => {
|
|
|
4510
4685
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
4511
4686
|
};
|
|
4512
4687
|
const realIndex = getRealIndex(innerIndex);
|
|
4513
|
-
const moveToInner =
|
|
4688
|
+
const moveToInner = import_react32.default.useCallback(
|
|
4514
4689
|
(idx, withAnim = true) => {
|
|
4515
4690
|
if (!useLoop) {
|
|
4516
4691
|
setAnimated(withAnim);
|
|
@@ -4538,7 +4713,7 @@ var Swiper = (props) => {
|
|
|
4538
4713
|
},
|
|
4539
4714
|
[useLoop, cloneCount, totalSlides]
|
|
4540
4715
|
);
|
|
4541
|
-
const handleTransitionEnd =
|
|
4716
|
+
const handleTransitionEnd = import_react32.default.useCallback(() => {
|
|
4542
4717
|
if (!useLoop) return;
|
|
4543
4718
|
const real = getRealIndex(innerIndex);
|
|
4544
4719
|
const canonical = cloneCount + real;
|
|
@@ -4548,7 +4723,7 @@ var Swiper = (props) => {
|
|
|
4548
4723
|
}
|
|
4549
4724
|
onChange?.(Math.min(real, maxIndex));
|
|
4550
4725
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
4551
|
-
const slideTo =
|
|
4726
|
+
const slideTo = import_react32.default.useCallback(
|
|
4552
4727
|
(logicalIndex) => {
|
|
4553
4728
|
if (!canSlide) return;
|
|
4554
4729
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -4558,7 +4733,7 @@ var Swiper = (props) => {
|
|
|
4558
4733
|
},
|
|
4559
4734
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
4560
4735
|
);
|
|
4561
|
-
const slideNext =
|
|
4736
|
+
const slideNext = import_react32.default.useCallback(() => {
|
|
4562
4737
|
if (!canSlide) return;
|
|
4563
4738
|
const nextInner = innerIndex + slideBy;
|
|
4564
4739
|
if (useLoop) {
|
|
@@ -4567,7 +4742,7 @@ var Swiper = (props) => {
|
|
|
4567
4742
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
4568
4743
|
}
|
|
4569
4744
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
4570
|
-
const slidePrev =
|
|
4745
|
+
const slidePrev = import_react32.default.useCallback(() => {
|
|
4571
4746
|
if (!canSlide) return;
|
|
4572
4747
|
const prevInner = innerIndex - slideBy;
|
|
4573
4748
|
if (useLoop) {
|
|
@@ -4576,7 +4751,7 @@ var Swiper = (props) => {
|
|
|
4576
4751
|
moveToInner(Math.max(prevInner, 0), true);
|
|
4577
4752
|
}
|
|
4578
4753
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
4579
|
-
|
|
4754
|
+
import_react32.default.useEffect(() => {
|
|
4580
4755
|
if (indexProp === void 0) return;
|
|
4581
4756
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
4582
4757
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -4584,12 +4759,12 @@ var Swiper = (props) => {
|
|
|
4584
4759
|
moveToInner(target, true);
|
|
4585
4760
|
}
|
|
4586
4761
|
}, [indexProp]);
|
|
4587
|
-
|
|
4762
|
+
import_react32.default.useImperativeHandle(swiperRef, () => ({
|
|
4588
4763
|
slidePrev,
|
|
4589
4764
|
slideNext,
|
|
4590
4765
|
slideTo
|
|
4591
4766
|
}));
|
|
4592
|
-
|
|
4767
|
+
import_react32.default.useEffect(() => {
|
|
4593
4768
|
if (!auto || !canSlide) return;
|
|
4594
4769
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
4595
4770
|
return () => {
|
|
@@ -4612,7 +4787,7 @@ var Swiper = (props) => {
|
|
|
4612
4787
|
startXRef.current = getClientX(e);
|
|
4613
4788
|
startTimeRef.current = Date.now();
|
|
4614
4789
|
};
|
|
4615
|
-
|
|
4790
|
+
import_react32.default.useEffect(() => {
|
|
4616
4791
|
if (!isDragging) return;
|
|
4617
4792
|
const handleMove = (e) => {
|
|
4618
4793
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -4650,8 +4825,8 @@ var Swiper = (props) => {
|
|
|
4650
4825
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
4651
4826
|
const slideWidthPercent = 100 / viewItemCount;
|
|
4652
4827
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
4653
|
-
const slideElements =
|
|
4654
|
-
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0,
|
|
4828
|
+
const slideElements = import_react32.default.useMemo(
|
|
4829
|
+
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4655
4830
|
"div",
|
|
4656
4831
|
{
|
|
4657
4832
|
className: "lib-xplat-swiper__slide",
|
|
@@ -4670,14 +4845,14 @@ var Swiper = (props) => {
|
|
|
4670
4845
|
Math.floor(realIndex / slideBy),
|
|
4671
4846
|
totalSteps - 1
|
|
4672
4847
|
);
|
|
4673
|
-
return /* @__PURE__ */ (0,
|
|
4674
|
-
/* @__PURE__ */ (0,
|
|
4848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime338.jsxs)("div", { className: "lib-xplat-swiper", ref: containerRef, children: [
|
|
4849
|
+
/* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4675
4850
|
"div",
|
|
4676
4851
|
{
|
|
4677
4852
|
className: "lib-xplat-swiper__viewport",
|
|
4678
4853
|
onMouseDown: handleDragStart,
|
|
4679
4854
|
onTouchStart: handleDragStart,
|
|
4680
|
-
children: /* @__PURE__ */ (0,
|
|
4855
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4681
4856
|
"div",
|
|
4682
4857
|
{
|
|
4683
4858
|
className: clsx_default(
|
|
@@ -4695,7 +4870,7 @@ var Swiper = (props) => {
|
|
|
4695
4870
|
)
|
|
4696
4871
|
}
|
|
4697
4872
|
),
|
|
4698
|
-
showProgress && canSlide && /* @__PURE__ */ (0,
|
|
4873
|
+
showProgress && canSlide && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4699
4874
|
"span",
|
|
4700
4875
|
{
|
|
4701
4876
|
className: "lib-xplat-swiper__progress-fill",
|
|
@@ -4705,7 +4880,7 @@ var Swiper = (props) => {
|
|
|
4705
4880
|
}
|
|
4706
4881
|
}
|
|
4707
4882
|
) }) }),
|
|
4708
|
-
canSlide && /* @__PURE__ */ (0,
|
|
4883
|
+
canSlide && /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4709
4884
|
"button",
|
|
4710
4885
|
{
|
|
4711
4886
|
className: clsx_default(
|
|
@@ -4723,8 +4898,8 @@ Swiper.displayName = "Swiper";
|
|
|
4723
4898
|
var Swiper_default = Swiper;
|
|
4724
4899
|
|
|
4725
4900
|
// src/components/Switch/Switch.tsx
|
|
4726
|
-
var
|
|
4727
|
-
var
|
|
4901
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
4902
|
+
var import_jsx_runtime339 = require("react/jsx-runtime");
|
|
4728
4903
|
var KNOB_TRANSITION_MS = 250;
|
|
4729
4904
|
var Switch = (props) => {
|
|
4730
4905
|
const {
|
|
@@ -4734,9 +4909,9 @@ var Switch = (props) => {
|
|
|
4734
4909
|
disabled,
|
|
4735
4910
|
onChange
|
|
4736
4911
|
} = props;
|
|
4737
|
-
const [isAnimating, setIsAnimating] =
|
|
4738
|
-
const timeoutRef =
|
|
4739
|
-
|
|
4912
|
+
const [isAnimating, setIsAnimating] = import_react33.default.useState(false);
|
|
4913
|
+
const timeoutRef = import_react33.default.useRef(null);
|
|
4914
|
+
import_react33.default.useEffect(() => {
|
|
4740
4915
|
return () => {
|
|
4741
4916
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4742
4917
|
};
|
|
@@ -4751,7 +4926,7 @@ var Switch = (props) => {
|
|
|
4751
4926
|
timeoutRef.current = null;
|
|
4752
4927
|
}, KNOB_TRANSITION_MS);
|
|
4753
4928
|
};
|
|
4754
|
-
return /* @__PURE__ */ (0,
|
|
4929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime339.jsx)(
|
|
4755
4930
|
"div",
|
|
4756
4931
|
{
|
|
4757
4932
|
className: clsx_default(
|
|
@@ -4764,7 +4939,7 @@ var Switch = (props) => {
|
|
|
4764
4939
|
),
|
|
4765
4940
|
onClick: handleClick,
|
|
4766
4941
|
"aria-disabled": disabled || isAnimating,
|
|
4767
|
-
children: /* @__PURE__ */ (0,
|
|
4942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime339.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
|
|
4768
4943
|
}
|
|
4769
4944
|
);
|
|
4770
4945
|
};
|
|
@@ -4772,26 +4947,27 @@ Switch.displayName = "Switch";
|
|
|
4772
4947
|
var Switch_default = Switch;
|
|
4773
4948
|
|
|
4774
4949
|
// src/components/Table/TableContext.tsx
|
|
4775
|
-
var
|
|
4776
|
-
var TableContext =
|
|
4950
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
4951
|
+
var TableContext = import_react34.default.createContext(null);
|
|
4777
4952
|
var useTableContext = () => {
|
|
4778
|
-
const ctx =
|
|
4953
|
+
const ctx = import_react34.default.useContext(TableContext);
|
|
4779
4954
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
4780
4955
|
return ctx;
|
|
4781
4956
|
};
|
|
4782
4957
|
var TableContext_default = TableContext;
|
|
4783
4958
|
|
|
4784
4959
|
// src/components/Table/Table.tsx
|
|
4785
|
-
var
|
|
4960
|
+
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
4786
4961
|
var Table = (props) => {
|
|
4787
4962
|
const {
|
|
4788
4963
|
children,
|
|
4964
|
+
size = "md",
|
|
4789
4965
|
rowBorderUse = true,
|
|
4790
4966
|
colBorderUse = true,
|
|
4791
4967
|
headerSticky = false,
|
|
4792
4968
|
stickyShadow = true
|
|
4793
4969
|
} = props;
|
|
4794
|
-
return /* @__PURE__ */ (0,
|
|
4970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime340.jsx)("div", { className: `lib-xplat-table-wrapper ${size}`, children: /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(
|
|
4795
4971
|
TableContext_default.Provider,
|
|
4796
4972
|
{
|
|
4797
4973
|
value: {
|
|
@@ -4800,7 +4976,7 @@ var Table = (props) => {
|
|
|
4800
4976
|
headerSticky,
|
|
4801
4977
|
stickyShadow
|
|
4802
4978
|
},
|
|
4803
|
-
children: /* @__PURE__ */ (0,
|
|
4979
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime340.jsx)("table", { className: "lib-xplat-table", children })
|
|
4804
4980
|
}
|
|
4805
4981
|
) });
|
|
4806
4982
|
};
|
|
@@ -4808,41 +4984,41 @@ Table.displayName = "Table";
|
|
|
4808
4984
|
var Table_default = Table;
|
|
4809
4985
|
|
|
4810
4986
|
// src/components/Table/TableBody.tsx
|
|
4811
|
-
var
|
|
4987
|
+
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
4812
4988
|
var TableBody = (props) => {
|
|
4813
4989
|
const { children } = props;
|
|
4814
|
-
return /* @__PURE__ */ (0,
|
|
4990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("tbody", { children });
|
|
4815
4991
|
};
|
|
4816
4992
|
TableBody.displayName = "TableBody";
|
|
4817
4993
|
var TableBody_default = TableBody;
|
|
4818
4994
|
|
|
4819
4995
|
// src/components/Table/TableCell.tsx
|
|
4820
|
-
var
|
|
4996
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
4821
4997
|
|
|
4822
4998
|
// src/components/Table/TableHeadContext.tsx
|
|
4823
|
-
var
|
|
4824
|
-
var TableHeadContext =
|
|
4999
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
5000
|
+
var TableHeadContext = import_react35.default.createContext(
|
|
4825
5001
|
null
|
|
4826
5002
|
);
|
|
4827
5003
|
var useTableHeadContext = () => {
|
|
4828
|
-
const ctx =
|
|
5004
|
+
const ctx = import_react35.default.useContext(TableHeadContext);
|
|
4829
5005
|
return ctx;
|
|
4830
5006
|
};
|
|
4831
5007
|
var TableHeadContext_default = TableHeadContext;
|
|
4832
5008
|
|
|
4833
5009
|
// src/components/Table/TableRowContext.tsx
|
|
4834
|
-
var
|
|
4835
|
-
var TableRowContext =
|
|
5010
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
5011
|
+
var TableRowContext = import_react36.default.createContext(null);
|
|
4836
5012
|
var useTableRowContext = () => {
|
|
4837
|
-
const ctx =
|
|
5013
|
+
const ctx = import_react36.default.useContext(TableRowContext);
|
|
4838
5014
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
4839
5015
|
return ctx;
|
|
4840
5016
|
};
|
|
4841
5017
|
var TableRowContext_default = TableRowContext;
|
|
4842
5018
|
|
|
4843
5019
|
// src/components/Table/TableCell.tsx
|
|
4844
|
-
var
|
|
4845
|
-
var TableCell =
|
|
5020
|
+
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
5021
|
+
var TableCell = import_react37.default.memo((props) => {
|
|
4846
5022
|
const {
|
|
4847
5023
|
children,
|
|
4848
5024
|
align = "center",
|
|
@@ -4854,9 +5030,9 @@ var TableCell = import_react35.default.memo((props) => {
|
|
|
4854
5030
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
4855
5031
|
const { stickyShadow } = useTableContext();
|
|
4856
5032
|
const headContext = useTableHeadContext();
|
|
4857
|
-
const [left, setLeft] =
|
|
4858
|
-
const cellRef =
|
|
4859
|
-
const calculateLeft =
|
|
5033
|
+
const [left, setLeft] = import_react37.default.useState(0);
|
|
5034
|
+
const cellRef = import_react37.default.useRef(null);
|
|
5035
|
+
const calculateLeft = import_react37.default.useCallback(() => {
|
|
4860
5036
|
if (!cellRef.current) return 0;
|
|
4861
5037
|
let totalLeft = 0;
|
|
4862
5038
|
for (const ref of stickyCells) {
|
|
@@ -4865,7 +5041,7 @@ var TableCell = import_react35.default.memo((props) => {
|
|
|
4865
5041
|
}
|
|
4866
5042
|
return totalLeft;
|
|
4867
5043
|
}, [stickyCells]);
|
|
4868
|
-
|
|
5044
|
+
import_react37.default.useEffect(() => {
|
|
4869
5045
|
if (!isSticky || !cellRef.current) return;
|
|
4870
5046
|
registerStickyCell(cellRef);
|
|
4871
5047
|
setLeft(calculateLeft());
|
|
@@ -4883,7 +5059,7 @@ var TableCell = import_react35.default.memo((props) => {
|
|
|
4883
5059
|
const CellTag = cellRef.current?.tagName === "TH" ? "th" : "td";
|
|
4884
5060
|
const isLastSticky = isSticky && stickyCells[stickyCells.length - 1] === cellRef;
|
|
4885
5061
|
const enableHover = headContext && headContext.cellHover;
|
|
4886
|
-
return /* @__PURE__ */ (0,
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
4887
5063
|
CellTag,
|
|
4888
5064
|
{
|
|
4889
5065
|
ref: cellRef,
|
|
@@ -4908,21 +5084,21 @@ TableCell.displayName = "TableCell";
|
|
|
4908
5084
|
var TableCell_default = TableCell;
|
|
4909
5085
|
|
|
4910
5086
|
// src/components/Table/TableHead.tsx
|
|
4911
|
-
var
|
|
5087
|
+
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
4912
5088
|
var TableHead = ({
|
|
4913
5089
|
children,
|
|
4914
5090
|
cellHover = false
|
|
4915
5091
|
}) => {
|
|
4916
5092
|
const { headerSticky } = useTableContext();
|
|
4917
|
-
return /* @__PURE__ */ (0,
|
|
5093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(TableHeadContext_default.Provider, { value: { cellHover }, children: /* @__PURE__ */ (0, import_jsx_runtime343.jsx)("thead", { className: clsx_default(headerSticky ? "table-sticky" : null), children }) });
|
|
4918
5094
|
};
|
|
4919
5095
|
TableHead.displayName = "TableHead";
|
|
4920
5096
|
var TableHead_default = TableHead;
|
|
4921
5097
|
|
|
4922
5098
|
// src/components/Table/TableRow.tsx
|
|
4923
|
-
var
|
|
4924
|
-
var
|
|
4925
|
-
var TableRow =
|
|
5099
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
5100
|
+
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
5101
|
+
var TableRow = import_react38.default.memo((props) => {
|
|
4926
5102
|
const {
|
|
4927
5103
|
children,
|
|
4928
5104
|
type = "secondary",
|
|
@@ -4930,14 +5106,14 @@ var TableRow = import_react36.default.memo((props) => {
|
|
|
4930
5106
|
onClick
|
|
4931
5107
|
} = props;
|
|
4932
5108
|
const { rowBorderUse } = useTableContext();
|
|
4933
|
-
const [stickyCells, setStickyCells] =
|
|
5109
|
+
const [stickyCells, setStickyCells] = import_react38.default.useState([]);
|
|
4934
5110
|
const registerStickyCell = (ref) => {
|
|
4935
5111
|
setStickyCells((prev) => {
|
|
4936
5112
|
if (prev.includes(ref)) return prev;
|
|
4937
5113
|
return [...prev, ref];
|
|
4938
5114
|
});
|
|
4939
5115
|
};
|
|
4940
|
-
return /* @__PURE__ */ (0,
|
|
5116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(TableRowContext_default.Provider, { value: { stickyCells, registerStickyCell }, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
4941
5117
|
"tr",
|
|
4942
5118
|
{
|
|
4943
5119
|
className: clsx_default(
|
|
@@ -4955,7 +5131,7 @@ TableRow.displayName = "TableRow";
|
|
|
4955
5131
|
var TableRow_default = TableRow;
|
|
4956
5132
|
|
|
4957
5133
|
// src/components/Tag/Tag.tsx
|
|
4958
|
-
var
|
|
5134
|
+
var import_jsx_runtime345 = require("react/jsx-runtime");
|
|
4959
5135
|
var Tag = (props) => {
|
|
4960
5136
|
const {
|
|
4961
5137
|
children,
|
|
@@ -4965,7 +5141,7 @@ var Tag = (props) => {
|
|
|
4965
5141
|
disabled = false,
|
|
4966
5142
|
colorIndex
|
|
4967
5143
|
} = props;
|
|
4968
|
-
return /* @__PURE__ */ (0,
|
|
5144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(
|
|
4969
5145
|
"span",
|
|
4970
5146
|
{
|
|
4971
5147
|
className: clsx_default(
|
|
@@ -4976,8 +5152,8 @@ var Tag = (props) => {
|
|
|
4976
5152
|
disabled && "disabled"
|
|
4977
5153
|
),
|
|
4978
5154
|
children: [
|
|
4979
|
-
/* @__PURE__ */ (0,
|
|
4980
|
-
onClose && /* @__PURE__ */ (0,
|
|
5155
|
+
/* @__PURE__ */ (0, import_jsx_runtime345.jsx)("span", { className: "tag-label", children }),
|
|
5156
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("button", { className: "tag-close", onClick: onClose, "aria-label": "\uC0AD\uC81C", disabled, children: /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(XIcon_default, {}) })
|
|
4981
5157
|
]
|
|
4982
5158
|
}
|
|
4983
5159
|
);
|
|
@@ -4985,83 +5161,26 @@ var Tag = (props) => {
|
|
|
4985
5161
|
Tag.displayName = "Tag";
|
|
4986
5162
|
var Tag_default = Tag;
|
|
4987
5163
|
|
|
4988
|
-
// src/components/TextArea/TextArea.tsx
|
|
4989
|
-
var import_react37 = __toESM(require("react"), 1);
|
|
4990
|
-
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
4991
|
-
var TextArea = import_react37.default.forwardRef(
|
|
4992
|
-
(props, ref) => {
|
|
4993
|
-
const { value, onChange, disabled, ...textareaProps } = props;
|
|
4994
|
-
const localRef = import_react37.default.useRef(null);
|
|
4995
|
-
const setRefs = (el) => {
|
|
4996
|
-
localRef.current = el;
|
|
4997
|
-
if (!ref) return;
|
|
4998
|
-
if (typeof ref === "function") {
|
|
4999
|
-
ref(el);
|
|
5000
|
-
} else if (ref && typeof ref === "object" && "current" in ref) {
|
|
5001
|
-
ref.current = el;
|
|
5002
|
-
}
|
|
5003
|
-
};
|
|
5004
|
-
const handleOnChange = (e) => {
|
|
5005
|
-
const val = e.target.value;
|
|
5006
|
-
if (onChange) {
|
|
5007
|
-
const event = {
|
|
5008
|
-
...e,
|
|
5009
|
-
target: { value: val }
|
|
5010
|
-
};
|
|
5011
|
-
onChange(event);
|
|
5012
|
-
}
|
|
5013
|
-
};
|
|
5014
|
-
import_react37.default.useEffect(() => {
|
|
5015
|
-
const el = localRef.current;
|
|
5016
|
-
if (!el) return;
|
|
5017
|
-
el.style.height = "0px";
|
|
5018
|
-
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
5019
|
-
el.style.height = `${nextHeight}px`;
|
|
5020
|
-
}, [value]);
|
|
5021
|
-
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: "lib-xplat-textarea-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
5022
|
-
"div",
|
|
5023
|
-
{
|
|
5024
|
-
className: clsx_default(
|
|
5025
|
-
"lib-xplat-textarea",
|
|
5026
|
-
disabled ? "disabled" : void 0
|
|
5027
|
-
),
|
|
5028
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
5029
|
-
"textarea",
|
|
5030
|
-
{
|
|
5031
|
-
...textareaProps,
|
|
5032
|
-
ref: setRefs,
|
|
5033
|
-
disabled,
|
|
5034
|
-
value,
|
|
5035
|
-
onChange: handleOnChange
|
|
5036
|
-
}
|
|
5037
|
-
)
|
|
5038
|
-
}
|
|
5039
|
-
) });
|
|
5040
|
-
}
|
|
5041
|
-
);
|
|
5042
|
-
TextArea.displayName = "TextArea";
|
|
5043
|
-
var TextArea_default = TextArea;
|
|
5044
|
-
|
|
5045
5164
|
// src/components/Toast/Toast.tsx
|
|
5046
|
-
var
|
|
5165
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
5047
5166
|
var import_react_dom4 = require("react-dom");
|
|
5048
|
-
var
|
|
5049
|
-
var ToastContext =
|
|
5167
|
+
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
5168
|
+
var ToastContext = import_react39.default.createContext(null);
|
|
5050
5169
|
var useToast = () => {
|
|
5051
|
-
const ctx =
|
|
5170
|
+
const ctx = import_react39.default.useContext(ToastContext);
|
|
5052
5171
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
5053
5172
|
return ctx;
|
|
5054
5173
|
};
|
|
5055
5174
|
var EXIT_DURATION = 300;
|
|
5056
5175
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
5057
|
-
const ref =
|
|
5058
|
-
const [height, setHeight] =
|
|
5059
|
-
|
|
5176
|
+
const ref = import_react39.default.useRef(null);
|
|
5177
|
+
const [height, setHeight] = import_react39.default.useState(void 0);
|
|
5178
|
+
import_react39.default.useEffect(() => {
|
|
5060
5179
|
if (ref.current && !isExiting) {
|
|
5061
5180
|
setHeight(ref.current.offsetHeight);
|
|
5062
5181
|
}
|
|
5063
5182
|
}, [isExiting]);
|
|
5064
|
-
return /* @__PURE__ */ (0,
|
|
5183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
|
|
5065
5184
|
"div",
|
|
5066
5185
|
{
|
|
5067
5186
|
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
@@ -5069,15 +5188,15 @@ var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
|
5069
5188
|
maxHeight: isExiting ? 0 : height ?? "none",
|
|
5070
5189
|
marginBottom: isExiting ? 0 : void 0
|
|
5071
5190
|
},
|
|
5072
|
-
children: /* @__PURE__ */ (0,
|
|
5191
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(
|
|
5073
5192
|
"div",
|
|
5074
5193
|
{
|
|
5075
5194
|
ref,
|
|
5076
5195
|
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
5077
5196
|
role: "alert",
|
|
5078
5197
|
children: [
|
|
5079
|
-
/* @__PURE__ */ (0,
|
|
5080
|
-
/* @__PURE__ */ (0,
|
|
5198
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("span", { className: "message", children: item.message }),
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
5081
5200
|
]
|
|
5082
5201
|
}
|
|
5083
5202
|
)
|
|
@@ -5088,13 +5207,13 @@ var ToastProvider = ({
|
|
|
5088
5207
|
children,
|
|
5089
5208
|
position = "top-right"
|
|
5090
5209
|
}) => {
|
|
5091
|
-
const [toasts, setToasts] =
|
|
5092
|
-
const [removing, setRemoving] =
|
|
5093
|
-
const [mounted, setMounted] =
|
|
5094
|
-
|
|
5210
|
+
const [toasts, setToasts] = import_react39.default.useState([]);
|
|
5211
|
+
const [removing, setRemoving] = import_react39.default.useState(/* @__PURE__ */ new Set());
|
|
5212
|
+
const [mounted, setMounted] = import_react39.default.useState(false);
|
|
5213
|
+
import_react39.default.useEffect(() => {
|
|
5095
5214
|
setMounted(true);
|
|
5096
5215
|
}, []);
|
|
5097
|
-
const remove =
|
|
5216
|
+
const remove = import_react39.default.useCallback((id) => {
|
|
5098
5217
|
setRemoving((prev) => new Set(prev).add(id));
|
|
5099
5218
|
setTimeout(() => {
|
|
5100
5219
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -5105,7 +5224,7 @@ var ToastProvider = ({
|
|
|
5105
5224
|
});
|
|
5106
5225
|
}, EXIT_DURATION);
|
|
5107
5226
|
}, []);
|
|
5108
|
-
const toast =
|
|
5227
|
+
const toast = import_react39.default.useCallback(
|
|
5109
5228
|
(type, message, duration = 3e3) => {
|
|
5110
5229
|
const id = `${Date.now()}-${Math.random()}`;
|
|
5111
5230
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -5115,10 +5234,10 @@ var ToastProvider = ({
|
|
|
5115
5234
|
},
|
|
5116
5235
|
[remove]
|
|
5117
5236
|
);
|
|
5118
|
-
return /* @__PURE__ */ (0,
|
|
5237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)(ToastContext.Provider, { value: { toast }, children: [
|
|
5119
5238
|
children,
|
|
5120
5239
|
mounted && (0, import_react_dom4.createPortal)(
|
|
5121
|
-
/* @__PURE__ */ (0,
|
|
5240
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime346.jsx)(
|
|
5122
5241
|
ToastItemComponent,
|
|
5123
5242
|
{
|
|
5124
5243
|
item: t,
|
|
@@ -5134,29 +5253,29 @@ var ToastProvider = ({
|
|
|
5134
5253
|
ToastProvider.displayName = "ToastProvider";
|
|
5135
5254
|
|
|
5136
5255
|
// src/components/Tooltip/Tooltip.tsx
|
|
5137
|
-
var
|
|
5138
|
-
var
|
|
5256
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
5257
|
+
var import_jsx_runtime347 = require("react/jsx-runtime");
|
|
5139
5258
|
var Tooltip = (props) => {
|
|
5140
5259
|
const {
|
|
5141
5260
|
type = "primary",
|
|
5142
5261
|
description,
|
|
5143
5262
|
children
|
|
5144
5263
|
} = props;
|
|
5145
|
-
const iconRef =
|
|
5146
|
-
return /* @__PURE__ */ (0,
|
|
5147
|
-
/* @__PURE__ */ (0,
|
|
5148
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
const iconRef = import_react40.default.useRef(null);
|
|
5265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: "lib-xplat-tooltip", children: [
|
|
5266
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
|
|
5267
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)("div", { className: clsx_default("tooltip-wrapper", type), children: description })
|
|
5149
5268
|
] });
|
|
5150
5269
|
};
|
|
5151
5270
|
Tooltip.displayName = "Tooltip";
|
|
5152
5271
|
var Tooltip_default = Tooltip;
|
|
5153
5272
|
|
|
5154
5273
|
// src/components/Video/Video.tsx
|
|
5155
|
-
var
|
|
5156
|
-
var
|
|
5157
|
-
var PipIcon = () => /* @__PURE__ */ (0,
|
|
5158
|
-
/* @__PURE__ */ (0,
|
|
5159
|
-
/* @__PURE__ */ (0,
|
|
5274
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
5275
|
+
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
5276
|
+
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)("rect", { x: "12", y: "11", width: "7", height: "6", rx: "1", fill: "currentColor" })
|
|
5160
5279
|
] });
|
|
5161
5280
|
var formatTime = (sec) => {
|
|
5162
5281
|
if (!Number.isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -5164,7 +5283,7 @@ var formatTime = (sec) => {
|
|
|
5164
5283
|
const s = Math.floor(sec % 60);
|
|
5165
5284
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
5166
5285
|
};
|
|
5167
|
-
var Video =
|
|
5286
|
+
var Video = import_react41.default.forwardRef((props, ref) => {
|
|
5168
5287
|
const {
|
|
5169
5288
|
src,
|
|
5170
5289
|
poster,
|
|
@@ -5188,21 +5307,21 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5188
5307
|
children,
|
|
5189
5308
|
...rest
|
|
5190
5309
|
} = props;
|
|
5191
|
-
const containerRef =
|
|
5192
|
-
const videoRef =
|
|
5193
|
-
const [isPlaying, setIsPlaying] =
|
|
5194
|
-
const [isLoaded, setIsLoaded] =
|
|
5195
|
-
const [currentTime, setCurrentTime] =
|
|
5196
|
-
const [duration, setDuration] =
|
|
5197
|
-
const [buffered, setBuffered] =
|
|
5198
|
-
const [volume, setVolume] =
|
|
5199
|
-
const [isMuted, setIsMuted] =
|
|
5200
|
-
const [isFullscreen, setIsFullscreen] =
|
|
5201
|
-
const [playbackRate, setPlaybackRate] =
|
|
5202
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
5203
|
-
const [captionsOn, setCaptionsOn] =
|
|
5204
|
-
const [isPip, setIsPip] =
|
|
5205
|
-
const setRefs =
|
|
5310
|
+
const containerRef = import_react41.default.useRef(null);
|
|
5311
|
+
const videoRef = import_react41.default.useRef(null);
|
|
5312
|
+
const [isPlaying, setIsPlaying] = import_react41.default.useState(Boolean(autoPlay));
|
|
5313
|
+
const [isLoaded, setIsLoaded] = import_react41.default.useState(false);
|
|
5314
|
+
const [currentTime, setCurrentTime] = import_react41.default.useState(0);
|
|
5315
|
+
const [duration, setDuration] = import_react41.default.useState(0);
|
|
5316
|
+
const [buffered, setBuffered] = import_react41.default.useState(0);
|
|
5317
|
+
const [volume, setVolume] = import_react41.default.useState(1);
|
|
5318
|
+
const [isMuted, setIsMuted] = import_react41.default.useState(Boolean(muted));
|
|
5319
|
+
const [isFullscreen, setIsFullscreen] = import_react41.default.useState(false);
|
|
5320
|
+
const [playbackRate, setPlaybackRate] = import_react41.default.useState(1);
|
|
5321
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react41.default.useState(false);
|
|
5322
|
+
const [captionsOn, setCaptionsOn] = import_react41.default.useState(false);
|
|
5323
|
+
const [isPip, setIsPip] = import_react41.default.useState(false);
|
|
5324
|
+
const setRefs = import_react41.default.useCallback(
|
|
5206
5325
|
(el) => {
|
|
5207
5326
|
videoRef.current = el;
|
|
5208
5327
|
if (typeof ref === "function") ref(el);
|
|
@@ -5210,14 +5329,14 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5210
5329
|
},
|
|
5211
5330
|
[ref]
|
|
5212
5331
|
);
|
|
5213
|
-
|
|
5332
|
+
import_react41.default.useEffect(() => {
|
|
5214
5333
|
const onFsChange = () => {
|
|
5215
5334
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
5216
5335
|
};
|
|
5217
5336
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
5218
5337
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
5219
5338
|
}, []);
|
|
5220
|
-
|
|
5339
|
+
import_react41.default.useEffect(() => {
|
|
5221
5340
|
const v = videoRef.current;
|
|
5222
5341
|
if (!v) return;
|
|
5223
5342
|
const onEnter = () => setIsPip(true);
|
|
@@ -5331,13 +5450,13 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5331
5450
|
const volumePct = (isMuted ? 0 : volume) * 100;
|
|
5332
5451
|
const VolumeGlyph = isMuted || volume === 0 ? VolumeXIcon_default : volume < 0.5 ? VolumeIcon_default : Volume2Icon_default;
|
|
5333
5452
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
5334
|
-
return /* @__PURE__ */ (0,
|
|
5453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
|
|
5335
5454
|
"div",
|
|
5336
5455
|
{
|
|
5337
5456
|
ref: containerRef,
|
|
5338
5457
|
className: clsx_default("lib-xplat-video", showControls && "has-controls"),
|
|
5339
5458
|
children: [
|
|
5340
|
-
/* @__PURE__ */ (0,
|
|
5459
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5341
5460
|
"video",
|
|
5342
5461
|
{
|
|
5343
5462
|
ref: setRefs,
|
|
@@ -5358,7 +5477,7 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5358
5477
|
children
|
|
5359
5478
|
}
|
|
5360
5479
|
),
|
|
5361
|
-
showCenterPlay && /* @__PURE__ */ (0,
|
|
5480
|
+
showCenterPlay && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5362
5481
|
"button",
|
|
5363
5482
|
{
|
|
5364
5483
|
type: "button",
|
|
@@ -5370,11 +5489,11 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5370
5489
|
onClick: togglePlay,
|
|
5371
5490
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
5372
5491
|
tabIndex: -1,
|
|
5373
|
-
children: /* @__PURE__ */ (0,
|
|
5492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("span", { className: "center-play-icon", children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(PlayCircleIcon_default, {}) })
|
|
5374
5493
|
}
|
|
5375
5494
|
),
|
|
5376
|
-
showControls && /* @__PURE__ */ (0,
|
|
5377
|
-
/* @__PURE__ */ (0,
|
|
5495
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("div", { className: "controls", onClick: (e) => e.stopPropagation(), children: [
|
|
5496
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5378
5497
|
"input",
|
|
5379
5498
|
{
|
|
5380
5499
|
type: "range",
|
|
@@ -5391,29 +5510,29 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5391
5510
|
}
|
|
5392
5511
|
}
|
|
5393
5512
|
),
|
|
5394
|
-
/* @__PURE__ */ (0,
|
|
5395
|
-
/* @__PURE__ */ (0,
|
|
5513
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("div", { className: "controls-row", children: [
|
|
5514
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5396
5515
|
"button",
|
|
5397
5516
|
{
|
|
5398
5517
|
type: "button",
|
|
5399
5518
|
className: "control-btn",
|
|
5400
5519
|
onClick: togglePlay,
|
|
5401
5520
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
5402
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
5521
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(PauseIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(PlayIcon_default, {})
|
|
5403
5522
|
}
|
|
5404
5523
|
),
|
|
5405
|
-
/* @__PURE__ */ (0,
|
|
5406
|
-
/* @__PURE__ */ (0,
|
|
5524
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("div", { className: "volume-group", children: [
|
|
5525
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5407
5526
|
"button",
|
|
5408
5527
|
{
|
|
5409
5528
|
type: "button",
|
|
5410
5529
|
className: "control-btn",
|
|
5411
5530
|
onClick: toggleMute,
|
|
5412
5531
|
"aria-label": isMuted ? "\uC74C\uC18C\uAC70 \uD574\uC81C" : "\uC74C\uC18C\uAC70",
|
|
5413
|
-
children: /* @__PURE__ */ (0,
|
|
5532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(VolumeGlyph, {})
|
|
5414
5533
|
}
|
|
5415
5534
|
),
|
|
5416
|
-
/* @__PURE__ */ (0,
|
|
5535
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5417
5536
|
"input",
|
|
5418
5537
|
{
|
|
5419
5538
|
type: "range",
|
|
@@ -5428,14 +5547,14 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5428
5547
|
}
|
|
5429
5548
|
)
|
|
5430
5549
|
] }),
|
|
5431
|
-
/* @__PURE__ */ (0,
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("span", { className: "time", children: [
|
|
5432
5551
|
formatTime(currentTime),
|
|
5433
5552
|
" / ",
|
|
5434
5553
|
formatTime(duration)
|
|
5435
5554
|
] }),
|
|
5436
|
-
/* @__PURE__ */ (0,
|
|
5437
|
-
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0,
|
|
5438
|
-
/* @__PURE__ */ (0,
|
|
5555
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)("div", { className: "controls-spacer" }),
|
|
5556
|
+
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)("div", { className: clsx_default("rate-group", rateMenuOpen && "is-open"), children: [
|
|
5557
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
|
|
5439
5558
|
"button",
|
|
5440
5559
|
{
|
|
5441
5560
|
type: "button",
|
|
@@ -5449,7 +5568,7 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5449
5568
|
]
|
|
5450
5569
|
}
|
|
5451
5570
|
),
|
|
5452
|
-
rateMenuOpen && /* @__PURE__ */ (0,
|
|
5571
|
+
rateMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("ul", { className: "rate-menu", role: "menu", children: playbackRates.map((r2) => /* @__PURE__ */ (0, import_jsx_runtime348.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime348.jsxs)(
|
|
5453
5572
|
"button",
|
|
5454
5573
|
{
|
|
5455
5574
|
type: "button",
|
|
@@ -5463,7 +5582,7 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5463
5582
|
}
|
|
5464
5583
|
) }, r2)) })
|
|
5465
5584
|
] }),
|
|
5466
|
-
showCaptions && /* @__PURE__ */ (0,
|
|
5585
|
+
showCaptions && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5467
5586
|
"button",
|
|
5468
5587
|
{
|
|
5469
5588
|
type: "button",
|
|
@@ -5471,37 +5590,37 @@ var Video = import_react40.default.forwardRef((props, ref) => {
|
|
|
5471
5590
|
onClick: toggleCaptions,
|
|
5472
5591
|
"aria-label": captionsOn ? "\uC790\uB9C9 \uB044\uAE30" : "\uC790\uB9C9 \uCF1C\uAE30",
|
|
5473
5592
|
"aria-pressed": captionsOn,
|
|
5474
|
-
children: /* @__PURE__ */ (0,
|
|
5593
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(TypeIcon_default, {})
|
|
5475
5594
|
}
|
|
5476
5595
|
),
|
|
5477
|
-
showPip && pipSupported && /* @__PURE__ */ (0,
|
|
5596
|
+
showPip && pipSupported && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5478
5597
|
"button",
|
|
5479
5598
|
{
|
|
5480
5599
|
type: "button",
|
|
5481
5600
|
className: clsx_default("control-btn", isPip && "is-active"),
|
|
5482
5601
|
onClick: togglePip,
|
|
5483
5602
|
"aria-label": isPip ? "PIP \uC885\uB8CC" : "PIP",
|
|
5484
|
-
children: /* @__PURE__ */ (0,
|
|
5603
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(PipIcon, {})
|
|
5485
5604
|
}
|
|
5486
5605
|
),
|
|
5487
|
-
showDownload && /* @__PURE__ */ (0,
|
|
5606
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5488
5607
|
"a",
|
|
5489
5608
|
{
|
|
5490
5609
|
className: "control-btn",
|
|
5491
5610
|
href: src,
|
|
5492
5611
|
download: downloadFileName ?? true,
|
|
5493
5612
|
"aria-label": "\uB2E4\uC6B4\uB85C\uB4DC",
|
|
5494
|
-
children: /* @__PURE__ */ (0,
|
|
5613
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(DownloadIcon_default, {})
|
|
5495
5614
|
}
|
|
5496
5615
|
),
|
|
5497
|
-
/* @__PURE__ */ (0,
|
|
5616
|
+
/* @__PURE__ */ (0, import_jsx_runtime348.jsx)(
|
|
5498
5617
|
"button",
|
|
5499
5618
|
{
|
|
5500
5619
|
type: "button",
|
|
5501
5620
|
className: "control-btn",
|
|
5502
5621
|
onClick: toggleFullscreen,
|
|
5503
5622
|
"aria-label": isFullscreen ? "\uC804\uCCB4\uD654\uBA74 \uC885\uB8CC" : "\uC804\uCCB4\uD654\uBA74",
|
|
5504
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
5623
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(MinimizeIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime348.jsx)(MaximizeIcon_default, {})
|
|
5505
5624
|
}
|
|
5506
5625
|
)
|
|
5507
5626
|
] })
|
|
@@ -5524,6 +5643,7 @@ var Video_default = Video;
|
|
|
5524
5643
|
Calendar,
|
|
5525
5644
|
CardTab,
|
|
5526
5645
|
Chart,
|
|
5646
|
+
ChatInput,
|
|
5527
5647
|
CheckBox,
|
|
5528
5648
|
Chip,
|
|
5529
5649
|
Divider,
|