@x-plat/design-system 0.17.0 → 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 +81 -30
- package/dist/components/Table/index.css +172 -145
- package/dist/components/Table/index.js +88 -37
- package/dist/components/index.cjs +159 -108
- package/dist/components/index.css +172 -145
- package/dist/components/index.js +193 -142
- package/dist/index.cjs +164 -113
- package/dist/index.css +172 -145
- package/dist/index.js +203 -152
- 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,
|
|
@@ -7063,26 +7101,39 @@ var Table = (props) => {
|
|
|
7063
7101
|
stickyShadow = true,
|
|
7064
7102
|
minWidth
|
|
7065
7103
|
} = props;
|
|
7066
|
-
|
|
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)(
|
|
7067
7108
|
"div",
|
|
7068
7109
|
{
|
|
7069
7110
|
className: `lib-xplat-table-wrapper ${size}`,
|
|
7070
|
-
"data-xplat-overlay-escape": "",
|
|
7071
7111
|
style: minWidth === void 0 ? void 0 : {
|
|
7072
7112
|
"--table-min-width": typeof minWidth === "number" ? `${minWidth}px` : minWidth
|
|
7073
7113
|
},
|
|
7074
|
-
children:
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
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
|
+
]
|
|
7086
7137
|
}
|
|
7087
7138
|
);
|
|
7088
7139
|
};
|
|
@@ -7099,24 +7150,24 @@ TableBody.displayName = "TableBody";
|
|
|
7099
7150
|
var TableBody_default = TableBody;
|
|
7100
7151
|
|
|
7101
7152
|
// src/components/Table/TableCell.tsx
|
|
7102
|
-
var
|
|
7153
|
+
var import_react39 = __toESM(require("react"), 1);
|
|
7103
7154
|
|
|
7104
7155
|
// src/components/Table/TableHeadContext.tsx
|
|
7105
|
-
var
|
|
7106
|
-
var TableHeadContext =
|
|
7156
|
+
var import_react37 = __toESM(require("react"), 1);
|
|
7157
|
+
var TableHeadContext = import_react37.default.createContext(
|
|
7107
7158
|
null
|
|
7108
7159
|
);
|
|
7109
7160
|
var useTableHeadContext = () => {
|
|
7110
|
-
const ctx =
|
|
7161
|
+
const ctx = import_react37.default.useContext(TableHeadContext);
|
|
7111
7162
|
return ctx;
|
|
7112
7163
|
};
|
|
7113
7164
|
var TableHeadContext_default = TableHeadContext;
|
|
7114
7165
|
|
|
7115
7166
|
// src/components/Table/TableRowContext.tsx
|
|
7116
|
-
var
|
|
7117
|
-
var TableRowContext =
|
|
7167
|
+
var import_react38 = __toESM(require("react"), 1);
|
|
7168
|
+
var TableRowContext = import_react38.default.createContext(null);
|
|
7118
7169
|
var useTableRowContext = () => {
|
|
7119
|
-
const ctx =
|
|
7170
|
+
const ctx = import_react38.default.useContext(TableRowContext);
|
|
7120
7171
|
if (!ctx) throw new Error("Table components must be used inside <Table>");
|
|
7121
7172
|
return ctx;
|
|
7122
7173
|
};
|
|
@@ -7124,7 +7175,7 @@ var TableRowContext_default = TableRowContext;
|
|
|
7124
7175
|
|
|
7125
7176
|
// src/components/Table/TableCell.tsx
|
|
7126
7177
|
var import_jsx_runtime346 = require("react/jsx-runtime");
|
|
7127
|
-
var TableCell =
|
|
7178
|
+
var TableCell = import_react39.default.memo((props) => {
|
|
7128
7179
|
const {
|
|
7129
7180
|
children,
|
|
7130
7181
|
align = "center",
|
|
@@ -7138,9 +7189,9 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
7138
7189
|
const { registerStickyCell, stickyCells } = useTableRowContext();
|
|
7139
7190
|
const { stickyShadow } = useTableContext();
|
|
7140
7191
|
const headContext = useTableHeadContext();
|
|
7141
|
-
const [left, setLeft] =
|
|
7142
|
-
const cellRef =
|
|
7143
|
-
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(() => {
|
|
7144
7195
|
if (!cellRef.current) return 0;
|
|
7145
7196
|
let totalLeft = 0;
|
|
7146
7197
|
for (const ref of stickyCells) {
|
|
@@ -7149,7 +7200,7 @@ var TableCell = import_react38.default.memo((props) => {
|
|
|
7149
7200
|
}
|
|
7150
7201
|
return totalLeft;
|
|
7151
7202
|
}, [stickyCells]);
|
|
7152
|
-
|
|
7203
|
+
import_react39.default.useEffect(() => {
|
|
7153
7204
|
if (!isSticky || !cellRef.current) return;
|
|
7154
7205
|
registerStickyCell(cellRef);
|
|
7155
7206
|
setLeft(calculateLeft());
|
|
@@ -7207,9 +7258,9 @@ TableHead.displayName = "TableHead";
|
|
|
7207
7258
|
var TableHead_default = TableHead;
|
|
7208
7259
|
|
|
7209
7260
|
// src/components/Table/TableRow.tsx
|
|
7210
|
-
var
|
|
7261
|
+
var import_react40 = __toESM(require("react"), 1);
|
|
7211
7262
|
var import_jsx_runtime348 = require("react/jsx-runtime");
|
|
7212
|
-
var TableRow =
|
|
7263
|
+
var TableRow = import_react40.default.memo((props) => {
|
|
7213
7264
|
const {
|
|
7214
7265
|
children,
|
|
7215
7266
|
type = "secondary",
|
|
@@ -7218,7 +7269,7 @@ var TableRow = import_react39.default.memo((props) => {
|
|
|
7218
7269
|
onClick
|
|
7219
7270
|
} = props;
|
|
7220
7271
|
const { rowBorderUse } = useTableContext();
|
|
7221
|
-
const [stickyCells, setStickyCells] =
|
|
7272
|
+
const [stickyCells, setStickyCells] = import_react40.default.useState([]);
|
|
7222
7273
|
const registerStickyCell = (ref) => {
|
|
7223
7274
|
setStickyCells((prev) => {
|
|
7224
7275
|
if (prev.includes(ref)) return prev;
|
|
@@ -7282,9 +7333,9 @@ Tag.displayName = "Tag";
|
|
|
7282
7333
|
var Tag_default = Tag;
|
|
7283
7334
|
|
|
7284
7335
|
// src/components/TextArea/TextArea.tsx
|
|
7285
|
-
var
|
|
7336
|
+
var import_react41 = __toESM(require("react"), 1);
|
|
7286
7337
|
var import_jsx_runtime350 = require("react/jsx-runtime");
|
|
7287
|
-
var TextArea =
|
|
7338
|
+
var TextArea = import_react41.default.forwardRef(
|
|
7288
7339
|
(props, ref) => {
|
|
7289
7340
|
const {
|
|
7290
7341
|
className,
|
|
@@ -7297,7 +7348,7 @@ var TextArea = import_react40.default.forwardRef(
|
|
|
7297
7348
|
disabled,
|
|
7298
7349
|
...textareaProps
|
|
7299
7350
|
} = props;
|
|
7300
|
-
const autoId =
|
|
7351
|
+
const autoId = import_react41.default.useId();
|
|
7301
7352
|
const fieldId = props.id ?? autoId;
|
|
7302
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)(
|
|
7303
7354
|
"textarea",
|
|
@@ -7319,7 +7370,7 @@ TextArea.displayName = "TextArea";
|
|
|
7319
7370
|
var TextArea_default = TextArea;
|
|
7320
7371
|
|
|
7321
7372
|
// src/components/TimePicker/TimePicker.tsx
|
|
7322
|
-
var
|
|
7373
|
+
var import_react42 = __toESM(require("react"), 1);
|
|
7323
7374
|
var import_jsx_runtime351 = require("react/jsx-runtime");
|
|
7324
7375
|
var ANIMATION_DURATION_MS4 = 200;
|
|
7325
7376
|
var toMinutes = (hhmm) => {
|
|
@@ -7357,13 +7408,13 @@ var TimePicker = (props) => {
|
|
|
7357
7408
|
required,
|
|
7358
7409
|
validations
|
|
7359
7410
|
} = 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 =
|
|
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(() => {
|
|
7367
7418
|
const safeStep = step > 0 && step <= 720 ? step : 30;
|
|
7368
7419
|
const lo = toMinutes(min) ?? 0;
|
|
7369
7420
|
const hi = toMinutes(max) ?? 24 * 60 - 1;
|
|
@@ -7371,7 +7422,7 @@ var TimePicker = (props) => {
|
|
|
7371
7422
|
for (let t = lo; t <= hi; t += safeStep) out.push(toHHmm(t));
|
|
7372
7423
|
return out;
|
|
7373
7424
|
}, [step, min, max]);
|
|
7374
|
-
const close =
|
|
7425
|
+
const close = import_react42.default.useCallback(() => setOpen(false), []);
|
|
7375
7426
|
useClickOutside_default([triggerRef, contentRef], close, isOpen);
|
|
7376
7427
|
useCloseWhenFocusHidden(isOpen, triggerRef, contentRef, close);
|
|
7377
7428
|
useEscapeKey(isOpen, () => {
|
|
@@ -7380,10 +7431,10 @@ var TimePicker = (props) => {
|
|
|
7380
7431
|
});
|
|
7381
7432
|
const host = useOverlayHost_default(triggerRef, mounted);
|
|
7382
7433
|
useAutoPosition_default(triggerRef, contentRef, mounted);
|
|
7383
|
-
|
|
7434
|
+
import_react42.default.useEffect(() => {
|
|
7384
7435
|
if (disabled && isOpen) setOpen(false);
|
|
7385
7436
|
}, [disabled, isOpen]);
|
|
7386
|
-
|
|
7437
|
+
import_react42.default.useEffect(() => {
|
|
7387
7438
|
if (isOpen) {
|
|
7388
7439
|
setMounted(true);
|
|
7389
7440
|
const t2 = setTimeout(() => setVisible(true), 1);
|
|
@@ -7455,20 +7506,20 @@ TimePicker.displayName = "TimePicker";
|
|
|
7455
7506
|
var TimePicker_default = TimePicker;
|
|
7456
7507
|
|
|
7457
7508
|
// src/components/Toast/Toast.tsx
|
|
7458
|
-
var
|
|
7509
|
+
var import_react43 = __toESM(require("react"), 1);
|
|
7459
7510
|
var import_react_dom4 = require("react-dom");
|
|
7460
7511
|
var import_jsx_runtime352 = require("react/jsx-runtime");
|
|
7461
|
-
var ToastContext =
|
|
7512
|
+
var ToastContext = import_react43.default.createContext(null);
|
|
7462
7513
|
var useToast = () => {
|
|
7463
|
-
const ctx =
|
|
7514
|
+
const ctx = import_react43.default.useContext(ToastContext);
|
|
7464
7515
|
if (!ctx) throw new Error("useToast must be used within ToastProvider");
|
|
7465
7516
|
return ctx;
|
|
7466
7517
|
};
|
|
7467
7518
|
var EXIT_DURATION = 300;
|
|
7468
7519
|
var ToastItemComponent = ({ item, isExiting, onClose }) => {
|
|
7469
|
-
const ref =
|
|
7470
|
-
const [height, setHeight] =
|
|
7471
|
-
|
|
7520
|
+
const ref = import_react43.default.useRef(null);
|
|
7521
|
+
const [height, setHeight] = import_react43.default.useState(void 0);
|
|
7522
|
+
import_react43.default.useEffect(() => {
|
|
7472
7523
|
if (ref.current && !isExiting) {
|
|
7473
7524
|
setHeight(ref.current.offsetHeight);
|
|
7474
7525
|
}
|
|
@@ -7500,13 +7551,13 @@ var ToastProvider = ({
|
|
|
7500
7551
|
children,
|
|
7501
7552
|
position = "top-right"
|
|
7502
7553
|
}) => {
|
|
7503
|
-
const [toasts, setToasts] =
|
|
7504
|
-
const [removing, setRemoving] =
|
|
7505
|
-
const [mounted, setMounted] =
|
|
7506
|
-
|
|
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(() => {
|
|
7507
7558
|
setMounted(true);
|
|
7508
7559
|
}, []);
|
|
7509
|
-
const remove =
|
|
7560
|
+
const remove = import_react43.default.useCallback((id) => {
|
|
7510
7561
|
setRemoving((prev) => new Set(prev).add(id));
|
|
7511
7562
|
setTimeout(() => {
|
|
7512
7563
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
@@ -7517,7 +7568,7 @@ var ToastProvider = ({
|
|
|
7517
7568
|
});
|
|
7518
7569
|
}, EXIT_DURATION);
|
|
7519
7570
|
}, []);
|
|
7520
|
-
const toast =
|
|
7571
|
+
const toast = import_react43.default.useCallback(
|
|
7521
7572
|
(type, message, duration = 3e3) => {
|
|
7522
7573
|
const id = `${Date.now()}-${Math.random()}`;
|
|
7523
7574
|
setToasts((prev) => [...prev, { id, type, message }]);
|
|
@@ -7570,7 +7621,7 @@ ToggleChip.displayName = "ToggleChip";
|
|
|
7570
7621
|
var ToggleChip_default = ToggleChip;
|
|
7571
7622
|
|
|
7572
7623
|
// src/components/Tooltip/Tooltip.tsx
|
|
7573
|
-
var
|
|
7624
|
+
var import_react44 = __toESM(require("react"), 1);
|
|
7574
7625
|
var import_jsx_runtime354 = require("react/jsx-runtime");
|
|
7575
7626
|
var OFFSET = 12;
|
|
7576
7627
|
var GAP = 8;
|
|
@@ -7586,14 +7637,14 @@ var Tooltip = (props) => {
|
|
|
7586
7637
|
disabled = false
|
|
7587
7638
|
} = props;
|
|
7588
7639
|
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 =
|
|
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) => {
|
|
7597
7648
|
const vw = window.innerWidth;
|
|
7598
7649
|
const vh = window.innerHeight;
|
|
7599
7650
|
return {
|
|
@@ -7601,7 +7652,7 @@ var Tooltip = (props) => {
|
|
|
7601
7652
|
top: Math.min(Math.max(GAP, top), Math.max(GAP, vh - h - GAP))
|
|
7602
7653
|
};
|
|
7603
7654
|
}, []);
|
|
7604
|
-
const placeAtCursor =
|
|
7655
|
+
const placeAtCursor = import_react44.default.useCallback((x, y) => {
|
|
7605
7656
|
const el = tooltipRef.current;
|
|
7606
7657
|
if (!el) return;
|
|
7607
7658
|
const w = el.offsetWidth;
|
|
@@ -7612,7 +7663,7 @@ var Tooltip = (props) => {
|
|
|
7612
7663
|
if (top < GAP) top = y + OFFSET;
|
|
7613
7664
|
setPos(clamp2(left, top, w, h));
|
|
7614
7665
|
}, [clamp2]);
|
|
7615
|
-
const placeAtTrigger =
|
|
7666
|
+
const placeAtTrigger = import_react44.default.useCallback(() => {
|
|
7616
7667
|
const el = tooltipRef.current;
|
|
7617
7668
|
const trigger = triggerRef.current;
|
|
7618
7669
|
if (!el || !trigger) return;
|
|
@@ -7624,19 +7675,19 @@ var Tooltip = (props) => {
|
|
|
7624
7675
|
const left = rect.left + rect.width / 2 - w / 2;
|
|
7625
7676
|
setPos(clamp2(left, top, w, h));
|
|
7626
7677
|
}, [clamp2]);
|
|
7627
|
-
const reposition =
|
|
7678
|
+
const reposition = import_react44.default.useCallback(() => {
|
|
7628
7679
|
if (follow && cursor.current) {
|
|
7629
7680
|
placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7630
7681
|
} else {
|
|
7631
7682
|
placeAtTrigger();
|
|
7632
7683
|
}
|
|
7633
7684
|
}, [follow, placeAtCursor, placeAtTrigger]);
|
|
7634
|
-
const handleMouseEnter =
|
|
7685
|
+
const handleMouseEnter = import_react44.default.useCallback((e) => {
|
|
7635
7686
|
if (disabled) return;
|
|
7636
7687
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7637
7688
|
delayTimer.current = window.setTimeout(() => setVisible(true), SHOW_DELAY);
|
|
7638
7689
|
}, [disabled]);
|
|
7639
|
-
const handleMouseMove =
|
|
7690
|
+
const handleMouseMove = import_react44.default.useCallback((e) => {
|
|
7640
7691
|
cursor.current = { x: e.clientX, y: e.clientY };
|
|
7641
7692
|
if (!visible || !follow) return;
|
|
7642
7693
|
cancelAnimationFrame(rafRef.current);
|
|
@@ -7644,25 +7695,25 @@ var Tooltip = (props) => {
|
|
|
7644
7695
|
if (cursor.current) placeAtCursor(cursor.current.x, cursor.current.y);
|
|
7645
7696
|
});
|
|
7646
7697
|
}, [visible, follow, placeAtCursor]);
|
|
7647
|
-
const close =
|
|
7698
|
+
const close = import_react44.default.useCallback(() => {
|
|
7648
7699
|
window.clearTimeout(delayTimer.current);
|
|
7649
7700
|
cancelAnimationFrame(rafRef.current);
|
|
7650
7701
|
setVisible(false);
|
|
7651
7702
|
}, []);
|
|
7652
|
-
const handleMouseLeave =
|
|
7703
|
+
const handleMouseLeave = import_react44.default.useCallback(() => {
|
|
7653
7704
|
cursor.current = null;
|
|
7654
7705
|
close();
|
|
7655
7706
|
}, [close]);
|
|
7656
|
-
const handleFocus =
|
|
7707
|
+
const handleFocus = import_react44.default.useCallback(() => {
|
|
7657
7708
|
if (disabled) return;
|
|
7658
7709
|
cursor.current = null;
|
|
7659
7710
|
setVisible(true);
|
|
7660
7711
|
}, [disabled]);
|
|
7661
|
-
|
|
7712
|
+
import_react44.default.useLayoutEffect(() => {
|
|
7662
7713
|
if (!visible) return;
|
|
7663
7714
|
reposition();
|
|
7664
7715
|
}, [visible, reposition]);
|
|
7665
|
-
|
|
7716
|
+
import_react44.default.useEffect(() => {
|
|
7666
7717
|
if (!visible || follow) return;
|
|
7667
7718
|
const onChange = () => placeAtTrigger();
|
|
7668
7719
|
window.addEventListener("scroll", onChange, true);
|
|
@@ -7672,7 +7723,7 @@ var Tooltip = (props) => {
|
|
|
7672
7723
|
window.removeEventListener("resize", onChange);
|
|
7673
7724
|
};
|
|
7674
7725
|
}, [visible, follow, placeAtTrigger]);
|
|
7675
|
-
|
|
7726
|
+
import_react44.default.useEffect(() => () => {
|
|
7676
7727
|
window.clearTimeout(delayTimer.current);
|
|
7677
7728
|
cancelAnimationFrame(rafRef.current);
|
|
7678
7729
|
}, []);
|
|
@@ -7711,10 +7762,10 @@ Tooltip.displayName = "Tooltip";
|
|
|
7711
7762
|
var Tooltip_default = Tooltip;
|
|
7712
7763
|
|
|
7713
7764
|
// src/components/Tour/Tour.tsx
|
|
7714
|
-
var
|
|
7765
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
7715
7766
|
|
|
7716
7767
|
// src/tokens/hooks/useScrollLock.ts
|
|
7717
|
-
var
|
|
7768
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
7718
7769
|
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
7719
7770
|
" ",
|
|
7720
7771
|
"PageUp",
|
|
@@ -7727,7 +7778,7 @@ var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
|
7727
7778
|
"ArrowRight"
|
|
7728
7779
|
]);
|
|
7729
7780
|
var useScrollLock = (enabled, allowRef) => {
|
|
7730
|
-
|
|
7781
|
+
import_react45.default.useEffect(() => {
|
|
7731
7782
|
if (!enabled) return;
|
|
7732
7783
|
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
7733
7784
|
const block = (e) => {
|
|
@@ -7777,14 +7828,14 @@ var Tour = (props) => {
|
|
|
7777
7828
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
7778
7829
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
7779
7830
|
} = props;
|
|
7780
|
-
const [uncontrolled, setUncontrolled] =
|
|
7831
|
+
const [uncontrolled, setUncontrolled] = import_react46.default.useState(0);
|
|
7781
7832
|
const index = current ?? uncontrolled;
|
|
7782
7833
|
const step = steps[index];
|
|
7783
7834
|
const isLast = index === steps.length - 1;
|
|
7784
|
-
const spotRef =
|
|
7785
|
-
const cardRef =
|
|
7786
|
-
const [targetFound, setTargetFound] =
|
|
7787
|
-
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(
|
|
7788
7839
|
(next) => {
|
|
7789
7840
|
if (current === void 0) setUncontrolled(next);
|
|
7790
7841
|
onStepChange?.(next);
|
|
@@ -7794,9 +7845,9 @@ var Tour = (props) => {
|
|
|
7794
7845
|
useEscapeKey(open, () => onClose("skip"));
|
|
7795
7846
|
useFocusTrap(cardRef, open, { trap: true });
|
|
7796
7847
|
useScrollLock_default(open, cardRef);
|
|
7797
|
-
const stepsRef =
|
|
7848
|
+
const stepsRef = import_react46.default.useRef(steps);
|
|
7798
7849
|
stepsRef.current = steps;
|
|
7799
|
-
|
|
7850
|
+
import_react46.default.useEffect(() => {
|
|
7800
7851
|
if (!open) return;
|
|
7801
7852
|
const target = stepsRef.current[index]?.target;
|
|
7802
7853
|
if (!target) return;
|
|
@@ -7821,7 +7872,7 @@ var Tour = (props) => {
|
|
|
7821
7872
|
stop = true;
|
|
7822
7873
|
};
|
|
7823
7874
|
}, [open, index]);
|
|
7824
|
-
const place =
|
|
7875
|
+
const place = import_react46.default.useCallback(() => {
|
|
7825
7876
|
const spot = spotRef.current;
|
|
7826
7877
|
const card = cardRef.current;
|
|
7827
7878
|
if (!spot || !card || !step) return;
|
|
@@ -7868,7 +7919,7 @@ var Tour = (props) => {
|
|
|
7868
7919
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
7869
7920
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
7870
7921
|
}, [step]);
|
|
7871
|
-
|
|
7922
|
+
import_react46.default.useLayoutEffect(() => {
|
|
7872
7923
|
if (!open) return;
|
|
7873
7924
|
place();
|
|
7874
7925
|
let raf = 0;
|
|
@@ -7885,7 +7936,7 @@ var Tour = (props) => {
|
|
|
7885
7936
|
raf = requestAnimationFrame(follow);
|
|
7886
7937
|
return () => cancelAnimationFrame(raf);
|
|
7887
7938
|
}, [open, index, place]);
|
|
7888
|
-
|
|
7939
|
+
import_react46.default.useEffect(() => {
|
|
7889
7940
|
if (!open) return;
|
|
7890
7941
|
const onMove = () => place();
|
|
7891
7942
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -7950,7 +8001,7 @@ Tour.displayName = "Tour";
|
|
|
7950
8001
|
var Tour_default = Tour;
|
|
7951
8002
|
|
|
7952
8003
|
// src/components/Video/Video.tsx
|
|
7953
|
-
var
|
|
8004
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
7954
8005
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
7955
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: [
|
|
7956
8007
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -7962,7 +8013,7 @@ var formatTime = (sec) => {
|
|
|
7962
8013
|
const s = Math.floor(sec % 60);
|
|
7963
8014
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
7964
8015
|
};
|
|
7965
|
-
var Video =
|
|
8016
|
+
var Video = import_react47.default.forwardRef((props, ref) => {
|
|
7966
8017
|
const {
|
|
7967
8018
|
src,
|
|
7968
8019
|
poster,
|
|
@@ -7986,21 +8037,21 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
7986
8037
|
children,
|
|
7987
8038
|
...rest
|
|
7988
8039
|
} = 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 =
|
|
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(
|
|
8004
8055
|
(el) => {
|
|
8005
8056
|
videoRef.current = el;
|
|
8006
8057
|
if (typeof ref === "function") ref(el);
|
|
@@ -8008,14 +8059,14 @@ var Video = import_react46.default.forwardRef((props, ref) => {
|
|
|
8008
8059
|
},
|
|
8009
8060
|
[ref]
|
|
8010
8061
|
);
|
|
8011
|
-
|
|
8062
|
+
import_react47.default.useEffect(() => {
|
|
8012
8063
|
const onFsChange = () => {
|
|
8013
8064
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
8014
8065
|
};
|
|
8015
8066
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
8016
8067
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
8017
8068
|
}, []);
|
|
8018
|
-
|
|
8069
|
+
import_react47.default.useEffect(() => {
|
|
8019
8070
|
const v = videoRef.current;
|
|
8020
8071
|
if (!v) return;
|
|
8021
8072
|
const onEnter = () => setIsPip(true);
|