@x-plat/design-system 0.5.10 → 0.5.12
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 +67 -48
- package/dist/components/Chart/index.js +68 -49
- package/dist/components/DatePicker/index.cjs +401 -379
- package/dist/components/DatePicker/index.js +388 -366
- package/dist/components/Dropdown/index.cjs +55 -27
- package/dist/components/Dropdown/index.css +10 -10
- package/dist/components/Dropdown/index.js +54 -26
- package/dist/components/Modal/index.cjs +29 -9
- package/dist/components/Modal/index.d.cts +0 -3
- package/dist/components/Modal/index.d.ts +0 -3
- package/dist/components/Modal/index.js +28 -8
- package/dist/components/PopOver/index.cjs +50 -22
- package/dist/components/PopOver/index.css +7 -10
- package/dist/components/PopOver/index.js +49 -21
- package/dist/components/Select/index.cjs +369 -341
- package/dist/components/Select/index.css +13 -23
- package/dist/components/Select/index.js +368 -340
- package/dist/components/index.cjs +503 -451
- package/dist/components/index.css +30 -43
- package/dist/components/index.js +459 -407
- package/dist/index.cjs +527 -475
- package/dist/index.css +30 -43
- package/dist/index.js +481 -429
- package/package.json +1 -1
|
@@ -2156,14 +2156,23 @@ var useChartSize = (ref) => {
|
|
|
2156
2156
|
import_react5.default.useEffect(() => {
|
|
2157
2157
|
const el = ref.current;
|
|
2158
2158
|
if (!el) return;
|
|
2159
|
+
let rafId = 0;
|
|
2159
2160
|
const observer = new ResizeObserver((entries) => {
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2161
|
+
cancelAnimationFrame(rafId);
|
|
2162
|
+
rafId = requestAnimationFrame(() => {
|
|
2163
|
+
const entry = entries[0];
|
|
2164
|
+
if (!entry) return;
|
|
2165
|
+
const { width, height } = entry.contentRect;
|
|
2166
|
+
const w = Math.floor(width);
|
|
2167
|
+
const h = Math.floor(height);
|
|
2168
|
+
setSize((prev) => prev.width === w && prev.height === h ? prev : { width: w, height: h });
|
|
2169
|
+
});
|
|
2164
2170
|
});
|
|
2165
2171
|
observer.observe(el);
|
|
2166
|
-
return () =>
|
|
2172
|
+
return () => {
|
|
2173
|
+
cancelAnimationFrame(rafId);
|
|
2174
|
+
observer.disconnect();
|
|
2175
|
+
};
|
|
2167
2176
|
}, [ref]);
|
|
2168
2177
|
return size;
|
|
2169
2178
|
};
|
|
@@ -2175,15 +2184,21 @@ var useChartTooltip = (enabled) => {
|
|
|
2175
2184
|
content: ""
|
|
2176
2185
|
});
|
|
2177
2186
|
const containerRef = import_react5.default.useRef(null);
|
|
2187
|
+
const rafRef = import_react5.default.useRef(0);
|
|
2178
2188
|
const move = import_react5.default.useCallback((e) => {
|
|
2179
2189
|
if (!enabled) return;
|
|
2180
|
-
const
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2190
|
+
const clientX = e.clientX;
|
|
2191
|
+
const clientY = e.clientY;
|
|
2192
|
+
cancelAnimationFrame(rafRef.current);
|
|
2193
|
+
rafRef.current = requestAnimationFrame(() => {
|
|
2194
|
+
const rect = containerRef.current?.getBoundingClientRect();
|
|
2195
|
+
if (!rect) return;
|
|
2196
|
+
setTooltip((prev) => ({
|
|
2197
|
+
...prev,
|
|
2198
|
+
x: clientX - rect.left,
|
|
2199
|
+
y: clientY - rect.top - 12
|
|
2200
|
+
}));
|
|
2201
|
+
});
|
|
2187
2202
|
}, [enabled]);
|
|
2188
2203
|
const show = import_react5.default.useCallback((e, content) => {
|
|
2189
2204
|
if (!enabled) return;
|
|
@@ -2197,10 +2212,35 @@ var useChartTooltip = (enabled) => {
|
|
|
2197
2212
|
});
|
|
2198
2213
|
}, [enabled]);
|
|
2199
2214
|
const hide = import_react5.default.useCallback(() => {
|
|
2215
|
+
cancelAnimationFrame(rafRef.current);
|
|
2200
2216
|
setTooltip((prev) => ({ ...prev, visible: false }));
|
|
2201
2217
|
}, []);
|
|
2202
2218
|
return { tooltip, show, hide, move, containerRef };
|
|
2203
2219
|
};
|
|
2220
|
+
var GridLines = import_react5.default.memo(({ width, height, chartH, maxVal }) => /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_jsx_runtime305.Fragment, { children: [0, 0.25, 0.5, 0.75, 1].map((ratio) => {
|
|
2221
|
+
const y = PADDING.top + (1 - ratio) * chartH;
|
|
2222
|
+
const val = Math.round(maxVal * ratio);
|
|
2223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("g", { children: [
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
2225
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
2226
|
+
] }, ratio);
|
|
2227
|
+
}) }));
|
|
2228
|
+
GridLines.displayName = "GridLines";
|
|
2229
|
+
var getLabelStep = (count, chartW) => {
|
|
2230
|
+
const minLabelWidth = 40;
|
|
2231
|
+
const maxLabels = Math.floor(chartW / minLabelWidth);
|
|
2232
|
+
if (count <= maxLabels) return 1;
|
|
2233
|
+
return Math.ceil(count / maxLabels);
|
|
2234
|
+
};
|
|
2235
|
+
var AxisLabels = import_react5.default.memo(({ labels, count, chartW, height }) => {
|
|
2236
|
+
const step = getLabelStep(count, chartW);
|
|
2237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(import_jsx_runtime305.Fragment, { children: labels.map((label, i) => {
|
|
2238
|
+
if (i % step !== 0) return null;
|
|
2239
|
+
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
2240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2241
|
+
}) });
|
|
2242
|
+
});
|
|
2243
|
+
AxisLabels.displayName = "AxisLabels";
|
|
2204
2244
|
var LineChart = import_react5.default.memo(({ data, labels, width, height, onHover, onMove, onLeave }) => {
|
|
2205
2245
|
const entries = import_react5.default.useMemo(() => Object.entries(data), [data]);
|
|
2206
2246
|
const maxVal = import_react5.default.useMemo(() => {
|
|
@@ -2220,19 +2260,10 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, onHov
|
|
|
2220
2260
|
),
|
|
2221
2261
|
[entries, count, chartW, chartH, maxVal]
|
|
2222
2262
|
);
|
|
2263
|
+
const showPoints = count <= 100;
|
|
2223
2264
|
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
const val = Math.round(maxVal * ratio);
|
|
2227
|
-
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("g", { children: [
|
|
2228
|
-
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
2229
|
-
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
2230
|
-
] }, ratio);
|
|
2231
|
-
}),
|
|
2232
|
-
labels.map((label, i) => {
|
|
2233
|
-
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
2234
|
-
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2235
|
-
}),
|
|
2265
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)(AxisLabels, { labels, count, chartW, height }),
|
|
2236
2267
|
entries.map(([key], di) => {
|
|
2237
2268
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2238
2269
|
const color = palette[2];
|
|
@@ -2247,7 +2278,7 @@ var LineChart = import_react5.default.memo(({ data, labels, width, height, onHov
|
|
|
2247
2278
|
strokeWidth: "2"
|
|
2248
2279
|
}
|
|
2249
2280
|
),
|
|
2250
|
-
points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
|
|
2281
|
+
showPoints && points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
|
|
2251
2282
|
"circle",
|
|
2252
2283
|
{
|
|
2253
2284
|
cx: p.x,
|
|
@@ -2285,19 +2316,10 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, onHo
|
|
|
2285
2316
|
),
|
|
2286
2317
|
[entries, count, chartW, chartH, maxVal]
|
|
2287
2318
|
);
|
|
2319
|
+
const showPoints = count <= 100;
|
|
2288
2320
|
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
const val = Math.round(maxVal * ratio);
|
|
2292
|
-
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("g", { children: [
|
|
2293
|
-
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
2294
|
-
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
2295
|
-
] }, ratio);
|
|
2296
|
-
}),
|
|
2297
|
-
labels.map((label, i) => {
|
|
2298
|
-
const x = PADDING.left + i / (count - 1 || 1) * chartW;
|
|
2299
|
-
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2300
|
-
}),
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)(AxisLabels, { labels, count, chartW, height }),
|
|
2301
2323
|
entries.map(([key], di) => {
|
|
2302
2324
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2303
2325
|
const color = palette[2];
|
|
@@ -2313,7 +2335,7 @@ var CurveChart = import_react5.default.memo(({ data, labels, width, height, onHo
|
|
|
2313
2335
|
] }) }),
|
|
2314
2336
|
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("path", { d: areaPath, fill: `url(#${gradientId})` }),
|
|
2315
2337
|
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("path", { d: linePath, fill: "none", stroke: color, strokeWidth: "2" }),
|
|
2316
|
-
points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
|
|
2338
|
+
showPoints && points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime305.jsx)(
|
|
2317
2339
|
"circle",
|
|
2318
2340
|
{
|
|
2319
2341
|
cx: p.x,
|
|
@@ -2343,11 +2365,11 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, onHove
|
|
|
2343
2365
|
const chartW = width - PADDING.left - PADDING.right;
|
|
2344
2366
|
const chartH = height - PADDING.top - PADDING.bottom;
|
|
2345
2367
|
const groupW = chartW / count;
|
|
2346
|
-
const barW = Math.min(32, groupW * 0.7 / groupCount);
|
|
2368
|
+
const barW = Math.max(1, Math.min(32, groupW * 0.7 / groupCount));
|
|
2347
2369
|
const bars = import_react5.default.useMemo(
|
|
2348
2370
|
() => entries.map(
|
|
2349
2371
|
([, values], di) => values.map((v, i) => {
|
|
2350
|
-
const h = v / maxVal * chartH;
|
|
2372
|
+
const h = Math.max(0, v / maxVal * chartH);
|
|
2351
2373
|
const x = PADDING.left + groupW * i + (groupW - barW * groupCount) / 2 + barW * di;
|
|
2352
2374
|
const y = PADDING.top + chartH - h;
|
|
2353
2375
|
return { x, y, w: barW, h, v };
|
|
@@ -2355,16 +2377,13 @@ var BarChart = import_react5.default.memo(({ data, labels, width, height, onHove
|
|
|
2355
2377
|
),
|
|
2356
2378
|
[entries, maxVal, chartH, groupW, barW, groupCount]
|
|
2357
2379
|
);
|
|
2380
|
+
const barLabelStep = getLabelStep(count, chartW);
|
|
2358
2381
|
return /* @__PURE__ */ (0, import_jsx_runtime305.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, className: "chart-svg", children: [
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
return /* @__PURE__ */ (0, import_jsx_runtime305.
|
|
2363
|
-
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("line", { x1: PADDING.left, y1: y, x2: width - PADDING.right, y2: y, className: "chart-grid" }),
|
|
2364
|
-
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x: PADDING.left - 8, y: y + 4, className: "chart-axis-label", textAnchor: "end", children: val })
|
|
2365
|
-
] }, ratio);
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime305.jsx)(GridLines, { width, height, chartH, maxVal }),
|
|
2383
|
+
labels.map((label, i) => {
|
|
2384
|
+
if (i % barLabelStep !== 0) return null;
|
|
2385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i);
|
|
2366
2386
|
}),
|
|
2367
|
-
labels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime305.jsx)("text", { x: PADDING.left + groupW * i + groupW / 2, y: height - 8, className: "chart-axis-label", textAnchor: "middle", children: label }, i)),
|
|
2368
2387
|
entries.map(([key], di) => {
|
|
2369
2388
|
const palette = getPalette(LINE_BAR_PALETTES, di, key);
|
|
2370
2389
|
const color = palette[2];
|
|
@@ -2544,7 +2563,7 @@ Chip.displayName = "Chip";
|
|
|
2544
2563
|
var Chip_default = Chip;
|
|
2545
2564
|
|
|
2546
2565
|
// src/components/DatePicker/InputDatePicker/index.tsx
|
|
2547
|
-
var
|
|
2566
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2548
2567
|
|
|
2549
2568
|
// src/components/Input/Input.tsx
|
|
2550
2569
|
var import_react6 = __toESM(require("react"), 1);
|
|
@@ -2734,15 +2753,37 @@ PasswordInput.displayName = "PasswordInput";
|
|
|
2734
2753
|
var PasswordInput_default = PasswordInput;
|
|
2735
2754
|
|
|
2736
2755
|
// src/components/Modal/Modal.tsx
|
|
2756
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
2757
|
+
var import_react_dom2 = require("react-dom");
|
|
2758
|
+
|
|
2759
|
+
// src/tokens/hooks/Portal.tsx
|
|
2737
2760
|
var import_react9 = __toESM(require("react"), 1);
|
|
2738
|
-
var import_react_dom = require("react-dom");
|
|
2761
|
+
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
2739
2762
|
var import_jsx_runtime311 = require("react/jsx-runtime");
|
|
2763
|
+
var PortalContainerContext = import_react9.default.createContext(null);
|
|
2764
|
+
var PortalProvider = ({ container, children }) => /* @__PURE__ */ (0, import_jsx_runtime311.jsx)(PortalContainerContext.Provider, { value: container, children });
|
|
2765
|
+
var Portal = ({ children }) => {
|
|
2766
|
+
const contextContainer = import_react9.default.useContext(PortalContainerContext);
|
|
2767
|
+
const [fallback, setFallback] = import_react9.default.useState(null);
|
|
2768
|
+
import_react9.default.useEffect(() => {
|
|
2769
|
+
if (!contextContainer) setFallback(document.body);
|
|
2770
|
+
}, [contextContainer]);
|
|
2771
|
+
const container = contextContainer ?? fallback;
|
|
2772
|
+
if (!container) return null;
|
|
2773
|
+
return import_react_dom.default.createPortal(children, container);
|
|
2774
|
+
};
|
|
2775
|
+
Portal.displayName = "Portal";
|
|
2776
|
+
var Portal_default = Portal;
|
|
2777
|
+
|
|
2778
|
+
// src/components/Modal/Modal.tsx
|
|
2779
|
+
var import_jsx_runtime312 = require("react/jsx-runtime");
|
|
2740
2780
|
var ANIMATION_DURATION_MS = 200;
|
|
2741
2781
|
var Modal = (props) => {
|
|
2742
2782
|
const { isOpen, onClose, children } = props;
|
|
2743
|
-
const [mounted, setMounted] =
|
|
2744
|
-
const [visible, setVisible] =
|
|
2745
|
-
|
|
2783
|
+
const [mounted, setMounted] = import_react10.default.useState(false);
|
|
2784
|
+
const [visible, setVisible] = import_react10.default.useState(false);
|
|
2785
|
+
const boxRef = import_react10.default.useRef(null);
|
|
2786
|
+
import_react10.default.useEffect(() => {
|
|
2746
2787
|
if (isOpen) {
|
|
2747
2788
|
setMounted(true);
|
|
2748
2789
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -2755,20 +2796,21 @@ var Modal = (props) => {
|
|
|
2755
2796
|
if (typeof document === "undefined") return null;
|
|
2756
2797
|
if (!mounted) return null;
|
|
2757
2798
|
const stateClass = visible ? "enter" : "exit";
|
|
2758
|
-
return (0,
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2799
|
+
return (0, import_react_dom2.createPortal)(
|
|
2800
|
+
/* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
2760
2801
|
"div",
|
|
2761
2802
|
{
|
|
2762
2803
|
className: clsx_default("lib-xplat-modal", "dim", stateClass),
|
|
2763
2804
|
onClick: onClose,
|
|
2764
|
-
children: /* @__PURE__ */ (0,
|
|
2805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(
|
|
2765
2806
|
"div",
|
|
2766
2807
|
{
|
|
2808
|
+
ref: boxRef,
|
|
2767
2809
|
className: clsx_default("lib-xplat-modal", "modal-box", stateClass),
|
|
2768
2810
|
role: "dialog",
|
|
2769
2811
|
"aria-modal": "true",
|
|
2770
2812
|
onClick: (e) => e.stopPropagation(),
|
|
2771
|
-
children
|
|
2813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime312.jsx)(PortalProvider, { container: boxRef.current, children })
|
|
2772
2814
|
}
|
|
2773
2815
|
)
|
|
2774
2816
|
}
|
|
@@ -2780,9 +2822,9 @@ Modal.displayName = "Modal";
|
|
|
2780
2822
|
var Modal_default = Modal;
|
|
2781
2823
|
|
|
2782
2824
|
// src/components/DatePicker/SingleDatePicker/index.tsx
|
|
2783
|
-
var
|
|
2784
|
-
var
|
|
2785
|
-
var DayCell2 =
|
|
2825
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2826
|
+
var import_jsx_runtime313 = require("react/jsx-runtime");
|
|
2827
|
+
var DayCell2 = import_react11.default.memo(
|
|
2786
2828
|
({
|
|
2787
2829
|
day,
|
|
2788
2830
|
disabled,
|
|
@@ -2792,7 +2834,7 @@ var DayCell2 = import_react10.default.memo(
|
|
|
2792
2834
|
isEnd,
|
|
2793
2835
|
inRange,
|
|
2794
2836
|
onSelect
|
|
2795
|
-
}) => /* @__PURE__ */ (0,
|
|
2837
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
|
|
2796
2838
|
"button",
|
|
2797
2839
|
{
|
|
2798
2840
|
type: "button",
|
|
@@ -2834,26 +2876,26 @@ var SingleDatePicker = (props) => {
|
|
|
2834
2876
|
initialYear,
|
|
2835
2877
|
initialMonth
|
|
2836
2878
|
);
|
|
2837
|
-
const [pickerMode, setPickerMode] =
|
|
2838
|
-
const [yearRangeStart, setYearRangeStart] =
|
|
2879
|
+
const [pickerMode, setPickerMode] = import_react11.default.useState("days");
|
|
2880
|
+
const [yearRangeStart, setYearRangeStart] = import_react11.default.useState(
|
|
2839
2881
|
Math.floor((initialYear ?? (/* @__PURE__ */ new Date()).getFullYear()) / 12) * 12
|
|
2840
2882
|
);
|
|
2841
|
-
const minTime =
|
|
2883
|
+
const minTime = import_react11.default.useMemo(
|
|
2842
2884
|
() => minDate ? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()).getTime() : -Infinity,
|
|
2843
2885
|
[minDate]
|
|
2844
2886
|
);
|
|
2845
|
-
const maxTime =
|
|
2887
|
+
const maxTime = import_react11.default.useMemo(
|
|
2846
2888
|
() => maxDate ? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()).getTime() : Infinity,
|
|
2847
2889
|
[maxDate]
|
|
2848
2890
|
);
|
|
2849
|
-
const highlightSet =
|
|
2891
|
+
const highlightSet = import_react11.default.useMemo(() => {
|
|
2850
2892
|
const set = /* @__PURE__ */ new Set();
|
|
2851
2893
|
for (const h of highlightDates) {
|
|
2852
2894
|
set.add(`${h.getFullYear()}-${h.getMonth()}-${h.getDate()}`);
|
|
2853
2895
|
}
|
|
2854
2896
|
return set;
|
|
2855
2897
|
}, [highlightDates]);
|
|
2856
|
-
const handleSelect =
|
|
2898
|
+
const handleSelect = import_react11.default.useCallback(
|
|
2857
2899
|
(date) => {
|
|
2858
2900
|
onChange?.(date);
|
|
2859
2901
|
},
|
|
@@ -2890,20 +2932,20 @@ var SingleDatePicker = (props) => {
|
|
|
2890
2932
|
const monthLabels = MONTH_LABELS[locale];
|
|
2891
2933
|
const titleText = pickerMode === "days" ? locale === "ko" ? `${year}\uB144 ${monthLabels[month]}` : `${monthLabels[month]} ${year}` : pickerMode === "months" ? `${year}` : `${yearRangeStart} - ${yearRangeStart + 11}`;
|
|
2892
2934
|
const hasRange = rangeStart != null && rangeEnd != null;
|
|
2893
|
-
return /* @__PURE__ */ (0,
|
|
2935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime313.jsxs)(
|
|
2894
2936
|
"div",
|
|
2895
2937
|
{
|
|
2896
2938
|
className: clsx_default("lib-xplat-datepicker", "single"),
|
|
2897
2939
|
children: [
|
|
2898
|
-
/* @__PURE__ */ (0,
|
|
2899
|
-
/* @__PURE__ */ (0,
|
|
2900
|
-
/* @__PURE__ */ (0,
|
|
2901
|
-
/* @__PURE__ */ (0,
|
|
2940
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsxs)("div", { className: "datepicker-header", children: [
|
|
2941
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsx)("button", { className: "datepicker-nav", onClick: handlePrev, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(ChevronLeftIcon_default, {}) }),
|
|
2942
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsx)("button", { className: "datepicker-title", onClick: handleTitleClick, type: "button", children: titleText }),
|
|
2943
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsx)("button", { className: "datepicker-nav", onClick: handleNext, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(ChevronRightIcon_default, {}) })
|
|
2902
2944
|
] }),
|
|
2903
|
-
/* @__PURE__ */ (0,
|
|
2904
|
-
pickerMode === "years" && /* @__PURE__ */ (0,
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsxs)("div", { className: "datepicker-body", children: [
|
|
2946
|
+
pickerMode === "years" && /* @__PURE__ */ (0, import_jsx_runtime313.jsx)("div", { className: "datepicker-picker-grid", children: Array.from({ length: 12 }, (_, i) => {
|
|
2905
2947
|
const y = yearRangeStart + i;
|
|
2906
|
-
return /* @__PURE__ */ (0,
|
|
2948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
|
|
2907
2949
|
"button",
|
|
2908
2950
|
{
|
|
2909
2951
|
type: "button",
|
|
@@ -2914,7 +2956,7 @@ var SingleDatePicker = (props) => {
|
|
|
2914
2956
|
y
|
|
2915
2957
|
);
|
|
2916
2958
|
}) }),
|
|
2917
|
-
pickerMode === "months" && /* @__PURE__ */ (0,
|
|
2959
|
+
pickerMode === "months" && /* @__PURE__ */ (0, import_jsx_runtime313.jsx)("div", { className: "datepicker-picker-grid", children: monthLabels.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
|
|
2918
2960
|
"button",
|
|
2919
2961
|
{
|
|
2920
2962
|
type: "button",
|
|
@@ -2924,8 +2966,8 @@ var SingleDatePicker = (props) => {
|
|
|
2924
2966
|
},
|
|
2925
2967
|
i
|
|
2926
2968
|
)) }),
|
|
2927
|
-
pickerMode === "days" && /* @__PURE__ */ (0,
|
|
2928
|
-
/* @__PURE__ */ (0,
|
|
2969
|
+
pickerMode === "days" && /* @__PURE__ */ (0, import_jsx_runtime313.jsxs)(import_jsx_runtime313.Fragment, { children: [
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsx)("div", { className: "datepicker-weekdays", children: weekdays.map((label, i) => /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
|
|
2929
2971
|
"div",
|
|
2930
2972
|
{
|
|
2931
2973
|
className: clsx_default(
|
|
@@ -2937,7 +2979,7 @@ var SingleDatePicker = (props) => {
|
|
|
2937
2979
|
},
|
|
2938
2980
|
label
|
|
2939
2981
|
)) }),
|
|
2940
|
-
/* @__PURE__ */ (0,
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime313.jsx)("div", { className: "datepicker-grid", children: days.map((day, idx) => {
|
|
2941
2983
|
const t = day.date.getTime();
|
|
2942
2984
|
const disabled = t < minTime || t > maxTime;
|
|
2943
2985
|
const selected = value ? isSameDay(day.date, value) : false;
|
|
@@ -2947,7 +2989,7 @@ var SingleDatePicker = (props) => {
|
|
|
2947
2989
|
const isStart = hasRange ? isSameDay(day.date, rangeStart) : false;
|
|
2948
2990
|
const isEnd = hasRange ? isSameDay(day.date, rangeEnd) : false;
|
|
2949
2991
|
const inRangeVal = hasRange ? isInRange(day.date, rangeStart, rangeEnd) : false;
|
|
2950
|
-
return /* @__PURE__ */ (0,
|
|
2992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime313.jsx)(
|
|
2951
2993
|
DayCell2,
|
|
2952
2994
|
{
|
|
2953
2995
|
day,
|
|
@@ -2972,7 +3014,7 @@ SingleDatePicker.displayName = "SingleDatePicker";
|
|
|
2972
3014
|
var SingleDatePicker_default = SingleDatePicker;
|
|
2973
3015
|
|
|
2974
3016
|
// src/components/DatePicker/InputDatePicker/index.tsx
|
|
2975
|
-
var
|
|
3017
|
+
var import_jsx_runtime314 = require("react/jsx-runtime");
|
|
2976
3018
|
var formatDate = (date) => {
|
|
2977
3019
|
if (!date || !(date instanceof Date) || isNaN(date.getTime())) return "";
|
|
2978
3020
|
const y = date.getFullYear();
|
|
@@ -2982,8 +3024,8 @@ var formatDate = (date) => {
|
|
|
2982
3024
|
};
|
|
2983
3025
|
var InputDatePicker = (props) => {
|
|
2984
3026
|
const { value, onChange, minDate, maxDate, disabled, locale = "ko", placeholder } = props;
|
|
2985
|
-
const [isOpen, setIsOpen] =
|
|
2986
|
-
const [tempDate, setTempDate] =
|
|
3027
|
+
const [isOpen, setIsOpen] = import_react12.default.useState(false);
|
|
3028
|
+
const [tempDate, setTempDate] = import_react12.default.useState(value ?? /* @__PURE__ */ new Date());
|
|
2987
3029
|
const handleOpen = () => {
|
|
2988
3030
|
if (disabled) return;
|
|
2989
3031
|
setTempDate(value ?? /* @__PURE__ */ new Date());
|
|
@@ -2999,19 +3041,19 @@ var InputDatePicker = (props) => {
|
|
|
2999
3041
|
const handleClose = () => {
|
|
3000
3042
|
setIsOpen(false);
|
|
3001
3043
|
};
|
|
3002
|
-
return /* @__PURE__ */ (0,
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
3044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)("div", { className: clsx_default("lib-xplat-datepicker input-datepicker", disabled && "disabled"), children: [
|
|
3045
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)("div", { className: "input-datepicker-trigger", onClick: handleOpen, children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
3004
3046
|
Input_default,
|
|
3005
3047
|
{
|
|
3006
3048
|
value: formatDate(value),
|
|
3007
3049
|
placeholder,
|
|
3008
|
-
suffix: /* @__PURE__ */ (0,
|
|
3050
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(CalenderIcon_default, {}),
|
|
3009
3051
|
disabled,
|
|
3010
3052
|
readOnly: true
|
|
3011
3053
|
}
|
|
3012
3054
|
) }),
|
|
3013
|
-
/* @__PURE__ */ (0,
|
|
3014
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime314.jsxs)("div", { className: "lib-xplat-popup-datepicker-card", children: [
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)("div", { className: "popup-datepicker-content", children: /* @__PURE__ */ (0, import_jsx_runtime314.jsx)(
|
|
3015
3057
|
SingleDatePicker_default,
|
|
3016
3058
|
{
|
|
3017
3059
|
value: tempDate,
|
|
@@ -3021,9 +3063,9 @@ var InputDatePicker = (props) => {
|
|
|
3021
3063
|
locale
|
|
3022
3064
|
}
|
|
3023
3065
|
) }),
|
|
3024
|
-
/* @__PURE__ */ (0,
|
|
3025
|
-
/* @__PURE__ */ (0,
|
|
3026
|
-
/* @__PURE__ */ (0,
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsxs)("div", { className: "popup-datepicker-footer", children: [
|
|
3067
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)(Button_default, { type: "secondary", onClick: handleClose, children: locale === "ko" ? "\uCDE8\uC18C" : "Cancel" }),
|
|
3068
|
+
/* @__PURE__ */ (0, import_jsx_runtime314.jsx)(Button_default, { type: "primary", onClick: handleApply, children: locale === "ko" ? "\uC801\uC6A9" : "Apply" })
|
|
3027
3069
|
] })
|
|
3028
3070
|
] }) })
|
|
3029
3071
|
] });
|
|
@@ -3032,20 +3074,20 @@ InputDatePicker.displayName = "InputDatePicker";
|
|
|
3032
3074
|
var InputDatePicker_default = InputDatePicker;
|
|
3033
3075
|
|
|
3034
3076
|
// src/components/DatePicker/PopupPicker/index.tsx
|
|
3035
|
-
var
|
|
3077
|
+
var import_react16 = __toESM(require("react"), 1);
|
|
3036
3078
|
|
|
3037
3079
|
// src/components/DatePicker/RangePicker/index.tsx
|
|
3038
|
-
var
|
|
3080
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
3039
3081
|
|
|
3040
3082
|
// src/components/Tab/Tab.tsx
|
|
3041
|
-
var
|
|
3083
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
3042
3084
|
|
|
3043
3085
|
// src/components/Tab/TabItem.tsx
|
|
3044
|
-
var
|
|
3045
|
-
var
|
|
3046
|
-
var TabItem =
|
|
3086
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
3087
|
+
var import_jsx_runtime315 = require("react/jsx-runtime");
|
|
3088
|
+
var TabItem = import_react13.default.forwardRef((props, ref) => {
|
|
3047
3089
|
const { isActive, title, onClick } = props;
|
|
3048
|
-
return /* @__PURE__ */ (0,
|
|
3090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime315.jsx)(
|
|
3049
3091
|
"div",
|
|
3050
3092
|
{
|
|
3051
3093
|
ref,
|
|
@@ -3059,25 +3101,25 @@ TabItem.displayName = "TabItem";
|
|
|
3059
3101
|
var TabItem_default = TabItem;
|
|
3060
3102
|
|
|
3061
3103
|
// src/components/Tab/Tab.tsx
|
|
3062
|
-
var
|
|
3104
|
+
var import_jsx_runtime316 = require("react/jsx-runtime");
|
|
3063
3105
|
var Tab = (props) => {
|
|
3064
3106
|
const { activeIndex, onChange, tabs, type, size = "md" } = props;
|
|
3065
|
-
const [underlineStyle, setUnderlineStyle] =
|
|
3107
|
+
const [underlineStyle, setUnderlineStyle] = import_react14.default.useState({
|
|
3066
3108
|
left: 0,
|
|
3067
3109
|
width: 0
|
|
3068
3110
|
});
|
|
3069
|
-
const itemRefs =
|
|
3111
|
+
const itemRefs = import_react14.default.useRef([]);
|
|
3070
3112
|
const handleChangeActiveTab = (tabItem, tabIdx) => {
|
|
3071
3113
|
onChange(tabItem, tabIdx);
|
|
3072
3114
|
};
|
|
3073
|
-
|
|
3115
|
+
import_react14.default.useEffect(() => {
|
|
3074
3116
|
const el = itemRefs.current[activeIndex];
|
|
3075
3117
|
if (el) {
|
|
3076
3118
|
setUnderlineStyle({ left: el.offsetLeft, width: el.offsetWidth });
|
|
3077
3119
|
}
|
|
3078
3120
|
}, [activeIndex, tabs.length]);
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
3080
|
-
tabs.map((tab, idx) => /* @__PURE__ */ (0,
|
|
3121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime316.jsxs)("div", { className: clsx_default("lib-xplat-tab", `type-${type}`, size), children: [
|
|
3122
|
+
tabs.map((tab, idx) => /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
3081
3123
|
TabItem_default,
|
|
3082
3124
|
{
|
|
3083
3125
|
onClick: () => handleChangeActiveTab(tab, idx),
|
|
@@ -3089,7 +3131,7 @@ var Tab = (props) => {
|
|
|
3089
3131
|
},
|
|
3090
3132
|
`${tab.value}_${idx}`
|
|
3091
3133
|
)),
|
|
3092
|
-
type === "toggle" && /* @__PURE__ */ (0,
|
|
3134
|
+
type === "toggle" && /* @__PURE__ */ (0, import_jsx_runtime316.jsx)(
|
|
3093
3135
|
"div",
|
|
3094
3136
|
{
|
|
3095
3137
|
className: "tab-toggle-underline",
|
|
@@ -3105,7 +3147,7 @@ Tab.displayName = "Tab";
|
|
|
3105
3147
|
var Tab_default = Tab;
|
|
3106
3148
|
|
|
3107
3149
|
// src/components/DatePicker/RangePicker/index.tsx
|
|
3108
|
-
var
|
|
3150
|
+
var import_jsx_runtime317 = require("react/jsx-runtime");
|
|
3109
3151
|
var RangePicker = (props) => {
|
|
3110
3152
|
const {
|
|
3111
3153
|
startDate,
|
|
@@ -3115,7 +3157,7 @@ var RangePicker = (props) => {
|
|
|
3115
3157
|
maxDate,
|
|
3116
3158
|
locale = "ko"
|
|
3117
3159
|
} = props;
|
|
3118
|
-
const [activeTab, setActiveTab] =
|
|
3160
|
+
const [activeTab, setActiveTab] = import_react15.default.useState("start");
|
|
3119
3161
|
const handleStartChange = (date) => {
|
|
3120
3162
|
if (!date) return;
|
|
3121
3163
|
const newStart = date > endDate ? endDate : date;
|
|
@@ -3128,8 +3170,8 @@ var RangePicker = (props) => {
|
|
|
3128
3170
|
};
|
|
3129
3171
|
const startMaxDate = maxDate && endDate < maxDate ? endDate : endDate;
|
|
3130
3172
|
const endMinDate = minDate && startDate > minDate ? startDate : startDate;
|
|
3131
|
-
return /* @__PURE__ */ (0,
|
|
3132
|
-
/* @__PURE__ */ (0,
|
|
3173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime317.jsxs)("div", { className: clsx_default("lib-xplat-datepicker", "range"), children: [
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime317.jsx)("div", { className: "datepicker-range-tabs", children: /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
3133
3175
|
Tab_default,
|
|
3134
3176
|
{
|
|
3135
3177
|
activeIndex: activeTab === "start" ? 0 : 1,
|
|
@@ -3142,8 +3184,8 @@ var RangePicker = (props) => {
|
|
|
3142
3184
|
size: "sm"
|
|
3143
3185
|
}
|
|
3144
3186
|
) }),
|
|
3145
|
-
/* @__PURE__ */ (0,
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3187
|
+
/* @__PURE__ */ (0, import_jsx_runtime317.jsxs)("div", { className: "datepicker-range-panels", children: [
|
|
3188
|
+
/* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
3147
3189
|
SingleDatePicker_default,
|
|
3148
3190
|
{
|
|
3149
3191
|
value: startDate,
|
|
@@ -3155,7 +3197,7 @@ var RangePicker = (props) => {
|
|
|
3155
3197
|
locale
|
|
3156
3198
|
}
|
|
3157
3199
|
),
|
|
3158
|
-
/* @__PURE__ */ (0,
|
|
3200
|
+
/* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
3159
3201
|
SingleDatePicker_default,
|
|
3160
3202
|
{
|
|
3161
3203
|
value: endDate,
|
|
@@ -3168,7 +3210,7 @@ var RangePicker = (props) => {
|
|
|
3168
3210
|
}
|
|
3169
3211
|
)
|
|
3170
3212
|
] }),
|
|
3171
|
-
/* @__PURE__ */ (0,
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime317.jsx)("div", { className: "datepicker-range-mobile", children: activeTab === "start" ? /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
3172
3214
|
SingleDatePicker_default,
|
|
3173
3215
|
{
|
|
3174
3216
|
value: startDate,
|
|
@@ -3179,7 +3221,7 @@ var RangePicker = (props) => {
|
|
|
3179
3221
|
rangeEnd: endDate,
|
|
3180
3222
|
locale
|
|
3181
3223
|
}
|
|
3182
|
-
) : /* @__PURE__ */ (0,
|
|
3224
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime317.jsx)(
|
|
3183
3225
|
SingleDatePicker_default,
|
|
3184
3226
|
{
|
|
3185
3227
|
value: endDate,
|
|
@@ -3197,10 +3239,10 @@ RangePicker.displayName = "RangePicker";
|
|
|
3197
3239
|
var RangePicker_default = RangePicker;
|
|
3198
3240
|
|
|
3199
3241
|
// src/components/DatePicker/PopupPicker/index.tsx
|
|
3200
|
-
var
|
|
3242
|
+
var import_jsx_runtime318 = require("react/jsx-runtime");
|
|
3201
3243
|
var PopupPicker = (props) => {
|
|
3202
3244
|
const { component, type, locale } = props;
|
|
3203
|
-
const [isOpen, setIsOpen] =
|
|
3245
|
+
const [isOpen, setIsOpen] = import_react16.default.useState(false);
|
|
3204
3246
|
const handleClick = () => setIsOpen(true);
|
|
3205
3247
|
const handleClose = () => setIsOpen(false);
|
|
3206
3248
|
const handleSingleChange = (date) => {
|
|
@@ -3208,11 +3250,11 @@ var PopupPicker = (props) => {
|
|
|
3208
3250
|
props.onChange?.(date);
|
|
3209
3251
|
handleClose();
|
|
3210
3252
|
};
|
|
3211
|
-
return /* @__PURE__ */ (0,
|
|
3212
|
-
|
|
3213
|
-
/* @__PURE__ */ (0,
|
|
3214
|
-
/* @__PURE__ */ (0,
|
|
3215
|
-
type === "single" && /* @__PURE__ */ (0,
|
|
3253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)("div", { className: "lib-xplat-popup-datepicker", children: [
|
|
3254
|
+
import_react16.default.cloneElement(component, { onClick: handleClick }),
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime318.jsx)(Modal_default, { isOpen, onClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime318.jsxs)("div", { className: clsx_default("lib-xplat-popup-datepicker-card", type === "range" && "range-mode"), children: [
|
|
3256
|
+
/* @__PURE__ */ (0, import_jsx_runtime318.jsxs)("div", { className: "popup-datepicker-content", children: [
|
|
3257
|
+
type === "single" && /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
|
|
3216
3258
|
SingleDatePicker_default,
|
|
3217
3259
|
{
|
|
3218
3260
|
value: props.value,
|
|
@@ -3222,7 +3264,7 @@ var PopupPicker = (props) => {
|
|
|
3222
3264
|
locale
|
|
3223
3265
|
}
|
|
3224
3266
|
),
|
|
3225
|
-
type === "range" && /* @__PURE__ */ (0,
|
|
3267
|
+
type === "range" && /* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
|
|
3226
3268
|
RangePicker_default,
|
|
3227
3269
|
{
|
|
3228
3270
|
startDate: props.startDate,
|
|
@@ -3234,8 +3276,8 @@ var PopupPicker = (props) => {
|
|
|
3234
3276
|
}
|
|
3235
3277
|
)
|
|
3236
3278
|
] }),
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3279
|
+
/* @__PURE__ */ (0, import_jsx_runtime318.jsxs)("div", { className: "popup-datepicker-footer", children: [
|
|
3280
|
+
/* @__PURE__ */ (0, import_jsx_runtime318.jsx)(
|
|
3239
3281
|
Button_default,
|
|
3240
3282
|
{
|
|
3241
3283
|
type: "secondary",
|
|
@@ -3243,7 +3285,7 @@ var PopupPicker = (props) => {
|
|
|
3243
3285
|
children: locale === "ko" ? "\uCDE8\uC18C" : "Cancel"
|
|
3244
3286
|
}
|
|
3245
3287
|
),
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime318.jsx)(Button_default, { type: "primary", onClick: handleClose, children: locale === "ko" ? "\uC801\uC6A9" : "Apply" })
|
|
3247
3289
|
] })
|
|
3248
3290
|
] }) })
|
|
3249
3291
|
] });
|
|
@@ -3252,10 +3294,10 @@ PopupPicker.displayName = "PopupPicker";
|
|
|
3252
3294
|
var PopupPicker_default = PopupPicker;
|
|
3253
3295
|
|
|
3254
3296
|
// src/components/Divider/Divider.tsx
|
|
3255
|
-
var
|
|
3297
|
+
var import_jsx_runtime319 = require("react/jsx-runtime");
|
|
3256
3298
|
var Divider = (props) => {
|
|
3257
3299
|
const { orientation = "horizontal" } = props;
|
|
3258
|
-
return /* @__PURE__ */ (0,
|
|
3300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime319.jsx)(
|
|
3259
3301
|
"div",
|
|
3260
3302
|
{
|
|
3261
3303
|
className: clsx_default("lib-xplat-divider", orientation),
|
|
@@ -3268,15 +3310,15 @@ Divider.displayName = "Divider";
|
|
|
3268
3310
|
var Divider_default = Divider;
|
|
3269
3311
|
|
|
3270
3312
|
// src/components/Drawer/Drawer.tsx
|
|
3271
|
-
var
|
|
3272
|
-
var
|
|
3273
|
-
var
|
|
3313
|
+
var import_react17 = __toESM(require("react"), 1);
|
|
3314
|
+
var import_react_dom3 = require("react-dom");
|
|
3315
|
+
var import_jsx_runtime320 = require("react/jsx-runtime");
|
|
3274
3316
|
var ANIMATION_DURATION_MS2 = 250;
|
|
3275
3317
|
var Drawer = (props) => {
|
|
3276
3318
|
const { isOpen, onClose, placement = "right", width = 320, title, children } = props;
|
|
3277
|
-
const [mounted, setMounted] =
|
|
3278
|
-
const [visible, setVisible] =
|
|
3279
|
-
|
|
3319
|
+
const [mounted, setMounted] = import_react17.default.useState(false);
|
|
3320
|
+
const [visible, setVisible] = import_react17.default.useState(false);
|
|
3321
|
+
import_react17.default.useEffect(() => {
|
|
3280
3322
|
if (isOpen) {
|
|
3281
3323
|
setMounted(true);
|
|
3282
3324
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -3290,13 +3332,13 @@ var Drawer = (props) => {
|
|
|
3290
3332
|
if (!mounted) return null;
|
|
3291
3333
|
const stateClass = visible ? "enter" : "exit";
|
|
3292
3334
|
const widthValue = typeof width === "number" ? `${width}px` : width;
|
|
3293
|
-
return (0,
|
|
3294
|
-
/* @__PURE__ */ (0,
|
|
3335
|
+
return (0, import_react_dom3.createPortal)(
|
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)(
|
|
3295
3337
|
"div",
|
|
3296
3338
|
{
|
|
3297
3339
|
className: clsx_default("lib-xplat-drawer-overlay", stateClass),
|
|
3298
3340
|
onClick: onClose,
|
|
3299
|
-
children: /* @__PURE__ */ (0,
|
|
3341
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)(
|
|
3300
3342
|
"div",
|
|
3301
3343
|
{
|
|
3302
3344
|
className: clsx_default("lib-xplat-drawer", placement, stateClass),
|
|
@@ -3305,11 +3347,11 @@ var Drawer = (props) => {
|
|
|
3305
3347
|
"aria-modal": "true",
|
|
3306
3348
|
onClick: (e) => e.stopPropagation(),
|
|
3307
3349
|
children: [
|
|
3308
|
-
title && /* @__PURE__ */ (0,
|
|
3309
|
-
/* @__PURE__ */ (0,
|
|
3310
|
-
/* @__PURE__ */ (0,
|
|
3350
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime320.jsxs)("div", { className: "drawer-header", children: [
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)("span", { className: "drawer-title", children: title }),
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
3311
3353
|
] }),
|
|
3312
|
-
/* @__PURE__ */ (0,
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime320.jsx)("div", { className: "drawer-body", children })
|
|
3313
3355
|
]
|
|
3314
3356
|
}
|
|
3315
3357
|
)
|
|
@@ -3322,50 +3364,60 @@ Drawer.displayName = "Drawer";
|
|
|
3322
3364
|
var Drawer_default = Drawer;
|
|
3323
3365
|
|
|
3324
3366
|
// src/components/Dropdown/Dropdown.tsx
|
|
3325
|
-
var
|
|
3367
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
3326
3368
|
|
|
3327
3369
|
// src/tokens/hooks/useAutoPosition.ts
|
|
3328
|
-
var
|
|
3370
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
3329
3371
|
var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
3330
|
-
const [position, setPosition] =
|
|
3372
|
+
const [position, setPosition] = import_react18.default.useState({
|
|
3331
3373
|
position: {},
|
|
3332
3374
|
direction: "bottom"
|
|
3333
3375
|
});
|
|
3334
|
-
const calculatePosition =
|
|
3376
|
+
const calculatePosition = import_react18.default.useCallback(() => {
|
|
3335
3377
|
if (!triggerRef.current || !popRef.current) return;
|
|
3336
3378
|
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
3337
3379
|
const popRect = popRef.current.getBoundingClientRect();
|
|
3338
|
-
const viewportWidth = window.innerWidth;
|
|
3339
3380
|
const viewportHeight = window.innerHeight;
|
|
3340
|
-
const
|
|
3381
|
+
const viewportWidth = window.innerWidth;
|
|
3341
3382
|
let direction = "bottom";
|
|
3342
|
-
|
|
3383
|
+
let top;
|
|
3384
|
+
let left = triggerRect.left;
|
|
3385
|
+
if (triggerRect.bottom + popRect.height > viewportHeight && triggerRect.top - popRect.height > 0) {
|
|
3343
3386
|
direction = "top";
|
|
3387
|
+
top = triggerRect.top - popRect.height;
|
|
3388
|
+
} else {
|
|
3389
|
+
top = triggerRect.bottom;
|
|
3344
3390
|
}
|
|
3345
|
-
if (
|
|
3346
|
-
|
|
3347
|
-
}
|
|
3348
|
-
if (triggerRect.left < 0) {
|
|
3349
|
-
position2["left"] = 10;
|
|
3391
|
+
if (left + popRect.width > viewportWidth) {
|
|
3392
|
+
left = viewportWidth - popRect.width - 8;
|
|
3350
3393
|
}
|
|
3394
|
+
if (left < 8) left = 8;
|
|
3351
3395
|
setPosition({
|
|
3352
|
-
position:
|
|
3396
|
+
position: { top, left, width: triggerRect.width },
|
|
3353
3397
|
direction
|
|
3354
3398
|
});
|
|
3355
3399
|
}, [triggerRef, popRef]);
|
|
3356
|
-
|
|
3357
|
-
|
|
3400
|
+
import_react18.default.useEffect(() => {
|
|
3401
|
+
if (!enabled) return;
|
|
3402
|
+
const raf = requestAnimationFrame(() => {
|
|
3403
|
+
calculatePosition();
|
|
3404
|
+
});
|
|
3358
3405
|
window.addEventListener("resize", calculatePosition);
|
|
3359
|
-
|
|
3406
|
+
window.addEventListener("scroll", calculatePosition, true);
|
|
3407
|
+
return () => {
|
|
3408
|
+
cancelAnimationFrame(raf);
|
|
3409
|
+
window.removeEventListener("resize", calculatePosition);
|
|
3410
|
+
window.removeEventListener("scroll", calculatePosition, true);
|
|
3411
|
+
};
|
|
3360
3412
|
}, [calculatePosition, enabled]);
|
|
3361
3413
|
return position;
|
|
3362
3414
|
};
|
|
3363
3415
|
var useAutoPosition_default = useAutoPosition;
|
|
3364
3416
|
|
|
3365
3417
|
// src/tokens/hooks/useClickOutside.ts
|
|
3366
|
-
var
|
|
3418
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
3367
3419
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
3368
|
-
|
|
3420
|
+
import_react19.default.useEffect(() => {
|
|
3369
3421
|
if (!enabled) return;
|
|
3370
3422
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
3371
3423
|
const listener = (event) => {
|
|
@@ -3388,17 +3440,17 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
3388
3440
|
var useClickOutside_default = useClickOutside;
|
|
3389
3441
|
|
|
3390
3442
|
// src/components/Dropdown/Dropdown.tsx
|
|
3391
|
-
var
|
|
3443
|
+
var import_jsx_runtime321 = require("react/jsx-runtime");
|
|
3392
3444
|
var Dropdown = (props) => {
|
|
3393
3445
|
const { items, children } = props;
|
|
3394
|
-
const [isOpen, setIsOpen] =
|
|
3395
|
-
const [mounted, setMounted] =
|
|
3396
|
-
const [visible, setVisible] =
|
|
3397
|
-
const triggerRef =
|
|
3398
|
-
const menuRef =
|
|
3399
|
-
const { position, direction } = useAutoPosition_default(triggerRef, menuRef,
|
|
3400
|
-
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false));
|
|
3401
|
-
|
|
3446
|
+
const [isOpen, setIsOpen] = import_react20.default.useState(false);
|
|
3447
|
+
const [mounted, setMounted] = import_react20.default.useState(false);
|
|
3448
|
+
const [visible, setVisible] = import_react20.default.useState(false);
|
|
3449
|
+
const triggerRef = import_react20.default.useRef(null);
|
|
3450
|
+
const menuRef = import_react20.default.useRef(null);
|
|
3451
|
+
const { position, direction } = useAutoPosition_default(triggerRef, menuRef, mounted);
|
|
3452
|
+
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false), isOpen);
|
|
3453
|
+
import_react20.default.useEffect(() => {
|
|
3402
3454
|
if (isOpen) {
|
|
3403
3455
|
setMounted(true);
|
|
3404
3456
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -3413,8 +3465,8 @@ var Dropdown = (props) => {
|
|
|
3413
3465
|
item.onClick?.();
|
|
3414
3466
|
setIsOpen(false);
|
|
3415
3467
|
};
|
|
3416
|
-
return /* @__PURE__ */ (0,
|
|
3417
|
-
/* @__PURE__ */ (0,
|
|
3468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)("div", { className: "lib-xplat-dropdown", children: [
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3418
3470
|
"div",
|
|
3419
3471
|
{
|
|
3420
3472
|
ref: triggerRef,
|
|
@@ -3423,14 +3475,14 @@ var Dropdown = (props) => {
|
|
|
3423
3475
|
children
|
|
3424
3476
|
}
|
|
3425
3477
|
),
|
|
3426
|
-
mounted && /* @__PURE__ */ (0,
|
|
3478
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3427
3479
|
"div",
|
|
3428
3480
|
{
|
|
3429
3481
|
ref: menuRef,
|
|
3430
|
-
className: clsx_default("dropdown-menu", direction, { visible }),
|
|
3482
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
3431
3483
|
style: { top: position.top, left: position.left },
|
|
3432
3484
|
role: "menu",
|
|
3433
|
-
children: items.map((item) => /* @__PURE__ */ (0,
|
|
3485
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3434
3486
|
"button",
|
|
3435
3487
|
{
|
|
3436
3488
|
className: clsx_default("dropdown-item", {
|
|
@@ -3445,30 +3497,30 @@ var Dropdown = (props) => {
|
|
|
3445
3497
|
item.key
|
|
3446
3498
|
))
|
|
3447
3499
|
}
|
|
3448
|
-
)
|
|
3500
|
+
) })
|
|
3449
3501
|
] });
|
|
3450
3502
|
};
|
|
3451
3503
|
Dropdown.displayName = "Dropdown";
|
|
3452
3504
|
var Dropdown_default = Dropdown;
|
|
3453
3505
|
|
|
3454
3506
|
// src/components/EmptyState/EmptyState.tsx
|
|
3455
|
-
var
|
|
3507
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
3456
3508
|
var EmptyState = (props) => {
|
|
3457
3509
|
const { icon, title = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4", description, action } = props;
|
|
3458
|
-
return /* @__PURE__ */ (0,
|
|
3459
|
-
icon && /* @__PURE__ */ (0,
|
|
3460
|
-
!icon && /* @__PURE__ */ (0,
|
|
3461
|
-
/* @__PURE__ */ (0,
|
|
3462
|
-
description && /* @__PURE__ */ (0,
|
|
3463
|
-
action && /* @__PURE__ */ (0,
|
|
3510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime322.jsxs)("div", { className: "lib-xplat-empty-state", children: [
|
|
3511
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: "empty-icon", children: icon }),
|
|
3512
|
+
!icon && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: "empty-icon", children: /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime322.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" }) }) }),
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime322.jsx)("p", { className: "empty-title", children: title }),
|
|
3514
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("p", { className: "empty-description", children: description }),
|
|
3515
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime322.jsx)("div", { className: "empty-action", children: action })
|
|
3464
3516
|
] });
|
|
3465
3517
|
};
|
|
3466
3518
|
EmptyState.displayName = "EmptyState";
|
|
3467
3519
|
var EmptyState_default = EmptyState;
|
|
3468
3520
|
|
|
3469
3521
|
// src/components/FileUpload/FileUpload.tsx
|
|
3470
|
-
var
|
|
3471
|
-
var
|
|
3522
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
3523
|
+
var import_jsx_runtime323 = require("react/jsx-runtime");
|
|
3472
3524
|
var FileUpload = (props) => {
|
|
3473
3525
|
const {
|
|
3474
3526
|
accept,
|
|
@@ -3478,8 +3530,8 @@ var FileUpload = (props) => {
|
|
|
3478
3530
|
label = "\uD30C\uC77C\uC744 \uB4DC\uB798\uADF8\uD558\uAC70\uB098 \uD074\uB9AD\uD558\uC5EC \uC5C5\uB85C\uB4DC",
|
|
3479
3531
|
description
|
|
3480
3532
|
} = props;
|
|
3481
|
-
const [isDragOver, setIsDragOver] =
|
|
3482
|
-
const inputRef =
|
|
3533
|
+
const [isDragOver, setIsDragOver] = import_react21.default.useState(false);
|
|
3534
|
+
const inputRef = import_react21.default.useRef(null);
|
|
3483
3535
|
const handleFiles = (fileList) => {
|
|
3484
3536
|
let files = Array.from(fileList);
|
|
3485
3537
|
if (maxSize) {
|
|
@@ -3509,7 +3561,7 @@ var FileUpload = (props) => {
|
|
|
3509
3561
|
handleFiles(e.target.files);
|
|
3510
3562
|
}
|
|
3511
3563
|
};
|
|
3512
|
-
return /* @__PURE__ */ (0,
|
|
3564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
3513
3565
|
"div",
|
|
3514
3566
|
{
|
|
3515
3567
|
className: clsx_default("lib-xplat-file-upload", { "drag-over": isDragOver }),
|
|
@@ -3518,7 +3570,7 @@ var FileUpload = (props) => {
|
|
|
3518
3570
|
onDragLeave: handleDragLeave,
|
|
3519
3571
|
onClick: () => inputRef.current?.click(),
|
|
3520
3572
|
children: [
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
|
|
3522
3574
|
"input",
|
|
3523
3575
|
{
|
|
3524
3576
|
ref: inputRef,
|
|
@@ -3528,9 +3580,9 @@ var FileUpload = (props) => {
|
|
|
3528
3580
|
onChange: handleChange
|
|
3529
3581
|
}
|
|
3530
3582
|
),
|
|
3531
|
-
/* @__PURE__ */ (0,
|
|
3532
|
-
/* @__PURE__ */ (0,
|
|
3533
|
-
description && /* @__PURE__ */ (0,
|
|
3583
|
+
/* @__PURE__ */ (0, import_jsx_runtime323.jsx)("div", { className: "upload-icon", children: /* @__PURE__ */ (0, import_jsx_runtime323.jsx)(UploadIcon_default, {}) }),
|
|
3584
|
+
/* @__PURE__ */ (0, import_jsx_runtime323.jsx)("p", { className: "upload-label", children: label }),
|
|
3585
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime323.jsx)("p", { className: "upload-description", children: description })
|
|
3534
3586
|
]
|
|
3535
3587
|
}
|
|
3536
3588
|
);
|
|
@@ -3539,10 +3591,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
3539
3591
|
var FileUpload_default = FileUpload;
|
|
3540
3592
|
|
|
3541
3593
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
3542
|
-
var
|
|
3594
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
3543
3595
|
|
|
3544
3596
|
// src/components/HtmlTypeWriter/utils.ts
|
|
3545
|
-
var
|
|
3597
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3546
3598
|
var voidTags = /* @__PURE__ */ new Set([
|
|
3547
3599
|
"br",
|
|
3548
3600
|
"img",
|
|
@@ -3610,41 +3662,41 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
3610
3662
|
props[attr.name] = attr.value;
|
|
3611
3663
|
});
|
|
3612
3664
|
if (voidTags.has(tag)) {
|
|
3613
|
-
return
|
|
3665
|
+
return import_react22.default.createElement(tag, props);
|
|
3614
3666
|
}
|
|
3615
3667
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
3616
|
-
return
|
|
3668
|
+
return import_react22.default.createElement(tag, props, ...children);
|
|
3617
3669
|
};
|
|
3618
3670
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
3619
3671
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
3620
3672
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
3621
|
-
return node == null ? null :
|
|
3673
|
+
return node == null ? null : import_react22.default.createElement(import_react22.default.Fragment, { key: idx }, node);
|
|
3622
3674
|
}).filter(Boolean);
|
|
3623
3675
|
return nodes.length === 0 ? null : nodes;
|
|
3624
3676
|
};
|
|
3625
3677
|
|
|
3626
3678
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
3627
|
-
var
|
|
3679
|
+
var import_jsx_runtime324 = require("react/jsx-runtime");
|
|
3628
3680
|
var HtmlTypeWriter = ({
|
|
3629
3681
|
html,
|
|
3630
3682
|
duration = 20,
|
|
3631
3683
|
onDone,
|
|
3632
3684
|
onChange
|
|
3633
3685
|
}) => {
|
|
3634
|
-
const [typedLen, setTypedLen] =
|
|
3635
|
-
const doneCalledRef =
|
|
3636
|
-
const { doc, rangeMap, totalLength } =
|
|
3686
|
+
const [typedLen, setTypedLen] = import_react23.default.useState(0);
|
|
3687
|
+
const doneCalledRef = import_react23.default.useRef(false);
|
|
3688
|
+
const { doc, rangeMap, totalLength } = import_react23.default.useMemo(() => {
|
|
3637
3689
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
3638
3690
|
const decoded = decodeHtmlEntities(html);
|
|
3639
3691
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
3640
3692
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
3641
3693
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
3642
3694
|
}, [html]);
|
|
3643
|
-
|
|
3695
|
+
import_react23.default.useEffect(() => {
|
|
3644
3696
|
setTypedLen(0);
|
|
3645
3697
|
doneCalledRef.current = false;
|
|
3646
3698
|
}, [html]);
|
|
3647
|
-
|
|
3699
|
+
import_react23.default.useEffect(() => {
|
|
3648
3700
|
if (!totalLength) return;
|
|
3649
3701
|
if (typedLen >= totalLength) return;
|
|
3650
3702
|
const timer = window.setInterval(() => {
|
|
@@ -3652,33 +3704,33 @@ var HtmlTypeWriter = ({
|
|
|
3652
3704
|
}, duration);
|
|
3653
3705
|
return () => window.clearInterval(timer);
|
|
3654
3706
|
}, [typedLen, totalLength, duration]);
|
|
3655
|
-
|
|
3707
|
+
import_react23.default.useEffect(() => {
|
|
3656
3708
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
3657
3709
|
onChange?.();
|
|
3658
3710
|
}
|
|
3659
3711
|
}, [typedLen, totalLength, onChange]);
|
|
3660
|
-
|
|
3712
|
+
import_react23.default.useEffect(() => {
|
|
3661
3713
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
3662
3714
|
doneCalledRef.current = true;
|
|
3663
3715
|
onDone?.();
|
|
3664
3716
|
}
|
|
3665
3717
|
}, [typedLen, totalLength, onDone]);
|
|
3666
|
-
const parsed =
|
|
3718
|
+
const parsed = import_react23.default.useMemo(
|
|
3667
3719
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
3668
3720
|
[doc, typedLen, rangeMap]
|
|
3669
3721
|
);
|
|
3670
|
-
return /* @__PURE__ */ (0,
|
|
3722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "lib-xplat-htmlTypewriter", children: parsed });
|
|
3671
3723
|
};
|
|
3672
3724
|
HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
3673
3725
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
3674
3726
|
|
|
3675
3727
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
3676
|
-
var
|
|
3677
|
-
var
|
|
3728
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
3729
|
+
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
3678
3730
|
var ImageSelector = (props) => {
|
|
3679
3731
|
const { value, label, onChange } = props;
|
|
3680
|
-
const [previewUrl, setPreviewUrl] =
|
|
3681
|
-
|
|
3732
|
+
const [previewUrl, setPreviewUrl] = import_react24.default.useState();
|
|
3733
|
+
import_react24.default.useEffect(() => {
|
|
3682
3734
|
if (!value) {
|
|
3683
3735
|
setPreviewUrl(void 0);
|
|
3684
3736
|
return;
|
|
@@ -3687,7 +3739,7 @@ var ImageSelector = (props) => {
|
|
|
3687
3739
|
setPreviewUrl(url);
|
|
3688
3740
|
return () => URL.revokeObjectURL(url);
|
|
3689
3741
|
}, [value]);
|
|
3690
|
-
const inputRef =
|
|
3742
|
+
const inputRef = import_react24.default.useRef(null);
|
|
3691
3743
|
const handleFileChange = (e) => {
|
|
3692
3744
|
const selectedFile = e.target.files?.[0];
|
|
3693
3745
|
if (selectedFile) {
|
|
@@ -3700,8 +3752,8 @@ var ImageSelector = (props) => {
|
|
|
3700
3752
|
const handleOpenFileDialog = () => {
|
|
3701
3753
|
inputRef.current?.click();
|
|
3702
3754
|
};
|
|
3703
|
-
return /* @__PURE__ */ (0,
|
|
3704
|
-
/* @__PURE__ */ (0,
|
|
3755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime325.jsxs)("div", { className: `lib-xplat-imageselector${value ? "" : " none-value"}`, children: [
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)(
|
|
3705
3757
|
"input",
|
|
3706
3758
|
{
|
|
3707
3759
|
type: "file",
|
|
@@ -3711,13 +3763,13 @@ var ImageSelector = (props) => {
|
|
|
3711
3763
|
ref: inputRef
|
|
3712
3764
|
}
|
|
3713
3765
|
),
|
|
3714
|
-
value && /* @__PURE__ */ (0,
|
|
3715
|
-
/* @__PURE__ */ (0,
|
|
3716
|
-
/* @__PURE__ */ (0,
|
|
3766
|
+
value && /* @__PURE__ */ (0, import_jsx_runtime325.jsxs)("div", { className: "action-bar", children: [
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "icon-wrapper", onClick: handleOpenFileDialog, children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)(UploadIcon_default, {}) }),
|
|
3768
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "icon-wrapper", onClick: handleDeleteFile, children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)(DeleteIcon_default, {}) })
|
|
3717
3769
|
] }),
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
3770
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "content", children: previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime325.jsx)("img", { src: previewUrl, alt: "preview" }) : /* @__PURE__ */ (0, import_jsx_runtime325.jsxs)("div", { className: "skeleton", onClick: handleOpenFileDialog, children: [
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "icon-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime325.jsx)(ImageIcon_default, {}) }),
|
|
3772
|
+
/* @__PURE__ */ (0, import_jsx_runtime325.jsx)("div", { className: "label", children: label || "\uC774\uBBF8\uC9C0 \uCD94\uAC00\uD558\uAE30" })
|
|
3721
3773
|
] }) })
|
|
3722
3774
|
] });
|
|
3723
3775
|
};
|
|
@@ -3725,7 +3777,7 @@ ImageSelector.displayName = "ImageSelector";
|
|
|
3725
3777
|
var ImageSelector_default = ImageSelector;
|
|
3726
3778
|
|
|
3727
3779
|
// src/components/Pagination/Pagination.tsx
|
|
3728
|
-
var
|
|
3780
|
+
var import_jsx_runtime326 = require("react/jsx-runtime");
|
|
3729
3781
|
var getPageRange = (current, totalPages, siblingCount) => {
|
|
3730
3782
|
const totalNumbers = siblingCount * 2 + 5;
|
|
3731
3783
|
if (totalPages <= totalNumbers) {
|
|
@@ -3768,19 +3820,19 @@ var Pagination = (props) => {
|
|
|
3768
3820
|
onChange?.(page);
|
|
3769
3821
|
}
|
|
3770
3822
|
};
|
|
3771
|
-
return /* @__PURE__ */ (0,
|
|
3772
|
-
/* @__PURE__ */ (0,
|
|
3823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime326.jsxs)("nav", { className: clsx_default("lib-xplat-pagination", size, type), "aria-label": "\uD398\uC774\uC9C0 \uB124\uBE44\uAC8C\uC774\uC158", children: [
|
|
3824
|
+
/* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
|
|
3773
3825
|
"button",
|
|
3774
3826
|
{
|
|
3775
3827
|
className: "page-btn prev",
|
|
3776
3828
|
disabled: current <= 1,
|
|
3777
3829
|
onClick: () => handleClick(current - 1),
|
|
3778
3830
|
"aria-label": "\uC774\uC804 \uD398\uC774\uC9C0",
|
|
3779
|
-
children: /* @__PURE__ */ (0,
|
|
3831
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(ChevronLeftIcon_default, {})
|
|
3780
3832
|
}
|
|
3781
3833
|
),
|
|
3782
3834
|
pages.map(
|
|
3783
|
-
(page, i) => page === "..." ? /* @__PURE__ */ (0,
|
|
3835
|
+
(page, i) => page === "..." ? /* @__PURE__ */ (0, import_jsx_runtime326.jsx)("span", { className: "dots", children: "..." }, `dots-${i}`) : /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
|
|
3784
3836
|
"button",
|
|
3785
3837
|
{
|
|
3786
3838
|
className: clsx_default("page-btn", { active: page === current }),
|
|
@@ -3791,14 +3843,14 @@ var Pagination = (props) => {
|
|
|
3791
3843
|
page
|
|
3792
3844
|
)
|
|
3793
3845
|
),
|
|
3794
|
-
/* @__PURE__ */ (0,
|
|
3846
|
+
/* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
|
|
3795
3847
|
"button",
|
|
3796
3848
|
{
|
|
3797
3849
|
className: "page-btn next",
|
|
3798
3850
|
disabled: current >= totalPages,
|
|
3799
3851
|
onClick: () => handleClick(current + 1),
|
|
3800
3852
|
"aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
3801
|
-
children: /* @__PURE__ */ (0,
|
|
3853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(ChevronRightIcon_default, {})
|
|
3802
3854
|
}
|
|
3803
3855
|
)
|
|
3804
3856
|
] });
|
|
@@ -3807,17 +3859,17 @@ Pagination.displayName = "Pagination";
|
|
|
3807
3859
|
var Pagination_default = Pagination;
|
|
3808
3860
|
|
|
3809
3861
|
// src/components/PopOver/PopOver.tsx
|
|
3810
|
-
var
|
|
3811
|
-
var
|
|
3862
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
3863
|
+
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
3812
3864
|
var PopOver = (props) => {
|
|
3813
3865
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
3814
|
-
const popRef =
|
|
3815
|
-
const triggerRef =
|
|
3816
|
-
const [localOpen, setLocalOpen] =
|
|
3817
|
-
const [eventTrigger, setEventTrigger] =
|
|
3866
|
+
const popRef = import_react25.default.useRef(null);
|
|
3867
|
+
const triggerRef = import_react25.default.useRef(null);
|
|
3868
|
+
const [localOpen, setLocalOpen] = import_react25.default.useState(false);
|
|
3869
|
+
const [eventTrigger, setEventTrigger] = import_react25.default.useState(false);
|
|
3818
3870
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
3819
3871
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
3820
|
-
|
|
3872
|
+
import_react25.default.useEffect(() => {
|
|
3821
3873
|
if (isOpen) {
|
|
3822
3874
|
setLocalOpen(isOpen);
|
|
3823
3875
|
setTimeout(() => {
|
|
@@ -3830,7 +3882,7 @@ var PopOver = (props) => {
|
|
|
3830
3882
|
}, 200);
|
|
3831
3883
|
}
|
|
3832
3884
|
}, [isOpen]);
|
|
3833
|
-
return /* @__PURE__ */ (0,
|
|
3885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)(
|
|
3834
3886
|
"div",
|
|
3835
3887
|
{
|
|
3836
3888
|
className: "lib-xplat-pop-over",
|
|
@@ -3840,11 +3892,11 @@ var PopOver = (props) => {
|
|
|
3840
3892
|
},
|
|
3841
3893
|
children: [
|
|
3842
3894
|
children,
|
|
3843
|
-
localOpen && /* @__PURE__ */ (0,
|
|
3895
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
|
|
3844
3896
|
"div",
|
|
3845
3897
|
{
|
|
3846
3898
|
className: clsx_default(
|
|
3847
|
-
"content
|
|
3899
|
+
"lib-xplat-pop-over-content",
|
|
3848
3900
|
position.direction,
|
|
3849
3901
|
eventTrigger && "visible"
|
|
3850
3902
|
),
|
|
@@ -3854,7 +3906,7 @@ var PopOver = (props) => {
|
|
|
3854
3906
|
},
|
|
3855
3907
|
children: PopOverEl
|
|
3856
3908
|
}
|
|
3857
|
-
)
|
|
3909
|
+
) })
|
|
3858
3910
|
]
|
|
3859
3911
|
}
|
|
3860
3912
|
);
|
|
@@ -3863,7 +3915,7 @@ PopOver.displayName = "PopOver";
|
|
|
3863
3915
|
var PopOver_default = PopOver;
|
|
3864
3916
|
|
|
3865
3917
|
// src/components/Progress/Progress.tsx
|
|
3866
|
-
var
|
|
3918
|
+
var import_jsx_runtime328 = require("react/jsx-runtime");
|
|
3867
3919
|
var Progress = (props) => {
|
|
3868
3920
|
const {
|
|
3869
3921
|
value,
|
|
@@ -3873,8 +3925,8 @@ var Progress = (props) => {
|
|
|
3873
3925
|
showLabel = false
|
|
3874
3926
|
} = props;
|
|
3875
3927
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
3876
|
-
return /* @__PURE__ */ (0,
|
|
3877
|
-
/* @__PURE__ */ (0,
|
|
3928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("div", { className: clsx_default("lib-xplat-progress", size, type), children: [
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
3878
3930
|
"div",
|
|
3879
3931
|
{
|
|
3880
3932
|
className: "track",
|
|
@@ -3882,7 +3934,7 @@ var Progress = (props) => {
|
|
|
3882
3934
|
"aria-valuenow": value,
|
|
3883
3935
|
"aria-valuemin": 0,
|
|
3884
3936
|
"aria-valuemax": max,
|
|
3885
|
-
children: /* @__PURE__ */ (0,
|
|
3937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
3886
3938
|
"div",
|
|
3887
3939
|
{
|
|
3888
3940
|
className: "bar",
|
|
@@ -3891,7 +3943,7 @@ var Progress = (props) => {
|
|
|
3891
3943
|
)
|
|
3892
3944
|
}
|
|
3893
3945
|
),
|
|
3894
|
-
showLabel && /* @__PURE__ */ (0,
|
|
3946
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("span", { className: "label", children: [
|
|
3895
3947
|
Math.round(percentage),
|
|
3896
3948
|
"%"
|
|
3897
3949
|
] })
|
|
@@ -3901,17 +3953,17 @@ Progress.displayName = "Progress";
|
|
|
3901
3953
|
var Progress_default = Progress;
|
|
3902
3954
|
|
|
3903
3955
|
// src/components/Radio/RadioGroupContext.tsx
|
|
3904
|
-
var
|
|
3905
|
-
var RadioGroupContext =
|
|
3956
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
3957
|
+
var RadioGroupContext = import_react26.default.createContext(
|
|
3906
3958
|
null
|
|
3907
3959
|
);
|
|
3908
3960
|
var useRadioGroupContext = () => {
|
|
3909
|
-
return
|
|
3961
|
+
return import_react26.default.useContext(RadioGroupContext);
|
|
3910
3962
|
};
|
|
3911
3963
|
var RadioGroupContext_default = RadioGroupContext;
|
|
3912
3964
|
|
|
3913
3965
|
// src/components/Radio/Radio.tsx
|
|
3914
|
-
var
|
|
3966
|
+
var import_jsx_runtime329 = require("react/jsx-runtime");
|
|
3915
3967
|
var Radio = (props) => {
|
|
3916
3968
|
const {
|
|
3917
3969
|
label,
|
|
@@ -3929,7 +3981,7 @@ var Radio = (props) => {
|
|
|
3929
3981
|
value,
|
|
3930
3982
|
onChange: rest.onChange
|
|
3931
3983
|
};
|
|
3932
|
-
return /* @__PURE__ */ (0,
|
|
3984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(
|
|
3933
3985
|
"label",
|
|
3934
3986
|
{
|
|
3935
3987
|
className: clsx_default(
|
|
@@ -3939,18 +3991,18 @@ var Radio = (props) => {
|
|
|
3939
3991
|
localChecked ? "checked" : void 0
|
|
3940
3992
|
),
|
|
3941
3993
|
children: [
|
|
3942
|
-
/* @__PURE__ */ (0,
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime329.jsx)("input", { ...rest, ...inputProps, checked: localChecked, type: "radio" }),
|
|
3995
|
+
/* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
|
|
3944
3996
|
"div",
|
|
3945
3997
|
{
|
|
3946
3998
|
className: clsx_default(
|
|
3947
3999
|
"circle",
|
|
3948
4000
|
localChecked ? "checked" : void 0
|
|
3949
4001
|
),
|
|
3950
|
-
children: localChecked && /* @__PURE__ */ (0,
|
|
4002
|
+
children: localChecked && /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("div", { className: "inner-circle" })
|
|
3951
4003
|
}
|
|
3952
4004
|
),
|
|
3953
|
-
label && /* @__PURE__ */ (0,
|
|
4005
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("span", { children: label })
|
|
3954
4006
|
]
|
|
3955
4007
|
}
|
|
3956
4008
|
);
|
|
@@ -3959,28 +4011,28 @@ Radio.displayName = "Radio";
|
|
|
3959
4011
|
var Radio_default = Radio;
|
|
3960
4012
|
|
|
3961
4013
|
// src/components/Radio/RadioGroup.tsx
|
|
3962
|
-
var
|
|
4014
|
+
var import_jsx_runtime330 = require("react/jsx-runtime");
|
|
3963
4015
|
var RadioGroup = (props) => {
|
|
3964
4016
|
const { children, ...rest } = props;
|
|
3965
|
-
return /* @__PURE__ */ (0,
|
|
4017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(import_jsx_runtime330.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime330.jsx)(RadioGroupContext_default.Provider, { value: rest, children }) });
|
|
3966
4018
|
};
|
|
3967
4019
|
RadioGroup.displayName = "RadioGroup";
|
|
3968
4020
|
var RadioGroup_default = RadioGroup;
|
|
3969
4021
|
|
|
3970
4022
|
// src/components/Select/Select.tsx
|
|
3971
|
-
var
|
|
4023
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
3972
4024
|
|
|
3973
4025
|
// src/components/Select/context.ts
|
|
3974
|
-
var
|
|
3975
|
-
var SelectContext =
|
|
4026
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
4027
|
+
var SelectContext = import_react27.default.createContext(null);
|
|
3976
4028
|
var context_default = SelectContext;
|
|
3977
4029
|
|
|
3978
4030
|
// src/components/Select/SelectItem.tsx
|
|
3979
|
-
var
|
|
3980
|
-
var
|
|
4031
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
4032
|
+
var import_jsx_runtime331 = require("react/jsx-runtime");
|
|
3981
4033
|
var SelectItem = (props) => {
|
|
3982
4034
|
const { children, value, onClick, disabled = false } = props;
|
|
3983
|
-
const ctx =
|
|
4035
|
+
const ctx = import_react28.default.useContext(context_default);
|
|
3984
4036
|
const handleClick = (e) => {
|
|
3985
4037
|
e.preventDefault();
|
|
3986
4038
|
e.stopPropagation();
|
|
@@ -3989,7 +4041,7 @@ var SelectItem = (props) => {
|
|
|
3989
4041
|
ctx?.close();
|
|
3990
4042
|
onClick?.();
|
|
3991
4043
|
};
|
|
3992
|
-
return /* @__PURE__ */ (0,
|
|
4044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
|
|
3993
4045
|
"div",
|
|
3994
4046
|
{
|
|
3995
4047
|
className: clsx_default("select-item", disabled && "disabled"),
|
|
@@ -4010,7 +4062,7 @@ SelectItem.displayName = "Select.Item";
|
|
|
4010
4062
|
var SelectItem_default = SelectItem;
|
|
4011
4063
|
|
|
4012
4064
|
// src/components/Select/Select.tsx
|
|
4013
|
-
var
|
|
4065
|
+
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
4014
4066
|
var ANIMATION_DURATION_MS3 = 200;
|
|
4015
4067
|
var SelectRoot = (props) => {
|
|
4016
4068
|
const {
|
|
@@ -4022,26 +4074,26 @@ var SelectRoot = (props) => {
|
|
|
4022
4074
|
error = false,
|
|
4023
4075
|
size = "md"
|
|
4024
4076
|
} = props;
|
|
4025
|
-
const itemChildren =
|
|
4026
|
-
(child) =>
|
|
4077
|
+
const itemChildren = import_react29.default.Children.toArray(children).filter(
|
|
4078
|
+
(child) => import_react29.default.isValidElement(child) && child.type === SelectItem_default
|
|
4027
4079
|
);
|
|
4028
4080
|
const isControlled = valueProp !== void 0;
|
|
4029
|
-
const [isOpen, setOpen] =
|
|
4030
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
4031
|
-
const controlledLabel =
|
|
4081
|
+
const [isOpen, setOpen] = import_react29.default.useState(false);
|
|
4082
|
+
const [uncontrolledLabel, setUncontrolledLabel] = import_react29.default.useState(null);
|
|
4083
|
+
const controlledLabel = import_react29.default.useMemo(() => {
|
|
4032
4084
|
if (!isControlled) return null;
|
|
4033
4085
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
4034
4086
|
return match ? match.props.children : null;
|
|
4035
4087
|
}, [isControlled, valueProp, itemChildren]);
|
|
4036
4088
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
4037
|
-
const triggerRef =
|
|
4038
|
-
const contentRef =
|
|
4039
|
-
const [mounted, setMounted] =
|
|
4040
|
-
const [visible, setVisible] =
|
|
4041
|
-
|
|
4089
|
+
const triggerRef = import_react29.default.useRef(null);
|
|
4090
|
+
const contentRef = import_react29.default.useRef(null);
|
|
4091
|
+
const [mounted, setMounted] = import_react29.default.useState(false);
|
|
4092
|
+
const [visible, setVisible] = import_react29.default.useState(false);
|
|
4093
|
+
import_react29.default.useEffect(() => {
|
|
4042
4094
|
if (disabled && isOpen) setOpen(false);
|
|
4043
4095
|
}, [disabled, isOpen]);
|
|
4044
|
-
|
|
4096
|
+
import_react29.default.useEffect(() => {
|
|
4045
4097
|
if (isOpen) {
|
|
4046
4098
|
setMounted(true);
|
|
4047
4099
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -4051,12 +4103,12 @@ var SelectRoot = (props) => {
|
|
|
4051
4103
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
4052
4104
|
return () => clearTimeout(t);
|
|
4053
4105
|
}, [isOpen]);
|
|
4054
|
-
const open =
|
|
4055
|
-
const close =
|
|
4056
|
-
const toggle =
|
|
4106
|
+
const open = import_react29.default.useCallback(() => setOpen(true), []);
|
|
4107
|
+
const close = import_react29.default.useCallback(() => setOpen(false), []);
|
|
4108
|
+
const toggle = import_react29.default.useCallback(() => setOpen((prev) => !prev), []);
|
|
4057
4109
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
4058
4110
|
const position = useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
4059
|
-
const setSelected =
|
|
4111
|
+
const setSelected = import_react29.default.useCallback(
|
|
4060
4112
|
(label, itemValue) => {
|
|
4061
4113
|
if (!isControlled) {
|
|
4062
4114
|
setUncontrolledLabel(label);
|
|
@@ -4065,7 +4117,7 @@ var SelectRoot = (props) => {
|
|
|
4065
4117
|
},
|
|
4066
4118
|
[isControlled, onChange]
|
|
4067
4119
|
);
|
|
4068
|
-
const ctxValue =
|
|
4120
|
+
const ctxValue = import_react29.default.useMemo(
|
|
4069
4121
|
() => ({
|
|
4070
4122
|
isOpen,
|
|
4071
4123
|
mounted,
|
|
@@ -4086,7 +4138,7 @@ var SelectRoot = (props) => {
|
|
|
4086
4138
|
if (disabled) return;
|
|
4087
4139
|
toggle();
|
|
4088
4140
|
};
|
|
4089
|
-
return /* @__PURE__ */ (0,
|
|
4141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(context_default.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime332.jsxs)(
|
|
4090
4142
|
"div",
|
|
4091
4143
|
{
|
|
4092
4144
|
className: clsx_default(
|
|
@@ -4097,7 +4149,7 @@ var SelectRoot = (props) => {
|
|
|
4097
4149
|
mounted && "is-open"
|
|
4098
4150
|
),
|
|
4099
4151
|
children: [
|
|
4100
|
-
/* @__PURE__ */ (0,
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsxs)(
|
|
4101
4153
|
"div",
|
|
4102
4154
|
{
|
|
4103
4155
|
ref: triggerRef,
|
|
@@ -4121,7 +4173,7 @@ var SelectRoot = (props) => {
|
|
|
4121
4173
|
}
|
|
4122
4174
|
},
|
|
4123
4175
|
children: [
|
|
4124
|
-
/* @__PURE__ */ (0,
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
4125
4177
|
"span",
|
|
4126
4178
|
{
|
|
4127
4179
|
className: clsx_default(
|
|
@@ -4131,27 +4183,27 @@ var SelectRoot = (props) => {
|
|
|
4131
4183
|
children: selectedLabel ?? placeholder
|
|
4132
4184
|
}
|
|
4133
4185
|
),
|
|
4134
|
-
/* @__PURE__ */ (0,
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
4135
4187
|
"span",
|
|
4136
4188
|
{
|
|
4137
4189
|
className: clsx_default("select-trigger-icon", isOpen && "open"),
|
|
4138
4190
|
"aria-hidden": true,
|
|
4139
|
-
children: /* @__PURE__ */ (0,
|
|
4191
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(ChevronDownIcon_default, {})
|
|
4140
4192
|
}
|
|
4141
4193
|
)
|
|
4142
4194
|
]
|
|
4143
4195
|
}
|
|
4144
4196
|
),
|
|
4145
|
-
mounted && /* @__PURE__ */ (0,
|
|
4197
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
4146
4198
|
"div",
|
|
4147
4199
|
{
|
|
4148
|
-
className: clsx_default("select-content", position.direction, stateClass),
|
|
4200
|
+
className: clsx_default("lib-xplat-select-content", position.direction, stateClass),
|
|
4149
4201
|
ref: contentRef,
|
|
4150
|
-
style: { ...position.position },
|
|
4202
|
+
style: { ...position.position, minWidth: position.position.width },
|
|
4151
4203
|
role: "listbox",
|
|
4152
|
-
children: itemChildren
|
|
4204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(context_default.Provider, { value: ctxValue, children: itemChildren })
|
|
4153
4205
|
}
|
|
4154
|
-
)
|
|
4206
|
+
) })
|
|
4155
4207
|
]
|
|
4156
4208
|
}
|
|
4157
4209
|
) });
|
|
@@ -4163,14 +4215,14 @@ var Select = Object.assign(SelectRoot, {
|
|
|
4163
4215
|
var Select_default = Select;
|
|
4164
4216
|
|
|
4165
4217
|
// src/components/Skeleton/Skeleton.tsx
|
|
4166
|
-
var
|
|
4218
|
+
var import_jsx_runtime333 = require("react/jsx-runtime");
|
|
4167
4219
|
var Skeleton = (props) => {
|
|
4168
4220
|
const { variant = "text", width, height } = props;
|
|
4169
4221
|
const style = {
|
|
4170
4222
|
width: typeof width === "number" ? `${width}px` : width,
|
|
4171
4223
|
height: typeof height === "number" ? `${height}px` : height
|
|
4172
4224
|
};
|
|
4173
|
-
return /* @__PURE__ */ (0,
|
|
4225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(
|
|
4174
4226
|
"div",
|
|
4175
4227
|
{
|
|
4176
4228
|
className: clsx_default("lib-xplat-skeleton", variant),
|
|
@@ -4183,20 +4235,20 @@ Skeleton.displayName = "Skeleton";
|
|
|
4183
4235
|
var Skeleton_default = Skeleton;
|
|
4184
4236
|
|
|
4185
4237
|
// src/components/Spinner/Spinner.tsx
|
|
4186
|
-
var
|
|
4238
|
+
var import_jsx_runtime334 = require("react/jsx-runtime");
|
|
4187
4239
|
var Spinner = (props) => {
|
|
4188
4240
|
const {
|
|
4189
4241
|
size = "md",
|
|
4190
4242
|
type = "brand"
|
|
4191
4243
|
} = props;
|
|
4192
|
-
return /* @__PURE__ */ (0,
|
|
4244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4193
4245
|
"div",
|
|
4194
4246
|
{
|
|
4195
4247
|
className: clsx_default("lib-xplat-spinner", size, type),
|
|
4196
4248
|
role: "status",
|
|
4197
4249
|
"aria-label": "\uB85C\uB529 \uC911",
|
|
4198
|
-
children: /* @__PURE__ */ (0,
|
|
4199
|
-
/* @__PURE__ */ (0,
|
|
4250
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime334.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
4251
|
+
/* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4200
4252
|
"circle",
|
|
4201
4253
|
{
|
|
4202
4254
|
className: "track",
|
|
@@ -4206,7 +4258,7 @@ var Spinner = (props) => {
|
|
|
4206
4258
|
strokeWidth: "3"
|
|
4207
4259
|
}
|
|
4208
4260
|
),
|
|
4209
|
-
/* @__PURE__ */ (0,
|
|
4261
|
+
/* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4210
4262
|
"circle",
|
|
4211
4263
|
{
|
|
4212
4264
|
className: "indicator",
|
|
@@ -4225,20 +4277,20 @@ Spinner.displayName = "Spinner";
|
|
|
4225
4277
|
var Spinner_default = Spinner;
|
|
4226
4278
|
|
|
4227
4279
|
// src/components/Steps/Steps.tsx
|
|
4228
|
-
var
|
|
4280
|
+
var import_jsx_runtime335 = require("react/jsx-runtime");
|
|
4229
4281
|
var Steps = (props) => {
|
|
4230
4282
|
const {
|
|
4231
4283
|
items,
|
|
4232
4284
|
current,
|
|
4233
4285
|
type = "brand"
|
|
4234
4286
|
} = props;
|
|
4235
|
-
return /* @__PURE__ */ (0,
|
|
4287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)("div", { className: clsx_default("lib-xplat-steps", type), children: items.map((item, index) => {
|
|
4236
4288
|
const status = index < current ? "completed" : index === current ? "active" : "pending";
|
|
4237
|
-
return /* @__PURE__ */ (0,
|
|
4238
|
-
/* @__PURE__ */ (0,
|
|
4239
|
-
/* @__PURE__ */ (0,
|
|
4240
|
-
/* @__PURE__ */ (0,
|
|
4241
|
-
item.description && /* @__PURE__ */ (0,
|
|
4289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime335.jsxs)("div", { className: clsx_default("step-item", status), children: [
|
|
4290
|
+
/* @__PURE__ */ (0, import_jsx_runtime335.jsx)("div", { className: "step-circle", children: status === "completed" ? /* @__PURE__ */ (0, import_jsx_runtime335.jsx)(CheckIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime335.jsx)("span", { children: index + 1 }) }),
|
|
4291
|
+
/* @__PURE__ */ (0, import_jsx_runtime335.jsxs)("div", { className: "step-content", children: [
|
|
4292
|
+
/* @__PURE__ */ (0, import_jsx_runtime335.jsx)("span", { className: "step-title", children: item.title }),
|
|
4293
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime335.jsx)("span", { className: "step-description", children: item.description })
|
|
4242
4294
|
] })
|
|
4243
4295
|
] }, index);
|
|
4244
4296
|
}) });
|
|
@@ -4247,8 +4299,8 @@ Steps.displayName = "Steps";
|
|
|
4247
4299
|
var Steps_default = Steps;
|
|
4248
4300
|
|
|
4249
4301
|
// src/components/Swiper/Swiper.tsx
|
|
4250
|
-
var
|
|
4251
|
-
var
|
|
4302
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
4303
|
+
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
4252
4304
|
var Swiper = (props) => {
|
|
4253
4305
|
const {
|
|
4254
4306
|
auto = false,
|
|
@@ -4271,23 +4323,23 @@ var Swiper = (props) => {
|
|
|
4271
4323
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
4272
4324
|
const useLoop = loop && canSlide;
|
|
4273
4325
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
4274
|
-
const extendedItems =
|
|
4326
|
+
const extendedItems = import_react30.default.useMemo(() => {
|
|
4275
4327
|
if (!useLoop) return items;
|
|
4276
4328
|
return [...items, ...items, ...items];
|
|
4277
4329
|
}, [items, useLoop]);
|
|
4278
4330
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
4279
|
-
const [innerIndex, setInnerIndex] =
|
|
4331
|
+
const [innerIndex, setInnerIndex] = import_react30.default.useState(
|
|
4280
4332
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
4281
4333
|
);
|
|
4282
|
-
const [isDragging, setIsDragging] =
|
|
4283
|
-
const [dragOffset, setDragOffset] =
|
|
4284
|
-
const [animated, setAnimated] =
|
|
4285
|
-
const [containerWidth, setContainerWidth] =
|
|
4286
|
-
const containerRef =
|
|
4287
|
-
const startXRef =
|
|
4288
|
-
const startTimeRef =
|
|
4289
|
-
const autoplayTimerRef =
|
|
4290
|
-
|
|
4334
|
+
const [isDragging, setIsDragging] = import_react30.default.useState(false);
|
|
4335
|
+
const [dragOffset, setDragOffset] = import_react30.default.useState(0);
|
|
4336
|
+
const [animated, setAnimated] = import_react30.default.useState(true);
|
|
4337
|
+
const [containerWidth, setContainerWidth] = import_react30.default.useState(0);
|
|
4338
|
+
const containerRef = import_react30.default.useRef(null);
|
|
4339
|
+
const startXRef = import_react30.default.useRef(0);
|
|
4340
|
+
const startTimeRef = import_react30.default.useRef(0);
|
|
4341
|
+
const autoplayTimerRef = import_react30.default.useRef(null);
|
|
4342
|
+
import_react30.default.useEffect(() => {
|
|
4291
4343
|
const el = containerRef.current;
|
|
4292
4344
|
if (!el) return;
|
|
4293
4345
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -4306,7 +4358,7 @@ var Swiper = (props) => {
|
|
|
4306
4358
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
4307
4359
|
};
|
|
4308
4360
|
const realIndex = getRealIndex(innerIndex);
|
|
4309
|
-
const moveToInner =
|
|
4361
|
+
const moveToInner = import_react30.default.useCallback(
|
|
4310
4362
|
(idx, withAnim = true) => {
|
|
4311
4363
|
if (!useLoop) {
|
|
4312
4364
|
setAnimated(withAnim);
|
|
@@ -4334,7 +4386,7 @@ var Swiper = (props) => {
|
|
|
4334
4386
|
},
|
|
4335
4387
|
[useLoop, cloneCount, totalSlides]
|
|
4336
4388
|
);
|
|
4337
|
-
const handleTransitionEnd =
|
|
4389
|
+
const handleTransitionEnd = import_react30.default.useCallback(() => {
|
|
4338
4390
|
if (!useLoop) return;
|
|
4339
4391
|
const real = getRealIndex(innerIndex);
|
|
4340
4392
|
const canonical = cloneCount + real;
|
|
@@ -4344,7 +4396,7 @@ var Swiper = (props) => {
|
|
|
4344
4396
|
}
|
|
4345
4397
|
onChange?.(Math.min(real, maxIndex));
|
|
4346
4398
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
4347
|
-
const slideTo =
|
|
4399
|
+
const slideTo = import_react30.default.useCallback(
|
|
4348
4400
|
(logicalIndex) => {
|
|
4349
4401
|
if (!canSlide) return;
|
|
4350
4402
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -4354,7 +4406,7 @@ var Swiper = (props) => {
|
|
|
4354
4406
|
},
|
|
4355
4407
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
4356
4408
|
);
|
|
4357
|
-
const slideNext =
|
|
4409
|
+
const slideNext = import_react30.default.useCallback(() => {
|
|
4358
4410
|
if (!canSlide) return;
|
|
4359
4411
|
const nextInner = innerIndex + slideBy;
|
|
4360
4412
|
if (useLoop) {
|
|
@@ -4363,7 +4415,7 @@ var Swiper = (props) => {
|
|
|
4363
4415
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
4364
4416
|
}
|
|
4365
4417
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
4366
|
-
const slidePrev =
|
|
4418
|
+
const slidePrev = import_react30.default.useCallback(() => {
|
|
4367
4419
|
if (!canSlide) return;
|
|
4368
4420
|
const prevInner = innerIndex - slideBy;
|
|
4369
4421
|
if (useLoop) {
|
|
@@ -4372,7 +4424,7 @@ var Swiper = (props) => {
|
|
|
4372
4424
|
moveToInner(Math.max(prevInner, 0), true);
|
|
4373
4425
|
}
|
|
4374
4426
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
4375
|
-
|
|
4427
|
+
import_react30.default.useEffect(() => {
|
|
4376
4428
|
if (indexProp === void 0) return;
|
|
4377
4429
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
4378
4430
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -4380,12 +4432,12 @@ var Swiper = (props) => {
|
|
|
4380
4432
|
moveToInner(target, true);
|
|
4381
4433
|
}
|
|
4382
4434
|
}, [indexProp]);
|
|
4383
|
-
|
|
4435
|
+
import_react30.default.useImperativeHandle(swiperRef, () => ({
|
|
4384
4436
|
slidePrev,
|
|
4385
4437
|
slideNext,
|
|
4386
4438
|
slideTo
|
|
4387
4439
|
}));
|
|
4388
|
-
|
|
4440
|
+
import_react30.default.useEffect(() => {
|
|
4389
4441
|
if (!auto || !canSlide) return;
|
|
4390
4442
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
4391
4443
|
return () => {
|
|
@@ -4408,7 +4460,7 @@ var Swiper = (props) => {
|
|
|
4408
4460
|
startXRef.current = getClientX(e);
|
|
4409
4461
|
startTimeRef.current = Date.now();
|
|
4410
4462
|
};
|
|
4411
|
-
|
|
4463
|
+
import_react30.default.useEffect(() => {
|
|
4412
4464
|
if (!isDragging) return;
|
|
4413
4465
|
const handleMove = (e) => {
|
|
4414
4466
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -4446,8 +4498,8 @@ var Swiper = (props) => {
|
|
|
4446
4498
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
4447
4499
|
const slideWidthPercent = 100 / viewItemCount;
|
|
4448
4500
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
4449
|
-
const slideElements =
|
|
4450
|
-
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0,
|
|
4501
|
+
const slideElements = import_react30.default.useMemo(
|
|
4502
|
+
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4451
4503
|
"div",
|
|
4452
4504
|
{
|
|
4453
4505
|
className: "lib-xplat-swiper__slide",
|
|
@@ -4466,14 +4518,14 @@ var Swiper = (props) => {
|
|
|
4466
4518
|
Math.floor(realIndex / slideBy),
|
|
4467
4519
|
totalSteps - 1
|
|
4468
4520
|
);
|
|
4469
|
-
return /* @__PURE__ */ (0,
|
|
4470
|
-
/* @__PURE__ */ (0,
|
|
4521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime336.jsxs)("div", { className: "lib-xplat-swiper", ref: containerRef, children: [
|
|
4522
|
+
/* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4471
4523
|
"div",
|
|
4472
4524
|
{
|
|
4473
4525
|
className: "lib-xplat-swiper__viewport",
|
|
4474
4526
|
onMouseDown: handleDragStart,
|
|
4475
4527
|
onTouchStart: handleDragStart,
|
|
4476
|
-
children: /* @__PURE__ */ (0,
|
|
4528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4477
4529
|
"div",
|
|
4478
4530
|
{
|
|
4479
4531
|
className: clsx_default(
|
|
@@ -4491,7 +4543,7 @@ var Swiper = (props) => {
|
|
|
4491
4543
|
)
|
|
4492
4544
|
}
|
|
4493
4545
|
),
|
|
4494
|
-
showProgress && canSlide && /* @__PURE__ */ (0,
|
|
4546
|
+
showProgress && canSlide && /* @__PURE__ */ (0, import_jsx_runtime336.jsx)("div", { className: "lib-xplat-swiper__progress", children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)("div", { className: "lib-xplat-swiper__progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4495
4547
|
"span",
|
|
4496
4548
|
{
|
|
4497
4549
|
className: "lib-xplat-swiper__progress-fill",
|
|
@@ -4501,7 +4553,7 @@ var Swiper = (props) => {
|
|
|
4501
4553
|
}
|
|
4502
4554
|
}
|
|
4503
4555
|
) }) }),
|
|
4504
|
-
canSlide && /* @__PURE__ */ (0,
|
|
4556
|
+
canSlide && /* @__PURE__ */ (0, import_jsx_runtime336.jsx)("div", { className: "lib-xplat-swiper__dots", children: Array.from({ length: totalSteps }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4505
4557
|
"button",
|
|
4506
4558
|
{
|
|
4507
4559
|
className: clsx_default(
|
|
@@ -4519,8 +4571,8 @@ Swiper.displayName = "Swiper";
|
|
|
4519
4571
|
var Swiper_default = Swiper;
|
|
4520
4572
|
|
|
4521
4573
|
// src/components/Switch/Switch.tsx
|
|
4522
|
-
var
|
|
4523
|
-
var
|
|
4574
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
4575
|
+
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
4524
4576
|
var KNOB_TRANSITION_MS = 250;
|
|
4525
4577
|
var Switch = (props) => {
|
|
4526
4578
|
const {
|
|
@@ -4530,9 +4582,9 @@ var Switch = (props) => {
|
|
|
4530
4582
|
disabled,
|
|
4531
4583
|
onChange
|
|
4532
4584
|
} = props;
|
|
4533
|
-
const [isAnimating, setIsAnimating] =
|
|
4534
|
-
const timeoutRef =
|
|
4535
|
-
|
|
4585
|
+
const [isAnimating, setIsAnimating] = import_react31.default.useState(false);
|
|
4586
|
+
const timeoutRef = import_react31.default.useRef(null);
|
|
4587
|
+
import_react31.default.useEffect(() => {
|
|
4536
4588
|
return () => {
|
|
4537
4589
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4538
4590
|
};
|
|
@@ -4547,7 +4599,7 @@ var Switch = (props) => {
|
|
|
4547
4599
|
timeoutRef.current = null;
|
|
4548
4600
|
}, KNOB_TRANSITION_MS);
|
|
4549
4601
|
};
|
|
4550
|
-
return /* @__PURE__ */ (0,
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
|
|
4551
4603
|
"div",
|
|
4552
4604
|
{
|
|
4553
4605
|
className: clsx_default(
|
|
@@ -4560,7 +4612,7 @@ var Switch = (props) => {
|
|
|
4560
4612
|
),
|
|
4561
4613
|
onClick: handleClick,
|
|
4562
4614
|
"aria-disabled": disabled || isAnimating,
|
|
4563
|
-
children: /* @__PURE__ */ (0,
|
|
4615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
|
|
4564
4616
|
}
|
|
4565
4617
|
);
|
|
4566
4618
|
};
|
|
@@ -4568,17 +4620,17 @@ Switch.displayName = "Switch";
|
|
|
4568
4620
|
var Switch_default = Switch;
|
|
4569
4621
|
|
|
4570
4622
|
// src/components/Table/TableContext.tsx
|
|
4571
|
-
var
|
|
4572
|
-
var TableContext =
|
|
4623
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
4624
|
+
var TableContext = import_react32.default.createContext(null);
|
|
4573
4625
|
var useTableContext = () => {
|
|
4574
|
-
const ctx =
|
|
4626
|
+
const ctx = import_react32.default.useContext(TableContext);
|
|
4575
4627
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
4576
4628
|
return ctx;
|
|
4577
4629
|
};
|
|
4578
4630
|
var TableContext_default = TableContext;
|
|
4579
4631
|
|
|
4580
4632
|
// src/components/Table/Table.tsx
|
|
4581
|
-
var
|
|
4633
|
+
var import_jsx_runtime338 = require("react/jsx-runtime");
|
|
4582
4634
|
var Table = (props) => {
|
|
4583
4635
|
const {
|
|
4584
4636
|
children,
|
|
@@ -4587,7 +4639,7 @@ var Table = (props) => {
|
|
|
4587
4639
|
headerSticky = false,
|
|
4588
4640
|
stickyShadow = true
|
|
4589
4641
|
} = props;
|
|
4590
|
-
return /* @__PURE__ */ (0,
|
|
4642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: "lib-xplat-table-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4591
4643
|
TableContext_default.Provider,
|
|
4592
4644
|
{
|
|
4593
4645
|
value: {
|
|
@@ -4596,7 +4648,7 @@ var Table = (props) => {
|
|
|
4596
4648
|
headerSticky,
|
|
4597
4649
|
stickyShadow
|
|
4598
4650
|
},
|
|
4599
|
-
children: /* @__PURE__ */ (0,
|
|
4651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("table", { className: "lib-xplat-table", children })
|
|
4600
4652
|
}
|
|
4601
4653
|
) });
|
|
4602
4654
|
};
|
|
@@ -4604,41 +4656,41 @@ Table.displayName = "Table";
|
|
|
4604
4656
|
var Table_default = Table;
|
|
4605
4657
|
|
|
4606
4658
|
// src/components/Table/TableBody.tsx
|
|
4607
|
-
var
|
|
4659
|
+
var import_jsx_runtime339 = require("react/jsx-runtime");
|
|
4608
4660
|
var TableBody = (props) => {
|
|
4609
4661
|
const { children } = props;
|
|
4610
|
-
return /* @__PURE__ */ (0,
|
|
4662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime339.jsx)("tbody", { children });
|
|
4611
4663
|
};
|
|
4612
4664
|
TableBody.displayName = "TableBody";
|
|
4613
4665
|
var TableBody_default = TableBody;
|
|
4614
4666
|
|
|
4615
4667
|
// src/components/Table/TableCell.tsx
|
|
4616
|
-
var
|
|
4668
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
4617
4669
|
|
|
4618
4670
|
// src/components/Table/TableHeadContext.tsx
|
|
4619
|
-
var
|
|
4620
|
-
var TableHeadContext =
|
|
4671
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
4672
|
+
var TableHeadContext = import_react33.default.createContext(
|
|
4621
4673
|
null
|
|
4622
4674
|
);
|
|
4623
4675
|
var useTableHeadContext = () => {
|
|
4624
|
-
const ctx =
|
|
4676
|
+
const ctx = import_react33.default.useContext(TableHeadContext);
|
|
4625
4677
|
return ctx;
|
|
4626
4678
|
};
|
|
4627
4679
|
var TableHeadContext_default = TableHeadContext;
|
|
4628
4680
|
|
|
4629
4681
|
// src/components/Table/TableRowContext.tsx
|
|
4630
|
-
var
|
|
4631
|
-
var TableRowContext =
|
|
4682
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
4683
|
+
var TableRowContext = import_react34.default.createContext(null);
|
|
4632
4684
|
var useTableRowContext = () => {
|
|
4633
|
-
const ctx =
|
|
4685
|
+
const ctx = import_react34.default.useContext(TableRowContext);
|
|
4634
4686
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
4635
4687
|
return ctx;
|
|
4636
4688
|
};
|
|
4637
4689
|
var TableRowContext_default = TableRowContext;
|
|
4638
4690
|
|
|
4639
4691
|
// src/components/Table/TableCell.tsx
|
|
4640
|
-
var
|
|
4641
|
-
var TableCell =
|
|
4692
|
+
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
4693
|
+
var TableCell = import_react35.default.memo((props) => {
|
|
4642
4694
|
const {
|
|
4643
4695
|
children,
|
|
4644
4696
|
align = "center",
|
|
@@ -4650,9 +4702,9 @@ var TableCell = import_react34.default.memo((props) => {
|
|
|
4650
4702
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
4651
4703
|
const { stickyShadow } = useTableContext();
|
|
4652
4704
|
const headContext = useTableHeadContext();
|
|
4653
|
-
const [left, setLeft] =
|
|
4654
|
-
const cellRef =
|
|
4655
|
-
const calculateLeft =
|
|
4705
|
+
const [left, setLeft] = import_react35.default.useState(0);
|
|
4706
|
+
const cellRef = import_react35.default.useRef(null);
|
|
4707
|
+
const calculateLeft = import_react35.default.useCallback(() => {
|
|
4656
4708
|
if (!cellRef.current) return 0;
|
|
4657
4709
|
let totalLeft = 0;
|
|
4658
4710
|
for (const ref of stickyCells) {
|
|
@@ -4661,7 +4713,7 @@ var TableCell = import_react34.default.memo((props) => {
|
|
|
4661
4713
|
}
|
|
4662
4714
|
return totalLeft;
|
|
4663
4715
|
}, [stickyCells]);
|
|
4664
|
-
|
|
4716
|
+
import_react35.default.useEffect(() => {
|
|
4665
4717
|
if (!isSticky || !cellRef.current) return;
|
|
4666
4718
|
registerStickyCell(cellRef);
|
|
4667
4719
|
setLeft(calculateLeft());
|
|
@@ -4679,7 +4731,7 @@ var TableCell = import_react34.default.memo((props) => {
|
|
|
4679
4731
|
const CellTag = cellRef.current?.tagName === "TH" ? "th" : "td";
|
|
4680
4732
|
const isLastSticky = isSticky && stickyCells[stickyCells.length - 1] === cellRef;
|
|
4681
4733
|
const enableHover = headContext && headContext.cellHover;
|
|
4682
|
-
return /* @__PURE__ */ (0,
|
|
4734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(
|
|
4683
4735
|
CellTag,
|
|
4684
4736
|
{
|
|
4685
4737
|
ref: cellRef,
|
|
@@ -4704,21 +4756,21 @@ TableCell.displayName = "TableCell";
|
|
|
4704
4756
|
var TableCell_default = TableCell;
|
|
4705
4757
|
|
|
4706
4758
|
// src/components/Table/TableHead.tsx
|
|
4707
|
-
var
|
|
4759
|
+
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
4708
4760
|
var TableHead = ({
|
|
4709
4761
|
children,
|
|
4710
4762
|
cellHover = false
|
|
4711
4763
|
}) => {
|
|
4712
4764
|
const { headerSticky } = useTableContext();
|
|
4713
|
-
return /* @__PURE__ */ (0,
|
|
4765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime341.jsx)(TableHeadContext_default.Provider, { value: { cellHover }, children: /* @__PURE__ */ (0, import_jsx_runtime341.jsx)("thead", { className: clsx_default(headerSticky ? "table-sticky" : null), children }) });
|
|
4714
4766
|
};
|
|
4715
4767
|
TableHead.displayName = "TableHead";
|
|
4716
4768
|
var TableHead_default = TableHead;
|
|
4717
4769
|
|
|
4718
4770
|
// src/components/Table/TableRow.tsx
|
|
4719
|
-
var
|
|
4720
|
-
var
|
|
4721
|
-
var TableRow =
|
|
4771
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
4772
|
+
var import_jsx_runtime342 = require("react/jsx-runtime");
|
|
4773
|
+
var TableRow = import_react36.default.memo((props) => {
|
|
4722
4774
|
const {
|
|
4723
4775
|
children,
|
|
4724
4776
|
type = "secondary",
|
|
@@ -4726,14 +4778,14 @@ var TableRow = import_react35.default.memo((props) => {
|
|
|
4726
4778
|
onClick
|
|
4727
4779
|
} = props;
|
|
4728
4780
|
const { rowBorderUse } = useTableContext();
|
|
4729
|
-
const [stickyCells, setStickyCells] =
|
|
4781
|
+
const [stickyCells, setStickyCells] = import_react36.default.useState([]);
|
|
4730
4782
|
const registerStickyCell = (ref) => {
|
|
4731
4783
|
setStickyCells((prev) => {
|
|
4732
4784
|
if (prev.includes(ref)) return prev;
|
|
4733
4785
|
return [...prev, ref];
|
|
4734
4786
|
});
|
|
4735
4787
|
};
|
|
4736
|
-
return /* @__PURE__ */ (0,
|
|
4788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(TableRowContext_default.Provider, { value: { stickyCells, registerStickyCell }, children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
4737
4789
|
"tr",
|
|
4738
4790
|
{
|
|
4739
4791
|
className: clsx_default(
|
|
@@ -4751,7 +4803,7 @@ TableRow.displayName = "TableRow";
|
|
|
4751
4803
|
var TableRow_default = TableRow;
|
|
4752
4804
|
|
|
4753
4805
|
// src/components/Tag/Tag.tsx
|
|
4754
|
-
var
|
|
4806
|
+
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
4755
4807
|
var Tag = (props) => {
|
|
4756
4808
|
const {
|
|
4757
4809
|
children,
|
|
@@ -4761,7 +4813,7 @@ var Tag = (props) => {
|
|
|
4761
4813
|
disabled = false,
|
|
4762
4814
|
colorIndex
|
|
4763
4815
|
} = props;
|
|
4764
|
-
return /* @__PURE__ */ (0,
|
|
4816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsxs)(
|
|
4765
4817
|
"span",
|
|
4766
4818
|
{
|
|
4767
4819
|
className: clsx_default(
|
|
@@ -4772,8 +4824,8 @@ var Tag = (props) => {
|
|
|
4772
4824
|
disabled && "disabled"
|
|
4773
4825
|
),
|
|
4774
4826
|
children: [
|
|
4775
|
-
/* @__PURE__ */ (0,
|
|
4776
|
-
onClose && /* @__PURE__ */ (0,
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime343.jsx)("span", { className: "tag-label", children }),
|
|
4828
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime343.jsx)("button", { className: "tag-close", onClick: onClose, "aria-label": "\uC0AD\uC81C", disabled, children: /* @__PURE__ */ (0, import_jsx_runtime343.jsx)(XIcon_default, {}) })
|
|
4777
4829
|
]
|
|
4778
4830
|
}
|
|
4779
4831
|
);
|
|
@@ -4782,12 +4834,12 @@ Tag.displayName = "Tag";
|
|
|
4782
4834
|
var Tag_default = Tag;
|
|
4783
4835
|
|
|
4784
4836
|
// src/components/TextArea/TextArea.tsx
|
|
4785
|
-
var
|
|
4786
|
-
var
|
|
4787
|
-
var TextArea =
|
|
4837
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
4838
|
+
var import_jsx_runtime344 = require("react/jsx-runtime");
|
|
4839
|
+
var TextArea = import_react37.default.forwardRef(
|
|
4788
4840
|
(props, ref) => {
|
|
4789
4841
|
const { value, onChange, disabled, ...textareaProps } = props;
|
|
4790
|
-
const localRef =
|
|
4842
|
+
const localRef = import_react37.default.useRef(null);
|
|
4791
4843
|
const setRefs = (el) => {
|
|
4792
4844
|
localRef.current = el;
|
|
4793
4845
|
if (!ref) return;
|
|
@@ -4807,21 +4859,21 @@ var TextArea = import_react36.default.forwardRef(
|
|
|
4807
4859
|
onChange(event);
|
|
4808
4860
|
}
|
|
4809
4861
|
};
|
|
4810
|
-
|
|
4862
|
+
import_react37.default.useEffect(() => {
|
|
4811
4863
|
const el = localRef.current;
|
|
4812
4864
|
if (!el) return;
|
|
4813
4865
|
el.style.height = "0px";
|
|
4814
4866
|
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
4815
4867
|
el.style.height = `${nextHeight}px`;
|
|
4816
4868
|
}, [value]);
|
|
4817
|
-
return /* @__PURE__ */ (0,
|
|
4869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: "lib-xplat-textarea-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
4818
4870
|
"div",
|
|
4819
4871
|
{
|
|
4820
4872
|
className: clsx_default(
|
|
4821
4873
|
"lib-xplat-textarea",
|
|
4822
4874
|
disabled ? "disabled" : void 0
|
|
4823
4875
|
),
|
|
4824
|
-
children: /* @__PURE__ */ (0,
|
|
4876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
4825
4877
|
"textarea",
|
|
4826
4878
|
{
|
|
4827
4879
|
...textareaProps,
|
|
@@ -4839,25 +4891,25 @@ TextArea.displayName = "TextArea";
|
|
|
4839
4891
|
var TextArea_default = TextArea;
|
|
4840
4892
|
|
|
4841
4893
|
// src/components/Toast/Toast.tsx
|
|
4842
|
-
var
|
|
4843
|
-
var
|
|
4844
|
-
var
|
|
4845
|
-
var ToastContext =
|
|
4894
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
4895
|
+
var import_react_dom4 = require("react-dom");
|
|
4896
|
+
var import_jsx_runtime345 = require("react/jsx-runtime");
|
|
4897
|
+
var ToastContext = import_react38.default.createContext(null);
|
|
4846
4898
|
var useToast = () => {
|
|
4847
|
-
const ctx =
|
|
4899
|
+
const ctx = import_react38.default.useContext(ToastContext);
|
|
4848
4900
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
4849
4901
|
return ctx;
|
|
4850
4902
|
};
|
|
4851
4903
|
var EXIT_DURATION = 300;
|
|
4852
4904
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
4853
|
-
const ref =
|
|
4854
|
-
const [height, setHeight] =
|
|
4855
|
-
|
|
4905
|
+
const ref = import_react38.default.useRef(null);
|
|
4906
|
+
const [height, setHeight] = import_react38.default.useState(void 0);
|
|
4907
|
+
import_react38.default.useEffect(() => {
|
|
4856
4908
|
if (ref.current && !isExiting) {
|
|
4857
4909
|
setHeight(ref.current.offsetHeight);
|
|
4858
4910
|
}
|
|
4859
4911
|
}, [isExiting]);
|
|
4860
|
-
return /* @__PURE__ */ (0,
|
|
4912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
|
|
4861
4913
|
"div",
|
|
4862
4914
|
{
|
|
4863
4915
|
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
@@ -4865,15 +4917,15 @@ var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
|
4865
4917
|
maxHeight: isExiting ? 0 : height ?? "none",
|
|
4866
4918
|
marginBottom: isExiting ? 0 : void 0
|
|
4867
4919
|
},
|
|
4868
|
-
children: /* @__PURE__ */ (0,
|
|
4920
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(
|
|
4869
4921
|
"div",
|
|
4870
4922
|
{
|
|
4871
4923
|
ref,
|
|
4872
4924
|
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
4873
4925
|
role: "alert",
|
|
4874
4926
|
children: [
|
|
4875
|
-
/* @__PURE__ */ (0,
|
|
4876
|
-
/* @__PURE__ */ (0,
|
|
4927
|
+
/* @__PURE__ */ (0, import_jsx_runtime345.jsx)("span", { className: "message", children: item.message }),
|
|
4928
|
+
/* @__PURE__ */ (0, import_jsx_runtime345.jsx)("button", { className: "close-btn", onClick: onClose, "aria-label": "\uB2EB\uAE30", children: "\xD7" })
|
|
4877
4929
|
]
|
|
4878
4930
|
}
|
|
4879
4931
|
)
|
|
@@ -4884,13 +4936,13 @@ var ToastProvider = ({
|
|
|
4884
4936
|
children,
|
|
4885
4937
|
position = "top-right"
|
|
4886
4938
|
}) => {
|
|
4887
|
-
const [toasts, setToasts] =
|
|
4888
|
-
const [removing, setRemoving] =
|
|
4889
|
-
const [mounted, setMounted] =
|
|
4890
|
-
|
|
4939
|
+
const [toasts, setToasts] = import_react38.default.useState([]);
|
|
4940
|
+
const [removing, setRemoving] = import_react38.default.useState(/* @__PURE__ */ new Set());
|
|
4941
|
+
const [mounted, setMounted] = import_react38.default.useState(false);
|
|
4942
|
+
import_react38.default.useEffect(() => {
|
|
4891
4943
|
setMounted(true);
|
|
4892
4944
|
}, []);
|
|
4893
|
-
const remove =
|
|
4945
|
+
const remove = import_react38.default.useCallback((id) => {
|
|
4894
4946
|
setRemoving((prev) => new Set(prev).add(id));
|
|
4895
4947
|
setTimeout(() => {
|
|
4896
4948
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -4901,7 +4953,7 @@ var ToastProvider = ({
|
|
|
4901
4953
|
});
|
|
4902
4954
|
}, EXIT_DURATION);
|
|
4903
4955
|
}, []);
|
|
4904
|
-
const toast =
|
|
4956
|
+
const toast = import_react38.default.useCallback(
|
|
4905
4957
|
(type, message, duration = 3e3) => {
|
|
4906
4958
|
const id = `${Date.now()}-${Math.random()}`;
|
|
4907
4959
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -4911,10 +4963,10 @@ var ToastProvider = ({
|
|
|
4911
4963
|
},
|
|
4912
4964
|
[remove]
|
|
4913
4965
|
);
|
|
4914
|
-
return /* @__PURE__ */ (0,
|
|
4966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(ToastContext.Provider, { value: { toast }, children: [
|
|
4915
4967
|
children,
|
|
4916
|
-
mounted && (0,
|
|
4917
|
-
/* @__PURE__ */ (0,
|
|
4968
|
+
mounted && (0, import_react_dom4.createPortal)(
|
|
4969
|
+
/* @__PURE__ */ (0, import_jsx_runtime345.jsx)("div", { className: clsx_default("lib-xplat-toast-container", position), children: toasts.map((t) => /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
|
|
4918
4970
|
ToastItemComponent,
|
|
4919
4971
|
{
|
|
4920
4972
|
item: t,
|
|
@@ -4930,29 +4982,29 @@ var ToastProvider = ({
|
|
|
4930
4982
|
ToastProvider.displayName = "ToastProvider";
|
|
4931
4983
|
|
|
4932
4984
|
// src/components/Tooltip/Tooltip.tsx
|
|
4933
|
-
var
|
|
4934
|
-
var
|
|
4985
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
4986
|
+
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
4935
4987
|
var Tooltip = (props) => {
|
|
4936
4988
|
const {
|
|
4937
4989
|
type = "primary",
|
|
4938
4990
|
description,
|
|
4939
4991
|
children
|
|
4940
4992
|
} = props;
|
|
4941
|
-
const iconRef =
|
|
4942
|
-
return /* @__PURE__ */ (0,
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
4944
|
-
/* @__PURE__ */ (0,
|
|
4993
|
+
const iconRef = import_react39.default.useRef(null);
|
|
4994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime346.jsxs)("div", { className: "lib-xplat-tooltip", children: [
|
|
4995
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("div", { className: "tooltip-content", ref: iconRef, children: children || "Tooltip" }),
|
|
4996
|
+
/* @__PURE__ */ (0, import_jsx_runtime346.jsx)("div", { className: clsx_default("tooltip-wrapper", type), children: description })
|
|
4945
4997
|
] });
|
|
4946
4998
|
};
|
|
4947
4999
|
Tooltip.displayName = "Tooltip";
|
|
4948
5000
|
var Tooltip_default = Tooltip;
|
|
4949
5001
|
|
|
4950
5002
|
// src/components/Video/Video.tsx
|
|
4951
|
-
var
|
|
4952
|
-
var
|
|
4953
|
-
var PipIcon = () => /* @__PURE__ */ (0,
|
|
4954
|
-
/* @__PURE__ */ (0,
|
|
4955
|
-
/* @__PURE__ */ (0,
|
|
5003
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
5004
|
+
var import_jsx_runtime347 = require("react/jsx-runtime");
|
|
5005
|
+
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime347.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: [
|
|
5006
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
5007
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)("rect", { x: "12", y: "11", width: "7", height: "6", rx: "1", fill: "currentColor" })
|
|
4956
5008
|
] });
|
|
4957
5009
|
var formatTime = (sec) => {
|
|
4958
5010
|
if (!Number.isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -4960,7 +5012,7 @@ var formatTime = (sec) => {
|
|
|
4960
5012
|
const s = Math.floor(sec % 60);
|
|
4961
5013
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
4962
5014
|
};
|
|
4963
|
-
var Video =
|
|
5015
|
+
var Video = import_react40.default.forwardRef((props, ref) => {
|
|
4964
5016
|
const {
|
|
4965
5017
|
src,
|
|
4966
5018
|
poster,
|
|
@@ -4984,21 +5036,21 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
4984
5036
|
children,
|
|
4985
5037
|
...rest
|
|
4986
5038
|
} = props;
|
|
4987
|
-
const containerRef =
|
|
4988
|
-
const videoRef =
|
|
4989
|
-
const [isPlaying, setIsPlaying] =
|
|
4990
|
-
const [isLoaded, setIsLoaded] =
|
|
4991
|
-
const [currentTime, setCurrentTime] =
|
|
4992
|
-
const [duration, setDuration] =
|
|
4993
|
-
const [buffered, setBuffered] =
|
|
4994
|
-
const [volume, setVolume] =
|
|
4995
|
-
const [isMuted, setIsMuted] =
|
|
4996
|
-
const [isFullscreen, setIsFullscreen] =
|
|
4997
|
-
const [playbackRate, setPlaybackRate] =
|
|
4998
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
4999
|
-
const [captionsOn, setCaptionsOn] =
|
|
5000
|
-
const [isPip, setIsPip] =
|
|
5001
|
-
const setRefs =
|
|
5039
|
+
const containerRef = import_react40.default.useRef(null);
|
|
5040
|
+
const videoRef = import_react40.default.useRef(null);
|
|
5041
|
+
const [isPlaying, setIsPlaying] = import_react40.default.useState(Boolean(autoPlay));
|
|
5042
|
+
const [isLoaded, setIsLoaded] = import_react40.default.useState(false);
|
|
5043
|
+
const [currentTime, setCurrentTime] = import_react40.default.useState(0);
|
|
5044
|
+
const [duration, setDuration] = import_react40.default.useState(0);
|
|
5045
|
+
const [buffered, setBuffered] = import_react40.default.useState(0);
|
|
5046
|
+
const [volume, setVolume] = import_react40.default.useState(1);
|
|
5047
|
+
const [isMuted, setIsMuted] = import_react40.default.useState(Boolean(muted));
|
|
5048
|
+
const [isFullscreen, setIsFullscreen] = import_react40.default.useState(false);
|
|
5049
|
+
const [playbackRate, setPlaybackRate] = import_react40.default.useState(1);
|
|
5050
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react40.default.useState(false);
|
|
5051
|
+
const [captionsOn, setCaptionsOn] = import_react40.default.useState(false);
|
|
5052
|
+
const [isPip, setIsPip] = import_react40.default.useState(false);
|
|
5053
|
+
const setRefs = import_react40.default.useCallback(
|
|
5002
5054
|
(el) => {
|
|
5003
5055
|
videoRef.current = el;
|
|
5004
5056
|
if (typeof ref === "function") ref(el);
|
|
@@ -5006,14 +5058,14 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5006
5058
|
},
|
|
5007
5059
|
[ref]
|
|
5008
5060
|
);
|
|
5009
|
-
|
|
5061
|
+
import_react40.default.useEffect(() => {
|
|
5010
5062
|
const onFsChange = () => {
|
|
5011
5063
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
5012
5064
|
};
|
|
5013
5065
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
5014
5066
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
5015
5067
|
}, []);
|
|
5016
|
-
|
|
5068
|
+
import_react40.default.useEffect(() => {
|
|
5017
5069
|
const v = videoRef.current;
|
|
5018
5070
|
if (!v) return;
|
|
5019
5071
|
const onEnter = () => setIsPip(true);
|
|
@@ -5127,13 +5179,13 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5127
5179
|
const volumePct = (isMuted ? 0 : volume) * 100;
|
|
5128
5180
|
const VolumeGlyph = isMuted || volume === 0 ? VolumeXIcon_default : volume < 0.5 ? VolumeIcon_default : Volume2Icon_default;
|
|
5129
5181
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
5130
|
-
return /* @__PURE__ */ (0,
|
|
5182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(
|
|
5131
5183
|
"div",
|
|
5132
5184
|
{
|
|
5133
5185
|
ref: containerRef,
|
|
5134
5186
|
className: clsx_default("lib-xplat-video", showControls && "has-controls"),
|
|
5135
5187
|
children: [
|
|
5136
|
-
/* @__PURE__ */ (0,
|
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5137
5189
|
"video",
|
|
5138
5190
|
{
|
|
5139
5191
|
ref: setRefs,
|
|
@@ -5154,7 +5206,7 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5154
5206
|
children
|
|
5155
5207
|
}
|
|
5156
5208
|
),
|
|
5157
|
-
showCenterPlay && /* @__PURE__ */ (0,
|
|
5209
|
+
showCenterPlay && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5158
5210
|
"button",
|
|
5159
5211
|
{
|
|
5160
5212
|
type: "button",
|
|
@@ -5166,11 +5218,11 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5166
5218
|
onClick: togglePlay,
|
|
5167
5219
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
5168
5220
|
tabIndex: -1,
|
|
5169
|
-
children: /* @__PURE__ */ (0,
|
|
5221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)("span", { className: "center-play-icon", children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PlayCircleIcon_default, {}) })
|
|
5170
5222
|
}
|
|
5171
5223
|
),
|
|
5172
|
-
showControls && /* @__PURE__ */ (0,
|
|
5173
|
-
/* @__PURE__ */ (0,
|
|
5224
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: "controls", onClick: (e) => e.stopPropagation(), children: [
|
|
5225
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5174
5226
|
"input",
|
|
5175
5227
|
{
|
|
5176
5228
|
type: "range",
|
|
@@ -5187,29 +5239,29 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5187
5239
|
}
|
|
5188
5240
|
}
|
|
5189
5241
|
),
|
|
5190
|
-
/* @__PURE__ */ (0,
|
|
5191
|
-
/* @__PURE__ */ (0,
|
|
5242
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: "controls-row", children: [
|
|
5243
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5192
5244
|
"button",
|
|
5193
5245
|
{
|
|
5194
5246
|
type: "button",
|
|
5195
5247
|
className: "control-btn",
|
|
5196
5248
|
onClick: togglePlay,
|
|
5197
5249
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
5198
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
5250
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PauseIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PlayIcon_default, {})
|
|
5199
5251
|
}
|
|
5200
5252
|
),
|
|
5201
|
-
/* @__PURE__ */ (0,
|
|
5202
|
-
/* @__PURE__ */ (0,
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: "volume-group", children: [
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5203
5255
|
"button",
|
|
5204
5256
|
{
|
|
5205
5257
|
type: "button",
|
|
5206
5258
|
className: "control-btn",
|
|
5207
5259
|
onClick: toggleMute,
|
|
5208
5260
|
"aria-label": isMuted ? "\uC74C\uC18C\uAC70 \uD574\uC81C" : "\uC74C\uC18C\uAC70",
|
|
5209
|
-
children: /* @__PURE__ */ (0,
|
|
5261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(VolumeGlyph, {})
|
|
5210
5262
|
}
|
|
5211
5263
|
),
|
|
5212
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5213
5265
|
"input",
|
|
5214
5266
|
{
|
|
5215
5267
|
type: "range",
|
|
@@ -5224,14 +5276,14 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5224
5276
|
}
|
|
5225
5277
|
)
|
|
5226
5278
|
] }),
|
|
5227
|
-
/* @__PURE__ */ (0,
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("span", { className: "time", children: [
|
|
5228
5280
|
formatTime(currentTime),
|
|
5229
5281
|
" / ",
|
|
5230
5282
|
formatTime(duration)
|
|
5231
5283
|
] }),
|
|
5232
|
-
/* @__PURE__ */ (0,
|
|
5233
|
-
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0,
|
|
5234
|
-
/* @__PURE__ */ (0,
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)("div", { className: "controls-spacer" }),
|
|
5285
|
+
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: clsx_default("rate-group", rateMenuOpen && "is-open"), children: [
|
|
5286
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(
|
|
5235
5287
|
"button",
|
|
5236
5288
|
{
|
|
5237
5289
|
type: "button",
|
|
@@ -5245,7 +5297,7 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5245
5297
|
]
|
|
5246
5298
|
}
|
|
5247
5299
|
),
|
|
5248
|
-
rateMenuOpen && /* @__PURE__ */ (0,
|
|
5300
|
+
rateMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)("ul", { className: "rate-menu", role: "menu", children: playbackRates.map((r2) => /* @__PURE__ */ (0, import_jsx_runtime347.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(
|
|
5249
5301
|
"button",
|
|
5250
5302
|
{
|
|
5251
5303
|
type: "button",
|
|
@@ -5259,7 +5311,7 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5259
5311
|
}
|
|
5260
5312
|
) }, r2)) })
|
|
5261
5313
|
] }),
|
|
5262
|
-
showCaptions && /* @__PURE__ */ (0,
|
|
5314
|
+
showCaptions && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5263
5315
|
"button",
|
|
5264
5316
|
{
|
|
5265
5317
|
type: "button",
|
|
@@ -5267,37 +5319,37 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5267
5319
|
onClick: toggleCaptions,
|
|
5268
5320
|
"aria-label": captionsOn ? "\uC790\uB9C9 \uB044\uAE30" : "\uC790\uB9C9 \uCF1C\uAE30",
|
|
5269
5321
|
"aria-pressed": captionsOn,
|
|
5270
|
-
children: /* @__PURE__ */ (0,
|
|
5322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(TypeIcon_default, {})
|
|
5271
5323
|
}
|
|
5272
5324
|
),
|
|
5273
|
-
showPip && pipSupported && /* @__PURE__ */ (0,
|
|
5325
|
+
showPip && pipSupported && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5274
5326
|
"button",
|
|
5275
5327
|
{
|
|
5276
5328
|
type: "button",
|
|
5277
5329
|
className: clsx_default("control-btn", isPip && "is-active"),
|
|
5278
5330
|
onClick: togglePip,
|
|
5279
5331
|
"aria-label": isPip ? "PIP \uC885\uB8CC" : "PIP",
|
|
5280
|
-
children: /* @__PURE__ */ (0,
|
|
5332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PipIcon, {})
|
|
5281
5333
|
}
|
|
5282
5334
|
),
|
|
5283
|
-
showDownload && /* @__PURE__ */ (0,
|
|
5335
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5284
5336
|
"a",
|
|
5285
5337
|
{
|
|
5286
5338
|
className: "control-btn",
|
|
5287
5339
|
href: src,
|
|
5288
5340
|
download: downloadFileName ?? true,
|
|
5289
5341
|
"aria-label": "\uB2E4\uC6B4\uB85C\uB4DC",
|
|
5290
|
-
children: /* @__PURE__ */ (0,
|
|
5342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(DownloadIcon_default, {})
|
|
5291
5343
|
}
|
|
5292
5344
|
),
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
5345
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5294
5346
|
"button",
|
|
5295
5347
|
{
|
|
5296
5348
|
type: "button",
|
|
5297
5349
|
className: "control-btn",
|
|
5298
5350
|
onClick: toggleFullscreen,
|
|
5299
5351
|
"aria-label": isFullscreen ? "\uC804\uCCB4\uD654\uBA74 \uC885\uB8CC" : "\uC804\uCCB4\uD654\uBA74",
|
|
5300
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
5352
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(MinimizeIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(MaximizeIcon_default, {})
|
|
5301
5353
|
}
|
|
5302
5354
|
)
|
|
5303
5355
|
] })
|