@x-plat/design-system 0.17.0 → 0.19.0
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 +5 -4
- package/dist/components/Chart/index.d.cts +9 -0
- package/dist/components/Chart/index.d.ts +9 -0
- package/dist/components/Chart/index.js +5 -4
- package/dist/components/Table/index.cjs +81 -30
- package/dist/components/Table/index.css +172 -145
- package/dist/components/Table/index.js +88 -37
- package/dist/components/index.cjs +164 -112
- package/dist/components/index.css +172 -145
- package/dist/components/index.js +198 -146
- package/dist/index.cjs +169 -117
- package/dist/index.css +172 -145
- package/dist/index.js +208 -156
- package/guidelines/components/chart.md +52 -10
- package/package.json +1 -1
|
@@ -2831,9 +2831,9 @@ var ChartTooltip = ({ x, y, containerWidth, containerHeight, tooltipType, childr
|
|
|
2831
2831
|
}
|
|
2832
2832
|
);
|
|
2833
2833
|
};
|
|
2834
|
-
var ChartLegend = ({ data, labels,
|
|
2834
|
+
var ChartLegend = ({ data, labels, shape }) => {
|
|
2835
2835
|
const entries = Object.entries(data);
|
|
2836
|
-
if (
|
|
2836
|
+
if (shape === "pie" || shape === "doughnut") {
|
|
2837
2837
|
const values = entries.flatMap(([, v]) => v);
|
|
2838
2838
|
const total = values.reduce((a, b) => a + b, 0) || 1;
|
|
2839
2839
|
const firstKey = entries[0]?.[0] ?? "";
|
|
@@ -2870,8 +2870,9 @@ var ChartLegend = ({ data, labels, type }) => {
|
|
|
2870
2870
|
}) });
|
|
2871
2871
|
};
|
|
2872
2872
|
var Chart = import_react6.default.memo((props) => {
|
|
2873
|
-
const { variant, type, data, labels, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
2873
|
+
const { variant, type, data, labels, legend, tooltip: showTooltip = true, tooltipType = "light" } = props;
|
|
2874
2874
|
const shape = variant ?? type ?? "line";
|
|
2875
|
+
const showLegend = legend ?? (shape === "pie" || shape === "doughnut");
|
|
2875
2876
|
const { tooltip, show, hide, move, containerRef } = useChartTooltip(showTooltip);
|
|
2876
2877
|
const { width, height } = useChartSize(containerRef);
|
|
2877
2878
|
const stableData = import_react6.default.useMemo(() => data, [JSON.stringify(data)]);
|
|
@@ -2885,7 +2886,7 @@ var Chart = import_react6.default.memo((props) => {
|
|
|
2885
2886
|
ready && shape === "bar" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(BarChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2886
2887
|
ready && shape === "pie" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, onHover: show, onMove: move, onLeave: hide }),
|
|
2887
2888
|
ready && shape === "doughnut" && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(PieDonutChart, { data: stableData, labels: stableLabels, width, height, animate, isDoughnut: true, onHover: show, onMove: move, onLeave: hide }),
|
|
2888
|
-
ready &&
|
|
2889
|
+
ready && showLegend && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartLegend, { data: stableData, labels: stableLabels, shape }),
|
|
2889
2890
|
tooltip.visible && tooltip.content && /* @__PURE__ */ (0, import_jsx_runtime306.jsx)(ChartTooltip, { x: tooltip.x, y: tooltip.y, containerWidth: width, containerHeight: height, tooltipType, children: tooltip.content })
|
|
2890
2891
|
] });
|
|
2891
2892
|
});
|
|
@@ -7041,6 +7042,9 @@ var Switch = (props) => {
|
|
|
7041
7042
|
Switch.displayName = "Switch";
|
|
7042
7043
|
var Switch_default = Switch;
|
|
7043
7044
|
|
|
7045
|
+
// src/components/Table/Table.tsx
|
|
7046
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
7047
|
+
|
|
7044
7048
|
// src/components/Table/TableContext.tsx
|
|
7045
7049
|
var import_react35 = __toESM(require("react"), 1);
|
|
7046
7050
|
var TableContext = import_react35.default.createContext(null);
|
|
@@ -7052,7 +7056,42 @@ var useTableContext = () => {
|
|
|
7052
7056
|
var TableContext_default = TableContext;
|
|
7053
7057
|
|
|
7054
7058
|
// src/components/Table/Table.tsx
|
|
7055
|
-
var import_jsx_runtime344 =
|
|
7059
|
+
var import_jsx_runtime344 = (
|
|
7060
|
+
/**
|
|
7061
|
+
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
7062
|
+
* 자리 잡는 데 쓰고 있을 수 있어서다. 스크롤은 안쪽 `-scroller` 가 맡는다.
|
|
7063
|
+
*/
|
|
7064
|
+
require("react/jsx-runtime")
|
|
7065
|
+
);
|
|
7066
|
+
var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
7067
|
+
const [scrollable, setScrollable] = import_react36.default.useState(false);
|
|
7068
|
+
import_react36.default.useEffect(() => {
|
|
7069
|
+
const el = scrollerRef.current;
|
|
7070
|
+
if (!el) return;
|
|
7071
|
+
const update = () => {
|
|
7072
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
7073
|
+
const can = max > 1;
|
|
7074
|
+
setScrollable(can);
|
|
7075
|
+
const thumb = thumbRef.current;
|
|
7076
|
+
if (!thumb) return;
|
|
7077
|
+
const ratio = can ? el.clientWidth / el.scrollWidth : 1;
|
|
7078
|
+
const w = Math.max(ratio * 100, 8);
|
|
7079
|
+
thumb.style.width = `${w.toFixed(2)}%`;
|
|
7080
|
+
thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
|
|
7081
|
+
};
|
|
7082
|
+
update();
|
|
7083
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
7084
|
+
const ro = new ResizeObserver(update);
|
|
7085
|
+
ro.observe(el);
|
|
7086
|
+
const table = el.firstElementChild;
|
|
7087
|
+
if (table) ro.observe(table);
|
|
7088
|
+
return () => {
|
|
7089
|
+
el.removeEventListener("scroll", update);
|
|
7090
|
+
ro.disconnect();
|
|
7091
|
+
};
|
|
7092
|
+
}, [scrollerRef, thumbRef]);
|
|
7093
|
+
return scrollable;
|
|
7094
|
+
};
|
|
7056
7095
|
var Table = (props) => {
|
|
7057
7096
|
const {
|
|
7058
7097
|
children,
|
|
@@ -7063,26 +7102,39 @@ var Table = (props) => {
|
|
|
7063
7102
|
stickyShadow = true,
|
|
7064
7103
|
minWidth
|
|
7065
7104
|
} = props;
|
|
7066
|
-
|
|
7105
|
+
const scrollerRef = import_react36.default.useRef(null);
|
|
7106
|
+
const thumbRef = import_react36.default.useRef(null);
|
|
7107
|
+
const scrollable = useScrollExtent(scrollerRef, thumbRef);
|
|
7108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
7067
7109
|
"div",
|
|
7068
7110
|
{
|
|
7069
7111
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
7070
|
-
"data-xplat-overlay-escape": "",
|
|
7071
7112
|
style: minWidth === void 0 ? void 0 : {
|
|
7072
7113
|
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
7073
7114
|
},
|
|
7074
|
-
children:
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7115
|
+
children: [
|
|
7116
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7117
|
+
"div",
|
|
7118
|
+
{
|
|
7119
|
+
ref: scrollerRef,
|
|
7120
|
+
className: "lib-xplat-table-scroller",
|
|
7121
|
+
"data-xplat-overlay-escape": "",
|
|
7122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7123
|
+
TableContext_default.Provider,
|
|
7124
|
+
{
|
|
7125
|
+
value: {
|
|
7126
|
+
rowBorderUse,
|
|
7127
|
+
colBorderUse,
|
|
7128
|
+
headerSticky,
|
|
7129
|
+
stickyShadow
|
|
7130
|
+
},
|
|
7131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
7132
|
+
}
|
|
7133
|
+
)
|
|
7134
|
+
}
|
|
7135
|
+
),
|
|
7136
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { className: `lib-xplat-table-scrollbar${scrollable ? " scrollable" : ""}`, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("div", { ref: thumbRef, className: "table-scrollbar-thumb" }) })
|
|
7137
|
+
]
|
|
7086
7138
|
}
|
|
7087
7139
|
);
|
|
7088
7140
|
};
|
|
@@ -7099,24 +7151,24 @@ TableBody.displayName = "TableBody";
|
|
|
7099
7151
|
var TableBody_default = TableBody;
|
|
7100
7152
|
|
|
7101
7153
|
// src/components/Table/TableCell.tsx
|
|
7102
|
-
var
|
|
7154
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
7103
7155
|
|
|
7104
7156
|
// src/components/Table/TableHeadContext.tsx
|
|
7105
|
-
var
|
|
7106
|
-
var TableHeadContext =
|
|
7157
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
7158
|
+
var TableHeadContext = import_react37.default.createContext(
|
|
7107
7159
|
null
|
|
7108
7160
|
);
|
|
7109
7161
|
var useTableHeadContext = () => {
|
|
7110
|
-
const ctx =
|
|
7162
|
+
const ctx = import_react37.default.useContext(TableHeadContext);
|
|
7111
7163
|
return ctx;
|
|
7112
7164
|
};
|
|
7113
7165
|
var TableHeadContext_default = TableHeadContext;
|
|
7114
7166
|
|
|
7115
7167
|
// src/components/Table/TableRowContext.tsx
|
|
7116
|
-
var
|
|
7117
|
-
var TableRowContext =
|
|
7168
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
7169
|
+
var TableRowContext = import_react38.default.createContext(null);
|
|
7118
7170
|
var useTableRowContext = () => {
|
|
7119
|
-
const ctx =
|
|
7171
|
+
const ctx = import_react38.default.useContext(TableRowContext);
|
|
7120
7172
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7121
7173
|
return ctx;
|
|
7122
7174
|
};
|
|
@@ -7124,7 +7176,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
7124
7176
|
|
|
7125
7177
|
// src/components/Table/TableCell.tsx
|
|
7126
7178
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
7127
|
-
var TableCell =
|
|
7179
|
+
var TableCell = import_react39.default.memo((props) => {
|
|
7128
7180
|
const {
|
|
7129
7181
|
children,
|
|
7130
7182
|
align = "center",
|
|
@@ -7138,9 +7190,9 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
7138
7190
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
7139
7191
|
const { stickyShadow } = useTableContext();
|
|
7140
7192
|
const headContext = useTableHeadContext();
|
|
7141
|
-
const [left, setLeft] =
|
|
7142
|
-
const cellRef =
|
|
7143
|
-
const calculateLeft =
|
|
7193
|
+
const [left, setLeft] = import_react39.default.useState(0);
|
|
7194
|
+
const cellRef = import_react39.default.useRef(null);
|
|
7195
|
+
const calculateLeft = import_react39.default.useCallback(() => {
|
|
7144
7196
|
if (!cellRef.current) return 0;
|
|
7145
7197
|
let totalLeft = 0;
|
|
7146
7198
|
for (const ref of stickyCells) {
|
|
@@ -7149,7 +7201,7 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
7149
7201
|
}
|
|
7150
7202
|
return totalLeft;
|
|
7151
7203
|
}, [stickyCells]);
|
|
7152
|
-
|
|
7204
|
+
import_react39.default.useEffect(() => {
|
|
7153
7205
|
if (!isSticky || !cellRef.current) return;
|
|
7154
7206
|
registerStickyCell(cellRef);
|
|
7155
7207
|
setLeft(calculateLeft());
|
|
@@ -7207,9 +7259,9 @@ TableHead.displayName = "TableHead";
|
|
|
7207
7259
|
var TableHead_default = TableHead;
|
|
7208
7260
|
|
|
7209
7261
|
// src/components/Table/TableRow.tsx
|
|
7210
|
-
var
|
|
7262
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
7211
7263
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
7212
|
-
var TableRow =
|
|
7264
|
+
var TableRow = import_react40.default.memo((props) => {
|
|
7213
7265
|
const {
|
|
7214
7266
|
children,
|
|
7215
7267
|
type = "secondary",
|
|
@@ -7218,7 +7270,7 @@ var TableRow = import_react39.default.memo((props) => {
|
|
|
7218
7270
|
onClick
|
|
7219
7271
|
} = props;
|
|
7220
7272
|
const { rowBorderUse } = useTableContext();
|
|
7221
|
-
const [stickyCells, setStickyCells] =
|
|
7273
|
+
const [stickyCells, setStickyCells] = import_react40.default.useState([]);
|
|
7222
7274
|
const registerStickyCell = (ref) => {
|
|
7223
7275
|
setStickyCells((prev) => {
|
|
7224
7276
|
if (prev.includes(ref)) return prev;
|
|
@@ -7282,9 +7334,9 @@ Tag.displayName = "Tag";
|
|
|
7282
7334
|
var Tag_default = Tag;
|
|
7283
7335
|
|
|
7284
7336
|
// src/components/TextArea/TextArea.tsx
|
|
7285
|
-
var
|
|
7337
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
7286
7338
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
7287
|
-
var TextArea =
|
|
7339
|
+
var TextArea = import_react41.default.forwardRef(
|
|
7288
7340
|
(props, ref) => {
|
|
7289
7341
|
const {
|
|
7290
7342
|
className,
|
|
@@ -7297,7 +7349,7 @@ var TextArea = import_react40.default.forwardRef(
|
|
|
7297
7349
|
disabled,
|
|
7298
7350
|
...textareaProps
|
|
7299
7351
|
} = props;
|
|
7300
|
-
const autoId =
|
|
7352
|
+
const autoId = import_react41.default.useId();
|
|
7301
7353
|
const fieldId = props.id ?? autoId;
|
|
7302
7354
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
7303
7355
|
"textarea",
|
|
@@ -7319,7 +7371,7 @@ TextArea.displayName = "TextArea";
|
|
|
7319
7371
|
var TextArea_default = TextArea;
|
|
7320
7372
|
|
|
7321
7373
|
// src/components/TimePicker/TimePicker.tsx
|
|
7322
|
-
var
|
|
7374
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
7323
7375
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
7324
7376
|
var ANIMATION_DURATION_MS4 = 200;
|
|
7325
7377
|
var toMinutes = (hhmm) => {
|
|
@@ -7357,13 +7409,13 @@ var TimePicker = (props) => {
|
|
|
7357
7409
|
required,
|
|
7358
7410
|
validations
|
|
7359
7411
|
} = props;
|
|
7360
|
-
const fieldId =
|
|
7361
|
-
const triggerRef =
|
|
7362
|
-
const contentRef =
|
|
7363
|
-
const [isOpen, setOpen] =
|
|
7364
|
-
const [mounted, setMounted] =
|
|
7365
|
-
const [visible, setVisible] =
|
|
7366
|
-
const options =
|
|
7412
|
+
const fieldId = import_react42.default.useId();
|
|
7413
|
+
const triggerRef = import_react42.default.useRef(null);
|
|
7414
|
+
const contentRef = import_react42.default.useRef(null);
|
|
7415
|
+
const [isOpen, setOpen] = import_react42.default.useState(false);
|
|
7416
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
7417
|
+
const [visible, setVisible] = import_react42.default.useState(false);
|
|
7418
|
+
const options = import_react42.default.useMemo(() => {
|
|
7367
7419
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
7368
7420
|
const lo = toMinutes(min) ?? 0;
|
|
7369
7421
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -7371,7 +7423,7 @@ var TimePicker = (props) => {
|
|
|
7371
7423
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
7372
7424
|
return out;
|
|
7373
7425
|
}, [step, min, max]);
|
|
7374
|
-
const close =
|
|
7426
|
+
const close = import_react42.default.useCallback(() => setOpen(false), []);
|
|
7375
7427
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
7376
7428
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
7377
7429
|
useEscapeKey(isOpen, () => {
|
|
@@ -7380,10 +7432,10 @@ var TimePicker = (props) => {
|
|
|
7380
7432
|
});
|
|
7381
7433
|
const host = useOverlayHost_default(triggerRef, mounted);
|
|
7382
7434
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
7383
|
-
|
|
7435
|
+
import_react42.default.useEffect(() => {
|
|
7384
7436
|
if (disabled && isOpen) setOpen(false);
|
|
7385
7437
|
}, [disabled, isOpen]);
|
|
7386
|
-
|
|
7438
|
+
import_react42.default.useEffect(() => {
|
|
7387
7439
|
if (isOpen) {
|
|
7388
7440
|
setMounted(true);
|
|
7389
7441
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -7455,20 +7507,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
7455
7507
|
var TimePicker_default = TimePicker;
|
|
7456
7508
|
|
|
7457
7509
|
// src/components/Toast/Toast.tsx
|
|
7458
|
-
var
|
|
7510
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
7459
7511
|
var import_react_dom4 = require("react-dom");
|
|
7460
7512
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
7461
|
-
var ToastContext =
|
|
7513
|
+
var ToastContext = import_react43.default.createContext(null);
|
|
7462
7514
|
var useToast = () => {
|
|
7463
|
-
const ctx =
|
|
7515
|
+
const ctx = import_react43.default.useContext(ToastContext);
|
|
7464
7516
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
7465
7517
|
return ctx;
|
|
7466
7518
|
};
|
|
7467
7519
|
var EXIT_DURATION = 300;
|
|
7468
7520
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
7469
|
-
const ref =
|
|
7470
|
-
const [height, setHeight] =
|
|
7471
|
-
|
|
7521
|
+
const ref = import_react43.default.useRef(null);
|
|
7522
|
+
const [height, setHeight] = import_react43.default.useState(void 0);
|
|
7523
|
+
import_react43.default.useEffect(() => {
|
|
7472
7524
|
if (ref.current && !isExiting) {
|
|
7473
7525
|
setHeight(ref.current.offsetHeight);
|
|
7474
7526
|
}
|
|
@@ -7500,13 +7552,13 @@ var ToastProvider = ({
|
|
|
7500
7552
|
children,
|
|
7501
7553
|
position = "top-right"
|
|
7502
7554
|
}) => {
|
|
7503
|
-
const [toasts, setToasts] =
|
|
7504
|
-
const [removing, setRemoving] =
|
|
7505
|
-
const [mounted, setMounted] =
|
|
7506
|
-
|
|
7555
|
+
const [toasts, setToasts] = import_react43.default.useState([]);
|
|
7556
|
+
const [removing, setRemoving] = import_react43.default.useState(/* @__PURE__ */ new Set());
|
|
7557
|
+
const [mounted, setMounted] = import_react43.default.useState(false);
|
|
7558
|
+
import_react43.default.useEffect(() => {
|
|
7507
7559
|
setMounted(true);
|
|
7508
7560
|
}, []);
|
|
7509
|
-
const remove =
|
|
7561
|
+
const remove = import_react43.default.useCallback((id) => {
|
|
7510
7562
|
setRemoving((prev) => new Set(prev).add(id));
|
|
7511
7563
|
setTimeout(() => {
|
|
7512
7564
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -7517,7 +7569,7 @@ var ToastProvider = ({
|
|
|
7517
7569
|
});
|
|
7518
7570
|
}, EXIT_DURATION);
|
|
7519
7571
|
}, []);
|
|
7520
|
-
const toast =
|
|
7572
|
+
const toast = import_react43.default.useCallback(
|
|
7521
7573
|
(type, message, duration = 3e3) => {
|
|
7522
7574
|
const id = `${Date.now()}-${Math.random()}`;
|
|
7523
7575
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -7570,7 +7622,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
7570
7622
|
var ToggleChip_default = ToggleChip;
|
|
7571
7623
|
|
|
7572
7624
|
// src/components/Tooltip/Tooltip.tsx
|
|
7573
|
-
var
|
|
7625
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
7574
7626
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
7575
7627
|
var OFFSET = 12;
|
|
7576
7628
|
var GAP = 8;
|
|
@@ -7586,14 +7638,14 @@ var Tooltip = (props) => {
|
|
|
7586
7638
|
disabled = false
|
|
7587
7639
|
} = props;
|
|
7588
7640
|
const shape = variant ?? type ?? "dark";
|
|
7589
|
-
const triggerRef =
|
|
7590
|
-
const tooltipRef =
|
|
7591
|
-
const [visible, setVisible] =
|
|
7592
|
-
const [pos, setPos] =
|
|
7593
|
-
const delayTimer =
|
|
7594
|
-
const rafRef =
|
|
7595
|
-
const cursor =
|
|
7596
|
-
const clamp2 =
|
|
7641
|
+
const triggerRef = import_react44.default.useRef(null);
|
|
7642
|
+
const tooltipRef = import_react44.default.useRef(null);
|
|
7643
|
+
const [visible, setVisible] = import_react44.default.useState(false);
|
|
7644
|
+
const [pos, setPos] = import_react44.default.useState({ left: 0, top: 0 });
|
|
7645
|
+
const delayTimer = import_react44.default.useRef(0);
|
|
7646
|
+
const rafRef = import_react44.default.useRef(0);
|
|
7647
|
+
const cursor = import_react44.default.useRef(null);
|
|
7648
|
+
const clamp2 = import_react44.default.useCallback((left, top, w, h) => {
|
|
7597
7649
|
const vw = window.innerWidth;
|
|
7598
7650
|
const vh = window.innerHeight;
|
|
7599
7651
|
return {
|
|
@@ -7601,7 +7653,7 @@ var Tooltip = (props) => {
|
|
|
7601
7653
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
7602
7654
|
};
|
|
7603
7655
|
}, []);
|
|
7604
|
-
const placeAtCursor =
|
|
7656
|
+
const placeAtCursor = import_react44.default.useCallback((x, y) => {
|
|
7605
7657
|
const el = tooltipRef.current;
|
|
7606
7658
|
if (!el) return;
|
|
7607
7659
|
const w = el.offsetWidth;
|
|
@@ -7612,7 +7664,7 @@ var Tooltip = (props) => {
|
|
|
7612
7664
|
if (top < GAP) top = y + OFFSET;
|
|
7613
7665
|
setPos(clamp2(left, top, w, h));
|
|
7614
7666
|
}, [clamp2]);
|
|
7615
|
-
const placeAtTrigger =
|
|
7667
|
+
const placeAtTrigger = import_react44.default.useCallback(() => {
|
|
7616
7668
|
const el = tooltipRef.current;
|
|
7617
7669
|
const trigger = triggerRef.current;
|
|
7618
7670
|
if (!el || !trigger) return;
|
|
@@ -7624,19 +7676,19 @@ var Tooltip = (props) => {
|
|
|
7624
7676
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
7625
7677
|
setPos(clamp2(left, top, w, h));
|
|
7626
7678
|
}, [clamp2]);
|
|
7627
|
-
const reposition =
|
|
7679
|
+
const reposition = import_react44.default.useCallback(() => {
|
|
7628
7680
|
if (follow && cursor.current) {
|
|
7629
7681
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7630
7682
|
} else {
|
|
7631
7683
|
placeAtTrigger();
|
|
7632
7684
|
}
|
|
7633
7685
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
7634
|
-
const handleMouseEnter =
|
|
7686
|
+
const handleMouseEnter = import_react44.default.useCallback((e) => {
|
|
7635
7687
|
if (disabled) return;
|
|
7636
7688
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7637
7689
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
7638
7690
|
}, [disabled]);
|
|
7639
|
-
const handleMouseMove =
|
|
7691
|
+
const handleMouseMove = import_react44.default.useCallback((e) => {
|
|
7640
7692
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7641
7693
|
if (!visible || !follow) return;
|
|
7642
7694
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -7644,25 +7696,25 @@ var Tooltip = (props) => {
|
|
|
7644
7696
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7645
7697
|
});
|
|
7646
7698
|
}, [visible, follow, placeAtCursor]);
|
|
7647
|
-
const close =
|
|
7699
|
+
const close = import_react44.default.useCallback(() => {
|
|
7648
7700
|
window.clearTimeout(delayTimer.current);
|
|
7649
7701
|
cancelAnimationFrame(rafRef.current);
|
|
7650
7702
|
setVisible(false);
|
|
7651
7703
|
}, []);
|
|
7652
|
-
const handleMouseLeave =
|
|
7704
|
+
const handleMouseLeave = import_react44.default.useCallback(() => {
|
|
7653
7705
|
cursor.current = null;
|
|
7654
7706
|
close();
|
|
7655
7707
|
}, [close]);
|
|
7656
|
-
const handleFocus =
|
|
7708
|
+
const handleFocus = import_react44.default.useCallback(() => {
|
|
7657
7709
|
if (disabled) return;
|
|
7658
7710
|
cursor.current = null;
|
|
7659
7711
|
setVisible(true);
|
|
7660
7712
|
}, [disabled]);
|
|
7661
|
-
|
|
7713
|
+
import_react44.default.useLayoutEffect(() => {
|
|
7662
7714
|
if (!visible) return;
|
|
7663
7715
|
reposition();
|
|
7664
7716
|
}, [visible, reposition]);
|
|
7665
|
-
|
|
7717
|
+
import_react44.default.useEffect(() => {
|
|
7666
7718
|
if (!visible || follow) return;
|
|
7667
7719
|
const onChange = () => placeAtTrigger();
|
|
7668
7720
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -7672,7 +7724,7 @@ var Tooltip = (props) => {
|
|
|
7672
7724
|
window.removeEventListener("resize", onChange);
|
|
7673
7725
|
};
|
|
7674
7726
|
}, [visible, follow, placeAtTrigger]);
|
|
7675
|
-
|
|
7727
|
+
import_react44.default.useEffect(() => () => {
|
|
7676
7728
|
window.clearTimeout(delayTimer.current);
|
|
7677
7729
|
cancelAnimationFrame(rafRef.current);
|
|
7678
7730
|
}, []);
|
|
@@ -7711,10 +7763,10 @@ Tooltip.displayName = "Tooltip";
|
|
|
7711
7763
|
var Tooltip_default = Tooltip;
|
|
7712
7764
|
|
|
7713
7765
|
// src/components/Tour/Tour.tsx
|
|
7714
|
-
var
|
|
7766
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
7715
7767
|
|
|
7716
7768
|
// src/tokens/hooks/useScrollLock.ts
|
|
7717
|
-
var
|
|
7769
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
7718
7770
|
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
7719
7771
|
" ",
|
|
7720
7772
|
"PageUp",
|
|
@@ -7727,7 +7779,7 @@ var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
|
7727
7779
|
"ArrowRight"
|
|
7728
7780
|
]);
|
|
7729
7781
|
var useScrollLock = (enabled, allowRef) => {
|
|
7730
|
-
|
|
7782
|
+
import_react45.default.useEffect(() => {
|
|
7731
7783
|
if (!enabled) return;
|
|
7732
7784
|
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
7733
7785
|
const block = (e) => {
|
|
@@ -7777,14 +7829,14 @@ var Tour = (props) => {
|
|
|
7777
7829
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
7778
7830
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
7779
7831
|
} = props;
|
|
7780
|
-
const [uncontrolled, setUncontrolled] =
|
|
7832
|
+
const [uncontrolled, setUncontrolled] = import_react46.default.useState(0);
|
|
7781
7833
|
const index = current ?? uncontrolled;
|
|
7782
7834
|
const step = steps[index];
|
|
7783
7835
|
const isLast = index === steps.length - 1;
|
|
7784
|
-
const spotRef =
|
|
7785
|
-
const cardRef =
|
|
7786
|
-
const [targetFound, setTargetFound] =
|
|
7787
|
-
const goTo =
|
|
7836
|
+
const spotRef = import_react46.default.useRef(null);
|
|
7837
|
+
const cardRef = import_react46.default.useRef(null);
|
|
7838
|
+
const [targetFound, setTargetFound] = import_react46.default.useState(true);
|
|
7839
|
+
const goTo = import_react46.default.useCallback(
|
|
7788
7840
|
(next) => {
|
|
7789
7841
|
if (current === void 0) setUncontrolled(next);
|
|
7790
7842
|
onStepChange?.(next);
|
|
@@ -7794,9 +7846,9 @@ var Tour = (props) => {
|
|
|
7794
7846
|
useEscapeKey(open, () => onClose("skip"));
|
|
7795
7847
|
useFocusTrap(cardRef, open, { trap: true });
|
|
7796
7848
|
useScrollLock_default(open, cardRef);
|
|
7797
|
-
const stepsRef =
|
|
7849
|
+
const stepsRef = import_react46.default.useRef(steps);
|
|
7798
7850
|
stepsRef.current = steps;
|
|
7799
|
-
|
|
7851
|
+
import_react46.default.useEffect(() => {
|
|
7800
7852
|
if (!open) return;
|
|
7801
7853
|
const target = stepsRef.current[index]?.target;
|
|
7802
7854
|
if (!target) return;
|
|
@@ -7821,7 +7873,7 @@ var Tour = (props) => {
|
|
|
7821
7873
|
stop = true;
|
|
7822
7874
|
};
|
|
7823
7875
|
}, [open, index]);
|
|
7824
|
-
const place =
|
|
7876
|
+
const place = import_react46.default.useCallback(() => {
|
|
7825
7877
|
const spot = spotRef.current;
|
|
7826
7878
|
const card = cardRef.current;
|
|
7827
7879
|
if (!spot || !card || !step) return;
|
|
@@ -7868,7 +7920,7 @@ var Tour = (props) => {
|
|
|
7868
7920
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
7869
7921
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
7870
7922
|
}, [step]);
|
|
7871
|
-
|
|
7923
|
+
import_react46.default.useLayoutEffect(() => {
|
|
7872
7924
|
if (!open) return;
|
|
7873
7925
|
place();
|
|
7874
7926
|
let raf = 0;
|
|
@@ -7885,7 +7937,7 @@ var Tour = (props) => {
|
|
|
7885
7937
|
raf = requestAnimationFrame(follow);
|
|
7886
7938
|
return () => cancelAnimationFrame(raf);
|
|
7887
7939
|
}, [open, index, place]);
|
|
7888
|
-
|
|
7940
|
+
import_react46.default.useEffect(() => {
|
|
7889
7941
|
if (!open) return;
|
|
7890
7942
|
const onMove = () => place();
|
|
7891
7943
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -7950,7 +8002,7 @@ Tour.displayName = "Tour";
|
|
|
7950
8002
|
var Tour_default = Tour;
|
|
7951
8003
|
|
|
7952
8004
|
// src/components/Video/Video.tsx
|
|
7953
|
-
var
|
|
8005
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
7954
8006
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
7955
8007
|
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime356.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: [
|
|
7956
8008
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7962,7 +8014,7 @@ var formatTime = (sec) => {
|
|
|
7962
8014
|
const s = Math.floor(sec % 60);
|
|
7963
8015
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7964
8016
|
};
|
|
7965
|
-
var Video =
|
|
8017
|
+
var Video = import_react47.default.forwardRef((props, ref) => {
|
|
7966
8018
|
const {
|
|
7967
8019
|
src,
|
|
7968
8020
|
poster,
|
|
@@ -7986,21 +8038,21 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
7986
8038
|
children,
|
|
7987
8039
|
...rest
|
|
7988
8040
|
} = props;
|
|
7989
|
-
const containerRef =
|
|
7990
|
-
const videoRef =
|
|
7991
|
-
const [isPlaying, setIsPlaying] =
|
|
7992
|
-
const [isLoaded, setIsLoaded] =
|
|
7993
|
-
const [currentTime, setCurrentTime] =
|
|
7994
|
-
const [duration, setDuration] =
|
|
7995
|
-
const [buffered, setBuffered] =
|
|
7996
|
-
const [volume, setVolume] =
|
|
7997
|
-
const [isMuted, setIsMuted] =
|
|
7998
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7999
|
-
const [playbackRate, setPlaybackRate] =
|
|
8000
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
8001
|
-
const [captionsOn, setCaptionsOn] =
|
|
8002
|
-
const [isPip, setIsPip] =
|
|
8003
|
-
const setRefs =
|
|
8041
|
+
const containerRef = import_react47.default.useRef(null);
|
|
8042
|
+
const videoRef = import_react47.default.useRef(null);
|
|
8043
|
+
const [isPlaying, setIsPlaying] = import_react47.default.useState(Boolean(autoPlay));
|
|
8044
|
+
const [isLoaded, setIsLoaded] = import_react47.default.useState(false);
|
|
8045
|
+
const [currentTime, setCurrentTime] = import_react47.default.useState(0);
|
|
8046
|
+
const [duration, setDuration] = import_react47.default.useState(0);
|
|
8047
|
+
const [buffered, setBuffered] = import_react47.default.useState(0);
|
|
8048
|
+
const [volume, setVolume] = import_react47.default.useState(1);
|
|
8049
|
+
const [isMuted, setIsMuted] = import_react47.default.useState(Boolean(muted));
|
|
8050
|
+
const [isFullscreen, setIsFullscreen] = import_react47.default.useState(false);
|
|
8051
|
+
const [playbackRate, setPlaybackRate] = import_react47.default.useState(1);
|
|
8052
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react47.default.useState(false);
|
|
8053
|
+
const [captionsOn, setCaptionsOn] = import_react47.default.useState(false);
|
|
8054
|
+
const [isPip, setIsPip] = import_react47.default.useState(false);
|
|
8055
|
+
const setRefs = import_react47.default.useCallback(
|
|
8004
8056
|
(el) => {
|
|
8005
8057
|
videoRef.current = el;
|
|
8006
8058
|
if (typeof ref === "function") ref(el);
|
|
@@ -8008,14 +8060,14 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
8008
8060
|
},
|
|
8009
8061
|
[ref]
|
|
8010
8062
|
);
|
|
8011
|
-
|
|
8063
|
+
import_react47.default.useEffect(() => {
|
|
8012
8064
|
const onFsChange = () => {
|
|
8013
8065
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
8014
8066
|
};
|
|
8015
8067
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
8016
8068
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
8017
8069
|
}, []);
|
|
8018
|
-
|
|
8070
|
+
import_react47.default.useEffect(() => {
|
|
8019
8071
|
const v = videoRef.current;
|
|
8020
8072
|
if (!v) return;
|
|
8021
8073
|
const onEnter = () => setIsPip(true);
|