@x-plat/design-system 0.16.3 → 0.18.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/Table/index.cjs +86 -31
- package/dist/components/Table/index.css +173 -146
- package/dist/components/Table/index.d.cts +10 -0
- package/dist/components/Table/index.d.ts +10 -0
- package/dist/components/Table/index.js +90 -35
- package/dist/components/index.cjs +164 -109
- package/dist/components/index.css +173 -146
- package/dist/components/index.js +195 -140
- package/dist/index.cjs +169 -114
- package/dist/index.css +173 -146
- package/dist/index.js +205 -150
- package/guidelines/components/table.md +1 -0
- package/package.json +1 -1
|
@@ -7041,6 +7041,9 @@ var Switch = (props) => {
|
|
|
7041
7041
|
Switch.displayName = "Switch";
|
|
7042
7042
|
var Switch_default = Switch;
|
|
7043
7043
|
|
|
7044
|
+
// src/components/Table/Table.tsx
|
|
7045
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
7046
|
+
|
|
7044
7047
|
// src/components/Table/TableContext.tsx
|
|
7045
7048
|
var import_react35 = __toESM(require("react"), 1);
|
|
7046
7049
|
var TableContext = import_react35.default.createContext(null);
|
|
@@ -7052,7 +7055,42 @@ var useTableContext = () => {
|
|
|
7052
7055
|
var TableContext_default = TableContext;
|
|
7053
7056
|
|
|
7054
7057
|
// src/components/Table/Table.tsx
|
|
7055
|
-
var import_jsx_runtime344 =
|
|
7058
|
+
var import_jsx_runtime344 = (
|
|
7059
|
+
/**
|
|
7060
|
+
* 바깥 이름(`lib-xplat-table-wrapper`)을 그대로 둔다 — 소비처가 이 클래스를
|
|
7061
|
+
* 자리 잡는 데 쓰고 있을 수 있어서다. 스크롤은 안쪽 `-scroller` 가 맡는다.
|
|
7062
|
+
*/
|
|
7063
|
+
require("react/jsx-runtime")
|
|
7064
|
+
);
|
|
7065
|
+
var useScrollExtent = (scrollerRef, thumbRef) => {
|
|
7066
|
+
const [scrollable, setScrollable] = import_react36.default.useState(false);
|
|
7067
|
+
import_react36.default.useEffect(() => {
|
|
7068
|
+
const el = scrollerRef.current;
|
|
7069
|
+
if (!el) return;
|
|
7070
|
+
const update = () => {
|
|
7071
|
+
const max = el.scrollWidth - el.clientWidth;
|
|
7072
|
+
const can = max > 1;
|
|
7073
|
+
setScrollable(can);
|
|
7074
|
+
const thumb = thumbRef.current;
|
|
7075
|
+
if (!thumb) return;
|
|
7076
|
+
const ratio = can ? el.clientWidth / el.scrollWidth : 1;
|
|
7077
|
+
const w = Math.max(ratio * 100, 8);
|
|
7078
|
+
thumb.style.width = `${w.toFixed(2)}%`;
|
|
7079
|
+
thumb.style.left = can ? `${(el.scrollLeft / max * (100 - w)).toFixed(2)}%` : "0%";
|
|
7080
|
+
};
|
|
7081
|
+
update();
|
|
7082
|
+
el.addEventListener("scroll", update, { passive: true });
|
|
7083
|
+
const ro = new ResizeObserver(update);
|
|
7084
|
+
ro.observe(el);
|
|
7085
|
+
const table = el.firstElementChild;
|
|
7086
|
+
if (table) ro.observe(table);
|
|
7087
|
+
return () => {
|
|
7088
|
+
el.removeEventListener("scroll", update);
|
|
7089
|
+
ro.disconnect();
|
|
7090
|
+
};
|
|
7091
|
+
}, [scrollerRef, thumbRef]);
|
|
7092
|
+
return scrollable;
|
|
7093
|
+
};
|
|
7056
7094
|
var Table = (props) => {
|
|
7057
7095
|
const {
|
|
7058
7096
|
children,
|
|
@@ -7060,25 +7098,42 @@ var Table = (props) => {
|
|
|
7060
7098
|
rowBorderUse = true,
|
|
7061
7099
|
colBorderUse = true,
|
|
7062
7100
|
headerSticky = false,
|
|
7063
|
-
stickyShadow = true
|
|
7101
|
+
stickyShadow = true,
|
|
7102
|
+
minWidth
|
|
7064
7103
|
} = props;
|
|
7065
|
-
|
|
7104
|
+
const scrollerRef = import_react36.default.useRef(null);
|
|
7105
|
+
const thumbRef = import_react36.default.useRef(null);
|
|
7106
|
+
const scrollable = useScrollExtent(scrollerRef, thumbRef);
|
|
7107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
|
|
7066
7108
|
"div",
|
|
7067
7109
|
{
|
|
7068
7110
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7111
|
+
style: minWidth === void 0 ? void 0 : {
|
|
7112
|
+
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
7113
|
+
},
|
|
7114
|
+
children: [
|
|
7115
|
+
/* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7116
|
+
"div",
|
|
7117
|
+
{
|
|
7118
|
+
ref: scrollerRef,
|
|
7119
|
+
className: "lib-xplat-table-scroller",
|
|
7120
|
+
"data-xplat-overlay-escape": "",
|
|
7121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)(
|
|
7122
|
+
TableContext_default.Provider,
|
|
7123
|
+
{
|
|
7124
|
+
value: {
|
|
7125
|
+
rowBorderUse,
|
|
7126
|
+
colBorderUse,
|
|
7127
|
+
headerSticky,
|
|
7128
|
+
stickyShadow
|
|
7129
|
+
},
|
|
7130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime344.jsx)("table", { className: "lib-xplat-table", children })
|
|
7131
|
+
}
|
|
7132
|
+
)
|
|
7133
|
+
}
|
|
7134
|
+
),
|
|
7135
|
+
/* @__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" }) })
|
|
7136
|
+
]
|
|
7082
7137
|
}
|
|
7083
7138
|
);
|
|
7084
7139
|
};
|
|
@@ -7095,24 +7150,24 @@ TableBody.displayName = "TableBody";
|
|
|
7095
7150
|
var TableBody_default = TableBody;
|
|
7096
7151
|
|
|
7097
7152
|
// src/components/Table/TableCell.tsx
|
|
7098
|
-
var
|
|
7153
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
7099
7154
|
|
|
7100
7155
|
// src/components/Table/TableHeadContext.tsx
|
|
7101
|
-
var
|
|
7102
|
-
var TableHeadContext =
|
|
7156
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
7157
|
+
var TableHeadContext = import_react37.default.createContext(
|
|
7103
7158
|
null
|
|
7104
7159
|
);
|
|
7105
7160
|
var useTableHeadContext = () => {
|
|
7106
|
-
const ctx =
|
|
7161
|
+
const ctx = import_react37.default.useContext(TableHeadContext);
|
|
7107
7162
|
return ctx;
|
|
7108
7163
|
};
|
|
7109
7164
|
var TableHeadContext_default = TableHeadContext;
|
|
7110
7165
|
|
|
7111
7166
|
// src/components/Table/TableRowContext.tsx
|
|
7112
|
-
var
|
|
7113
|
-
var TableRowContext =
|
|
7167
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
7168
|
+
var TableRowContext = import_react38.default.createContext(null);
|
|
7114
7169
|
var useTableRowContext = () => {
|
|
7115
|
-
const ctx =
|
|
7170
|
+
const ctx = import_react38.default.useContext(TableRowContext);
|
|
7116
7171
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7117
7172
|
return ctx;
|
|
7118
7173
|
};
|
|
@@ -7120,7 +7175,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
7120
7175
|
|
|
7121
7176
|
// src/components/Table/TableCell.tsx
|
|
7122
7177
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
7123
|
-
var TableCell =
|
|
7178
|
+
var TableCell = import_react39.default.memo((props) => {
|
|
7124
7179
|
const {
|
|
7125
7180
|
children,
|
|
7126
7181
|
align = "center",
|
|
@@ -7134,9 +7189,9 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
7134
7189
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
7135
7190
|
const { stickyShadow } = useTableContext();
|
|
7136
7191
|
const headContext = useTableHeadContext();
|
|
7137
|
-
const [left, setLeft] =
|
|
7138
|
-
const cellRef =
|
|
7139
|
-
const calculateLeft =
|
|
7192
|
+
const [left, setLeft] = import_react39.default.useState(0);
|
|
7193
|
+
const cellRef = import_react39.default.useRef(null);
|
|
7194
|
+
const calculateLeft = import_react39.default.useCallback(() => {
|
|
7140
7195
|
if (!cellRef.current) return 0;
|
|
7141
7196
|
let totalLeft = 0;
|
|
7142
7197
|
for (const ref of stickyCells) {
|
|
@@ -7145,7 +7200,7 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
7145
7200
|
}
|
|
7146
7201
|
return totalLeft;
|
|
7147
7202
|
}, [stickyCells]);
|
|
7148
|
-
|
|
7203
|
+
import_react39.default.useEffect(() => {
|
|
7149
7204
|
if (!isSticky || !cellRef.current) return;
|
|
7150
7205
|
registerStickyCell(cellRef);
|
|
7151
7206
|
setLeft(calculateLeft());
|
|
@@ -7203,9 +7258,9 @@ TableHead.displayName = "TableHead";
|
|
|
7203
7258
|
var TableHead_default = TableHead;
|
|
7204
7259
|
|
|
7205
7260
|
// src/components/Table/TableRow.tsx
|
|
7206
|
-
var
|
|
7261
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
7207
7262
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
7208
|
-
var TableRow =
|
|
7263
|
+
var TableRow = import_react40.default.memo((props) => {
|
|
7209
7264
|
const {
|
|
7210
7265
|
children,
|
|
7211
7266
|
type = "secondary",
|
|
@@ -7214,7 +7269,7 @@ var TableRow = import_react39.default.memo((props) => {
|
|
|
7214
7269
|
onClick
|
|
7215
7270
|
} = props;
|
|
7216
7271
|
const { rowBorderUse } = useTableContext();
|
|
7217
|
-
const [stickyCells, setStickyCells] =
|
|
7272
|
+
const [stickyCells, setStickyCells] = import_react40.default.useState([]);
|
|
7218
7273
|
const registerStickyCell = (ref) => {
|
|
7219
7274
|
setStickyCells((prev) => {
|
|
7220
7275
|
if (prev.includes(ref)) return prev;
|
|
@@ -7278,9 +7333,9 @@ Tag.displayName = "Tag";
|
|
|
7278
7333
|
var Tag_default = Tag;
|
|
7279
7334
|
|
|
7280
7335
|
// src/components/TextArea/TextArea.tsx
|
|
7281
|
-
var
|
|
7336
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
7282
7337
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
7283
|
-
var TextArea =
|
|
7338
|
+
var TextArea = import_react41.default.forwardRef(
|
|
7284
7339
|
(props, ref) => {
|
|
7285
7340
|
const {
|
|
7286
7341
|
className,
|
|
@@ -7293,7 +7348,7 @@ var TextArea = import_react40.default.forwardRef(
|
|
|
7293
7348
|
disabled,
|
|
7294
7349
|
...textareaProps
|
|
7295
7350
|
} = props;
|
|
7296
|
-
const autoId =
|
|
7351
|
+
const autoId = import_react41.default.useId();
|
|
7297
7352
|
const fieldId = props.id ?? autoId;
|
|
7298
7353
|
const control = /* @__PURE__ */ (0, import_jsx_runtime350.jsx)("div", { className: clsx_default("lib-xplat-textarea-wrap", className), children: /* @__PURE__ */ (0, import_jsx_runtime350.jsx)(
|
|
7299
7354
|
"textarea",
|
|
@@ -7315,7 +7370,7 @@ TextArea.displayName = "TextArea";
|
|
|
7315
7370
|
var TextArea_default = TextArea;
|
|
7316
7371
|
|
|
7317
7372
|
// src/components/TimePicker/TimePicker.tsx
|
|
7318
|
-
var
|
|
7373
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
7319
7374
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
7320
7375
|
var ANIMATION_DURATION_MS4 = 200;
|
|
7321
7376
|
var toMinutes = (hhmm) => {
|
|
@@ -7353,13 +7408,13 @@ var TimePicker = (props) => {
|
|
|
7353
7408
|
required,
|
|
7354
7409
|
validations
|
|
7355
7410
|
} = props;
|
|
7356
|
-
const fieldId =
|
|
7357
|
-
const triggerRef =
|
|
7358
|
-
const contentRef =
|
|
7359
|
-
const [isOpen, setOpen] =
|
|
7360
|
-
const [mounted, setMounted] =
|
|
7361
|
-
const [visible, setVisible] =
|
|
7362
|
-
const options =
|
|
7411
|
+
const fieldId = import_react42.default.useId();
|
|
7412
|
+
const triggerRef = import_react42.default.useRef(null);
|
|
7413
|
+
const contentRef = import_react42.default.useRef(null);
|
|
7414
|
+
const [isOpen, setOpen] = import_react42.default.useState(false);
|
|
7415
|
+
const [mounted, setMounted] = import_react42.default.useState(false);
|
|
7416
|
+
const [visible, setVisible] = import_react42.default.useState(false);
|
|
7417
|
+
const options = import_react42.default.useMemo(() => {
|
|
7363
7418
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
7364
7419
|
const lo = toMinutes(min) ?? 0;
|
|
7365
7420
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -7367,7 +7422,7 @@ var TimePicker = (props) => {
|
|
|
7367
7422
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
7368
7423
|
return out;
|
|
7369
7424
|
}, [step, min, max]);
|
|
7370
|
-
const close =
|
|
7425
|
+
const close = import_react42.default.useCallback(() => setOpen(false), []);
|
|
7371
7426
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
7372
7427
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
7373
7428
|
useEscapeKey(isOpen, () => {
|
|
@@ -7376,10 +7431,10 @@ var TimePicker = (props) => {
|
|
|
7376
7431
|
});
|
|
7377
7432
|
const host = useOverlayHost_default(triggerRef, mounted);
|
|
7378
7433
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
7379
|
-
|
|
7434
|
+
import_react42.default.useEffect(() => {
|
|
7380
7435
|
if (disabled && isOpen) setOpen(false);
|
|
7381
7436
|
}, [disabled, isOpen]);
|
|
7382
|
-
|
|
7437
|
+
import_react42.default.useEffect(() => {
|
|
7383
7438
|
if (isOpen) {
|
|
7384
7439
|
setMounted(true);
|
|
7385
7440
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -7451,20 +7506,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
7451
7506
|
var TimePicker_default = TimePicker;
|
|
7452
7507
|
|
|
7453
7508
|
// src/components/Toast/Toast.tsx
|
|
7454
|
-
var
|
|
7509
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
7455
7510
|
var import_react_dom4 = require("react-dom");
|
|
7456
7511
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
7457
|
-
var ToastContext =
|
|
7512
|
+
var ToastContext = import_react43.default.createContext(null);
|
|
7458
7513
|
var useToast = () => {
|
|
7459
|
-
const ctx =
|
|
7514
|
+
const ctx = import_react43.default.useContext(ToastContext);
|
|
7460
7515
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
7461
7516
|
return ctx;
|
|
7462
7517
|
};
|
|
7463
7518
|
var EXIT_DURATION = 300;
|
|
7464
7519
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
7465
|
-
const ref =
|
|
7466
|
-
const [height, setHeight] =
|
|
7467
|
-
|
|
7520
|
+
const ref = import_react43.default.useRef(null);
|
|
7521
|
+
const [height, setHeight] = import_react43.default.useState(void 0);
|
|
7522
|
+
import_react43.default.useEffect(() => {
|
|
7468
7523
|
if (ref.current && !isExiting) {
|
|
7469
7524
|
setHeight(ref.current.offsetHeight);
|
|
7470
7525
|
}
|
|
@@ -7496,13 +7551,13 @@ var ToastProvider = ({
|
|
|
7496
7551
|
children,
|
|
7497
7552
|
position = "top-right"
|
|
7498
7553
|
}) => {
|
|
7499
|
-
const [toasts, setToasts] =
|
|
7500
|
-
const [removing, setRemoving] =
|
|
7501
|
-
const [mounted, setMounted] =
|
|
7502
|
-
|
|
7554
|
+
const [toasts, setToasts] = import_react43.default.useState([]);
|
|
7555
|
+
const [removing, setRemoving] = import_react43.default.useState(/* @__PURE__ */ new Set());
|
|
7556
|
+
const [mounted, setMounted] = import_react43.default.useState(false);
|
|
7557
|
+
import_react43.default.useEffect(() => {
|
|
7503
7558
|
setMounted(true);
|
|
7504
7559
|
}, []);
|
|
7505
|
-
const remove =
|
|
7560
|
+
const remove = import_react43.default.useCallback((id) => {
|
|
7506
7561
|
setRemoving((prev) => new Set(prev).add(id));
|
|
7507
7562
|
setTimeout(() => {
|
|
7508
7563
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -7513,7 +7568,7 @@ var ToastProvider = ({
|
|
|
7513
7568
|
});
|
|
7514
7569
|
}, EXIT_DURATION);
|
|
7515
7570
|
}, []);
|
|
7516
|
-
const toast =
|
|
7571
|
+
const toast = import_react43.default.useCallback(
|
|
7517
7572
|
(type, message, duration = 3e3) => {
|
|
7518
7573
|
const id = `${Date.now()}-${Math.random()}`;
|
|
7519
7574
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -7566,7 +7621,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
7566
7621
|
var ToggleChip_default = ToggleChip;
|
|
7567
7622
|
|
|
7568
7623
|
// src/components/Tooltip/Tooltip.tsx
|
|
7569
|
-
var
|
|
7624
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
7570
7625
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
7571
7626
|
var OFFSET = 12;
|
|
7572
7627
|
var GAP = 8;
|
|
@@ -7582,14 +7637,14 @@ var Tooltip = (props) => {
|
|
|
7582
7637
|
disabled = false
|
|
7583
7638
|
} = props;
|
|
7584
7639
|
const shape = variant ?? type ?? "dark";
|
|
7585
|
-
const triggerRef =
|
|
7586
|
-
const tooltipRef =
|
|
7587
|
-
const [visible, setVisible] =
|
|
7588
|
-
const [pos, setPos] =
|
|
7589
|
-
const delayTimer =
|
|
7590
|
-
const rafRef =
|
|
7591
|
-
const cursor =
|
|
7592
|
-
const clamp2 =
|
|
7640
|
+
const triggerRef = import_react44.default.useRef(null);
|
|
7641
|
+
const tooltipRef = import_react44.default.useRef(null);
|
|
7642
|
+
const [visible, setVisible] = import_react44.default.useState(false);
|
|
7643
|
+
const [pos, setPos] = import_react44.default.useState({ left: 0, top: 0 });
|
|
7644
|
+
const delayTimer = import_react44.default.useRef(0);
|
|
7645
|
+
const rafRef = import_react44.default.useRef(0);
|
|
7646
|
+
const cursor = import_react44.default.useRef(null);
|
|
7647
|
+
const clamp2 = import_react44.default.useCallback((left, top, w, h) => {
|
|
7593
7648
|
const vw = window.innerWidth;
|
|
7594
7649
|
const vh = window.innerHeight;
|
|
7595
7650
|
return {
|
|
@@ -7597,7 +7652,7 @@ var Tooltip = (props) => {
|
|
|
7597
7652
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
7598
7653
|
};
|
|
7599
7654
|
}, []);
|
|
7600
|
-
const placeAtCursor =
|
|
7655
|
+
const placeAtCursor = import_react44.default.useCallback((x, y) => {
|
|
7601
7656
|
const el = tooltipRef.current;
|
|
7602
7657
|
if (!el) return;
|
|
7603
7658
|
const w = el.offsetWidth;
|
|
@@ -7608,7 +7663,7 @@ var Tooltip = (props) => {
|
|
|
7608
7663
|
if (top < GAP) top = y + OFFSET;
|
|
7609
7664
|
setPos(clamp2(left, top, w, h));
|
|
7610
7665
|
}, [clamp2]);
|
|
7611
|
-
const placeAtTrigger =
|
|
7666
|
+
const placeAtTrigger = import_react44.default.useCallback(() => {
|
|
7612
7667
|
const el = tooltipRef.current;
|
|
7613
7668
|
const trigger = triggerRef.current;
|
|
7614
7669
|
if (!el || !trigger) return;
|
|
@@ -7620,19 +7675,19 @@ var Tooltip = (props) => {
|
|
|
7620
7675
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
7621
7676
|
setPos(clamp2(left, top, w, h));
|
|
7622
7677
|
}, [clamp2]);
|
|
7623
|
-
const reposition =
|
|
7678
|
+
const reposition = import_react44.default.useCallback(() => {
|
|
7624
7679
|
if (follow && cursor.current) {
|
|
7625
7680
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7626
7681
|
} else {
|
|
7627
7682
|
placeAtTrigger();
|
|
7628
7683
|
}
|
|
7629
7684
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
7630
|
-
const handleMouseEnter =
|
|
7685
|
+
const handleMouseEnter = import_react44.default.useCallback((e) => {
|
|
7631
7686
|
if (disabled) return;
|
|
7632
7687
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7633
7688
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
7634
7689
|
}, [disabled]);
|
|
7635
|
-
const handleMouseMove =
|
|
7690
|
+
const handleMouseMove = import_react44.default.useCallback((e) => {
|
|
7636
7691
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7637
7692
|
if (!visible || !follow) return;
|
|
7638
7693
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -7640,25 +7695,25 @@ var Tooltip = (props) => {
|
|
|
7640
7695
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7641
7696
|
});
|
|
7642
7697
|
}, [visible, follow, placeAtCursor]);
|
|
7643
|
-
const close =
|
|
7698
|
+
const close = import_react44.default.useCallback(() => {
|
|
7644
7699
|
window.clearTimeout(delayTimer.current);
|
|
7645
7700
|
cancelAnimationFrame(rafRef.current);
|
|
7646
7701
|
setVisible(false);
|
|
7647
7702
|
}, []);
|
|
7648
|
-
const handleMouseLeave =
|
|
7703
|
+
const handleMouseLeave = import_react44.default.useCallback(() => {
|
|
7649
7704
|
cursor.current = null;
|
|
7650
7705
|
close();
|
|
7651
7706
|
}, [close]);
|
|
7652
|
-
const handleFocus =
|
|
7707
|
+
const handleFocus = import_react44.default.useCallback(() => {
|
|
7653
7708
|
if (disabled) return;
|
|
7654
7709
|
cursor.current = null;
|
|
7655
7710
|
setVisible(true);
|
|
7656
7711
|
}, [disabled]);
|
|
7657
|
-
|
|
7712
|
+
import_react44.default.useLayoutEffect(() => {
|
|
7658
7713
|
if (!visible) return;
|
|
7659
7714
|
reposition();
|
|
7660
7715
|
}, [visible, reposition]);
|
|
7661
|
-
|
|
7716
|
+
import_react44.default.useEffect(() => {
|
|
7662
7717
|
if (!visible || follow) return;
|
|
7663
7718
|
const onChange = () => placeAtTrigger();
|
|
7664
7719
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -7668,7 +7723,7 @@ var Tooltip = (props) => {
|
|
|
7668
7723
|
window.removeEventListener("resize", onChange);
|
|
7669
7724
|
};
|
|
7670
7725
|
}, [visible, follow, placeAtTrigger]);
|
|
7671
|
-
|
|
7726
|
+
import_react44.default.useEffect(() => () => {
|
|
7672
7727
|
window.clearTimeout(delayTimer.current);
|
|
7673
7728
|
cancelAnimationFrame(rafRef.current);
|
|
7674
7729
|
}, []);
|
|
@@ -7707,10 +7762,10 @@ Tooltip.displayName = "Tooltip";
|
|
|
7707
7762
|
var Tooltip_default = Tooltip;
|
|
7708
7763
|
|
|
7709
7764
|
// src/components/Tour/Tour.tsx
|
|
7710
|
-
var
|
|
7765
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
7711
7766
|
|
|
7712
7767
|
// src/tokens/hooks/useScrollLock.ts
|
|
7713
|
-
var
|
|
7768
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
7714
7769
|
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
7715
7770
|
" ",
|
|
7716
7771
|
"PageUp",
|
|
@@ -7723,7 +7778,7 @@ var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
|
7723
7778
|
"ArrowRight"
|
|
7724
7779
|
]);
|
|
7725
7780
|
var useScrollLock = (enabled, allowRef) => {
|
|
7726
|
-
|
|
7781
|
+
import_react45.default.useEffect(() => {
|
|
7727
7782
|
if (!enabled) return;
|
|
7728
7783
|
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
7729
7784
|
const block = (e) => {
|
|
@@ -7773,14 +7828,14 @@ var Tour = (props) => {
|
|
|
7773
7828
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
7774
7829
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
7775
7830
|
} = props;
|
|
7776
|
-
const [uncontrolled, setUncontrolled] =
|
|
7831
|
+
const [uncontrolled, setUncontrolled] = import_react46.default.useState(0);
|
|
7777
7832
|
const index = current ?? uncontrolled;
|
|
7778
7833
|
const step = steps[index];
|
|
7779
7834
|
const isLast = index === steps.length - 1;
|
|
7780
|
-
const spotRef =
|
|
7781
|
-
const cardRef =
|
|
7782
|
-
const [targetFound, setTargetFound] =
|
|
7783
|
-
const goTo =
|
|
7835
|
+
const spotRef = import_react46.default.useRef(null);
|
|
7836
|
+
const cardRef = import_react46.default.useRef(null);
|
|
7837
|
+
const [targetFound, setTargetFound] = import_react46.default.useState(true);
|
|
7838
|
+
const goTo = import_react46.default.useCallback(
|
|
7784
7839
|
(next) => {
|
|
7785
7840
|
if (current === void 0) setUncontrolled(next);
|
|
7786
7841
|
onStepChange?.(next);
|
|
@@ -7790,9 +7845,9 @@ var Tour = (props) => {
|
|
|
7790
7845
|
useEscapeKey(open, () => onClose("skip"));
|
|
7791
7846
|
useFocusTrap(cardRef, open, { trap: true });
|
|
7792
7847
|
useScrollLock_default(open, cardRef);
|
|
7793
|
-
const stepsRef =
|
|
7848
|
+
const stepsRef = import_react46.default.useRef(steps);
|
|
7794
7849
|
stepsRef.current = steps;
|
|
7795
|
-
|
|
7850
|
+
import_react46.default.useEffect(() => {
|
|
7796
7851
|
if (!open) return;
|
|
7797
7852
|
const target = stepsRef.current[index]?.target;
|
|
7798
7853
|
if (!target) return;
|
|
@@ -7817,7 +7872,7 @@ var Tour = (props) => {
|
|
|
7817
7872
|
stop = true;
|
|
7818
7873
|
};
|
|
7819
7874
|
}, [open, index]);
|
|
7820
|
-
const place =
|
|
7875
|
+
const place = import_react46.default.useCallback(() => {
|
|
7821
7876
|
const spot = spotRef.current;
|
|
7822
7877
|
const card = cardRef.current;
|
|
7823
7878
|
if (!spot || !card || !step) return;
|
|
@@ -7864,7 +7919,7 @@ var Tour = (props) => {
|
|
|
7864
7919
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
7865
7920
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
7866
7921
|
}, [step]);
|
|
7867
|
-
|
|
7922
|
+
import_react46.default.useLayoutEffect(() => {
|
|
7868
7923
|
if (!open) return;
|
|
7869
7924
|
place();
|
|
7870
7925
|
let raf = 0;
|
|
@@ -7881,7 +7936,7 @@ var Tour = (props) => {
|
|
|
7881
7936
|
raf = requestAnimationFrame(follow);
|
|
7882
7937
|
return () => cancelAnimationFrame(raf);
|
|
7883
7938
|
}, [open, index, place]);
|
|
7884
|
-
|
|
7939
|
+
import_react46.default.useEffect(() => {
|
|
7885
7940
|
if (!open) return;
|
|
7886
7941
|
const onMove = () => place();
|
|
7887
7942
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -7946,7 +8001,7 @@ Tour.displayName = "Tour";
|
|
|
7946
8001
|
var Tour_default = Tour;
|
|
7947
8002
|
|
|
7948
8003
|
// src/components/Video/Video.tsx
|
|
7949
|
-
var
|
|
8004
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
7950
8005
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
7951
8006
|
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: [
|
|
7952
8007
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7958,7 +8013,7 @@ var formatTime = (sec) => {
|
|
|
7958
8013
|
const s = Math.floor(sec % 60);
|
|
7959
8014
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7960
8015
|
};
|
|
7961
|
-
var Video =
|
|
8016
|
+
var Video = import_react47.default.forwardRef((props, ref) => {
|
|
7962
8017
|
const {
|
|
7963
8018
|
src,
|
|
7964
8019
|
poster,
|
|
@@ -7982,21 +8037,21 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
7982
8037
|
children,
|
|
7983
8038
|
...rest
|
|
7984
8039
|
} = props;
|
|
7985
|
-
const containerRef =
|
|
7986
|
-
const videoRef =
|
|
7987
|
-
const [isPlaying, setIsPlaying] =
|
|
7988
|
-
const [isLoaded, setIsLoaded] =
|
|
7989
|
-
const [currentTime, setCurrentTime] =
|
|
7990
|
-
const [duration, setDuration] =
|
|
7991
|
-
const [buffered, setBuffered] =
|
|
7992
|
-
const [volume, setVolume] =
|
|
7993
|
-
const [isMuted, setIsMuted] =
|
|
7994
|
-
const [isFullscreen, setIsFullscreen] =
|
|
7995
|
-
const [playbackRate, setPlaybackRate] =
|
|
7996
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
7997
|
-
const [captionsOn, setCaptionsOn] =
|
|
7998
|
-
const [isPip, setIsPip] =
|
|
7999
|
-
const setRefs =
|
|
8040
|
+
const containerRef = import_react47.default.useRef(null);
|
|
8041
|
+
const videoRef = import_react47.default.useRef(null);
|
|
8042
|
+
const [isPlaying, setIsPlaying] = import_react47.default.useState(Boolean(autoPlay));
|
|
8043
|
+
const [isLoaded, setIsLoaded] = import_react47.default.useState(false);
|
|
8044
|
+
const [currentTime, setCurrentTime] = import_react47.default.useState(0);
|
|
8045
|
+
const [duration, setDuration] = import_react47.default.useState(0);
|
|
8046
|
+
const [buffered, setBuffered] = import_react47.default.useState(0);
|
|
8047
|
+
const [volume, setVolume] = import_react47.default.useState(1);
|
|
8048
|
+
const [isMuted, setIsMuted] = import_react47.default.useState(Boolean(muted));
|
|
8049
|
+
const [isFullscreen, setIsFullscreen] = import_react47.default.useState(false);
|
|
8050
|
+
const [playbackRate, setPlaybackRate] = import_react47.default.useState(1);
|
|
8051
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react47.default.useState(false);
|
|
8052
|
+
const [captionsOn, setCaptionsOn] = import_react47.default.useState(false);
|
|
8053
|
+
const [isPip, setIsPip] = import_react47.default.useState(false);
|
|
8054
|
+
const setRefs = import_react47.default.useCallback(
|
|
8000
8055
|
(el) => {
|
|
8001
8056
|
videoRef.current = el;
|
|
8002
8057
|
if (typeof ref === "function") ref(el);
|
|
@@ -8004,14 +8059,14 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
8004
8059
|
},
|
|
8005
8060
|
[ref]
|
|
8006
8061
|
);
|
|
8007
|
-
|
|
8062
|
+
import_react47.default.useEffect(() => {
|
|
8008
8063
|
const onFsChange = () => {
|
|
8009
8064
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
8010
8065
|
};
|
|
8011
8066
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
8012
8067
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
8013
8068
|
}, []);
|
|
8014
|
-
|
|
8069
|
+
import_react47.default.useEffect(() => {
|
|
8015
8070
|
const v = videoRef.current;
|
|
8016
8071
|
if (!v) return;
|
|
8017
8072
|
const onEnter = () => setIsPip(true);
|