@x-plat/design-system 0.5.11 → 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 +38 -17
- package/dist/components/Dropdown/index.css +9 -9
- package/dist/components/Dropdown/index.js +37 -16
- 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 +33 -12
- package/dist/components/PopOver/index.css +6 -9
- package/dist/components/PopOver/index.js +32 -11
- package/dist/components/Select/index.cjs +351 -330
- package/dist/components/Select/index.css +12 -19
- package/dist/components/Select/index.js +350 -329
- package/dist/components/index.cjs +485 -440
- package/dist/components/index.css +27 -37
- package/dist/components/index.js +441 -396
- package/dist/index.cjs +509 -464
- package/dist/index.css +27 -37
- package/dist/index.js +463 -418
- 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,16 +3364,16 @@ 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();
|
|
@@ -3355,12 +3397,15 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3355
3397
|
direction
|
|
3356
3398
|
});
|
|
3357
3399
|
}, [triggerRef, popRef]);
|
|
3358
|
-
|
|
3400
|
+
import_react18.default.useEffect(() => {
|
|
3359
3401
|
if (!enabled) return;
|
|
3360
|
-
|
|
3402
|
+
const raf = requestAnimationFrame(() => {
|
|
3403
|
+
calculatePosition();
|
|
3404
|
+
});
|
|
3361
3405
|
window.addEventListener("resize", calculatePosition);
|
|
3362
3406
|
window.addEventListener("scroll", calculatePosition, true);
|
|
3363
3407
|
return () => {
|
|
3408
|
+
cancelAnimationFrame(raf);
|
|
3364
3409
|
window.removeEventListener("resize", calculatePosition);
|
|
3365
3410
|
window.removeEventListener("scroll", calculatePosition, true);
|
|
3366
3411
|
};
|
|
@@ -3370,9 +3415,9 @@ var useAutoPosition = (triggerRef, popRef, enabled = true) => {
|
|
|
3370
3415
|
var useAutoPosition_default = useAutoPosition;
|
|
3371
3416
|
|
|
3372
3417
|
// src/tokens/hooks/useClickOutside.ts
|
|
3373
|
-
var
|
|
3418
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
3374
3419
|
var useClickOutside = (refs, handler, enabled = true) => {
|
|
3375
|
-
|
|
3420
|
+
import_react19.default.useEffect(() => {
|
|
3376
3421
|
if (!enabled) return;
|
|
3377
3422
|
const refArray = Array.isArray(refs) ? refs : [refs];
|
|
3378
3423
|
const listener = (event) => {
|
|
@@ -3395,17 +3440,17 @@ var useClickOutside = (refs, handler, enabled = true) => {
|
|
|
3395
3440
|
var useClickOutside_default = useClickOutside;
|
|
3396
3441
|
|
|
3397
3442
|
// src/components/Dropdown/Dropdown.tsx
|
|
3398
|
-
var
|
|
3443
|
+
var import_jsx_runtime321 = require("react/jsx-runtime");
|
|
3399
3444
|
var Dropdown = (props) => {
|
|
3400
3445
|
const { items, children } = props;
|
|
3401
|
-
const [isOpen, setIsOpen] =
|
|
3402
|
-
const [mounted, setMounted] =
|
|
3403
|
-
const [visible, setVisible] =
|
|
3404
|
-
const triggerRef =
|
|
3405
|
-
const menuRef =
|
|
3406
|
-
const { position, direction } = useAutoPosition_default(triggerRef, menuRef,
|
|
3407
|
-
useClickOutside_default([triggerRef, menuRef], () => setIsOpen(false));
|
|
3408
|
-
|
|
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(() => {
|
|
3409
3454
|
if (isOpen) {
|
|
3410
3455
|
setMounted(true);
|
|
3411
3456
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -3420,8 +3465,8 @@ var Dropdown = (props) => {
|
|
|
3420
3465
|
item.onClick?.();
|
|
3421
3466
|
setIsOpen(false);
|
|
3422
3467
|
};
|
|
3423
|
-
return /* @__PURE__ */ (0,
|
|
3424
|
-
/* @__PURE__ */ (0,
|
|
3468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime321.jsxs)("div", { className: "lib-xplat-dropdown", children: [
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3425
3470
|
"div",
|
|
3426
3471
|
{
|
|
3427
3472
|
ref: triggerRef,
|
|
@@ -3430,14 +3475,14 @@ var Dropdown = (props) => {
|
|
|
3430
3475
|
children
|
|
3431
3476
|
}
|
|
3432
3477
|
),
|
|
3433
|
-
mounted && /* @__PURE__ */ (0,
|
|
3478
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3434
3479
|
"div",
|
|
3435
3480
|
{
|
|
3436
3481
|
ref: menuRef,
|
|
3437
|
-
className: clsx_default("dropdown-menu", direction, { visible }),
|
|
3482
|
+
className: clsx_default("lib-xplat-dropdown-menu", direction, { visible }),
|
|
3438
3483
|
style: { top: position.top, left: position.left },
|
|
3439
3484
|
role: "menu",
|
|
3440
|
-
children: items.map((item) => /* @__PURE__ */ (0,
|
|
3485
|
+
children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(
|
|
3441
3486
|
"button",
|
|
3442
3487
|
{
|
|
3443
3488
|
className: clsx_default("dropdown-item", {
|
|
@@ -3452,30 +3497,30 @@ var Dropdown = (props) => {
|
|
|
3452
3497
|
item.key
|
|
3453
3498
|
))
|
|
3454
3499
|
}
|
|
3455
|
-
)
|
|
3500
|
+
) })
|
|
3456
3501
|
] });
|
|
3457
3502
|
};
|
|
3458
3503
|
Dropdown.displayName = "Dropdown";
|
|
3459
3504
|
var Dropdown_default = Dropdown;
|
|
3460
3505
|
|
|
3461
3506
|
// src/components/EmptyState/EmptyState.tsx
|
|
3462
|
-
var
|
|
3507
|
+
var import_jsx_runtime322 = require("react/jsx-runtime");
|
|
3463
3508
|
var EmptyState = (props) => {
|
|
3464
3509
|
const { icon, title = "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4", description, action } = props;
|
|
3465
|
-
return /* @__PURE__ */ (0,
|
|
3466
|
-
icon && /* @__PURE__ */ (0,
|
|
3467
|
-
!icon && /* @__PURE__ */ (0,
|
|
3468
|
-
/* @__PURE__ */ (0,
|
|
3469
|
-
description && /* @__PURE__ */ (0,
|
|
3470
|
-
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 })
|
|
3471
3516
|
] });
|
|
3472
3517
|
};
|
|
3473
3518
|
EmptyState.displayName = "EmptyState";
|
|
3474
3519
|
var EmptyState_default = EmptyState;
|
|
3475
3520
|
|
|
3476
3521
|
// src/components/FileUpload/FileUpload.tsx
|
|
3477
|
-
var
|
|
3478
|
-
var
|
|
3522
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
3523
|
+
var import_jsx_runtime323 = require("react/jsx-runtime");
|
|
3479
3524
|
var FileUpload = (props) => {
|
|
3480
3525
|
const {
|
|
3481
3526
|
accept,
|
|
@@ -3485,8 +3530,8 @@ var FileUpload = (props) => {
|
|
|
3485
3530
|
label = "\uD30C\uC77C\uC744 \uB4DC\uB798\uADF8\uD558\uAC70\uB098 \uD074\uB9AD\uD558\uC5EC \uC5C5\uB85C\uB4DC",
|
|
3486
3531
|
description
|
|
3487
3532
|
} = props;
|
|
3488
|
-
const [isDragOver, setIsDragOver] =
|
|
3489
|
-
const inputRef =
|
|
3533
|
+
const [isDragOver, setIsDragOver] = import_react21.default.useState(false);
|
|
3534
|
+
const inputRef = import_react21.default.useRef(null);
|
|
3490
3535
|
const handleFiles = (fileList) => {
|
|
3491
3536
|
let files = Array.from(fileList);
|
|
3492
3537
|
if (maxSize) {
|
|
@@ -3516,7 +3561,7 @@ var FileUpload = (props) => {
|
|
|
3516
3561
|
handleFiles(e.target.files);
|
|
3517
3562
|
}
|
|
3518
3563
|
};
|
|
3519
|
-
return /* @__PURE__ */ (0,
|
|
3564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime323.jsxs)(
|
|
3520
3565
|
"div",
|
|
3521
3566
|
{
|
|
3522
3567
|
className: clsx_default("lib-xplat-file-upload", { "drag-over": isDragOver }),
|
|
@@ -3525,7 +3570,7 @@ var FileUpload = (props) => {
|
|
|
3525
3570
|
onDragLeave: handleDragLeave,
|
|
3526
3571
|
onClick: () => inputRef.current?.click(),
|
|
3527
3572
|
children: [
|
|
3528
|
-
/* @__PURE__ */ (0,
|
|
3573
|
+
/* @__PURE__ */ (0, import_jsx_runtime323.jsx)(
|
|
3529
3574
|
"input",
|
|
3530
3575
|
{
|
|
3531
3576
|
ref: inputRef,
|
|
@@ -3535,9 +3580,9 @@ var FileUpload = (props) => {
|
|
|
3535
3580
|
onChange: handleChange
|
|
3536
3581
|
}
|
|
3537
3582
|
),
|
|
3538
|
-
/* @__PURE__ */ (0,
|
|
3539
|
-
/* @__PURE__ */ (0,
|
|
3540
|
-
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 })
|
|
3541
3586
|
]
|
|
3542
3587
|
}
|
|
3543
3588
|
);
|
|
@@ -3546,10 +3591,10 @@ FileUpload.displayName = "FileUpload";
|
|
|
3546
3591
|
var FileUpload_default = FileUpload;
|
|
3547
3592
|
|
|
3548
3593
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
3549
|
-
var
|
|
3594
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
3550
3595
|
|
|
3551
3596
|
// src/components/HtmlTypeWriter/utils.ts
|
|
3552
|
-
var
|
|
3597
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3553
3598
|
var voidTags = /* @__PURE__ */ new Set([
|
|
3554
3599
|
"br",
|
|
3555
3600
|
"img",
|
|
@@ -3617,41 +3662,41 @@ var convertNodeToReactWithRange = (node, typedLen, rangeMap) => {
|
|
|
3617
3662
|
props[attr.name] = attr.value;
|
|
3618
3663
|
});
|
|
3619
3664
|
if (voidTags.has(tag)) {
|
|
3620
|
-
return
|
|
3665
|
+
return import_react22.default.createElement(tag, props);
|
|
3621
3666
|
}
|
|
3622
3667
|
const children = Array.from(element.childNodes).map((child) => convertNodeToReactWithRange(child, typedLen, rangeMap)).filter((n) => n != null);
|
|
3623
|
-
return
|
|
3668
|
+
return import_react22.default.createElement(tag, props, ...children);
|
|
3624
3669
|
};
|
|
3625
3670
|
var htmlToReactProgressive = (root, typedLen, rangeMap) => {
|
|
3626
3671
|
const nodes = Array.from(root.childNodes).map((child, idx) => {
|
|
3627
3672
|
const node = convertNodeToReactWithRange(child, typedLen, rangeMap);
|
|
3628
|
-
return node == null ? null :
|
|
3673
|
+
return node == null ? null : import_react22.default.createElement(import_react22.default.Fragment, { key: idx }, node);
|
|
3629
3674
|
}).filter(Boolean);
|
|
3630
3675
|
return nodes.length === 0 ? null : nodes;
|
|
3631
3676
|
};
|
|
3632
3677
|
|
|
3633
3678
|
// src/components/HtmlTypeWriter/HtmlTypeWriter.tsx
|
|
3634
|
-
var
|
|
3679
|
+
var import_jsx_runtime324 = require("react/jsx-runtime");
|
|
3635
3680
|
var HtmlTypeWriter = ({
|
|
3636
3681
|
html,
|
|
3637
3682
|
duration = 20,
|
|
3638
3683
|
onDone,
|
|
3639
3684
|
onChange
|
|
3640
3685
|
}) => {
|
|
3641
|
-
const [typedLen, setTypedLen] =
|
|
3642
|
-
const doneCalledRef =
|
|
3643
|
-
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(() => {
|
|
3644
3689
|
if (typeof window === "undefined") return { doc: null, rangeMap: /* @__PURE__ */ new Map(), totalLength: 0 };
|
|
3645
3690
|
const decoded = decodeHtmlEntities(html);
|
|
3646
3691
|
const doc2 = new DOMParser().parseFromString(decoded, "text/html");
|
|
3647
3692
|
const { rangeMap: rangeMap2, totalLength: totalLength2 } = buildRangeMap(doc2.body);
|
|
3648
3693
|
return { doc: doc2, rangeMap: rangeMap2, totalLength: totalLength2 };
|
|
3649
3694
|
}, [html]);
|
|
3650
|
-
|
|
3695
|
+
import_react23.default.useEffect(() => {
|
|
3651
3696
|
setTypedLen(0);
|
|
3652
3697
|
doneCalledRef.current = false;
|
|
3653
3698
|
}, [html]);
|
|
3654
|
-
|
|
3699
|
+
import_react23.default.useEffect(() => {
|
|
3655
3700
|
if (!totalLength) return;
|
|
3656
3701
|
if (typedLen >= totalLength) return;
|
|
3657
3702
|
const timer = window.setInterval(() => {
|
|
@@ -3659,33 +3704,33 @@ var HtmlTypeWriter = ({
|
|
|
3659
3704
|
}, duration);
|
|
3660
3705
|
return () => window.clearInterval(timer);
|
|
3661
3706
|
}, [typedLen, totalLength, duration]);
|
|
3662
|
-
|
|
3707
|
+
import_react23.default.useEffect(() => {
|
|
3663
3708
|
if (typedLen > 0 && typedLen < totalLength) {
|
|
3664
3709
|
onChange?.();
|
|
3665
3710
|
}
|
|
3666
3711
|
}, [typedLen, totalLength, onChange]);
|
|
3667
|
-
|
|
3712
|
+
import_react23.default.useEffect(() => {
|
|
3668
3713
|
if (typedLen === totalLength && totalLength > 0 && !doneCalledRef.current) {
|
|
3669
3714
|
doneCalledRef.current = true;
|
|
3670
3715
|
onDone?.();
|
|
3671
3716
|
}
|
|
3672
3717
|
}, [typedLen, totalLength, onDone]);
|
|
3673
|
-
const parsed =
|
|
3718
|
+
const parsed = import_react23.default.useMemo(
|
|
3674
3719
|
() => doc ? htmlToReactProgressive(doc.body, typedLen, rangeMap) : null,
|
|
3675
3720
|
[doc, typedLen, rangeMap]
|
|
3676
3721
|
);
|
|
3677
|
-
return /* @__PURE__ */ (0,
|
|
3722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)("div", { className: "lib-xplat-htmlTypewriter", children: parsed });
|
|
3678
3723
|
};
|
|
3679
3724
|
HtmlTypeWriter.displayName = "HtmlTypeWriter";
|
|
3680
3725
|
var HtmlTypeWriter_default = HtmlTypeWriter;
|
|
3681
3726
|
|
|
3682
3727
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
3683
|
-
var
|
|
3684
|
-
var
|
|
3728
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
3729
|
+
var import_jsx_runtime325 = require("react/jsx-runtime");
|
|
3685
3730
|
var ImageSelector = (props) => {
|
|
3686
3731
|
const { value, label, onChange } = props;
|
|
3687
|
-
const [previewUrl, setPreviewUrl] =
|
|
3688
|
-
|
|
3732
|
+
const [previewUrl, setPreviewUrl] = import_react24.default.useState();
|
|
3733
|
+
import_react24.default.useEffect(() => {
|
|
3689
3734
|
if (!value) {
|
|
3690
3735
|
setPreviewUrl(void 0);
|
|
3691
3736
|
return;
|
|
@@ -3694,7 +3739,7 @@ var ImageSelector = (props) => {
|
|
|
3694
3739
|
setPreviewUrl(url);
|
|
3695
3740
|
return () => URL.revokeObjectURL(url);
|
|
3696
3741
|
}, [value]);
|
|
3697
|
-
const inputRef =
|
|
3742
|
+
const inputRef = import_react24.default.useRef(null);
|
|
3698
3743
|
const handleFileChange = (e) => {
|
|
3699
3744
|
const selectedFile = e.target.files?.[0];
|
|
3700
3745
|
if (selectedFile) {
|
|
@@ -3707,8 +3752,8 @@ var ImageSelector = (props) => {
|
|
|
3707
3752
|
const handleOpenFileDialog = () => {
|
|
3708
3753
|
inputRef.current?.click();
|
|
3709
3754
|
};
|
|
3710
|
-
return /* @__PURE__ */ (0,
|
|
3711
|
-
/* @__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)(
|
|
3712
3757
|
"input",
|
|
3713
3758
|
{
|
|
3714
3759
|
type: "file",
|
|
@@ -3718,13 +3763,13 @@ var ImageSelector = (props) => {
|
|
|
3718
3763
|
ref: inputRef
|
|
3719
3764
|
}
|
|
3720
3765
|
),
|
|
3721
|
-
value && /* @__PURE__ */ (0,
|
|
3722
|
-
/* @__PURE__ */ (0,
|
|
3723
|
-
/* @__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, {}) })
|
|
3724
3769
|
] }),
|
|
3725
|
-
/* @__PURE__ */ (0,
|
|
3726
|
-
/* @__PURE__ */ (0,
|
|
3727
|
-
/* @__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" })
|
|
3728
3773
|
] }) })
|
|
3729
3774
|
] });
|
|
3730
3775
|
};
|
|
@@ -3732,7 +3777,7 @@ ImageSelector.displayName = "ImageSelector";
|
|
|
3732
3777
|
var ImageSelector_default = ImageSelector;
|
|
3733
3778
|
|
|
3734
3779
|
// src/components/Pagination/Pagination.tsx
|
|
3735
|
-
var
|
|
3780
|
+
var import_jsx_runtime326 = require("react/jsx-runtime");
|
|
3736
3781
|
var getPageRange = (current, totalPages, siblingCount) => {
|
|
3737
3782
|
const totalNumbers = siblingCount * 2 + 5;
|
|
3738
3783
|
if (totalPages <= totalNumbers) {
|
|
@@ -3775,19 +3820,19 @@ var Pagination = (props) => {
|
|
|
3775
3820
|
onChange?.(page);
|
|
3776
3821
|
}
|
|
3777
3822
|
};
|
|
3778
|
-
return /* @__PURE__ */ (0,
|
|
3779
|
-
/* @__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)(
|
|
3780
3825
|
"button",
|
|
3781
3826
|
{
|
|
3782
3827
|
className: "page-btn prev",
|
|
3783
3828
|
disabled: current <= 1,
|
|
3784
3829
|
onClick: () => handleClick(current - 1),
|
|
3785
3830
|
"aria-label": "\uC774\uC804 \uD398\uC774\uC9C0",
|
|
3786
|
-
children: /* @__PURE__ */ (0,
|
|
3831
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(ChevronLeftIcon_default, {})
|
|
3787
3832
|
}
|
|
3788
3833
|
),
|
|
3789
3834
|
pages.map(
|
|
3790
|
-
(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)(
|
|
3791
3836
|
"button",
|
|
3792
3837
|
{
|
|
3793
3838
|
className: clsx_default("page-btn", { active: page === current }),
|
|
@@ -3798,14 +3843,14 @@ var Pagination = (props) => {
|
|
|
3798
3843
|
page
|
|
3799
3844
|
)
|
|
3800
3845
|
),
|
|
3801
|
-
/* @__PURE__ */ (0,
|
|
3846
|
+
/* @__PURE__ */ (0, import_jsx_runtime326.jsx)(
|
|
3802
3847
|
"button",
|
|
3803
3848
|
{
|
|
3804
3849
|
className: "page-btn next",
|
|
3805
3850
|
disabled: current >= totalPages,
|
|
3806
3851
|
onClick: () => handleClick(current + 1),
|
|
3807
3852
|
"aria-label": "\uB2E4\uC74C \uD398\uC774\uC9C0",
|
|
3808
|
-
children: /* @__PURE__ */ (0,
|
|
3853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime326.jsx)(ChevronRightIcon_default, {})
|
|
3809
3854
|
}
|
|
3810
3855
|
)
|
|
3811
3856
|
] });
|
|
@@ -3814,17 +3859,17 @@ Pagination.displayName = "Pagination";
|
|
|
3814
3859
|
var Pagination_default = Pagination;
|
|
3815
3860
|
|
|
3816
3861
|
// src/components/PopOver/PopOver.tsx
|
|
3817
|
-
var
|
|
3818
|
-
var
|
|
3862
|
+
var import_react25 = __toESM(require("react"), 1);
|
|
3863
|
+
var import_jsx_runtime327 = require("react/jsx-runtime");
|
|
3819
3864
|
var PopOver = (props) => {
|
|
3820
3865
|
const { children, isOpen, onClose, PopOverEl } = props;
|
|
3821
|
-
const popRef =
|
|
3822
|
-
const triggerRef =
|
|
3823
|
-
const [localOpen, setLocalOpen] =
|
|
3824
|
-
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);
|
|
3825
3870
|
useClickOutside_default([popRef, triggerRef], onClose, isOpen);
|
|
3826
3871
|
const position = useAutoPosition_default(triggerRef, popRef, localOpen);
|
|
3827
|
-
|
|
3872
|
+
import_react25.default.useEffect(() => {
|
|
3828
3873
|
if (isOpen) {
|
|
3829
3874
|
setLocalOpen(isOpen);
|
|
3830
3875
|
setTimeout(() => {
|
|
@@ -3837,7 +3882,7 @@ var PopOver = (props) => {
|
|
|
3837
3882
|
}, 200);
|
|
3838
3883
|
}
|
|
3839
3884
|
}, [isOpen]);
|
|
3840
|
-
return /* @__PURE__ */ (0,
|
|
3885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)(
|
|
3841
3886
|
"div",
|
|
3842
3887
|
{
|
|
3843
3888
|
className: "lib-xplat-pop-over",
|
|
@@ -3847,11 +3892,11 @@ var PopOver = (props) => {
|
|
|
3847
3892
|
},
|
|
3848
3893
|
children: [
|
|
3849
3894
|
children,
|
|
3850
|
-
localOpen && /* @__PURE__ */ (0,
|
|
3895
|
+
localOpen && /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
|
|
3851
3896
|
"div",
|
|
3852
3897
|
{
|
|
3853
3898
|
className: clsx_default(
|
|
3854
|
-
"content
|
|
3899
|
+
"lib-xplat-pop-over-content",
|
|
3855
3900
|
position.direction,
|
|
3856
3901
|
eventTrigger && "visible"
|
|
3857
3902
|
),
|
|
@@ -3861,7 +3906,7 @@ var PopOver = (props) => {
|
|
|
3861
3906
|
},
|
|
3862
3907
|
children: PopOverEl
|
|
3863
3908
|
}
|
|
3864
|
-
)
|
|
3909
|
+
) })
|
|
3865
3910
|
]
|
|
3866
3911
|
}
|
|
3867
3912
|
);
|
|
@@ -3870,7 +3915,7 @@ PopOver.displayName = "PopOver";
|
|
|
3870
3915
|
var PopOver_default = PopOver;
|
|
3871
3916
|
|
|
3872
3917
|
// src/components/Progress/Progress.tsx
|
|
3873
|
-
var
|
|
3918
|
+
var import_jsx_runtime328 = require("react/jsx-runtime");
|
|
3874
3919
|
var Progress = (props) => {
|
|
3875
3920
|
const {
|
|
3876
3921
|
value,
|
|
@@ -3880,8 +3925,8 @@ var Progress = (props) => {
|
|
|
3880
3925
|
showLabel = false
|
|
3881
3926
|
} = props;
|
|
3882
3927
|
const percentage = Math.min(100, Math.max(0, value / max * 100));
|
|
3883
|
-
return /* @__PURE__ */ (0,
|
|
3884
|
-
/* @__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)(
|
|
3885
3930
|
"div",
|
|
3886
3931
|
{
|
|
3887
3932
|
className: "track",
|
|
@@ -3889,7 +3934,7 @@ var Progress = (props) => {
|
|
|
3889
3934
|
"aria-valuenow": value,
|
|
3890
3935
|
"aria-valuemin": 0,
|
|
3891
3936
|
"aria-valuemax": max,
|
|
3892
|
-
children: /* @__PURE__ */ (0,
|
|
3937
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
|
|
3893
3938
|
"div",
|
|
3894
3939
|
{
|
|
3895
3940
|
className: "bar",
|
|
@@ -3898,7 +3943,7 @@ var Progress = (props) => {
|
|
|
3898
3943
|
)
|
|
3899
3944
|
}
|
|
3900
3945
|
),
|
|
3901
|
-
showLabel && /* @__PURE__ */ (0,
|
|
3946
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime328.jsxs)("span", { className: "label", children: [
|
|
3902
3947
|
Math.round(percentage),
|
|
3903
3948
|
"%"
|
|
3904
3949
|
] })
|
|
@@ -3908,17 +3953,17 @@ Progress.displayName = "Progress";
|
|
|
3908
3953
|
var Progress_default = Progress;
|
|
3909
3954
|
|
|
3910
3955
|
// src/components/Radio/RadioGroupContext.tsx
|
|
3911
|
-
var
|
|
3912
|
-
var RadioGroupContext =
|
|
3956
|
+
var import_react26 = __toESM(require("react"), 1);
|
|
3957
|
+
var RadioGroupContext = import_react26.default.createContext(
|
|
3913
3958
|
null
|
|
3914
3959
|
);
|
|
3915
3960
|
var useRadioGroupContext = () => {
|
|
3916
|
-
return
|
|
3961
|
+
return import_react26.default.useContext(RadioGroupContext);
|
|
3917
3962
|
};
|
|
3918
3963
|
var RadioGroupContext_default = RadioGroupContext;
|
|
3919
3964
|
|
|
3920
3965
|
// src/components/Radio/Radio.tsx
|
|
3921
|
-
var
|
|
3966
|
+
var import_jsx_runtime329 = require("react/jsx-runtime");
|
|
3922
3967
|
var Radio = (props) => {
|
|
3923
3968
|
const {
|
|
3924
3969
|
label,
|
|
@@ -3936,7 +3981,7 @@ var Radio = (props) => {
|
|
|
3936
3981
|
value,
|
|
3937
3982
|
onChange: rest.onChange
|
|
3938
3983
|
};
|
|
3939
|
-
return /* @__PURE__ */ (0,
|
|
3984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime329.jsxs)(
|
|
3940
3985
|
"label",
|
|
3941
3986
|
{
|
|
3942
3987
|
className: clsx_default(
|
|
@@ -3946,18 +3991,18 @@ var Radio = (props) => {
|
|
|
3946
3991
|
localChecked ? "checked" : void 0
|
|
3947
3992
|
),
|
|
3948
3993
|
children: [
|
|
3949
|
-
/* @__PURE__ */ (0,
|
|
3950
|
-
/* @__PURE__ */ (0,
|
|
3994
|
+
/* @__PURE__ */ (0, import_jsx_runtime329.jsx)("input", { ...rest, ...inputProps, checked: localChecked, type: "radio" }),
|
|
3995
|
+
/* @__PURE__ */ (0, import_jsx_runtime329.jsx)(
|
|
3951
3996
|
"div",
|
|
3952
3997
|
{
|
|
3953
3998
|
className: clsx_default(
|
|
3954
3999
|
"circle",
|
|
3955
4000
|
localChecked ? "checked" : void 0
|
|
3956
4001
|
),
|
|
3957
|
-
children: localChecked && /* @__PURE__ */ (0,
|
|
4002
|
+
children: localChecked && /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("div", { className: "inner-circle" })
|
|
3958
4003
|
}
|
|
3959
4004
|
),
|
|
3960
|
-
label && /* @__PURE__ */ (0,
|
|
4005
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime329.jsx)("span", { children: label })
|
|
3961
4006
|
]
|
|
3962
4007
|
}
|
|
3963
4008
|
);
|
|
@@ -3966,28 +4011,28 @@ Radio.displayName = "Radio";
|
|
|
3966
4011
|
var Radio_default = Radio;
|
|
3967
4012
|
|
|
3968
4013
|
// src/components/Radio/RadioGroup.tsx
|
|
3969
|
-
var
|
|
4014
|
+
var import_jsx_runtime330 = require("react/jsx-runtime");
|
|
3970
4015
|
var RadioGroup = (props) => {
|
|
3971
4016
|
const { children, ...rest } = props;
|
|
3972
|
-
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 }) });
|
|
3973
4018
|
};
|
|
3974
4019
|
RadioGroup.displayName = "RadioGroup";
|
|
3975
4020
|
var RadioGroup_default = RadioGroup;
|
|
3976
4021
|
|
|
3977
4022
|
// src/components/Select/Select.tsx
|
|
3978
|
-
var
|
|
4023
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
3979
4024
|
|
|
3980
4025
|
// src/components/Select/context.ts
|
|
3981
|
-
var
|
|
3982
|
-
var SelectContext =
|
|
4026
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
4027
|
+
var SelectContext = import_react27.default.createContext(null);
|
|
3983
4028
|
var context_default = SelectContext;
|
|
3984
4029
|
|
|
3985
4030
|
// src/components/Select/SelectItem.tsx
|
|
3986
|
-
var
|
|
3987
|
-
var
|
|
4031
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
4032
|
+
var import_jsx_runtime331 = require("react/jsx-runtime");
|
|
3988
4033
|
var SelectItem = (props) => {
|
|
3989
4034
|
const { children, value, onClick, disabled = false } = props;
|
|
3990
|
-
const ctx =
|
|
4035
|
+
const ctx = import_react28.default.useContext(context_default);
|
|
3991
4036
|
const handleClick = (e) => {
|
|
3992
4037
|
e.preventDefault();
|
|
3993
4038
|
e.stopPropagation();
|
|
@@ -3996,7 +4041,7 @@ var SelectItem = (props) => {
|
|
|
3996
4041
|
ctx?.close();
|
|
3997
4042
|
onClick?.();
|
|
3998
4043
|
};
|
|
3999
|
-
return /* @__PURE__ */ (0,
|
|
4044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime331.jsx)(
|
|
4000
4045
|
"div",
|
|
4001
4046
|
{
|
|
4002
4047
|
className: clsx_default("select-item", disabled && "disabled"),
|
|
@@ -4017,7 +4062,7 @@ SelectItem.displayName = "Select.Item";
|
|
|
4017
4062
|
var SelectItem_default = SelectItem;
|
|
4018
4063
|
|
|
4019
4064
|
// src/components/Select/Select.tsx
|
|
4020
|
-
var
|
|
4065
|
+
var import_jsx_runtime332 = require("react/jsx-runtime");
|
|
4021
4066
|
var ANIMATION_DURATION_MS3 = 200;
|
|
4022
4067
|
var SelectRoot = (props) => {
|
|
4023
4068
|
const {
|
|
@@ -4029,26 +4074,26 @@ var SelectRoot = (props) => {
|
|
|
4029
4074
|
error = false,
|
|
4030
4075
|
size = "md"
|
|
4031
4076
|
} = props;
|
|
4032
|
-
const itemChildren =
|
|
4033
|
-
(child) =>
|
|
4077
|
+
const itemChildren = import_react29.default.Children.toArray(children).filter(
|
|
4078
|
+
(child) => import_react29.default.isValidElement(child) && child.type === SelectItem_default
|
|
4034
4079
|
);
|
|
4035
4080
|
const isControlled = valueProp !== void 0;
|
|
4036
|
-
const [isOpen, setOpen] =
|
|
4037
|
-
const [uncontrolledLabel, setUncontrolledLabel] =
|
|
4038
|
-
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(() => {
|
|
4039
4084
|
if (!isControlled) return null;
|
|
4040
4085
|
const match = itemChildren.find((child) => child.props.value === valueProp);
|
|
4041
4086
|
return match ? match.props.children : null;
|
|
4042
4087
|
}, [isControlled, valueProp, itemChildren]);
|
|
4043
4088
|
const selectedLabel = isControlled ? controlledLabel : uncontrolledLabel;
|
|
4044
|
-
const triggerRef =
|
|
4045
|
-
const contentRef =
|
|
4046
|
-
const [mounted, setMounted] =
|
|
4047
|
-
const [visible, setVisible] =
|
|
4048
|
-
|
|
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(() => {
|
|
4049
4094
|
if (disabled && isOpen) setOpen(false);
|
|
4050
4095
|
}, [disabled, isOpen]);
|
|
4051
|
-
|
|
4096
|
+
import_react29.default.useEffect(() => {
|
|
4052
4097
|
if (isOpen) {
|
|
4053
4098
|
setMounted(true);
|
|
4054
4099
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -4058,12 +4103,12 @@ var SelectRoot = (props) => {
|
|
|
4058
4103
|
const t = setTimeout(() => setMounted(false), ANIMATION_DURATION_MS3);
|
|
4059
4104
|
return () => clearTimeout(t);
|
|
4060
4105
|
}, [isOpen]);
|
|
4061
|
-
const open =
|
|
4062
|
-
const close =
|
|
4063
|
-
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), []);
|
|
4064
4109
|
useClickOutside_default([contentRef, triggerRef], close, isOpen);
|
|
4065
4110
|
const position = useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
4066
|
-
const setSelected =
|
|
4111
|
+
const setSelected = import_react29.default.useCallback(
|
|
4067
4112
|
(label, itemValue) => {
|
|
4068
4113
|
if (!isControlled) {
|
|
4069
4114
|
setUncontrolledLabel(label);
|
|
@@ -4072,7 +4117,7 @@ var SelectRoot = (props) => {
|
|
|
4072
4117
|
},
|
|
4073
4118
|
[isControlled, onChange]
|
|
4074
4119
|
);
|
|
4075
|
-
const ctxValue =
|
|
4120
|
+
const ctxValue = import_react29.default.useMemo(
|
|
4076
4121
|
() => ({
|
|
4077
4122
|
isOpen,
|
|
4078
4123
|
mounted,
|
|
@@ -4093,7 +4138,7 @@ var SelectRoot = (props) => {
|
|
|
4093
4138
|
if (disabled) return;
|
|
4094
4139
|
toggle();
|
|
4095
4140
|
};
|
|
4096
|
-
return /* @__PURE__ */ (0,
|
|
4141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(context_default.Provider, { value: ctxValue, children: /* @__PURE__ */ (0, import_jsx_runtime332.jsxs)(
|
|
4097
4142
|
"div",
|
|
4098
4143
|
{
|
|
4099
4144
|
className: clsx_default(
|
|
@@ -4104,7 +4149,7 @@ var SelectRoot = (props) => {
|
|
|
4104
4149
|
mounted && "is-open"
|
|
4105
4150
|
),
|
|
4106
4151
|
children: [
|
|
4107
|
-
/* @__PURE__ */ (0,
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsxs)(
|
|
4108
4153
|
"div",
|
|
4109
4154
|
{
|
|
4110
4155
|
ref: triggerRef,
|
|
@@ -4128,7 +4173,7 @@ var SelectRoot = (props) => {
|
|
|
4128
4173
|
}
|
|
4129
4174
|
},
|
|
4130
4175
|
children: [
|
|
4131
|
-
/* @__PURE__ */ (0,
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
4132
4177
|
"span",
|
|
4133
4178
|
{
|
|
4134
4179
|
className: clsx_default(
|
|
@@ -4138,27 +4183,27 @@ var SelectRoot = (props) => {
|
|
|
4138
4183
|
children: selectedLabel ?? placeholder
|
|
4139
4184
|
}
|
|
4140
4185
|
),
|
|
4141
|
-
/* @__PURE__ */ (0,
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
4142
4187
|
"span",
|
|
4143
4188
|
{
|
|
4144
4189
|
className: clsx_default("select-trigger-icon", isOpen && "open"),
|
|
4145
4190
|
"aria-hidden": true,
|
|
4146
|
-
children: /* @__PURE__ */ (0,
|
|
4191
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(ChevronDownIcon_default, {})
|
|
4147
4192
|
}
|
|
4148
4193
|
)
|
|
4149
4194
|
]
|
|
4150
4195
|
}
|
|
4151
4196
|
),
|
|
4152
|
-
mounted && /* @__PURE__ */ (0,
|
|
4197
|
+
mounted && /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(
|
|
4153
4198
|
"div",
|
|
4154
4199
|
{
|
|
4155
|
-
className: clsx_default("select-content", position.direction, stateClass),
|
|
4200
|
+
className: clsx_default("lib-xplat-select-content", position.direction, stateClass),
|
|
4156
4201
|
ref: contentRef,
|
|
4157
4202
|
style: { ...position.position, minWidth: position.position.width },
|
|
4158
4203
|
role: "listbox",
|
|
4159
|
-
children: itemChildren
|
|
4204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime332.jsx)(context_default.Provider, { value: ctxValue, children: itemChildren })
|
|
4160
4205
|
}
|
|
4161
|
-
)
|
|
4206
|
+
) })
|
|
4162
4207
|
]
|
|
4163
4208
|
}
|
|
4164
4209
|
) });
|
|
@@ -4170,14 +4215,14 @@ var Select = Object.assign(SelectRoot, {
|
|
|
4170
4215
|
var Select_default = Select;
|
|
4171
4216
|
|
|
4172
4217
|
// src/components/Skeleton/Skeleton.tsx
|
|
4173
|
-
var
|
|
4218
|
+
var import_jsx_runtime333 = require("react/jsx-runtime");
|
|
4174
4219
|
var Skeleton = (props) => {
|
|
4175
4220
|
const { variant = "text", width, height } = props;
|
|
4176
4221
|
const style = {
|
|
4177
4222
|
width: typeof width === "number" ? `${width}px` : width,
|
|
4178
4223
|
height: typeof height === "number" ? `${height}px` : height
|
|
4179
4224
|
};
|
|
4180
|
-
return /* @__PURE__ */ (0,
|
|
4225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime333.jsx)(
|
|
4181
4226
|
"div",
|
|
4182
4227
|
{
|
|
4183
4228
|
className: clsx_default("lib-xplat-skeleton", variant),
|
|
@@ -4190,20 +4235,20 @@ Skeleton.displayName = "Skeleton";
|
|
|
4190
4235
|
var Skeleton_default = Skeleton;
|
|
4191
4236
|
|
|
4192
4237
|
// src/components/Spinner/Spinner.tsx
|
|
4193
|
-
var
|
|
4238
|
+
var import_jsx_runtime334 = require("react/jsx-runtime");
|
|
4194
4239
|
var Spinner = (props) => {
|
|
4195
4240
|
const {
|
|
4196
4241
|
size = "md",
|
|
4197
4242
|
type = "brand"
|
|
4198
4243
|
} = props;
|
|
4199
|
-
return /* @__PURE__ */ (0,
|
|
4244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4200
4245
|
"div",
|
|
4201
4246
|
{
|
|
4202
4247
|
className: clsx_default("lib-xplat-spinner", size, type),
|
|
4203
4248
|
role: "status",
|
|
4204
4249
|
"aria-label": "\uB85C\uB529 \uC911",
|
|
4205
|
-
children: /* @__PURE__ */ (0,
|
|
4206
|
-
/* @__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)(
|
|
4207
4252
|
"circle",
|
|
4208
4253
|
{
|
|
4209
4254
|
className: "track",
|
|
@@ -4213,7 +4258,7 @@ var Spinner = (props) => {
|
|
|
4213
4258
|
strokeWidth: "3"
|
|
4214
4259
|
}
|
|
4215
4260
|
),
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
4261
|
+
/* @__PURE__ */ (0, import_jsx_runtime334.jsx)(
|
|
4217
4262
|
"circle",
|
|
4218
4263
|
{
|
|
4219
4264
|
className: "indicator",
|
|
@@ -4232,20 +4277,20 @@ Spinner.displayName = "Spinner";
|
|
|
4232
4277
|
var Spinner_default = Spinner;
|
|
4233
4278
|
|
|
4234
4279
|
// src/components/Steps/Steps.tsx
|
|
4235
|
-
var
|
|
4280
|
+
var import_jsx_runtime335 = require("react/jsx-runtime");
|
|
4236
4281
|
var Steps = (props) => {
|
|
4237
4282
|
const {
|
|
4238
4283
|
items,
|
|
4239
4284
|
current,
|
|
4240
4285
|
type = "brand"
|
|
4241
4286
|
} = props;
|
|
4242
|
-
return /* @__PURE__ */ (0,
|
|
4287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime335.jsx)("div", { className: clsx_default("lib-xplat-steps", type), children: items.map((item, index) => {
|
|
4243
4288
|
const status = index < current ? "completed" : index === current ? "active" : "pending";
|
|
4244
|
-
return /* @__PURE__ */ (0,
|
|
4245
|
-
/* @__PURE__ */ (0,
|
|
4246
|
-
/* @__PURE__ */ (0,
|
|
4247
|
-
/* @__PURE__ */ (0,
|
|
4248
|
-
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 })
|
|
4249
4294
|
] })
|
|
4250
4295
|
] }, index);
|
|
4251
4296
|
}) });
|
|
@@ -4254,8 +4299,8 @@ Steps.displayName = "Steps";
|
|
|
4254
4299
|
var Steps_default = Steps;
|
|
4255
4300
|
|
|
4256
4301
|
// src/components/Swiper/Swiper.tsx
|
|
4257
|
-
var
|
|
4258
|
-
var
|
|
4302
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
4303
|
+
var import_jsx_runtime336 = require("react/jsx-runtime");
|
|
4259
4304
|
var Swiper = (props) => {
|
|
4260
4305
|
const {
|
|
4261
4306
|
auto = false,
|
|
@@ -4278,23 +4323,23 @@ var Swiper = (props) => {
|
|
|
4278
4323
|
const maxIndex = Math.max(0, totalSlides - viewItemCount);
|
|
4279
4324
|
const useLoop = loop && canSlide;
|
|
4280
4325
|
const cloneCount = useLoop ? totalSlides : 0;
|
|
4281
|
-
const extendedItems =
|
|
4326
|
+
const extendedItems = import_react30.default.useMemo(() => {
|
|
4282
4327
|
if (!useLoop) return items;
|
|
4283
4328
|
return [...items, ...items, ...items];
|
|
4284
4329
|
}, [items, useLoop]);
|
|
4285
4330
|
const initialIdx = Math.max(0, Math.min(indexProp ?? 0, maxIndex));
|
|
4286
|
-
const [innerIndex, setInnerIndex] =
|
|
4331
|
+
const [innerIndex, setInnerIndex] = import_react30.default.useState(
|
|
4287
4332
|
useLoop ? cloneCount + initialIdx : initialIdx
|
|
4288
4333
|
);
|
|
4289
|
-
const [isDragging, setIsDragging] =
|
|
4290
|
-
const [dragOffset, setDragOffset] =
|
|
4291
|
-
const [animated, setAnimated] =
|
|
4292
|
-
const [containerWidth, setContainerWidth] =
|
|
4293
|
-
const containerRef =
|
|
4294
|
-
const startXRef =
|
|
4295
|
-
const startTimeRef =
|
|
4296
|
-
const autoplayTimerRef =
|
|
4297
|
-
|
|
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(() => {
|
|
4298
4343
|
const el = containerRef.current;
|
|
4299
4344
|
if (!el) return;
|
|
4300
4345
|
const ro = new ResizeObserver((entries) => {
|
|
@@ -4313,7 +4358,7 @@ var Swiper = (props) => {
|
|
|
4313
4358
|
return ((inner - cloneCount) % totalSlides + totalSlides) % totalSlides;
|
|
4314
4359
|
};
|
|
4315
4360
|
const realIndex = getRealIndex(innerIndex);
|
|
4316
|
-
const moveToInner =
|
|
4361
|
+
const moveToInner = import_react30.default.useCallback(
|
|
4317
4362
|
(idx, withAnim = true) => {
|
|
4318
4363
|
if (!useLoop) {
|
|
4319
4364
|
setAnimated(withAnim);
|
|
@@ -4341,7 +4386,7 @@ var Swiper = (props) => {
|
|
|
4341
4386
|
},
|
|
4342
4387
|
[useLoop, cloneCount, totalSlides]
|
|
4343
4388
|
);
|
|
4344
|
-
const handleTransitionEnd =
|
|
4389
|
+
const handleTransitionEnd = import_react30.default.useCallback(() => {
|
|
4345
4390
|
if (!useLoop) return;
|
|
4346
4391
|
const real = getRealIndex(innerIndex);
|
|
4347
4392
|
const canonical = cloneCount + real;
|
|
@@ -4351,7 +4396,7 @@ var Swiper = (props) => {
|
|
|
4351
4396
|
}
|
|
4352
4397
|
onChange?.(Math.min(real, maxIndex));
|
|
4353
4398
|
}, [useLoop, innerIndex, cloneCount, totalSlides, maxIndex, onChange]);
|
|
4354
|
-
const slideTo =
|
|
4399
|
+
const slideTo = import_react30.default.useCallback(
|
|
4355
4400
|
(logicalIndex) => {
|
|
4356
4401
|
if (!canSlide) return;
|
|
4357
4402
|
const clamped = useLoop ? logicalIndex : Math.max(0, Math.min(logicalIndex, maxIndex));
|
|
@@ -4361,7 +4406,7 @@ var Swiper = (props) => {
|
|
|
4361
4406
|
},
|
|
4362
4407
|
[canSlide, useLoop, cloneCount, maxIndex, onChange, moveToInner]
|
|
4363
4408
|
);
|
|
4364
|
-
const slideNext =
|
|
4409
|
+
const slideNext = import_react30.default.useCallback(() => {
|
|
4365
4410
|
if (!canSlide) return;
|
|
4366
4411
|
const nextInner = innerIndex + slideBy;
|
|
4367
4412
|
if (useLoop) {
|
|
@@ -4370,7 +4415,7 @@ var Swiper = (props) => {
|
|
|
4370
4415
|
moveToInner(Math.min(nextInner, maxIndex), true);
|
|
4371
4416
|
}
|
|
4372
4417
|
}, [canSlide, useLoop, innerIndex, slideBy, maxIndex, moveToInner]);
|
|
4373
|
-
const slidePrev =
|
|
4418
|
+
const slidePrev = import_react30.default.useCallback(() => {
|
|
4374
4419
|
if (!canSlide) return;
|
|
4375
4420
|
const prevInner = innerIndex - slideBy;
|
|
4376
4421
|
if (useLoop) {
|
|
@@ -4379,7 +4424,7 @@ var Swiper = (props) => {
|
|
|
4379
4424
|
moveToInner(Math.max(prevInner, 0), true);
|
|
4380
4425
|
}
|
|
4381
4426
|
}, [canSlide, useLoop, innerIndex, slideBy, moveToInner]);
|
|
4382
|
-
|
|
4427
|
+
import_react30.default.useEffect(() => {
|
|
4383
4428
|
if (indexProp === void 0) return;
|
|
4384
4429
|
const clamped = Math.max(0, Math.min(indexProp, maxIndex));
|
|
4385
4430
|
const target = useLoop ? cloneCount + clamped : clamped;
|
|
@@ -4387,12 +4432,12 @@ var Swiper = (props) => {
|
|
|
4387
4432
|
moveToInner(target, true);
|
|
4388
4433
|
}
|
|
4389
4434
|
}, [indexProp]);
|
|
4390
|
-
|
|
4435
|
+
import_react30.default.useImperativeHandle(swiperRef, () => ({
|
|
4391
4436
|
slidePrev,
|
|
4392
4437
|
slideNext,
|
|
4393
4438
|
slideTo
|
|
4394
4439
|
}));
|
|
4395
|
-
|
|
4440
|
+
import_react30.default.useEffect(() => {
|
|
4396
4441
|
if (!auto || !canSlide) return;
|
|
4397
4442
|
autoplayTimerRef.current = setInterval(slideNext, autoplayDelay);
|
|
4398
4443
|
return () => {
|
|
@@ -4415,7 +4460,7 @@ var Swiper = (props) => {
|
|
|
4415
4460
|
startXRef.current = getClientX(e);
|
|
4416
4461
|
startTimeRef.current = Date.now();
|
|
4417
4462
|
};
|
|
4418
|
-
|
|
4463
|
+
import_react30.default.useEffect(() => {
|
|
4419
4464
|
if (!isDragging) return;
|
|
4420
4465
|
const handleMove = (e) => {
|
|
4421
4466
|
setDragOffset(getClientX(e) - startXRef.current);
|
|
@@ -4453,8 +4498,8 @@ var Swiper = (props) => {
|
|
|
4453
4498
|
}, [isDragging, dragOffset, innerIndex, useLoop, maxIndex, slideStep, moveToInner]);
|
|
4454
4499
|
const slideWidthPercent = 100 / viewItemCount;
|
|
4455
4500
|
const gapAdjust = spaceBetween * (viewItemCount - 1) / viewItemCount;
|
|
4456
|
-
const slideElements =
|
|
4457
|
-
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0,
|
|
4501
|
+
const slideElements = import_react30.default.useMemo(
|
|
4502
|
+
() => extendedItems.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4458
4503
|
"div",
|
|
4459
4504
|
{
|
|
4460
4505
|
className: "lib-xplat-swiper__slide",
|
|
@@ -4473,14 +4518,14 @@ var Swiper = (props) => {
|
|
|
4473
4518
|
Math.floor(realIndex / slideBy),
|
|
4474
4519
|
totalSteps - 1
|
|
4475
4520
|
);
|
|
4476
|
-
return /* @__PURE__ */ (0,
|
|
4477
|
-
/* @__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)(
|
|
4478
4523
|
"div",
|
|
4479
4524
|
{
|
|
4480
4525
|
className: "lib-xplat-swiper__viewport",
|
|
4481
4526
|
onMouseDown: handleDragStart,
|
|
4482
4527
|
onTouchStart: handleDragStart,
|
|
4483
|
-
children: /* @__PURE__ */ (0,
|
|
4528
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime336.jsx)(
|
|
4484
4529
|
"div",
|
|
4485
4530
|
{
|
|
4486
4531
|
className: clsx_default(
|
|
@@ -4498,7 +4543,7 @@ var Swiper = (props) => {
|
|
|
4498
4543
|
)
|
|
4499
4544
|
}
|
|
4500
4545
|
),
|
|
4501
|
-
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)(
|
|
4502
4547
|
"span",
|
|
4503
4548
|
{
|
|
4504
4549
|
className: "lib-xplat-swiper__progress-fill",
|
|
@@ -4508,7 +4553,7 @@ var Swiper = (props) => {
|
|
|
4508
4553
|
}
|
|
4509
4554
|
}
|
|
4510
4555
|
) }) }),
|
|
4511
|
-
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)(
|
|
4512
4557
|
"button",
|
|
4513
4558
|
{
|
|
4514
4559
|
className: clsx_default(
|
|
@@ -4526,8 +4571,8 @@ Swiper.displayName = "Swiper";
|
|
|
4526
4571
|
var Swiper_default = Swiper;
|
|
4527
4572
|
|
|
4528
4573
|
// src/components/Switch/Switch.tsx
|
|
4529
|
-
var
|
|
4530
|
-
var
|
|
4574
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
4575
|
+
var import_jsx_runtime337 = require("react/jsx-runtime");
|
|
4531
4576
|
var KNOB_TRANSITION_MS = 250;
|
|
4532
4577
|
var Switch = (props) => {
|
|
4533
4578
|
const {
|
|
@@ -4537,9 +4582,9 @@ var Switch = (props) => {
|
|
|
4537
4582
|
disabled,
|
|
4538
4583
|
onChange
|
|
4539
4584
|
} = props;
|
|
4540
|
-
const [isAnimating, setIsAnimating] =
|
|
4541
|
-
const timeoutRef =
|
|
4542
|
-
|
|
4585
|
+
const [isAnimating, setIsAnimating] = import_react31.default.useState(false);
|
|
4586
|
+
const timeoutRef = import_react31.default.useRef(null);
|
|
4587
|
+
import_react31.default.useEffect(() => {
|
|
4543
4588
|
return () => {
|
|
4544
4589
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4545
4590
|
};
|
|
@@ -4554,7 +4599,7 @@ var Switch = (props) => {
|
|
|
4554
4599
|
timeoutRef.current = null;
|
|
4555
4600
|
}, KNOB_TRANSITION_MS);
|
|
4556
4601
|
};
|
|
4557
|
-
return /* @__PURE__ */ (0,
|
|
4602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime337.jsx)(
|
|
4558
4603
|
"div",
|
|
4559
4604
|
{
|
|
4560
4605
|
className: clsx_default(
|
|
@@ -4567,7 +4612,7 @@ var Switch = (props) => {
|
|
|
4567
4612
|
),
|
|
4568
4613
|
onClick: handleClick,
|
|
4569
4614
|
"aria-disabled": disabled || isAnimating,
|
|
4570
|
-
children: /* @__PURE__ */ (0,
|
|
4615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime337.jsx)("div", { className: clsx_default("knob", value ? "checked" : void 0) })
|
|
4571
4616
|
}
|
|
4572
4617
|
);
|
|
4573
4618
|
};
|
|
@@ -4575,17 +4620,17 @@ Switch.displayName = "Switch";
|
|
|
4575
4620
|
var Switch_default = Switch;
|
|
4576
4621
|
|
|
4577
4622
|
// src/components/Table/TableContext.tsx
|
|
4578
|
-
var
|
|
4579
|
-
var TableContext =
|
|
4623
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
4624
|
+
var TableContext = import_react32.default.createContext(null);
|
|
4580
4625
|
var useTableContext = () => {
|
|
4581
|
-
const ctx =
|
|
4626
|
+
const ctx = import_react32.default.useContext(TableContext);
|
|
4582
4627
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
4583
4628
|
return ctx;
|
|
4584
4629
|
};
|
|
4585
4630
|
var TableContext_default = TableContext;
|
|
4586
4631
|
|
|
4587
4632
|
// src/components/Table/Table.tsx
|
|
4588
|
-
var
|
|
4633
|
+
var import_jsx_runtime338 = require("react/jsx-runtime");
|
|
4589
4634
|
var Table = (props) => {
|
|
4590
4635
|
const {
|
|
4591
4636
|
children,
|
|
@@ -4594,7 +4639,7 @@ var Table = (props) => {
|
|
|
4594
4639
|
headerSticky = false,
|
|
4595
4640
|
stickyShadow = true
|
|
4596
4641
|
} = props;
|
|
4597
|
-
return /* @__PURE__ */ (0,
|
|
4642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("div", { className: "lib-xplat-table-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)(
|
|
4598
4643
|
TableContext_default.Provider,
|
|
4599
4644
|
{
|
|
4600
4645
|
value: {
|
|
@@ -4603,7 +4648,7 @@ var Table = (props) => {
|
|
|
4603
4648
|
headerSticky,
|
|
4604
4649
|
stickyShadow
|
|
4605
4650
|
},
|
|
4606
|
-
children: /* @__PURE__ */ (0,
|
|
4651
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime338.jsx)("table", { className: "lib-xplat-table", children })
|
|
4607
4652
|
}
|
|
4608
4653
|
) });
|
|
4609
4654
|
};
|
|
@@ -4611,41 +4656,41 @@ Table.displayName = "Table";
|
|
|
4611
4656
|
var Table_default = Table;
|
|
4612
4657
|
|
|
4613
4658
|
// src/components/Table/TableBody.tsx
|
|
4614
|
-
var
|
|
4659
|
+
var import_jsx_runtime339 = require("react/jsx-runtime");
|
|
4615
4660
|
var TableBody = (props) => {
|
|
4616
4661
|
const { children } = props;
|
|
4617
|
-
return /* @__PURE__ */ (0,
|
|
4662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime339.jsx)("tbody", { children });
|
|
4618
4663
|
};
|
|
4619
4664
|
TableBody.displayName = "TableBody";
|
|
4620
4665
|
var TableBody_default = TableBody;
|
|
4621
4666
|
|
|
4622
4667
|
// src/components/Table/TableCell.tsx
|
|
4623
|
-
var
|
|
4668
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
4624
4669
|
|
|
4625
4670
|
// src/components/Table/TableHeadContext.tsx
|
|
4626
|
-
var
|
|
4627
|
-
var TableHeadContext =
|
|
4671
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
4672
|
+
var TableHeadContext = import_react33.default.createContext(
|
|
4628
4673
|
null
|
|
4629
4674
|
);
|
|
4630
4675
|
var useTableHeadContext = () => {
|
|
4631
|
-
const ctx =
|
|
4676
|
+
const ctx = import_react33.default.useContext(TableHeadContext);
|
|
4632
4677
|
return ctx;
|
|
4633
4678
|
};
|
|
4634
4679
|
var TableHeadContext_default = TableHeadContext;
|
|
4635
4680
|
|
|
4636
4681
|
// src/components/Table/TableRowContext.tsx
|
|
4637
|
-
var
|
|
4638
|
-
var TableRowContext =
|
|
4682
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
4683
|
+
var TableRowContext = import_react34.default.createContext(null);
|
|
4639
4684
|
var useTableRowContext = () => {
|
|
4640
|
-
const ctx =
|
|
4685
|
+
const ctx = import_react34.default.useContext(TableRowContext);
|
|
4641
4686
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
4642
4687
|
return ctx;
|
|
4643
4688
|
};
|
|
4644
4689
|
var TableRowContext_default = TableRowContext;
|
|
4645
4690
|
|
|
4646
4691
|
// src/components/Table/TableCell.tsx
|
|
4647
|
-
var
|
|
4648
|
-
var TableCell =
|
|
4692
|
+
var import_jsx_runtime340 = require("react/jsx-runtime");
|
|
4693
|
+
var TableCell = import_react35.default.memo((props) => {
|
|
4649
4694
|
const {
|
|
4650
4695
|
children,
|
|
4651
4696
|
align = "center",
|
|
@@ -4657,9 +4702,9 @@ var TableCell = import_react34.default.memo((props) => {
|
|
|
4657
4702
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
4658
4703
|
const { stickyShadow } = useTableContext();
|
|
4659
4704
|
const headContext = useTableHeadContext();
|
|
4660
|
-
const [left, setLeft] =
|
|
4661
|
-
const cellRef =
|
|
4662
|
-
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(() => {
|
|
4663
4708
|
if (!cellRef.current) return 0;
|
|
4664
4709
|
let totalLeft = 0;
|
|
4665
4710
|
for (const ref of stickyCells) {
|
|
@@ -4668,7 +4713,7 @@ var TableCell = import_react34.default.memo((props) => {
|
|
|
4668
4713
|
}
|
|
4669
4714
|
return totalLeft;
|
|
4670
4715
|
}, [stickyCells]);
|
|
4671
|
-
|
|
4716
|
+
import_react35.default.useEffect(() => {
|
|
4672
4717
|
if (!isSticky || !cellRef.current) return;
|
|
4673
4718
|
registerStickyCell(cellRef);
|
|
4674
4719
|
setLeft(calculateLeft());
|
|
@@ -4686,7 +4731,7 @@ var TableCell = import_react34.default.memo((props) => {
|
|
|
4686
4731
|
const CellTag = cellRef.current?.tagName === "TH" ? "th" : "td";
|
|
4687
4732
|
const isLastSticky = isSticky && stickyCells[stickyCells.length - 1] === cellRef;
|
|
4688
4733
|
const enableHover = headContext && headContext.cellHover;
|
|
4689
|
-
return /* @__PURE__ */ (0,
|
|
4734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime340.jsx)(
|
|
4690
4735
|
CellTag,
|
|
4691
4736
|
{
|
|
4692
4737
|
ref: cellRef,
|
|
@@ -4711,21 +4756,21 @@ TableCell.displayName = "TableCell";
|
|
|
4711
4756
|
var TableCell_default = TableCell;
|
|
4712
4757
|
|
|
4713
4758
|
// src/components/Table/TableHead.tsx
|
|
4714
|
-
var
|
|
4759
|
+
var import_jsx_runtime341 = require("react/jsx-runtime");
|
|
4715
4760
|
var TableHead = ({
|
|
4716
4761
|
children,
|
|
4717
4762
|
cellHover = false
|
|
4718
4763
|
}) => {
|
|
4719
4764
|
const { headerSticky } = useTableContext();
|
|
4720
|
-
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 }) });
|
|
4721
4766
|
};
|
|
4722
4767
|
TableHead.displayName = "TableHead";
|
|
4723
4768
|
var TableHead_default = TableHead;
|
|
4724
4769
|
|
|
4725
4770
|
// src/components/Table/TableRow.tsx
|
|
4726
|
-
var
|
|
4727
|
-
var
|
|
4728
|
-
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) => {
|
|
4729
4774
|
const {
|
|
4730
4775
|
children,
|
|
4731
4776
|
type = "secondary",
|
|
@@ -4733,14 +4778,14 @@ var TableRow = import_react35.default.memo((props) => {
|
|
|
4733
4778
|
onClick
|
|
4734
4779
|
} = props;
|
|
4735
4780
|
const { rowBorderUse } = useTableContext();
|
|
4736
|
-
const [stickyCells, setStickyCells] =
|
|
4781
|
+
const [stickyCells, setStickyCells] = import_react36.default.useState([]);
|
|
4737
4782
|
const registerStickyCell = (ref) => {
|
|
4738
4783
|
setStickyCells((prev) => {
|
|
4739
4784
|
if (prev.includes(ref)) return prev;
|
|
4740
4785
|
return [...prev, ref];
|
|
4741
4786
|
});
|
|
4742
4787
|
};
|
|
4743
|
-
return /* @__PURE__ */ (0,
|
|
4788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(TableRowContext_default.Provider, { value: { stickyCells, registerStickyCell }, children: /* @__PURE__ */ (0, import_jsx_runtime342.jsx)(
|
|
4744
4789
|
"tr",
|
|
4745
4790
|
{
|
|
4746
4791
|
className: clsx_default(
|
|
@@ -4758,7 +4803,7 @@ TableRow.displayName = "TableRow";
|
|
|
4758
4803
|
var TableRow_default = TableRow;
|
|
4759
4804
|
|
|
4760
4805
|
// src/components/Tag/Tag.tsx
|
|
4761
|
-
var
|
|
4806
|
+
var import_jsx_runtime343 = require("react/jsx-runtime");
|
|
4762
4807
|
var Tag = (props) => {
|
|
4763
4808
|
const {
|
|
4764
4809
|
children,
|
|
@@ -4768,7 +4813,7 @@ var Tag = (props) => {
|
|
|
4768
4813
|
disabled = false,
|
|
4769
4814
|
colorIndex
|
|
4770
4815
|
} = props;
|
|
4771
|
-
return /* @__PURE__ */ (0,
|
|
4816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime343.jsxs)(
|
|
4772
4817
|
"span",
|
|
4773
4818
|
{
|
|
4774
4819
|
className: clsx_default(
|
|
@@ -4779,8 +4824,8 @@ var Tag = (props) => {
|
|
|
4779
4824
|
disabled && "disabled"
|
|
4780
4825
|
),
|
|
4781
4826
|
children: [
|
|
4782
|
-
/* @__PURE__ */ (0,
|
|
4783
|
-
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, {}) })
|
|
4784
4829
|
]
|
|
4785
4830
|
}
|
|
4786
4831
|
);
|
|
@@ -4789,12 +4834,12 @@ Tag.displayName = "Tag";
|
|
|
4789
4834
|
var Tag_default = Tag;
|
|
4790
4835
|
|
|
4791
4836
|
// src/components/TextArea/TextArea.tsx
|
|
4792
|
-
var
|
|
4793
|
-
var
|
|
4794
|
-
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(
|
|
4795
4840
|
(props, ref) => {
|
|
4796
4841
|
const { value, onChange, disabled, ...textareaProps } = props;
|
|
4797
|
-
const localRef =
|
|
4842
|
+
const localRef = import_react37.default.useRef(null);
|
|
4798
4843
|
const setRefs = (el) => {
|
|
4799
4844
|
localRef.current = el;
|
|
4800
4845
|
if (!ref) return;
|
|
@@ -4814,21 +4859,21 @@ var TextArea = import_react36.default.forwardRef(
|
|
|
4814
4859
|
onChange(event);
|
|
4815
4860
|
}
|
|
4816
4861
|
};
|
|
4817
|
-
|
|
4862
|
+
import_react37.default.useEffect(() => {
|
|
4818
4863
|
const el = localRef.current;
|
|
4819
4864
|
if (!el) return;
|
|
4820
4865
|
el.style.height = "0px";
|
|
4821
4866
|
const nextHeight = Math.min(el.scrollHeight, 400);
|
|
4822
4867
|
el.style.height = `${nextHeight}px`;
|
|
4823
4868
|
}, [value]);
|
|
4824
|
-
return /* @__PURE__ */ (0,
|
|
4869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: "lib-xplat-textarea-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
4825
4870
|
"div",
|
|
4826
4871
|
{
|
|
4827
4872
|
className: clsx_default(
|
|
4828
4873
|
"lib-xplat-textarea",
|
|
4829
4874
|
disabled ? "disabled" : void 0
|
|
4830
4875
|
),
|
|
4831
|
-
children: /* @__PURE__ */ (0,
|
|
4876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
4832
4877
|
"textarea",
|
|
4833
4878
|
{
|
|
4834
4879
|
...textareaProps,
|
|
@@ -4846,25 +4891,25 @@ TextArea.displayName = "TextArea";
|
|
|
4846
4891
|
var TextArea_default = TextArea;
|
|
4847
4892
|
|
|
4848
4893
|
// src/components/Toast/Toast.tsx
|
|
4849
|
-
var
|
|
4850
|
-
var
|
|
4851
|
-
var
|
|
4852
|
-
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);
|
|
4853
4898
|
var useToast = () => {
|
|
4854
|
-
const ctx =
|
|
4899
|
+
const ctx = import_react38.default.useContext(ToastContext);
|
|
4855
4900
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
4856
4901
|
return ctx;
|
|
4857
4902
|
};
|
|
4858
4903
|
var EXIT_DURATION = 300;
|
|
4859
4904
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
4860
|
-
const ref =
|
|
4861
|
-
const [height, setHeight] =
|
|
4862
|
-
|
|
4905
|
+
const ref = import_react38.default.useRef(null);
|
|
4906
|
+
const [height, setHeight] = import_react38.default.useState(void 0);
|
|
4907
|
+
import_react38.default.useEffect(() => {
|
|
4863
4908
|
if (ref.current && !isExiting) {
|
|
4864
4909
|
setHeight(ref.current.offsetHeight);
|
|
4865
4910
|
}
|
|
4866
4911
|
}, [isExiting]);
|
|
4867
|
-
return /* @__PURE__ */ (0,
|
|
4912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(
|
|
4868
4913
|
"div",
|
|
4869
4914
|
{
|
|
4870
4915
|
className: clsx_default("lib-xplat-toast-wrapper", { exit: isExiting }),
|
|
@@ -4872,15 +4917,15 @@ var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
|
4872
4917
|
maxHeight: isExiting ? 0 : height ?? "none",
|
|
4873
4918
|
marginBottom: isExiting ? 0 : void 0
|
|
4874
4919
|
},
|
|
4875
|
-
children: /* @__PURE__ */ (0,
|
|
4920
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(
|
|
4876
4921
|
"div",
|
|
4877
4922
|
{
|
|
4878
4923
|
ref,
|
|
4879
4924
|
className: clsx_default("lib-xplat-toast", item.type, { exit: isExiting }),
|
|
4880
4925
|
role: "alert",
|
|
4881
4926
|
children: [
|
|
4882
|
-
/* @__PURE__ */ (0,
|
|
4883
|
-
/* @__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" })
|
|
4884
4929
|
]
|
|
4885
4930
|
}
|
|
4886
4931
|
)
|
|
@@ -4891,13 +4936,13 @@ var ToastProvider = ({
|
|
|
4891
4936
|
children,
|
|
4892
4937
|
position = "top-right"
|
|
4893
4938
|
}) => {
|
|
4894
|
-
const [toasts, setToasts] =
|
|
4895
|
-
const [removing, setRemoving] =
|
|
4896
|
-
const [mounted, setMounted] =
|
|
4897
|
-
|
|
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(() => {
|
|
4898
4943
|
setMounted(true);
|
|
4899
4944
|
}, []);
|
|
4900
|
-
const remove =
|
|
4945
|
+
const remove = import_react38.default.useCallback((id) => {
|
|
4901
4946
|
setRemoving((prev) => new Set(prev).add(id));
|
|
4902
4947
|
setTimeout(() => {
|
|
4903
4948
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -4908,7 +4953,7 @@ var ToastProvider = ({
|
|
|
4908
4953
|
});
|
|
4909
4954
|
}, EXIT_DURATION);
|
|
4910
4955
|
}, []);
|
|
4911
|
-
const toast =
|
|
4956
|
+
const toast = import_react38.default.useCallback(
|
|
4912
4957
|
(type, message, duration = 3e3) => {
|
|
4913
4958
|
const id = `${Date.now()}-${Math.random()}`;
|
|
4914
4959
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -4918,10 +4963,10 @@ var ToastProvider = ({
|
|
|
4918
4963
|
},
|
|
4919
4964
|
[remove]
|
|
4920
4965
|
);
|
|
4921
|
-
return /* @__PURE__ */ (0,
|
|
4966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(ToastContext.Provider, { value: { toast }, children: [
|
|
4922
4967
|
children,
|
|
4923
|
-
mounted && (0,
|
|
4924
|
-
/* @__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)(
|
|
4925
4970
|
ToastItemComponent,
|
|
4926
4971
|
{
|
|
4927
4972
|
item: t,
|
|
@@ -4937,29 +4982,29 @@ var ToastProvider = ({
|
|
|
4937
4982
|
ToastProvider.displayName = "ToastProvider";
|
|
4938
4983
|
|
|
4939
4984
|
// src/components/Tooltip/Tooltip.tsx
|
|
4940
|
-
var
|
|
4941
|
-
var
|
|
4985
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
4986
|
+
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
4942
4987
|
var Tooltip = (props) => {
|
|
4943
4988
|
const {
|
|
4944
4989
|
type = "primary",
|
|
4945
4990
|
description,
|
|
4946
4991
|
children
|
|
4947
4992
|
} = props;
|
|
4948
|
-
const iconRef =
|
|
4949
|
-
return /* @__PURE__ */ (0,
|
|
4950
|
-
/* @__PURE__ */ (0,
|
|
4951
|
-
/* @__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 })
|
|
4952
4997
|
] });
|
|
4953
4998
|
};
|
|
4954
4999
|
Tooltip.displayName = "Tooltip";
|
|
4955
5000
|
var Tooltip_default = Tooltip;
|
|
4956
5001
|
|
|
4957
5002
|
// src/components/Video/Video.tsx
|
|
4958
|
-
var
|
|
4959
|
-
var
|
|
4960
|
-
var PipIcon = () => /* @__PURE__ */ (0,
|
|
4961
|
-
/* @__PURE__ */ (0,
|
|
4962
|
-
/* @__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" })
|
|
4963
5008
|
] });
|
|
4964
5009
|
var formatTime = (sec) => {
|
|
4965
5010
|
if (!Number.isFinite(sec) || sec < 0) return "0:00";
|
|
@@ -4967,7 +5012,7 @@ var formatTime = (sec) => {
|
|
|
4967
5012
|
const s = Math.floor(sec % 60);
|
|
4968
5013
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
4969
5014
|
};
|
|
4970
|
-
var Video =
|
|
5015
|
+
var Video = import_react40.default.forwardRef((props, ref) => {
|
|
4971
5016
|
const {
|
|
4972
5017
|
src,
|
|
4973
5018
|
poster,
|
|
@@ -4991,21 +5036,21 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
4991
5036
|
children,
|
|
4992
5037
|
...rest
|
|
4993
5038
|
} = props;
|
|
4994
|
-
const containerRef =
|
|
4995
|
-
const videoRef =
|
|
4996
|
-
const [isPlaying, setIsPlaying] =
|
|
4997
|
-
const [isLoaded, setIsLoaded] =
|
|
4998
|
-
const [currentTime, setCurrentTime] =
|
|
4999
|
-
const [duration, setDuration] =
|
|
5000
|
-
const [buffered, setBuffered] =
|
|
5001
|
-
const [volume, setVolume] =
|
|
5002
|
-
const [isMuted, setIsMuted] =
|
|
5003
|
-
const [isFullscreen, setIsFullscreen] =
|
|
5004
|
-
const [playbackRate, setPlaybackRate] =
|
|
5005
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
5006
|
-
const [captionsOn, setCaptionsOn] =
|
|
5007
|
-
const [isPip, setIsPip] =
|
|
5008
|
-
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(
|
|
5009
5054
|
(el) => {
|
|
5010
5055
|
videoRef.current = el;
|
|
5011
5056
|
if (typeof ref === "function") ref(el);
|
|
@@ -5013,14 +5058,14 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5013
5058
|
},
|
|
5014
5059
|
[ref]
|
|
5015
5060
|
);
|
|
5016
|
-
|
|
5061
|
+
import_react40.default.useEffect(() => {
|
|
5017
5062
|
const onFsChange = () => {
|
|
5018
5063
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
5019
5064
|
};
|
|
5020
5065
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
5021
5066
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
5022
5067
|
}, []);
|
|
5023
|
-
|
|
5068
|
+
import_react40.default.useEffect(() => {
|
|
5024
5069
|
const v = videoRef.current;
|
|
5025
5070
|
if (!v) return;
|
|
5026
5071
|
const onEnter = () => setIsPip(true);
|
|
@@ -5134,13 +5179,13 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5134
5179
|
const volumePct = (isMuted ? 0 : volume) * 100;
|
|
5135
5180
|
const VolumeGlyph = isMuted || volume === 0 ? VolumeXIcon_default : volume < 0.5 ? VolumeIcon_default : Volume2Icon_default;
|
|
5136
5181
|
const pipSupported = typeof document !== "undefined" && "pictureInPictureEnabled" in document && document.pictureInPictureEnabled;
|
|
5137
|
-
return /* @__PURE__ */ (0,
|
|
5182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime347.jsxs)(
|
|
5138
5183
|
"div",
|
|
5139
5184
|
{
|
|
5140
5185
|
ref: containerRef,
|
|
5141
5186
|
className: clsx_default("lib-xplat-video", showControls && "has-controls"),
|
|
5142
5187
|
children: [
|
|
5143
|
-
/* @__PURE__ */ (0,
|
|
5188
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5144
5189
|
"video",
|
|
5145
5190
|
{
|
|
5146
5191
|
ref: setRefs,
|
|
@@ -5161,7 +5206,7 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5161
5206
|
children
|
|
5162
5207
|
}
|
|
5163
5208
|
),
|
|
5164
|
-
showCenterPlay && /* @__PURE__ */ (0,
|
|
5209
|
+
showCenterPlay && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5165
5210
|
"button",
|
|
5166
5211
|
{
|
|
5167
5212
|
type: "button",
|
|
@@ -5173,11 +5218,11 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5173
5218
|
onClick: togglePlay,
|
|
5174
5219
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
5175
5220
|
tabIndex: -1,
|
|
5176
|
-
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, {}) })
|
|
5177
5222
|
}
|
|
5178
5223
|
),
|
|
5179
|
-
showControls && /* @__PURE__ */ (0,
|
|
5180
|
-
/* @__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)(
|
|
5181
5226
|
"input",
|
|
5182
5227
|
{
|
|
5183
5228
|
type: "range",
|
|
@@ -5194,29 +5239,29 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5194
5239
|
}
|
|
5195
5240
|
}
|
|
5196
5241
|
),
|
|
5197
|
-
/* @__PURE__ */ (0,
|
|
5198
|
-
/* @__PURE__ */ (0,
|
|
5242
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: "controls-row", children: [
|
|
5243
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5199
5244
|
"button",
|
|
5200
5245
|
{
|
|
5201
5246
|
type: "button",
|
|
5202
5247
|
className: "control-btn",
|
|
5203
5248
|
onClick: togglePlay,
|
|
5204
5249
|
"aria-label": isPlaying ? "\uC77C\uC2DC\uC815\uC9C0" : "\uC7AC\uC0DD",
|
|
5205
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
5250
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PauseIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PlayIcon_default, {})
|
|
5206
5251
|
}
|
|
5207
5252
|
),
|
|
5208
|
-
/* @__PURE__ */ (0,
|
|
5209
|
-
/* @__PURE__ */ (0,
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("div", { className: "volume-group", children: [
|
|
5254
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5210
5255
|
"button",
|
|
5211
5256
|
{
|
|
5212
5257
|
type: "button",
|
|
5213
5258
|
className: "control-btn",
|
|
5214
5259
|
onClick: toggleMute,
|
|
5215
5260
|
"aria-label": isMuted ? "\uC74C\uC18C\uAC70 \uD574\uC81C" : "\uC74C\uC18C\uAC70",
|
|
5216
|
-
children: /* @__PURE__ */ (0,
|
|
5261
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(VolumeGlyph, {})
|
|
5217
5262
|
}
|
|
5218
5263
|
),
|
|
5219
|
-
/* @__PURE__ */ (0,
|
|
5264
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5220
5265
|
"input",
|
|
5221
5266
|
{
|
|
5222
5267
|
type: "range",
|
|
@@ -5231,14 +5276,14 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5231
5276
|
}
|
|
5232
5277
|
)
|
|
5233
5278
|
] }),
|
|
5234
|
-
/* @__PURE__ */ (0,
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsxs)("span", { className: "time", children: [
|
|
5235
5280
|
formatTime(currentTime),
|
|
5236
5281
|
" / ",
|
|
5237
5282
|
formatTime(duration)
|
|
5238
5283
|
] }),
|
|
5239
|
-
/* @__PURE__ */ (0,
|
|
5240
|
-
playbackRates && playbackRates.length > 0 && /* @__PURE__ */ (0,
|
|
5241
|
-
/* @__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)(
|
|
5242
5287
|
"button",
|
|
5243
5288
|
{
|
|
5244
5289
|
type: "button",
|
|
@@ -5252,7 +5297,7 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5252
5297
|
]
|
|
5253
5298
|
}
|
|
5254
5299
|
),
|
|
5255
|
-
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)(
|
|
5256
5301
|
"button",
|
|
5257
5302
|
{
|
|
5258
5303
|
type: "button",
|
|
@@ -5266,7 +5311,7 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5266
5311
|
}
|
|
5267
5312
|
) }, r2)) })
|
|
5268
5313
|
] }),
|
|
5269
|
-
showCaptions && /* @__PURE__ */ (0,
|
|
5314
|
+
showCaptions && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5270
5315
|
"button",
|
|
5271
5316
|
{
|
|
5272
5317
|
type: "button",
|
|
@@ -5274,37 +5319,37 @@ var Video = import_react39.default.forwardRef((props, ref) => {
|
|
|
5274
5319
|
onClick: toggleCaptions,
|
|
5275
5320
|
"aria-label": captionsOn ? "\uC790\uB9C9 \uB044\uAE30" : "\uC790\uB9C9 \uCF1C\uAE30",
|
|
5276
5321
|
"aria-pressed": captionsOn,
|
|
5277
|
-
children: /* @__PURE__ */ (0,
|
|
5322
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(TypeIcon_default, {})
|
|
5278
5323
|
}
|
|
5279
5324
|
),
|
|
5280
|
-
showPip && pipSupported && /* @__PURE__ */ (0,
|
|
5325
|
+
showPip && pipSupported && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5281
5326
|
"button",
|
|
5282
5327
|
{
|
|
5283
5328
|
type: "button",
|
|
5284
5329
|
className: clsx_default("control-btn", isPip && "is-active"),
|
|
5285
5330
|
onClick: togglePip,
|
|
5286
5331
|
"aria-label": isPip ? "PIP \uC885\uB8CC" : "PIP",
|
|
5287
|
-
children: /* @__PURE__ */ (0,
|
|
5332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(PipIcon, {})
|
|
5288
5333
|
}
|
|
5289
5334
|
),
|
|
5290
|
-
showDownload && /* @__PURE__ */ (0,
|
|
5335
|
+
showDownload && /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5291
5336
|
"a",
|
|
5292
5337
|
{
|
|
5293
5338
|
className: "control-btn",
|
|
5294
5339
|
href: src,
|
|
5295
5340
|
download: downloadFileName ?? true,
|
|
5296
5341
|
"aria-label": "\uB2E4\uC6B4\uB85C\uB4DC",
|
|
5297
|
-
children: /* @__PURE__ */ (0,
|
|
5342
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(DownloadIcon_default, {})
|
|
5298
5343
|
}
|
|
5299
5344
|
),
|
|
5300
|
-
/* @__PURE__ */ (0,
|
|
5345
|
+
/* @__PURE__ */ (0, import_jsx_runtime347.jsx)(
|
|
5301
5346
|
"button",
|
|
5302
5347
|
{
|
|
5303
5348
|
type: "button",
|
|
5304
5349
|
className: "control-btn",
|
|
5305
5350
|
onClick: toggleFullscreen,
|
|
5306
5351
|
"aria-label": isFullscreen ? "\uC804\uCCB4\uD654\uBA74 \uC885\uB8CC" : "\uC804\uCCB4\uD654\uBA74",
|
|
5307
|
-
children: isFullscreen ? /* @__PURE__ */ (0,
|
|
5352
|
+
children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(MinimizeIcon_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime347.jsx)(MaximizeIcon_default, {})
|
|
5308
5353
|
}
|
|
5309
5354
|
)
|
|
5310
5355
|
] })
|